:root {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #EEF2F5;
  --surface-3: #E2E8EE;
  --border: #CBD5E0;
  --border-strong: #4C595D;
  --text: #0A0E12;
  --text-2: #1E2933;
  --text-3: #4C595D;
  --text-4: #7A8B94;
  --cyber-yellow: #FFDA01;
  --cyber-yellow-dark: #C1A501;
  --primary: #0088B8;
  --primary-strong: #00668C;
  --primary-soft: rgba(0, 173, 227, .14);
  --primary-soft-2: rgba(0, 173, 227, .08);
  --primary-border: #00ADE3;
  --green: #2E7D47;
  --green-dot: #59A767;
  --green-soft: rgba(89, 167, 103, .14);
  --green-border: #59A767;
  --amber: #9E8600;
  --amber-soft: rgba(255, 218, 1, .2);
  --amber-border: #C1A501;
  --red: #E11D48;
  --bar-bg: rgba(255, 255, 255, .94);
  --shadow: 0 1px 2px rgba(10, 14, 18, .06);
  --shadow-lg: 0 20px 50px rgba(10, 14, 18, .25);
  --scrim: rgba(10, 14, 18, .45);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Chakra Petch', system-ui, sans-serif;
  --display: 'Rajdhani', 'Chakra Petch', sans-serif;
  --header-h: 64px;
  --nav-h: 64px;
  --cut-lg: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  --cut-md: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  --cut-sm: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  --cut-xs: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 0 100%);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #020202;
  --surface: #0B0F12;
  --surface-2: #12181D;
  --surface-3: #1A232A;
  --border: #26333B;
  --border-strong: #4C595D;
  --text: #F4F7F9;
  --text-2: #D0DCE2;
  --text-3: #8A9BA3;
  --text-4: #4C595D;
  --primary: #00ADE3;
  --primary-strong: #5CE1FF;
  --primary-soft: rgba(0, 173, 227, .16);
  --primary-soft-2: rgba(0, 173, 227, .08);
  --primary-border: rgba(0, 173, 227, .45);
  --green: #59A767;
  --green-dot: #59A767;
  --green-soft: rgba(89, 167, 103, .15);
  --green-border: rgba(89, 167, 103, .45);
  --amber: #FFDA01;
  --amber-soft: rgba(255, 218, 1, .14);
  --amber-border: rgba(255, 218, 1, .45);
  --red: #FF2E4C;
  --bar-bg: rgba(8, 11, 14, .94);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .7);
  --scrim: rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  transition: background-color .25s, color .25s;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--cyber-yellow); color: #020202; }

.ms {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  user-select: none;
}

