:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --crit: #dc2626;
  --crit-bg: #fef2f2;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --off: #94a3b8;
  --off-bg: #f1f5f9;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #0f172a;
    --border: #1f2a40;
    --text: #e2e8f0;
    --muted: #8b9ab3;
    --accent: #60a5fa;
    --crit: #f87171;
    --crit-bg: rgba(248, 113, 113, .12);
    --warn: #fbbf24;
    --warn-bg: rgba(251, 191, 36, .12);
    --ok: #4ade80;
    --ok-bg: rgba(74, 222, 128, .1);
    --off: #64748b;
    --off-bg: rgba(100, 116, 139, .15);
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Noto Sans Georgian", "Segoe UI", system-ui, -apple-system, sans-serif;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
button { font: inherit; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 36px; height: 36px; flex: none; }
.brand svg rect { fill: var(--accent); }
.brand svg path { stroke: #fff; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand h1 { font-size: 18px; line-height: 1.2; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.updated { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.updated::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.updated.stale::before { background: var(--crit); }

main { max-width: 1400px; margin: 0 auto; padding: 20px 24px 48px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; text-align: left; color: inherit;
}
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat.crit .value { color: var(--crit); }
.stat.warn .value { color: var(--warn); }
.stat.ok .value { color: var(--ok); }
.stat.off .value { color: var(--off); }
.stat.zero .value { color: var(--muted); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] {
  flex: 1; min-width: 220px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; outline: none;
}
.toolbar input[type=search]:focus { border-color: var(--accent); }
.toggle { display: flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; user-select: none; }

/* ---------- panels ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 15px; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty.good { color: var(--ok); }

/* ---------- alerts ---------- */
.alert {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 0 14px; align-items: center;
  padding: 12px 18px 12px 0; border-bottom: 1px solid var(--border);
}
.alert:last-child { border-bottom: 0; }
.alert .bar { align-self: stretch; border-radius: 0 3px 3px 0; }
.alert.critical .bar { background: var(--crit); }
.alert.warning .bar { background: var(--warn); }
.alert.acked { opacity: .55; }
.alert .main { min-width: 0; }
.alert .line1 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert .host { font-weight: 600; cursor: pointer; color: var(--accent); }
.alert .host:hover { text-decoration: underline; }
.alert .title { font-weight: 500; }
.alert .detail { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert .meta { font-size: 12px; color: var(--muted); }
.alert .actions { display: flex; gap: 6px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; white-space: nowrap;
}
.pill.critical { background: var(--crit-bg); color: var(--crit); }
.pill.warning { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--off-bg); color: var(--off); }
.pill.cat { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); font-weight: 500; }

.btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger:hover { border-color: var(--crit); color: var(--crit); }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- "რა ვქნა?" ---------- */
.hint { margin-top: 6px; }
.hint summary {
  display: inline-block; cursor: pointer; font-size: 12px; font-weight: 500; color: var(--accent);
  list-style: none; user-select: none;
}
.hint summary::-webkit-details-marker { display: none; }
.hint summary::before { content: "▸ "; }
.hint[open] summary::before { content: "▾ "; }
.hint-body {
  margin-top: 8px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 13px; max-width: 900px;
}
.hint-body p { margin: 0 0 10px; }
.hint-body ol { margin: 0 0 10px; padding-left: 20px; }
.hint-body li { margin-bottom: 3px; }
.hint-sec { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.hint-full {
  font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word;
  color: var(--muted); margin-bottom: 10px; max-height: 240px; overflow-y: auto;
}
.hint-body .btn { display: inline-block; text-decoration: none; }

/* ---------- history charts ---------- */
.range { display: flex; gap: 6px; margin-bottom: 10px; }
.range .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; transition: opacity .15s; }
.chart { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 6px; background: var(--surface); }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); }
.chart-head b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: none; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.chart-svg .threshold { stroke: var(--warn); stroke-width: 1; opacity: .7; }
.chart-svg .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-svg .area { fill: var(--accent); opacity: .1; }
.chart-svg .dot { fill: var(--accent); }
.chart-svg .ring { stroke: var(--surface); stroke-width: 2; }
.chart-svg .cross { stroke: var(--muted); stroke-width: 1; }
.chart-tip {
  position: absolute; top: 28px; transform: translateX(-50%); pointer-events: none; white-space: nowrap;
  background: var(--text); color: var(--surface); border-radius: 8px; padding: 4px 8px; font-size: 11px;
  display: flex; gap: 6px; align-items: baseline;
}
.chart-tip[hidden] { display: none; }
.chart-tip b { font-size: 13px; }

