/* FormRelay: one hand-written stylesheet, in the DomoDomu apps' style (Engage, LandlordOS, PraxiOS): 14px Inter,
   slate neutrals, hairline borders, tinted status colors, a fixed sidebar and a blurred top bar. FormRelay's brand is
   teal. Tokens (light, then dark), the app shell, then components. Dark mode follows the system unless the theme
   button picked one (<html data-theme>, saved in this browser). */
:root {
  --brand: #0F766E;
  --brand-hover: #0B5E58;
  --brand-50: #EEF8F6;
  --brand-100: #CDEBE6;
  --brand-ink: #FFFFFF;
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F2F4F7;
  --line: #E6E8EC;
  --line-strong: #D0D5DD;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --placeholder: #98A2B3;
  --success: #067647; --success-bg: #ECFDF3; --success-line: #ABEFC6;
  --warning: #B54708; --warning-bg: #FFFAEB; --warning-line: #FEDF89;
  --danger: #D92D20;  --danger-bg: #FEF3F2;  --danger-line: #FECDCA;
  --info: #175CD3;    --info-bg: #EFF8FF;    --info-line: #B2DDFF;
  --tok-tag: #0F766E; --tok-attr: #9A3412; --tok-str: #1D4ED8; --tok-kw: #7C3AED; --tok-com: #667085;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --sidebar-w: 248px;
  --topbar-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2DD4BF; --brand-hover: #5EEAD4; --brand-50: rgba(45, 212, 191, .12); --brand-100: rgba(45, 212, 191, .26); --brand-ink: #042F2E;
    --bg: #0B0E14; --surface: #12161F; --surface-2: #161B26; --surface-3: #1C2230;
    --line: #252C3A; --line-strong: #344054;
    --text: #F2F4F7; --text-2: #C3CAD5; --text-3: #8A94A6; --placeholder: #667085;
    --success: #47CD89; --success-bg: rgba(71, 205, 137, .12); --success-line: rgba(71, 205, 137, .32);
    --warning: #FDB022; --warning-bg: rgba(253, 176, 34, .12); --warning-line: rgba(253, 176, 34, .32);
    --danger: #F97066;  --danger-bg: rgba(249, 112, 102, .12); --danger-line: rgba(249, 112, 102, .32);
    --info: #53B1FD;    --info-bg: rgba(83, 177, 253, .12);   --info-line: rgba(83, 177, 253, .32);
    --tok-tag: #5EEAD4; --tok-attr: #FDBA74; --tok-str: #93C5FD; --tok-kw: #C4B5FD; --tok-com: #8A94A6;
    --shadow-xs: none; --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #2DD4BF; --brand-hover: #5EEAD4; --brand-50: rgba(45, 212, 191, .12); --brand-100: rgba(45, 212, 191, .26); --brand-ink: #042F2E;
  --bg: #0B0E14; --surface: #12161F; --surface-2: #161B26; --surface-3: #1C2230;
  --line: #252C3A; --line-strong: #344054;
  --text: #F2F4F7; --text-2: #C3CAD5; --text-3: #8A94A6; --placeholder: #667085;
  --success: #47CD89; --success-bg: rgba(71, 205, 137, .12); --success-line: rgba(71, 205, 137, .32);
  --warning: #FDB022; --warning-bg: rgba(253, 176, 34, .12); --warning-line: rgba(253, 176, 34, .32);
  --danger: #F97066;  --danger-bg: rgba(249, 112, 102, .12); --danger-line: rgba(249, 112, 102, .32);
  --info: #53B1FD;    --info-bg: rgba(83, 177, 253, .12);   --info-line: rgba(83, 177, 253, .32);
  --tok-tag: #5EEAD4; --tok-attr: #FDBA74; --tok-str: #93C5FD; --tok-kw: #C4B5FD; --tok-com: #8A94A6;
  --shadow-xs: none; --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
h1 { font-size: 24px; line-height: 1.25; font-weight: 650; margin: 0; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 15px; line-height: 1.35; font-weight: 600; margin: 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 12px; }
code, pre { font-family: var(--mono); font-size: 0.86em; font-variant-ligatures: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
[hidden], [data-hidden-tab] { display: none !important; }
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
h2 > .icon { color: var(--text-3); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-3); }
.small, .hint { font-size: 12.5px; }
.hint { color: var(--text-3); display: block; margin: 6px 0 0; font-weight: 400; }
.optional { color: var(--text-3); font-weight: 400; font-size: 12.5px; margin-left: 4px; }
.kbd { font: 500 11px/1 var(--mono); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-3); }

