:root {
  --bg: #f6f5f2; --surface: #ffffff; --ink: #16181d; --muted: #6b6f78; --line: #e4e2dc;
  --accent: #2f6df6; --accent-ink: #ffffff;
  --good: #1f8a5b; --good-bg: #e3f4ec; --warn: #a35c00; --warn-bg: #fdf0dc;
  --bad: #c0392b; --bad-bg: #fbe7e4; --wait-bg: #eef1f6;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a20; --ink: #eceae6; --muted: #8b909a; --line: #262a32;
    --accent: #6b97ff; --accent-ink: #0f1115;
    --good: #4cc38a; --good-bg: #15291f; --warn: #f0a94b; --warn-bg: #2b2113;
    --bad: #ff7b6b; --bad-bg: #2e1715; --wait-bg: #1f232b;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h2 { font-size: 18px; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 6px; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.topbar form { margin: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; color: var(--ink); }
.brand.big { font-size: 20px; margin-bottom: 20px; }
.mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.full { width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--line); }
.btn.danger:hover { background: var(--bad-bg); }

/* flash */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: var(--good-bg); color: var(--good); }
.flash.error { background: var(--bad-bg); color: var(--bad); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat strong { font-size: 17px; font-weight: 600; }
.stat small { color: var(--muted); font-weight: 400; font-size: 13px; }
.good { color: var(--good); } .bad { color: var(--bad); }

/* panels */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* domain table */
.table { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 2fr 2fr 1.1fr 0.9fr auto; gap: 14px; align-items: center;
  padding: 14px 4px; border-bottom: 1px solid var(--line);
}
.row.head { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 4px; }
.row.paused > div:not(.actions) { opacity: 0.5; }
.row > div { min-width: 0; }
.domain { font-weight: 600; color: var(--ink); word-break: break-all; }
a.domain:hover { color: var(--accent); }
.aliases, .target { font-size: 13px; color: var(--muted); word-break: break-all; }
.type { font-weight: 500; }
.tag {
  display: inline-block; margin-left: 8px; font-size: 11px; padding: 1px 7px; border-radius: 99px;
  background: var(--wait-bg); color: var(--muted); font-weight: 500; vertical-align: 1px;
}
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions form { margin: 0; }
.empty { padding: 28px 4px; color: var(--muted); text-align: center; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); cursor: help; }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.wait, .pill.muted { background: var(--wait-bg); color: var(--muted); }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 550; margin-bottom: 16px; }
input[type=text], input:not([type]), input[type=password] {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.site-form { max-width: 620px; }
fieldset.types { border: 0; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
fieldset.types legend { font-weight: 550; margin-bottom: 6px; padding: 0; }
.choice {
  flex-direction: row; align-items: flex-start; gap: 12px; margin: 0; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); }
.row-buttons { display: flex; gap: 10px; }
[hidden] { display: none !important; }

.help { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); max-width: 620px; }
.help p { margin: 6px 0; }
table.dns { border-collapse: collapse; margin: 10px 0; font-size: 14px; }
table.dns th, table.dns td { text-align: left; padding: 6px 18px 6px 0; border-bottom: 1px solid var(--line); }
table.dns th { font-size: 12px; color: var(--muted); font-weight: 500; }
.back { font-size: 14px; }

/* login */
.login { min-height: 80vh; display: grid; place-items: center; }
.login .card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
}
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; }

@media (max-width: 760px) {
  .row { grid-template-columns: 1fr 1fr; }
  .row.head { display: none; }
  .row > div:first-child { grid-column: 1 / -1; }
  .actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
}

/* ---------- navigation ---------- */
.topbar-left { display: flex; align-items: center; gap: 28px; }
.tabs { display: flex; gap: 4px; }
.tabs a { color: var(--muted); font-weight: 550; padding: 6px 12px; border-radius: 8px; }
.tabs a:hover { color: var(--ink); background: var(--bg); }
.tabs a.active { color: var(--ink); background: var(--bg); }
@media (max-width: 560px) { .brand-name { display: none; } .topbar-left { gap: 12px; } }

/* ---------- metrics: chart tokens ---------- */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --st-ok: #2a78d6; --st-warn: #fab219; --st-crit: #d03b3b; --st-good: #0ca30c;
  --gridline: #ecebe6; --axis: #8a8d94;
}
@media (prefers-color-scheme: dark) {
  :root {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --st-ok: #3987e5; --st-good: #0ca30c;
    --gridline: #23262d; --axis: #7d828c;
  }
}

.page-title { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
.m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.m-head p { margin: 4px 0 0; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted);
        border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; background: var(--surface); white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live[data-state="live"] .live-dot { background: var(--st-good); animation: pulse 2s infinite; }
.live[data-state="stale"] .live-dot { background: var(--st-warn); }
.live[data-state="down"] .live-dot { background: var(--st-crit); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st-good) 45%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* gauges */
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
@media (max-width: 860px) { .gauges { grid-template-columns: repeat(2, 1fr); } }
.gauge-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
              padding: 16px 16px 14px; position: relative; text-align: center; --lvl: var(--st-ok); }
