:root {
  --bg: #f5efe1;
  --surface: rgba(255, 250, 240, 0.9);
  --surface-strong: #fffdf8;
  --line: rgba(54, 43, 20, 0.12);
  --text: #26190d;
  --muted: #6f5d4f;
  --red: #c7222a;
  --blue: #233b8f;
  --gold: #f3cf49;
  --shadow: 0 24px 60px rgba(35, 28, 18, 0.15);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(243, 207, 73, 0.35), transparent 28%),
    radial-gradient(circle at right center, rgba(199, 34, 42, 0.14), transparent 30%),
    linear-gradient(135deg, #f8f0d8 0%, #f4efe7 42%, #efe6cf 100%);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

textarea,
input,
select,
button {
  font: inherit;
}

.login-page .auth-shell,
.dashboard-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: stretch;
  min-height: 100vh;
}

.brand-panel,
.panel-card,
.hero-card,
.stat-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand-panel {
  border-radius: 36px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(35, 59, 143, 0.18), transparent 68%);
}

.brand-mark {
  width: 148px;
  padding: 14px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,0.74), rgba(255,255,255,0.3));
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  color: var(--red);
  font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
  margin-bottom: 18px;
}

.lead {
  font-size: 1.08rem;
  line-height: 1.7;
  max-width: 54ch;
  color: var(--muted);
}

.info-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.info-strip span,
.stat-pill,
.entry-meta span {
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.entry-meta .relief-badge {
  font-weight: 800;
}

.entry-meta .relief-badge-required {
  color: #8f171d;
  border-color: rgba(199, 34, 42, 0.3);
  background: rgba(255, 226, 229, 0.96);
}

.entry-meta .relief-badge-not-required {
  color: #17633d;
  border-color: rgba(31, 134, 86, 0.28);
  background: rgba(219, 249, 232, 0.96);
}

.entry-meta .relief-badge-na {
  color: #35506f;
  border-color: rgba(86, 118, 154, 0.24);
  background: rgba(232, 240, 249, 0.96);
}

.login-panel {
  display: flex;
  align-items: center;
}

.panel-card {
  border-radius: var(--radius-xl);
  padding: 28px;
}

.tab-row {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  background: rgba(35, 59, 143, 0.08);
  border-radius: 999px;
  margin-bottom: 22px;
}

.tab-button,
.primary-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.tab-button {
  padding: 12px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab-button.is-active {
  background: var(--blue);
  color: #fff;
}

.tab-pane {
  display: none;
}

.tab-pane.is-active {
  display: block;
}

.muted {
  color: var(--muted);
}

.stack-form,
.inline-filter,
.field-row {
  display: grid;
  gap: 16px;
}

.stack-form label,
.inline-filter label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid rgba(53, 37, 20, 0.14);
  background: rgba(255, 255, 255, 0.9);
  padding: 14px 16px;
  color: var(--text);
}

textarea {
  resize: vertical;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  font-weight: 700;
  margin-bottom: 8px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--red), #e65436);
  color: #fff;
}

.primary-button.secondary-tone,
.ghost-button.dark {
  background: linear-gradient(135deg, var(--blue), #3557bf);
  color: #fff;
}

.danger-button {
  color: #8c1520;
  border-color: rgba(199, 34, 42, 0.28);
  background: rgba(199, 34, 42, 0.1);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.logout-button,
.logout-button:hover {
  background: linear-gradient(135deg, var(--red), #e65436);
  color: #fff;
  border-color: rgba(199, 34, 42, 0.25);
}

.primary-button:hover,
.ghost-button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.alert {
  padding: 14px 16px;
  border-radius: 16px;
  margin-bottom: 18px;
}

.alert-danger {
  background: rgba(199, 34, 42, 0.12);
  border: 1px solid rgba(199, 34, 42, 0.2);
  color: #8c1520;
}

.alert-success {
  background: rgba(35, 128, 73, 0.12);
  border: 1px solid rgba(35, 128, 73, 0.2);
  color: #1b6c3e;
}

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

.topbar h1 {
  max-width: 920px;
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 1.02;
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.dashboard-brand {
  display: flex;
  gap: 18px;
  align-items: center;
}

.dashboard-brand img {
  width: 86px;
  height: 86px;
  object-fit: contain;
  filter: drop-shadow(0 12px 20px rgba(18, 24, 38, 0.12));
}

.hero-card {
  padding: 28px;
  border-radius: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
}

.hero-card h2 {
  margin-bottom: 14px;
}

.hero-card .inline-filter {
  width: min(420px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.hero-card .inline-filter .ghost-button {
  grid-column: 1 / -1;
}

.summary-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 700;
}

.summary-count-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 12px;
  max-width: 520px;
}

.summary-count-grid article {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(35, 59, 143, 0.16);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(235, 241, 255, 0.72));
}

.summary-count-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-count-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--blue);
  font-size: 2.15rem;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
}

.admin-grid {
  grid-template-columns: 0.92fr 1.08fr;
}

.section-heading,
.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.inline-action-form {
  margin: 0;
}

.entry-list,
.admin-entry-list {
  display: grid;
  gap: 14px;
}

.entry-card,
.category-group,
.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 10px;
}

