:root {
  --ink: #172429;
  --ink-soft: #4f5f62;
  --ink-faint: #768386;
  --nav: #153438;
  --nav-deep: #10292d;
  --accent: #11756d;
  --accent-dark: #0d5c56;
  --accent-pale: #e4f3ef;
  --paper: #ffffff;
  --canvas: #f3f5f2;
  --line: #dbe1dd;
  --line-strong: #c8d0cb;
  --warning: #976014;
  --warning-bg: #fff4dc;
  --danger: #a33838;
  --danger-bg: #fcebea;
  --success: #287052;
  --success-bg: #e7f4ed;
  --info: #356a83;
  --info-bg: #eaf2f6;
  --shadow: 0 1px 2px rgba(16, 41, 45, .05), 0 8px 24px rgba(16, 41, 45, .04);
  --radius: 12px;
  --radius-sm: 8px;
  --focus: 0 0 0 3px rgba(17, 117, 109, .22);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: 4px; font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
h3 { margin-bottom: 6px; font-size: 16px; }
small { color: var(--ink-faint); font-size: 12px; }
::selection { background: #bfe1d9; color: var(--nav-deep); }

:focus-visible { outline: 0; box-shadow: var(--focus); }
.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 10px 14px; border-radius: 6px; background: var(--paper); color: var(--ink); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .92em; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); }
.compact { margin-bottom: 0; }
.strong { font-weight: 700; }
.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.positive-text { color: var(--success); }
.warning-text { color: var(--warning); }
.danger-text { color: var(--danger); }
.demo-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; padding: 9px 12px; border: 1px solid #ead5aa; border-radius: 8px; background: var(--warning-bg); color: var(--warning); font-size: 11px; }
.demo-banner strong { white-space: nowrap; }

