* { box-sizing: border-box; }
body {
    margin: 0;
    background: #F4F5F7;
    color: #15191E;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
}
h1, h2 { margin: 0; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 4px 24px; background: #fff; border-bottom: 1px solid #DDE1E6; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.nav { display: flex; gap: 4px; }
.side { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
.nav a, .side a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 6px; color: #414A55; font-size: 14px; font-weight: 500; text-decoration: none; }
.nav a:hover, .side a:hover { background: #F0F2F5; color: #15191E; }
.nav a.on, .side a.on { background: #E8EDF7; color: #1F4FB2; font-weight: 600; }
.fresh { margin-right: 8px; color: #5B6570; font-size: 12.5px; }
.fresh.lost { color: #A3211A; font-weight: 600; }

.page { max-width: 1560px; margin: 0 auto; padding: 14px 24px 20px; }
.page-title { font-size: 16px; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.tiles-five { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { min-width: 0; padding: 12px 16px; background: #fff; border: 1px solid #DDE1E6; border-radius: 8px; }
.tile.bad { background: #FBE4E1; border-color: #E3A29B; }
.tile-label { color: #5B6570; font-size: 12.5px; font-weight: 500; }
.tile-value { overflow: hidden; font-size: 30px; font-weight: 700; line-height: 38px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; text-overflow: ellipsis; }
.tile-sub { overflow: hidden; min-height: 17px; color: #414A55; font-size: 12.5px; line-height: 17px; white-space: nowrap; text-overflow: ellipsis; }
.tile.bad .tile-label, .tile.bad .tile-sub { color: #7A1E18; }
.tile.bad .tile-value, .tile-value.bad { color: #A3211A; }

.split { display: grid; gap: 14px; margin-top: 14px; align-items: stretch; }
.split-overview { grid-template-columns: minmax(0, 2.6fr) minmax(300px, 1fr); }
.split-analytics { grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr); }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { min-width: 0; padding: 12px 16px; background: #fff; border: 1px solid #DDE1E6; border-radius: 8px; }
.panel h2 { margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.panel.grow { flex: 1; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.section-gap { margin-top: 14px; }
.scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table th { padding: 0 8px 6px; border-bottom: 1px solid #E6E9ED; color: #5B6570; font-size: 12px; font-weight: 500; text-align: right; white-space: nowrap; }
.table td { padding: 7px 8px; border-bottom: 1px solid #F0F2F5; text-align: right; vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .l { text-align: left; }
.table tfoot td { border-top: 1px solid #C9CED5; border-bottom: 0; font-weight: 700; }
.small { display: block; color: #5B6570; font-size: 11.5px; font-weight: 400; line-height: 15px; }
.name { font-weight: 600; }
.num-bad { color: #A3211A; font-weight: 700; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.chip.ok { background: #DDF1E5; color: #0B5A31; }
.chip.idle { background: #ECEEF1; color: #414A55; }
.chip.warn { background: #FDEFD6; color: #7F4500; }
.chip.bad { background: #A3211A; color: #fff; }

.resources { display: flex; flex-direction: column; gap: 9px; }
.resource-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; font-size: 12.5px; }
.resource-value { color: #414A55; font-variant-numeric: tabular-nums; text-align: right; }
.bar { overflow: hidden; height: 7px; background: #E6E9ED; border-radius: 4px; }
.fill { height: 100%; border-radius: 4px; background: #1F4FB2; }
.fill.warn { background: #D9820F; }
.fill.bad { background: #A3211A; }

.error-row { padding: 6px 0; border-bottom: 1px solid #F0F2F5; font-size: 13px; }
.error-row:last-child { border-bottom: 0; }
.error-row b { font-weight: 600; }

.stack-chart { --chart-height: 172px; }
.stack-chart-small { --chart-height: 132px; }
.sc-body { display: flex; height: var(--chart-height); }
.sc-axis { position: relative; flex: 0 0 40px; }
.sc-axis-label { position: absolute; right: 8px; transform: translateY(50%); color: #5B6570; font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums; }
.sc-plot { position: relative; flex: 1; min-width: 0; }
.sc-grid { position: absolute; left: 0; right: 0; height: 1px; background: #EEF0F3; }
.sc-grid.sc-base { background: #C9CED5; }
.sc-cols { position: absolute; inset: 0; display: flex; }
.sc-col { display: flex; flex: 1; align-items: flex-end; justify-content: center; min-width: 0; padding: 0; border: 0; border-radius: 4px 4px 0 0; background: transparent; cursor: default; }
.sc-col.is-shaded { background: #F6F7F9; }
.sc-col:hover, .sc-col.is-active, .sc-col:focus-visible { background: #E8EDF7; outline: none; }
.sc-col.is-muted .sc-stack { opacity: .5; }
.sc-stack { display: flex; flex-direction: column; gap: 2px; width: min(24px, 70%); }
.sc-seg { flex: 1 1 0; min-height: 2px; }
.sc-seg:first-child { border-radius: 4px 4px 0 0; }
.sc-ticks { position: relative; height: 18px; margin: 4px 0 0 40px; }
.sc-tick { position: absolute; top: 0; transform: translateX(-50%); color: #5B6570; font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-tick.is-major { color: #15191E; font-weight: 600; }
.sc-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #5B6570; font-size: 13px; }
.sc-tip { position: absolute; top: 0; z-index: 5; display: none; min-width: 150px; padding: 8px 10px; border: 1px solid #DDE1E6; border-radius: 8px; background: #fff; box-shadow: 0 6px 20px #15191E1F; font-size: 12.5px; pointer-events: none; }
.sc-tip.is-visible { display: block; }
.sc-tip-title { margin-bottom: 6px; color: #414A55; font-weight: 600; white-space: nowrap; }
.sc-tip-row { display: flex; align-items: center; gap: 8px; line-height: 20px; white-space: nowrap; }
.sc-tip-row b { min-width: 34px; color: #15191E; font-variant-numeric: tabular-nums; text-align: right; }
.sc-tip-row span:last-child { color: #5B6570; }
.sc-tip-key { flex: 0 0 12px; height: 3px; border-radius: 2px; }
.sc-tip-total { margin-top: 4px; padding-top: 4px; padding-left: 20px; border-top: 1px solid #EEF0F3; }
.legend { display: flex; flex-wrap: wrap; gap: 4px; }
.legend-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #414A55; font: inherit; font-size: 12.5px; cursor: pointer; }
.legend-btn:hover { background: #F0F2F5; }
.legend-swatch { width: 10px; height: 10px; border: 2px solid var(--swatch); border-radius: 3px; background: var(--swatch); }
.legend-btn[aria-pressed="false"] { color: #5B6570; text-decoration: line-through; }
.legend-btn[aria-pressed="false"] .legend-swatch { background: transparent; }
.empty { align-self: center; width: 100%; color: #5B6570; font-size: 13px; text-align: center; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.toolbar-end { margin-left: auto; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill, .btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid #CBD1D8; border-radius: 6px; background: #fff; color: #2C333B; font: 500 13.5px inherit; font-family: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.pill:hover, .btn:hover { background: #F0F2F5; }
.pill.on { border-color: #1F4FB2; background: #1F4FB2; color: #fff; font-weight: 600; }
.btn-dark { border-color: #15191E; background: #15191E; color: #fff; font-weight: 600; }
.btn-dark:hover { background: #2C333B; }
.btn-row { min-height: 34px; padding: 0 10px; font-size: 12.5px; margin-left: 4px; }
.btn-danger { border-color: #E3A29B; color: #A3211A; }
.range { color: #414A55; font-size: 13px; }
.date { display: flex; align-items: center; gap: 6px; color: #414A55; font-size: 13px; }
.date input { min-height: 38px; padding: 0 8px; border: 1px solid #CBD1D8; border-radius: 6px; background: #fff; color: #15191E; font: inherit; }
.logs-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.logs { overflow: auto; height: calc(100vh - 150px); min-height: 320px; padding: 14px 16px; border-radius: 8px; background: #12161B; color: #D5DAE0; font: 12.5px/20px Menlo, Consolas, monospace; white-space: pre; }

.dialog { min-width: min(380px, 90vw); padding: 24px; border: 0; border-radius: 10px; box-shadow: 0 20px 60px #0004; }
.dialog::backdrop { background: #0006; }
.dialog h2 { margin-bottom: 14px; font-size: 18px; }
.dialog form { display: grid; gap: 14px; }
.dialog label { display: flex; flex-direction: column; gap: 5px; color: #414A55; font-size: 12.5px; }
.dialog input { min-height: 40px; padding: 0 10px; border: 1px solid #CBD1D8; border-radius: 6px; font: inherit; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.warning { color: #7F4500; font-size: 13px; }
.secret { display: block; padding: 10px; border-radius: 6px; background: #F0F2F5; font-size: 13px; word-break: break-all; }

.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-box { display: grid; gap: 14px; width: min(360px, 100%); padding: 28px; background: #fff; border: 1px solid #DDE1E6; border-radius: 10px; }
.login-box h1 { margin-bottom: 4px; font-size: 18px; font-weight: 600; }
.login-box label { display: flex; flex-direction: column; gap: 5px; color: #414A55; font-size: 12.5px; }
.login-box input { min-height: 44px; padding: 0 10px; border: 1px solid #CBD1D8; border-radius: 6px; font: inherit; font-size: 14px; }
.login-box .btn { justify-content: center; min-height: 44px; margin-top: 4px; }
.login-error { margin: 0; padding: 10px 12px; border-radius: 6px; background: #FBE4E1; color: #7A1E18; font-size: 13px; }

@media (max-width: 980px) {
    .split-overview, .split-analytics { grid-template-columns: minmax(0, 1fr); }
    .side, .toolbar-end { margin-left: 0; }
    .top { padding: 4px 16px; }
    .page { padding: 14px 16px 20px; }
}
