/*
 * Reachype Outbound panel. Design language borrowed from the Startup Society design system
 * (apple.com rhythm: white space, rounded tiles, pill buttons, glass chrome, night-navy console sidebar).
 * Layers: 1 brand palette -> 2 neutrals -> 3 semantic roles. Components only use layer 3.
 */
:root {
  --brand-primary: #0038cc;
  --brand-secondary: #00124d;
  --brand-accent: #0055ff;
  --brand-text: #050a1f;

  --gray-50: #f5f5f7;
  --gray-100: #eeeef2;
  --gray-200: #e4e5eb;
  --gray-300: #d2d3db;
  --gray-400: #a4a7b5;
  --gray-500: #7c7f8f;
  --gray-600: #626577;
  --gray-800: #2a2d3d;

  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);

  --background: #fff;
  --foreground: var(--brand-text);
  --card: #fff;
  --primary: var(--brand-primary);
  --primary-hover: var(--brand-accent);
  --primary-foreground: #fff;
  --link: var(--brand-primary);
  --dot: var(--brand-accent);
  --secondary: var(--gray-100);
  --muted: var(--gray-50);
  --muted-foreground: var(--gray-600);
  --accent: #edf2ff;
  --accent-foreground: var(--brand-primary);
  --subtle: var(--gray-50);
  --destructive: #d1001c;
  --destructive-soft: #fdecee;
  --success: #18733a;
  --success-soft: #e6f4ea;
  --warning: #a64b00;
  --warning-soft: #fdf0e1;
  --info: var(--brand-primary);
  --info-soft: #edf2ff;
  --border: var(--gray-200);
  --input: var(--gray-300);
  --ring: var(--brand-accent);

  --shadow-raised: 0 1px 2px rgb(5 10 31 / 0.04), 0 2px 12px rgb(5 10 31 / 0.04);
  --shadow-card: 0 1px 2px rgb(5 10 31 / 0.03), 0 8px 28px -6px rgb(5 10 31 / 0.08);
  --shadow-overlay: 0 24px 56px -12px rgb(5 10 31 / 0.22), 0 4px 12px rgb(5 10 31 / 0.06);
  --glass: rgb(255 255 255 / 0.72);
  --glass-border: rgb(5 10 31 / 0.08);
  --ease-apple: cubic-bezier(0.28, 0.11, 0.32, 1);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --header-height: 4.5rem;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-heading: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

/* Night: the console sidebar and the login panel. */
.surface-inverse {
  --background: var(--brand-text);
  --foreground: #f5f6fa;
  --card: #0b1433;
  --muted: #101a3d;
  --muted-foreground: #a3a9c2;
  --secondary: #16214a;
  --accent: #16214a;
  --primary: var(--brand-accent);
  --link: #5c8bff;
  --border: rgb(255 255 255 / 0.1);
  --ring: #5c8bff;
  background-color: var(--background);
  color: var(--foreground);
  color-scheme: dark;
}
.glow-brand {
  background-image:
    radial-gradient(60% 50% at 80% 100%, rgb(0 85 255 / 0.35), transparent 70%),
    radial-gradient(50% 60% at 100% 0%, rgb(0 56 204 / 0.35), transparent 70%),
    linear-gradient(180deg, var(--brand-text) 0%, var(--brand-secondary) 140%);
}

