:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #272f3b;
  --blue: #3d6fab;
  --blue-dark: #2f5f99;
  --blue-soft: #edf4ff;
  --ink: #242b36;
  --muted: #697486;
  --line: #e5eaf2;
  --panel: #ffffff;
  --success: #68b36b;
  --danger: #ef4f5f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f7fb;
}

a {
  color: var(--blue-dark);
}

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

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    linear-gradient(90deg, rgba(61, 111, 171, 0.08), rgba(255, 255, 255, 0)),
    #f4f7fb;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.35rem 1rem;
  background: var(--blue);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.brand-lockup {
  color: #fff;
  text-decoration: none;
  display: grid;
  gap: 0.1rem;
  padding: 0.25rem 0.55rem 1.4rem;
}

.brand-title {
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-subtitle {
  font-size: 0.73rem;
  opacity: 0.82;
}

.side-nav {
  display: grid;
  gap: 0.35rem;
}

.side-nav a,
.logout-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.68rem 0.75rem;
  border-radius: 4px;
  color: #eef6ff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.side-nav a:hover,
.logout-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.side-nav a.active {
  background: #fff;
  color: var(--ink);
}

.nav-icon {
  width: 24px;
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid currentColor;
  font-size: 0.62rem;
  font-weight: 800;
  opacity: 0.85;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 0.5rem;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.avatar-dot {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #d9e8ff;
  color: var(--blue-dark);
  font-size: 0.75rem;
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
}

.breadcrumb {
  color: var(--muted);
  font-weight: 800;
}

.topbar-actions,
.heading-actions,
.heading-row,
.section-title-row,
.panel-header,
.panel-actions,
.form-actions,
.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.heading-row,
.section-title-row,
.panel-header {
  justify-content: space-between;
}

.page-content {
  width: min(1280px, calc(100% - 4rem));
  margin: 0 auto 3rem;
}

.page-heading {
  margin-bottom: 1.5rem;
}

.eyebrow {
  display: inline-block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0.25rem 0 0.45rem;
  font-size: clamp(2rem, 3vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.page-heading p,
.section-title-row p,
.panel-header p {
  margin: 0;
  color: var(--muted);
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 2rem;
}

.metric-cell {
  min-height: 108px;
  padding: 1.2rem 1.35rem;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 0.25rem;
}

.metric-cell:last-child {
  border-right: none;
}

.metric-cell span,
.metric-cell small,
.detail-item span,
.mini-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-cell strong {
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  color: var(--ink);
}

.metric-cell small,
.policy-row small,
.document-row small {
  display: block;
  text-transform: none;
  font-weight: 600;
}

.content-section,
.detail-card,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.4rem;
  margin-bottom: 1.5rem;
}

.section-title-row {
  margin-bottom: 1rem;
}

.section-title-row h2,
.panel h1,
.panel h2,
.section-block h3 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.policy-list {
  display: grid;
  gap: 0.5rem;
}

.policy-list-header,
.policy-row {
  display: grid;
  grid-template-columns: 3px minmax(220px, 1.8fr) minmax(130px, 1fr) minmax(112px, 0.75fr) minmax(105px, 0.8fr) minmax(100px, 0.75fr) 72px;
  align-items: center;
  gap: 1rem;
}

.policy-list-header {
  padding: 0.25rem 1rem 0.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.policy-list-header span:first-child {
  grid-column: 2;
}

.policy-row {
  min-height: 74px;
  position: relative;
  padding: 0 1rem 0 0;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid #edf1f7;
  border-radius: 4px;
  box-shadow: 0 3px 12px rgba(38, 55, 77, 0.04);
}

.policy-row:hover {
  border-color: #c9d9ee;
  transform: translateY(-1px);
}

.policy-accent {
  width: 3px;
  height: 100%;
  border-radius: 4px 0 0 4px;
}

.accent-0 { background: #ffce3f; }
.accent-1 { background: #f45f68; }
.accent-2 { background: #b54bb5; }
.accent-3 { background: #f278b2; }
.accent-4 { background: #2e323a; }
.accent-5 { background: #82c94c; }

.policy-name strong,
.document-row strong {
  display: block;
  color: var(--ink);
}

.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.danger {
  background: var(--danger);
}

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #eef2f6;
  font-weight: 800;
}

.row-action,
.text-link,
.document-row em {
  color: var(--blue-dark);
  font-weight: 800;
  text-decoration: none;
  font-style: normal;
}

.policy-title-line {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.provider-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #ffdc35;
  color: #151515;
  font-size: 0.75rem;
  font-weight: 900;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem 2rem;
}

.detail-item {
  min-height: 64px;
  border-bottom: 1px solid #aeb8c7;
  display: grid;
  align-content: start;
  gap: 0.3rem;
  padding-bottom: 0.8rem;
}

.detail-item strong {
  font-size: 1.04rem;
  color: var(--ink);
}

.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 1.5rem;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mini-card,
.stat-card {
  min-height: 86px;
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
  display: grid;
  gap: 0.35rem;
}

.mini-card strong,
.stat-card h2 {
  font-size: 1.25rem;
}

.document-list {
  max-height: 310px;
  overflow: auto;
  display: grid;
  gap: 0.4rem;
  padding-right: 0.35rem;
}

.document-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.document-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  background: #ffe8e8;
  color: #c74444;
  font-size: 0.68rem;
  font-weight: 900;
}

.page-grid {
  display: grid;
  gap: 1.5rem;
}

.stats-grid,
.policy-meta-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

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

.data-table th {
  color: var(--muted);
  font-size: 0.86rem;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 0.9rem;
}

.form-grid {
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  align-items: center;
}

.form-grid .form-actions,
.form-grid textarea,
.form-grid h2 {
  grid-column: 2;
}

.form-grid textarea {
  min-height: 120px;
}

.form-grid label,
.form-stack label {
  font-weight: 800;
  color: var(--ink);
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.78rem 0.9rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

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

button,
.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.78rem 1.05rem;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}

.button-primary {
  background: #4287ee;
  color: #fff;
}

.button-primary:hover {
  background: #2f72db;
}

.button-secondary {
  background: #fff;
  color: var(--blue-dark);
  border-color: #7ea6d8;
}

.inline-form {
  display: inline-block;
}

.section-block {
  margin-top: 1.5rem;
}

.details-list {
  display: grid;
  gap: 0.75rem;
}

.details-list dt {
  font-weight: 800;
}

.details-list dd {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.toast {
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.toast-error {
  background: #fff1f2;
  color: #a81d2b;
  border-color: #ffcdd4;
}

.toast-success {
  background: #eefbf2;
  color: #166534;
  border-color: #bce9ca;
}

.panel-center {
  width: min(420px, 100%);
  margin: auto;
}

.panel-center h1 {
  font-size: 2rem;
  margin-bottom: 1.25rem;
}

.empty-state {
  padding: 2rem;
  border: 1px dashed #c7d4e5;
  border-radius: 6px;
  background: #fbfdff;
}

.empty-state.compact {
  padding: 1.2rem;
}

.empty-state h3 {
  margin: 0 0 0.3rem;
}

.empty-state p {
  margin-top: 0;
  color: var(--muted);
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}

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

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

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

  .sidebar-footer {
    display: none;
  }

  .topbar {
    height: auto;
    padding: 1rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .page-content {
    width: min(100% - 2rem, 1280px);
  }

  .overview-strip,
  .detail-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }

  .metric-cell {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .metric-cell:last-child {
    border-bottom: none;
  }

  .policy-list-header {
    display: none;
  }

  .policy-row {
    grid-template-columns: 3px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.85rem 1rem 0.85rem 0;
  }

  .policy-row > span:not(.policy-accent):not(.policy-name) {
    grid-column: 2;
  }

  .heading-row,
  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .topbar-actions,
  .heading-actions,
  .page-actions,
  .mini-metrics {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .form-actions,
  .form-grid textarea,
  .form-grid h2 {
    grid-column: 1;
  }

  .document-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .document-row em {
    grid-column: 2;
  }
}
