:root {
    --navy: #11232f;
    --accent: #ff5432;
    --ink: #1c1c1a;
    --paper: #ede9e8;
    --white: #fff;
    --muted: rgba(28, 28, 26, .58);
    --faint: rgba(17, 35, 47, .08);
    --line: rgba(17, 35, 47, .18);
    --font-sans: "Arial Narrow", "Aptos Narrow", "Helvetica Neue", "Noto Sans", Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--font-sans);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a, input, select, textarea { transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 150ms ease; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .38; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.5rem, 5vw, 4.8rem); font-weight: 500; letter-spacing: -.055em; line-height: .95; }
h2 { font-size: 1.55rem; font-weight: 550; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--white); color: var(--ink); padding: .8rem .85rem; }
input:hover, select:hover, textarea:hover { border-color: rgba(17, 35, 47, .48); }
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
textarea { min-height: 92px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--navy) 50%), linear-gradient(135deg, var(--navy) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.mono { font-family: var(--font-mono); font-size: .88em; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.skip-link { position: fixed; top: -80px; left: 1rem; z-index: 1000; background: var(--accent); color: var(--navy); padding: .8rem 1rem; }
.skip-link:focus { top: 1rem; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 66px; height: 34px; background: var(--navy); color: var(--white); font-family: var(--font-mono); font-size: .78rem; font-weight: 700; letter-spacing: -.06em; }
.brand-mark.inverse { background: var(--accent); color: var(--navy); }
.eyebrow, .section-index { font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow { color: var(--accent); margin-bottom: .9rem; }
.section-index { color: var(--muted); }
.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 1rem; background: var(--paper); }
.boot-screen p { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }

/* Authentication */
.login-layout { min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr); }
.login-brand { background: var(--navy); color: var(--white); padding: clamp(1.5rem, 4vw, 4.5rem); display: flex; flex-direction: column; justify-content: space-between; min-height: 100svh; }
.login-brand-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; }
.login-title { max-width: 780px; padding-block: 4rem; }
.login-title h1 { color: var(--white); font-size: clamp(3.5rem, 7.3vw, 7.8rem); font-weight: 450; line-height: .9; letter-spacing: -.065em; }
.login-title > p:last-child { max-width: 480px; color: rgba(255, 255, 255, .65); font-size: 1rem; line-height: 1.6; margin-top: 2rem; }
.estate-facts { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-top: 1px solid rgba(255, 255, 255, .22); }
.estate-facts div { padding: 1.25rem 1rem 0 0; border-right: 1px solid rgba(255, 255, 255, .14); }
.estate-facts dt { color: rgba(255, 255, 255, .48); font-family: var(--font-mono); font-size: .67rem; text-transform: uppercase; }
.estate-facts dd { margin: .45rem 0 0; font-size: 1.35rem; }
.login-panel { background: var(--paper); display: grid; place-items: center; padding: clamp(1.5rem, 4vw, 4rem); }
.login-form { width: min(100%, 420px); display: grid; gap: 1.35rem; }
.login-form h2 { font-size: 2.4rem; }
.login-form > .muted { line-height: 1.6; margin-top: -.8rem; }
.field-label, .form-field { display: grid; gap: .5rem; }
.field-label { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.login-security { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: .58rem; color: var(--muted); }

/* Application shell */
.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 100; min-height: 72px; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); align-items: stretch; background: var(--white); border-bottom: 1px solid var(--line); }
.wordmark { grid-column: span 7; display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem; border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; }
.brand-copy { display: grid; line-height: 1.1; }
.brand-copy strong { font-size: .95rem; font-weight: 650; }
.brand-copy small { margin-top: .25rem; color: var(--muted); font-family: var(--font-mono); font-size: .58rem; text-transform: uppercase; }
.estate-meta { grid-column: span 10; display: flex; align-items: center; justify-content: center; gap: 2rem; color: var(--muted); font-family: var(--font-mono); font-size: .65rem; letter-spacing: .05em; }
.account-block { grid-column: span 7; display: grid; grid-template-columns: 1fr auto; align-content: center; column-gap: 1rem; padding: .8rem 1.5rem; border-left: 1px solid var(--line); text-align: right; }
.account-block > span { font-weight: 600; }
.account-block > small { grid-column: 1; color: var(--muted); font-family: var(--font-mono); font-size: .6rem; }
.account-block .text-button { grid-column: 2; grid-row: 1 / span 2; }
.text-button { border: 0; border-left: 1px solid var(--line); background: transparent; padding-left: 1rem; color: var(--muted); font-size: .75rem; }
.text-button:hover { color: var(--accent); }
.workspace-nav { position: sticky; top: 72px; z-index: 90; display: flex; gap: 0; padding-left: 1.5rem; background: var(--navy); color: var(--white); overflow-x: auto; }
.workspace-nav button { flex: 0 0 auto; border: 0; border-right: 1px solid rgba(255, 255, 255, .16); background: transparent; color: rgba(255, 255, 255, .55); padding: .95rem 1.25rem; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; }
.workspace-nav button:hover, .workspace-nav button.active { color: var(--white); background: rgba(255, 255, 255, .07); }
.workspace-nav button.active { box-shadow: inset 0 -2px var(--accent); }
.nav-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: .65rem; background: var(--accent); color: var(--navy); }
.flash { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 2rem; background: var(--accent); color: var(--navy); font-weight: 600; }
.flash button { border: 0; background: transparent; font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; }
.workspace-page { width: min(100%, 1720px); margin: 0 auto; padding: clamp(1.5rem, 3vw, 3.5rem) clamp(1rem, 2.5vw, 2.5rem) 4rem; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2.5rem; }
.page-heading > div:first-child > p:last-child { max-width: 620px; color: var(--muted); line-height: 1.55; margin-top: 1.1rem; }
.heading-actions { display: flex; gap: .65rem; flex: 0 0 auto; }
.primary-button, .secondary-button, .danger-button { min-height: 42px; border: 1px solid var(--navy); border-radius: 2px; padding: .75rem 1rem; font-family: var(--font-mono); font-size: .68rem; font-weight: 650; letter-spacing: .015em; text-transform: uppercase; }
.primary-button { background: var(--accent); border-color: var(--accent); color: var(--navy); }
.primary-button:hover:not(:disabled) { background: var(--navy); border-color: var(--navy); color: var(--white); }
.secondary-button { background: transparent; color: var(--navy); }
.secondary-button:hover:not(:disabled) { background: var(--navy); color: var(--white); }
.danger-button { background: transparent; color: var(--accent); border-color: var(--accent); }
.danger-button:hover:not(:disabled) { background: var(--accent); color: var(--navy); }
.wide { width: 100%; }
.back-link { border: 0; background: transparent; padding: 0; margin-bottom: 2rem; color: var(--muted); font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; }
.back-link:hover { color: var(--accent); }
.app-footer { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding: 1.25rem 2.5rem; color: var(--muted); font-family: var(--font-mono); font-size: .6rem; }