*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--subtle); color: var(--foreground); letter-spacing: -0.011em; font-size: 15px; line-height: 1.45; }
h1, h2, h3, h4 { font-family: var(--font-heading); margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background-color: rgb(0 85 255 / 0.2); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 3px solid rgb(0 85 255 / 0.35); outline-offset: 2px; }
[hidden] { display: none !important; }
svg.i { width: 1.1rem; height: 1.1rem; flex-shrink: 0; vertical-align: -0.2em; }
.crumbs svg.i { width: 0.9rem; height: 0.9rem; opacity: .5; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; width: 16rem; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid rgb(255 255 255 / 0.08); }
.sidebar .brand { height: var(--header-height); display: flex; align-items: center; gap: 0.6rem; padding: 0 1.25rem; }
.wordmark { font-family: var(--font-heading); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.045em; color: var(--foreground); }
.wordmark i { color: var(--dot); font-style: normal; }
.tag { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-foreground);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.5rem; }
.nav { flex: 1; overflow-y: auto; padding: 0.75rem; display: grid; gap: 1.4rem; align-content: start; }
.nav h2 { margin: 0 0 0.35rem; padding: 0 0.75rem; font-family: var(--font-sans); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: rgb(221 226 240 / 0.5); }
.nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 0.75rem; height: 2.25rem; padding: 0 0.75rem; border-radius: var(--radius-md); font-size: 0.875rem;
  color: rgb(221 226 240 / 0.8); text-decoration: none; transition: background-color .2s var(--ease-apple), color .2s var(--ease-apple); }
.nav a svg { width: 1.125rem; height: 1.125rem; color: var(--link); flex-shrink: 0; }
.nav a:hover { background: rgb(22 33 74 / 0.6); color: #fff; }
.nav a.active { background: #16214a; color: #fff; font-weight: 500; box-shadow: 0 1px 3px rgb(5 10 31 / 0.3); }
.nav .count { margin-left: auto; font-size: 0.6875rem; font-weight: 600; background: var(--brand-accent); color: #fff; border-radius: 999px; padding: 0.05rem 0.45rem; }
.sidebar-foot { padding: 1rem 1.25rem 1.25rem; font-size: 0.75rem; color: var(--muted-foreground); display: grid; gap: 0.5rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--header-height); display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1.5rem; border-bottom: 1px solid var(--glass-border); }
.glass { background-color: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.crumbs { font-size: 0.875rem; color: var(--muted-foreground); display: flex; gap: 0.4rem; align-items: center; min-width: 0; }
.crumbs b { color: var(--foreground); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.btn.menu-btn { display: none; }
.content { flex: 1; padding: 2.5rem 2.5rem 4rem; }
.page { max-width: 72rem; margin: 0 auto; width: 100%; animation: rise .35s var(--ease-spring); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- type */
.page-header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; padding-bottom: 2rem; }
.page-header h1 { font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem); line-height: 1.1; font-weight: 700; letter-spacing: -0.03em; }
.page-header p { margin-top: 0.5rem; max-width: 42rem; font-size: 0.9375rem; color: var(--muted-foreground); }
.page-header .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.eyebrow { font-size: 0.8125rem; letter-spacing: 0.02em; font-weight: 600; color: var(--link); }
.tracked { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted-foreground); }
.section-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; }
.section-desc { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted-foreground); }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.8125rem; }
.xs { font-size: 0.75rem; }
.mono { font-family: var(--font-mono); font-size: 0.8125rem; }
.num { font-variant-numeric: tabular-nums; }
.rule { display: block; width: 3rem; height: 3px; background: var(--dot); border-radius: 2px; }

/* ---------------------------------------------------------------- layout helpers */
.stack { display: grid; gap: 1.5rem; }
.stack-sm { display: grid; gap: 0.75rem; }
.row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid-4 { display: grid; gap: 0.75rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.grow { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); outline: 1px solid rgb(5 10 31 / 0.06); padding: 1.5rem; min-width: 0; }
.card.tight { padding: 1rem 1.25rem; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.card-head h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.015em; }
.card-head p { font-size: 0.8125rem; color: var(--muted-foreground); margin-top: 0.15rem; }
.stat { background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-raised); outline: 1px solid rgb(5 10 31 / 0.06); padding: 1.1rem 1.2rem;
  display: block; color: inherit; text-decoration: none; transition: outline-color .2s var(--ease-apple), transform .2s var(--ease-apple); }
