/* ============================================================
   RELAIS — agents dashboard
   Artisanal notebook aesthetic. Original design.
   ============================================================ */

:root {
  --cream-50:  #faf6ee;
  --cream-100: #f8f2e6;
  --cream-200: #f5f0e8;
  --cream-300: #ede4d3;
  --cream-400: #e0d3bc;

  --ink-900: #1a1008;
  --ink-800: #2a1d12;
  --ink-600: #5c4a38;
  --ink-500: #6f5c47;
  --ink-400: #8a7560;
  --ink-300: #b0a18d;
  --ink-200: #c4b8a8;
  --ink-100: #d9d0bf;

  --coral-400: #e19478;
  --coral-500: #d97757;
  --coral-600: #c96040;
  --coral-700: #a84e31;

  --emerald-50: #edf7f1;
  --emerald-400: #47b881;
  --emerald-600: #2f9e66;

  --red-50: #fbefec;
  --red-400: #e2725b;
  --red-500: #d15642;

  --amber-400: #d4a04a;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 18px;

  --shadow-card: 0 1px 0 rgba(26,16,8,0.04), 0 1px 2px rgba(26,16,8,0.03);
  --shadow-lift: 0 4px 12px rgba(26,16,8,0.06), 0 1px 2px rgba(26,16,8,0.04);
  --shadow-modal: 0 24px 60px rgba(26,16,8,0.22), 0 8px 20px rgba(26,16,8,0.12);

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--cream-200);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Paper grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.06  0 0 0 0 0.03  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.4'/></svg>");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.35;
  mix-blend-mode: multiply;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- type ---------- */
.h-display {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  font-size: 34px;
  line-height: 1.1;
  font-variation-settings: "opsz" 24;
}
.h-display .accent-underline {
  position: relative; display: inline-block;
}
.h-display .accent-underline::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -2px; height: 6px;
  background: var(--coral-500);
  opacity: 0.22;
  border-radius: 2px;
  transform: skewX(-8deg);
}

.h-section {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  font-size: 18px;
}

.label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-400);
}

.text-secondary { color: var(--ink-500); }
.text-muted { color: var(--ink-400); }
.text-dim { color: var(--ink-300); }
.mono { font-family: var(--font-mono); }

/* ---------- layout ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 56px;
  background: rgba(245, 240, 232, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cream-300);
}
.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--coral-500);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  position: relative;
  box-shadow: 0 1px 0 rgba(26,16,8,0.08), inset 0 1px 0 rgba(255,255,255,0.18);
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 6px;
  border: 1px dashed rgba(255,255,255,0.35);
  pointer-events: none;
}
.brand-word { font-size: 16px; }
.brand-sub { font-size: 10px; color: var(--ink-400); letter-spacing: 0.14em; text-transform: uppercase; margin-left: 2px; font-weight: 600;}

.navlinks { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
.navlink {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--ink-500);
  font-weight: 500;
  transition: all 200ms ease;
  cursor: pointer;
}
.navlink:hover { background: var(--cream-300); color: var(--ink-900); }
.navlink.active { color: var(--ink-900); background: rgba(217, 119, 87, 0.08); }
.navlink.active::before {
  content: '•'; margin-right: 6px; color: var(--coral-500);
}

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #e8d9c4, #c4b8a8);
  color: var(--ink-800);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px;
  border: 1px solid var(--cream-300);
  letter-spacing: 0.05em;
}
.avatar-btn { cursor: pointer; transition: all 180ms ease; padding: 0; }
.avatar-btn:hover { box-shadow: 0 0 0 3px rgba(217,119,87,0.15); border-color: var(--coral-400); }

.profile-menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 28px; margin: 0 -28px;
  background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-sans); font-size: 13.5px;
  color: var(--ink-700); text-align: left; width: calc(100% + 56px);
  transition: background 150ms ease;
}
.profile-menu-item:hover { background: var(--cream-100); }
.profile-menu-item .chev { margin-left: auto; color: var(--ink-300); }
.profile-menu-item span { flex: 1; }

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 28px 72px;
  width: 100%;
  animation: pageIn 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
  flex-wrap: wrap;
}
.page-head-copy { max-width: 620px; }
.page-head .label { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.page-head .label .dot { width: 5px; height: 5px; background: var(--coral-500); border-radius: 50%; }
.page-head p { color: var(--ink-500); margin: 10px 0 0; font-size: 14.5px; }

/* ---------- cards ---------- */
.card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--cream-300);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 22px; }
.card-pad-lg { padding: 28px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--cream-300);
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-900); display: flex; align-items: center; gap: 8px;}
.card-head .meta { font-size: 12px; color: var(--ink-400); font-family: var(--font-mono); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  transition: all 200ms ease;
  line-height: 1;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--coral-500);
  color: #fff;
  box-shadow: 0 1px 0 rgba(168,78,49,0.3), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { background: var(--coral-600); }
