/* VTx Watchdog — calm blue/white dashboard on the catalog's --ux-* tokens. */

/* Blue/white palette overrides: the shared token file defaults to violet. */
:root {
  --ux-page: #F3F7FC;
  --ux-surface: #FFFFFF;
  --ux-surface-2: #F2F6FB;
  --ux-surface-3: #E7EEF8;
  --ux-ink: #0F1C2E;
  --ux-ink-2: #43536B;
  --ux-ink-3: #7C8CA3;
  --ux-line: rgba(15, 28, 46, .09);
  --ux-line-2: rgba(15, 28, 46, .17);
  --ux-accent: #1F6FEB;
  --ux-accent-2: #2F8FE0;
  --ux-accent-soft: rgba(31, 111, 235, .12);
  --ux-accent-ink: #FFFFFF;
  --ux-mint: #0F9F86;
  --ux-warn: #C86A12;
  --ux-danger: #D02F4B;
  --ux-shadow: rgba(16, 44, 84, .14);
  --ux-shadow-strong: rgba(16, 44, 84, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ux-page: #070C14;
    --ux-surface: #111A27;
    --ux-surface-2: #16222F;
    --ux-surface-3: #20303F;
    --ux-accent: #7DB4FF;
    --ux-accent-2: #67C7E8;
    --ux-accent-soft: rgba(125, 180, 255, .15);
    --ux-accent-ink: #08111D;
    --ux-mint: #5FE3C0;
    --ux-warn: #FFB26B;
    --ux-danger: #FF7D8C;
  }
}
:root[data-theme="dark"] {
  --ux-page: #070C14;
  --ux-surface: #111A27;
  --ux-surface-2: #16222F;
  --ux-surface-3: #20303F;
  --ux-accent: #7DB4FF;
  --ux-accent-2: #67C7E8;
  --ux-accent-soft: rgba(125, 180, 255, .15);
  --ux-accent-ink: #08111D;
  --ux-mint: #5FE3C0;
  --ux-warn: #FFB26B;
  --ux-danger: #FF7D8C;
}

html { -webkit-text-size-adjust: 100%; font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(1000px 480px at 10% -14%, color-mix(in srgb, var(--ux-accent-2) 12%, transparent), transparent 62%),
    radial-gradient(900px 420px at 92% 0%, color-mix(in srgb, var(--ux-accent) 9%, transparent), transparent 58%),
    var(--ux-page);
  color: var(--ux-ink);
  transition: background-color .35s var(--ux-ease), color .35s var(--ux-ease);
}

body.ux, .ux {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; }
a { color: inherit; }

.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;
}

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; border-radius: 10px;
  background: var(--ux-ink); color: var(--ux-surface);
  font-size: 14px; font-weight: 650; text-decoration: none;
  transition: top .2s var(--ux-ease);
}
.skip-link:focus { top: 12px; }

.muted { color: var(--ux-ink-3); }
.num { text-align: right; }
.nowrap { white-space: nowrap; }

/* ── layout ──────────────────────────────────────────────────────── */
.banner {
  padding: 11px 15px; border-radius: 13px;
  background: color-mix(in srgb, var(--ux-warn) 12%, var(--ux-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ux-warn) 30%, transparent);
  font-size: 14px; color: var(--ux-ink-2);
}
.banner code {
  padding: 1px 5px; border-radius: 5px;
  background: color-mix(in srgb, var(--ux-warn) 16%, transparent);
  font-size: 14px;
}

.view { display: grid; gap: 16px; }
.view:focus { outline: none; }

