:root {
  color-scheme: light;
  --bg: #F9F6F1;
  --panel: #ffffff;
  --panel-soft: #fffdf9;
  --ink: #1b2f3d;
  --muted: #6d6a63;
  --line: #ddd5ca;
  --brand: #1E445C;
  --brand-dark: #143346;
  --brand-soft: #e7eef1;
  --sand: #F9F6F1;
  --sand-strong: #efe6d9;
  --good: #287a4a;
  --good-soft: #e7f3ec;
  --warn: #a96218;
  --warn-soft: #fff1d9;
  --bad: #a8332c;
  --bad-soft: #fae6e4;
  --purple: #6b5578;
  --purple-soft: #f0e9f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  --primary: var(--brand);
  --primary-hover: var(--brand-dark);
  --text: var(--ink);
  --text-muted: var(--muted);
  --border-color: var(--line);
  --surface: var(--panel);
  --surface-alt: var(--panel-soft);
  --nav-text: #ffffff;
  --footer-bg: var(--brand);
  --footer-text: #e7eef1;
  --card-highlight: var(--brand);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

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

.app-shell.no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.top-nav {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  border-bottom: 1px solid #cfd6e0;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 5;
}

.brand-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 100%;
  min-width: 0;
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.top-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 220px;
}

.top-brand-text {
  color: var(--brand);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.primary-nav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  height: 100%;
}

.nav-button {
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 0;
  margin-bottom: 0;
  color: var(--brand);
  background: transparent;
  text-align: left;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 650;
}

.nav-button:hover,
.nav-button.active {
  background: var(--sand);
  border-bottom-color: var(--brand);
  text-decoration: none;
}

.nav-count {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
}

.user-menu {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.user-menu-button {
  height: 100%;
  padding: 0 12px;
  background: transparent;
  color: var(--brand);
  border-left: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
}

.user-menu-button:hover,
.user-menu.open .user-menu-button {
  background: #fff;
}

.user-menu-panel {
  display: none;
  position: absolute;
  top: 41px;
  right: 0;
  width: 190px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 10;
}

.user-menu.open .user-menu-panel {
  display: block;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  color: #263342;
  font-size: 13px;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--sand);
  text-decoration: none;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  background: var(--sand);
  color: #263342;
  padding: 8px;
  position: sticky;
  top: 44px;
  height: calc(100vh - 44px);
  overflow-y: auto;
  border-right: 1px solid #cfd6e0;
}

.app-shell.no-sidebar .sidebar {
  display: none;
}

.main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 10px 12px 12px;
}

.app-shell.no-sidebar .main {
  grid-column: 1;
}

.page-header {
  margin-bottom: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 650;
}

