:root {
    --red: #c8102e;
    --red-dark: #9f0b23;
    --red-soft: #fff0f2;
    --ink: #17191c;
    --muted: #687078;
    --line: #e4e7e9;
    --surface: #ffffff;
    --canvas: #f5f6f7;
    --green: #167451;
    --green-soft: #eaf7f1;
    --amber: #9b6200;
    --amber-soft: #fff6df;
    --sidebar: #202328;
    --shadow: 0 18px 55px rgba(27, 31, 36, .16);
    --radius: 14px;
    --sidebar-width: 268px;
    font-family: Roboto, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: currentColor; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 3vw, 2.75rem); line-height: 1.08; letter-spacing: -.045em; font-weight: 720; }
h2 { margin-bottom: 5px; font-size: 1.25rem; line-height: 1.3; letter-spacing: -.02em; }
h3 { margin-bottom: 5px; font-size: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 28px 18px 18px; overflow-y: auto; color: #fff; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 13px; padding: 0 9px; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: .97rem; line-height: 1.2; letter-spacing: -.01em; }
.brand small { color: #aeb4ba; font-size: .73rem; line-height: 1.2; }
.brand-mark { position: relative; display: inline-block; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.16); }
.brand-mark i, .brand-mark b { position: absolute; display: block; left: 50%; top: 50%; background: var(--red); transform: translate(-50%, -50%); }
.brand-mark i { width: 16px; height: 5px; }
.brand-mark b { width: 5px; height: 16px; }
.main-nav { display: grid; gap: 4px; margin-top: 47px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 13px; border-radius: 9px; color: #b7bdc2; font-size: .89rem; font-weight: 560; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-link::before { position: absolute; left: -18px; width: 3px; height: 20px; border-radius: 0 4px 4px 0; content: ""; background: transparent; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.055); transform: translateX(2px); }
.nav-link.is-active { color: #fff; background: rgba(255,255,255,.09); }
.nav-link.is-active::before { background: #ee284a; }
.sidebar-foot { margin-top: auto; padding-top: 32px; }
.user-block { display: flex; align-items: center; gap: 10px; padding: 13px 8px 2px; border-top: 1px solid rgba(255,255,255,.11); }
.avatar { display: grid; flex: 0 0 35px; width: 35px; height: 35px; place-items: center; border-radius: 50%; color: white; background: var(--red); font-size: .8rem; font-weight: 700; }
.user-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.user-copy strong { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.user-copy small { color: #9ea5aa; font-size: .68rem; }
.user-block .icon-button { color: #9ea5aa; }
.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.page-wrap { width: min(1480px, 100%); margin: 0 auto; padding: 48px clamp(28px, 4vw, 64px) 72px; animation: page-in .4s cubic-bezier(.2,.75,.25,1) both; }
.mobile-header { display: none; }
.sidebar-scrim { display: none; }

@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 36px; }
.page-header h1 { margin-bottom: 9px; }
.page-intro { margin: 0; color: var(--muted); font-size: .95rem; }
.eyebrow { display: inline-block; margin: 0 0 12px; color: rgba(255,255,255,.68); font-size: .67rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow-dark { color: var(--red); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 0; border-radius: 8px; cursor: pointer; font-size: .84rem; font-weight: 680; transition: box-shadow .18s ease, background .18s ease, color .18s ease, transform .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(200,16,46,.22); outline-offset: 3px; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-primary { color: #fff; background: var(--red); box-shadow: 0 5px 13px rgba(200,16,46,.18); }
.button-primary:hover { background: var(--red-dark); box-shadow: 0 7px 18px rgba(200,16,46,.24); }
.button-secondary { border: 1px solid #d9dddf; color: #30353a; background: #fff; }
.button-secondary:hover { border-color: #b9bec2; background: #fafafa; }
.button-quiet { color: var(--muted); background: transparent; }
.button-quiet:hover { color: var(--ink); background: #f1f2f3; }
.button-wide { width: 100%; justify-content: space-between; min-height: 50px; padding-inline: 20px; }
.icon-button { display: inline-grid; width: 38px; height: 38px; padding: 0; place-items: center; border: 0; border-radius: 50%; cursor: pointer; color: inherit; background: transparent; transition: background .18s ease, color .18s ease; }
.icon-button:hover { color: var(--ink); background: rgba(96,103,110,.1); }
.text-button, .text-link { display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer; color: var(--red); background: none; font-size: .79rem; font-weight: 700; }
.text-link svg { transition: transform .18s ease; }
.text-link:hover svg { transform: translateX(3px); }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.critical-banner, .info-banner { display: flex; min-height: 70px; align-items: center; gap: 14px; margin-bottom: 27px; padding: 13px 19px; border-left: 3px solid var(--red); color: #5d1522; background: var(--red-soft); transition: transform .2s ease, box-shadow .2s ease; }
.critical-banner:hover { transform: translateY(-1px); box-shadow: 0 8px 25px rgba(110,20,37,.07); }
.critical-symbol { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: white; background: var(--red); }
.critical-banner > span:nth-child(2), .info-banner > div { display: grid; flex: 1; gap: 3px; }
.critical-banner strong, .info-banner strong { font-size: .86rem; }
.critical-banner small, .info-banner small { color: #82515a; font-size: .75rem; }
.critical-link { display: flex; align-items: center; gap: 7px; font-size: .75rem; font-weight: 700; }
.info-banner { border-left-color: #8292a0; color: #33404a; background: #edf2f5; }
.info-banner small { color: #677681; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 44px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { position: relative; display: grid; gap: 5px; padding: 24px 27px; }
.metric:first-child { padding-left: 0; }
.metric + .metric::before { position: absolute; left: 0; top: 25%; width: 1px; height: 50%; content: ""; background: var(--line); }
.metric > span { color: var(--muted); font-size: .71rem; font-weight: 620; }
.metric > strong { font-size: clamp(1.5rem, 2vw, 2rem); line-height: 1.12; letter-spacing: -.035em; }
.metric > small { color: #8b9298; font-size: .68rem; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 28px; align-items: stretch; }
.section-block { padding: 27px 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 1px rgba(25,31,35,.015); }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; color: var(--muted); font-size: .76rem; }
.stock-list { display: grid; }
.stock-row { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(210px, 1.6fr) 90px; align-items: center; gap: 24px; min-height: 70px; border-top: 1px solid #edf0f1; }
.stock-row:first-child { border-top: 0; }
.stock-title, .stock-values { display: grid; gap: 4px; }
.stock-title strong, .stock-values strong { font-size: .83rem; }
.stock-title small, .stock-values small { color: var(--muted); font-size: .67rem; }
.stock-measure { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 14px; }
.progress-track { position: relative; height: 5px; overflow: visible; border-radius: 5px; background: #e9ecee; }
.progress-fill { position: absolute; inset: 0 auto 0 0; min-width: 2px; border-radius: inherit; background: #64717a; transform-origin: left; animation: progress-grow .7s .15s cubic-bezier(.2,.7,.2,1) both; }
@keyframes progress-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.progress-fill.status-critical { background: var(--red); }
.progress-fill.status-attention { background: #d99217; }
.progress-fill.status-ok { background: var(--green); }
.threshold-mark { position: absolute; right: 0; top: -3px; width: 1px; height: 11px; background: #a2a8ad; }
.status-label { display: inline-flex; width: fit-content; min-height: 25px; align-items: center; justify-content: center; padding: 0 9px; border-radius: 12px; font-size: .64rem; font-weight: 720; }
.status-label.status-critical { color: var(--red-dark); background: var(--red-soft); }
.status-label.status-attention { color: var(--amber); background: var(--amber-soft); }
.status-label.status-ok { color: var(--green); background: var(--green-soft); }
.activity-chart { display: flex; min-height: 380px; flex-direction: column; }
.chart-legend { display: flex; gap: 17px; margin-bottom: 18px; color: var(--muted); font-size: .68rem; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; background: #dadde0; }
.chart-legend .legend-in { background: var(--red); }
.chart-legend .legend-out { background: #414950; }
.bar-chart { position: relative; display: grid; flex: 1; grid-template-columns: repeat(6, 1fr); gap: 7px; align-items: end; padding-top: 10px; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), #eef0f2 25%); }
.bar-group { display: grid; height: 100%; grid-template-rows: 1fr 20px; align-items: end; gap: 9px; }
.bar-group > small { color: var(--muted); font-size: .62rem; text-align: center; }
.bars { display: flex; height: 100%; align-items: end; justify-content: center; gap: 3px; }
.bar { width: min(11px, 38%); min-height: 2px; border-radius: 3px 3px 0 0; background: #414950; transform-origin: bottom; animation: bar-rise .7s .25s cubic-bezier(.2,.7,.2,1) both; }
.bar-in { background: var(--red); }
@keyframes bar-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.recent-section { margin-top: 28px; }

.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .77rem; }
.data-table th { height: 39px; padding: 0 14px; color: #81898f; border-bottom: 1px solid var(--line); font-size: .64rem; font-weight: 680; text-align: left; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { padding-left: 0; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; }
.data-table td { height: 62px; padding: 10px 14px; border-bottom: 1px solid #edf0f1; color: #474d52; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .16s ease; }
.data-table tbody tr:hover { background: #fafbfb; }
.data-table td strong { color: #24282c; font-size: .78rem; }
.align-right { text-align: right !important; }
.quantity { color: #25292d !important; font-weight: 720; white-space: nowrap; }
.cell-note { display: block; max-width: 280px; margin-top: 4px; overflow: hidden; color: #8a9298; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.movement-type { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 5px; font-size: .62rem; font-weight: 720; }
.movement-in { color: var(--green); background: var(--green-soft); }
.movement-out { color: #4c545b; background: #eceff1; }
.row-muted { opacity: .52; }
.row-action { width: 46px; }
.reference-code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .71rem !important; }
.type-label { display: inline-flex; padding: 5px 9px; border-radius: 6px; color: #55616a; background: #f0f2f3; font-size: .68rem; }

.event-list-section { padding-bottom: 18px; }
.export-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: end; gap: 18px; margin-bottom: 28px; padding: 18px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.45); }
.export-copy { display: flex; align-items: center; gap: 12px; padding-bottom: 3px; }
.export-copy h2 { margin: 0 0 3px; font-size: .88rem; }
.export-copy p { margin: 0; color: var(--muted); font-size: .67rem; }
.export-icon { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: #59636b; background: #e9ecee; }
.export-form { display: flex; align-items: end; gap: 8px; }
.compact-export-field { min-width: 145px; }
.compact-export-field input { min-height: 41px; }
.field > span em { margin-left: 3px; color: #858d93; font-size: .62rem; font-style: normal; font-weight: 500; }
.event-list { border-top: 1px solid var(--line); }
.event-row { border-bottom: 1px solid var(--line); }
.event-row summary { display: grid; grid-template-columns: 95px 1fr minmax(150px, .35fr) 26px; align-items: center; gap: 23px; min-height: 88px; padding: 8px 2px; cursor: pointer; list-style: none; transition: background .16s ease; }
.event-row summary::-webkit-details-marker { display: none; }
.event-row summary:hover { background: #fafbfb; }
.event-date { display: flex; align-items: baseline; gap: 7px; }
.event-date strong { font-size: 1.45rem; letter-spacing: -.04em; }
.event-date small { max-width: 42px; color: #81898f; font-size: .58rem; font-weight: 700; line-height: 1.25; }
.event-main, .event-meta { display: grid; gap: 5px; }
.event-main strong { font-size: .86rem; }
.event-main small, .event-meta small { color: var(--muted); font-size: .67rem; }
.event-meta { text-align: right; }
.event-meta strong { font-size: .85rem; }
.disclosure { width: 8px; height: 8px; border-right: 1.5px solid #747c82; border-bottom: 1.5px solid #747c82; transform: rotate(45deg); transition: transform .2s ease; }
.event-row[open] .disclosure { transform: rotate(225deg); }
.event-detail { display: grid; grid-template-columns: 1fr .8fr; gap: 35px; padding: 2px 45px 25px 118px; animation: detail-in .2s ease both; }
@keyframes detail-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.event-items { display: grid; border-top: 1px solid #edf0f1; }
.event-items span { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid #edf0f1; font-size: .72rem; }
.event-items span b { font-weight: 720; }
.event-note { color: #7b8389; font-size: .68rem; line-height: 1.55; }
.event-note p { margin: 10px 0 0; color: #545c62; }

.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; padding: 30px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 14px 0 5px; color: var(--ink); }
.empty-state p { max-width: 400px; margin-bottom: 18px; font-size: .78rem; }
.empty-state.compact { min-height: 100px; }
.empty-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; color: #6e777d; background: #eef0f2; }
.empty-state-page { min-height: 70vh; }
.empty-state-page h1 { font-size: 2rem; }

.filter-bar { display: flex; align-items: end; gap: 10px; margin-bottom: 25px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.filter-count { margin-left: auto; padding-bottom: 13px; color: var(--muted); font-size: .7rem; }
.compact-field { min-width: 180px; }

.modal { width: min(600px, calc(100vw - 32px)); max-height: min(820px, calc(100vh - 32px)); padding: 0; overflow: hidden; border: 0; border-radius: 17px; color: var(--ink); background: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px) scale(.985); transition: opacity .2s ease, transform .2s ease, overlay .2s allow-discrete, display .2s allow-discrete; }
.modal[open] { opacity: 1; transform: none; }
@starting-style { .modal[open] { opacity: 0; transform: translateY(12px) scale(.985); } }
.modal::backdrop { background: rgba(18, 22, 25, .56); backdrop-filter: blur(2px); opacity: 0; transition: opacity .2s ease, overlay .2s allow-discrete, display .2s allow-discrete; }
.modal[open]::backdrop { opacity: 1; }
@starting-style { .modal[open]::backdrop { opacity: 0; } }
.modal-large { width: min(760px, calc(100vw - 32px)); }
.modal form { display: grid; max-height: inherit; grid-template-rows: auto minmax(0, 1fr) auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 25px 28px 20px; border-bottom: 1px solid var(--line); }
.modal-header .eyebrow { margin-bottom: 6px; }
.modal-header h2 { margin: 0; font-size: 1.35rem; }
.modal-body { padding: 25px 28px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 28px; border-top: 1px solid var(--line); background: #fafafa; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; }
.field > span { color: #464d53; font-size: .69rem; font-weight: 680; }
.field > small { min-height: 13px; color: #8b9298; font-size: .62rem; line-height: 1.35; }
.field-span-2 { grid-column: span 2; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d9dddf; border-radius: 7px; outline: 0; color: #252a2e; background: #fff; font-size: .79rem; transition: border .16s ease, box-shadow .16s ease, background .16s ease; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #adb2b6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.09); }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 45px; }
.input-suffix b { position: absolute; right: 12px; top: 50%; color: #858d93; font-size: .67rem; transform: translateY(-50%); }
.switch-field { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-field > input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control { position: relative; flex: 0 0 38px; width: 38px; height: 22px; border-radius: 12px; background: #bbc1c5; transition: background .2s ease; }
.switch-control::after { position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; content: ""; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s ease; }
.switch-field input:checked + .switch-control { background: var(--red); }
.switch-field input:checked + .switch-control::after { transform: translateX(16px); }
.switch-field > span:last-child { display: grid; gap: 2px; }
.switch-field strong { font-size: .72rem; }
.switch-field small { color: var(--muted); font-size: .63rem; }
.items-editor { margin: 25px 0; padding: 22px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.items-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.items-heading h3 { font-size: .9rem; }
.items-heading p { margin: 0; color: var(--muted); font-size: .65rem; }
.running-total { color: var(--muted); font-size: .68rem; font-weight: 600; }
.running-total span { display: block; margin-top: 3px; color: var(--ink); font-size: .95rem; text-align: right; }
.item-lines { display: grid; gap: 12px; }
.item-line { display: grid; grid-template-columns: 1fr 170px 38px; align-items: start; gap: 10px; padding: 13px; border-radius: 9px; background: #f6f7f8; }
.item-line .field input, .item-line .field select { background: white; }
.remove-item { margin-top: 22px; color: #777f85; }
.item-line:only-child .remove-item { visibility: hidden; }
.add-item { margin-top: 13px; }

.toast-region { position: fixed; z-index: 100; right: 24px; bottom: 24px; display: grid; width: min(390px, calc(100vw - 32px)); gap: 10px; }
.toast { display: flex; min-height: 56px; align-items: center; gap: 11px; padding: 12px 13px 12px 16px; border-radius: 10px; color: white; background: #2b3034; box-shadow: 0 12px 35px rgba(24,29,33,.25); font-size: .76rem; animation: toast-in .3s ease both; }
.toast svg { flex: 0 0 auto; }
.toast span { flex: 1; }
.toast-success > svg { color: #67d5aa; }
.toast-error > svg { color: #ff879b; }
.toast-close { width: 30px; height: 30px; border: 0; border-radius: 50%; color: #cfd3d5; background: transparent; cursor: pointer; font-size: 1.2rem; }
.toast.is-leaving { opacity: 0; transform: translateY(10px); transition: .2s ease; }

.auth-page { overflow-x: hidden; background: white; }
.auth-layout { display: grid; min-height: 100svh; grid-template-columns: minmax(0, 1.28fr) minmax(440px, .72fr); }
.auth-brand-panel { position: relative; display: flex; overflow: hidden; color: white; background: #b30d29; }
.auth-brand-panel::before { position: absolute; inset: 0; content: ""; opacity: .24; background: radial-gradient(circle at 18% 10%, rgba(255,255,255,.24), transparent 25%), linear-gradient(128deg, transparent 28%, rgba(78,0,14,.26) 100%); }
.auth-brand-panel::after { position: absolute; right: -15vw; bottom: -22vw; width: 60vw; height: 60vw; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; content: ""; box-shadow: 0 0 0 8vw rgba(255,255,255,.025), 0 0 0 18vw rgba(255,255,255,.025); }
.auth-brand-content { position: relative; z-index: 1; display: flex; width: 100%; flex-direction: column; justify-content: space-between; padding: clamp(35px, 5vw, 70px); }
.brand-light { padding: 0; }
.brand-light small { color: rgba(255,255,255,.62); }
.brand-mark-light { box-shadow: none; }
.auth-statement { margin: auto 0; padding: 9vh 0; }
.auth-statement h1 { max-width: 730px; margin-bottom: 22px; font-size: clamp(2.8rem, 5.2vw, 5.8rem); line-height: .98; color: white; letter-spacing: -.065em; }
.auth-statement p { max-width: 520px; margin: 0; color: rgba(255,255,255,.7); font-size: clamp(.9rem, 1.3vw, 1.1rem); line-height: 1.55; }
.auth-watermark { color: rgba(255,255,255,.35); font-size: .63rem; font-weight: 750; letter-spacing: .55em; }
.auth-action-panel { display: grid; place-items: center; padding: 45px; background: white; }
.auth-box { width: min(370px, 100%); }
.auth-box h2 { margin-bottom: 13px; font-size: 2rem; letter-spacing: -.04em; }
.auth-box > p { margin-bottom: 26px; color: var(--muted); font-size: .83rem; line-height: 1.6; }
.auth-note { display: block; margin-top: 17px; color: #92999e; font-size: .64rem; line-height: 1.5; text-align: center; }
.inline-alert { display: flex; align-items: start; gap: 9px; margin-bottom: 20px; padding: 12px; border-left: 3px solid var(--red); color: #6d1a29; background: var(--red-soft); font-size: .7rem; line-height: 1.45; }
.inline-alert svg { flex: 0 0 auto; }
.mobile-auth-mark { display: none; }

.simple-page { display: grid; min-height: 100vh; place-items: center; padding: 35px; background: var(--canvas); }
.simple-panel { width: min(620px, 100%); padding: 45px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.simple-panel > .brand-mark { margin-bottom: 30px; }
.simple-panel h1 { font-size: 2.2rem; }
.simple-panel > p { color: var(--muted); line-height: 1.55; }
.setup-list { display: grid; gap: 12px; margin: 25px 0 0; padding-left: 20px; color: #444b50; font-size: .8rem; line-height: 1.5; }
code { padding: 2px 5px; border-radius: 4px; color: #8f1730; background: #f7edf0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.technical-error { margin: 25px 0 0; padding: 14px; overflow: auto; border-radius: 8px; color: #6d252f; background: #fff0f2; font-size: .67rem; white-space: pre-wrap; }

@media (max-width: 1180px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .activity-chart { min-height: 320px; }
    .bar-chart { min-height: 200px; }
    .auth-layout { grid-template-columns: 1fr minmax(390px, .7fr); }
    .auth-statement h1 { font-size: clamp(2.8rem, 5vw, 4.5rem); }
    .export-toolbar { grid-template-columns: 1fr 1fr; }
    .export-copy { grid-column: 1 / -1; }
    .export-form { display: grid; grid-template-columns: 1fr auto; }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 260px; }
    .sidebar { transform: translateX(-100%); transition: transform .25s cubic-bezier(.2,.75,.25,1); }
    body.nav-open .sidebar { transform: none; }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 35; display: block; visibility: hidden; width: 100%; border: 0; opacity: 0; background: rgba(14,17,19,.45); transition: opacity .25s ease, visibility .25s ease; }
    body.nav-open .sidebar-scrim { visibility: visible; opacity: 1; }
    .workspace { margin-left: 0; }
    .mobile-header { position: sticky; top: 0; z-index: 30; display: flex; height: 62px; align-items: center; gap: 9px; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
    .brand-mobile { gap: 9px; padding: 0; }
    .brand-mobile .brand-mark { width: 28px; height: 28px; flex-basis: 28px; }
    .brand-mobile strong { font-size: .83rem; }
    .page-wrap { padding-top: 35px; }
    .auth-layout { grid-template-columns: 1fr; }
    .auth-brand-panel { display: none; }
    .auth-action-panel { min-height: 100svh; }
    .mobile-auth-mark { display: block; margin-bottom: 60px; }
}

@media (max-width: 680px) {
    h1 { font-size: 2rem; }
    .page-wrap { padding: 28px 16px 50px; }
    .page-header { align-items: stretch; flex-direction: column; margin-bottom: 28px; }
    .page-header .button, .header-actions { width: 100%; }
    .header-actions { display: grid; grid-template-columns: 1fr; }
    .metric-strip { grid-template-columns: 1fr 1fr; }
    .metric { padding: 19px 15px; }
    .metric:nth-child(odd) { padding-left: 0; }
    .metric:nth-child(3)::before { display: none; }
    .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
    .metric > strong { font-size: 1.35rem; }
    .critical-banner, .info-banner { align-items: start; }
    .critical-link, .info-banner .text-link { display: none; }
    .section-block { padding: 22px 18px; border-radius: 11px; }
    .section-heading { align-items: start; flex-direction: column; }
    .stock-row { grid-template-columns: 1fr auto; gap: 8px 15px; padding: 15px 0; }
    .stock-measure { grid-column: 1 / -1; grid-row: 2; grid-template-columns: 75px 1fr; }
    .stock-row .status-label { grid-column: 2; grid-row: 1; }
    .recent-section .section-heading .text-link { display: none; }
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
    .data-table tbody tr:last-child { border-bottom: 0; }
    .data-table td { display: flex; min-height: 31px; height: auto; align-items: center; justify-content: space-between; gap: 20px; padding: 6px 0 !important; border: 0; text-align: right !important; }
    .data-table td::before { flex: 0 0 auto; content: attr(data-label); color: #8a9196; font-size: .62rem; font-weight: 680; text-transform: uppercase; }
    .cell-note { margin-left: auto; }
    .row-action { display: none !important; }
    .event-row summary { grid-template-columns: 62px 1fr 20px; gap: 13px; min-height: 83px; }
    .export-toolbar { grid-template-columns: 1fr; padding: 17px 0; background: transparent; }
    .export-copy { grid-column: auto; }
    .export-form { grid-template-columns: 1fr; }
    .export-form .button { width: 100%; }
    .event-meta { grid-column: 2; display: flex; justify-content: space-between; text-align: left; }
    .event-row summary .disclosure { grid-column: 3; grid-row: 1 / 3; }
    .event-detail { grid-template-columns: 1fr; gap: 18px; padding: 0 0 22px 75px; }
    .event-date { display: grid; gap: 0; }
    .event-date strong { font-size: 1.2rem; }
    .form-grid { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: span 1; }
    .item-line { grid-template-columns: 1fr 34px; }
    .item-line .weight-field { grid-column: 1; }
    .remove-item { grid-column: 2; grid-row: 1 / 3; align-self: center; margin: 0; }
    .modal-header, .modal-body { padding-left: 20px; padding-right: 20px; }
    .modal-footer { padding: 13px 20px; }
    .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
    .compact-field, .filter-count { min-width: 0; }
    .filter-count { grid-column: 1 / -1; margin: 0; padding: 5px 0 0; }
    .toast-region { right: 16px; bottom: 16px; }
    .auth-action-panel { padding: 32px 25px; }
    .auth-box h2 { font-size: 1.75rem; }
    .simple-panel { padding: 30px 24px; }
}

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