.btn-ghost { color: var(--ink-600); }
.btn-ghost:hover { background: var(--cream-300); color: var(--ink-900); }
.btn-outline {
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--cream-300);
  color: var(--ink-800);
}
.btn-outline:hover { border-color: var(--ink-200); background: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 11px 18px; font-size: 14px; }

/* ---------- inputs ---------- */
.input {
  width: 100%;
  background: var(--cream-50);
  border: 1px solid var(--cream-300);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--ink-900);
  transition: all 200ms ease;
}
.input::placeholder { color: var(--ink-300); }
.input:focus { outline: none; border-color: var(--coral-400); background: #fff; box-shadow: 0 0 0 3px rgba(217,119,87,0.1); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; font-family: var(--font-sans);}
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 12px; font-weight: 600; color: var(--ink-600); }
.input-hint { font-size: 11.5px; color: var(--ink-400); }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-ok { background: var(--emerald-50); color: var(--emerald-600); }
.pill-ok .dot { background: var(--emerald-600); box-shadow: 0 0 0 2px rgba(47,158,102,0.15); }
.pill-err { background: var(--red-50); color: var(--red-500); }
.pill-err .dot { background: var(--red-500); }
.pill-run {
  background: rgba(217,119,87,0.12); color: var(--coral-600);
}
.pill-run .dot {
  background: var(--coral-500);
  animation: pulse 1.4s ease-in-out infinite;
}
.pill-idle { background: var(--cream-300); color: var(--ink-500);}
.pill-idle .dot { background: var(--ink-300);}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(217,119,87,0.4);}
  50% { opacity: 0.6; box-shadow: 0 0 0 5px rgba(217,119,87,0);}
}