/* ---------- Brand ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; letter-spacing: -0.015em; }
.wordmark:hover { color: var(--text); }
.logo { width: 28px; height: 28px; color: var(--brand); flex: none; }

/* ---------- Shell: fixed sidebar, sticky blurred top bar, centered content ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 50; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px 12px; overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 18px; }
.plan-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--brand-50); color: var(--brand); border: 1px solid var(--brand-100); }
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 500; min-width: 0;
}
.nav-item .icon { width: 18px; height: 18px; color: var(--text-3); vertical-align: 0; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.is-active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav-item.is-active .icon { color: var(--brand); }
.nav-muted { color: var(--text-3); }
.nav-group { margin-top: 18px; display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3);
}
.nav-label .count { font-weight: 500; margin-left: 4px; }
.nav-add { color: var(--text-3); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); }
.nav-add:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-50); }
.nav-add .icon { width: 13px; height: 13px; vertical-align: 0; }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px 19px; padding-left: 8px; border-left: 1px solid var(--line); }
.nav-sub .nav-item { font-size: 13px; padding: 5px 9px; }
.nav-sub .nav-item .icon { width: 16px; height: 16px; }
.dot-paused { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); margin-left: auto; flex: none; }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 12px; }
.usage-mini { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); text-decoration: none; color: var(--text); }
.usage-mini:hover { color: var(--text); border-color: var(--line-strong); }
.usage-mini-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-bottom: 7px; }
.usage-mini-text strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* The account menu: a drop-up at the sidebar's foot. */
.account-menu > summary {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); cursor: pointer; list-style: none;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: var(--surface-3); }
.account-who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.account-email { font-size: 13px; font-weight: 600; color: var(--text); }
.account-role { font-size: 12px; color: var(--text-3); }
.account-menu .menu-panel { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; min-width: 0; }
.account-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #6366F1)); color: #fff; font-weight: 650; font-size: 13px;
}
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

.icon-button {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid transparent;
  background: none; color: var(--text-2); cursor: pointer; padding: 0;
}
.icon-button:hover { background: var(--surface-3); color: var(--text); }
.icon-button.is-done { color: var(--success); }
.icon-button .icon { width: 18px; height: 18px; vertical-align: 0; }
.icon-button-small { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.icon-button-small .icon { width: 15px; height: 15px; }

.shell-main { margin-left: var(--sidebar-w); min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; width: min(380px, 100%); height: 36px; padding: 0 8px 0 11px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text-3);
  font: inherit; font-size: 13.5px; cursor: pointer; box-shadow: var(--shadow-xs); text-align: left;
}
.search-trigger:hover { border-color: var(--line-strong); color: var(--text-2); }
.search-trigger span:first-of-type { flex: 1; }
.mobile-only { display: none !important; }
.mobile-bar { display: none; }
.content { width: 100%; max-width: 1200px; margin: 0 auto; padding: 28px 28px 64px; }
.scrim { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 45; }

/* Theme button: shows the icon of the theme it switches to. */
[data-theme-toggle] .i-moon { display: none; }
:root[data-theme="light"] [data-theme-toggle] .i-moon { display: block; }
:root[data-theme="light"] [data-theme-toggle] .i-sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) [data-theme-toggle] .i-moon { display: block; }
  :root:not([data-theme]) [data-theme-toggle] .i-sun { display: none; }
}

/* Command palette: jump to any form or page (Ctrl K). */
.palette { border: 0; padding: 0; background: none; width: min(620px, calc(100vw - 32px)); margin: 12vh auto auto; color: var(--text); }
.palette::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
.palette-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.palette-search input { border: 0 !important; box-shadow: none !important; padding: 16px 0 !important; font-size: 15px !important; background: none !important; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-list a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 13.5px; }
.palette-list a .icon { color: var(--text-3); }
.palette-list a .palette-kind { margin-left: auto; font-size: 12px; color: var(--text-3); }
.palette-list a.is-current, .palette-list a:hover { background: var(--brand-50); color: var(--brand); }
.palette-list a.is-current .icon { color: var(--brand); }
.palette-empty { padding: 18px; text-align: center; color: var(--text-3); font-size: 13px; }
.palette-foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12px; color: var(--text-3); }

