:root {
  --navy: #0b2146;
  --ink: #172033;
  --muted: #6b7280;
  --teal: #13b9a8;
  --blue: #2d5f9f;
  --orange: #f59e0b;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --line: #dde5ef;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.eyebrow,
.small,
.admin-contact span {
  color: var(--muted);
  font-size: 0.82rem;
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item,
.icon-button,
.primary {
  border: 0;
  cursor: pointer;
}

.nav-item {
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(19, 185, 168, 0.12);
  color: var(--navy);
}

.admin-contact {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
}

a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.main {
  min-width: 0;
  padding: 26px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1rem;
}

.toolbar {
  display: flex;
  gap: 10px;
}

input,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}

#global-search {
  width: min(360px, 42vw);
}

.primary,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: var(--navy);
  font-weight: 800;
}

.icon-button {
  background: var(--teal);
}

.section {
  display: none;
}

.section.active {
  display: grid;
  gap: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.panel,
.record-form,
.table {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
  display: grid;
  gap: 4px;
}

.metric span,
.metric em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.metric strong {
  font-size: 1.9rem;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.record-form,
.stacked-form {
  display: grid;
  gap: 10px;
}

.record-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  padding: 14px;
}

.stacked-form {
  max-width: 560px;
}

.table,
.list {
  overflow: hidden;
}

.row,
.list-item {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.row:last-child,
.list-item:last-child {
  border-bottom: 0;
}

.row small,
.list-item small {
  color: var(--muted);
}

.status {
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(19, 185, 168, 0.12);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 800;
}

.warning {
  background: rgba(245, 158, 11, 0.16);
}

.notice {
  min-height: 28px;
  color: var(--blue);
  font-weight: 800;
}

.checklist {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.legal-page {
  max-width: 920px;
  margin: 0 auto;
}

.legal-page .panel {
  gap: 16px;
  line-height: 1.55;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar,
  .toolbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  #global-search,
  .toolbar button {
    width: 100%;
  }

  .metrics,
  .panel-grid,
  .record-form {
    grid-template-columns: 1fr;
  }

  .row,
  .list-item {
    grid-template-columns: 1fr;
  }
}