/* ---------- host cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 16px; }
.card {
  border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: 10px;
  padding: 12px 14px; background: var(--surface-2); cursor: pointer; text-align: left; color: inherit;
  transition: border-color .15s, transform .15s;
}
.card:hover { transform: translateY(-1px); border-color: var(--accent); }
.card.critical { border-left-color: var(--crit); }
.card.warning { border-left-color: var(--warn); }
.card.offline { border-left-color: var(--off); opacity: .75; }
.card .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { font-size: 12px; color: var(--muted); margin: 2px 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.metric { font-size: 11px; color: var(--muted); }
.metric b { display: block; font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
.metric b.crit { color: var(--crit); }
.metric b.warn { color: var(--warn); }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 9; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--surface);
  border-left: 1px solid var(--border); z-index: 10; transform: translateX(100%); transition: transform .2s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 18px; }
.drawer-head p { margin: 2px 0 0; font-size: 13px; }
.drawer-body { overflow-y: auto; padding: 16px 20px 32px; }
.drawer-body h3 { font-size: 13px; letter-spacing: .02em; color: var(--muted); margin: 22px 0 8px; }
.drawer-body h3:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; }
.kv div { font-size: 12px; color: var(--muted); }
.kv b { display: block; font-size: 14px; color: var(--text); font-weight: 500; word-break: break-word; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.msg { color: var(--muted); word-break: break-word; }
.bar-track { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; min-width: 80px; margin-top: 4px; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.crit { background: var(--crit); }
.drawer-foot { margin-top: 28px; display: flex; justify-content: flex-end; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .top, main { padding-left: 16px; padding-right: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .alert { grid-template-columns: 4px 1fr; }
  .alert .actions { grid-column: 2; margin-top: 8px; }
  .drawer-body { padding: 14px 16px 28px; }
  .charts { grid-template-columns: 1fr; }
  .table-wrap { overflow-x: auto; }
}

/* ================= ნავიგაცია (ყველა შიდა გვერდი) ================= */
.brand { color: inherit; text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav button {
  font: inherit; font-size: 13px; color: var(--muted); text-decoration: none; background: none; border: 0;
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { color: var(--accent); background: var(--surface-2); font-weight: 500; }
.nav .org { font-size: 13px; color: var(--text); font-weight: 500; padding: 6px 10px; border-right: 1px solid var(--border); margin-right: 4px; }
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* ================= ფორმები ================= */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; }
.field .hint-text { font-size: 12px; color: var(--muted); }
.input, .field input, .field select {
  font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); outline: none; width: 100%;
}
.field input:focus, .field select:focus, .input:focus { border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 14px; cursor: pointer; }
.btn-primary {
  font: inherit; font-weight: 500; border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer;
  background: var(--accent); color: #fff; text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost {
  font: inherit; font-weight: 500; border: 1px solid var(--border); border-radius: 10px; padding: 9px 16px; cursor: pointer;
  background: var(--surface); color: var(--text); text-decoration: none; display: inline-block;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.msg { font-size: 13px; padding: 9px 12px; border-radius: 10px; margin-bottom: 14px; }
.msg.error { background: var(--crit-bg); color: var(--crit); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg[hidden] { display: none; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ================= შესვლა / რეგისტრაცია ================= */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 22px; }
.auth-card h2 { font-size: 20px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.auth-card .btn-primary { width: 100%; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-foot a { color: var(--accent); }

/* ================= პარამეტრები / ადმინი ================= */
.page { max-width: 980px; margin: 0 auto; padding: 24px 24px 64px; }
.page > h1 { font-size: 22px; margin-bottom: 18px; }
.section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; }
.section > h2 { font-size: 16px; margin-bottom: 4px; }
.section > .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.section ol.steps { margin: 0 0 16px; padding-left: 20px; font-size: 14px; }
.section ol.steps li { margin-bottom: 6px; }
.code {
  font: 12px/1.6 ui-monospace, Consolas, monospace; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; word-break: break-all; white-space: pre-wrap; margin-bottom: 10px;
}
.usage { font-size: 13px; color: var(--muted); }
.usage b { color: var(--text); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.table-scroll { overflow-x: auto; }
.table-scroll table td, .table-scroll table th { white-space: nowrap; }
.input-sm { font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 80px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

/* ================= მთავარი (landing) ================= */
.lp-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; max-width: 1180px; margin: 0 auto; }
.lp-hero { max-width: 1180px; margin: 0 auto; padding: 48px 24px 32px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.lp-hero h1 { font-size: 42px; line-height: 1.15; letter-spacing: -.01em; margin-bottom: 18px; }
.lp-hero h1 em { font-style: normal; color: var(--accent); }
.lp-hero p { font-size: 17px; color: var(--muted); margin: 0 0 28px; max-width: 540px; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-shot { border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 20px 50px rgba(15, 23, 42, .15); width: 100%; height: auto; display: block; background: var(--surface); }
.lp-section { max-width: 1180px; margin: 0 auto; padding: 48px 24px; }
.lp-section > h2 { font-size: 28px; margin-bottom: 8px; text-align: center; }
.lp-section > .sub { text-align: center; color: var(--muted); margin: 0 auto 32px; max-width: 640px; }
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-feature { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.lp-feature .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 12px; }
.lp-feature .ic svg { width: 22px; height: 22px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lp-feature h3 { font-size: 16px; margin-bottom: 6px; }
.lp-feature p { margin: 0; color: var(--muted); font-size: 14px; }
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
.lp-step { padding: 20px; border-radius: 14px; border: 1px dashed var(--border); }
.lp-step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; margin-bottom: 12px; }
.lp-step h3 { font-size: 16px; margin-bottom: 6px; }
.lp-step p { margin: 0; color: var(--muted); font-size: 14px; }
.lp-trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-trust div { font-size: 14px; color: var(--muted); }
.lp-trust b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.lp-final { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 40px 24px; }
.lp-final h2 { font-size: 24px; margin-bottom: 8px; }
.lp-final p { color: var(--muted); margin: 0 0 22px; }
.lp-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

@media (max-width: 900px) {
  .lp-hero { grid-template-columns: 1fr; gap: 32px; padding-top: 24px; }
  .lp-hero h1 { font-size: 32px; }
  .lp-features, .lp-steps, .lp-trust { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .lp-features, .lp-steps, .lp-trust, .form-grid { grid-template-columns: 1fr; }
  .lp-top, .lp-section, .lp-hero, .page { padding-left: 16px; padding-right: 16px; }
  .top { flex-wrap: wrap; }
}