/* Register */
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); margin-bottom: 1.5rem; }
.metric-strip div { display: flex; justify-content: space-between; align-items: baseline; padding: 1rem 1.25rem; border-right: 1px solid var(--line); }
.metric-strip div:first-child { padding-left: 0; }
.metric-strip div:last-child { border-right: 0; }
.metric-strip span { color: var(--muted); font-family: var(--font-mono); font-size: .62rem; }
.metric-strip strong { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 500; }
.import-panel { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 2rem; padding: 1.5rem; margin-bottom: 1.5rem; border: 1px solid var(--navy); background: var(--white); }
.import-panel h2 { margin: .45rem 0 .6rem; }
.import-panel p { max-width: 680px; color: var(--muted); line-height: 1.5; }
.import-controls { display: flex; align-items: end; gap: .65rem; }
.import-controls input { min-width: 300px; font-size: .75rem; }
.filter-bar { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.filter-bar label, .decision-note label { display: grid; gap: .4rem; color: var(--muted); font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.filter-bar input, .filter-bar select { min-height: 40px; padding: .65rem .75rem; font-family: var(--font-sans); font-size: .8rem; text-transform: none; }
.filter-submit { min-height: 40px; border: 1px solid var(--navy); background: var(--navy); color: var(--white); padding: 0 1rem; font-family: var(--font-mono); font-size: .65rem; text-transform: uppercase; }
.filter-submit:hover { background: var(--accent); color: var(--navy); }
.error-banner { display: flex; align-items: center; gap: 1rem; padding: 1rem; margin: 1rem 0; border-left: 3px solid var(--accent); background: rgba(255, 84, 50, .08); line-height: 1.4; }
.error-banner strong { flex: 0 0 auto; }
.error-banner span { flex: 1; }
.error-banner button { border: 0; border-bottom: 1px solid currentColor; background: transparent; padding: .25rem 0; font-family: var(--font-mono); font-size: .65rem; text-transform: uppercase; }
.table-frame { max-height: calc(100svh - 355px); min-height: 260px; overflow: auto; border-block: 1px solid var(--navy); background: var(--white); scrollbar-color: var(--navy) var(--paper); }
.data-table { min-width: 960px; }
.data-row { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: .75rem; align-items: center; min-height: 64px; padding: .55rem .75rem; border-bottom: 1px solid var(--faint); }
.data-row > :nth-child(1) { grid-column: span 2; }
.data-row > :nth-child(2) { grid-column: span 4; }
.data-row > :nth-child(3) { grid-column: span 3; }
.data-row > :nth-child(4) { grid-column: span 5; }
.data-row > :nth-child(5) { grid-column: span 2; }
.data-row > :nth-child(6) { grid-column: span 1; }
.data-row > :nth-child(7) { grid-column: span 2; }
.data-row > :nth-child(8) { grid-column: span 5; }
.data-header { position: sticky; top: 0; z-index: 5; min-height: 42px; padding-block: .65rem; background: var(--navy); color: rgba(255, 255, 255, .58); border: 0; font-family: var(--font-mono); font-size: .6rem; letter-spacing: .035em; text-transform: uppercase; }
.data-row:not(.data-header) { transition: opacity 150ms ease, background-color 150ms ease; }
.data-row:not(.data-header):hover { background: var(--paper); }
.code-cell { font-family: var(--font-mono); font-size: .75rem; }
.name-cell, .col-position { min-width: 0; display: grid; gap: .2rem; text-align: left; }
.name-cell button { display: grid; gap: .2rem; width: 100%; border: 0; background: transparent; padding: .3rem 0; text-align: left; }
.name-cell strong, .col-position strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; font-weight: 600; }
.name-cell button:hover strong { color: var(--accent); }
.name-cell small, .col-position small { color: var(--muted); font-family: var(--font-mono); font-size: .58rem; text-transform: uppercase; }
.status-label { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.status-label::before { content: ""; width: 6px; height: 6px; background: var(--navy); }
.status-label.inactive { color: var(--muted); }
.status-label.inactive::before { background: var(--accent); }
.row-actions { display: flex; justify-content: flex-end; gap: .45rem; }
.row-actions button { border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: .35rem .1rem; font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.row-actions button:hover { color: var(--accent); border-color: var(--accent); }
.table-state, .page-state { display: grid; place-content: center; justify-items: center; min-height: 240px; padding: 3rem; text-align: center; color: var(--muted); }
.table-state h3, .page-state h2 { color: var(--ink); margin: .5rem 0; }
.table-state p, .page-state p { max-width: 440px; line-height: 1.5; }
.loading-line { width: 120px; height: 2px; margin-bottom: 1rem; background: var(--accent); animation: loading-pulse 1.2s ease-in-out infinite alternate; }
@keyframes loading-pulse { from { transform: scaleX(.2); opacity: .35; } to { transform: scaleX(1); opacity: 1; } }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 1rem; color: var(--muted); font-family: var(--font-mono); font-size: .64rem; }
.pagination div { display: flex; gap: .5rem; }
.pagination button { border: 1px solid var(--line); background: transparent; padding: .6rem .8rem; font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.pagination button:hover:not(:disabled) { border-color: var(--navy); color: var(--accent); }

/* Details */
.detail-heading h1 { font-size: clamp(2.5rem, 4.5vw, 4.3rem); }
.detail-status-line { display: flex; gap: 1.5rem; align-items: center; border-block: 1px solid var(--line); padding: .8rem 0; color: var(--muted); font-family: var(--font-mono); font-size: .62rem; }
.confirmation-panel { display: grid; grid-template-columns: 1fr minmax(260px, .8fr) auto; align-items: end; gap: 1.5rem; padding: 1.5rem; margin: 1.5rem 0; border: 1px solid var(--accent); background: var(--white); }
.confirmation-panel h2 { margin: .4rem 0; }
.confirmation-panel p { color: var(--muted); line-height: 1.45; }
.confirmation-panel label { display: grid; gap: .4rem; font-family: var(--font-mono); font-size: .65rem; text-transform: uppercase; }
.confirmation-panel > div:last-child { display: flex; gap: .5rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 2rem; border-top: 1px solid var(--navy); }
.detail-section { padding: 1.5rem 1.5rem 1.5rem 0; border-bottom: 1px solid var(--line); }
.detail-section:nth-child(odd) { border-right: 1px solid var(--line); }
.detail-section:nth-child(even) { padding-left: 1.5rem; }
.detail-section dl { margin: 1.25rem 0 0; }
.definition { display: grid; grid-template-columns: minmax(130px, .8fr) 1.2fr; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--faint); }
.definition dt { color: var(--muted); font-size: .75rem; }
.definition dd { margin: 0; font-size: .82rem; overflow-wrap: anywhere; }
.section-note { margin-top: 1rem; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.family-section, .audit-section { margin-top: 3rem; }
.section-heading { margin-bottom: 1.25rem; }
.section-heading h2 { margin: .4rem 0; }
.section-heading p { color: var(--muted); }
.family-table { border-top: 1px solid var(--navy); }
.family-row { display: grid; grid-template-columns: 1fr 3fr 2fr 2fr; gap: 1rem; padding: .85rem .5rem; border-bottom: 1px solid var(--line); }
.family-row span { color: var(--muted); }
.family-header { background: var(--navy); color: var(--white); font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.family-header span { color: rgba(255, 255, 255, .62); }
.empty-inline { padding: 1.25rem 0; color: var(--muted); }
.audit-list { border-top: 1px solid var(--navy); }
.audit-entry { display: grid; grid-template-columns: 130px 160px 1fr auto; gap: 1rem; align-items: baseline; padding: .85rem .5rem; border-bottom: 1px solid var(--line); }
.audit-entry > span, .audit-entry small { color: var(--muted); font-family: var(--font-mono); font-size: .62rem; }
.audit-entry strong { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; }

/* Forms */
.form-version { color: var(--muted); font-family: var(--font-mono); font-size: .65rem; }
.employee-form { background: var(--white); border-top: 1px solid var(--navy); }
.form-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.form-tabs { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.form-tabs button { display: flex; align-items: center; gap: 1rem; min-height: 58px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); padding: 1rem 1.25rem; text-align: left; font-size: .78rem; }
.form-tabs button span { font-family: var(--font-mono); font-size: .62rem; }
.form-tabs button:hover { color: var(--ink); background: var(--paper); }
.form-tabs button.active { background: var(--navy); color: var(--white); box-shadow: inset 3px 0 var(--accent); }
.form-content { min-height: 610px; padding: clamp(1.5rem, 3vw, 3rem); animation: tab-in 150ms ease; }
@keyframes tab-in { from { opacity: .5; } to { opacity: 1; } }
.form-section-heading { max-width: 720px; margin-bottom: 2rem; }
.form-section-heading h2 { margin: .45rem 0 .65rem; font-size: 2rem; }
.form-section-heading p { color: var(--muted); line-height: 1.55; }
.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1rem; }
.form-field > span { color: var(--muted); font-family: var(--font-mono); font-size: .64rem; letter-spacing: .025em; text-transform: uppercase; }
.form-field.wide { grid-column: 1 / -1; }
.form-field input, .form-field select { min-height: 46px; }
.placement-block { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--navy); }
.placement-block > div:first-child { margin-bottom: 1.25rem; }
.placement-block h3 { margin: .4rem 0; }
.placement-block p { color: var(--muted); line-height: 1.5; }
.rule-notice { padding: .8rem 1rem; margin-top: 1rem; background: var(--navy); color: var(--white) !important; font-family: var(--font-mono); font-size: .68rem; }
.family-meta { max-width: 640px; }
.children-editor { margin-top: 2rem; }
.children-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--navy); padding-bottom: .75rem; }
.child-row { display: grid; grid-template-columns: 40px 2fr 1.2fr 1.2fr auto; gap: .75rem; align-items: end; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.child-row label { display: grid; gap: .4rem; color: var(--muted); font-family: var(--font-mono); font-size: .6rem; text-transform: uppercase; }
.child-index { align-self: center; color: var(--muted); font-family: var(--font-mono); }
.remove-button { min-height: 46px; border: 0; background: transparent; color: var(--accent); font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.form-footer { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 76px; padding: 1rem 1.5rem; border-top: 1px solid var(--navy); background: rgba(255, 255, 255, .96); }
.form-footer > div { display: flex; align-items: center; gap: .65rem; }
.form-footer > div:first-child { color: var(--muted); font-size: .72rem; }
.form-error { color: #a12b16; line-height: 1.45; }

/* Approvals and audit ledger */
.approval-policy { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; border-block: 1px solid var(--line); padding: 1rem 0; }
.approval-policy p { color: var(--muted); line-height: 1.55; }
.decision-note { max-width: 620px; margin: 1.5rem 0; }
.approval-list { border-top: 1px solid var(--navy); }
.approval-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(420px, 2fr) minmax(170px, .7fr); gap: 1.5rem; align-items: center; padding: 1.35rem .75rem; border-bottom: 1px solid var(--line); }
.approval-person { display: grid; gap: .35rem; }
.approval-person button { justify-self: start; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 0; font-weight: 650; }
.approval-person button:hover { color: var(--accent); }
.approval-person small { color: var(--muted); font-size: .65rem; }
.placement-change { display: grid; grid-template-columns: 1fr 30px 1fr; gap: .75rem; align-items: center; }
.placement-change > div { display: grid; gap: .25rem; }
.placement-change span, .placement-change small { color: var(--muted); font-family: var(--font-mono); font-size: .6rem; text-transform: uppercase; }
.change-arrow { color: var(--accent) !important; font-size: 1.2rem !important; }
.approval-status { display: grid; justify-items: end; gap: .8rem; }
.approval-status > div { display: flex; gap: .5rem; }
.request-status { font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.request-status.approved { color: var(--navy); }
.request-status.rejected { color: var(--accent); }
.audit-filter { display: flex; gap: 0; margin-bottom: 1.5rem; overflow-x: auto; }
.audit-filter button { flex: 0 0 auto; border: 1px solid var(--line); border-right: 0; background: transparent; padding: .65rem .9rem; color: var(--muted); font-family: var(--font-mono); font-size: .62rem; text-transform: uppercase; }
.audit-filter button:last-child { border-right: 1px solid var(--line); }
.audit-filter button.active { background: var(--navy); color: var(--white); }
.audit-ledger { border-top: 1px solid var(--navy); background: var(--white); }
.ledger-row { display: grid; grid-template-columns: 1.2fr .8fr 1.5fr 3fr; gap: 1rem; padding: 1rem .75rem; border-bottom: 1px solid var(--line); }
.ledger-row > div { display: grid; align-content: start; gap: .35rem; }
.ledger-row small { color: var(--muted); font-size: .64rem; line-height: 1.4; overflow-wrap: anywhere; }
.ledger-row p { line-height: 1.45; }
.ledger-header { background: var(--navy); color: rgba(255, 255, 255, .62); font-family: var(--font-mono); font-size: .6rem; text-transform: uppercase; }
.audit-action { font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase; }
.old-value { color: #a12b16 !important; }

@media (hover: hover) and (min-width: 901px) {
    .data-row:not(.data-header):focus-within { background: var(--paper); }
}

@media (max-width: 1100px) {
    .wordmark { grid-column: span 8; }
    .estate-meta { grid-column: span 8; gap: .8rem; }
    .account-block { grid-column: span 8; }
    .filter-bar { grid-template-columns: 2fr 1fr 1fr; }
    .filter-bar label:nth-child(4) { grid-column: 1; }
    .import-panel { grid-template-columns: 1fr; align-items: start; }
    .approval-row { grid-template-columns: 1fr 2fr; }
    .approval-status { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; }
    .child-row { grid-template-columns: 30px 1fr 1fr; }
    .child-row label:nth-of-type(3) { grid-column: 2; }
    .confirmation-panel { grid-template-columns: 1fr 1fr; }
    .confirmation-panel > div:last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    html { font-size: 13px; }
    .login-layout { grid-template-columns: 1fr; }
    .login-brand { min-height: auto; padding: 1.5rem; }
    .login-brand-top { margin-bottom: 4rem; }
    .login-title { padding: 0 0 3rem; }
    .login-title h1 { font-size: clamp(3.2rem, 15vw, 5rem); }
    .login-title > p:last-child { margin-top: 1.25rem; }
    .estate-facts { margin-bottom: 1rem; }
    .login-panel { padding: 3rem 1.5rem; }
    .topbar { min-height: 62px; grid-template-columns: 1fr auto; }
    .wordmark { grid-column: 1; padding: 0 1rem; border-right: 0; }
    .brand-copy, .estate-meta { display: none; }
    .account-block { grid-column: 2; padding: .6rem 1rem; }
    .account-block > span, .account-block > small { display: none; }
    .account-block .text-button { grid-column: 1; grid-row: 1; border: 0; }
    .workspace-nav { top: 62px; padding-left: 0; }
    .workspace-nav button { padding: .85rem 1rem; }
    .workspace-page { padding: 1.5rem 1rem 3rem; }
    .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 1.75rem; }
    .heading-actions { width: 100%; flex-wrap: wrap; }
    .heading-actions button { flex: 1; }
    .metric-strip { grid-template-columns: repeat(2, 1fr); }
    .metric-strip div { padding: .8rem; border-bottom: 1px solid var(--line); }
    .metric-strip div:nth-child(2) { border-right: 0; }
    .metric-strip div:first-child { padding-left: .8rem; }
    .import-controls { flex-direction: column; align-items: stretch; }
    .import-controls input { min-width: 0; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-bar .search-field { grid-column: 1 / -1; }
    .filter-bar label:nth-child(4) { grid-column: auto; }
    .filter-submit { grid-column: 1 / -1; }
    .table-frame { max-height: none; min-height: 260px; overflow-x: hidden; }
    .data-table { min-width: 0; }
    .data-row { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .5rem; min-height: 68px; padding: .6rem .35rem; }
    .data-row > :nth-child(1) { grid-column: span 2; }
    .data-row > :nth-child(2) { grid-column: span 5; }
    .data-row > :nth-child(5) { grid-column: span 2; }
    .data-row > :nth-child(7) { grid-column: span 3; }
    .data-row > :nth-child(8) { grid-column: 5 / span 8; grid-row: 2; justify-content: flex-start; }
    .data-row .col-nik, .data-row .col-position, .data-row .col-children { display: none; }
    .name-cell small { display: none; }
    .row-actions { grid-row: 2; }
    .data-header > :nth-child(8) { display: none; }
    .data-header { min-height: 38px; }
    .pagination { align-items: flex-start; flex-direction: column; }
    .app-footer { flex-direction: column; padding: 1rem; }
    .detail-status-line { flex-wrap: wrap; gap: .75rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-section, .detail-section:nth-child(even) { padding: 1.25rem 0; }
    .detail-section:nth-child(odd) { border-right: 0; }
    .family-row { grid-template-columns: 1fr 2fr; }
    .family-row > :nth-child(3), .family-row > :nth-child(4) { display: none; }
    .confirmation-panel { grid-template-columns: 1fr; }
    .confirmation-panel > div:last-child { grid-column: auto; flex-wrap: wrap; }
    .audit-entry { grid-template-columns: 1fr 1fr; }
    .audit-entry p { grid-column: 1 / -1; }
    .form-layout { grid-template-columns: 1fr; }
    .form-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .form-tabs button { flex: 0 0 auto; min-height: 50px; border-right: 1px solid var(--line); border-bottom: 0; padding: .75rem 1rem; }
    .form-tabs button.active { box-shadow: inset 0 -3px var(--accent); }
    .form-content { min-height: 500px; padding: 1.5rem 1rem; }
    .fields-grid { grid-template-columns: 1fr; }
    .form-field.wide { grid-column: auto; }
    .child-row { grid-template-columns: 30px 1fr; }
    .child-row label, .child-row label:nth-of-type(3) { grid-column: 2; }
    .child-row .remove-button { grid-column: 2; justify-self: start; }
    .form-footer { align-items: stretch; flex-direction: column; padding: .75rem; }
    .form-footer > div:last-child { display: grid; grid-template-columns: 1fr 1.5fr; }
    .form-footer > div:first-child > span { display: none; }
    .approval-policy { grid-template-columns: 1fr; }
    .approval-row { grid-template-columns: 1fr; gap: 1rem; }
    .approval-status { grid-column: auto; }
    .placement-change { grid-template-columns: 1fr 20px 1fr; }
    .ledger-row { grid-template-columns: 1fr 1fr; }
    .ledger-row > :nth-child(3), .ledger-row > :nth-child(4) { grid-column: 1 / -1; }
    .ledger-header { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