.page-title {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.page-copy {
  color: var(--muted);
  max-width: 780px;
  line-height: 1.55;
  margin: 8px 0 0;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.top-actions,
.filters,
.download-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.top-actions {
  justify-content: flex-end;
}

.status-filter-links {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0;
}

.status-filter-link {
  border-radius: 999px;
  color: var(--ink);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 650;
}

.status-filter-separator {
  color: var(--muted);
  font-size: 12px;
}

.status-filter-link:hover,
.status-filter-link.active {
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
}

.status-filter-link.active {
  box-shadow: inset 0 0 0 1px var(--brand);
}

.rejection-detail {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 3px solid var(--bad);
  background: var(--bad-soft);
  color: var(--ink);
}

.sort-link {
  color: inherit;
  font-weight: inherit;
}

.sort-link:hover {
  color: var(--brand);
  text-decoration: none;
}

.panel,
.metric-card,
.mini-card,
.site-card,
.record-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.panel {
  overflow: hidden;
  margin-top: 10px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--sand);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  letter-spacing: -0.01em;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.panel-header p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.panel-body {
  padding: 12px;
}

.table-host {
  height: calc(100vh - 142px);
  min-height: 420px;
  background: #fff;
}

.tabulator {
  border: 0;
  background: #fff;
  font-size: 13px;
  color: #263342;
}

.tabulator .tabulator-header {
  border-bottom: 1px solid var(--line);
  background: var(--sand);
}

.tabulator .tabulator-header .tabulator-col {
  background: var(--sand);
  border-right: 1px solid var(--line);
  color: var(--brand);
  font-weight: 650;
}

.tabulator-row {
  border-bottom: 1px solid #eee5da;
  min-height: 32px;
}

.tabulator-row.tabulator-row-even {
  background: var(--panel-soft);
}

.tabulator-row .tabulator-cell {
  border-right: 1px solid #eee5da;
  padding: 6px 9px;
  line-height: 1.35;
}

.tabulator-row.new-lien {
  font-weight: 650;
}

.status-text {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #d7dfeb;
  padding: 2px 7px;
  background: #f8fafd;
  font-size: 11px;
  font-weight: 650;
  color: #43516a;
  white-space: nowrap;
}

.status-text.ready,
.status-text.healthy,
.status-text.new,
.status-text.active-healthy {
  border-color: #bfe7d5;
  background: var(--good-soft);
  color: var(--good);
}

.status-text.down,
.status-text.active-down {
  border-color: #f2caca;
  background: var(--bad-soft);
  color: var(--bad);
}

.status-text.progress {
  border-color: #bfd0ff;
  background: var(--brand-soft);
  color: var(--brand);
}

.status-text.planned,
.status-text.downloaded {
  border-color: #d7dfeb;
  background: #f2f5fa;
  color: #607089;
}

.search,
.select,
.field input,
.field select,
.field textarea,
.form-control,
.form-select {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  min-height: 32px;
  padding: 6px 9px;
  color: var(--ink);
  outline: none;
  font-size: 13px;
}

.search {
  min-width: min(340px, 100%);
}

.field {
  display: grid;
  gap: 5px;
}

.field label,
.form-label {
  color: #40506a;
  font-weight: 650;
  font-size: 12px;
}

textarea,
.field textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

.button,
.btn-primary,
.btn-outline-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 4px;
  min-height: 32px;
  padding: 7px 11px;
  font-weight: 650;
  font-size: 13px;
  box-shadow: none;
}

.button,
.btn-primary {
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
}

.button:hover,
.btn-primary:hover {
  color: #fff;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  text-decoration: none;
}

.button.secondary,
.btn-outline-primary,
.btn-secondary {
  color: var(--ink);
  background: var(--sand);
  border: 1px solid var(--line);
}

.button.secondary:hover,
.btn-outline-primary:hover,
.btn-secondary:hover {
  color: var(--ink);
  background: var(--sand-strong);
  border-color: var(--line);
}

.button.good {
  color: #fff;
  background: var(--good);
}

.button.warn {
  color: #583600;
  background: #f7c668;
}

.button.danger {
  color: #fff;
  background: var(--bad);
}

.row-action,
.ghost-button {
  color: var(--brand);
  background: transparent;
  font-weight: 650;
  padding: 0;
}

.row-action[disabled] {
  color: #9aa6ba;
  cursor: not-allowed;
}

.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #bfe7d5;
  background: var(--good-soft);
  color: #07593d;
  box-shadow: none;
}

.alert-danger {
  border-color: #f2caca;
  background: var(--bad-soft);
  color: var(--bad);
}

.alert-warning {
  border-color: #f1d49b;
  background: var(--warn-soft);
  color: var(--warn);
}

.alert-info {
  border-color: #c7d6df;
  background: var(--brand-soft);
  color: var(--brand);
}

.folder-pane {
  display: grid;
  gap: 8px;
}

.folder-section {
  display: grid;
  gap: 1px;
}

.folder-title {
  padding: 7px 8px 4px;
  color: #667085;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.folder-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px 5px 18px;
  border-radius: 3px;
  background: transparent;
  color: #263342;
  font-size: 12px;
  text-align: left;
}

.folder-row:hover {
  background: #fff;
  text-decoration: none;
}

.folder-row.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.folder-row.root {
  padding-left: 8px;
  font-weight: 650;
}

.folder-count {
  color: #667085;
  font-size: 11px;
}

.context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.context-bar strong {
  color: var(--ink);
}