.card {
  background: var(--ux-surface); border-radius: 20px;
  box-shadow: 0 0 0 1px var(--ux-line), 0 24px 56px -46px var(--ux-shadow-strong);
  padding: 18px 20px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.card-head p { margin-top: 3px; font-size: 14px; font-weight: 600; color: var(--ux-ink-3); }
.card-head > :last-child:not(:first-child) { margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 16px; }

/* ── KPI numerals ───────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 15px 16px; border-radius: 17px; }
.kpi-label { font-size: 13.5px; font-weight: 750; color: var(--ux-ink-3); letter-spacing: .01em; }
.kpi-value {
  display: block; margin-top: 5px;
  font-size: 28px; font-weight: 800; letter-spacing: -.045em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-foot { margin-top: 3px; font-size: 13px; font-weight: 600; color: var(--ux-ink-3); }
.kpi-value.is-warn { color: var(--ux-warn); }
.kpi-value.is-down { color: var(--ux-danger); }
.kpi-value.is-ok { color: var(--ux-mint); }
.kpi-value.is-muted { color: var(--ux-ink-3); }

/* ── segmented control (element 047) ────────────────────────────── */
.seg {
  position: relative; flex: none;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; border-radius: 13px;
  background: var(--ux-surface-2); box-shadow: inset 0 0 0 1px var(--ux-line);
}
.seg-knob {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: 54px;
  border-radius: 9px; background: var(--ux-surface);
  box-shadow: 0 0 0 1px var(--ux-line), 0 6px 14px -10px var(--ux-shadow-strong);
  transition: left .32s var(--ux-ease), width .32s var(--ux-ease);
}
.seg button {
  position: relative; z-index: 1;
  height: 28px; min-width: 54px; padding: 0 11px;
  border: 0; border-radius: 9px; background: none;
  font-size: 13.5px; font-weight: 700; color: var(--ux-ink-3); cursor: pointer;
  transition: color .22s;
}
.seg button:hover { color: var(--ux-ink-2); }
.seg button[aria-checked="true"] { color: var(--ux-ink); }
.seg button:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 1px; }

/* ── status list (element 238) ─────────────────────────────────── */
.status-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--ux-mint) 9%, transparent);
}
.status-head.is-warn { background: color-mix(in srgb, var(--ux-warn) 11%, transparent); }
.status-head.is-down { background: color-mix(in srgb, var(--ux-danger) 10%, transparent); }
.status-head.is-empty { background: var(--ux-surface-2); }
.status-copy { flex: 1; min-width: 0; }
.status-copy h3 { font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.status-copy p { margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--ux-ink-3); }

.pulse { position: relative; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ux-mint); }
.pulse::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--ux-mint); animation: pulse 1.9s ease-out infinite;
}
.is-warn .pulse, .pulse.is-warn { background: var(--ux-warn); }
.is-warn .pulse::after { border-color: var(--ux-warn); }
.is-down .pulse, .pulse.is-down { background: var(--ux-danger); }
.is-down .pulse::after { border-color: var(--ux-danger); }
.is-empty .pulse, .pulse.is-empty { background: var(--ux-ink-3); }
.is-empty .pulse::after { animation: none; border-color: var(--ux-ink-3); }
@keyframes pulse { from { transform: scale(.55); opacity: 1; } to { transform: scale(1.55); opacity: 0; } }

.badge {
  flex: none; padding: 4px 9px; border-radius: 999px;
  background: var(--ux-surface); box-shadow: inset 0 0 0 1px var(--ux-line);
  font-size: 13px; font-weight: 800; color: var(--ux-ink-2); white-space: nowrap;
}
.badge-ok { color: var(--ux-mint); }
.badge-warn { color: var(--ux-warn); }
.badge-down { color: var(--ux-danger); }
.badge-quiet { color: var(--ux-ink-3); }

