:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-soft: #f8f9f7;
  --ink: #191c1a;
  --muted: #6b716d;
  --muted-2: #929994;
  --line: #e2e6e1;
  --line-strong: #d2d8d2;
  --sidebar: #1d211f;
  --sidebar-soft: #292e2b;
  --accent: #d64b2a;
  --accent-dark: #b83a1f;
  --accent-soft: #fff0eb;
  --teal: #18776f;
  --teal-soft: #e8f4f1;
  --amber: #af6910;
  --amber-soft: #fff5df;
  --red: #bb3d44;
  --red-soft: #fff0f1;
  --blue: #3266a6;
  --blue-soft: #edf3fb;
  --shadow: 0 12px 34px rgba(30, 38, 33, 0.08);
  --radius: 7px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: Inter, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { color: inherit; }
button, select { cursor: pointer; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: 236px; display: flex; flex-direction: column; color: #eef1ee; background: var(--sidebar); border-right: 1px solid #303532; }
.brand { height: 78px; padding: 0 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #303532; }
.brand-mark { width: 33px; height: 33px; display: flex; align-items: flex-end; gap: 3px; padding: 7px; background: var(--accent); border-radius: 6px; }
.brand-mark span { width: 5px; background: white; border-radius: 1px; }
.brand-mark span:nth-child(1) { height: 10px; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 14px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; font-weight: 700; }
.brand small { margin-top: 1px; color: #939b96; font-size: 11px; text-transform: uppercase; }
.main-nav { display: flex; flex-direction: column; gap: 4px; padding: 20px 12px; }
.nav-item { min-height: 43px; width: 100%; padding: 0 12px; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; color: #abb2ad; background: transparent; border: 0; border-radius: 6px; text-align: left; transition: color .15s ease, background .15s ease; }
.nav-item:hover { color: white; background: #262b28; }
.nav-item.active { color: white; background: #303632; }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 23px; background: var(--accent); border-radius: 0 2px 2px 0; }
.nav-item b { min-width: 21px; height: 21px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; color: #d4d9d5; background: #3b423e; border-radius: 10px; font-size: 11px; font-weight: 600; }
.nav-item b.alert-count { color: #ffd9d0; background: #6a3125; }
.sidebar-foot { margin-top: auto; padding: 16px 14px; display: flex; align-items: center; gap: 8px; border-top: 1px solid #303532; }
.worker-status { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.worker-status strong, .worker-status small { display: block; }
.worker-status strong { font-size: 12px; font-weight: 600; }
.worker-status small { margin-top: 3px; color: #8e9791; font-size: 11px; }
.live-dot { width: 8px; height: 8px; flex: none; background: #51b69c; border: 2px solid #2f5e52; border-radius: 50%; box-shadow: 0 0 0 3px rgba(81,182,156,.1); }

.main-content { min-height: 100vh; margin-left: 236px; }
.topbar { height: 68px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.topbar-left, .topbar-actions, .breadcrumb, .heading-actions, .filter-row { display: flex; align-items: center; }
.breadcrumb { gap: 7px; color: var(--muted-2); font-size: 12px; }
.breadcrumb svg { width: 14px; height: 14px; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.topbar-actions { gap: 9px; }
.global-search { width: 260px; height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 11px; color: var(--muted-2); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; }
.global-search input { min-width: 0; flex: 1; color: var(--ink); background: transparent; border: 0; outline: 0; }
.global-search svg { width: 16px; }
kbd { padding: 2px 6px; color: var(--muted-2); background: white; border: 1px solid var(--line); border-radius: 4px; font: 10px inherit; white-space: nowrap; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-soft); }
.icon-btn.inverse { color: #9fa7a2; background: transparent; border-color: #39403c; }
.notification-btn { position: relative; }
.notification-btn > span { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; background: var(--accent); border: 1px solid white; border-radius: 50%; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; color: white; background: #2c694f; border-radius: 50%; font-size: 12px; font-weight: 700; }
.mobile-menu { display: none; margin-right: 10px; }

.page-wrap { max-width: 1580px; margin: 0 auto; padding: 32px 34px 56px; }
.view { display: none; }
.view.active { display: block; animation: view-in .2s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.page-heading { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading.compact { margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 750; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 28px; line-height: 1.25; font-weight: 720; }
h2 { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 700; }
h3 { margin: 0; font-size: 13px; font-weight: 700; }
.heading-meta { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.heading-actions { gap: 9px; }
.btn { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; font-weight: 650; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { color: white; background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.secondary { color: var(--ink); background: white; border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-soft); }
.btn:disabled { opacity: .55; cursor: wait; }
.is-spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.metric-strip { margin-bottom: 18px; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-item { min-width: 0; padding: 20px 22px; position: relative; }
.metric-item + .metric-item { border-left: 1px solid var(--line); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; }
.metric-icon svg { width: 16px; height: 16px; }
.metric-icon.neutral { color: var(--blue); background: var(--blue-soft); }
.metric-icon.good { color: var(--teal); background: var(--teal-soft); }
.metric-icon.warn { color: var(--amber); background: var(--amber-soft); }
.metric-icon.cost { color: var(--accent); background: var(--accent-soft); }
.metric-value { margin-top: 8px; display: flex; align-items: baseline; gap: 6px; }
.metric-value strong { font-size: 24px; line-height: 1.2; font-weight: 730; white-space: nowrap; }
.metric-value small { color: var(--muted-2); font-size: 11px; }
.metric-sub { margin: 6px 0 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.attention-bar { min-height: 58px; margin-bottom: 18px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; background: var(--amber-soft); border: 1px solid #f0d9aa; border-left: 3px solid var(--amber); border-radius: var(--radius); }
.attention-icon { width: 30px; height: 30px; display: grid; place-items: center; color: var(--amber); background: rgba(255,255,255,.7); border-radius: 50%; }
.attention-icon svg { width: 16px; }
.attention-bar > div:nth-child(2) { min-width: 0; flex: 1; }
.attention-bar strong, .attention-bar span { display: block; }
.attention-bar strong { font-size: 12px; }
.attention-bar span { margin-top: 3px; color: #7c6a46; font-size: 11px; }
.text-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px; color: var(--accent-dark); background: transparent; border: 0; font-size: 12px; font-weight: 650; white-space: nowrap; }
.text-btn svg { width: 15px; height: 15px; }

.dashboard-grid { margin-bottom: 18px; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .75fr); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { min-height: 66px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.trend-value { text-align: right; }
.trend-value strong, .trend-value span { display: block; }
.trend-value strong { font-size: 17px; }
.trend-value span { margin-top: 4px; color: var(--teal); font-size: 11px; }
.trend-value span svg { width: 13px; height: 13px; vertical-align: -2px; }
.chart-wrap { height: 275px; padding: 18px 22px 14px 54px; position: relative; }
.chart-y { position: absolute; inset: 20px auto 36px 15px; display: flex; flex-direction: column; justify-content: space-between; color: var(--muted-2); font-size: 10px; }
.chart-wrap > svg { width: 100%; height: 215px; overflow: visible; }
.grid-lines line { stroke: #edf0ed; stroke-width: 1; }
.chart-area { fill: rgba(214,75,42,.08); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-points circle { fill: white; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-points circle:last-child { fill: var(--accent); }
.chart-x { display: flex; justify-content: space-between; color: var(--muted-2); font-size: 10px; }
.health-panel { min-width: 0; }
.donut-row { min-height: 206px; padding: 22px 20px; display: flex; align-items: center; gap: 28px; }
.donut { width: 128px; height: 128px; flex: none; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--teal) 0 75%, var(--amber) 75% 87.5%, var(--red) 87.5% 100%); position: relative; }
.donut::after { content: ""; width: 86px; height: 86px; position: absolute; background: white; border-radius: 50%; }
.donut > div { z-index: 1; text-align: center; }
.donut strong, .donut span { display: block; }
.donut strong { font-size: 21px; }
.donut span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.health-legend { min-width: 0; flex: 1; display: grid; gap: 15px; }
.legend-item { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-item strong { color: var(--ink); font-size: 12px; }
.health-note { min-height: 50px; padding: 0 18px; display: flex; align-items: center; gap: 8px; color: var(--muted); background: var(--surface-soft); border-top: 1px solid var(--line); font-size: 11px; }
.health-note svg { width: 15px; color: var(--teal); }
.health-note strong { margin-left: auto; color: var(--ink); }

.table-panel { overflow: hidden; }
.table-head { border-bottom: 0; }
.group-tabs { min-height: 45px; padding: 0 18px; display: flex; align-items: flex-end; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.group-tab { min-height: 42px; padding: 0 2px; position: relative; color: var(--muted); background: transparent; border: 0; font-size: 12px; white-space: nowrap; }
.group-tab.active { color: var(--ink); font-weight: 650; }
.group-tab.active::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--accent); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { height: 42px; padding: 0 14px; color: var(--muted-2); background: var(--surface-soft); border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 700; text-align: left; text-transform: uppercase; }
.data-table td { height: 60px; padding: 0 14px; border-bottom: 1px solid #edf0ed; font-size: 12px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fbfcfa; }
.data-table .align-right { text-align: right; }
.upstream-cell { min-width: 150px; display: flex; align-items: center; gap: 10px; }
.vendor-mark { width: 30px; height: 30px; flex: none; display: grid; place-items: center; color: white; border-radius: 6px; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.upstream-cell strong, .upstream-cell small { display: block; }
.upstream-cell strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.upstream-cell small { max-width: 150px; margin-top: 3px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.group-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.group-badge::before { content: ""; width: 7px; height: 7px; background: var(--group-color, var(--blue)); border-radius: 2px; }
.money strong, .money small { display: block; }
.money strong { font-size: 12px; }
.money small { margin-top: 3px; color: var(--muted-2); font-size: 10px; }
.multiplier { padding: 3px 7px; color: var(--ink); background: #f0f2ef; border-radius: 4px; font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status.healthy { color: var(--teal); }
.status.healthy::before { background: var(--teal); }
.status.low { color: var(--amber); }
.status.low::before { background: var(--amber); }
.status.error { color: var(--red); }
.status.error::before { background: var(--red); }
.status.disabled { color: var(--muted-2); }
.status.disabled::before { background: var(--muted-2); }
.row-actions { display: inline-flex; justify-content: flex-end; gap: 5px; }
.row-actions .icon-btn { width: 30px; height: 30px; background: transparent; }
.row-actions .icon-btn svg { width: 15px; height: 15px; }
.time-cell { color: var(--muted); font-size: 11px; }
.empty-state { height: 150px !important; color: var(--muted); text-align: center; }

.table-toolbar { min-height: 62px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.filter-row { min-width: 0; gap: 8px; }
.inline-search { width: 240px; height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 6px; }
.inline-search svg { width: 15px; color: var(--muted); }
.inline-search input { width: 100%; border: 0; outline: 0; }
select, input, textarea { color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 6px; outline: 0; }
select:focus, input:focus, textarea:focus { border-color: #e0836d; box-shadow: 0 0 0 3px rgba(214,75,42,.09); }
.table-toolbar select, .heading-select { height: 36px; padding: 0 30px 0 10px; font-size: 12px; }
.result-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.toggle { width: 34px; height: 19px; padding: 2px; border: 0; border-radius: 10px; background: #c7ccc8; transition: background .15s ease; }
.toggle::after { content: ""; display: block; width: 15px; height: 15px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .15s ease; }
.toggle.on { background: var(--teal); }
.toggle.on::after { transform: translateX(15px); }

.split-layout { display: grid; grid-template-columns: minmax(360px, .85fr) minmax(400px, 1.4fr); gap: 18px; align-items: start; }
.group-list { padding: 8px; }
.group-row { min-height: 62px; padding: 8px 10px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.group-row:hover { background: var(--surface-soft); }
.group-row.active { background: var(--accent-soft); border-color: #f1c8bc; }
.group-handle { color: var(--muted-2); }
.group-handle svg { width: 15px; }
.group-row strong, .group-row small { display: block; }
.group-row strong { font-size: 12px; }
.group-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.group-row-actions { display: flex; align-items: center; gap: 3px; }
.group-row-actions .icon-btn { width: 29px; height: 29px; background: transparent; }
.group-detail-panel { min-height: 420px; }
.group-detail-hero { min-height: 123px; padding: 22px; display: flex; align-items: flex-start; gap: 15px; border-bottom: 1px solid var(--line); }
.group-symbol { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--group-color); border-radius: 7px; }
.group-symbol svg { width: 20px; height: 20px; }
.group-detail-copy { min-width: 0; flex: 1; }
.group-detail-copy h2 { font-size: 18px; }
.group-detail-copy p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.group-detail-stats { padding: 18px 22px; display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.mini-stat + .mini-stat { padding-left: 18px; border-left: 1px solid var(--line); }
.mini-stat span, .mini-stat strong { display: block; }
.mini-stat span { color: var(--muted); font-size: 10px; }
.mini-stat strong { margin-top: 6px; font-size: 17px; }
.group-members { padding: 16px 22px; }
.group-members-head { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.member-row { min-height: 48px; display: flex; align-items: center; gap: 10px; border-top: 1px solid #edf0ed; }
.member-row:first-of-type { border-top: 0; }
.member-row .vendor-mark { width: 27px; height: 27px; }
.member-row > div:nth-child(2) { min-width: 0; flex: 1; }
.member-row strong, .member-row small { display: block; }
.member-row strong { font-size: 11px; }
.member-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.history-chart-panel { margin-bottom: 18px; }
.history-chart { height: 300px; padding: 22px 24px 14px; }
.history-chart svg { width: 100%; height: 100%; overflow: visible; }
.history-grid line { stroke: #edf0ed; }
.history-line { fill: none; stroke: var(--blue); stroke-width: 2.4; vector-effect: non-scaling-stroke; }
.history-area { fill: rgba(50,102,166,.07); }
.history-point { fill: white; stroke: var(--blue); stroke-width: 2; vector-effect: non-scaling-stroke; }
.history-label { fill: var(--muted-2); font-size: 10px; }
.history-table-panel { margin-top: 0; }
.change-negative { color: var(--red); }
.change-positive { color: var(--teal); }

.alert-filter-bar { min-height: 50px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.segmented { height: 34px; padding: 3px; display: inline-flex; background: #e9ece8; border-radius: 6px; }
.segmented button { padding: 0 14px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; font-size: 11px; }
.segmented button.active { color: var(--ink); background: white; box-shadow: 0 1px 3px rgba(25,28,26,.08); }
.alert-filter-bar > span { color: var(--muted); font-size: 11px; }
.alert-list { display: grid; gap: 9px; }
.alert-item { min-height: 82px; padding: 14px 16px; display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 13px; background: white; border: 1px solid var(--line); border-left: 3px solid var(--alert-color); border-radius: var(--radius); }
.alert-item.resolved { opacity: .68; }
.alert-type-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--alert-color); background: var(--alert-bg); border-radius: 6px; }
.alert-type-icon svg { width: 17px; }
.alert-main strong { display: block; font-size: 12px; }
.alert-main p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.alert-main small { display: inline-block; margin-top: 6px; color: var(--muted-2); font-size: 10px; }
.alert-action { display: flex; align-items: center; gap: 9px; }
.alert-severity { padding: 3px 7px; color: var(--alert-color); background: var(--alert-bg); border-radius: 4px; font-size: 10px; }

.app-dialog { width: min(720px, calc(100vw - 28px)); max-height: calc(100vh - 32px); padding: 0; color: var(--ink); background: white; border: 0; border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.app-dialog::backdrop { background: rgba(20,24,21,.48); backdrop-filter: blur(2px); }
.small-dialog { width: min(480px, calc(100vw - 28px)); }
.dialog-head { min-height: 74px; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 18px; }
.dialog-body { max-height: calc(100vh - 190px); padding: 20px; overflow-y: auto; }
.dialog-foot { min-height: 66px; padding: 12px 20px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; background: var(--surface-soft); border-top: 1px solid var(--line); }
.form-section + .form-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-section h3 { margin-bottom: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid.three-cols { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid label { min-width: 0; display: block; }
.form-grid label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-height: 38px; padding: 8px 10px; font-size: 12px; resize: vertical; }
.form-grid textarea { min-height: 58px; }
.span-2 { grid-column: span 2; }
.secret-field { display: flex; }
.secret-field input { border-radius: 6px 0 0 6px; }
.secret-field .icon-btn { flex: none; width: 39px; height: 38px; border-left: 0; border-radius: 0 6px 6px 0; }
.detector-fields { margin-top: 14px; padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 6px; }
.detector-fields[hidden] { display: none; }
.detector-note { margin-top: 14px; }

.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 360px; padding: 11px 13px; display: flex; align-items: center; gap: 9px; color: white; background: #242925; border: 1px solid #3b443e; border-radius: 6px; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast svg { width: 16px; color: #73cfb5; }
.toast span { font-size: 12px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
.mobile-scrim { display: none; }

.login-page { min-height: 100vh; background: #eef0ed; }
.login-shell { width: min(980px, calc(100vw - 40px)); min-height: 610px; margin: max(40px, calc((100vh - 610px) / 2)) auto 40px; display: grid; grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr); background: white; border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 24px 60px rgba(28,34,30,.12); overflow: hidden; }
.login-brand-panel { min-height: 610px; padding: 0 42px 34px; display: flex; flex-direction: column; color: white; background: #202622; position: relative; overflow: hidden; }
.login-brand-panel::after { content: ""; width: 280px; height: 280px; position: absolute; right: -120px; bottom: 78px; border: 42px solid rgba(255,255,255,.035); border-radius: 50%; }
.login-brand { height: 86px; padding: 0; border-bottom-color: #363d38; }
.login-brand-copy { margin: auto 0; position: relative; z-index: 1; }
.login-brand-copy > p { margin: 0 0 16px; color: #91a097; font-size: 10px; font-weight: 700; }
.login-brand-copy h1 { color: white; font-size: 34px; line-height: 1.45; }
.login-service-state { margin-top: 32px; display: flex; align-items: center; gap: 10px; color: #b9c2bc; font-size: 11px; }
.login-brand-foot { color: #77827b; font-size: 10px; position: relative; z-index: 1; }
.login-form-panel { display: grid; place-items: center; padding: 54px; }
.login-form { width: min(340px, 100%); display: grid; gap: 18px; }
.login-form h2 { font-size: 25px; }
.login-subtitle { margin: 8px 0 14px; color: var(--muted); font-size: 12px; }
.login-form label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
.login-form input { width: 100%; height: 42px; padding: 0 11px; }
.login-form .secret-field .icon-btn { height: 42px; width: 42px; }
.login-error { min-height: 18px; margin: -5px 0; color: var(--red); font-size: 11px; }
.login-submit { width: 100%; height: 42px; justify-content: space-between; padding: 0 16px; }

@media (max-width: 1180px) {
  .page-wrap { padding: 28px 24px 48px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .health-panel .donut-row { min-height: 180px; justify-content: center; }
  .health-legend { max-width: 260px; }
  .metric-item { padding: 18px; }
  .metric-value strong { font-size: 21px; }
  .split-layout { grid-template-columns: minmax(320px,.8fr) 1fr; }
}

@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .mobile-scrim { display: block; position: fixed; inset: 0; z-index: 25; pointer-events: none; background: rgba(18,21,19,.42); opacity: 0; transition: opacity .2s ease; }
  .mobile-scrim.open { pointer-events: auto; opacity: 1; }
  .main-content { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: 0 18px; }
  .page-wrap { padding: 24px 18px 42px; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-item:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric-item:nth-child(4) { border-top: 1px solid var(--line); }
  .split-layout { grid-template-columns: 1fr; }
  .group-detail-panel { min-height: 0; }
  .data-table { min-width: 920px; }
  .login-shell { grid-template-columns: minmax(300px,.75fr) minmax(380px,1fr); }
  .login-brand-panel { padding-inline: 30px; }
  .login-form-panel { padding: 38px; }
}

@media (max-width: 620px) {
  .topbar { height: 60px; padding: 0 12px; }
  .breadcrumb span, .breadcrumb svg, .global-search, .avatar { display: none; }
  .page-wrap { padding: 20px 12px 36px; }
  .page-heading { align-items: flex-start; }
  .page-heading, .page-heading.compact { margin-bottom: 18px; }
  .page-heading > div:first-child { min-width: 0; }
  h1 { font-size: 23px; }
  .heading-actions { flex-direction: column-reverse; align-items: stretch; }
  .heading-actions .btn { min-width: 118px; }
  .heading-meta { max-width: 210px; line-height: 1.5; }
  .metric-item { padding: 15px 13px; }
  .metric-top { align-items: flex-start; }
  .metric-value { display: block; }
  .metric-value strong { font-size: 19px; }
  .metric-value small { display: block; margin-top: 2px; }
  .metric-sub { display: none; }
  .attention-bar { align-items: flex-start; }
  .attention-bar .text-btn { align-self: center; font-size: 0; }
  .attention-bar .text-btn svg { width: 18px; height: 18px; }
  .chart-wrap { height: 240px; padding-left: 44px; }
  .chart-wrap > svg { height: 180px; }
  .chart-x span:nth-child(even) { display: none; }
  .donut-row { gap: 18px; }
  .donut { width: 110px; height: 110px; }
  .donut::after { width: 74px; height: 74px; }
  .panel-head { padding: 14px; }
  .table-toolbar { align-items: flex-start; }
  .filter-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .inline-search { width: 100%; grid-column: span 2; }
  .result-count { display: none; }
  .group-detail-stats { padding: 15px; }
  .mini-stat + .mini-stat { padding-left: 10px; }
  .mini-stat strong { font-size: 14px; }
  .form-grid, .form-grid.three-cols { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .dialog-body { padding: 16px; }
  .alert-item { grid-template-columns: 34px minmax(0,1fr); }
  .alert-action { grid-column: 2; justify-content: flex-start; }
  .alert-filter-bar { align-items: flex-end; }
  .toast-region { right: 12px; bottom: 12px; left: 12px; }
  .toast { min-width: 0; max-width: none; }
  .login-shell { width: calc(100vw - 24px); min-height: 0; margin: 12px auto; display: block; }
  .login-brand-panel { min-height: 190px; padding: 0 24px 22px; }
  .login-brand { height: 68px; }
  .login-brand-copy { margin: 22px 0 auto; }
  .login-brand-copy > p, .login-service-state { display: none; }
  .login-brand-copy h1 { font-size: 23px; line-height: 1.35; }
  .login-brand-foot { display: none; }
  .login-form-panel { padding: 30px 24px 34px; }
}