.gauge-card[data-level="warn"] { --lvl: var(--st-warn); }
.gauge-card[data-level="crit"] { --lvl: var(--st-crit); }
.gauge-label { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.gauge { width: 100%; max-width: 190px; display: block; margin: 4px auto 0; }
.g-track, .g-fill { fill: none; stroke-width: 10; stroke-linecap: round; }
.g-track { stroke: color-mix(in srgb, var(--lvl) 16%, var(--surface)); }
.g-fill { stroke: var(--lvl); transition: d 0.6s ease; }
.g-num { fill: var(--ink); font-size: 24px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.g-unit { fill: var(--muted); font-size: 11px; font-weight: 500; }
.gauge-sub { margin-top: -6px; min-height: 18px; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; font-weight: 600;
               padding: 3px 10px; border-radius: 99px; color: var(--ink);
               background: color-mix(in srgb, var(--lvl) 14%, var(--surface)); }
.status-chip .s-icon { color: var(--lvl); font-size: 10px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
        display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile span { font-size: 12px; color: var(--muted); }
.tile strong { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* range control */
.wrap-head { flex-wrap: wrap; gap: 10px; }
.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.segmented button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: transparent; color: var(--muted);
                    padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* charts */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .charts { grid-template-columns: 1fr; } }
.chart-card { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 6px; }
.chart-card h3 { font-size: 14px; margin: 0 0 6px; }
.chart { min-height: 214px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .tip-row i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.plot { position: relative; }
.plot svg { display: block; overflow: visible; }
.plot .grid { stroke: var(--gridline); stroke-width: 1; }
.plot .grid.base { stroke: var(--line); }
.plot .axis { fill: var(--axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.plot .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .end-label { fill: var(--muted); font-size: 11px; font-weight: 600; }
.plot .cross { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
.plot .dot { stroke: var(--surface); stroke-width: 2; }
.plot .hit { fill: transparent; cursor: crosshair; }
.chart-empty { position: absolute; inset: 0 0 26px 58px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
       padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 150px; z-index: 2; }
.tip-time { color: var(--muted); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row span { flex: 1; color: var(--muted); }
.tip-row b { font-variant-numeric: tabular-nums; }
.history-note { margin: 12px 0 0; }

/* meters, services, tables */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; }
@media (max-width: 440px) { .two-col { grid-template-columns: 1fr; } }
.two-col > .panel { margin-bottom: 20px; min-width: 0; }
.panel-head.sub { margin-top: 22px; }
.meters { display: grid; gap: 10px; }
.meter { display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; align-items: center; font-size: 13px; --lvl: var(--st-ok); }
.meter[data-level="warn"] { --lvl: var(--st-warn); }
.meter[data-level="crit"] { --lvl: var(--st-crit); }
.m-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-bar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--lvl) 16%, var(--surface)); overflow: hidden; }
.m-bar span { display: block; height: 100%; background: var(--lvl); border-radius: 4px; transition: width 0.6s ease; }
.m-fig { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 44px; }
.services { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.services li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.services .s-icon { font-size: 10px; color: var(--st-good); }
.services li[data-ok="false"] .s-icon { color: var(--st-crit); }
.svc-name { flex: 1; }
.svc-state { font-size: 13px; color: var(--muted); }
.ptable { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.ptable th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
             font-weight: 500; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.ptable td { padding: 7px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptable th:first-child { width: 42%; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; }
.pname { font-weight: 550; }

/* Parteli tab */
.p-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.p-envs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.p-envs a { padding: 7px 14px; color: var(--ink); font-weight: 550; font-size: 14px; }
.p-envs a + a { border-left: 1px solid var(--line); }
.p-envs a.active { background: var(--ink); color: var(--bg); }
.p-envs a.env-live.active { background: var(--bad); color: #fff; }
.p-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.p-tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 550; font-size: 14px; }
.p-tabs a.active { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.flash.live-note { background: var(--bad-bg); color: var(--bad); }
.p-cloud { margin: -6px 0 18px; }
.p-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.p-filter input, .p-filter select, .p-notes input, .p-notes textarea, .p-plans input, .p-inline input, select {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.p-accounts tbody tr { cursor: pointer; }
.p-accounts tbody tr:hover { background: var(--bg); }
.p-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 8px 0 16px; flex-wrap: wrap; }
.p-title h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.p-title p { margin: 4px 0 0; }
.pill.big { font-size: 14px; padding: 5px 12px; }
.p-mod { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.p-mod:first-of-type { border-top: 0; }
.p-mod form { margin: 0; }
.p-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 14px; }
.p-kv dt { color: var(--muted); font-size: 13px; } .p-kv dd { margin: 0; overflow-wrap: anywhere; }
.p-actions { display: flex; flex-direction: column; gap: 10px; }
.p-actions form, .p-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.p-notes { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.p-notes textarea, .p-notes input:not([type=checkbox]) { width: 100%; }
.p-notes label { width: 100%; }
.p-check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.p-plans td { vertical-align: top; }
.p-plans td:first-child input { width: 100%; margin-bottom: 4px; }
.p-price { display: inline-flex; align-items: center; gap: 4px; font-weight: 400; }
.p-price input { width: 100px; text-align: right; }
@media (max-width: 720px) { .p-accounts th:nth-child(n+5), .p-accounts td:nth-child(n+5) { display: none; } }