/* Shell */
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 30; display: flex; height: 100vh; flex-direction: column; overflow-y: auto; background: var(--nav); color: #edf5f3; }
.brand { display: flex; align-items: center; gap: 11px; min-height: 74px; padding: 16px 20px; }
.brand__mark { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; background: #d5a06f; color: var(--nav-deep); font-family: Georgia, serif; font-size: 21px; font-weight: 700; }
.brand strong, .brand small { display: block; }
.brand strong { color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: 20px; letter-spacing: .01em; line-height: 1.05; }
.brand small { margin-top: 3px; color: #9eb4b5; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.nav-list { flex: 1; padding: 6px 12px; }
.nav-list__label { margin: 20px 10px 7px; color: #809b9d; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.nav-list a { display: flex; min-height: 42px; align-items: center; gap: 11px; margin: 3px 0; padding: 9px 11px; border-radius: 8px; color: #c8d8d7; font-size: 13px; font-weight: 600; text-decoration: none; transition: background .16s ease, color .16s ease; }
.nav-list a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-list a[aria-current="page"] { background: #285158; color: #fff; box-shadow: inset 3px 0 #d5a06f; }
.nav-icon { display: inline-grid; width: 22px; height: 22px; place-items: center; color: #94b1b1; font-size: 17px; font-weight: 400; }
.nav-list a[aria-current="page"] .nav-icon { color: #f2c69e; }
.sidebar__footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.user-card { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.1); }
.avatar { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border-radius: 50%; background: #d7e8e4; color: var(--nav); font-size: 12px; font-weight: 800; }
.user-card__identity { min-width: 0; flex: 1; }
.user-card__identity strong, .user-card__identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card__identity strong { color: #f8fbfa; font-size: 12px; }
.user-card__identity small { color: #8fa9aa; font-size: 10px; text-transform: capitalize; }
.user-card__logout-form { margin: 0; }
.user-card__logout { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: #9fb4b4; cursor: pointer; text-decoration: none; }
.user-card__logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 64px; align-items: center; gap: 16px; padding: 10px clamp(18px, 3vw, 38px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.global-search { display: flex; width: min(590px, 62vw); height: 39px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); color: var(--ink-faint); }
.global-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); background: #fff; }
.global-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); }
.global-search kbd { padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--ink-faint); font-size: 11px; }
.privacy-chip { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 5px 9px; border: 1px solid #d8e4df; border-radius: 999px; background: #f3f8f6; color: #506d68; font-size: 11px; font-weight: 650; white-space: nowrap; }
.privacy-chip > span { color: var(--success); font-size: 7px; }
.menu-toggle { display: none; }
.main-content { width: 100%; max-width: 1580px; margin: 0 auto; padding: 30px clamp(18px, 3vw, 38px) 64px; outline: none; }

/* Headings and controls */
.eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .145em; text-transform: uppercase; }
.eyebrow--light { color: #d6a575; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 5px; }
.page-heading__description { max-width: 760px; margin-bottom: 0; color: var(--ink-soft); font-size: 14px; }
.page-heading__actions, .record-heading__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; margin: -5px 0 20px; color: var(--ink-faint); font-size: 12px; }
.breadcrumbs a { color: var(--accent-dark); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.record-heading { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.record-heading__identity { display: flex; min-width: 0; align-items: center; gap: 16px; }
.record-heading__identity h1 { margin: 4px 0; overflow-wrap: anywhere; }
.record-heading__identity p { margin-bottom: 0; color: var(--ink-soft); }
.record-heading__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--ink-faint); font-size: 11px; }
.record-icon { display: grid; width: 54px; height: 54px; flex: 0 0 54px; place-items: center; border: 1px solid #c9ded8; border-radius: 14px; background: var(--accent-pale); color: var(--accent-dark); font-size: 27px; }
.record-icon--account { background: #edf1f6; color: #496276; border-color: #d8e0e7; }
.record-icon--import { background: #fff3e7; color: #9a5b20; border-color: #ecd8c1; }
.privacy-label, .source-chip, .step-chip { display: inline-flex; align-items: center; width: max-content; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: #f6f8f6; color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.privacy-label--visible { border-color: #e7c997; background: var(--warning-bg); color: var(--warning); }
.heading-form { margin: 0; }
.step-chip { color: var(--accent-dark); background: var(--accent-pale); border-color: #c9e1da; }

.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button--primary { background: var(--accent); color: #fff; box-shadow: 0 2px 5px rgba(17,117,109,.18); }
.button--primary:hover { background: var(--accent-dark); }
.button--secondary { border-color: var(--line-strong); background: #fff; color: var(--ink); }
.button--secondary:hover { border-color: #9eaaa4; background: #fafbf9; }
.button--quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
.button--quiet:hover { background: #e9eeeb; color: var(--ink); }
.button--danger { border-color: #e6bdbd; background: #fff; color: var(--danger); }
.button--danger:hover { background: var(--danger-bg); }
.button--small { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.button--full { width: 100%; }
.text-link, .subtle-link { color: var(--accent-dark); font-weight: 700; text-decoration: none; }
.text-link:hover, .subtle-link:hover { text-decoration: underline; }
.row-arrow { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 7px; color: var(--ink-faint); font-size: 17px; text-decoration: none; }
.row-arrow:hover { background: var(--accent-pale); color: var(--accent-dark); }
.icon-button { display: grid; width: 39px; height: 39px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }

/* Panels, stats, grids */
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.panel__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel__header h2 { margin-bottom: 2px; }
.panel__header p:not(.eyebrow) { margin-bottom: 0; color: var(--ink-faint); font-size: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.stats-grid--record { margin: 0 0 20px; }
.stat-card { position: relative; min-width: 0; overflow: hidden; padding: 18px 19px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: #d3dbd6; content: ""; }
.stat-card--accent::before { background: var(--accent); }
.stat-card--warning::before { background: #d4983a; }
.stat-card--success::before { background: var(--success); }
.stat-card__label { margin-bottom: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.stat-card__value { overflow: hidden; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: clamp(23px, 2.2vw, 31px); font-variant-numeric: tabular-nums; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.stat-card__detail { margin-top: 4px; color: var(--ink-faint); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .72fr); gap: 16px; }
.panel--wide { min-width: 0; }
.section-panel { margin-bottom: 18px; scroll-margin-top: 84px; }
.two-column-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.two-column-grid--import { grid-template-columns: minmax(0, 1.25fr) minmax(310px, .75fr); margin-bottom: 18px; }
.compliance-grid { padding: 18px 22px 0; }
.compliance-lower-grid { padding-top: 6px; padding-bottom: 22px; }
.subsection-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.subsection-heading h3 { margin: 0; font-size: 14px; }
.subsection-heading span { color: var(--ink-faint); font-size: 10px; font-weight: 750; letter-spacing: .03em; text-transform: uppercase; }
.anchor-tabs { position: sticky; top: 63px; z-index: 12; display: flex; gap: 2px; margin: 0 0 18px; padding: 5px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.96); box-shadow: 0 3px 12px rgba(16,41,45,.05); scrollbar-width: none; }
.anchor-tabs a { min-height: 34px; padding: 8px 12px; border-radius: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.anchor-tabs a:hover { background: var(--accent-pale); color: var(--accent-dark); }

/* Tables */
.table-panel { overflow: hidden; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead { background: #f7f9f7; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e7ebe8; text-align: left; vertical-align: middle; }
thead th { color: var(--ink-faint); font-size: 10px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: #fbfcfb; }
th small, td small { display: block; margin-top: 2px; font-weight: 400; }
.record-link { color: var(--ink); font-weight: 750; text-decoration: none; }
.record-link:hover { color: var(--accent-dark); text-decoration: underline; }
.table-toolbar { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.table-toolbar > div:first-child { display: flex; flex-direction: column; }
.table-toolbar span { color: var(--ink-faint); font-size: 11px; }
.table-toolbar__actions { display: flex; gap: 8px; }
.data-table.is-compact th, .data-table.is-compact td { padding-top: 7px; padding-bottom: 7px; }
.timestamp { white-space: nowrap; }

/* Status and flags */
.status-badge { display: inline-flex; min-height: 23px; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 750; letter-spacing: .015em; white-space: nowrap; }
.status-badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge--positive { border-color: #c6dfd1; background: var(--success-bg); color: var(--success); }
.status-badge--warning { border-color: #ead5aa; background: var(--warning-bg); color: var(--warning); }
.status-badge--danger { border-color: #edc4c2; background: var(--danger-bg); color: var(--danger); }
.status-badge--info { border-color: #ccdde5; background: var(--info-bg); color: var(--info); }
.status-badge--muted { border-color: #dce1de; background: #f2f4f2; color: #66726e; }
.flag-stack { display: flex; max-width: 150px; flex-wrap: wrap; gap: 4px; }
.flag { display: inline-block; padding: 2px 6px; border-radius: 5px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.flag--danger { background: var(--danger-bg); color: var(--danger); }
.flag--warning { background: var(--warning-bg); color: var(--warning); }
.flag--clear { background: #eef3f0; color: #64716c; }
.count-chip { display: inline-grid; min-width: 27px; min-height: 24px; place-items: center; padding: 2px 7px; border-radius: 6px; background: #f0f3f1; color: var(--ink-soft); font-weight: 750; }
.count-chip--warning { background: var(--warning-bg); color: var(--warning); }
.count-chip--danger { background: var(--danger-bg); color: var(--danger); }
.priority { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.priority i { width: 7px; height: 7px; border-radius: 50%; background: #8d9a95; }
.priority--high i { background: var(--danger); }
.priority--medium i { background: #d08b25; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--ink-faint); font-size: 10px; }
.legend > span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: #85938e; }
.legend-dot--positive { background: var(--success); }
.legend-dot--warning { background: #cc8621; }
.legend-dot--danger { background: var(--danger); }

/* Forms and filters */
.filter-bar { display: flex; align-items: end; gap: 10px; margin-bottom: 14px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.filter-bar--accounts { flex-wrap: wrap; }
.filter-search { display: flex; min-width: 220px; height: 36px; flex: 1; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink-faint); }
.filter-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.filter-search input { width: 100%; border: 0; outline: 0; background: transparent; }
.form-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.form-field label, .label-row label, .release-control label { color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.form-field small { line-height: 1.35; }
.form-field--compact { min-width: 130px; }
.form-field--compact label { font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.form-field--span { grid-column: 1 / -1; }
input, select, textarea { width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink); outline: 0; }
input:hover, select:hover, textarea:hover { border-color: #a8b4ae; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
textarea { min-height: 68px; resize: vertical; }
input[type="file"] { padding: 7px; }
input[type="checkbox"] { width: 16px; min-height: 16px; accent-color: var(--accent); }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; cursor: pointer; }
.check-row--filter { min-height: 36px; padding: 0 5px; white-space: nowrap; }
.form-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.inline-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 18px 20px; border-top: 1px solid var(--line); background: #fafbf9; }
.inline-form--restrictions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline-form--upload { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.form-actions p { max-width: 620px; margin-bottom: 0; color: var(--ink-faint); font-size: 11px; }
.permission-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.permission-fieldset:disabled { opacity: .62; }
.permission-note { margin: 14px 20px 0; padding: 11px 13px; border: 1px solid #d6e0dc; border-radius: 8px; background: #f4f7f5; color: var(--ink-soft); }
.permission-note p { margin: 2px 0 0; font-size: 11px; }
.money-input { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; }
.money-input:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.money-input > span { padding-left: 9px; color: var(--ink-faint); }
.money-input input { border: 0; box-shadow: none; }
.money-input input:focus { box-shadow: none; }

/* Record details */
.record-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 3px 22px 20px; }
.record-grid--single { grid-template-columns: 1fr; padding-top: 4px; }
.record-field { position: relative; min-width: 0; padding: 17px 18px 13px 0; border-bottom: 1px solid #e8ece9; }
.record-field dt { margin-bottom: 5px; color: var(--ink-faint); font-size: 10px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.record-field dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-weight: 650; }
.provenance { display: block; width: max-content; max-width: 100%; margin-top: 5px; overflow: hidden; color: #70817c; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.masked-value { letter-spacing: .025em; }
.restriction-banner, .validation-banner, .audit-assurance, .governance-note { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; padding: 13px 15px; border: 1px solid #e9c5c3; border-radius: 10px; background: var(--danger-bg); color: var(--danger); }
.restriction-banner__icon, .validation-banner > span, .audit-assurance__mark, .governance-note > span { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border-radius: 50%; background: var(--danger); color: #fff; font-weight: 850; }
.restriction-banner div, .validation-banner div, .audit-assurance div, .governance-note div { flex: 1; }
.restriction-banner p, .validation-banner p, .audit-assurance p, .governance-note p { margin: 1px 0 0; color: inherit; font-size: 11px; opacity: .84; }
.restriction-banner a { color: inherit; font-size: 11px; font-weight: 800; white-space: nowrap; }
.validation-banner--success, .audit-assurance { border-color: #c4ded0; background: var(--success-bg); color: var(--success); }
.validation-banner--success > span, .audit-assurance__mark { background: var(--success); }
.governance-note { margin-top: 14px; border-color: #d6e3e8; background: var(--info-bg); color: var(--info); }
.governance-note > span { background: var(--info); }
.action-drawer { margin: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; }
.action-drawer > summary { display: flex; min-height: 57px; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; background: #f7f9f7; cursor: pointer; list-style: none; }
.action-drawer > summary::-webkit-details-marker { display: none; }
.action-drawer > summary span:first-child { display: flex; flex-direction: column; }
.action-drawer > summary span:last-child { color: var(--accent); font-size: 21px; }
.restriction-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px 20px 2px; }
.restriction-card { padding: 15px; border: 1px solid #ebc3c1; border-radius: 9px; background: #fffafa; }
.restriction-card--released { border-color: var(--line); background: #f8faf8; opacity: .78; }
.restriction-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.restriction-card__head > div { display: flex; align-items: center; gap: 8px; }
.restriction-card dl { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 9px; margin: 14px 0 0; }
.restriction-card dt { color: var(--ink-faint); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.restriction-card dd { margin: 3px 0 0; font-size: 11px; }
.release-control { margin-top: 13px; padding-top: 11px; border-top: 1px solid #efd8d6; }
.release-control summary { width: max-content; color: var(--danger); font-size: 11px; font-weight: 750; cursor: pointer; }
.release-control form { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 10px; }
.release-control label { grid-column: 1 / -1; }
.released-note { margin: 12px 0 0; color: var(--ink-faint); font-size: 10px; }

/* Documents, timelines, dashboard details */
.document-list { margin: 0; padding: 3px 20px 8px; list-style: none; }
.document-list li { display: flex; align-items: center; gap: 11px; padding: 13px 0; border-bottom: 1px solid #e7ebe8; }
.document-list li:last-child { border-bottom: 0; }
.document-list li > span:nth-child(2) { min-width: 0; flex: 1; }
.document-list strong, .document-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-mark { display: grid; width: 32px; height: 36px; flex: 0 0 32px; place-items: center; border: 1px solid #cfddd8; border-radius: 5px; background: #eef6f3; color: var(--accent-dark); }
.file-mark--large { width: 40px; height: 46px; flex-basis: 40px; }
.document-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 18px 20px; }
.document-card { display: flex; min-width: 0; align-items: flex-start; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
.document-card > div { min-width: 0; flex: 1; }
.document-card p { margin: 2px 0; overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.document-card small { display: block; }
.document-download { display: inline-block; margin-top: 7px; font-size: 11px; }
.hash { display: block; margin-top: 5px; color: #73827d; font-size: 9px; }
.hash-wrap { word-break: break-all; }
.ownership-timeline, .audit-timeline, .activity-list { margin: 0; padding: 18px 22px 22px; list-style: none; }
.ownership-timeline li { position: relative; display: grid; grid-template-columns: 31px 1fr; gap: 12px; padding-bottom: 13px; }
.ownership-timeline li::before { position: absolute; top: 30px; bottom: -2px; left: 14px; width: 1px; background: var(--line); content: ""; }
.ownership-timeline li:last-child::before { display: none; }
.ownership-timeline__marker { z-index: 1; display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid #bdd9d2; border-radius: 50%; background: var(--accent-pale); color: var(--accent-dark); font-size: 10px; font-weight: 800; }
.ownership-timeline__card { padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; }
.ownership-timeline__card > div { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.ownership-timeline__card p { margin: 4px 0 0; color: var(--ink-faint); font-size: 11px; }
.audit-timeline li { display: grid; grid-template-columns: 150px 13px 1fr; gap: 12px; min-height: 72px; }
.audit-timeline__time { color: var(--ink-faint); font-family: ui-monospace, monospace; font-size: 10px; }
.audit-timeline__marker { position: relative; width: 9px; height: 9px; margin-top: 4px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; }
.audit-timeline__marker::after { position: absolute; top: 10px; bottom: -58px; left: 2px; width: 1px; background: var(--line); content: ""; }
.audit-timeline li:last-child .audit-timeline__marker::after { display: none; }
.audit-timeline p { margin: 2px 0; color: var(--ink-soft); font-size: 12px; }
.health-list { padding: 5px 18px 0; }
.health-list a { display: flex; align-items: center; justify-content: space-between; padding: 13px 3px; border-bottom: 1px solid #e7ebe8; text-decoration: none; }
.health-list a:hover { color: var(--accent-dark); }
.health-list strong, .health-list small { display: block; }
.health-list strong { font-family: Georgia, serif; font-size: 22px; }
.health-summary { display: flex; align-items: center; gap: 12px; margin: 17px; padding: 14px; border-radius: 9px; background: #f0f6f3; }
.ring { width: 43px; height: 43px; border: 6px solid #c3e0d8; border-top-color: var(--accent); border-radius: 50%; transform: rotate(35deg); }
.health-summary strong, .health-summary small { display: block; }
.compact-timeline { padding: 4px 19px 9px; }
.timeline__item { display: grid; grid-template-columns: 10px 1fr auto; gap: 11px; align-items: center; padding: 12px 0; border-bottom: 1px solid #e7ebe8; text-decoration: none; }
.timeline__item:last-child { border-bottom: 0; }
.timeline__item > span { min-width: 0; }
.timeline__item > span:nth-child(2) strong, .timeline__item > span:nth-child(2) small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline__item > span:last-child { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.timeline__marker { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.activity-list li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding-bottom: 14px; }
.activity-list__mark { width: 8px; height: 8px; margin-top: 5px; border: 2px solid #78a69b; border-radius: 50%; }
.activity-list strong, .activity-list small { display: block; }

/* Imports */
.import-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .65fr); gap: 16px; margin-bottom: 18px; }
.import-form { padding: 20px 22px; }
.upload-zone { position: relative; display: grid; min-height: 148px; place-items: center; margin-bottom: 18px; border: 1.5px dashed #9bb8b1; border-radius: 10px; background: #f6faf8; text-align: center; }
.upload-zone.is-dragover { border-color: var(--accent); background: var(--accent-pale); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone label { display: flex; width: 100%; height: 100%; min-height: 148px; align-items: center; justify-content: center; flex-direction: column; padding: 20px; cursor: pointer; }
.upload-zone label strong, .upload-zone label span, .upload-zone label small { display: block; }
.upload-zone label span { margin-top: 2px; color: var(--ink-soft); }
.upload-zone label small { margin-top: 7px; }
.upload-zone__mark { display: grid !important; width: 39px; height: 39px; place-items: center; margin-bottom: 7px; border-radius: 50%; background: var(--accent-pale); color: var(--accent-dark) !important; font-size: 22px; }
.import-requirements { margin: 17px 0; padding: 11px 13px; border: 1px solid #dbe4df; border-radius: 8px; background: #f7f9f7; }
.import-requirements p { margin: 3px 0; font-family: ui-monospace, monospace; font-size: 10px; overflow-wrap: anywhere; }
.import-requirements span { color: var(--ink-faint); font-size: 10px; }
.process-card { padding: 22px; }
.process-card > h2 { margin-bottom: 20px; }
.process-list { margin: 0; padding: 0; list-style: none; }
.process-list li { display: grid; grid-template-columns: 29px 1fr; gap: 11px; padding-bottom: 17px; }
.process-list li > span { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid #c8ddd7; border-radius: 50%; background: var(--accent-pale); color: var(--accent-dark); font-size: 10px; font-weight: 800; }
.process-list p { margin: 2px 0 0; color: var(--ink-faint); font-size: 11px; }
.import-progress { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 18px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 10px; background: #fff; list-style: none; box-shadow: var(--shadow); }
.import-progress li { position: relative; display: flex; align-items: center; gap: 9px; }
.import-progress li::after { position: absolute; top: 14px; right: 10px; left: 43px; height: 1px; background: var(--line); content: ""; }
.import-progress li:last-child::after { display: none; }
.import-progress li > span { z-index: 1; display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--ink-faint); font-size: 10px; font-weight: 800; }
.import-progress strong, .import-progress small { display: block; }
.import-progress strong { font-size: 11px; }
.import-progress li.is-complete > span { border-color: var(--accent); background: var(--accent); color: #fff; }
.import-progress li.is-current > span { border: 2px solid var(--accent); color: var(--accent-dark); }
.commit-panel { padding-bottom: 19px; }
.commit-panel > p, .commit-panel > ul, .commit-panel > form, .commit-complete { margin-right: 20px; margin-left: 20px; }
.commit-panel > p { color: var(--ink-soft); }
.check-list { padding-left: 19px; color: var(--ink-soft); font-size: 12px; }
.check-list li { margin: 6px 0; }
.commit-complete { display: flex; gap: 12px; padding: 16px; border-radius: 9px; background: var(--success-bg); color: var(--success); }
.commit-complete > span { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 50%; background: var(--success); color: #fff; }
.commit-complete p { margin: 4px 0 8px; color: #456e5d; font-size: 11px; }
.cell-list { margin: 0; padding-left: 15px; color: var(--danger); font-size: 10px; }

/* Metro 2 readiness */
.metro2-control-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: 18px; padding: 0 20px 20px; }
.metro2-control-grid .inline-form { align-items: end; padding: 18px; border: 1px solid var(--line); border-radius: 9px; }
.metro2-create-profile { padding: 17px; border: 1px solid var(--line); border-radius: 9px; }
.metro2-create-profile summary { margin-bottom: 14px; }
.metro2-create-profile[open] summary { color: var(--accent-dark); }
.metro2-generation-form .permission-fieldset { grid-column: 1 / -1; }
.metro2-form-section { padding: 20px 22px 23px; }
.metro2-profile-form > .panel { margin-bottom: 18px; }
.checkbox-field { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9f7; cursor: pointer; }
.checkbox-field input { flex: 0 0 16px; margin-top: 3px; }
.checkbox-field strong, .checkbox-field small { display: block; }
.checkbox-field small { margin-top: 2px; }
.stat-card__value--small { font-family: inherit; font-size: 17px; font-weight: 750; }
.metro2-sticky-actions { position: sticky; z-index: 10; bottom: 14px; padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(255,255,255,.96); box-shadow: 0 8px 30px rgba(16,41,45,.13); backdrop-filter: blur(10px); }

/* Audit */
.audit-assurance { margin-bottom: 14px; }
.audit-assurance .source-chip { margin-left: auto; }
.audit-table code { display: block; max-width: 500px; margin-top: 4px; padding: 7px; overflow-x: auto; border-radius: 5px; background: #f0f2f0; color: var(--ink-soft); font-size: 9px; white-space: pre-wrap; }
.event-details { margin-top: 6px; }
.event-details summary { width: max-content; color: var(--accent-dark); font-size: 10px; font-weight: 750; cursor: pointer; }
.event-details p { margin: 6px 0; }

/* Feedback and empty states */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid #cddde4; border-radius: 8px; background: var(--info-bg); color: var(--info); }
.flash--error, .flash--danger { border-color: #ecc3c1; background: var(--danger-bg); color: var(--danger); }
.flash--success { border-color: #c6dfd1; background: var(--success-bg); color: var(--success); }
.flash--warning { border-color: #ead5aa; background: var(--warning-bg); color: var(--warning); }
.flash button { border: 0; background: transparent; color: inherit; font-size: 20px; cursor: pointer; }
.empty-state { display: grid; min-height: 220px; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-state__mark { display: grid; width: 43px; height: 43px; place-items: center; margin-bottom: 10px; border: 1px solid #cbd8d3; border-radius: 50%; background: #f3f7f5; color: #738780; font-size: 23px; }
.empty-state h3 { margin-bottom: 3px; }
.empty-state p { max-width: 440px; margin-bottom: 13px; color: var(--ink-faint); font-size: 12px; }

/* Authentication and errors */
.auth-page { min-height: 100vh; background: #fff; }
.auth-shell { display: grid; grid-template-columns: minmax(380px, .95fr) minmax(430px, 1.05fr); min-height: 100vh; }
.auth-story { position: relative; display: flex; flex-direction: column; overflow: hidden; padding: 28px clamp(28px, 5vw, 72px) 38px; background: var(--nav); color: #fff; }
.auth-story::before, .auth-story::after { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; }
.auth-story::before { width: 520px; height: 520px; right: -260px; bottom: -110px; }
.auth-story::after { width: 330px; height: 330px; right: -165px; bottom: -15px; }
.brand--light { padding: 0; }
.auth-story__content { z-index: 1; margin: auto 0; }
.auth-story__headline { max-width: 620px; margin-bottom: 22px; color: #fff; font-family: Georgia, "Times New Roman", serif; font-size: clamp(39px, 5vw, 66px); font-weight: 400; line-height: 1.02; letter-spacing: -.045em; }
.auth-story__content > p:last-child { max-width: 570px; color: #b7cbca; font-size: clamp(15px, 1.6vw, 18px); }
.auth-story__foot { z-index: 1; margin: 0; color: #87a4a5; font-size: 10px; letter-spacing: .065em; }
.auth-panel { display: grid; place-items: center; padding: 35px; background: #f7f8f6; }
.auth-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 20px 60px rgba(16,41,45,.08); }
.auth-card--wide { width: min(560px, 100%); }
.auth-card h1, .auth-card h2 { font-size: 29px; }
.auth-card .button, .auth-card input:not([type="checkbox"]) { min-height: 44px; }
.security-note { margin: 17px 0 0; color: var(--ink-faint); font-size: 10px; text-align: center; }
.setup-steps { display: grid; gap: 13px; margin: 22px 0 0; padding-left: 22px; color: var(--ink-soft); }
.setup-key { display: block; margin: 9px 0 7px; padding: 10px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); color: var(--ink); font-size: 13px; letter-spacing: .08em; text-align: center; }
.secondary-auth-action { display: flex; justify-content: center; margin-top: 10px; }
.recovery-code-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 20px 0; padding: 0; list-style: none; }
.recovery-code-list li { padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); text-align: center; }
.recovery-code-list code { color: var(--ink); font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
.security-callout { margin: 0 0 18px; padding: 11px 12px; border: 1px solid #ead5aa; border-radius: 8px; background: var(--warning-bg); color: var(--warning); font-size: 11px; }
.password-page { display: grid; min-height: calc(100vh - 160px); place-items: center; padding: 30px; }
.error-page { display: grid; min-height: calc(100vh - 160px); place-items: center; align-content: center; padding: 40px 20px; text-align: center; }
.error-code { margin-bottom: 7px; color: #dce4df; font-family: Georgia, serif; font-size: clamp(90px, 16vw, 180px); line-height: .8; }
.error-page > p:not(.eyebrow) { max-width: 570px; color: var(--ink-soft); }
.error-page__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin: 13px 0 22px; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .restriction-list { grid-template-columns: 1fr; }
  .filter-bar { flex-wrap: wrap; }
  .filter-search { min-width: 280px; }
}

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-105%); box-shadow: 12px 0 35px rgba(7,30,33,.22); transition: transform .2s ease; }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open::after { position: fixed; z-index: 25; inset: 0; background: rgba(10,30,31,.38); content: ""; }
  .menu-toggle { display: grid; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .import-layout { grid-template-columns: 1fr; }
  .metro2-control-grid { grid-template-columns: 1fr; }
  .record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { min-height: 330px; }
  .auth-story__content { margin: 55px 0; }
  .auth-story__headline { font-size: 44px; }
}

@media (max-width: 680px) {
  body { font-size: 13px; }
  .topbar { padding: 9px 13px; }
  .global-search { width: auto; flex: 1; }
  .global-search kbd, .privacy-chip { display: none; }
  .main-content { padding: 22px 13px 45px; }
  .page-heading, .record-heading { align-items: flex-start; flex-direction: column; }
  .page-heading__actions, .record-heading__actions { width: 100%; }
  .page-heading__actions .button, .record-heading__actions .button { flex: 1; }
  .record-heading__identity { align-items: flex-start; }
  .record-icon { width: 44px; height: 44px; flex-basis: 44px; border-radius: 11px; font-size: 22px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-card__value { font-size: 21px; }
  .two-column-grid, .two-column-grid--import { grid-template-columns: 1fr; }
  .record-grid { grid-template-columns: 1fr 1fr; padding-right: 14px; padding-left: 14px; }
  .panel__header { padding: 16px; }
  .filter-bar { align-items: stretch; }
  .filter-search, .form-field--compact { min-width: 100%; }
  .filter-bar .button { flex: 1; }
  .form-grid, .inline-form, .inline-form--restrictions, .inline-form--upload { grid-template-columns: 1fr; }
  .form-field--span { grid-column: 1; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button { width: 100%; }
  .document-grid { grid-template-columns: 1fr; padding: 14px; }
  .restriction-card dl { grid-template-columns: 1fr 1fr; }
  .release-control form { grid-template-columns: 1fr; }
  .audit-timeline li { grid-template-columns: 13px 1fr; }
  .audit-timeline__time { grid-column: 2; grid-row: 1; }
  .audit-timeline__marker { grid-column: 1; grid-row: 1 / 3; }
  .audit-timeline li > div { grid-column: 2; }
  .import-progress { grid-template-columns: 1fr 1fr; row-gap: 17px; }
  .import-progress li:nth-child(2)::after { display: none; }
  .timeline__item { grid-template-columns: 10px 1fr; }
  .timeline__item > span:last-child { grid-column: 2; align-items: flex-start; }
  .auth-story { display: none; }
  .auth-panel { min-height: 100vh; padding: 18px; }
  .auth-card { padding: 25px 20px; }
  .recovery-code-list { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .stats-grid { grid-template-columns: 1fr; }
  .record-grid { grid-template-columns: 1fr; }
  .record-field { padding-right: 0; }
  .record-heading__actions { flex-direction: column; }
  .record-heading__actions .button { width: 100%; }
  .restriction-banner, .validation-banner { align-items: flex-start; }
  .restriction-banner a { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  .sidebar, .topbar, .button, .filter-bar, .anchor-tabs, .action-drawer { display: none !important; }
  .app-shell { display: block; }
  .main-content { max-width: none; padding: 0; }
  .panel, .stat-card { break-inside: avoid; box-shadow: none; }
}