.entry-subline {
  display: block;
  margin-top: -2px;
  font-size: 0.82rem;
  line-height: 1.15;
}

.entry-category-line {
  display: block;
  margin-top: 8px;
  line-height: 1.2;
}

.empty-state {
  text-align: center;
  padding: 36px 22px;
}

.compact-empty {
  padding: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.section-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

.section-link,
.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  font-weight: 700;
  color: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.section-link:hover,
.dropdown-trigger:hover {
  transform: translateY(-1px);
}

.section-link.is-active,
.dropdown-trigger.is-active {
  background: linear-gradient(135deg, var(--blue), #3557bf);
  color: #fff;
}

.section-dropdown {
  position: relative;
}

.dropdown-trigger {
  cursor: pointer;
}

.section-dropdown-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  min-width: 240px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 18px 44px rgba(35, 28, 18, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.section-dropdown:hover .section-dropdown-menu,
.section-dropdown:focus-within .section-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.section-dropdown-menu a {
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 800;
}

.section-dropdown-menu a:hover,
.section-dropdown-menu a.is-active {
  background: rgba(35, 59, 143, 0.1);
  color: var(--blue);
}

.stat-card {
  border-radius: 18px;
  padding: 18px;
}

.stat-card p {
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card h3 {
  margin: 0;
  font-size: 1.9rem;
}

.stat-card-accent {
  background: linear-gradient(135deg, rgba(35, 59, 143, 0.9), rgba(199, 34, 42, 0.78));
  color: #fff;
}

.stat-card-accent p {
  color: rgba(255, 255, 255, 0.84);
}

.category-summary-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

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

.category-detail-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.category-detail-card h4 {
  margin-bottom: 6px;
}

.category-detail-card p {
  margin-bottom: 8px;
}

.category-detail-meta {
  justify-content: flex-end;
  margin: 0;
}

.category-empty {
  margin: 12px 0 0;
}

.admin-tools-grid {
  grid-template-columns: 1fr 0.95fr;
  margin-bottom: 20px;
}

.panel-span-full {
  grid-column: 1 / -1;
}

.staff-filter {
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: end;
  margin: 18px 0;
}

.staff-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.staff-record-panel {
  margin: 18px 0 20px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(35, 59, 143, 0.18);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(235, 241, 255, 0.78));
  box-shadow: 0 18px 44px rgba(35, 59, 143, 0.08);
  scroll-margin-top: 18px;
}

.record-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.record-stat-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
}

.record-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.record-stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 1.35rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tr.is-selected-row td {
  background: rgba(35, 59, 143, 0.08);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.multi-name-list {
  display: grid;
  gap: 10px;
}

.form-label {
  color: var(--muted);
  font-weight: 700;
}

.multi-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.multi-name-row button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.add-name-button {
  justify-self: start;
}

.name-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.name-chip-list span {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(35, 59, 143, 0.18);
  background: rgba(235, 241, 255, 0.9);
  color: var(--blue);
  font-weight: 800;
  font-size: 0.88rem;
}

.pagination-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  font-weight: 700;
  color: var(--muted);
}

.pagination-link.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #3557bf);
}

.summary-box {
  min-height: 420px;
  white-space: pre-wrap;
  line-height: 1.55;
}

.compact-card {
  padding: 16px;
}

@media (max-width: 980px) {
  .auth-shell,
  .content-grid,
  .admin-grid,
  .admin-tools-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-panel {
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .auth-shell,
  .dashboard-shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0 32px;
  }

  .brand-panel,
  .panel-card,
  .hero-card {
    padding: 22px;
    border-radius: 22px;
  }

  .topbar,
  .hero-card,
  .staff-filter {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-brand img {
    width: 58px;
    height: 58px;
  }

  .topbar h1 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .summary-count-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .staff-filter {
    grid-template-columns: 1fr;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 721px) {
  .field-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