.status-list { display: grid; gap: 2px; }
.status-row {
  display: grid; gap: 5px;
  padding: 8px 2px 9px;
  border: 0; border-bottom: 1px solid var(--ux-line);
  background: none; color: inherit; text-align: left; width: 100%;
  cursor: pointer; border-radius: 0;
}
.status-row:last-child { border-bottom: 0; }
.status-row:hover .status-name { color: var(--ux-accent); }
.status-row:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: -2px; border-radius: 8px; }
.status-top { display: flex; align-items: center; gap: 8px; }
.status-name {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 15px; font-weight: 800; transition: color .2s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.status-name .chev { flex: none; color: var(--ux-ink-3); font-size: 13px; }
.status-state {
  flex: none; padding: 1px 7px; border-radius: 999px;
  background: var(--ux-surface-2); font-size: 13px; font-weight: 800;
  color: var(--ux-ink-2);
}
.status-state.is-ok { color: var(--ux-mint); }
.status-state.is-warn { color: var(--ux-warn); }
.status-state.is-down { color: var(--ux-danger); }
.status-pct {
  margin-left: auto; font-size: 13px; font-weight: 800;
  color: var(--ux-ink-3); font-variant-numeric: tabular-nums;
}
.status-bars { display: flex; align-items: stretch; gap: 2px; height: 20px; }
.status-bars i {
  position: relative; flex: 1; min-width: 2px; border-radius: 2px;
  background: var(--ux-accent-2); opacity: .85;
  transition: opacity .15s;
}
.status-bars i.is-ok { background: var(--ux-mint); }
.status-bars i.is-warn { background: var(--ux-warn); }
.status-bars i.is-down { background: var(--ux-danger); }
.status-bars i.is-gap { background: var(--ux-surface-3); box-shadow: inset 0 0 0 1px var(--ux-line-2); opacity: 1; }
.bars-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 2px; font-size: 13px; font-weight: 700; color: var(--ux-ink-3); }
.bars-legend span { display: inline-flex; align-items: center; gap: 5px; }
.bars-legend em { width: 9px; height: 9px; border-radius: 2px; background: var(--ux-surface-3); font-style: normal; }
.bars-legend em.is-ok { background: var(--ux-mint); }
.bars-legend em.is-warn { background: var(--ux-warn); }
.bars-legend em.is-down { background: var(--ux-danger); }
.bars-legend em.is-gap { background: var(--ux-surface-3); box-shadow: inset 0 0 0 1px var(--ux-line-2); }
.status-bars i:hover, .status-bars i:focus-visible { opacity: .55; }
.status-bars i:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 1px; }
.status-meta {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--ux-ink-3);
  font-variant-numeric: tabular-nums;
}

/* ── health table ───────────────────────────────────────────────── */
.health-table { margin-top: 10px; display: grid; }
.health-row {
  display: grid; grid-template-columns: minmax(120px, 1.4fr) auto auto auto auto;
  gap: 4px 14px; align-items: center;
  width: 100%; padding: 10px 4px;
  border: 0; border-bottom: 1px solid var(--ux-line);
  background: none; color: inherit; text-align: left; cursor: pointer;
}
.health-row:last-child { border-bottom: 0; }
.health-row:hover { background: var(--ux-surface-2); }
.health-row:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: -2px; border-radius: 8px; }
.health-site { display: flex; align-items: center; gap: 8px; min-width: 0; }
.health-site b { font-size: 15px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-site small { display: block; font-size: 13.5px; color: var(--ux-ink-3); font-weight: 600; }
.health-cell { font-size: 14px; font-weight: 700; color: var(--ux-ink-2); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.health-cell small { display: block; font-size: 13.5px; color: var(--ux-ink-3); font-weight: 700; }
.health-bars { grid-column: 1 / -1; display: flex; gap: 2px; height: 14px; margin-top: 2px; }
.health-bars i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--ux-mint); opacity: .85; }
.health-bars i.is-warn { background: var(--ux-warn); }
.health-bars i.is-down { background: var(--ux-danger); }
.health-bars i.is-gap { background: var(--ux-surface-3); box-shadow: inset 0 0 0 1px var(--ux-line-2); opacity: 1; }
.health-bars i:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 1px; }
.method-note {
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--ux-line);
  font-size: 13px; font-weight: 600; color: var(--ux-ink-3); line-height: 1.5;
}

/* ── traffic ────────────────────────────────────────────────────── */
.pull-card { display: grid; gap: 8px; }
.pull-main { display: flex; align-items: center; gap: 10px; }
.pull-main h3 { font-size: 16px; font-weight: 800; }
.pull-main p { margin-top: 2px; font-size: 13.5px; font-weight: 600; color: var(--ux-ink-3); }
.pull-dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ux-mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ux-mint) 16%, transparent);
}
.pull-dot.is-warn { background: var(--ux-warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ux-warn) 16%, transparent); }
.pull-dot.is-down { background: var(--ux-danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ux-danger) 16%, transparent); }
.pull-dot.is-muted { background: var(--ux-ink-3); box-shadow: 0 0 0 3px var(--ux-surface-2); }
.pull-main > .badge { margin-left: auto; }
.pull-error {
  padding: 7px 10px; border-radius: 9px;
  background: color-mix(in srgb, var(--ux-danger) 9%, transparent);
  font-size: 13px; font-weight: 700; color: var(--ux-danger);
}

