/* IP Toolkit – neutral, single-accent theme */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --hover: #f4f5f7;
  --border: #e3e6ea;
  --border-strong: #d3d7dd;
  --text: #15181e;
  --text-2: #4b5260;
  --text-3: #8b919c;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, .08);
  --accent-ring: rgba(37, 99, 235, .2);
  --c1: var(--accent); --c2: var(--accent);
  --ok: #16a34a; --ok-bg: rgba(22, 163, 74, .1);
  --warn: #d97706; --warn-bg: rgba(217, 119, 6, .1);
  --err: #dc2626; --err-bg: rgba(220, 38, 38, .09);
  --info: #2563eb; --info-bg: rgba(37, 99, 235, .08);
  --code-bg: #0f1115; --code-text: #d4d8e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f13; --surface: #14171c; --surface-2: #1a1e24; --hover: #1a1e24;
    --border: #252a32; --border-strong: #323843;
    --text: #e8eaee; --text-2: #a3a9b4; --text-3: #6b727e;
    --accent: #3b82f6; --accent-hover: #60a5fa; --accent-soft: rgba(59, 130, 246, .12); --accent-ring: rgba(59, 130, 246, .3);
    --ok: #22c55e; --ok-bg: rgba(34, 197, 94, .12); --warn: #f59e0b; --warn-bg: rgba(245, 158, 11, .12);
    --err: #ef4444; --err-bg: rgba(239, 68, 68, .12); --info: #3b82f6; --info-bg: rgba(59, 130, 246, .12);
    --code-bg: #0a0c0f; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f13; --surface: #14171c; --surface-2: #1a1e24; --hover: #1a1e24;
  --border: #252a32; --border-strong: #323843;
  --text: #e8eaee; --text-2: #a3a9b4; --text-3: #6b727e;
  --accent: #3b82f6; --accent-hover: #60a5fa; --accent-soft: rgba(59, 130, 246, .12); --accent-ring: rgba(59, 130, 246, .3);
  --ok: #22c55e; --ok-bg: rgba(34, 197, 94, .12); --warn: #f59e0b; --warn-bg: rgba(245, 158, 11, .12);
  --err: #ef4444; --err-bg: rgba(239, 68, 68, .12); --info: #3b82f6; --info-bg: rgba(59, 130, 246, .12);
  --code-bg: #0a0c0f; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  min-height: 100vh; overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: .9em; }
svg.lucide { width: 16px; height: 16px; stroke-width: 1.8; flex-shrink: 0; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
  padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface);
  overflow-y: auto; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--text); color: var(--bg); flex-shrink: 0; }
.brand-logo svg { width: 18px; height: 18px; }
.brand b { font-size: 15px; letter-spacing: -.01em; display: block; font-weight: 650; }
.brand small { color: var(--text-3); font-size: 11.5px; font-family: var(--mono); }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; text-decoration: none; color: var(--text-2);
  font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.chip-icon {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
}
.nav .chip-icon { background: transparent; border-color: transparent; width: 20px; height: 20px; color: inherit; }
.chip-icon svg { width: 15px; height: 15px; }
.sidebar-foot { margin-top: auto; padding: 14px 6px 0; display: flex; gap: 8px; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border); }