a.stat:hover { outline-color: rgb(5 10 31 / 0.25); text-decoration: none; }
.stat dt { font-size: 0.8125rem; color: var(--muted-foreground); display: flex; gap: 0.4rem; align-items: center; }
.stat dd { margin: 0.25rem 0 0; font-family: var(--font-heading); font-size: 1.9rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat .detail { margin: 0.2rem 0 0; font-size: 0.75rem; color: var(--muted-foreground); font-family: var(--font-sans); font-weight: 400; letter-spacing: 0; }
.hero { border-radius: var(--radius-2xl); padding: 2rem; position: relative; overflow: hidden; }
.hero h2 { font-size: clamp(1.5rem, 1.3rem + 0.9vw, 2.125rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.hero p { color: var(--muted-foreground); margin-top: 0.5rem; max-width: 36rem; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; height: 2.25rem; padding: 0 1rem; border-radius: 999px;
  border: 1px solid transparent; font-size: 0.875rem; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; cursor: pointer; user-select: none;
  background: var(--primary); color: var(--primary-foreground); text-decoration: none;
  transition: background-color .2s var(--ease-apple), border-color .2s var(--ease-apple), color .2s var(--ease-apple), transform .2s var(--ease-apple); }
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn svg { width: 1rem; height: 1rem; }
.btn.lg { height: 2.75rem; padding: 0 1.4rem; font-size: 0.9375rem; }
.btn.sm { height: 2rem; padding: 0 0.85rem; font-size: 0.8125rem; }
.btn.tinted { background: var(--accent); color: var(--accent-foreground); }
.btn.tinted:hover { background: #dfe7ff; }
.btn.outline { background: transparent; color: var(--foreground); border-color: var(--input); }
.btn.outline:hover { background: var(--muted); border-color: rgb(5 10 31 / 0.25); }
.btn.ghost { background: transparent; color: var(--foreground); }
.btn.ghost:hover { background: var(--muted); }
.btn.danger { background: var(--destructive-soft); color: var(--destructive); }
.btn.danger:hover { background: #f9d9dd; }
.btn.solid-danger { background: var(--destructive); color: #fff; }
.btn.solid-danger:hover { background: #b00018; }
.btn.icon { width: 2.25rem; padding: 0; }

/* ---------------------------------------------------------------- badges / pills */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; height: 1.35rem; padding: 0 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500;
  white-space: nowrap; background: var(--secondary); color: var(--foreground); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.red { background: var(--destructive-soft); color: var(--destructive); }
.badge.ink { background: var(--brand-text); color: #fff; }
.pill-state { display: inline-flex; align-items: center; gap: 0.45rem; height: 2rem; padding: 0 0.85rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
  background: var(--card); outline: 1px solid var(--border); }
.pill-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.pill-state.paused .dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.pill-state.killed .dot { background: var(--destructive); box-shadow: 0 0 0 3px var(--destructive-soft); }

/* ---------------------------------------------------------------- segmented control / tabs */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--secondary); border-radius: 999px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; height: 1.9rem; padding: 0 0.85rem; border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
  color: var(--muted-foreground); cursor: pointer; display: inline-flex; gap: 0.35rem; align-items: center; transition: background-color .2s var(--ease-apple), color .2s; }
.segmented button:hover { color: var(--foreground); }
.segmented button.on { background: var(--card); color: var(--foreground); box-shadow: 0 1px 3px rgb(5 10 31 / 0.12); }
.segmented .n { font-size: 0.6875rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- inputs */
.input, .select, .textarea { width: 100%; height: 2.75rem; padding: 0 0.9rem; border: 1px solid var(--input); border-radius: var(--radius); background: var(--card);
  outline: none; transition: border-color .2s, box-shadow .2s; font-size: 0.9375rem; }
.textarea { height: auto; min-height: 6rem; padding: 0.7rem 0.9rem; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ring); box-shadow: 0 0 0 4px rgb(0 85 255 / 0.15); }
.search { position: relative; flex: 1; min-width: 14rem; max-width: 24rem; }
.search svg { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--muted-foreground); }
.search .input { padding-left: 2.4rem; height: 2.4rem; border-radius: 999px; background: var(--card); }
label.field { display: grid; gap: 0.4rem; font-size: 0.8125rem; font-weight: 500; }
label.field .hint { font-weight: 400; color: var(--muted-foreground); font-size: 0.75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.4rem; min-height: 2.75rem; border: 1px solid var(--input); border-radius: var(--radius); background: var(--card); }
.chips:focus-within { border-color: var(--ring); box-shadow: 0 0 0 4px rgb(0 85 255 / 0.15); }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; height: 1.85rem; padding: 0 0.4rem 0 0.75rem; border-radius: 999px; background: var(--accent);
  color: var(--accent-foreground); font-size: 0.8125rem; font-weight: 500; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center; }
.chip button:hover { background: rgb(0 56 204 / 0.12); }
.chip.plain { background: var(--secondary); color: var(--foreground); padding: 0 0.75rem; }
.chips input { border: 0; outline: none; flex: 1; min-width: 8rem; height: 1.85rem; padding: 0 0.4rem; background: transparent; font-size: 0.875rem; }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.t th { height: 2.6rem; padding: 0 1rem; text-align: left; font-weight: 500; font-size: 0.75rem; color: var(--muted-foreground); white-space: nowrap;
  border-bottom: 1px solid var(--border); background: var(--card); }
.t td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background-color .15s; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover { background: rgb(245 245 247 / 0.8); }
.t .title { font-weight: 500; }
.t .sub { font-size: 0.8125rem; color: var(--muted-foreground); margin-top: 0.1rem; max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t td.right, .t th.right { text-align: right; }
.empty { padding: 3.5rem 1rem; text-align: center; color: var(--muted-foreground); }
.empty h3 { color: var(--foreground); font-size: 1.05rem; margin-bottom: 0.35rem; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; border-top: 1px solid var(--border); font-size: 0.8125rem; color: var(--muted-foreground); }

/* ---------------------------------------------------------------- meters / charts */
.meter { height: 6px; background: var(--secondary); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: inherit; width: 0; transition: width .6s var(--ease-spring); }
.meter.green > i { background: var(--success); }
.meter.amber > i { background: var(--warning); }
.meter.red > i { background: var(--destructive); }
.fitcell { display: grid; grid-template-columns: 2.2rem 4.5rem; gap: 0.5rem; align-items: center; }
.funnel { display: grid; gap: 0.7rem; }
.funnel .step { display: grid; grid-template-columns: 9.5rem 1fr 3.5rem; gap: 0.9rem; align-items: center; font-size: 0.875rem; }
.funnel .bar { height: 1.65rem; background: var(--muted); border-radius: 0.5rem; overflow: hidden; }
.funnel .bar > i { display: block; height: 100%; width: 0; border-radius: 0.5rem; background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  transition: width .7s var(--ease-spring); min-width: 2px; }
.funnel .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 13rem; display: block; }
.chart .grid line { stroke: var(--gray-200); stroke-width: 1; }
.chart text { fill: var(--gray-500); font-size: 10px; font-family: var(--font-sans); }
.legend { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--muted-foreground); }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.c1 { background: var(--brand-primary); fill: var(--brand-primary); }
.c2 { background: #7fa2ff; fill: #7fa2ff; }
.c3 { background: var(--success); fill: var(--success); }
.ring { width: 7.5rem; height: 7.5rem; }
.ring .track { stroke: var(--secondary); }
.ring .val { stroke: var(--brand-primary); transition: stroke-dashoffset .8s var(--ease-spring); }
.ring text { font-family: var(--font-heading); font-weight: 600; fill: var(--foreground); }

/* ---------------------------------------------------------------- lists */
.list { display: grid; }
.list .item { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.list .item:last-child { border-bottom: 0; }
.list .ic { width: 2rem; height: 2rem; border-radius: 0.65rem; display: grid; place-items: center; flex-shrink: 0; background: var(--accent); color: var(--primary); }
.list .ic svg { width: 1rem; height: 1rem; }
.list .ic.warn { background: var(--warning-soft); color: var(--warning); }
.list .ic.crit { background: var(--destructive-soft); color: var(--destructive); }
.list .ic.ok { background: var(--success-soft); color: var(--success); }
.kv { display: grid; grid-template-columns: 10rem 1fr; gap: 0.55rem 1rem; font-size: 0.875rem; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.attention { display: grid; gap: 0.5rem; }
.attention a { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-raised);
  outline: 1px solid rgb(5 10 31 / 0.06); color: var(--foreground); text-decoration: none; font-size: 0.9rem; transition: outline-color .2s; }
.attention a:hover { outline-color: rgb(5 10 31 / 0.25); }
.attention a .go { margin-left: auto; color: var(--muted-foreground); }
.process { display: flex; align-items: center; gap: 0.6rem; font-size: 0.875rem; padding: 0.55rem 0; }
.process .led { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-300); }
.process .led.on { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.process .led.off { background: var(--destructive); box-shadow: 0 0 0 3px var(--destructive-soft); }

/* ---------------------------------------------------------------- email preview */
.mail { border-radius: var(--radius-xl); background: var(--card); box-shadow: var(--shadow-card); outline: 1px solid rgb(5 10 31 / 0.06); overflow: hidden; }
.mail-head { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: grid; gap: 0.35rem; font-size: 0.875rem; }
.mail-head .subj { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 0.35rem; }
.mail-head .meta { display: grid; grid-template-columns: 3.5rem 1fr; gap: 0.25rem 0.5rem; color: var(--muted-foreground); }
.mail-head .meta b { color: var(--foreground); font-weight: 500; overflow-wrap: anywhere; }
.avatar { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent)); flex-shrink: 0; }
.mail-body { padding: 1.5rem; white-space: pre-wrap; font-size: 0.975rem; line-height: 1.65; overflow-wrap: anywhere; }
.mail-foot { padding: 0.85rem 1.5rem; border-top: 1px solid var(--border); background: var(--muted); font-size: 0.75rem; color: var(--muted-foreground); display: flex; gap: 1rem; flex-wrap: wrap; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 1rem; font-size: 0.8125rem; }
.checks span { display: flex; align-items: center; gap: 0.4rem; }
.checks svg { width: 0.9rem; height: 0.9rem; flex-shrink: 0; }
.ok-ic { color: var(--success); }
.bad-ic { color: var(--destructive); }
.quote { border-left: 3px solid var(--dot); padding: 0.15rem 0 0.15rem 0.85rem; font-size: 0.875rem; color: var(--foreground); }
.quote cite { display: block; font-style: normal; font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.25rem; overflow-wrap: anywhere; }
.timeline { display: grid; position: relative; }
.timeline .ev { display: grid; grid-template-columns: 1rem 1fr; gap: 0.75rem; padding-bottom: 1rem; position: relative; }
.timeline .ev::before { content: ""; position: absolute; left: calc(0.5rem - 1px); top: 1rem; bottom: 0; width: 2px; background: var(--border); }
.timeline .ev:last-child::before { display: none; }
.timeline .pt { width: 1rem; height: 1rem; border-radius: 50%; border: 3px solid var(--card); background: var(--brand-accent); box-shadow: 0 0 0 1px var(--border); margin-top: 0.15rem; }
.timeline .what { font-size: 0.875rem; font-weight: 500; }
.timeline .when { font-size: 0.75rem; color: var(--muted-foreground); }

/* ---------------------------------------------------------------- overlays */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgb(5 10 31 / 0.32); display: grid; place-items: center; padding: 1rem;
  animation: fade .2s var(--ease-apple); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog { width: min(30rem, 100%); background: var(--card); border-radius: var(--radius-2xl); box-shadow: var(--shadow-overlay); padding: 1.75rem; animation: pop .28s var(--ease-spring); }
.dialog h3 { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; }
.dialog p { margin-top: 0.5rem; color: var(--muted-foreground); font-size: 0.9rem; }
.dialog .actions { margin-top: 1.5rem; display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } }
.toasts { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 0.5rem; width: min(28rem, calc(100% - 2rem)); }
.toast { background: var(--brand-text); color: #fff; padding: 0.8rem 1.1rem; border-radius: var(--radius); box-shadow: var(--shadow-overlay); font-size: 0.875rem;
  display: flex; gap: 0.6rem; align-items: flex-start; animation: pop .3s var(--ease-spring); }
.toast.err { background: var(--destructive); }
.toast svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.loading { display: grid; place-items: center; padding: 4rem; color: var(--muted-foreground); }
.spinner { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2.5px solid var(--gray-200); border-top-color: var(--brand-primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--gray-100), var(--gray-50), var(--gray-100)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 0.5rem; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- login */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--background); }
.auth .art { padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.poster { font-family: var(--font-heading); font-weight: 800; text-transform: uppercase; letter-spacing: -0.04em; line-height: 1.02; font-size: clamp(3rem, 1rem + 5.4vw, 6rem); padding-top: 0.12em; }
.poster i { color: var(--dot); font-style: normal; }
.auth .form-side { display: grid; place-items: center; padding: 2rem; }
.auth form { width: min(22rem, 100%); display: grid; gap: 1rem; }
.auth h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.err-text { color: var(--destructive); font-size: 0.8125rem; min-height: 1.2em; }

/* ---------------------------------------------------------------- control panel */
.control-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.tile { border-radius: var(--radius-2xl); padding: 1.5rem; background: var(--card); box-shadow: var(--shadow-card); outline: 1px solid rgb(5 10 31 / 0.06); display: grid; gap: 0.75rem; align-content: start; }
.tile h3 { font-size: 1.05rem; font-weight: 600; }
.tile p { font-size: 0.85rem; color: var(--muted-foreground); }
.tile.alert { background: var(--brand-text); color: #fff; outline: 0; }
.tile.alert p { color: #a3a9c2; }
.banner { border-radius: var(--radius-xl); padding: 1rem 1.25rem; display: flex; gap: 0.85rem; align-items: center; font-size: 0.9rem; }
.banner svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.banner.killed { background: var(--destructive); color: #fff; }
.banner.paused { background: var(--warning-soft); color: var(--warning); }
.banner.dry { background: var(--info-soft); color: var(--info); }
.banner .btn { margin-left: auto; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .control-tiles { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 70; left: 0; top: 0; transform: translateX(-100%); transition: transform .3s var(--ease-spring); box-shadow: var(--shadow-overlay); }
  .shell.nav-open .sidebar { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .content { padding: 1.5rem 1rem 3rem; }
  .topbar { padding: 0 1rem; }
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth .art { min-height: 16rem; padding: 2rem; }
  .kv { grid-template-columns: 1fr; gap: 0.15rem; }
  .kv dd { margin-bottom: 0.5rem; }
  .funnel .step { grid-template-columns: 7rem 1fr 3rem; }
  .checks { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .pill-state .mode-txt { display: none; }
  .mail-head .avatar { display: none; }
  .crumbs a { white-space: nowrap; }
  .page-header .actions { width: 100%; }
}

.reply-text { white-space: pre-wrap; font-size: 0.95rem; line-height: 1.6; margin: 0.75rem 0 1rem; padding: 1rem 1.1rem; background: var(--muted); border-radius: var(--radius); overflow-wrap: anywhere; }
pre { overflow-x: auto; white-space: pre-wrap; margin: 1rem 0 0; }
details summary { cursor: pointer; }
.stack > details.card { padding: 1rem 1.5rem; }

.card.flush > .card-head { padding: 1.5rem 1.5rem 0; }
.tile.alert { --link: #5c8bff; }
.card.stack { display: grid; gap: 1.5rem; }
.card.stack > .card-head { margin-bottom: 0; }
.divider { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.stack > .segmented { justify-self: start; }
