:root {
  color-scheme: dark;
  --bg: #0d0d0c;
  --sidebar: #10100e;
  --surface: #141412;
  --surface-raised: #181815;
  --surface-hover: #1d1c18;
  --border: #292823;
  --border-soft: rgba(255, 255, 255, .075);
  --text: #f3f2ed;
  --muted: #96958d;
  --subtle: #6f6e67;
  --accent: #ff6b1a;
  --accent-hover: #ff7c35;
  --accent-soft: rgba(255, 107, 26, .10);
  --accent-border: rgba(255, 107, 26, .28);
  --green: #50c98b;
  --danger: #ff6b6b;
  --sidebar-width: 248px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.sidebar-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea, a { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
::selection { color: #fff; background: rgba(255, 107, 26, .35); }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Login Gate */
.login-gate { min-height: 100vh; padding: 24px 16px; display: grid; place-items: center; background: radial-gradient(circle at top, rgba(255, 107, 26, .08), transparent 48%), var(--bg); }
.login-card { width: 100%; max-width: 420px; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, .45); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.login-brand img { width: 38px; height: 38px; border-radius: 9px; object-fit: contain; }
.login-brand strong { display: block; font-size: 20px; line-height: 1.1; font-weight: 650; letter-spacing: -.5px; }
.login-brand small { display: block; margin-top: 3px; color: var(--accent); font-size: 9px; font-weight: 650; letter-spacing: 1.5px; }
.login-card h1 { font-size: 22px; font-weight: 580; letter-spacing: -.4px; }
.login-card > p { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-card form { margin-top: 20px; display: grid; gap: 12px; }
.login-card label { display: block; color: var(--muted); font-size: 11px; }
.login-card input { width: 100%; height: 42px; padding: 0 13px; font-size: 13px; }
.full-btn { width: 100%; height: 42px; }
.login-footnote { margin-top: 16px !important; color: var(--subtle) !important; font-size: 10px !important; }

/* Shell */
.console-shell { min-height: 100vh; }
.console-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar-width); display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border-soft); }
.sidebar-brand-row { height: 74px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; }
.console-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.console-brand img { display: block; width: 34px; height: 34px; object-fit: contain; border-radius: 7px; }
.console-brand > span { font-size: 20px; line-height: 1.1; font-weight: 650; letter-spacing: -.65px; }
.console-brand small { display: block; margin-top: 4px; color: var(--accent); font-size: 8px; font-weight: 650; letter-spacing: 1.5px; }
.sidebar-nav { flex: 1; padding: 10px 10px 20px; overflow-y: auto; }
.sidebar-label { padding: 0 11px; margin: 0 0 9px; color: #79786f; font-size: 10px; line-height: 1.4; font-weight: 600; letter-spacing: 1.35px; }
.sidebar-label-account { margin-top: 24px; }
.console-link { position: relative; width: 100%; height: 41px; padding: 0 12px; display: flex; align-items: center; gap: 12px; color: #aaa99f; background: transparent; border: 0; border-radius: 8px; text-align: left; font-size: 13px; font-weight: 450; transition: color .15s ease, background .15s ease; }
.console-link + .console-link { margin-top: 3px; }
.console-link:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.console-link.active { color: #ffd5bd; background: var(--accent-soft); }
.console-link.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 2px; border-radius: 0 2px 2px 0; background: var(--accent); }
.console-link.active > .icon:first-child { color: var(--accent); }
.sidebar-bottom { padding: 10px; border-top: 1px solid var(--border-soft); }
.sidebar-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 10px; border: 1px solid var(--border-soft); border-radius: 10px; background: rgba(255, 255, 255, .018); }
.nav-count-badge { margin-left: auto; min-width: 19px; height: 19px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--accent); color: #1a0b02; font-size: 10px; font-weight: 700; }
.events-feed { display: grid; gap: 10px; padding: 14px 16px; max-height: 540px; overflow-y: auto; border-top: 1px solid var(--border-soft); }
.event-item { padding: 11px 13px; background: #10100e; border: 1px solid var(--border-soft); border-radius: 9px; display: grid; gap: 4px; }
.event-item.is-unread { border-color: var(--accent-border); background: rgba(255, 107, 26, .04); }
.event-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.event-item-head strong { font-size: 12px; font-weight: 600; }
.event-item-head time { margin-left: auto; font-size: 10px; color: var(--subtle); }
.event-item p { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.inline-result.is-danger { border-color: rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .07); color: #ffd4d4; }
.sidebar-summary small, .sidebar-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-summary small { color: var(--muted); font-size: 9px; }
.sidebar-summary strong { margin-top: 2px; font-size: 12px; font-weight: 600; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 14px 5px 3px; }
.user-avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--accent-border); border-radius: 9px; color: #ffc3a3; background: var(--accent-soft); font-size: 11px; font-weight: 650; }
.user-copy { flex: 1; min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: 11px; font-weight: 550; }
.user-copy small { color: var(--subtle); font-size: 9px; }
.icon-btn { position: relative; width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; flex: 0 0 auto; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; transition: color .15s ease, background .15s ease; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.sidebar-close, .sidebar-toggle { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 45; padding: 0; background: rgba(0, 0, 0, .66); border: 0; backdrop-filter: blur(2px); }

/* Topbar & Content */
.console-workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.console-topbar { position: sticky; top: 0; z-index: 30; height: 58px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: rgba(13, 13, 12, .94); border-bottom: 1px solid var(--border-soft); backdrop-filter: blur(14px); }
.topbar-left, .topbar-actions, .console-breadcrumb, .topbar-link, .topbar-status { display: flex; align-items: center; }
.topbar-left { min-width: 0; }
.console-breadcrumb { gap: 8px; min-width: 0; font-size: 12px; }
.console-breadcrumb > span { color: var(--subtle); }
.console-breadcrumb > .icon { width: 12px; height: 12px; color: #4f4e48; }
.console-breadcrumb strong { overflow: hidden; color: #d8d7d0; font-weight: 450; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { gap: 10px; }
.topbar-link { gap: 7px; padding: 7px 10px; color: var(--muted); border-radius: 7px; font-size: 12px; }
.topbar-link:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.topbar-status { gap: 7px; padding: 7px 10px; color: var(--muted); border: 1px solid var(--border-soft); border-radius: 8px; font-size: 11px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(80, 201, 139, .1); }
.status-dot.is-bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 107, 107, .12); }

.console-content { width: 100%; max-width: 1420px; margin: 0 auto; padding: 28px 32px 72px; }
.console-sec { min-width: 0; animation: section-in .18s ease; }
@keyframes section-in { from { opacity: .25; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { min-height: 60px; margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h1 { font-size: 25px; line-height: 1.25; font-weight: 580; letter-spacing: -.6px; }
.section-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.wrap-actions { flex-wrap: wrap; }

.console-error, .form-error { padding: 11px 14px; margin-bottom: 14px; color: #ffaaa6; border: 1px solid rgba(255, 107, 107, .24); border-radius: 9px; background: rgba(255, 107, 107, .065); font-size: 12px; }

/* Buttons & Inputs */
.btn { min-height: 36px; padding: 7px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; white-space: nowrap; font-size: 12px; line-height: 1.2; font-weight: 500; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.btn:disabled { cursor: wait; opacity: .55; }
.btn .icon { width: 14px; height: 14px; }
.btn-sm { min-height: 31px; padding: 5px 10px; font-size: 11px; }
.btn-xs { min-height: 27px; padding: 4px 9px; font-size: 10px; border-radius: 6px; }
.btn-primary { color: #1a0b02; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { color: #d4d3cc; background: #171715; border-color: var(--border); }
.btn-secondary:hover { color: #fff; background: var(--surface-hover); border-color: #3a3932; }
.btn-danger { color: #ff9696; background: rgba(255, 107, 107, .04); border-color: rgba(255, 107, 107, .27); }
.btn-danger:hover { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .42); }

input, select, textarea { min-width: 0; color: var(--text); background: #0f0f0d; border: 1px solid var(--border); border-radius: 8px; padding: 0 11px; font-size: 12px; transition: border-color .15s ease; }
input, select { height: 37px; }
textarea { padding: 10px 12px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #626159; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-border); }

/* Cards, Metrics, Charts */
.panel-card, .metric-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric-grid.kpi-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric-grid.kpi-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric-card { min-height: 112px; padding: 17px 18px; }
.metric-card > span, .metric-card > strong, .metric-card > small { display: block; }
.metric-card > span { color: var(--muted); font-size: 11px; }
.metric-card > strong { margin-top: 8px; font-size: 22px; line-height: 1.2; font-weight: 560; letter-spacing: -.45px; overflow-wrap: anywhere; }
.metric-card > small { margin-top: 7px; color: var(--subtle); font-size: 10px; }
.metric-card.featured { border-color: var(--accent-border); background: linear-gradient(135deg, rgba(255, 107, 26, .065), var(--surface) 60%); }

.period-tabs { display: inline-flex; padding: 3px; border: 1px solid var(--border-soft); border-radius: 9px; background: var(--surface); }
.per-tab { height: 29px; padding: 0 11px; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: 11px; }
.per-tab:hover { color: var(--text); }
.per-tab.active { color: #ffd9c3; background: var(--accent-soft); }

.chart-card { padding: 18px; margin-bottom: 14px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card-heading h2 { font-size: 13px; font-weight: 550; }
.card-heading p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.chart-legend-group { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-legend { display: flex; align-items: center; gap: 6px; color: var(--subtle); font-size: 10px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.chart-legend.is-cost i { background: #50c98b; }
.bar-chart { height: 180px; padding: 20px 2px 0; display: flex; align-items: stretch; gap: 5px; border-bottom: 1px solid var(--border-soft); background-image: linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px); background-size: 100% 33.33%; }
.bar-column { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar-fill { width: min(46%, 16px); min-height: 2px; border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg, #ff884d, #ed5710); opacity: .88; }
.bar-fill.is-cost { background: linear-gradient(180deg, #6be2a5, #3ca971); opacity: .82; }
.bar-column::after { content: attr(data-label); position: absolute; top: calc(100% + 7px); left: 50%; color: var(--subtle); font-size: 8px; white-space: nowrap; transform: translateX(-50%); }
.bar-tooltip { position: absolute; bottom: calc(100% + 12px); left: 50%; z-index: 6; padding: 5px 8px; display: none; color: var(--text); background: #26251f; border: 1px solid var(--border); border-radius: 5px; font-size: 10px; white-space: nowrap; transform: translateX(-50%); }
.bar-column:hover .bar-tooltip { display: block; }
.chart-caption { min-height: 16px; margin-top: 24px; color: var(--subtle); font-size: 10px; }
.empty-chart { width: 100%; display: grid; place-items: center; min-height: 150px; color: var(--subtle); text-align: center; font-size: 11px; }

.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.split-grid > *, .detail-grid > *, .detail-tables > * { min-width: 0; }
.panel-card, .metric-card, .subcard { min-width: 0; }
.table-card { margin-top: 14px; overflow: hidden; }
.split-grid .table-card { margin-top: 0; }
.table-card > .card-heading { padding: 16px 18px; }
.table-scroll { width: 100%; overflow-x: auto; border-top: 1px solid var(--border-soft); }
.console-table { width: 100%; min-width: 600px; border-collapse: collapse; text-align: left; }
.compact-table { min-width: 480px; }
.console-table th { padding: 10px 15px; color: var(--subtle); background: rgba(255, 255, 255, .012); font-size: 9px; font-weight: 550; letter-spacing: .35px; text-transform: uppercase; white-space: nowrap; }
.console-table td { padding: 11px 15px; color: #c4c3bb; border-top: 1px solid rgba(255, 255, 255, .045); font-size: 11px; white-space: nowrap; }
.console-table tbody tr:hover td { background: rgba(255, 255, 255, .02); }
.console-table td code { color: #e4e3dc; font-size: 10px; }
.console-table td[colspan] { padding: 24px 16px; color: var(--subtle); text-align: center; white-space: normal; }
.cell-wrap { white-space: normal !important; max-width: 240px; overflow-wrap: anywhere; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; }

.soft-badge { display: inline-flex; align-items: center; padding: 2px 7px; border: 1px solid var(--accent-border); border-radius: 5px; color: #ff9e6d; background: var(--accent-soft); font-size: 9px; line-height: 1.5; font-weight: 500; }
.soft-badge.success { color: var(--green); border-color: rgba(80, 201, 139, .24); background: rgba(80, 201, 139, .06); }
.soft-badge.danger { color: #ff9696; border-color: rgba(255, 107, 107, .28); background: rgba(255, 107, 107, .07); }
.soft-badge.warn { color: #fbbf24; border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .08); }
.select-inline { align-self: center; color: var(--muted); font-size: 11px; }

/* Forms, Toolbar, Client Detail */
.toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 14px; }
.search-input { flex: 1 1 210px; min-width: 160px; }
.select-input { flex: 0 1 290px; }

.form-card { padding: 18px; margin-bottom: 16px; border-color: var(--accent-border); }
.form-card label { display: block; color: var(--muted); font-size: 11px; }
.form-card label input, .form-card label select, .form-card label textarea { width: 100%; margin-top: 5px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.subcard .form-grid-3 { grid-template-columns: 125px 105px minmax(0, 1fr); }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.textarea-label { margin-top: 12px; }
.checkbox-label { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 8px; margin-top: 10px; color: #d6d5ce !important; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.secret-reveal { margin: 14px 0; padding: 16px; border: 1px solid rgba(80, 201, 139, .3); border-radius: 11px; background: rgba(80, 201, 139, .045); }
.secret-reveal-title { display: flex; align-items: flex-start; gap: 10px; }
.secret-reveal-title > .icon { margin-top: 1px; color: var(--green); }
.secret-reveal-title strong, .secret-reveal-title span { display: block; }
.secret-reveal-title strong { font-size: 12px; font-weight: 550; }
.secret-reveal-title span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.secret-value { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.secret-value code { flex: 1; min-width: 0; padding: 9px 11px; overflow-x: auto; color: #e8e7e0; background: rgba(0, 0, 0, .35); border: 1px solid var(--border-soft); border-radius: 7px; font-size: 11px; white-space: nowrap; }

.detail-card { margin-top: 18px; padding: 20px; border-color: var(--accent-border); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); }
.key-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-head h2 { font-size: 18px; font-weight: 560; overflow-wrap: anywhere; }
.muted-line { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.subcard { padding: 16px; background: #10100e; border: 1px solid var(--border-soft); border-radius: 10px; }
.subcard h3 { font-size: 13px; font-weight: 550; }
.subcard label { display: block; color: var(--muted); font-size: 11px; }
.subcard label input, .subcard label select { width: 100%; margin-top: 5px; }
.subcard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.big-balance { font-size: 22px; color: var(--accent); font-weight: 600; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.subcard .btn { margin-top: 12px; }
.preset-row .btn { margin-top: 0; }
.subform-sep { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.inline-result { margin-top: 10px; padding: 9px 11px; border: 1px solid rgba(80, 201, 139, .3); border-radius: 8px; background: rgba(80, 201, 139, .06); color: #d5f5e3; font-size: 11px; overflow-wrap: anywhere; }
.detail-tables { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.subtable-title { margin-bottom: 8px; font-size: 13px; font-weight: 550; }

/* Upstream diff & Notices */
.upstream-card { padding: 18px; margin-bottom: 14px; border-color: var(--border); }
.upstream-cols { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.upstream-cols strong { display: block; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); background: #10100e; font-size: 10px; font-family: monospace; color: #dddcd4; }
.chip.warn { border-color: rgba(255, 107, 107, .35); color: #ff9b9b; background: rgba(255, 107, 107, .08); }
.chip.ok { border-color: rgba(80, 201, 139, .3); color: var(--green); background: rgba(80, 201, 139, .06); }

.notice-list { display: grid; gap: 12px; }
.notice-card { padding: 17px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; }
.notice-card.is-hidden { opacity: .6; }
.notice-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice-head h2 { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.notice-head time { margin-left: auto; color: var(--subtle); font-size: 10px; white-space: nowrap; }
.notice-card p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.notice-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

.loading-card, .empty-card { padding: 28px 18px; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; text-align: center; font-size: 12px; }
.console-toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: min(360px, calc(100vw - 32px)); padding: 11px 15px; color: #e9e8e1; background: #25241f; border: 1px solid #3c3a31; border-radius: 9px; box-shadow: 0 12px 36px rgba(0, 0, 0, .4); font-size: 12px; }

@media (max-width: 1180px) {
  .metric-grid.kpi-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid.kpi-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split-grid, .detail-grid, .form-grid-3, .subcard .form-grid-3, .upstream-cols { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .console-sidebar { width: min(290px, calc(100vw - 46px)); transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 40px rgba(0, 0, 0, .32); }
  body.sidebar-open .console-sidebar { transform: translateX(0); }
  .sidebar-close, .sidebar-toggle { display: inline-grid; }
  .sidebar-toggle { margin-right: 8px; }
  .console-workspace { margin-left: 0; }
  .console-topbar { padding: 0 16px; }
  .console-content { padding: 22px 18px 56px; }
  .sidebar-brand-row { height: 64px; }
}

@media (max-width: 640px) {
  .console-topbar { height: 56px; padding: 0 12px; gap: 8px; }
  .console-content { padding: 18px 14px 48px; }
  .topbar-link, .status-text { display: none; }
  .topbar-status { width: 29px; height: 29px; padding: 0; justify-content: center; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 12px; }
  .section-heading h1 { font-size: 22px; }
  .heading-actions { width: 100%; }
  .heading-actions .btn, .section-heading > .btn { flex: 1; }
  .period-tabs { width: 100%; }
  .per-tab { flex: 1; padding: 0 6px; }
  .metric-grid, .metric-grid.kpi-4, .metric-grid.kpi-6, .form-grid-2 { grid-template-columns: 1fr; }
  .metric-card { min-height: 92px; }
  .bar-column:nth-child(even)::after { display: none; }
  .secret-value { flex-direction: column; align-items: stretch; }
}