.main-col { min-width: 0; }
.scrim { position: fixed; inset: 0; opacity: 0; pointer-events: none; }
.main { min-width: 0; padding: 32px clamp(16px, 4vw, 48px) 80px; }
.view { max-width: 1160px; margin: 0 auto; }
.topbar { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.page-head .chip-icon { width: 40px; height: 40px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.page-head .chip-icon svg { width: 20px; height: 20px; }
.page-head h1 { margin: 0; font-size: clamp(21px, 2.4vw, 25px); letter-spacing: -.02em; line-height: 1.2; font-weight: 650; }
.page-head p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text); }
.card h3 > svg { color: var(--text-3); }
.card h3 .chip-icon { width: 24px; height: 24px; border-radius: 6px; }
.card h3 .chip-icon svg { width: 13px; height: 13px; }
.card h3 .right { margin-left: auto; display: flex; gap: 6px; align-items: center; font-weight: 500; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.anim { animation: rise .35s ease-out both; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.view-enter { animation: fade .25s ease-out both; }
@keyframes fade { from { opacity: 0; } }

/* ---------- forms ---------- */
.search {
  display: flex; gap: 8px; align-items: stretch; padding: 5px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--border-strong); transition: box-shadow .15s, border-color .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.search .ico { display: grid; place-items: center; padding-left: 8px; color: var(--text-3); }
.search input, .search textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 7px 4px; }
.search input { font-family: var(--mono); font-size: 14.5px; }
.search input::placeholder, .search textarea::placeholder { font-family: 'Inter', system-ui, sans-serif; }
.search textarea { resize: vertical; min-height: 92px; font-family: var(--mono); font-size: 13.5px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  padding: 8px 16px; border-radius: 7px; font-weight: 550; font-size: 14px; color: #fff; background: var(--accent);
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--text-3); transition: color .15s, border-color .15s, background .15s; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--hover); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.copied { color: var(--ok); border-color: var(--ok); }

.options { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.select, .input {
  padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); outline: none; min-width: 0; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.input { font-family: var(--mono); font-size: 13.5px; }
.select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.types { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.type-chip {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); transition: all .12s; font-family: var(--mono);
  display: inline-flex; align-items: center; gap: 5px;
}
.type-chip svg { width: 13px; height: 13px; }
.type-chip:hover { border-color: var(--border-strong); color: var(--text); background: var(--hover); }
.type-chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.type-chip.special { font-family: inherit; }

.recent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; font-size: 12px; color: var(--text-3); }
.recent svg { width: 13px; height: 13px; }
.recent button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 2px 8px; cursor: pointer; color: var(--text-2); font-size: 12px; font-family: var(--mono); transition: all .12s; display: inline-flex; align-items: center; gap: 5px; }
.recent button:hover { border-color: var(--border-strong); color: var(--text); }

