/* ---------- Chart tokens (sequential blue, status) ---------- */
:root {
  --series-1: #2a78d6;
  --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #5598e7; --seq-4: #2a78d6; --seq-5: #184f95;
  --seq-ink-light: #0b0b0b; --seq-ink-dark: #ffffff;
  --st-crit: #d03b3b; --st-good: #0ca30c;
  --st-grid: #e1e0d9; --st-base: #c3c2b7; --st-free: #e7e6e2;
}
:root[data-theme="dark"] {
  --series-1: #3987e5;
  --seq-1: #1c3a5e; --seq-2: #1f4f86; --seq-3: #2a6cbd; --seq-4: #3987e5; --seq-5: #86b6ef;
  --st-grid: #2c2c2a; --st-base: #383835; --st-free: #34353a;
}

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; background: var(--bg); background-image: radial-gradient(circle at 20% 10%, rgba(69, 115, 210, .10), transparent 45%), radial-gradient(circle at 80% 90%, rgba(240, 106, 106, .08), transparent 45%); }
.login-card { width: 440px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 28px 30px 18px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-brand b { font-size: 22px; display: block; }
.login-brand small { color: var(--muted); }
.logo.big { width: 48px; height: 48px; border-radius: 12px; font-size: 19px; background: #111; color: #fff; display: grid; place-items: center; font-weight: 800; }
:root[data-theme="dark"] .logo.big { background: #fff; color: #111; }
.login-tabs { width: 100%; margin-bottom: 8px; }
.login-tabs button { flex: 1; }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.login label.chk { display: flex; align-items: center; gap: 8px; color: var(--text); }
.login .mfield { color: var(--text); background: var(--surface); }
.login-err, #pw-err { color: var(--red); font-size: 13px; min-height: 18px; margin: 8px 0 4px; }
.btn-primary.wide { width: 100%; justify-content: center; height: 40px; font-size: 15px; }
.login-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.login-foot code { font-size: 11px; color: var(--text); word-break: break-all; }
.login-office { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 13px; }
.link { color: var(--blue); }
.link:hover { text-decoration: underline; }

/* ---------- Sidebar user chip ---------- */
.user-chip { margin-top: 8px; border-top: 1px solid var(--side-hover); border-radius: 0; padding-top: 10px; }
.user-chip .uc-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip .uc-txt b { font-weight: 600; font-size: 13px; color: var(--side-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .uc-txt small { color: var(--side-muted); font-size: 11.5px; }

/* ---------- Users dialog ---------- */
.us-head, .us-row { display: grid; grid-template-columns: 1.3fr 1.6fr 140px 120px 130px 50px 210px; gap: 8px; align-items: center; }
.us-head { font-size: 11.5px; color: var(--muted); padding: 0 4px 4px; }
.us-row { padding: 6px 4px; border-top: 1px solid var(--border); font-size: 13px; }
.us-row.off { opacity: .55; }
.us-row select { height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); padding: 0 6px; }
.us-name { font-weight: 600; }
.us-name small { color: var(--muted); font-weight: 400; }
.us-mail { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-row .num { text-align: right; }
.us-act { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.us-list { max-height: 38vh; overflow-y: auto; }
.us-domain { align-items: center; margin-top: 12px; }
.us-domain label { margin: 0 !important; }
.us-domain .mfield { width: 200px; height: 32px; }
.us-log { max-height: 22vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.us-log table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.us-log th, .us-log td { text-align: left; padding: 5px 10px; border-bottom: 1px solid var(--border); }
.us-log th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; }

/* ---------- Statistics ---------- */
.statsv { padding: 0 24px 60px; }
.st-sub { color: var(--muted); font-size: 13px; margin: 6px 0 12px 6px; }
.st-toolbar { position: sticky; top: 0; z-index: 3; background: var(--bg); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.st-toolbar .spacer { flex: 1; }
.st-range { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.st-grid-wrap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.st-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px 16px; min-width: 0; }
.st-card.wide { grid-column: 1 / -1; }
.st-card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.st-card-head h3 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; }
.st-card-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.st-card-head .spacer { flex: 1; }
.st-card-head .icon-btn { width: 24px; height: 24px; opacity: .55; }
.st-card:hover .st-card-head .icon-btn { opacity: 1; }
.st-card-head .icon-btn:disabled { opacity: .2; }
.st-empty { color: var(--muted); font-size: 13px; padding: 14px 4px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

.st-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.st-tile { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.st-tile b { font-size: 26px; font-weight: 600; line-height: 1.1; }
.st-tile span { font-size: 13px; color: var(--text); }
.st-tile small { font-size: 11.5px; color: var(--muted); }
.st-tile.crit b { color: var(--st-crit); }

.st-hm { overflow-x: auto; }
.st-hm-row { display: flex; gap: 2px; margin-bottom: 2px; align-items: center; }
.st-hm-name { width: 200px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.st-pn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-hm-cell { flex: 1 0 40px; height: 28px; border-radius: 4px; display: grid; place-items: center; font-size: 11.5px; font-variant-numeric: tabular-nums; background: var(--soft); color: var(--seq-ink-light); }
.st-hm-cell.h { background: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.st-hm-cell.h.cur { color: #3d9a6d; }
.st-hm-cell.s0 { background: var(--soft); box-shadow: inset 0 0 0 1px var(--border); }
.st-hm-cell.s1 { background: var(--seq-1); }
.st-hm-cell.s2 { background: var(--seq-2); }
.st-hm-cell.s3 { background: var(--seq-3); color: var(--seq-ink-dark); }
.st-hm-cell.s4 { background: var(--seq-4); color: var(--seq-ink-dark); }
.st-hm-cell.s5 { background: var(--seq-5); color: var(--seq-ink-dark); }
:root[data-theme="dark"] .st-hm-cell { color: var(--seq-ink-dark); }
:root[data-theme="dark"] .st-hm-cell.s5 { color: #0b0b0b; }
.st-legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.st-legend span { display: inline-flex; align-items: center; gap: 5px; }
.st-legend .st-hm-cell { flex: none; width: 18px; height: 12px; }
.st-sw { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }
.st-sw.col { background: var(--series-1); }
.st-sw.cap { height: 2px; background: var(--text); }
.st-sw.free { background: var(--st-free); box-shadow: inset 0 0 0 1px var(--border); }

.st-svg { width: 100%; display: block; overflow: visible; }
.st-svg .st-grid { stroke: var(--st-grid); stroke-width: 1; }
.st-svg .st-base { stroke: var(--st-base); stroke-width: 1; }
.st-svg .st-ax { fill: var(--muted); font-size: 11px; font-family: inherit; }
.st-svg .st-ax.cur { fill: #3d9a6d; font-weight: 700; }
.st-svg .st-col { fill: var(--series-1); }
.st-svg .st-cap { stroke: var(--text); stroke-width: 2; }
.st-svg g:hover .st-col { filter: brightness(1.15); }

.st-hbars { display: flex; flex-direction: column; gap: 6px; }
.st-hrow, .st-frow { display: grid; grid-template-columns: 190px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; }
.st-hl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.st-htrack { position: relative; height: 14px; }
.st-hbar { height: 100%; border-radius: 0 4px 4px 0; }
.st-hrow:hover .st-hbar { filter: brightness(1.1); }
.st-hmark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; }
.st-hv { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-hv small { color: var(--muted); }
.st-free { display: flex; flex-direction: column; gap: 8px; }
.st-frow { grid-template-columns: 190px 1fr 50px; row-gap: 2px; }
.st-stack { display: flex; height: 14px; gap: 2px; }
.st-stack i { display: block; height: 100%; }
.st-stack i.busy { background: var(--series-1); border-radius: 4px 0 0 4px; }
.st-stack i.free { background: var(--st-free); border-radius: 0 4px 4px 0; box-shadow: inset 0 0 0 1px var(--border); }
.st-runs { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--muted); }
.st-runs span:not(.muted) { background: var(--soft); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; color: var(--text); }

.st-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.st-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.st-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.st-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.st-table td:first-child { display: table-cell; }
.st-table tr.st-done td { color: var(--muted); }
.st-util { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--st-free); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.st-util i { display: block; height: 100%; background: var(--series-1); }
.st-warn { color: var(--st-crit); font-weight: 600; }
.st-ok { color: var(--st-good); font-weight: 600; }
.st-tip { position: fixed; display: none; z-index: 70; max-width: 360px; white-space: pre-line; background: #1e1f21; color: #fff; font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 6px; pointer-events: none; box-shadow: var(--shadow-lg); }
:root[data-theme="dark"] .st-tip { background: #3a3b3e; }
@media (max-width: 1200px) { .st-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } .st-grid-wrap { grid-template-columns: 1fr; } }

/* ---------- Users view ---------- */
.users-view .st-card { margin-bottom: 16px; }
.online { display: flex; flex-wrap: wrap; gap: 10px; }
.on-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.on-chip.edit { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.on-chip span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.on-chip small { color: var(--muted); font-size: 12px; }
.us-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.us-toolbar .spacer { flex: 1; }
.us-toolbar .seg button small { color: var(--muted); margin-left: 3px; }
.us-table select { height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); padding: 0 6px; }
.us-table tr.off td { opacity: .55; }
.us-table tr.hl td { background: rgba(69, 115, 210, .08); }
.us-table .us-act { text-align: right; white-space: nowrap; }
.us-n { display: inline-flex; align-items: center; gap: 6px; }
.dot-on { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.badge { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--soft); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.new { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 700; }
.badge.ok { color: var(--green); border-color: var(--green); }
.badge.wait { color: #b07a10; border-color: #e2b35a; }
.badge.off { color: var(--red); border-color: var(--red); }
.nav-badge { margin-left: auto; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; border-radius: 9px; padding: 1px 7px; }
.login-warn { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: #fdf1d8; color: #6b4a06; font-size: 13px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
:root[data-theme="dark"] .login-warn { background: #3d3115; color: #f1c46c; }