/* ---------- Sign-in and other public pages: one centered card ---------- */
body.auth { min-height: 100vh; background: radial-gradient(900px 480px at 50% -10%, var(--brand-50), transparent 70%) no-repeat, var(--bg); }
.auth-top { display: flex; justify-content: center; padding: 56px 16px 4px; }
.auth-top .wordmark { font-size: 18px; font-weight: 800; }
.auth-top .logo { width: 36px; height: 36px; }
.auth-main { max-width: 450px; margin: 0 auto; padding: 24px 16px 40px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 32px 28px; box-shadow: var(--shadow-sm); }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .stack { margin-top: 20px; }
.auth-points { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 8px; color: var(--text-2); font-size: 13.5px; }
.auth-points li { display: flex; gap: 8px; }
.auth-points li::before { content: "✓"; color: var(--brand); font-weight: 700; }
.site-footer { display: flex; gap: 16px; justify-content: center; color: var(--text-3); font-size: 12.5px; padding: 0 16px 28px; }
.site-footer a { color: var(--text-3); }

/* ---------- Page structure ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.subtitle { color: var(--text-2); margin: 4px 0 0; font-size: 14px; }
.head-actions { display: flex; gap: 8px; flex: none; }
.title-with-back { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.back-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text-2); background: var(--surface); flex: none; box-shadow: var(--shadow-xs); }
.back-button:hover { color: var(--text); background: var(--surface-2); }
.back-button .icon { vertical-align: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 6px 0 0; color: var(--text-3); font-size: 13px; }
.meta > * + *:not(.status)::before { content: "·"; margin-right: 12px; color: var(--line-strong); }
.count-badge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); letter-spacing: 0; border: 1px solid var(--line); }
.section-title { margin: 32px 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.narrow { max-width: 720px; }
.grid-2, .grid-3 { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 > .card, .grid-3 > .card { margin: 0; }
.span-2 { grid-column: span 2; }

/* ---------- Cards and lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow-xs); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -20px -20px 18px; padding: 14px 20px; border-bottom: 1px solid var(--line); min-height: 52px; }
.card.flush > .card-head { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.card-actions form { margin: 0; }
.card.empty { text-align: center; padding: 48px 20px; }
.card.empty .muted { max-width: 420px; margin: 6px auto 0; }
.card.empty h2 { justify-content: center; font-size: 16px; }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-50); color: var(--brand); display: inline-grid; place-items: center; margin-bottom: 14px; }
.empty-icon .icon { width: 26px; height: 26px; vertical-align: 0; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.empty-actions form { margin: 0; }
.empty-inline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.empty-inline p { margin: 0; }
.link-quiet { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 550; text-decoration: none; color: var(--text-2); }
.link-quiet:hover { color: var(--brand); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list-link, .row { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.list-link { color: var(--text); text-decoration: none; }
.list-link:hover { color: var(--text); }
.list-link:hover .item-title { color: var(--brand); }
.row form { margin: 0; }
.item-icon { width: 36px; height: 36px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; flex: none; }
.item-icon .icon { vertical-align: 0; }
.item-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; flex: 1; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-side { display: flex; align-items: center; gap: 14px; flex: none; }

/* ---------- Stats and chart ---------- */
.stat-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 10px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-value span { font-size: 14px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.stat-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--text-3); font-size: 12px; margin: 10px 0 0; }
.plan-name { font-size: 20px; font-weight: 700; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; letter-spacing: -0.015em; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: block; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; min-width: 3px; }
.meter.is-high > span { background: var(--warning); }
.meter.is-full > span { background: var(--danger); }
.chart { display: grid; grid-template-columns: auto 1fr; gap: 12px; height: 220px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--text-3); text-align: right; padding-bottom: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.chart-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; position: relative; }
.chart-bars::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(50% - 11px); border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); pointer-events: none; }
.chart-col { display: flex; flex-direction: column; min-width: 0; position: relative; }
.chart-bar-wrap { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line-strong); }
.chart-bar { display: block; width: 100%; max-width: 40px; margin: 0 auto; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 50%, transparent)); }
.chart-col:hover .chart-bar { background: var(--brand-hover); }
.chart-label { font-size: 11px; color: var(--text-3); text-align: center; padding-top: 6px; height: 22px; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 550; font-size: 13px; color: var(--text); }
.check { display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
input:not([type=checkbox]):not([type=hidden]):not([type=radio]), textarea, select {
  font: inherit; font-weight: 400; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 8px 12px; width: 100%; min-height: 40px; box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }
.field-error { color: var(--danger); font-size: 12.5px; font-weight: 400; }
.field-error:empty { display: none; }
.input-validation-error { border-color: var(--danger) !important; }
.input-validation-error:focus { box-shadow: 0 0 0 4px var(--danger-bg) !important; }
.code-input { letter-spacing: 0.4em; font-size: 22px !important; font-family: var(--mono) !important; max-width: 12ch; }
.inline-form { display: flex; gap: 8px; margin-top: 14px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.toggle { display: flex; align-items: flex-start; gap: 12px; font-size: 13.5px; font-weight: 550; cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 36px; height: 20px; border-radius: 99px; background: var(--line-strong); position: relative; flex: none; margin-top: 1px; transition: background .15s; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .25); transition: transform .15s; }
.toggle input:checked + .toggle-track { background: var(--brand); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.toggle small { display: block; color: var(--text-3); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
details.hint > summary { cursor: pointer; color: var(--text-2); font-weight: 550; }
details.hint ol { margin: 10px 0 8px; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); }

/* ---------- Buttons ---------- */
.button, .button-secondary, .button-danger {
  font: inherit; font-size: 13.5px; font-weight: 550; border-radius: var(--radius); padding: 7px 14px; min-height: 36px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.button .icon, .button-secondary .icon, .button-danger .icon { width: 17px; height: 17px; vertical-align: 0; }
.button { background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .12); }
.button:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.button-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs); }
.button-secondary:hover { background: var(--surface-2); color: var(--text); }
.button-secondary.is-done { border-color: var(--success-line); color: var(--success); background: var(--success-bg); }
.button-danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger-line); box-shadow: var(--shadow-xs); }
.button-danger:hover { background: var(--danger-bg); color: var(--danger); }
.button-small { min-height: 30px; padding: 5px 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.button-block { width: 100%; }
[aria-busy="true"] { opacity: .65; cursor: progress; }
.link-button { font: inherit; font-size: 13px; font-weight: 550; background: none; border: 0; padding: 4px 0; color: var(--brand); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--text-3); }
.link-button.danger:hover { color: var(--danger); }