.date-range {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.date-range input {
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.muted,
.text-muted,
.text-muted-custom,
.form-text {
  color: var(--muted) !important;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #edf2f8;
  vertical-align: middle;
}

th {
  color: #526179;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--sand);
  white-space: nowrap;
}

tbody tr:hover {
  background: #fbfdff;
}

.review-records-table th,
.review-records-table td {
  padding: 5px 6px;
  font-size: 12px;
  line-height: 1.25;
}

.review-records-table th {
  font-size: 10px;
  letter-spacing: 0.05em;
}

td {
  color: #23304a;
  font-size: 13px;
}

.strong-cell {
  font-weight: 650;
  color: var(--ink);
}

.stack {
  display: grid;
  gap: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.pill.good {
  color: var(--good);
  background: var(--good-soft);
}

.pill.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.pill.bad {
  color: var(--bad);
  background: var(--bad-soft);
}

.pill.info {
  color: var(--brand);
  background: var(--brand-soft);
}

.pill.purple {
  color: var(--purple);
  background: var(--purple-soft);
}

.pill.neutral {
  color: #5a6680;
  background: #edf2f8;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.card-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  margin: 22px 0;
}

.site-card,
.record-card,
.metric-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  min-width: 0;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.site-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.site-card h3,
.record-card h3 {
  margin: 0;
  letter-spacing: -0.01em;
  font-weight: 650;
}

.site-card p,
.record-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.meta-box {
  padding: 8px;
  border-radius: 4px;
  background: var(--panel-soft);
  border: 1px solid #e6ebf1;
}

.meta-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.split-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.document-viewer,
.request-form {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.document-viewer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.doc-expand-btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

/* Hidden gallery feeding Viewer.js. We don't display it inline so the page only
   shows the thumbnail grid + the selected stage image. */
.doc-gallery-hidden {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

.doc-stage {
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1f2937;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  max-height: 55vh;
  overflow: hidden;
  cursor: zoom-in;
}

.doc-stage img {
  max-width: 100%;
  max-height: 52vh;
  height: auto;
  width: auto;
  display: block;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.doc-stage-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.doc-stage-meta__title {
  font-weight: 600;
  color: #263342;
}

.doc-stage-meta__page {
  color: var(--muted);
}

.doc-classification {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.doc-classification--tax-lien {
  background: #e6f4ea;
  color: #1e6b3a;
  border-color: #b7e0c4;
}

.doc-classification--release {
  background: #e8f0fb;
  color: #1f4f82;
  border-color: #b9cde7;
}

.doc-classification--other {
  background: #f0f1f4;
  color: #6b7280;
  border-color: #d6d9df;
}

.doc-classification--unclassified {
  background: #fdf3d7;
  color: #8a6d1a;
  border-color: #ead9a2;
}

.doc-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  padding: 8px;
  background: #f4f6f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.doc-thumb {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #fff;
  border: 1px solid #dbe2ec;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  font: inherit;
  color: inherit;
}

.doc-thumb:hover {
  border-color: #9fb5d1;
  box-shadow: 0 2px 6px rgba(31, 79, 130, 0.12);
}

.doc-thumb.is-selected {
  border-color: var(--brand, #1f4f82);
  box-shadow: 0 0 0 2px rgba(31, 79, 130, 0.25);
}

.doc-thumb.is-other {
  opacity: 0.55;
  filter: grayscale(0.65);
}

.doc-thumb.is-other:hover,
.doc-thumb.is-other.is-selected {
  /* Restore full intensity once the operator actively picks an Other page so it
     doesn't look broken when previewed in the stage above. */
  opacity: 1;
  filter: none;
}

.doc-thumb__image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 4px;
  height: 110px;
  overflow: hidden;
}

.doc-thumb__image-wrap img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  background: #fff;
}

.doc-thumb__pdf-wrap {
  border: 1px dashed #c9d3df;
  background: #fff;
}

.doc-thumb__pdf-label {
  color: #1f4f82;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.doc-thumb__label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  font-size: 11px;
}

.doc-thumb__page {
  font-weight: 600;
  color: #263342;
}

.doc-extras {
  font-size: 12px;
  color: #263342;
}

.doc-extras ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* Admin-only AI pipeline diagnostics block - sits between the stage meta and the
   thumbnail grid. One hidden .doc-diag child per attachment; JS toggles visibility. */
.doc-diag-wrap {
  border: 1px solid #d6d9df;
  border-radius: 6px;
  background: #fafbfd;
  padding: 10px 12px;
  font-size: 12px;
  color: #263342;
}

.doc-diag-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #d6d9df;
  margin-bottom: 8px;
}

.doc-diag-header__title {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #1f4f82;
}

.doc-diag-header__hint {
  color: var(--muted);
  font-size: 11px;
}

.doc-diag-header__link {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
}

.doc-diag__section + .doc-diag__section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e6ebf1;
}

.doc-diag__section-title {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.doc-diag__class-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.doc-diag__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.doc-diag__table th,
.doc-diag__table td {
  border: 1px solid #e6ebf1;
  padding: 4px 6px;
  vertical-align: top;
  text-align: left;
}

.doc-diag__table th {
  background: #eef2f7;
  font-weight: 600;
  color: #263342;
}

.doc-diag__table--compact th,
.doc-diag__table--compact td {
  padding: 2px 5px;
  font-size: 10.5px;
}

.doc-diag__score {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.doc-diag__score.is-winner {
  background: #e6f4ea;
  font-weight: 700;
  color: #1e6b3a;
}

.doc-diag__badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.doc-diag__badge.is-ok {
  background: #e6f4ea;
  color: #1e6b3a;
}

.doc-diag__badge.is-err {
  background: #fce8e6;
  color: #9c2c1e;
}

.doc-diag__details {
  margin-top: 6px;
}

.doc-diag__details summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--brand, #1f4f82);
}

.doc-diag__model-block {
  margin-top: 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #e6ebf1;
  border-radius: 4px;
}

.doc-diag-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #d6d9df;
  font-size: 11px;
}

.doc-diag-footer ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.document-frame {
  border-radius: 6px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(31, 79, 130, 0.06) 0 30%, transparent 30%),
    repeating-linear-gradient(180deg, #fff 0 24px, #f4f6f9 24px 25px);
  min-height: 360px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.document-frame::before {
  content: "";
  position: absolute;
  inset: 18px auto auto 18px;
  width: 78px;
  height: 104px;
  border-radius: 4px;
  background: linear-gradient(135deg, #b8c7d8, #315b86);
}

.document-inner {
  margin-left: 108px;
  display: grid;
  gap: 9px;
  position: relative;
  z-index: 1;
}

.doc-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.doc-line {
  height: 9px;
  border-radius: 99px;
  background: #d9e3f5;
}

.doc-line.short {
  width: 56%;
}

.doc-line.medium {
  width: 74%;
}

.profile-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.subnav-list {
  display: grid;
  gap: 1px;
}

.subnav-link,
.list-group-item {
  display: block;
  padding: 8px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #263342;
  font-size: 13px;
}

.subnav-link:hover,
.list-group-item:hover {
  background: var(--sand);
  text-decoration: none;
}

.subnav-link.active,
.list-group-item.active {
  background: var(--brand-soft);
  border-color: var(--line);
  color: var(--brand);
}

.auth-container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-content {
  width: min(100%, 440px);
}

.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-header,
.home-footer {
  background: #fff;
  border-color: var(--line);
}

.home-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.home-section {
  flex: 1;
  padding: 3rem 0;
  background: var(--bg);
}

.home-hero {
  flex: 0 0 auto;
  padding: 4rem 0 3rem;
  background: var(--brand);
  color: #fff;
}

.home-hero h1,
.home-hero p {
  color: #fff;
}

.home-footer {
  padding: 2rem 0 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.empty-state {
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .metric-grid,
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-panel {
    grid-template-columns: 1fr;
  }
}

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

  .top-nav {
    align-items: stretch;
    height: auto;
    min-height: 44px;
    flex-direction: column;
    padding: 8px 14px;
  }

  .brand-strip,
  .primary-nav {
    width: 100%;
  }

  .primary-nav {
    flex-wrap: wrap;
    height: auto;
  }

  .nav-button {
    min-height: 36px;
  }

  .user-menu {
    height: 36px;
    align-self: flex-end;
  }

  .sidebar {
    grid-row: auto;
    grid-column: auto;
    position: static;
    height: auto;
  }

  .main {
    grid-row: auto;
    grid-column: auto;
    padding: 14px;
  }

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

  .top-actions {
    justify-content: flex-start;
  }

  .metric-grid,
  .card-grid,
  .meta-grid,
  .profile-layout {
    grid-template-columns: 1fr;
  }
}
