@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f5f1e8;
  --ink: #162826;
  --muted: #64756f;
  --surface: rgba(255, 252, 246, 0.94);
  --surface-soft: #f5f0e7;
  --border: rgba(22, 40, 38, 0.12);
  --primary: #0f766e;
  --primary-deep: #0b4f4a;
  --accent: #d0893b;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(22, 40, 38, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(208, 137, 59, 0.12), transparent 22%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 26%),
    linear-gradient(180deg, #f7f2e8, #edf4f1 48%, #eef3f8);
}

h1, h2, h3 {
  margin: 0;
  font-family: 'Fraunces', serif;
  letter-spacing: -0.02em;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(22, 40, 38, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.86);
}

input:focus, textarea:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.admin-shell {
  width: min(1640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.card {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 800;
  color: #386964;
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: rgba(56, 105, 100, 0.5);
}

.subtitle, .meta-text, .status-text, .empty-text {
  color: var(--muted);
}

.metrics-inline {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  background: rgba(233, 248, 243, 0.82);
  color: #1e5f57;
  font-size: 12px;
  font-weight: 700;
}

.auth-card {
  width: min(520px, 100%);
  margin: 8vh auto 0;
  padding: 28px;
}

.auth-card h1 {
  margin-top: 8px;
  font-size: 36px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form label, .field {
  display: grid;
  gap: 8px;
}

.topbar {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(247, 240, 228, 0.94));
}

.topbar h1 {
  margin-top: 8px;
  font-size: clamp(28px, 2.4vw, 42px);
}

.top-actions, .panel-actions, .storage-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.layout {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
}

.sidebar {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 16px;
}

.case-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.case-item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 240, 228, 0.88));
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.case-item:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.28);
}

.case-item.active {
  border-color: rgba(15, 118, 110, 0.36);
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.08);
}

.content {
  display: grid;
  gap: 20px;
}

.panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.status-banner {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(42, 122, 82, 0.22);
  background: linear-gradient(180deg, rgba(233, 250, 238, 0.92), rgba(245, 255, 248, 0.98));
  color: #166534;
  font-weight: 700;
}

.status-banner.error {
  border-color: rgba(180, 35, 24, 0.22);
  background: linear-gradient(180deg, rgba(255, 239, 239, 0.95), rgba(255, 248, 247, 0.98));
  color: #9f1239;
}

.missing-report { display: grid; gap: 12px; margin-bottom: 16px; }
.missing-block { display: grid; gap: 8px; }
.missing-chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.missing-chip, .path-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(208, 137, 59, 0.32);
  background: rgba(255, 243, 222, 0.92);
  color: #8a5b00;
  font-size: 12px;
  font-weight: 800;
}

.path-chip {
  border-color: rgba(15, 118, 110, 0.2);
  background: rgba(232, 248, 245, 0.9);
  color: #165950;
}

.section-start td {
  border-top: 2px solid rgba(15, 118, 110, 0.16);
}

.admin-choice-row, .admin-choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.admin-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-choice-row label, .admin-choice-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(22, 40, 38, 0.1);
  background: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.admin-choice-row input, .admin-choice-grid input {
  width: auto;
  margin: 0;
}

.audit-log {
  display: grid;
  gap: 10px;
}

.audit-item {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 248, 246, 0.88));
}

.audit-item p {
  margin: 6px 0 0;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
}

.btn {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #c26f25 38%, var(--primary));
  color: #fff;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(15, 118, 110, 0.16);
  color: #15443e;
}

.btn.danger {
  background: rgba(255, 242, 241, 0.96);
  border-color: rgba(180, 35, 24, 0.16);
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.small-btn {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .panel-header, .topbar {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .admin-shell {
    width: min(100% - 20px, 1640px);
    padding-top: 12px;
  }

  .auth-card,
  .panel,
  .sidebar,
  .topbar {
    padding: 16px;
    border-radius: 22px;
  }

  .top-actions,
  .panel-actions,
  .storage-toolbar {
    display: grid;
    width: 100%;
  }

  .btn {
    width: 100%;
  }
}