/* ---------- icon tile ---------- */
.icon-tile {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: rgba(217,119,87,0.1);
  color: var(--coral-600);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-tile.lg { width: 44px; height: 44px; border-radius: var(--radius-lg);}
.icon-tile.muted { background: var(--cream-300); color: var(--ink-500); }

/* ---------- terminal ---------- */
.terminal {
  background: #1a1008;
  border-radius: var(--radius-xl);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #f5f0e8;
  line-height: 1.7;
  overflow: hidden;
  position: relative;
}
.terminal::selection, .terminal *::selection { background: var(--coral-500); color: #fff; }
.term-line { display: flex; gap: 14px; white-space: pre; }
.term-ts { color: #736452; flex-shrink: 0; }
.term-tag { flex-shrink: 0; font-weight: 700; letter-spacing: 0.04em; }
.term-msg { color: #e6dcc8; white-space: pre-wrap; flex: 1; min-width: 0; overflow-wrap: break-word;}
.tag-info { color: #9fb4d4; }
.tag-ok { color: #6dd0a0; }
.tag-warn { color: #e4b867; }
.tag-err { color: #ee8878; }
.tag-run { color: var(--coral-400); }
.term-msg .kw { color: #e4b867; }
.term-msg .str { color: #b8d39a; }
.term-msg .dim { color: #8a7560; }

.terminal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: #120a04;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  color: #c4b8a8;
  font-family: var(--font-mono);
  font-size: 11.5px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.terminal-head .dots { display: flex; gap: 5px; }
.terminal-head .dots span { width: 9px; height: 9px; border-radius: 50%; background: #3d2d1d; }
.terminal-wrap {
  background: #1a1008;
  border-radius: var(--radius-xl);
  border: 1px solid #2a1d12;
  overflow: hidden;
}
.terminal-wrap .terminal { border-radius: 0; padding: 14px 18px 18px; }

/* skeleton / loader */
.skel { background: var(--cream-300); border-radius: 4px; animation: skel 1.6s ease-in-out infinite; }
@keyframes skel { 0%,100%{opacity:.6;} 50%{opacity:.3;} }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  animation: fadeIn 200ms ease;
}
.modal {
  background: #fff;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-modal);
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 64px);
  overflow: hidden;
  animation: modalIn 240ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

/* misc helpers */
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-main { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }
@media (max-width: 960px){
  .grid-main { grid-template-columns: 1fr; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

.divider { height: 1px; background: var(--cream-300); border: 0; margin: 0; }
.divider-dashed { height: 0; border: 0; border-top: 1px dashed var(--cream-400); margin: 0; }

/* stamp (artisanal touch) */
.stamp {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1.5px dashed var(--coral-500);
  border-radius: 4px;
  color: var(--coral-600);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  transform: rotate(-2deg);
  background: rgba(217,119,87,0.04);
}

/* handwritten margin note */
.margin-note {
  font-family: 'Caveat', 'Kalam', cursive;
  color: var(--coral-600);
  font-size: 17px;
  line-height: 1.1;
  transform: rotate(-3deg);
  display: inline-block;
}
.margin-note::before { content: '↳ '; opacity: 0.6; }

/* stat block */
.stat { display: flex; flex-direction: column; gap: 6px;}
.stat-val { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink-900); font-variant-numeric: tabular-nums;}
.stat-lbl { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-400);}
.stat-delta { font-size: 11.5px; color: var(--emerald-600); font-weight: 600; display: flex; align-items: center; gap: 3px;}
.stat-delta.neg { color: var(--red-500); }

/* sparkline */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px;}
.spark span { width: 5px; background: var(--coral-500); border-radius: 1px; opacity: 0.55; }

/* tab bar */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--cream-300); margin-bottom: 22px;}
.tab {
  padding: 10px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-400);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all 200ms ease;
}
.tab:hover { color: var(--ink-800); }
.tab.active { color: var(--ink-900); border-bottom-color: var(--coral-500); }
.tab .count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-300); margin-left: 6px; font-weight: 500;}

/* agent row */
.agent-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto auto;
  gap: 20px; align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--cream-300);
  transition: background 200ms ease;
  cursor: pointer;
}
.agent-row:last-child { border-bottom: 0; }
.agent-row:hover { background: rgba(255,255,255,0.6); }
.agent-row:hover .agent-row-title { color: var(--coral-600);}
.agent-row-title {
  font-weight: 600; font-size: 15px; color: var(--ink-900);
  display: flex; align-items: center; gap: 10px;
  transition: color 200ms ease;
}
.agent-row-desc { font-size: 12.5px; color: var(--ink-400); margin-top: 3px;}
.agent-row-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-400); text-align: right;}
.agent-row-meta b { color: var(--ink-800); font-weight: 600;}

@media (max-width: 720px){
  .agent-row { grid-template-columns: 40px 1fr auto; gap: 14px; }
  .agent-row .hide-sm { display: none; }
}

/* ---------- time picker ---------- */
.time-picker { display: flex; flex-direction: column; gap: 16px; }
.tp-display {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  background: var(--cream-50);
  border: 1px solid var(--cream-300);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
}
.tp-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tp-num {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: 8px;
  min-width: 76px;
  text-align: center;
}
.tp-sep {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 600;
  color: var(--coral-500);
  line-height: 1;
  padding-bottom: 18px;
}
.tp-lbl { font-size: 10px; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600; margin-top: 2px; }
.tp-bump {
  width: 28px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-400);
  border-radius: 6px;
  transition: all 150ms ease;
}
.tp-bump:hover { color: var(--coral-600); background: var(--cream-200); }
.tp-bump .flip { transform: rotate(180deg); }
.tp-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tp-preset {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--cream-300);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  transition: all 180ms ease;
}
.tp-preset:hover { border-color: var(--ink-200); }
.tp-preset.active { border-color: var(--coral-500); background: rgba(217,119,87,0.06); }
.tp-preset-time { font-size: 12px; font-weight: 600; color: var(--ink-900); }
.tp-preset-label { font-size: 10.5px; color: var(--ink-400); }

