:root {
  --bg: #0b0e14;
  --bg-elev: #121722;
  --bg-elev-2: #181f2e;
  --bg-hover: rgba(255, 255, 255, 0.035);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #edf2f7;
  --text-2: #b5c0d4;
  --muted: #7c8aa5;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.15);
  --cyan: #06b6d4;
  --purple: #a855f7;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #f8fafc;
  --bg-hover: rgba(15, 23, 42, 0.035);
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.12);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.12);
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sm-text { font-size: 12.5px; }
.xs-text { font-size: 11.5px; }
.text-green { color: var(--green); }
.text-blue { color: var(--accent); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }
.text-muted { color: var(--muted); }

/* Login */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 20%, rgba(59,130,246,0.14), transparent 45%),
              radial-gradient(circle at 80% 80%, rgba(168,85,247,0.12), transparent 45%),
              var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.4px; }
.login-brand p { margin: 2px 0 0; font-size: 12.5px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.sm { width: 34px; height: 34px; border-radius: 9px; }
.brand-mark.sm svg { width: 18px; height: 18px; }
.login-footer { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; font-size: 12px; }

/* Form controls */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.field input, .select-input, .search-box input, .log-search {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .select-input:focus, .search-box input:focus, .log-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input:disabled { opacity: 0.6; cursor: not-allowed; }
.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { width: 100%; padding-right: 54px; }
.icon-btn-inline {
  position: absolute; right: 8px; background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 12px; padding: 4px 6px; border-radius: 4px;
}
.icon-btn-inline:hover { color: var(--text); }
.checkbox-row { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.checkbox-row.sm { font-size: 12px; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error {
  background: var(--red-soft); color: var(--red); border: 1px solid rgba(239,68,68,0.28);
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12.5px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: all 0.15s; white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-full { width: 100%; padding: 10px 16px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
.btn-success { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,0.25); }
.btn-success:hover:not(:disabled) { background: rgba(34,197,94,0.24); }
.btn-warn { background: var(--amber-soft); color: var(--amber); border-color: rgba(245,158,11,0.25); }
.btn-warn:hover:not(:disabled) { background: rgba(245,158,11,0.25); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: rgba(239,68,68,0.25); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.26); }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.link-btn:hover { color: var(--red); }

/* Topbar */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand-inline { display: flex; align-items: center; gap: 11px; }
.brand-title-row { display: flex; align-items: center; gap: 8px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: 0.4px; }
.brand-sub { font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; font-weight: 500; }
.chip-subtle { background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-2); }

.live-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--bg-elev-2); border: 1px solid var(--border);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.live-badge.online .live-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2s infinite; }
.live-badge.offline .live-dot { background: var(--red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.user-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px;
  border-radius: 999px; background: var(--bg-elev-2); border: 1px solid var(--border); font-size: 12.5px;
}
.user-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.notice-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 22px; background: var(--amber-soft); border-bottom: 1px solid rgba(245,158,11,0.28);
  color: var(--text); font-size: 13px;
}
.notice-actions { display: flex; gap: 8px; }

/* Main content */
.main-content { max-width: 1460px; width: 100%; margin: 0 auto; padding: 18px 22px 42px; display: flex; flex-direction: column; gap: 18px; }

/* Telemetry Grid */
.telemetry-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; display: flex; flex-direction: column; gap: 10px;
}
.metric-head { display: flex; align-items: center; justify-content: space-between; }
.metric-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.metric-tag { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: var(--bg-elev-2); color: var(--text-2); font-family: var(--mono); }
.metric-value-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.metric-value { font-size: 25px; font-weight: 700; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.metric-sub { font-size: 12px; }
.metric-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; margin-top: auto; }
.sparkline-wrap { height: 32px; width: 100%; }
.sparkline-wrap svg { width: 100%; height: 100%; display: block; }