/* ---------- Tabs, segmented control, menus ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 24px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-2); text-decoration: none; font-weight: 550; font-size: 13.5px; white-space: nowrap; }
.tab .icon { color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tab.is-active .icon { color: var(--brand); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.toolbar-note { color: var(--text-3); font-size: 12.5px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--radius); }
.segmented a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 7px; text-decoration: none; color: var(--text-2); font-size: 13px; font-weight: 550; }
.segmented a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 220px; max-height: 340px; overflow: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.menu-panel .check { padding: 6px 8px; border-radius: var(--radius-sm); }
.menu-panel .check:hover { background: var(--surface-3); }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border-radius: var(--radius-sm); border: 0; background: none;
  font: inherit; font-size: 13.5px; color: var(--text); text-decoration: none; cursor: pointer; text-align: left;
}
.menu-item .icon { color: var(--text-3); }
.menu-item:hover { background: var(--surface-3); color: var(--text); }
.menu-item.danger:hover, .menu-item.danger:hover .icon { color: var(--danger); background: var(--danger-bg); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.menu-panel form { margin: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-href] { cursor: pointer; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table td a { color: var(--text); text-decoration: none; }
.data-table td a:hover { color: var(--brand); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .pill + .pill { margin-left: 4px; }
.cell { display: block; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.row-title .icon { color: var(--text-3); }
.key-short { display: inline-flex; align-items: center; gap: 4px; }
.key-short code { color: var(--text-3); }

/* ---------- Badges and messages ---------- */
.pill, .status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 550; padding: 2px 9px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-3); color: var(--text-2); vertical-align: middle; white-space: nowrap; line-height: 18px;
}
.pill::before, .status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill-delivered, .pill-sent, .status-live { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.pill-received, .pill-pending, .pill-norecipients { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.pill-deliveryfailed, .pill-failed, .pill-spam { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.status-off { color: var(--text-3); }

/* Flash messages arrive as toasts at the bottom right (without the script they stay at the top of the page). */
.flash, .notice { display: flex; align-items: flex-start; gap: 10px; border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid; }
.flash .icon, .notice .icon { width: 19px; height: 19px; margin-top: 0; vertical-align: 0; flex: none; }
.flash { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.flash-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.notice-warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.notice a { color: inherit; font-weight: 600; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast-stack .flash {
  pointer-events: auto; width: min(380px, calc(100vw - 40px)); min-width: 280px; margin: 0; padding: 12px 14px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--success);
  box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; transition: opacity .3s, transform .3s;
}
.toast-stack .flash .icon { color: var(--success); }
.toast-stack .flash-error { border-left-color: var(--danger); }
.toast-stack .flash-error .icon { color: var(--danger); }
.toast-stack .flash.is-leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast-stack .flash { animation: none; transition: none; } }

/* ---------- Setup ---------- */
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-input { font-family: var(--mono) !important; font-size: 13px !important; background: var(--surface-2) !important; }
.code-tab-list { display: inline-flex; gap: 2px; margin: 14px 0 10px; flex-wrap: wrap; padding: 3px; background: var(--surface-3); border-radius: var(--radius); }
.code-tab { font: inherit; font-size: 13px; font-weight: 550; padding: 5px 12px; border-radius: 7px; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.code-tab:hover { color: var(--text); }
.code-tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.code-tabs:not(.is-ready) .code-tab-list { display: none; }
.code-tabs:not(.is-ready) [data-hidden-tab] { display: block !important; margin-top: 12px; }
.code-block { position: relative; }
.code-block pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; padding-right: 92px; overflow-x: auto; margin: 0; font-size: 12.5px; line-height: 1.7; }
.copy-float { position: absolute; top: 8px; right: 8px; }
.tok-t { color: var(--tok-tag); }
.tok-a { color: var(--tok-attr); }
.tok-s { color: var(--tok-str); }
.tok-k { color: var(--tok-kw); }
.tok-c { color: var(--tok-com); font-style: italic; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; }
.checklist a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); padding: 6px 8px; margin: -2px -8px; border-radius: var(--radius-sm); flex: 1; }
.checklist a:hover { background: var(--surface-3); color: var(--text); }
.checklist strong { font-size: 13.5px; font-weight: 600; }
.checklist a span { color: var(--text-3); font-size: 12.5px; }
.checklist .is-done strong { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.check-dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; margin-top: 6px; }
.is-done .check-dot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.check-dot .icon { width: 12px; height: 12px; vertical-align: 0; }
.facts { margin: 0 0 14px; padding-left: 18px; color: var(--text-2); font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.facts-on { list-style: none; padding: 0; }
.facts-on li { display: flex; gap: 8px; align-items: flex-start; }
.facts-on .icon { color: var(--success); margin-top: 2px; vertical-align: 0; }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 1px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 550; }
.settings-nav a .icon { color: var(--text-3); }
.settings-nav a:hover { color: var(--text); background: var(--surface-3); }
.settings-nav a.is-active { color: var(--brand); background: var(--brand-50); }
.settings-nav a.is-active .icon { color: var(--brand); }
.settings-body { max-width: 720px; }
.settings-body .card { scroll-margin-top: calc(var(--topbar-h) + 20px); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 6px 4px 10px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line); font-size: 13px; }
.chip .icon { width: 14px; height: 14px; vertical-align: 0; color: var(--text-3); }
.chip.is-pending { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.chip.is-pending .icon { color: var(--warning); }
.chip-note { font-size: 12px; opacity: .85; }
.chip form { margin: 0; }
.chip-remove { width: 22px; height: 22px; border-radius: 50%; border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; opacity: .6; }
.chip-remove:hover { opacity: 1; background: rgba(16, 24, 40, .08); }
.danger-zone { border-color: var(--danger-line); }
.danger-zone .card-head { background: var(--danger-bg); }
.danger-zone h2, .danger-zone h2 .icon { color: var(--danger); }
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.danger-zone .card-head + .danger-row { border-top: 0; padding-top: 0; }
.danger-row p { margin: 2px 0 0; }
.danger-row form { margin: 0; flex: none; }
.delete-form { display: flex; gap: 8px; }
.delete-form input { width: 200px !important; }

/* ---------- Integrations ---------- */
.integrations { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.integration { margin: 0; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: calc(var(--topbar-h) + 20px); }
.integration > .button-secondary { align-self: flex-start; }
.integration-head { display: flex; align-items: flex-start; gap: 12px; }
.integration-head > div { flex: 1; min-width: 0; }
.integration-head p { margin: 2px 0 0; }
.integration-icon { width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.integration-icon .icon { width: 20px; height: 20px; vertical-align: 0; }
.tint-teal { background: var(--brand-50); color: var(--brand); }
.tint-slack { background: #F4EDF7; color: #4A154B; }
.tint-discord { background: #EEF0FE; color: #5865F2; }
.tint-json { background: #FEF3C7; color: #B45309; }
:root[data-theme="dark"] .tint-slack { background: #2A1A2C; color: #E0B3E6; }
:root[data-theme="dark"] .tint-discord { background: #1E2140; color: #A5ACF9; }
:root[data-theme="dark"] .tint-json { background: #3A2A0A; color: #FCD34D; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tint-slack { background: #2A1A2C; color: #E0B3E6; }
  :root:not([data-theme="light"]) .tint-discord { background: #1E2140; color: #A5ACF9; }
  :root:not([data-theme="light"]) .tint-json { background: #3A2A0A; color: #FCD34D; }
}
.integration.is-soon { opacity: .6; box-shadow: none; background: var(--surface-2); }
.connection { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; }
.connection form { margin: 0; }
.connect > summary, .secret > summary { list-style: none; width: fit-content; }
.connect > summary::-webkit-details-marker, .secret > summary::-webkit-details-marker { display: none; }
.connect[open] > summary { margin-bottom: 12px; }
.secret > summary { cursor: pointer; color: var(--text-3); }
.secret[open] > summary { margin-bottom: 8px; }

/* ---------- Plans, profile, submission detail ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.plan { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.plan .price { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.plan form:first-of-type { margin-top: auto; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile p { margin: 2px 0 0; }
.fields { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 12px 24px; margin: 0; }
.fields dt { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.outbox-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 12px; background: #fff; }

/* ---------- Sign-in extras and security settings ---------- */
.field-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field-label-row a { font-weight: 550; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12.5px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-card > .empty-icon { margin-bottom: 12px; }
.steps { margin: 0 0 18px; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.qr { width: 184px; margin: 12px 0 8px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.qr svg { display: block; width: 100%; height: auto; }
.manual-key { word-spacing: .2em; user-select: all; }
.recovery-codes { list-style: none; margin: 0; padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.recovery-codes code { font-size: 14px; letter-spacing: .04em; }
.two-factor-actions { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Narrower screens ---------- */
@media (max-width: 1100px) {
  .setup-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 > .span-2 { grid-column: span 2; }
}
@media (max-width: 991.98px) {
  .sidebar { width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .shell-main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .mobile-only { display: inline-grid !important; }
  .content { padding: 20px 16px 48px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .settings-nav a { white-space: nowrap; }
}
@media (max-width: 640px) {
  h1 { font-size: 20px; }
  .search-trigger .kbd, .topbar .hide-small { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .head-actions .button { width: 100%; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-3 > .span-2 { grid-column: auto; }
  .card { padding: 16px; }
  .card-head { margin: -16px -16px 16px; padding: 12px 16px; }
  .fields { grid-template-columns: 1fr; gap: 2px; }
  .fields dd { margin-bottom: 12px; }
  .inline-form, .key-row, .delete-form { flex-direction: column; align-items: stretch; }
  .delete-form input { width: 100% !important; }
  .danger-row { flex-direction: column; align-items: stretch; }
  .toolbar-actions { margin-left: 0; }
  .item-side .muted { display: none; }
  .empty-inline { flex-direction: column; align-items: flex-start; }
  .chart { height: 180px; }
  .chart-bars { gap: 3px; }
  .chart-label { font-size: 10px; }
  .integrations { grid-template-columns: 1fr; }
  .toast-stack { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast-stack .flash { width: auto; min-width: 0; }
}
