:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #667085;
  --line: #d7e0e7;
  --line-strong: #b8c5cf;
  --paper: #fff;
  --wash: #f3f6f8;
  --navy: #183a53;
  --navy-deep: #102b3e;
  --teal: #087f74;
  --teal-dark: #05655d;
  --teal-fill: #e8f6f3;
  --green: #138a54;
  --green-fill: #e8f6ee;
  --amber: #b65a07;
  --amber-fill: #fff5df;
  --red: #bd332c;
  --red-fill: #fff0ef;
  --blue: #1769d2;
  --blue-fill: #eaf3ff;
  --shadow: 0 18px 48px rgba(15, 42, 61, .12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; color: var(--ink); background: var(--wash); letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(23, 105, 210, .25); outline-offset: 2px; }
a { color: inherit; }
.resource-kpi-link { color: inherit; text-decoration: none; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.resource-kpi-link:hover { background: var(--teal-fill); }
.resource-kpi-link small { margin-top: 5px; color: var(--teal); font-size: 11px; font-weight: 700; }
.machine-cost-link { color: var(--teal); font-weight: 800; text-decoration: underline; text-decoration-color: rgba(8,127,116,.3); text-underline-offset: 3px; }
.machine-detail-link { min-width: 150px; display: inline-flex; flex-direction: column; gap: 3px; color: var(--ink); text-decoration: none; }
.machine-detail-link strong { font-size: 12px; }
.machine-detail-link small { color: var(--teal); font-size: 10px; font-weight: 750; }
.machine-detail-link:hover strong { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.machine-detail-link.compact { min-width: 0; }
.billing-link { min-width: 140px; display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--teal); text-decoration: none; white-space: nowrap; }
.billing-link .billing-estimate { color: var(--ink); font-size: 14px; }
.billing-link .billing-estimate span { display: inline; margin-left: 3px; color: var(--muted); font-size: 9px; font-weight: 650; }
.billing-link small { font-size: 10px; }
.billing-link .billing-mode { color: var(--muted); }
.billing-link .billing-detail { color: var(--teal); font-weight: 750; }
.machine-cost-link:hover, .billing-link:hover strong { color: var(--teal-dark); }
.billing-link:hover .billing-detail { text-decoration: underline; text-underline-offset: 2px; }

.topbar { min-height: 66px; padding: 0 28px; display: flex; align-items: center; gap: 28px; background: var(--navy-deep); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(255,255,255,.1); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; flex: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 6px; display: grid; place-items: center; background: #ef6a34; color: #fff; font-weight: 800; }
.brand span:last-child { display: flex; flex-direction: column; }
.brand strong { font-size: 15px; }
.brand small { color: #bcd0de; font-size: 11px; margin-top: 2px; }
.topbar-context { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar-context label { font-size: 11px; color: #bcd0de; }
.topbar-context select { width: min(240px, 25vw); height: 36px; padding: 0 34px 0 11px; color: #fff; background: #234b68; border: 1px solid rgba(255,255,255,.18); border-radius: 5px; }
.topbar-nav { display: flex; align-items: center; gap: 2px; }
.topbar-link { min-height: 36px; padding: 0 12px; display: inline-flex; align-items: center; color: #cfe3ed; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.topbar-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.topbar-link.is-active { color: #fff; background: rgba(255,255,255,.07); box-shadow: inset 0 -2px 0 #66d0c5; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-scope { color: #bcd0de; font-size: 11px; white-space: nowrap; }
.user-label { color: #c7d6e1; font-size: 12px; }
.button { min-height: 38px; border: 1px solid transparent; border-radius: 5px; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 650; font-size: 13px; white-space: nowrap; }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.button.danger { background: var(--red); color: #fff; border-color: var(--red); }
.topbar-button { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.topbar-button:hover { background: rgba(255,255,255,.09); }
.button.full { width: 100%; min-height: 44px; }

.page-shell { width: min(1520px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 56px; }
.page-heading { min-height: 76px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--teal); font-size: 11px; font-weight: 800; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: 26px; line-height: 1.25; }
h2 { margin: 0; font-size: 16px; line-height: 1.35; }
.page-heading > div > p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.machine-subtabs { display: flex; align-items: stretch; gap: 0; margin-bottom: 22px; border: 1px solid var(--line); background: var(--paper); }
.machine-subtabs a { min-width: 220px; padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; color: var(--muted); text-decoration: none; border-right: 1px solid var(--line); border-bottom: 3px solid transparent; }
.machine-subtabs a:last-child { border-right: 0; }
.machine-subtabs a:hover { color: var(--teal); background: #f8fbfb; }
.machine-subtabs a.is-active { color: var(--ink); background: var(--teal-fill); border-bottom-color: var(--teal); }
.machine-subtabs span { font-size: 13px; font-weight: 800; }
.machine-subtabs small { font-size: 10px; color: var(--muted); }
.calculation-meta { display: flex; align-items: center; gap: 10px; min-width: 260px; justify-content: flex-end; }
.calculation-meta > span:last-child { display: flex; flex-direction: column; align-items: flex-end; }
.calculation-meta strong { font-size: 12px; }
.calculation-meta small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px #ffe8c7; }
.sync-dot.ok { background: var(--green); box-shadow: 0 0 0 4px #d5f2e1; }

.tabs { display: flex; gap: 3px; margin-bottom: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { min-height: 43px; padding: 9px 15px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap; }
.tab.is-active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.page-message { padding: 11px 13px; margin-bottom: 16px; border: 1px solid #f3c889; background: var(--amber-fill); color: #7c430e; font-size: 12px; }
.page-message[data-type="error"] { border-color: #efb1ac; background: var(--red-fill); color: var(--red); }
.page-message[data-type="success"] { border-color: #a4dabc; background: var(--green-fill); color: var(--green); }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--paper); margin-bottom: 24px; }
.kpi { min-width: 0; padding: 17px 16px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 7px; }
.kpi strong { display: block; font-size: clamp(17px, 1.7vw, 22px); white-space: nowrap; }
.kpi small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); gap: 18px; }
.panel { background: var(--paper); border: 1px solid var(--line); padding: 18px; }
.panel.spaced { margin-top: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 12px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-actions { margin-bottom: 12px; }
.breakdown { display: grid; gap: 2px; }
.breakdown-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.breakdown-row:last-child { border-bottom: 0; }
.breakdown-row span { color: var(--muted); font-size: 12px; }
.breakdown-row strong { font-size: 14px; }
.breakdown-row.total { margin-top: 5px; padding: 14px 12px; background: var(--blue-fill); border: 0; color: var(--navy); }
.rules-list { margin: 0; }
.rules-list div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rules-list div:last-child { border-bottom: 0; }
.rules-list dt { color: var(--muted); font-size: 12px; }
.rules-list dd { margin: 0; font-size: 12px; font-weight: 700; text-align: right; }
.rules-list a { color: var(--teal); text-underline-offset: 3px; }

.operations-section { margin-bottom: 24px; }
.operations-customer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.operations-customer-card { min-width: 0; padding: 16px; background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--navy); }
.operations-customer-card[data-customer="shenfei"] { border-top-color: var(--teal); }
.operations-customer-card[data-customer="bilibili"] { border-top-color: var(--blue); }
.operations-customer-card[data-customer="flickr"] { border-top-color: #d26f3b; }
.operations-customer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.operations-customer-head h3 { margin: 0; font-size: 15px; }
.operations-customer-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.operations-customer-head a { color: var(--teal); font-size: 11px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.operations-customer-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 15px; }
.operations-customer-metrics span, .operations-customer-metrics strong { display: block; }
.operations-customer-metrics span { color: var(--muted); font-size: 9px; }
.operations-customer-metrics strong { margin-top: 4px; font-size: 15px; overflow-wrap: anywhere; }
.operations-customer-action { width: 100%; margin-top: 14px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; background: #f8fafb; color: var(--navy); font-size: 11px; font-weight: 750; }
.operations-customer-action:hover { color: var(--teal); border-color: var(--teal); background: var(--teal-fill); }
.operations-filter { border-bottom: 1px solid var(--line); }
.operations-table-scroll table { min-width: 1280px; }
.project-name-cell { min-width: 250px; }
.project-name-cell strong, .project-name-cell small { display: block; }
.project-name-cell small { max-width: 330px; margin-top: 4px; color: var(--muted); font-size: 10px; white-space: normal; line-height: 1.4; }
.machine-reference { min-width: 180px; white-space: normal; line-height: 1.45; }
.billing-state { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.billing-state strong { font-size: 11px; }
.billing-state small { color: var(--muted); font-size: 9px; }
.billing-state.pending strong { color: var(--amber); }
.table-link { color: var(--teal); font-weight: 800; text-decoration: none; white-space: nowrap; }
.table-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.section-divider { margin: 30px 0 16px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.section-divider::before, .section-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.table-scroll { overflow: auto; border: 1px solid var(--line); background: var(--paper); }
table { width: 100%; min-width: 1050px; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 10px; background: var(--teal); color: #fff; font-weight: 700; text-align: center; white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.text, td.actions, td.notes { text-align: left; }
td.notes { max-width: 280px; white-space: normal; color: var(--muted); line-height: 1.45; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; text-align: left; }
tr.total td { background: var(--blue-fill); color: var(--navy); font-weight: 800; border-top: 2px solid var(--blue); }
tr.unallocated td { background: var(--amber-fill); color: var(--amber); font-weight: 750; }
.empty-state { padding: 30px 15px; text-align: center; color: var(--muted); }
.row-actions { display: inline-flex; gap: 5px; }
.icon-action { min-width: 34px; min-height: 32px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--navy); font-size: 12px; }
.icon-action:hover { border-color: var(--teal); color: var(--teal); }
.icon-action.delete { color: var(--red); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.active { color: var(--green); }
.status.active::before { background: var(--green); }
.status.inactive { color: var(--muted); }
.status.pending { color: var(--amber); }
.status.pending::before { background: var(--amber); }
.allocation-warning { color: var(--amber); font-weight: 700; }
.status.available { color: var(--blue); }
.status.available::before { background: var(--blue); }
.status.unknown { color: var(--muted); }
.status.unknown::before { background: #98a2b3; }
.icon-action.end { color: var(--amber); }
.private-field { color: var(--navy); }
.lock-flag { display: inline-flex; padding: 3px 7px; border: 1px solid #efb1ac; border-radius: 4px; color: var(--red); background: var(--red-fill); font-weight: 750; }
.needs-data { color: var(--amber); font-weight: 700; }
td.preserve-notes { min-width: 260px; max-width: 420px; white-space: pre-wrap; }
.wide-resource table { min-width: 1880px; }

.compact-kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--paper); margin-bottom: 12px; }
.compact-kpis > div, .compact-kpis > a { min-width: 0; padding: 12px 13px; border-right: 1px solid var(--line); }
.compact-kpis > div:last-child, .compact-kpis > a:last-child { border-right: 0; }
.compact-kpis span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.compact-kpis strong { display: block; font-size: 16px; white-space: nowrap; }
.filter-bar { display: flex; align-items: flex-end; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-bottom: 0; background: #f8fafb; }
.filter-bar label, .month-picker { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.filter-bar input, .filter-bar select, .month-picker input { width: min(260px, 28vw); min-height: 36px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--ink); }
.scope-note { margin-left: auto; align-self: center; color: var(--teal); font-size: 11px; font-weight: 700; }
.accounting-note { margin: -10px 0 16px; padding: 10px 12px; border-left: 3px solid var(--teal); background: var(--teal-fill); color: #315b58; font-size: 11px; line-height: 1.6; }
.month-picker { align-self: flex-end; }
.month-picker input { width: 180px; }
.ledger-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ledger-grid .panel:first-child { grid-column: 1 / -1; }
.ledger-grid table { min-width: 650px; }
.monthly-kpis { margin-bottom: 24px; }

.storage-heading { align-items: center; }
.storage-period-control { display: inline-flex; align-items: center; padding: 3px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--paper); }
.storage-period-button { min-width: 52px; min-height: 32px; padding: 5px 12px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.storage-period-button:hover { color: var(--teal); background: var(--teal-fill); }
.storage-period-button.is-active { color: #fff; background: var(--teal); }
.storage-period-button:disabled { cursor: wait; opacity: .62; }
.storage-notice { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #f3c889; border-left: 3px solid var(--amber); background: var(--amber-fill); color: #7c430e; font-size: 11px; line-height: 1.55; }
.storage-notice[data-state="ok"] { border-color: #a4dabc; border-left-color: var(--green); background: var(--green-fill); color: var(--green); }
.storage-notice[data-state="error"] { border-color: #efb1ac; border-left-color: var(--red); background: var(--red-fill); color: var(--red); }
.storage-kpis { margin-bottom: 18px; }
.storage-overview-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 18px; }
.storage-capacity-breakdown { min-height: 150px; display: flex; flex-direction: column; justify-content: center; }
.storage-capacity-meter { width: 100%; height: 18px; display: block; overflow: hidden; border: 1px solid var(--line-strong); background: var(--wash); }
.storage-capacity-meter .classified { fill: var(--teal); }
.storage-capacity-meter .unclassified { fill: var(--amber); }
.storage-capacity-meter .idle { fill: #cdd7df; }
.storage-capacity-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.storage-capacity-legend > div { min-width: 0; padding-top: 9px; border-top: 3px solid var(--line-strong); }
.storage-capacity-legend > div[data-kind="classified"] { border-top-color: var(--teal); }
.storage-capacity-legend > div[data-kind="unclassified"] { border-top-color: var(--amber); }
.storage-capacity-legend > div[data-kind="idle"] { border-top-color: #98a2b3; }
.storage-capacity-legend span { display: block; color: var(--muted); font-size: 10px; }
.storage-capacity-legend strong { display: block; margin-top: 5px; font-size: 15px; white-space: nowrap; }
.storage-period-summary { margin-top: -3px; }
.storage-period-summary dd.positive { color: var(--amber); }
.storage-period-summary dd.negative { color: var(--green); }
.storage-directory-panel { padding: 0; }
.storage-directory-panel > .section-heading { padding: 18px 18px 0; }
.storage-directory-panel .scope-note { margin-left: auto; }
.storage-table-scroll { border-width: 1px 0 0; }
.storage-table-scroll table { min-width: 1320px; }
.storage-table-scroll th:first-child, .storage-table-scroll td:first-child { position: sticky; left: 0; z-index: 1; }
.storage-table-scroll th:first-child { z-index: 2; }
.storage-table-scroll td:first-child { background: var(--paper); }
.storage-table-scroll tr.unallocated td:first-child { background: var(--amber-fill); }
.storage-directory-name { min-width: 210px; }
.storage-directory-name strong, .storage-directory-name small { display: block; }
.storage-directory-name small { max-width: 300px; margin-top: 4px; color: var(--muted); font-size: 10px; white-space: normal; line-height: 1.35; }
.storage-project-note { min-width: 210px; }
.storage-project-note strong, .storage-project-note small { display: block; }
.storage-project-note small { max-width: 280px; margin-top: 4px; color: var(--muted); font-size: 10px; white-space: normal; line-height: 1.35; }
.storage-project-note .needs-data { display: inline-block; }
.storage-note-field { margin-top: 15px; }
.storage-change.positive { color: var(--amber); font-weight: 750; }
.storage-change.negative { color: var(--green); font-weight: 750; }
.status.error { color: var(--red); }
.status.error::before { background: var(--red); }

dialog { width: min(650px, calc(100% - 28px)); max-height: min(88vh, 780px); padding: 0; border: 0; background: transparent; overflow: visible; }
dialog::backdrop { background: rgba(11, 29, 43, .55); }
.dialog-card { max-height: min(88vh, 780px); overflow-y: auto; padding: 22px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.dialog-card.compact { max-width: 480px; margin: auto; }
.dialog-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.dialog-close { min-width: 34px; min-height: 34px; border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.dialog-description { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 750; }
.field .hint { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; line-height: 1.35; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 9px 10px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; }
.field textarea { min-height: 80px; resize: vertical; }
.field input[readonly] { background: var(--wash); color: var(--muted); }
.checkbox-field { min-height: 40px; display: flex !important; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 4px; font-weight: 500 !important; }
.checkbox-field input { width: 17px; min-height: 17px; margin: 0; }
.form-message { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 12px; }
.form-message[data-type="success"] { color: var(--green); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: #eef3f6; }
.login-shell { width: min(940px, calc(100% - 32px)); min-height: 560px; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-brand { padding: 52px; background: var(--navy-deep); color: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.login-brand .brand-mark { width: 44px; height: 44px; margin-bottom: 28px; }
.login-brand .eyebrow { color: #66d0c5; }
.login-brand h1 { font-size: 34px; }
.login-brand > p:last-of-type { max-width: 400px; margin: 14px 0 0; color: #c3d2dc; font-size: 14px; line-height: 1.7; }
.login-facts { width: 100%; margin: 36px 0 0; border-top: 1px solid rgba(255,255,255,.15); }
.login-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.login-facts dt { color: #a9bfcd; font-size: 11px; }
.login-facts dd { margin: 0; font-size: 11px; font-weight: 700; }
.login-panel { padding: 52px; display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { font-size: 25px; }
.panel-description { margin: 8px 0 27px; color: var(--muted); font-size: 12px; }
.login-panel label { display: block; margin: 15px 0 7px; font-size: 12px; font-weight: 700; }
.login-panel input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 4px; }
.password-field { position: relative; }
.password-field input { padding-right: 58px; }
.field-icon { position: absolute; right: 4px; top: 4px; height: 36px; padding: 0 9px; border: 0; background: transparent; color: var(--teal); font-size: 11px; font-weight: 700; }
.back-link { align-self: center; margin-top: 20px; color: var(--muted); font-size: 11px; text-decoration: none; }
.back-link:hover { color: var(--teal); }

@media (max-width: 1100px) {
  .topbar { gap: 16px; }
  .user-label { display: none; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi { border-bottom: 1px solid var(--line); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-last-child(-n+3) { border-bottom: 0; }
  .overview-grid { grid-template-columns: 1fr; }
  .storage-overview-grid { grid-template-columns: 1fr; }
  .compact-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .compact-kpis > :is(div, a) { border-bottom: 1px solid var(--line); }
  .compact-kpis > :is(div, a):nth-child(4n) { border-right: 0; }
  .compact-kpis > :is(div, a):nth-last-child(-n+3) { border-bottom: 0; }
}

@media (max-width: 760px) {
  .topbar { padding: 10px 14px; gap: 12px; flex-wrap: wrap; }
  .brand { flex: 1; }
  .brand small, .user-label, .topbar-scope { display: none; }
  .topbar-nav { order: 2; width: 100%; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .topbar-nav::-webkit-scrollbar { display: none; }
  .topbar-actions { order: 3; width: 100%; margin-left: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .topbar-context { width: 100%; }
  .topbar-context label { flex: none; }
  .topbar-context select { width: 100%; }
  .page-shell { width: calc(100% - 20px); padding-top: 18px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .machine-subtabs { overflow-x: auto; }
  .machine-subtabs a { min-width: 190px; }
  .calculation-meta { min-width: 0; justify-content: flex-start; }
  .calculation-meta > span:last-child { align-items: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3n) { border-right: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .kpi:nth-last-child(-n+2) { border-bottom: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .storage-period-control { width: 100%; }
  .storage-period-button { flex: 1; }
  .section-actions .button { width: 100%; }
  .month-picker { width: 100%; }
  .month-picker input { width: 100%; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar label, .filter-bar input, .filter-bar select { width: 100%; }
  .scope-note { margin: 2px 0 0; align-self: flex-start; }
  .operations-customer-grid { grid-template-columns: 1fr; }
  .compact-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-kpis > :is(div, a):nth-child(4n) { border-right: 1px solid var(--line); }
  .compact-kpis > :is(div, a):nth-child(2n) { border-right: 0; }
  .compact-kpis > :is(div, a):nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .compact-kpis > :is(div, a):last-child { grid-column: 1 / -1; border-bottom: 0; }
  .storage-capacity-legend { grid-template-columns: 1fr; }
  .storage-directory-panel > .section-heading { padding: 14px 14px 0; }
  .storage-directory-panel .scope-note { margin-left: 0; }
  .ledger-grid { grid-template-columns: 1fr; }
  .ledger-grid .panel:first-child { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-brand { padding: 34px 28px; }
  .login-brand .brand-mark { margin-bottom: 18px; }
  .login-brand h1 { font-size: 27px; }
  .login-facts { display: none; }
  .login-panel { padding: 34px 28px; }
}

@media (max-width: 430px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi { border-right: 0; }
  .kpi:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .kpi:last-child { border-bottom: 0; }
  .panel { padding: 14px; }
  .storage-directory-panel { padding: 0; }
  .compact-kpis { grid-template-columns: 1fr; }
  .compact-kpis > :is(div, a) { border-right: 0; }
  .compact-kpis > :is(div, a):last-child { grid-column: auto; }
}