/* ---------- schedule clock legacy (kept empty to avoid unused warn) ---------- */

/* ---------- segmented ---------- */
.segmented {
  display: inline-flex;
  background: var(--cream-200);
  border: 1px solid var(--cream-300);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-500);
  transition: all 200ms ease;
}
.segmented button.active { background: #fff; color: var(--ink-900); box-shadow: 0 1px 2px rgba(26,16,8,0.06); }

/* run list */
.run-item {
  display: grid;
  grid-template-columns: 12px auto 1fr auto auto;
  gap: 14px; align-items: center;
  padding: 12px 2px;
  border-bottom: 1px dashed var(--cream-300);
  font-size: 13px;
}
.run-item:last-child { border-bottom: 0;}
.run-item .r-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald-400); }
.run-item.err .r-dot { background: var(--red-500);}
.run-item .r-ts { font-family: var(--font-mono); color: var(--ink-500); font-size: 12px;}
.run-item .r-sum { color: var(--ink-700, var(--ink-800)); }
.run-item .r-dur { font-family: var(--font-mono); color: var(--ink-400); font-size: 11.5px;}

/* kbd */
.kbd {
  display: inline-block;
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--cream-100);
  border: 1px solid var(--cream-300);
  border-bottom-width: 2px;
  color: var(--ink-500);
}

/* toggle */
.toggle { position: relative; width: 34px; height: 20px; flex-shrink: 0;}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slot {
  position: absolute; inset: 0;
  background: var(--cream-300);
  border-radius: 999px;
  transition: background 200ms ease;
  cursor: pointer;
}
.toggle-slot::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(26,16,8,0.18);
  transition: transform 200ms ease;
}
.toggle input:checked + .toggle-slot { background: var(--coral-500);}
.toggle input:checked + .toggle-slot::before { transform: translateX(14px);}

/* connection card */
.conn-card {
  border: 1px solid var(--cream-300);
  border-radius: var(--radius-xl);
  padding: 18px;
  background: rgba(255,255,255,0.7);
  display: flex; flex-direction: column; gap: 14px;
  transition: all 200ms ease;
}
.conn-card.connected { border-color: rgba(47,158,102,0.25); background: rgba(237,247,241,0.4); }

/* email item */
.email-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 14px; align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  transition: all 200ms ease;
}
.email-item:hover { background: var(--cream-100); border-color: var(--cream-300);}
.email-item.del { opacity: 0.6;}
.email-item.del .e-subj { text-decoration: line-through; text-decoration-color: var(--red-400); text-decoration-thickness: 1px;}
.e-from { color: var(--ink-500); font-size: 12px; margin-top: 2px; }
.e-reason { font-size: 11.5px; color: var(--ink-400); font-style: italic; }

