/* SIM Gateway dashboard */

:root {
  --bg: #0b0f14;
  --bg-2: #111720;
  --panel: #151d28;
  --panel-2: #1b2532;
  --line: #243040;
  --line-soft: #1c2634;
  --text: #e6edf6;
  --text-dim: #9fb0c4;
  --text-mute: #6b7f96;
  --accent: #14b8a6;
  --accent-ink: #042f2e;
  --accent-soft: rgba(20, 184, 166, .14);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-2: #eef1f6;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --line: #dde3ec;
  --line-soft: #e8edf4;
  --text: #0f1a26;
  --text-dim: #4a5b6f;
  --text-mute: #7b8b9e;
  --accent: #0d9488;
  --accent-ink: #ffffff;
  --accent-soft: rgba(13, 148, 136, .1);
  --shadow: 0 1px 2px rgba(16,26,38,.06), 0 8px 24px -14px rgba(16,26,38,.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.small { font-size: 12px; }
.empty { color: var(--text-mute); padding: 22px 4px; text-align: center; margin: 0; }
code { font-family: var(--mono); font-size: .92em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- icons ---------- */
i[data-ico] { width: 17px; height: 17px; display: inline-block; flex: none; background: currentColor; }
i[data-ico="grid"]     { -webkit-mask: var(--m-grid) center/contain no-repeat; mask: var(--m-grid) center/contain no-repeat; }
i[data-ico="send"]     { -webkit-mask: var(--m-send) center/contain no-repeat; mask: var(--m-send) center/contain no-repeat; }
i[data-ico="megaphone"]{ -webkit-mask: var(--m-mega) center/contain no-repeat; mask: var(--m-mega) center/contain no-repeat; }
i[data-ico="inbox"]    { -webkit-mask: var(--m-inbox) center/contain no-repeat; mask: var(--m-inbox) center/contain no-repeat; }
i[data-ico="phone"]    { -webkit-mask: var(--m-phone) center/contain no-repeat; mask: var(--m-phone) center/contain no-repeat; }
i[data-ico="shield"]   { -webkit-mask: var(--m-shield) center/contain no-repeat; mask: var(--m-shield) center/contain no-repeat; }
i[data-ico="terminal"] { -webkit-mask: var(--m-term) center/contain no-repeat; mask: var(--m-term) center/contain no-repeat; }
i[data-ico="cog"]      { -webkit-mask: var(--m-cog) center/contain no-repeat; mask: var(--m-cog) center/contain no-repeat; }
i[data-ico="menu"]     { -webkit-mask: var(--m-menu) center/contain no-repeat; mask: var(--m-menu) center/contain no-repeat; }
i[data-ico="moon"]     { -webkit-mask: var(--m-moon) center/contain no-repeat; mask: var(--m-moon) center/contain no-repeat; }

:root {
  --m-grid:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  --m-send:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m22 2-7 20-4-9-9-4Z'/%3E%3Cpath d='M22 2 11 13'/%3E%3C/svg%3E");
  --m-mega:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 11 18-5v12L3 13Z'/%3E%3Cpath d='M11.6 16.8a3 3 0 1 1-5.8-1.6'/%3E%3C/svg%3E");
  --m-inbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1z'/%3E%3C/svg%3E");
  --m-phone: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.2a2 2 0 0 1 2.1-.5c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2z'/%3E%3C/svg%3E");
  --m-shield:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 13c0 5-3.5 7.5-7.7 9a1 1 0 0 1-.6 0C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.2-2.7a1 1 0 0 1 1.5 0C14.5 3.8 17 5 19 5a1 1 0 0 1 1 1z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
  --m-term:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 17 6-6-6-6'/%3E%3Cpath d='M12 19h8'/%3E%3C/svg%3E");
  --m-cog:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1A1.7 1.7 0 0 0 9 19.4a1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1A1.7 1.7 0 0 0 4.6 9a1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E");
  --m-menu:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18'/%3E%3C/svg%3E");
  --m-moon:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E");
}

/* ---------- login ---------- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 15px;
}
.login-error { color: var(--danger); min-height: 18px; margin: 0; font-size: 13px; text-align: center; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 15px; margin: 0; letter-spacing: -.01em; font-weight: 650; }
.brand p { margin: 0; font-size: 11.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #000));
  color: var(--accent-ink);
  font-weight: 800; font-size: 11px; letter-spacing: .04em;
}
.brand-lg { margin-bottom: 6px; }
.brand-lg h1 { font-size: 19px; }
.brand-lg p { font-size: 13px; max-width: none; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh;
}

.nav { display: grid; gap: 2px; flex: 1; align-content: start; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim);
  font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.badge {
  margin-left: auto;
  background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
}

.sidebar-foot { display: grid; gap: 10px; }
.device-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 11px;
}
.device-chip-text { min-width: 0; }
.device-chip strong { display: block; font-size: 12.5px; text-transform: capitalize; }
.device-chip small { display: block; font-size: 11px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-mute); flex: none; }
.dot.on  { background: var(--ok);     box-shadow: 0 0 0 3px rgba(52,211,153,.18); }
.dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(248,113,113,.18); }
.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions .btn { flex: 1; justify-content: center; }
.sidebar-actions .btn:first-child { flex: none; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px; height: 58px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; margin: 0; font-weight: 650; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.menu-btn { display: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mute); }
.live-dot.on { background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.view { display: none; padding: 22px 24px 60px; gap: 16px; flex-direction: column; }
.view.is-active { display: flex; }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 13.5px; margin: 0; font-weight: 650; letter-spacing: -.005em; }
.card-head .btn { margin-left: auto; }
.chip-row { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px;
  display: grid; gap: 3px; align-content: start;
}
.stat-label { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 680; letter-spacing: -.02em; line-height: 1.15; }
.stat-value.sm { font-size: 16px; font-weight: 620; }
.stat-sub { font-size: 11.5px; color: var(--text-mute); }

.bars { display: flex; gap: 3px; align-items: flex-end; height: 18px; margin-top: 4px; }
.bars i { width: 5px; background: var(--line); border-radius: 1.5px; display: block; }
.bars i:nth-child(1) { height: 30%; } .bars i:nth-child(2) { height: 46%; }
.bars i:nth-child(3) { height: 62%; } .bars i:nth-child(4) { height: 80%; }
.bars i:nth-child(5) { height: 100%; }
.bars i.lit { background: var(--accent); }
.bars.weak i.lit { background: var(--warn); }

/* ---------- chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.chart .col {
  flex: 1; height: 100%;
  display: flex; align-items: flex-end;
  background: var(--line-soft); border-radius: 3px;
  transition: background .12s;
}
.chart .col > span { width: 100%; min-height: 2px; background: var(--accent); border-radius: 3px; display: block; }
.chart .col:hover { background: var(--line); }
.legend { margin-left: auto; display: flex; gap: 14px; font-size: 11.5px; color: var(--text-dim); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend b { width: 8px; height: 8px; border-radius: 2px; display: block; }
.legend em { font-style: normal; font-weight: 650; color: var(--text); }
.k-sent { background: var(--accent); } .k-failed { background: var(--danger); } .k-in { background: var(--info); }

/* ---------- forms ---------- */
.form { display: grid; gap: 13px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.hint { font-size: 11.5px; color: var(--text-mute); margin: 0; }

input, textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  resize: vertical;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-mute); }
textarea { font-family: var(--sans); line-height: 1.55; }

.seg-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg-row .btn, .seg-row .btn-row { margin-left: auto; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 620; }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn-ghost { background: var(--panel-2); border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--text-mute); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px -17px; padding: 0 18px 17px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--panel-2); }
.table .num { font-variant-numeric: tabular-nums; color: var(--text-mute); white-space: nowrap; font-size: 12px; }
.table .peer { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.table .body { color: var(--text-dim); max-width: 380px; overflow-wrap: anywhere; }

/* ---------- pills ---------- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 640; text-transform: capitalize; white-space: nowrap;
  border: 1px solid transparent;
}
.pill-sent, .pill-delivered, .pill-done, .pill-completed, .pill-received
  { background: rgba(52,211,153,.13); color: var(--ok); border-color: rgba(52,211,153,.25); }
.pill-queued, .pill-sending, .pill-draft, .pill-dialing, .pill-ringing, .pill-claimed
  { background: rgba(251,191,36,.13); color: var(--warn); border-color: rgba(251,191,36,.25); }
.pill-failed, .pill-cancelled, .pill-error
  { background: rgba(248,113,113,.13); color: var(--danger); border-color: rgba(248,113,113,.25); }
.pill-running { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.pill-paused  { background: rgba(96,165,250,.13); color: var(--info); border-color: rgba(96,165,250,.25); }

/* ---------- activity log ---------- */
.log { max-height: 300px; overflow-y: auto; margin: 0 -6px; }
.log-row { display: flex; gap: 10px; padding: 6px 6px; border-radius: 6px; font-size: 12.5px; align-items: baseline; }
.log-row:hover { background: var(--panel-2); }
.log-row time { color: var(--text-mute); font-variant-numeric: tabular-nums; font-size: 11.5px; flex: none; }
.log-row .src { color: var(--text-mute); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; flex: none; min-width: 52px; }
.log-row.warn .src  { color: var(--warn); }
.log-row.error .src { color: var(--danger); }
.log-row p { margin: 0; color: var(--text-dim); overflow-wrap: anywhere; }

/* ---------- campaigns ---------- */
.camp {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 15px; margin-bottom: 10px; background: var(--panel-2);
}
.camp:last-child { margin-bottom: 0; }
.camp-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.camp-top h4 { margin: 0; font-size: 13.5px; font-weight: 650; }
.camp-top .btn-row { margin-left: auto; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 7px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.camp-meta { display: flex; gap: 16px; font-size: 11.5px; color: var(--text-mute); flex-wrap: wrap; }
.camp-meta b { color: var(--text-dim); font-weight: 650; }

/* ---------- inbox ---------- */
.msg {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px; background: var(--panel-2);
}
.msg:last-child { margin-bottom: 0; }
.msg.unread { border-left: 3px solid var(--accent); }
.msg-top { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.msg-top strong { font-family: var(--mono); font-size: 13px; }
.msg-top time { margin-left: auto; color: var(--text-mute); font-size: 11.5px; }
.msg p { margin: 0; color: var(--text-dim); overflow-wrap: anywhere; font-size: 13px; }

/* ---------- console ---------- */
.console {
  background: #05080c; color: #c7d6e6;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; margin: 0 0 11px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  height: 340px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}
[data-theme="light"] .console { background: #0b1220; }
.console .cmd { color: var(--accent); }
.console .err { color: var(--danger); }
.console-form { display: flex; gap: 8px; }
.console-form input { font-family: var(--mono); }

/* ---------- key/value ---------- */
.kv { display: grid; gap: 0; }
.kv-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row span { color: var(--text-mute); flex: none; width: 116px; font-size: 12.5px; }
.kv-row b { font-weight: 550; overflow-wrap: anywhere; }

/* ---------- docs ---------- */
.docs { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.docs summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.docs summary:hover { color: var(--text); }
.docs-body { margin-top: 12px; }
.docs-body pre {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px;
  font-family: var(--mono); font-size: 12px; overflow-x: auto; margin: 6px 0 16px;
  line-height: 1.6;
}
.docs-body h4 { margin: 16px 0 4px; font-size: 12.5px; }
.docs-body h4:first-child { margin-top: 0; }
.docs-body p { margin: 0 0 6px; color: var(--text-dim); font-size: 12.5px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 14px;
  box-shadow: var(--shadow); font-size: 13px;
  animation: slide .2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.warn  { border-left-color: var(--warn); }
@keyframes slide { from { opacity: 0; transform: translateX(14px); } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 200; padding: 20px; }
.modal-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  width: min(460px, 100%); box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 10px; font-size: 15px; }
.modal-card p { margin: 0 0 14px; color: var(--text-dim); font-size: 13px; }
.secret {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px;
  overflow-wrap: anywhere; margin-bottom: 14px; user-select: all;
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 236px; z-index: 60;
    transform: translateX(-100%); transition: transform .2s;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
  .menu-btn { display: inline-flex; }
  .view { padding: 16px; }
  .topbar { padding: 0 16px; }
  .row { grid-template-columns: 1fr; }
  .table-wrap { margin: 0 -18px -17px; }
}
