/* ============ TOKENS ============ */
:root {
  --bg: #f4f6f9;
  --bg-glow: radial-gradient(1200px 500px at 70% -10%, rgba(20,184,166,.10), transparent 60%), radial-gradient(900px 400px at 0% 0%, rgba(99,102,241,.07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --surface-3: #e8edf3;
  --elev: #ffffff;
  --border: #e3e8ef;
  --border-strong: #cfd7e2;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --accent: #0d9488;
  --accent-2: #14b8a6;
  --accent-soft: rgba(13,148,136,.10);
  --accent-ink: #ffffff;
  --ok: #16a34a;     --ok-bg: rgba(22,163,74,.10);
  --warn: #d97706;   --warn-bg: rgba(217,119,6,.11);
  --crit: #dc2626;   --crit-bg: rgba(220,38,38,.09);
  --pending: #64748b; --pending-bg: rgba(100,116,139,.10);
  --c1: #0891b2; --c2: #7c3aed; --c3: #db2777; --c4: #16a34a; --c5: #2563eb; --c6: #ca8a04; --c7: #ea580c;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --shadow-lg: 0 12px 40px rgba(15,23,42,.14);
  --code-bg: #0f172a; --code-text: #d5f5ef;
  --radius: 8px;
  --side-w: 248px;
  color-scheme: light;
  font-family: "Inter", "Noto Sans Thai", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
}
:root[data-theme="dark"] {
  --bg: #0b0e13;
  --bg-glow: radial-gradient(1200px 500px at 70% -10%, rgba(45,212,191,.08), transparent 60%), radial-gradient(900px 400px at 0% 0%, rgba(129,140,248,.07), transparent 60%);
  --surface: #12161d;
  --surface-2: #181d26;
  --surface-3: #202632;
  --elev: #1a1f29;
  --border: #232a36;
  --border-strong: #313a49;
  --text: #e8edf4;
  --text-2: #b4bfcd;
  --muted: #8592a4;
  --accent: #2dd4bf;
  --accent-2: #5eead4;
  --accent-soft: rgba(45,212,191,.12);
  --accent-ink: #042f2b;
  --ok: #4ade80;     --ok-bg: rgba(74,222,128,.12);
  --warn: #fbbf24;   --warn-bg: rgba(251,191,36,.12);
  --crit: #f87171;   --crit-bg: rgba(248,113,113,.13);
  --pending: #94a3b8; --pending-bg: rgba(148,163,184,.12);
  --c1: #38bdf8; --c2: #a78bfa; --c3: #f472b6; --c4: #4ade80; --c5: #60a5fa; --c6: #facc15; --c7: #fb923c;
  --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
  --code-bg: #07090d; --code-text: #c9f4ec;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); background-image: var(--bg-glow); background-attachment: fixed; color: var(--text); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; transition: background-color .25s, color .25s; }
a { color: inherit; text-decoration: none; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
::selection { background: var(--accent-soft); }

/* ============ SHELL: SIDEBAR ============ */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px); border-right: 1px solid var(--border); z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 18px; font-weight: 700; letter-spacing: -.01em; font-size: 15.5px; }
.brand-dot { width: 34px; height: 34px; border-radius: 6px; background: linear-gradient(135deg, var(--accent-2), #6366f1); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 18px rgba(20,184,166,.35); }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 5px; color: var(--text-2); font-weight: 500; transition: background .15s, color .15s; white-space: nowrap; }
.nav a svg { opacity: .8; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a.active svg { opacity: 1; }
.nav .badge { margin-left: auto; background: var(--crit); color: #fff; font-size: 11px; border-radius: 6px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.sys-card { padding: 12px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.sys-card .row { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: ping 2s infinite; flex: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 8px transparent; } }
.theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px; }
.theme-seg button { border: 0; background: none; color: var(--muted); padding: 7px 0; border-radius: 4px; cursor: pointer; display: grid; place-items: center; font: inherit; font-size: 11.5px; gap: 2px; }
.theme-seg button:hover { color: var(--text); }
.theme-seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.mock-flag { font-size: 11.5px; color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 4px; text-align: center; font-weight: 500; }

.page { margin-left: var(--side-w); padding: 34px 40px 72px; max-width: calc(1360px + var(--side-w)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: inline-flex; gap: 6px; align-items: center; }
.crumb:hover { color: var(--accent); }
h1 { font-size: 30px; margin: 0; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
h2 { font-size: 16.5px; margin: 0 0 14px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 14.5px; margin: 0; font-weight: 600; }
.sub-head { color: var(--muted); font-size: 13.5px; margin-top: 6px; }

@media (max-width: 960px) {
  .side { position: sticky; top: 0; width: auto; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0; } .brand small, .brand .t, .nav-label, .sys-card, .mock-flag { display: none; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1; }
  .nav a { padding: 8px 11px; } .nav a span.lbl { display: inline; }
  .side-foot { margin: 0; }
  .theme-seg button span { display: none; } .theme-seg button { padding: 6px 9px; }
  .page { margin-left: 0; padding: 24px 20px 56px; }
}
@media (max-width: 560px) { .nav a span.lbl { display: none; } .page { padding: 20px 16px 48px; } h1 { font-size: 24px; } }

/* ============ SURFACES ============ */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 22px; }
.section { margin-top: 28px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .g4 { grid-template-columns: minmax(0, 1fr); } }

/* ============ CONTROLS ============ */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 6px; padding: 9px 16px; border: 1px solid var(--border-strong); color: var(--text); background: var(--surface); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover { filter: brightness(1.06); color: var(--accent-ink); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 4px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .6; cursor: wait; }
.input, select.input, textarea.input { width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 5px; padding: 9px 12px; font: inherit; transition: .15s; }
.input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 38px; background: var(--surface); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 500; padding: 6px 13px; border-radius: 4px; cursor: pointer; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; transition: .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .cnt { font-size: 11px; background: var(--surface-3); border-radius: 6px; padding: 0 6px; color: var(--muted); }
label.field { display: block; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }

/* ============ STATUS ============ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.crit { color: var(--crit); background: var(--crit-bg); }
.pill.pending { color: var(--pending); background: var(--pending-bg); }
.pill.nodot::before { display: none; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; white-space: nowrap; border: 1px solid var(--border); }
.tag.host { color: var(--accent); background: var(--accent-soft); border-color: transparent; font-weight: 550; }
.copy { cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: color .15s; }
.copy svg { opacity: .55; }
.copy:hover { color: var(--accent); } .copy:hover svg { opacity: 1; }

/* ============ KPI TILES ============ */
.tile { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.tile .ic { width: 42px; height: 42px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.tile .l { color: var(--muted); font-size: 12.5px; font-weight: 500; }

/* ============ SERVER CARDS ============ */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
@media (max-width: 560px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.scard { padding: 18px; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s, border-color .18s; position: relative; overflow: hidden; }
.scard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.scard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--st, transparent); }
.scard.warn { --st: var(--warn); } .scard.crit { --st: var(--crit); } .scard.pending { --st: var(--pending); }
.scard.pending { border-style: dashed; box-shadow: none; }
.scard-head { display: flex; gap: 12px; align-items: center; }
.drop { width: 40px; height: 40px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--accent); flex: none; position: relative; }
.drop i { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--surface); }
.scard .name { font-weight: 650; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.scard .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.scard .meta > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding: 14px 8px; border-radius: 6px; background: var(--surface-2); }
.gauge { display: grid; justify-items: center; gap: 4px; }
.gauge svg { display: block; }
.gauge .gl { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.spark-wrap { margin-top: 14px; }
.spark-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.spark { display: block; height: 44px; }
.scard-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.scard-foot .tags { display: flex; gap: 5px; }
.issue { margin-top: 14px; font-size: 13px; padding: 9px 12px; border-radius: 5px; background: var(--warn-bg); color: var(--warn); font-weight: 500; display: flex; gap: 8px; align-items: center; }
.issue.crit { background: var(--crit-bg); color: var(--crit); }
.issue.pending { background: var(--pending-bg); color: var(--pending); }
.pending-body { margin-top: 16px; padding: 22px 14px; border-radius: 6px; background: var(--surface-2); text-align: center; color: var(--muted); font-size: 13px; display: grid; gap: 10px; justify-items: center; }

.bar { height: 7px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.bar > div { height: 100%; border-radius: 2px; transition: width .4s; }

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 780px; }
table.t th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; letter-spacing: .03em; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
table.t th:first-child { border-top-left-radius: var(--radius); } table.t th:last-child { border-top-right-radius: var(--radius); }
table.t td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--surface-2); }
.mini-bar { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.mini-bar .bar { flex: 1; height: 6px; }

/* ============ METRIC CARDS / CHARTS ============ */
.mcard { padding: 18px 20px; display: flex; gap: 16px; align-items: center; }
.mcard .k { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.mcard .big { font-size: 24px; font-weight: 700; margin: 2px 0; letter-spacing: -.02em; }
.mcard .sub { color: var(--muted); font-size: 12.5px; }
.mcard .ic { width: 44px; height: 44px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.chart-card { padding: 18px 18px 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend b { color: var(--text); font-weight: 550; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.chart .tip { position: absolute; pointer-events: none; background: var(--elev); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font-size: 12px; white-space: nowrap; display: none; z-index: 5; box-shadow: var(--shadow-lg); min-width: 150px; }
.chart .tip .r { display: flex; gap: 14px; justify-content: space-between; margin-top: 3px; }
.chart .tip .r b { font-weight: 600; }

/* ============ ALERTS ============ */
.lvl { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 4px; white-space: nowrap; }
.lvl.warn { color: var(--warn); background: var(--warn-bg); }
.lvl.crit { color: var(--crit); background: var(--crit-bg); }
.lvl.ok { color: var(--ok); background: var(--ok-bg); }
.ch { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ch span { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); color: var(--muted); opacity: .5; }
.ch span.sent { opacity: 1; color: var(--text-2); }
.ch span.sent::before { content: "✓ "; color: var(--ok); }
.ch span.fail { opacity: 1; color: var(--crit); background: var(--crit-bg); }
.ch span.fail::before { content: "✕ "; }
.active-list { display: grid; gap: 10px; }
.active-alert { display: flex; gap: 14px; align-items: center; padding: 14px 18px; flex-wrap: wrap; border-left: 3px solid var(--warn); }
.active-alert.crit { border-left-color: var(--crit); }
.active-alert .ic { width: 36px; height: 36px; border-radius: 5px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); flex: none; }
.active-alert.crit .ic { background: var(--crit-bg); color: var(--crit); }

/* ============ SETTINGS ============ */
.side-tabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 24px; }
.side-tabs a { padding: 9px 14px; border-radius: 5px; color: var(--muted); font-weight: 500; }
.side-tabs a:hover { background: var(--surface); color: var(--text); }
.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 1100px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } .side-tabs { position: static; flex-direction: row; overflow-x: auto; } .side-tabs a { white-space: nowrap; } }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.codebox { background: var(--code-bg); border-radius: 6px; padding: 14px 16px; font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--code-text); overflow-x: auto; white-space: pre; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.ch-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ch-icon { width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.th-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.th-row:last-child { border-bottom: 0; }
.th-row .input { padding: 6px 10px; }
@media (max-width: 640px) { .th-row { grid-template-columns: 1fr 1fr 1fr; } .th-row > :first-child { grid-column: 1 / -1; } }

/* message previews (คงสีของแต่ละแอปไว้ทั้งสองธีม) */
.preview-wrap { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1180px) { .preview-wrap { grid-template-columns: minmax(0, 1fr); } }
.phone { background: #8cabd9; border-radius: 8px; padding: 16px; min-height: 260px; }
.phone.tg { background: #0e1621; }
.line-bubble { background: #fff; color: #111; border-radius: 8px; overflow: hidden; max-width: 290px; font-size: 13px; }
.line-bubble .hd { background: #dc2626; color: #fff; padding: 10px 14px; font-weight: 600; }
.line-bubble .bd { padding: 12px 14px; display: grid; gap: 6px; }
.line-bubble .row { display: flex; justify-content: space-between; gap: 10px; }
.line-bubble .row span:first-child { color: #777; }
.line-bubble .ft { border-top: 1px solid #eee; padding: 10px; text-align: center; color: #2f7de1; font-weight: 600; }
.tg-msg { background: #182533; color: #e8eef3; border-radius: 6px; padding: 10px 12px; max-width: 300px; font-size: 13px; line-height: 1.55; }
.tg-msg a { color: #6ab3f3; }
.mail { background: #fff; color: #222; border-radius: 7px; font-size: 13px; overflow: hidden; border: 1px solid var(--border); }
.mail .mh { padding: 10px 14px; border-bottom: 1px solid #eee; color: #555; }
.mail .mh b { color: #111; }
.mail .mb { padding: 14px; }
.mail table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.mail td { border: 1px solid #eee; padding: 5px 8px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--elev); border: 1px solid var(--border); box-shadow: var(--shadow-lg); color: var(--text); padding: 11px 18px; border-radius: 6px; opacity: 0; transition: .2s; z-index: 50; pointer-events: none; max-width: calc(100% - 32px); font-weight: 500; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { padding: 44px; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ============ MOBILE GUARDS ============ */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; }
.page { min-width: 0; overflow-x: clip; }
@media (max-width: 560px) {
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar #view { margin-left: 0 !important; }
  .active-alert { padding: 12px 14px; gap: 10px; }
  .mcard .big { font-size: 20px; }
}
@media (max-width: 480px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .tile .ic { width: 34px; height: 34px; border-radius: 5px; }
  .tile .n { font-size: 20px !important; }
}

/* ============ SPECS / SITES ============ */
.specs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.spec { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); white-space: nowrap; }
.spec svg { color: var(--muted); }
.spec b { font-weight: 650; color: var(--text); }
.site-mini { margin-top: 14px; display: grid; gap: 6px; }
.site-mini .hd { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.site-mini .it { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.site-mini .it .d { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.site-mini .it .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-mini .it .st { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.res { display: grid; gap: 4px; min-width: 150px; }
.res .top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.res .top b { font-weight: 600; }
.res .sub { font-size: 11.5px; color: var(--muted); }
.spec-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.spec-grid > div { background: var(--surface); padding: 14px 16px; }
.spec-grid .k { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.spec-grid .v { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.spec-grid .s { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stype { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.http { font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 600; }
a.dom { color: var(--accent); display: inline-flex; gap: 4px; align-items: center; }
a.dom:hover { text-decoration: underline; }

.nav-logout { font-size: 12.5px; color: var(--muted); text-align: center; padding: 4px; }
.nav-logout:hover { color: var(--crit); }
@media (max-width: 960px) { .nav-logout { display: none; } }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