/* finding */
.finding {
  padding: 14px 16px; border-radius: var(--radius-lg);
  border: 1px solid var(--cream-300); background: #fff;
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: flex-start;
}
.finding.sev-hi { border-left: 3px solid var(--red-500); }
.finding.sev-med { border-left: 3px solid var(--amber-400); }
.finding.sev-lo { border-left: 3px solid var(--ink-200); }
.finding-code {
  font-family: var(--font-mono); font-size: 11.5px;
  background: var(--cream-100); padding: 2px 6px; border-radius: 4px;
  color: var(--ink-700, var(--ink-800));
  display: inline-block;
}
.finding-path { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400);}

/* tape */
.tape {
  position: absolute;
  width: 64px; height: 18px;
  background: rgba(217,119,87,0.22);
  top: -8px; left: 22px;
  transform: rotate(-3deg);
  box-shadow: 0 1px 2px rgba(26,16,8,0.05);
}

/* ── Bottom nav (mobile only, hidden by default) ──────────── */
.bottom-nav { display: none; }
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px 4px;
  cursor: pointer;
  color: var(--ink-300);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 180ms ease;
  position: relative;
}
.bottom-nav-item .bn-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  transition: background 180ms ease, transform 150ms ease;
}
.bottom-nav-item.active { color: var(--coral-600); }
.bottom-nav-item.active .bn-icon {
  background: rgba(217,119,87,0.12);
  transform: translateY(-1px);
}
.bottom-nav-item.active svg { stroke: var(--coral-600); }

/* ── Tablet (≤ 860px): navlinks tighten up ───────────────── */
@media (max-width: 860px) {
  .navbar-inner { padding: 0 18px; gap: 16px; }
  .brand-sub { display: none; }
  .navlink { padding: 7px 10px; font-size: 13px; }
  .navlinks { gap: 2px; margin-left: 4px; }
}

/* ── Small tablet / large phone (≤ 700px): navlinks hidden ── */
@media (max-width: 700px) {
  .navlinks { display: none; }
  .navbar-inner { padding: 0 16px; gap: 0; }
  .nav-right { margin-left: auto; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(248, 242, 230, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--cream-300);
    box-shadow: 0 -4px 20px rgba(26,16,8,0.06);
  }

  .page { padding: 20px 16px 80px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
  .page-head-copy { max-width: 100%; }
  .h-display { font-size: 26px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-main { grid-template-columns: 1fr; gap: 14px; }
  .agent-row { grid-template-columns: 40px 1fr auto; gap: 12px; padding: 14px 16px; }
  .agent-row .hide-sm { display: none; }
  .card-pad { padding: 16px; }
  .card-pad-lg { padding: 18px; }
  .card-head { padding: 12px 16px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
  .segmented button { padding: 5px 9px; font-size: 12px; }
  .stamp { transform: rotate(0deg); }
  .margin-note { display: none; }
  .settings-sidebar { flex-direction: row !important; overflow-x: auto; gap: 4px !important; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .settings-sidebar .navlink { white-space: nowrap; flex-shrink: 0; }
  .conn-card { min-height: auto !important; padding: 16px; }
  .conn-security { grid-template-columns: auto 1fr !important; }
  .conn-security .btn { display: none; }
  .run-item { grid-template-columns: 8px 1fr auto !important; gap: 10px; }
  .run-item .r-ts { display: none; }
  .stat-val { font-size: 22px; }
}

/* ── Phone (≤ 480px): tighten further ───────────────────── */
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .tp-num { font-size: 34px; min-width: 58px; }
  .tp-sep { font-size: 28px; }
  .tp-presets { grid-template-columns: 1fr 1fr; }
  .terminal { font-size: 11px; }
  .term-ts { display: none; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 94vh; border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; }
  .modal-step3-grid { grid-template-columns: 1fr !important; }
}

/* ── Small phone (≤ 380px) ───────────────────────────────── */
@media (max-width: 380px) {
  .grid-4 { grid-template-columns: 1fr; }
  .tp-num { font-size: 28px; min-width: 50px; }
  .bottom-nav-item { font-size: 8.5px; }
  .bottom-nav-item .bn-icon { width: 28px; height: 28px; border-radius: 8px; }
}