.site-total-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.site-total {
  padding: 13px 14px; border-radius: 16px;
  background: var(--ux-surface); box-shadow: 0 0 0 1px var(--ux-line);
}
.site-total h3 { font-size: 15px; font-weight: 800; color: var(--ux-ink-2); }
.site-total b {
  display: block; margin-top: 5px; font-size: 22px; font-weight: 800;
  letter-spacing: -.04em; font-variant-numeric: tabular-nums;
}
.site-total small { display: block; margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--ux-ink-3); }

.traffic-series { display: grid; gap: 11px; }
.series-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.series-row > b { font-size: 14px; font-weight: 750; color: var(--ux-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-bars { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.series-bars i {
  flex: 1; min-width: 2px; border-radius: 2px 2px 1px 1px;
  background: linear-gradient(180deg, var(--ux-accent-2), color-mix(in srgb, var(--ux-accent-2) 55%, var(--ux-accent)));
  opacity: .85; transform-origin: 50% 100%;
  transform: scaleY(.2); transition: transform .45s var(--ux-spring);
  position: relative;
}
.series-bars i.is-gap { background: repeating-linear-gradient(135deg, var(--ux-surface-3) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--ux-line); opacity: 1; }
.is-rendered .series-bars i { transform: none; }
.series-bars i:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 1px; }
.series-total { font-size: 14px; font-weight: 800; color: var(--ux-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.series-legend { display: flex; gap: 14px; margin-top: 2px; font-size: 13.5px; font-weight: 700; color: var(--ux-ink-3); }
.series-legend span { display: inline-flex; align-items: center; gap: 5px; }
.series-legend em { width: 9px; height: 9px; border-radius: 2px; background: var(--ux-accent-2); font-style: normal; }
.series-legend em.is-gap { background: repeating-linear-gradient(135deg, var(--ux-surface-3) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--ux-line); }

/* ── tables ─────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto; margin: 0 -6px; max-width: 100%;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table th {
  padding: 8px 10px; text-align: left; white-space: nowrap;
  font-size: 14px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ux-ink-3); border-bottom: 1px solid var(--ux-line);
}
.data-table td {
  padding: 9px 10px; vertical-align: middle;
  border-bottom: 1px solid var(--ux-line);
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .num { text-align: right; }
.data-table .cell-strong { font-weight: 750; }
.data-table .gap-cell { color: var(--ux-ink-3); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  background: var(--ux-surface-2); font-size: 13px; font-weight: 800; color: var(--ux-ink-2);
  white-space: nowrap;
}
.chip.is-ok { color: var(--ux-mint); background: color-mix(in srgb, var(--ux-mint) 12%, transparent); }
.chip.is-warn { color: var(--ux-warn); background: color-mix(in srgb, var(--ux-warn) 12%, transparent); }
.chip.is-down { color: var(--ux-danger); background: color-mix(in srgb, var(--ux-danger) 10%, transparent); }
.chip.is-muted { color: var(--ux-ink-3); }

/* ── Telegram summary (overview card) ─────────────────────────────── */
.tg-channels { display: grid; gap: 1px; }
.tg-channel {
  display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, auto) auto;
  gap: 10px; align-items: center;
  padding: 9px 2px; border-bottom: 1px solid var(--ux-line);
  font-size: 14px;
}
.tg-channel:last-child { border-bottom: 0; }
.tg-channel b { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-channel small { display: block; font-size: 13px; color: var(--ux-ink-3); }
.tg-channel span { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tg-channel .age { font-size: 13.5px; color: var(--ux-ink-3); }

/* ── drawer (element 273) ───────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10, 10, 20, .26); backdrop-filter: blur(2px);
  animation: fade .22s ease both;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  display: flex; flex-direction: column;
  width: min(430px, 94vw);
  background: var(--ux-surface);
  border-radius: 22px 0 0 22px;
  box-shadow: -30px 0 70px -40px var(--ux-shadow-strong), 0 0 0 1px var(--ux-line);
  transform: translateX(100%);
  transition: transform .4s cubic-bezier(.3, 1.1, .4, 1);
  overflow: hidden;
}
.drawer.is-open { transform: none; }
@keyframes fade { from { opacity: 0; } }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 8px;
}
.drawer-head h2 { flex: 1; font-size: 20px; font-weight: 850; letter-spacing: -.015em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 2px 18px 26px; }
.drawer-site { display: flex; align-items: center; gap: 10px; }
.drawer-site h3 { font-size: 20px; font-weight: 850; letter-spacing: -.02em; }
.drawer-site p { margin-top: 2px; font-size: 13.5px; color: var(--ux-ink-3); }
.drawer-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.drawer-kv div { padding: 9px 10px; border-radius: 11px; background: var(--ux-surface-2); }
.drawer-kv small { display: block; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ux-ink-3); }
.drawer-kv b { display: block; margin-top: 3px; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.drawer-section { margin-top: 16px; }
.drawer-section h3 {
  margin-bottom: 7px; font-size: 14px; font-weight: 850;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ux-ink-3);
}
.drawer-bars { display: flex; gap: 2px; height: 30px; }
.drawer-bars i { flex: 1; min-width: 2px; border-radius: 2px; background: var(--ux-mint); opacity: .85; }
.drawer-bars i.is-warn { background: var(--ux-warn); }
.drawer-bars i.is-down { background: var(--ux-danger); }
.drawer-bars i.is-gap { background: var(--ux-surface-3); box-shadow: inset 0 0 0 1px var(--ux-line-2); opacity: 1; }
.drawer-bars i { position: relative; }
.drawer-bars i:focus-visible { outline: 2px solid var(--ux-accent); outline-offset: 1px; }
.sample-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--ux-line);
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.sample-row:last-child { border-bottom: 0; }
.sample-row span { color: var(--ux-ink-3); }
.sample-row b { font-weight: 750; }
.sample-row .err { grid-column: 1 / -1; font-size: 13px; color: var(--ux-danger); overflow-wrap: anywhere; }
.incident-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; margin-bottom: 5px; border-radius: 9px;
  background: var(--ux-surface-2); font-size: 13px; font-weight: 650;
}
.incident-row time { margin-left: auto; color: var(--ux-ink-3); font-size: 13px; }

/* ── load error banner ─────────────────────────────────────────── */
.load-alert {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 13px;
  background: color-mix(in srgb, var(--ux-warn) 10%, var(--ux-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ux-warn) 30%, transparent);
  font-size: 14px; font-weight: 650; color: var(--ux-ink-2);
}
.load-alert > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.load-alert .btn { flex: none; height: 30px; padding: 0 12px; }

/* ── global tooltip ────────────────────────────────────────────── */
.wd-tooltip {
  position: fixed; left: 0; top: 0; z-index: 80;
  min-width: 140px;
  max-width: min(340px, calc(100vw - 16px));
  padding: 8px 11px; border-radius: 9px;
  background: #0F1C2E; color: #FFFFFF;
  font-size: 13.5px; line-height: 1.45; font-weight: 600;
  text-align: left; white-space: normal; word-break: normal;
  overflow-wrap: break-word; pointer-events: none;
  box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .55);
}
:root[data-theme="dark"] .wd-tooltip { background: #E7EEF8; color: #0F1C2E; }

/* ── empty / error states ──────────────────────────────────────── */
.state-box {
  display: grid; place-items: center; gap: 6px;
  padding: 26px 14px; text-align: center;
  border-radius: 13px; background: var(--ux-surface-2);
  font-size: 14px; color: var(--ux-ink-3);
}
.state-box strong { font-size: 13.5px; font-weight: 750; color: var(--ux-ink-2); }
.state-box.is-error { background: color-mix(in srgb, var(--ux-danger) 7%, var(--ux-surface)); color: var(--ux-danger); }

/* ── skeletons (element 439) ───────────────────────────────────── */
.skeleton-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; padding: 7px 2px; }
.skeleton-row span {
  height: 11px; border-radius: 5px;
  background: linear-gradient(90deg, var(--ux-surface-2) 25%, var(--ux-surface-3) 45%, var(--ux-surface-2) 65%);
  background-size: 260% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-row span:nth-child(2) { width: 72%; justify-self: end; }
.skeleton-row span:nth-child(3) { width: 55%; justify-self: end; }
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -130% 0; } }

/* ── toasts (element 435) ──────────────────────────────────────── */
.toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  width: min(330px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 12px; border-radius: 13px;
  background: var(--ux-surface);
  box-shadow: 0 0 0 1px var(--ux-line), 0 20px 40px -26px var(--ux-shadow-strong);
  animation: toast-in .38s cubic-bezier(.3, 1.3, .45, 1) both;
  pointer-events: auto;
}
.toast.is-out { animation: toast-out .24s ease both; }
.toast-icon {
  display: grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: color-mix(in srgb, var(--ux-mint) 15%, transparent);
  color: var(--ux-mint); font-size: 13px; font-weight: 900;
}
.toast.is-error .toast-icon { background: color-mix(in srgb, var(--ux-danger) 14%, transparent); color: var(--ux-danger); }
.toast.is-warn .toast-icon { background: color-mix(in srgb, var(--ux-warn) 15%, transparent); color: var(--ux-warn); }
.toast-body { min-width: 0; flex: 1; }
.toast-body b { display: block; font-size: 14px; font-weight: 800; }
.toast-body p { margin-top: 2px; font-size: 13px; color: var(--ux-ink-3); overflow-wrap: anywhere; }
.toast-close { border: 0; background: none; color: var(--ux-ink-3); font-size: 13.5px; cursor: pointer; padding: 0 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(5px) scale(.98); } }

/* ── footer ────────────────────────────────────────────────────── */
.foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 4px 2px 0; font-size: 13px; font-weight: 600; color: var(--ux-ink-3);
}

/* ── auth page ─────────────────────────────────────────────────── */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 22px; }
.auth-card {
  width: min(370px, 100%); padding: 24px 24px 20px;
  border-radius: 22px; background: var(--ux-surface);
  box-shadow: 0 0 0 1px var(--ux-line), 0 40px 80px -52px var(--ux-shadow-strong);
}
.brand-block { margin-bottom: 16px; }
.auth-copy { font-size: 13.5px; color: var(--ux-ink-3); line-height: 1.6; }
.auth-form { display: grid; gap: 7px; margin-top: 16px; }
.auth-form label { font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ux-ink-3); }
.auth-form input {
  height: 40px; padding: 0 12px; border: 0; border-radius: 11px;
  background: var(--ux-surface-2); color: var(--ux-ink);
  box-shadow: inset 0 0 0 1px var(--ux-line); font-size: 14px;
}
.auth-form input:focus { outline: 2px solid var(--ux-accent); outline-offset: 1px; }
.auth-form .btn { margin-top: 5px; }
.form-hint { margin-top: 11px; font-size: 13px; color: var(--ux-ink-3); }
.form-err { margin-top: 11px; font-size: 13.5px; font-weight: 700; color: var(--ux-danger); }