.segmented-bar {
  height: 10px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden;
  display: flex; width: 100%;
}
.seg { height: 100%; transition: width 0.4s ease; }
.seg-app { background: #3b82f6; }
.seg-wired { background: #f59e0b; }
.seg-comp { background: #a855f7; }

.progress-track { height: 10px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #06b6d4); transition: width 0.4s ease; }

.summary-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-box {
  background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; display: flex; align-items: baseline; justify-content: space-between;
  cursor: pointer; transition: border-color 0.15s;
}
.stat-box:hover { border-color: var(--accent); }
.stat-num { font-size: 19px; font-weight: 700; font-family: var(--mono); }
.stat-lbl { font-size: 11.5px; color: var(--muted); }

/* Panel Card & Tabs */
.panel-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tabs-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.tab-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tab-btn {
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 6px 11px; border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: inherit;
}
.tab-btn:hover { color: var(--text); background: var(--bg-hover); }
.tab-btn.active { color: var(--text); background: var(--bg-elev-2); border-color: var(--border-strong); }
.tab-cnt { font-size: 11px; font-family: var(--mono); padding: 1px 6px; border-radius: 999px; background: var(--bg-hover); color: var(--muted); }
.tab-btn.active .tab-cnt { background: var(--accent-soft); color: var(--accent); }

.toolbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-box input { width: 240px; padding: 7px 11px; font-size: 13px; }
.select-input { padding: 7px 10px; font-size: 12.5px; }
.select-input.sm { padding: 5px 8px; font-size: 12px; }

.lang-pills-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 9px 16px; border-bottom: 1px solid var(--border); background: var(--bg-elev-2);
}
.pill-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.pill-btn:hover { color: var(--text); border-color: var(--border-strong); }
.pill-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Services Table */
.table-wrap { width: 100%; overflow-x: auto; }
.svc-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.svc-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-elev);
}
.svc-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.svc-table tbody tr { transition: background 0.12s; }
.svc-table tbody tr:hover { background: var(--bg-hover); }
.svc-table tbody tr.row-selected { background: var(--accent-soft); }
.num-col { text-align: right !important; }
.center-col { text-align: center !important; }
.actions-col { text-align: right !important; white-space: nowrap; }
.empty-row { text-align: center; padding: 38px !important; color: var(--muted); }

.svc-name-cell { cursor: pointer; }
.svc-title-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.svc-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.svc-name:hover { color: var(--accent); }
.svc-label-sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); margin-top: 2px; max-width: 310px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-tag { font-size: 10.5px; padding: 1px 6px; border-radius: 5px; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--muted); }
.mini-tag.self { background: var(--accent-soft); color: var(--accent); border-color: rgba(59,130,246,0.3); }