/* ---------- key/value ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, 36%) 1fr; font-size: 13.5px; }
.kv > div { padding: 7px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.kv > div:nth-last-child(-n + 2) { border-bottom: 0; }
.kv .k { color: var(--text-3); display: flex; align-items: center; gap: 7px; padding-right: 12px; }
.kv .k svg { width: 14px; height: 14px; }
.kv .v { font-weight: 500; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- stats ---------- */
.stat .label { color: var(--text-3); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.stat .label svg { width: 13px; height: 13px; }
.stat .value { font-size: 19px; font-weight: 650; letter-spacing: -.01em; margin-top: 6px; overflow-wrap: anywhere; }
.stat .sub { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }

/* ---------- IP hero ---------- */
.ip-hero { position: relative; padding: 20px 20px 18px; border-top: 2px solid var(--accent); }
.ip-hero.bad { border-top-color: var(--err); }
.ip-hero.good { border-top-color: var(--ok); }
.ip-hero .label { font-size: 11.5px; font-weight: 600; color: var(--text-3); display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: .06em; }
.ip-hero .label svg { width: 14px; height: 14px; }
.ip-hero .ip { font-family: var(--mono); font-size: clamp(20px, 2.4vw, 27px); font-weight: 600; margin: 8px 0 4px; overflow-wrap: anywhere; letter-spacing: -.01em; padding-right: 70px; }
.ip-hero .ip.small { font-size: clamp(15px, 1.6vw, 19px); }
.ip-hero .meta { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ip-hero .meta svg { width: 14px; height: 14px; color: var(--text-3); }
.ip-hero .actions { position: absolute; top: 16px; right: 16px; display: flex; gap: 6px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: live 2s infinite; }
@keyframes live { 50% { opacity: .35; } }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 5px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 1px solid var(--border); }
.badge svg { width: 12px; height: 12px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.rtype { display: inline-block; min-width: 48px; text-align: center; padding: 2px 7px; border-radius: 5px; font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); }

/* ---------- tables / records ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.records { table-layout: fixed; }
table.records col.c-name { width: 26%; } table.records col.c-ttl { width: 120px; } table.records col.c-act { width: 44px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
th:first-child { border-top-left-radius: 6px; } th:last-child { border-top-right-radius: 6px; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--hover); }
tbody tr.anim { animation-name: fade; }
td.data { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; word-break: break-word; }
td.nowrap, .nowrap { white-space: nowrap; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.link { color: var(--accent); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }

.record-group { margin-bottom: 18px; }
.record-group:last-child { margin-bottom: 0; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.group-head .count { color: var(--text-3); font-size: 12.5px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: .6; } }

pre.raw {
  margin: 0; padding: 14px 16px; border-radius: 8px; background: var(--code-bg); color: var(--code-text); font-family: var(--mono); font-size: 12px; line-height: 1.6;
  overflow: auto; max-height: 520px; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--border);
}
pre.raw .c { color: #6b7280; }
details.disclosure { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
details.disclosure + details.disclosure { margin-top: 8px; }
details.disclosure summary { cursor: pointer; padding: 11px 16px; font-weight: 550; font-size: 14px; display: flex; align-items: center; gap: 9px; list-style: none; }
details.disclosure summary:hover { background: var(--hover); }
details.disclosure summary > svg:first-child { color: var(--text-3); }
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure summary .chev { margin-left: auto; transition: transform .2s; color: var(--text-3); }
details.disclosure[open] summary .chev { transform: rotate(180deg); }
details.disclosure > div { padding: 4px 16px 16px; }

/* ---------- states ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13.5px; }
.empty .big { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.empty .big svg { width: 22px; height: 22px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; font-weight: 600; }
.error-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: var(--err-bg); color: var(--err); font-weight: 500; font-size: 13.5px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--info); color: var(--text-2); font-size: 13px; }
.note svg { color: var(--info); margin-top: 2px; }
.note.warn { border-left-color: var(--warn); }
.note.warn svg { color: var(--warn); }

.loader { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 44px 0; color: var(--text-3); font-size: 13.5px; }
.orbit { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .7s linear infinite; }
.orbit span { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- progress ring ---------- */
.ring { position: relative; width: 112px; height: 112px; flex-shrink: 0; }
.ring svg { width: 112px; height: 112px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: var(--accent); transition: stroke-dashoffset .8s ease-out; }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .center b { font-size: 24px; letter-spacing: -.02em; display: block; line-height: 1.1; font-weight: 650; font-family: var(--mono); }
.ring .center small { color: var(--text-3); font-size: 11.5px; }
.summary-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.summary-row .stats { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.mini-stat { padding: 9px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); min-width: 104px; }
.mini-stat b { font-size: 19px; display: block; font-weight: 650; font-family: var(--mono); letter-spacing: -.02em; }
.mini-stat span { font-size: 11.5px; color: var(--text-3); font-weight: 500; }

.bar-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar-meter span { display: block; height: 100%; background: var(--accent); animation: grow .8s ease-out both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.ok { background: var(--ok); }
.status-dot.err { background: var(--err); }
.status-dot.warn { background: var(--warn); }
.status-dot.wait { background: var(--text-3); animation: live 1s infinite; }

.map { width: 100%; height: 260px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.flag { font-size: 16px; line-height: 1; }
.list-inline { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- home tool grid ---------- */
.section-title { margin: 10px 0 12px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.tool-tile { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; padding: 16px; cursor: pointer; transition: border-color .15s, background .15s; }
.tool-tile:hover { border-color: var(--border-strong); background: var(--hover); }
.tool-tile:hover .chip-icon { color: var(--accent); }
.tool-tile .chip-icon { width: 34px; height: 34px; border-radius: 8px; transition: color .15s; }
.tool-tile .chip-icon svg { width: 17px; height: 17px; }
.tool-tile b { display: block; margin-bottom: 1px; font-weight: 600; font-size: 14px; }
.tool-tile span { color: var(--text-2); font-size: 12.5px; }

.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 13.5px; font-weight: 500; animation: toastIn .2s ease-out both; }
.toast svg { color: var(--ok); }
.toast.out { animation: toastOut .2s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: 0; }
.check-row .ci { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; }
.check-row .ci svg { width: 15px; height: 15px; }
.check-row .ci.ok { background: var(--ok-bg); color: var(--ok); }
.check-row .ci.warn { background: var(--warn-bg); color: var(--warn); }
.check-row .ci.err { background: var(--err-bg); color: var(--err); }
.check-row .ci.info { background: var(--info-bg); color: var(--info); }
.check-row .ci.off { background: var(--surface-2); color: var(--text-3); }
.check-row b { display: block; font-weight: 600; font-size: 14px; }
.check-row .d { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }

.calc-bits { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; line-height: 1.8; }
.calc-bits .n { color: var(--accent); font-weight: 600; }
.calc-bits .h { color: var(--text-3); }

.theme-toggle { width: 30px; height: 30px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-105%); transition: transform .25s ease-out; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .scrim { background: rgba(0, 0, 0, .35); transition: opacity .25s; z-index: 15; }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar .brand { padding: 0; }
  .main { padding: 20px 16px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat .value { font-size: 16px; }
  .span2 { grid-column: auto; }
  .search { flex-wrap: wrap; }
  .search .btn { flex: 1; }
  .kv { grid-template-columns: 1fr; }
  .kv .k { padding: 8px 0 0; border-bottom: 0 !important; }
  .kv .v { padding-top: 2px; }
  .card { padding: 16px; }
  table.records col.c-name { width: 0 !important; }
  table.records th:first-child, table.records td:first-child { display: none; }
  table.records col.c-ttl { width: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- command palette ---------- */
.search-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0 0 6px; padding: 7px 8px 7px 10px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-3); cursor: pointer; font-size: 13.5px; text-align: left;
  transition: border-color .15s, color .15s;
}
.search-trigger:hover { border-color: var(--text-3); color: var(--text-2); }
.search-trigger .keys { margin-left: auto; display: flex; gap: 3px; }
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(10, 12, 16, .45); display: none;
  justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
}
.cmdk-backdrop.open { display: flex; animation: fade .12s ease-out both; }
body.cmdk-open { overflow: hidden; }
.cmdk {
  width: 100%; max-width: 640px; max-height: 70vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .35); animation: cmdkIn .15s ease-out both;
}
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-6px) scale(.99); } }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmdk-input svg { width: 18px; height: 18px; color: var(--text-3); }
.cmdk-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; font-family: var(--mono); }
.cmdk-input input::placeholder { font-family: 'Inter', system-ui, sans-serif; color: var(--text-3); }
.cmdk-list { overflow-y: auto; padding: 6px; flex: 1; }
.cmdk-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.cmdk-item .chip-icon { width: 30px; height: 30px; }
.cmdk-item.active { background: var(--accent-soft); }
.cmdk-item.active .chip-icon { color: var(--accent); border-color: transparent; background: var(--surface); }
.cmdk-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cmdk-text b { font-weight: 550; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-text b.mono { font-size: 13.5px; }
.cmdk-text small { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-enter { color: var(--text-3); opacity: 0; }
.cmdk-item.active .cmdk-enter { opacity: 1; color: var(--accent); }
.cmdk-empty { text-align: center; padding: 32px 16px; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cmdk-empty svg { width: 24px; height: 24px; color: var(--text-3); }
.cmdk-empty small { color: var(--text-3); }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); }
.cmdk-foot kbd { margin-right: 3px; }
@media (max-width: 860px) { .cmdk-foot { display: none; } .cmdk-backdrop { padding-top: 8vh; } }

/* home search trigger */
.home-search { cursor: text; align-items: center; padding: 12px 12px 12px 6px; }
.home-search:hover { border-color: var(--text-3); }
.home-search:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.home-search .fake-placeholder { flex: 1; min-width: 0; color: var(--text-3); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-search .keys { display: flex; gap: 3px; }
.spin svg, svg.spin { animation: spin 1s linear infinite; }