/* ---------- Cut-Corner Containers ---------- */
.card, .cockpit, .link, .sheet {
  --cut: 14px;
  --c-border: var(--border);
  position: relative;
  isolation: isolate;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.card::after, .cockpit::after, .link::after, .sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1.5px solid var(--c-border);
  background: linear-gradient(225deg, var(--c-border) calc(var(--cut) * .7071 + 1.5px), var(--surface) calc(var(--cut) * .7071 + 2px)) border-box;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  pointer-events: none;
  transition: border-color .25s;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--bar-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1.5px solid var(--border);
}
.topbar-inner {
  height: var(--header-h);
  max-width: 760px; margin: 0 auto;
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center; color: #020202;
  background: var(--cyber-yellow);
  border: 1.5px solid var(--cyber-yellow-dark);
  clip-path: var(--cut-sm);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title {
  font-family: var(--display);
  font-size: 17px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.monitor-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 0;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .06em;
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text-2);
  clip-path: var(--cut-sm);
  transition: background-color .2s, border-color .2s, color .2s, transform .1s;
  user-select: none;
}
.monitor-pill:active { transform: scale(.96); }
.monitor-dot { width: 7px; height: 7px; background: var(--text-4); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.monitor-pill[data-state="live"] { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.monitor-pill[data-state="live"] .monitor-dot { background: var(--green-dot); animation: pulse 1.6s ease-in-out infinite; }
.monitor-pill[data-state="connecting"] { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.monitor-pill[data-state="connecting"] .monitor-dot { background: var(--cyber-yellow-dark); animation: pulse .9s ease-in-out infinite; }

.icon-btn {
  width: 38px; height: 38px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--text-3);
  clip-path: var(--cut-sm);
  transition: background-color .15s, color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.icon-btn:active { background: var(--surface-3); }
.avatar {
  position: relative; overflow: hidden; padding: 0;
  width: 32px; height: 32px; margin-left: 2px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-3);
  clip-path: var(--cut-sm);
}
.avatar .ms { font-size: 18px; }
.avatar img, .profile-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 380px) {
  .icon-btn { width: 34px; height: 34px; }
}

/* ---------- Layout ---------- */
.content {
  max-width: 760px; margin: 0 auto;
  padding: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 28px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
.view { display: flex; flex-direction: column; gap: 22px; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.tag {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 0; border: 1px solid; white-space: nowrap; line-height: 1.4;
  clip-path: var(--cut-xs);
}
.tag-sky { color: var(--primary-strong); background: var(--primary-soft); border-color: var(--primary-border); }
.tag-green { color: var(--green); background: var(--green-soft); border-color: var(--green-border); }
.tag-amber { color: var(--amber); background: var(--amber-soft); border-color: var(--amber-border); }
.tag-muted { color: var(--text-3); background: var(--surface-3); border-color: var(--border); }

.count-chip {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 0;
  background: var(--primary-soft-2); border: 1px solid var(--primary-border); color: var(--primary-strong);
  clip-path: var(--cut-xs);
}
.count-chip-muted { background: var(--surface-3); border-color: var(--border); color: var(--text-3); }

.chip-dot { width: 6px; height: 6px; background: var(--green-dot); flex-shrink: 0; }

/* ---------- Cockpit ---------- */
.cockpit {
  --cut: 18px;
  --c-border: var(--border-strong);
  padding: 16px 18px 20px; margin-bottom: 6px;
  display: flex; flex-direction: column; gap: 14px;
}
.cockpit[data-state="tx"] { --c-border: var(--red); }

.last-tx {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 14px 8px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--primary-border);
  clip-path: var(--cut-sm);
  font-family: var(--mono); font-size: 12px;
}
.last-tx-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.last-tx-call { font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.last-tx-meta { color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.last-tx-ago { color: var(--text-3); font-size: 11px; font-weight: 600; flex-shrink: 0; }

.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 0;
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
  clip-path: var(--cut-xs);
  transition: all .25s;
}
.status-dot { width: 6px; height: 6px; background: var(--text-4); }
.cockpit[data-state="tx"] .status-badge {
  color: #fff; border-color: var(--red);
  background: var(--red);
  animation: pulse 1.4s ease-in-out infinite;
}
.cockpit[data-state="tx"] .status-dot { background: #fff; box-shadow: 0 0 6px #fff; }
.cockpit[data-state="offline"] .status-badge { color: #020202; background: var(--cyber-yellow); border-color: var(--cyber-yellow-dark); }
.cockpit[data-state="offline"] .status-dot { background: #020202; }

.lcd {
  position: relative; overflow: hidden;
  border: 2px solid #1A232A; padding: 14px;
  clip-path: var(--cut-md);
  display: flex; flex-direction: column; gap: 10px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, .22) 1px, transparent 1px, transparent 3px),
    linear-gradient(#0C1612, #070E0B);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
  font-family: var(--mono);
}
.lcd-top {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 6px; border-bottom: 1px solid rgba(89, 167, 103, .35);
  font-size: 10px; letter-spacing: .08em;
}
.lcd-top-left { display: flex; align-items: center; gap: 8px; color: #59A767; font-weight: 700; }
.lcd-chip {
  padding: 2px 6px; background: rgba(89, 167, 103, .2); border: 1px solid rgba(89, 167, 103, .5);
  color: #7EE08F; font-weight: 700; font-size: 9px; clip-path: var(--cut-xs);
}
.lcd-top-right { display: flex; gap: 6px; color: rgba(126, 224, 143, .75); font-weight: 700; font-size: 9px; }
.lcd-rxtx { color: #7EE08F; }
.cockpit[data-state="tx"] .lcd-rxtx { color: #FF2E4C; animation: pulse 1s ease-in-out infinite; }

.lcd-body { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 2px 0; }
.lcd-call-wrap { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.lcd-label { font-size: 9px; font-weight: 700; letter-spacing: .16em; color: #59A767; }
.lcd-call {
  font-family: var(--display);
  font-size: 34px; font-weight: 700; letter-spacing: .08em; line-height: 1;
  color: #7EE08F; text-shadow: 0 0 8px rgba(89, 167, 103, .55);
  overflow-wrap: anywhere;
}
.cockpit[data-state="offline"] .lcd-call { color: var(--cyber-yellow); text-shadow: 0 0 8px rgba(255, 218, 1, .4); }
.lcd-readouts { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lcd-row { display: inline-flex; align-items: center; gap: 6px; }
.lcd-key { font-size: 10px; font-weight: 700; color: #59A767; }
.lcd-row:first-child .lcd-key { font-size: 12px; }
.lcd-freq {
  font-family: var(--display);
  font-size: 22px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 8px; clip-path: var(--cut-xs);
  background: rgba(0, 0, 0, .5); border: 1px solid rgba(89, 167, 103, .45);
  color: #A8F0B4; text-shadow: 0 0 6px rgba(89, 167, 103, .35);
}
.lcd-freq small { font-family: var(--mono); font-size: 11px; color: #59A767; }
.lcd-tone {
  font-size: 12px; font-weight: 700; padding: 2px 7px; clip-path: var(--cut-xs);
  background: rgba(89, 167, 103, .16); color: #7EE08F; border: 1px solid rgba(89, 167, 103, .4);
}
.lcd-bottom {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 6px; border-top: 1px solid rgba(89, 167, 103, .35);
  font-size: 11px; color: #59A767;
}
.lcd-loc { display: flex; align-items: center; gap: 6px; color: #A8F0B4; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lcd-loc .ms { font-size: 14px; color: #7EE08F; }
.lcd-txcount { font-size: 10px; color: #59A767; }

.modulation { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.modulation-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--text-3); }
.modulation-timer { color: var(--text); font-size: 12px; }
.vu {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px;
  height: 10px; padding: 2px;
  background: var(--surface-3); border: 1px solid var(--border);
  clip-path: var(--cut-xs);
}
.vu i { opacity: .12; transition: opacity .15s; }
.vu i:nth-child(-n+4) { background: #59A767; }
.vu i:nth-child(n+5):nth-child(-n+8) { background: #00ADE3; }
.vu i:nth-child(9), .vu i:nth-child(10) { background: #FFDA01; }
.vu i:nth-child(11), .vu i:nth-child(12) { background: #E11D48; }

/* ---------- Telemetry stream (Flat Cardless List) ---------- */
.stream { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.stream-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stream-title, .section-title { display: flex; align-items: center; gap: 8px; }
.stream-title .ms, .section-title .ms { color: var(--primary); }
.stream-title h2, .section-title h2 {
  font-family: var(--display);
  font-size: 16px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 0;
  background: var(--surface-3); border: 1px solid var(--border);
  clip-path: var(--cut-xs);
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-2);
}
.chip-toggle .chip-dot { animation: pulse 1.6s ease-in-out infinite; }
.chip-toggle[aria-pressed="false"] .chip-dot { background: var(--text-4); animation: none; }
.divider { border: 0; border-top: 1.5px solid var(--border); margin: 2px 0 0; width: 100%; }

.feed { display: flex; flex-direction: column; }
.pkt {
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--mono); font-size: 12px;
}
.pkt:last-child { border-bottom: 0; }
.pkt.is-new { animation: slidein .25s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pkt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pkt-head-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pkt-dot { width: 6px; height: 6px; background: var(--primary); flex-shrink: 0; }
.pkt-time { font-weight: 600; color: var(--text-3); font-size: 11px; }
.pkt-right { font-weight: 700; color: var(--primary); font-size: 11px; white-space: nowrap; }
.pkt-body {
  padding-left: 14px;
  color: var(--text); font-weight: 600; overflow-wrap: anywhere;
}
.pkt-body .call { color: var(--primary-strong); font-weight: 700; }
.pkt-body .rest { color: var(--text-2); font-weight: 500; }
.pkt-notif .pkt-dot { background: var(--green-dot); }
.pkt-notif .pkt-right { color: var(--green); }
.pkt-node .pkt-dot { animation: pulse 1.6s ease-in-out infinite; }
.pkt-node.is-live {
  background: rgba(225, 29, 72, .06);
  border-left: 2px solid var(--red);
  padding-left: 10px; padding-right: 8px;
}
.pkt-node.is-live .pkt-dot { background: var(--red); }
.pkt-idle { padding: 8px 4px; flex-direction: row; align-items: center; justify-content: space-between; }
.pkt-idle .pkt-dot { background: var(--border-strong); }
.pkt-idle .pkt-time { color: var(--text-3); font-weight: 500; }
.pkt-idle .pkt-chip { font-size: 11px; color: var(--text-3); }
.pkt-idle .pkt-right { font-size: 10px; color: var(--text-4); text-transform: uppercase; font-weight: 600; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 16px; text-align: center; color: var(--text-3); font-size: 13px;
  border: 1.5px dashed var(--border-strong);
  clip-path: var(--cut-md);
}
.empty .ms { font-size: 32px; color: var(--text-4); }

/* ---------- RF-Links ---------- */
.summary { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.summary-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.summary-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.summary-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--primary-soft); border: 1px solid var(--primary-border); color: var(--primary);
  clip-path: var(--cut-sm);
}
.summary-icon .ms { font-size: 18px; }
.summary h2 { font-family: var(--display); font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.summary p { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-top: 2px; }
.pill-live {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 4px 10px; border-radius: 0;
  background: var(--green-soft); border: 1px solid var(--green-border); color: var(--green);
  clip-path: var(--cut-xs);
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em;
}
.pill-live[data-live="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.pill-live[data-live="true"] .chip-dot { background: #fff; animation: pulse 1s ease-in-out infinite; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--primary-border);
  clip-path: var(--cut-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-family: var(--mono); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.stat-value { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: .03em; }
.stat-accent { color: var(--primary); }

.links { display: flex; flex-direction: column; gap: 10px; }
.link {
  --cut: 12px;
  padding: 12px 16px 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.link-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.link-call { font-family: var(--display); font-size: 16px; font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; gap: 6px; }
.link-loc { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-heard { font-family: var(--mono); font-size: 10px; color: var(--text-4); }
.link-chips { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.link-freq {
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--primary-strong);
  padding: 6px 10px; background: var(--primary-soft-2); border: 1px solid var(--primary-border);
  clip-path: var(--cut-xs);
}
.link-freq small { font-size: 10px; font-weight: 500; color: var(--text-3); }
.link-tone {
  font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-2);
  padding: 6px 8px; background: var(--surface-3); border: 1px solid var(--border);
  clip-path: var(--cut-xs);
}
.link.is-live { --c-border: var(--red); }
.live-badge {
  font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .06em;
  color: #fff; background: var(--red);
  padding: 1px 6px; clip-path: var(--cut-xs); animation: pulse 1.2s ease-in-out infinite;
}
@media (max-width: 360px) {
  .link { flex-direction: column; align-items: flex-start; }
}

/* ---------- Logs ---------- */
.search-card { padding: 12px; }
.search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  clip-path: var(--cut-sm);
  color: var(--text-4);
}
.search:focus-within { border-color: var(--primary); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 600 13px var(--sans); color: var(--text);
}
.search input::placeholder { color: var(--text-4); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font-family: var(--mono); font-size: 10px; padding: 2px 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-3);
  clip-path: var(--cut-xs);
}
.log-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 0 4px; }
.log-meta { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.log-meta strong { color: var(--text); font-weight: 700; }
.log-meta .chip-dot { animation: pulse 1.6s ease-in-out infinite; }
.log-meta[data-live="false"] .chip-dot { background: var(--text-4); animation: none; }
.log-sep { color: var(--text-4); }
.log-actions { display: flex; gap: 6px; }
.btn-tonal, .btn-outline {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 0;
  font-family: var(--mono); font-size: 11px; font-weight: 700; text-transform: uppercase;
  clip-path: var(--cut-xs);
}
.btn-tonal .ms, .btn-outline .ms { font-size: 14px; }
.btn-tonal { background: var(--primary-soft-2); border: 1px solid var(--primary-border); color: var(--primary-strong); }
.btn-outline { background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); }
.btn-tonal:active, .btn-outline:active { transform: scale(.96); }

.log-list { padding: 2px; }
.log-list:empty { display: none; }
.log {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 14px 8px 12px; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px;
}
.log:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); }
.log:last-child { border-bottom: 0; }
.log-dot { width: 6px; height: 6px; background: var(--border-strong); flex-shrink: 0; }
.log-time { color: var(--text-4); }
.log-text { color: var(--text-2); font-weight: 600; overflow-wrap: anywhere; }
.log-text .call { color: var(--green); font-weight: 700; }
.log-text mark { background: var(--cyber-yellow); color: #020202; padding: 0 2px; }
.log-mode .log-dot { background: var(--primary); }
.log-mode .log-text { color: var(--primary-strong); }
.log-notif .log-dot { background: var(--cyber-yellow-dark); }
.log-node { background: var(--green-soft); }
.log-node .log-dot { background: var(--green-dot); box-shadow: 0 0 0 3px var(--green-border); }
.log-idle .log-text { color: var(--text-3); font-weight: 500; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bar-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1.5px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 76px; height: 48px;
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); text-decoration: none;
  transition: color .15s;
}
.bottomnav a .ms {
  font-size: 21px; padding: 3px 16px;
  clip-path: var(--cut-sm);
  transition: background-color .2s, color .2s;
}
.bottomnav a[aria-current="page"] { color: var(--text); font-weight: 700; }
.bottomnav a[aria-current="page"] .ms {
  background: var(--cyber-yellow); color: #020202;
  font-variation-settings: 'FILL' 1;
}

/* ---------- Settings sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: var(--scrim);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  animation: fadein .2s ease-out;
}
@keyframes fadein { from { opacity: 0; } }
.sheet {
  --cut: 18px;
  --c-border: var(--border-strong);
  width: 100%; max-width: 520px;
  padding: 10px 18px 18px;
  display: flex; flex-direction: column; gap: 14px;
  animation: sheetup .25s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes sheetup { from { transform: translateY(30px); opacity: 0; } }
.sheet-handle { width: 36px; height: 4px; background: var(--border-strong); margin: 0 auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h3 { font-family: var(--display); font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.sheet-close {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-3);
  clip-path: var(--cut-xs);
}
.sheet-close .ms { font-size: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--text-3); }
.field input {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  clip-path: var(--cut-sm);
  font: 500 12px var(--mono); outline: 0;
}
.field input:focus { border-color: var(--primary); }
.field-hint { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.field-hint code { font-family: var(--mono); font-size: 10px; }
.segmented { display: flex; gap: 6px; }
.segmented button {
  flex: 1; padding: 8px 4px;
  background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2);
  clip-path: var(--cut-xs);
  font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase;
  transition: background-color .15s, color .15s;
}
.segmented button[aria-pressed="true"] {
  background: var(--cyber-yellow); border-color: var(--cyber-yellow-dark); color: #020202; font-weight: 700;
}
.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.btn-text {
  border: 0; background: transparent; color: var(--text-3);
  font-family: var(--mono); font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 10px 8px;
}
.btn-primary {
  flex: 1; padding: 11px;
  background: var(--cyber-yellow); color: #020202;
  border: 1.5px solid var(--cyber-yellow-dark);
  clip-path: var(--cut-sm);
  font-family: var(--mono); font-size: 12px; font-weight: 800; letter-spacing: .06em;
}
.btn-primary:active { transform: scale(.98); }

.dialog-backdrop { align-items: center; }
.profile-dialog {
  width: 100%; max-width: 360px;
  padding: 24px 28px 26px;
  background: #00EAFF; color: #020202;
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%, 0 16px);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left;
  animation: sheetup .2s ease-out;
}
.profile-top {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.profile-close {
  width: 30px; height: 30px; padding: 0;
  display: grid; place-items: center;
  background: #020202; border: 0; color: #00EAFF;
  clip-path: var(--cut-xs);
}
.profile-close .ms { font-size: 18px; }
.profile-date {
  font-family: var(--mono); font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #020202;
}
.profile-avatar {
  position: relative; overflow: hidden;
  width: 152px; height: 124px; margin-bottom: 20px;
  display: grid; place-items: center;
  background: #020202; color: #00EAFF;
  clip-path: polygon(
    12px 0, 60% 0, calc(60% + 4px) 4px, calc(80% - 4px) 4px, 80% 0, calc(100% - 12px) 0,
    100% 12px, 100% calc(100% - 12px),
    calc(100% - 12px) 100%, 82% 100%, calc(82% - 4px) calc(100% - 6px), calc(18% + 4px) calc(100% - 6px), 18% 100%, 12px 100%,
    0 calc(100% - 12px), 0 56%, 4px calc(56% - 4px), 4px calc(24% + 4px), 0 24%, 0 12px
  );
}
.profile-avatar .ms { font-size: 48px; }
.profile-title {
  font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: .03em; line-height: 1.1;
  color: #020202; text-transform: uppercase; margin-bottom: 8px;
}
.profile-motto {
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: #020202;
}
.profile-home {
  align-self: flex-end; margin-top: 32px;
  padding: 13px 32px;
  background: #020202; color: #F4F7F9;
  font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-decoration: none; text-transform: uppercase;
  clip-path: polygon(
    0 0, 100% 0,
    100% 24%, calc(100% - 4px) calc(24% + 4px), calc(100% - 4px) calc(76% - 4px), 100% 76%,
    100% 100%, 0 100%,
    0 76%, 4px calc(76% - 4px), 4px calc(24% + 4px), 0 24%
  );
}
.profile-home:active { transform: scale(.97); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 70;
  transform: translate(-50%, 8px);
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; max-width: calc(100% - 32px);
  background: #0A0E12; color: #fff;
  clip-path: var(--cut-sm);
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
[data-theme="dark"] .toast { background: var(--cyber-yellow); color: #020202; }
.toast .ms { font-size: 16px; color: #59A767; }
[data-theme="dark"] .toast .ms { color: #020202; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes pulse { 50% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
