:root {
  --bg: #07090d;
  --side: #0c1118;
  --card: #121820;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f6fa;
  --muted: #8b9bb0;
  --accent: #3ec4ff;
  --accent2: #34d399;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --violet: #a78bfa;
  --pink: #e879f9;
  --radius: 14px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.side {
  width: 220px;
  flex-shrink: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(56, 189, 248, .15);
  border: 1px solid rgba(56, 189, 248, .4);
  display: grid; place-items: center;
  color: var(--accent); font-weight: 700; font-size: 12px;
}
.brand h1 { margin: 0; font-size: 14px; font-weight: 600; }
.brand p { margin: 2px 0 0; font-size: 10px; color: #64748b; }

.nav { padding: 8px; flex: 1; overflow-y: auto; }
.nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 2px;
}
.nav button:hover { background: rgba(30, 41, 59, .7); }
.nav button.active {
  background: #1e293b;
  color: #7dd3fc;
  border-color: #334155;
}
.side-foot {
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: #64748b;
}

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, .9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top h2 { margin: 0; font-size: 16px; font-weight: 600; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-ok { color: #6ee7b7; border-color: #065f46; background: #064e3b55; }
.badge-warn { color: #fcd34d; border-color: #854d0e; background: #713f1255; }
.badge-info { color: #7dd3fc; border-color: #0c4a6e; background: #0c4a6e44; }
.badge-dim { color: #94a3b8; border-color: #334155; background: #1e293b55; }

.btn {
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 980px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: inset 0 0.5px 0 rgba(255,255,255,.08);
}
.btn:hover { background: rgba(255,255,255,.12); }
.btn-accent {
  background: linear-gradient(180deg, #5ad0ff, #2a9de0);
  border-color: rgba(255,255,255,.2);
  color: #041018;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 16px rgba(62,196,255,.3);
}
.btn-soft { background: rgba(62,196,255,.1); color: #7dd3fc; border-color: rgba(62,196,255,.25); }
.btn-danger { background: #4c051955; border-color: #9f1239; color: #fecdd3; }

.content { padding: 18px 20px 40px; }

.page { display: none; }
.page.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.2fr 1fr; }
@media (max-width: 1100px) and (min-width: 761px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .side { width: 64px; }
  .brand p, .brand h1, .nav button span.label, .side-foot, .side-back { display: none; }
  .nav button { text-align: center; padding: 10px 6px; font-size: 16px; justify-content: center; }
  .nav button .ico { display: inline; margin: 0; }
}
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.card .sub { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.kpi-val { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-lab { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Table */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #1e293b; }
th { color: var(--muted); font-weight: 500; background: #0f172a; position: sticky; top: 0; }
tr:hover td { background: #1a2336; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px;
}
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-off { background: #475569; }
.dot-err { background: var(--err); }

.pill {
  display: inline-flex; align-items: center;
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid; gap: 4px;
}
.pill-warm { color: #c4b5fd; border-color: #5b21b6; background: #2e1065aa; }
.pill-com { color: #f0abfc; border-color: #86198f; background: #4a044eaa; }
.pill-sales { color: #a5b4fc; border-color: #3730a3; background: #1e1b4baa; }
.pill-sys { color: #7dd3fc; border-color: #0c4a6e; background: #082f49aa; }
.pill-err { color: #fca5a5; border-color: #991b1b; background: #450a0aaa; }
.pill-bot { color: #86efac; border-color: #166534; background: #052e16aa; }
.pill-market { color: #fcd34d; border-color: #854d0e; background: #451a03aa; }
.pill-finder { color: #67e8f9; border-color: #155e75; background: #083344aa; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #0f172a; color: var(--muted); cursor: pointer;
}
.chip.active { color: #7dd3fc; border-color: #0369a1; background: #0c4a6e55; }

/* Monitoring — Telegram-style */
.monitor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  min-height: 560px;
}
@media (max-width: 900px) { .monitor-layout { grid-template-columns: 1fr; } }

.chat-list, .chat-feed {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-list-h, .chat-feed-h {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
}
.chat-rows { overflow-y: auto; flex: 1; max-height: 520px; }
.chat-row {
  display: flex; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid #1a2336; cursor: pointer;
}
.chat-row:hover, .chat-row.active { background: #1e293b88; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #334155, #1e3a5f);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #bae6fd; flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.avatar.has-img { color: transparent; font-size: 0; }
.chat-meta { min-width: 0; flex: 1; }
.chat-meta .name { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.chat-meta .preview { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-meta .time { font-size: 10px; color: #64748b; font-weight: 400; }

.feed-scroll {
  flex: 1;
  overflow-y: auto;
  max-height: 480px;
  padding: 16px 14px 20px;
  background:
    radial-gradient(ellipse at top, #132033 0%, transparent 55%),
    #0d1524;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  max-width: 92%;
  align-self: flex-start;
  background: #1a2740;
  border: 1px solid #2a3a55;
  border-radius: 12px 12px 12px 4px;
  padding: 8px 11px;
  animation: bubbleIn .35s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.bubble.sys { border-color: #1e3a5f; }
.bubble.err { border-color: #7f1d1d; background: #2a1216; }
.bubble .b-top { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.bubble .b-acc { font-size: 12px; font-weight: 600; color: #7dd3fc; }
.bubble .b-text { font-size: 13px; line-height: 1.4; }
.bubble .b-time { font-size: 10px; color: #64748b; margin-top: 4px; text-align: right; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* Smart match highlight */
.smart {
  border: 1px solid rgba(52, 211, 153, .45);
  background: linear-gradient(135deg, #052e1a99, #151d2e 55%);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, .08), 0 12px 40px rgba(16, 185, 129, .08);
}
.smart-title {
  display: flex; align-items: center; gap: 8px;
  color: #6ee7b7; font-weight: 700; font-size: 14px; margin-bottom: 6px;
}
.smart ul { margin: 8px 0 12px; padding-left: 18px; color: #cbd5e1; font-size: 12px; line-height: 1.55; }
.score {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: ui-monospace, monospace;
  font-size: 18px; font-weight: 700; color: #34d399;
}

/* Pipeline */
.flow {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0;
}
.step {
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0f172a; font-size: 11px; color: var(--muted);
}
.step.on { border-color: #0369a1; color: #7dd3fc; background: #0c4a6e33; }
.step.done { border-color: #065f46; color: #6ee7b7; background: #064e3b33; }
.arrow { color: #475569; font-size: 12px; }

/* Forms */
label.field { display: block; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
label.field input, label.field select, label.field textarea {
  display: block; width: 100%; margin-top: 4px;
  background: #0f172a; border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-size: 12px;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bar { height: 6px; border-radius: 999px; background: #1f2937; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; }

/* Tour annotations — pin only; text on hover (no permanent overlay) */
.tour-pin {
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #0b1220;
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .3), 0 6px 16px rgba(0,0,0,.35);
  z-index: 30;
  cursor: help;
  animation: pulse 2.4s infinite;
}
.tour-pin::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 240px;
  padding: 10px 12px;
  background: #0f172aee;
  border: 1px solid #38bdf8aa;
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  text-align: left;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 40;
}
.tour-pin::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #38bdf8aa;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 40;
}
.tour-pin:hover::after,
.tour-pin:focus::after,
.tour-pin:hover::before,
.tour-pin:focus::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.tour-pin.tip-below::after {
  bottom: auto;
  top: calc(100% + 10px);
}
.tour-pin.tip-below::before {
  bottom: auto;
  top: calc(100% + 4px);
  border-top-color: transparent;
  border-bottom-color: #38bdf8aa;
}
.tour-pin.tip-left::after {
  left: auto;
  right: calc(100% + 10px);
  bottom: 50%;
  transform: translateY(50%) translateX(4px);
}
.tour-pin.tip-right::after {
  left: calc(100% + 10px);
  bottom: 50%;
  transform: translateY(50%);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(56, 189, 248, .3), 0 6px 16px rgba(0,0,0,.35); }
  50% { box-shadow: 0 0 0 7px rgba(56, 189, 248, .12), 0 6px 16px rgba(0,0,0,.35); }
}
.rel { position: relative; }
body.tour-off .tour-pin { display: none !important; }

/* Avatar images */
.avatar {
  background-size: cover !important;
  background-position: center !important;
  overflow: hidden;
}
.avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 50%;
}
.avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  object-fit: cover; vertical-align: middle;
  border: 1px solid #334155;
}
.avatar-row { display: flex; align-items: center; gap: 8px; }
.av-stack { display: flex; }
.av-stack img {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--card); margin-left: -8px; object-fit: cover;
}
.av-stack img:first-child { margin-left: 0; }

/* Toggle rows for flexible settings */
.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 700px) { .toggle-grid { grid-template-columns: 1fr; } }
.toggle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 10px;
  background: #0f172a; border: 1px solid var(--line); border-radius: 8px;
  font-size: 12px;
}
.toggle .sw {
  width: 34px; height: 18px; border-radius: 999px;
  background: #334155; position: relative; flex-shrink: 0;
}
.toggle .sw.on { background: #0369a1; }
.toggle .sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #e2e8f0;
  transition: left .15s;
}
.toggle .sw.on::after { left: 18px; }
.range-row {
  display: grid; grid-template-columns: 110px 1fr 48px;
  gap: 8px; align-items: center; font-size: 11px; color: var(--muted);
  margin-bottom: 8px;
}
.range-row input[type=range] { width: 100%; accent-color: var(--accent); }
.range-row .val { font-family: ui-monospace, monospace; color: #7dd3fc; text-align: right; }

/* One-button hero card */
.one-btn {
  border: 1px solid rgba(56, 189, 248, .45);
  background: linear-gradient(135deg, #0c4a6e55, #151d2e 50%, #1e1b4b55);
  box-shadow: 0 0 40px rgba(56, 189, 248, .08);
}
.one-btn .mega {
  font-size: 15px; font-weight: 700; margin: 8px 0 4px;
}
.one-btn .mega-sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.45; }

/* Presentation mode */
.present-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: #050a12;
  color: var(--text);
  flex-direction: column;
}
body.presenting .present-overlay { display: flex; }
body.presenting .app { visibility: hidden; }

.present-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: #0b1220;
}
.present-bar .left { display: flex; gap: 12px; align-items: center; }
.present-bar .brand-sm { font-weight: 700; color: var(--accent); font-size: 13px; }
.present-slide {
  flex: 1; display: none; flex-direction: column;
  justify-content: center; padding: 32px 8vw 48px;
  max-width: 1100px; margin: 0 auto; width: 100%;
}
.present-slide.active { display: flex; animation: fade .25s ease; }
.present-slide .eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); margin-bottom: 12px;
}
.present-slide h2 {
  margin: 0 0 12px; font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.02em; line-height: 1.15;
}
.present-slide .lead {
  font-size: 17px; color: #cbd5e1; max-width: 640px; line-height: 1.55; margin-bottom: 24px;
}
.present-slide ul {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 10px; max-width: 560px;
}
.present-slide ul li {
  padding: 12px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; line-height: 1.4;
}
.present-slide ul li b { color: #7dd3fc; }
.present-visual {
  margin-top: 28px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--card); padding: 16px; overflow: hidden;
  max-height: 280px;
}
.present-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--line); background: #0b1220;
}
.present-dots { display: flex; gap: 6px; }
.present-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: #334155;
}
.present-dots span.on { background: var(--accent); }
.kbd {
  font-size: 10px; color: #64748b; border: 1px solid #334155;
  padding: 2px 6px; border-radius: 4px; margin-left: 6px;
}

.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 900px) { .row-3 { grid-template-columns: 1fr; } }

.hint {
  font-size: 11px; color: var(--muted); line-height: 1.45;
  padding: 10px 12px; border-left: 3px solid var(--accent);
  background: #0f172a88; border-radius: 0 8px 8px 0; margin: 10px 0;
}
.section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: #94a3b8; margin: 14px 0 8px; padding-top: 8px; border-top: 1px solid #1e293b;
}
.section-label:first-child { border-top: 0; padding-top: 0; margin-top: 0; }

.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .5);
  animation: live 1.4s infinite;
  display: inline-block;
}
@keyframes live {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .5); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* —— back to landing + mobile shell —— */
.side-back {
  display: block;
  margin: 8px 10px 4px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #7dd3fc;
  text-decoration: none;
  border: 1px solid rgba(62, 196, 255, .28);
  background: rgba(62, 196, 255, .08);
  text-align: center;
}
.side-back:hover { background: rgba(62, 196, 255, .14); }
.side-close {
  display: none;
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.btn-menu {
  display: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  place-items: center;
  padding: 0;
}
.btn-back-landing {
  display: none;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #7dd3fc;
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(62, 196, 255, .3);
  background: rgba(62, 196, 255, .1);
  flex-shrink: 0;
}
.btn-back-landing:hover { background: rgba(62, 196, 255, .18); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.side-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 40;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.nav button .ico { display: none; margin-right: 6px; }

/* phone / narrow tablet */
@media (max-width: 760px) {
  .btn-menu { display: grid; }
  .btn-back-landing { display: inline-flex; }
  .hide-sm { display: none !important; }
  .side-close { display: grid; place-items: center; }
  .side-scrim { display: block; }
  .side-scrim[hidden] { display: none !important; }

  .app { flex-direction: column; min-height: 100dvh; }

  .side {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(300px, 86vw);
    height: 100dvh;
    height: 100svh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: none;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  body.nav-open .side {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0,0,0,.45);
  }
  body.nav-open { overflow: hidden; }

  .brand { position: relative; }
  .nav button {
    display: flex;
    align-items: center;
    text-align: left;
    padding: 11px 12px;
    font-size: 14px;
  }
  .nav button .ico { display: inline; }
  .nav button .label { display: inline !important; }
  .brand h1, .brand p, .side-foot { display: block !important; }
  .side-foot { font-size: 10px; }

  .top {
    flex-wrap: wrap;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    gap: 8px;
  }
  .top-left { gap: 8px; min-width: 0; flex: 1; }
  .top h2 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42vw;
  }
  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .top-actions .btn {
    padding: 7px 11px;
    font-size: 11px;
  }
  .content {
    padding: 12px 12px max(28px, env(safe-area-inset-bottom, 0px));
  }

  .monitor-layout {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 10px;
  }
  .chat-list { max-height: 200px; }
  .chat-rows { max-height: 160px; }
  .feed-scroll { max-height: min(52dvh, 420px); }
  .chat-list-h, .chat-feed-h { padding: 10px 12px; }

  .grid-4 { grid-template-columns: 1fr 1fr; }
  .kpi-val { font-size: 22px; }
  .card { padding: 12px; }
  .chips { gap: 5px; }
  .chip { font-size: 10px; padding: 5px 8px; }

  .tour-pin { display: none; } /* tips clutter phone */

  .present-visual { max-height: 200px; }
  .present-nav { flex-wrap: wrap; gap: 8px; padding: 12px; }
}

@media (max-width: 420px) {
  .hide-xs { display: none !important; }
  .btn-back-landing { font-size: 11px; padding: 5px 8px; }
  .top h2 { max-width: 36vw; }
  .grid-4 { grid-template-columns: 1fr; }
  .badge-info { display: none; }
}

/* override mid-width icon-only side when phone drawer is active */
@media (max-width: 760px) {
  .side { width: min(300px, 86vw) !important; }
}