/* ── responsive + motion ──────────────────────────────────────── */
@media (max-width: 1120px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-total-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-row { grid-template-columns: minmax(100px, 1.4fr) auto auto; }
  .health-row .health-cell:nth-of-type(3),
  .health-row .health-cell:nth-of-type(4) { display: none; }
  .series-row { grid-template-columns: 92px minmax(0, 1fr) auto; }
}
@media (max-width: 560px) {
  .card { padding: 14px; border-radius: 17px; }
  .series-row { grid-template-columns: 74px minmax(0, 1fr); }
  .series-total { grid-column: 2; text-align: right; }
  .data-table { font-size: 14px; min-width: 680px; }
  .data-table th, .data-table td { padding: 8px 7px; }
  .drawer { width: 100vw; border-radius: 18px 18px 0 0; }
  .drawer-kv { grid-template-columns: 1fr 1fr; }
  .toast-stack { right: 10px; bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 560px) {
  .status-head { flex-wrap: wrap; }
  .status-copy { flex: 1 1 calc(100% - 24px); }
  .status-head > .badge { margin-left: 20px; }
  .health-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; }
  .health-site { grid-column: 1 / -1; flex-direction: column; align-items: flex-start; gap: 2px; }
  .health-site b { max-width: 100%; }
  .health-site small { overflow-wrap: anywhere; }
  .health-cell { text-align: left; }
  .health-cell:last-of-type { text-align: right; }
}