/* Status badges */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.running { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status-dot.scheduled { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.status-dot.stopped { background: var(--muted); opacity: 0.6; }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; }
.status-pill.running { background: var(--green-soft); color: var(--green); }
.status-pill.scheduled { background: var(--accent-soft); color: var(--accent); }
.status-pill.stopped { background: var(--bg-elev-2); color: var(--muted); }
.status-pill.error { background: var(--red-soft); color: var(--red); }

/* Language badges */
.lang-badge {
  display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px; border: 1px solid transparent;
}
.lang-python { background: rgba(59, 130, 246, 0.14); color: #60a5fa; border-color: rgba(59,130,246,0.25); }
.lang-nodejs { background: rgba(34, 197, 94, 0.14); color: #4ade80; border-color: rgba(34,197,94,0.25); }
.lang-typescript { background: rgba(14, 165, 233, 0.14); color: #38bdf8; border-color: rgba(14,165,233,0.25); }
.lang-go { background: rgba(6, 182, 212, 0.14); color: #22d3ee; border-color: rgba(6,182,212,0.25); }
.lang-rust { background: rgba(249, 115, 22, 0.15); color: #fb923c; border-color: rgba(249,115,22,0.25); }
.lang-workers { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.lang-native { background: rgba(168, 85, 247, 0.15); color: #c084fc; border-color: rgba(168,85,247,0.25); }
.lang-shell { background: rgba(148, 163, 184, 0.14); color: #94a3b8; border-color: rgba(148,163,184,0.25); }
.lang-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Resource cells */
.res-cell { text-align: right; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.mini-bar { height: 4px; width: 64px; margin-left: auto; margin-top: 4px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden; }
.mini-bar > div { height: 100%; border-radius: 999px; background: var(--accent); }
.mini-bar.high > div { background: var(--amber); }
.mini-bar.crit > div { background: var(--red); }

/* Ports */
.ports-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 170px; }
.port-chip {
  font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 6px;
  text-decoration: none; border: 1px solid var(--border); color: var(--text-2); background: var(--bg-elev-2);
}
.port-chip.public { border-color: rgba(59,130,246,0.35); color: var(--accent); background: var(--accent-soft); }
.port-chip.public:hover { background: var(--accent); color: #fff; }

/* Autostart Switch */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer; background: var(--bg-elev-2);
  border: 1px solid var(--border-strong); border-radius: 999px; transition: 0.2s;
}
.slider:before {
  content: ""; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px;
  background: var(--muted); border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--green-soft); border-color: var(--green); }
.switch input:checked + .slider:before { transform: translateX(17px); background: var(--green); }
.switch input:disabled + .slider { opacity: 0.45; cursor: not-allowed; }

.row-actions { display: inline-flex; align-items: center; gap: 5px; justify-content: flex-end; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.52); z-index: 50; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 95vw);
  background: var(--bg-elev); border-left: 1px solid var(--border); z-index: 60;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.drawer-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.drawer-title-row h2 { margin: 0; font-size: 18px; }
.drawer-action-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--bg-elev-2);
}
.drawer-tabs { display: flex; gap: 6px; padding: 10px 20px 0; border-bottom: 1px solid var(--border); }
.dtab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 12px; color: var(--muted); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.dtab:hover { color: var(--text); }
.dtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }

.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.kv-item { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.kv-k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.kv-v { font-size: 13px; margin-top: 3px; word-break: break-all; }
.section-block { margin-top: 16px; }
.section-block h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.cmd-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--text-2);
}
.tree-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tree-table th, .tree-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.tree-table th { color: var(--muted); font-weight: 600; }
.policy-card {
  background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
}

/* Log viewer */
.log-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.seg-buttons { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg-btn { background: var(--bg-elev-2); border: none; color: var(--muted); padding: 5px 11px; font-size: 12px; cursor: pointer; font-family: inherit; }
.seg-btn.active { background: var(--accent); color: #fff; }
.log-search { flex: 1; min-width: 130px; padding: 5px 9px; font-size: 12px; }
.log-meta { margin-bottom: 8px; word-break: break-all; }
.code-viewer {
  background: #070a0f; color: #cbd5e1; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 11.8px; line-height: 1.55;
  overflow: auto; max-height: calc(100vh - 300px); white-space: pre-wrap; word-break: break-word; margin: 0;
}
.sm-viewer { max-height: 220px; }

/* Modals */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.58); z-index: 80;
  display: flex; align-items: center; justify-content: center; padding: 18px; backdrop-filter: blur(3px);
}
.modal-card {
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.modal-card.modal-lg { max-width: 660px; }
.modal-card.modal-sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-tabs { display: flex; gap: 6px; padding: 10px 18px 0; border-bottom: 1px solid var(--border); }
.mtab { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); font-size: 13px; cursor: pointer; font-family: inherit; }
.mtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 12px; }

.guide-block h4 { margin: 14px 0 6px; font-size: 13.5px; }
.guide-block ol, .guide-block ul { padding-left: 18px; margin: 6px 0; color: var(--text-2); }
.guide-block li { margin-bottom: 5px; }
.guide-block code { background: var(--bg-elev-2); padding: 1px 6px; border-radius: 5px; font-family: var(--mono); font-size: 12px; color: var(--accent); }
.guide-tip {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: var(--accent-soft); border: 1px solid rgba(59,130,246,0.28); font-size: 12.5px; color: var(--text-2);
}

/* Toasts */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elev); border: 1px solid var(--border-strong); color: var(--text);
  padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px;
  display: flex; align-items: center; gap: 8px; animation: slideIn 0.2s ease;
}
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 1120px) {
  .telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .telemetry-grid { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .main-content { padding: 12px 14px 32px; }
  .search-box input { width: 100%; }
  .grid-2, .kv-grid { grid-template-columns: 1fr; }
}
