:root {
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 0.9375rem; --text-lg: 1.125rem; --text-xl: 1.5rem;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --font-display: 'General Sans', 'Satoshi', system-ui, sans-serif;
  --font-body: 'Satoshi', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;
  --navy: #0B1B3F; --blue: #2F7BFF; --blue-deep: #1F63E0; --sky: #CFE2FF; --cream: #FAF7F0; --midnight: #0B1220;
  --ok: #1E9E6A; --warn: #C98A12; --bad: #D6455D; --info: #2F7BFF;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme='light'] {
  --bg: #F6F3EC; --surface: #FFFFFF; --surface-2: #FAF8F3; --sidebar: #FAF7F0;
  --border: rgba(11, 27, 63, 0.10); --border-strong: rgba(11, 27, 63, 0.18);
  --text: #0B1B3F; --muted: #4E5A73; --faint: #7C8699;
  --tint: #E7EFFF; --bubble-in: #ECE9E1; --hover: rgba(11, 27, 63, 0.04);
  --ok-bg: #E3F5EC; --warn-bg: #FBF0D9; --bad-bg: #FBE6EA;
  --shadow: 0 1px 2px rgba(11,27,63,.05), 0 8px 24px -12px rgba(11,27,63,.12);
}
[data-theme='dark'] {
  --bg: #0B1220; --surface: #111A2E; --surface-2: #0E1628; --sidebar: #0D1526;
  --border: rgba(207, 226, 255, 0.09); --border-strong: rgba(207, 226, 255, 0.16);
  --text: #F3F5FA; --muted: #A9B4CC; --faint: #7D89A3;
  --tint: rgba(47, 123, 255, 0.15); --bubble-in: #26314A; --hover: rgba(207, 226, 255, 0.05);
  --ok: #3CC48C; --warn: #E3AE43; --bad: #FF7A90;
  --ok-bg: rgba(60,196,140,.14); --warn-bg: rgba(227,174,67,.14); --bad-bg: rgba(255,122,144,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
}

html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: var(--text-base); line-height: 1.5; }
.num, td, .kpi-value { font-variant-numeric: tabular-nums lining-nums; }
button { font: inherit; color: inherit; }
a { color: var(--blue); }

/* Shell */
.app { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto auto 1fr; height: 100dvh; }
.sandbox-banner { grid-column: 1 / -1; display: none; align-items: center; justify-content: center; gap: var(--space-2); padding: 6px; background: #F2B33D; color: #3A2600; font-size: var(--text-sm); font-weight: 600; }
.app.sandbox .sandbox-banner { display: flex; }
.sidebar { grid-row: 2 / -1; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.brand { display: flex; align-items: center; padding: 18px 20px 14px; color: var(--text); }
.brand .logo { height: 26px; width: auto; }
.ws { margin: 4px 12px 12px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; text-align: left; }
.ws-avatar { width: 28px; height: 28px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
[data-theme='dark'] .ws-avatar { background: var(--blue); }
.ws strong { display: block; font-size: var(--text-sm); line-height: 1.2; }
.ws small { color: var(--faint); font-size: var(--text-xs); }
.ws svg { margin-left: auto; color: var(--faint); }
.nav { list-style: none; padding: 4px 10px; display: grid; gap: 2px; }
.nav-group { font-size: var(--text-xs); color: var(--faint); padding: 14px 12px 6px; font-weight: 500; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-size: var(--text-sm); font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active { background: var(--tint); color: var(--blue); }
.nav a svg { flex: none; width: 18px; height: 18px; }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--blue); color: #fff; border-radius: var(--r-full); padding: 1px 7px; }
.nav li.hidden { display: none; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); }
.usage { font-size: var(--text-xs); color: var(--muted); display: grid; gap: 6px; padding: 8px 6px; }
.bar { height: 6px; background: var(--border); border-radius: var(--r-full); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }

.topbar { grid-column: 2; display: flex; align-items: center; gap: var(--space-3); padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--bg); }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--faint); font-size: var(--text-sm); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; font: inherit; color: var(--text); }
.kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.env { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px; background: var(--surface); }
.env button { border: 0; background: none; padding: 4px 12px; border-radius: var(--r-full); font-size: var(--text-xs); font-weight: 600; color: var(--muted); cursor: pointer; }
.env button.on { background: var(--navy); color: #fff; }
[data-theme='dark'] .env button.on { background: var(--blue); }
.app.sandbox .env button.on { background: #F2B33D; color: #3A2600; }
.role-pick { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--r-full); padding: 3px 4px 3px 10px; }
.role-pick select { border: 0; background: var(--tint); color: var(--blue); font: 600 var(--text-xs) var(--font-body); border-radius: var(--r-full); padding: 4px 8px; cursor: pointer; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r-full); display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--muted); position: relative; }
.icon-btn:hover { color: var(--text); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.me { width: 34px; height: 34px; border-radius: 50%; background: var(--sky); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.main { grid-column: 2; overflow-y: auto; overscroll-behavior: contain; }
.page { padding: 28px 32px 48px; max-width: 1400px; }
.page.flush { padding: 0; max-width: none; height: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }
.page-head h1 { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.page-head p { color: var(--muted); font-size: var(--text-sm); margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--text-sm); font-weight: 600; cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); }
.btn.sm { padding: 5px 10px; font-size: var(--text-xs); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Cards & KPI */
.grid { display: grid; gap: var(--space-4); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g21 { grid-template-columns: 2fr 1fr; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--space-5); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.card-head h2 { font-size: var(--text-base); font-weight: 700; }
.card-head small { color: var(--faint); font-size: var(--text-xs); }
.kpi-label { font-size: var(--text-sm); color: var(--muted); font-weight: 500; }
.kpi-value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.2; }
.delta { font-size: var(--text-xs); font-weight: 600; margin-top: 4px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 180px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-full); background: var(--hover); color: var(--muted); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.nodot::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--tint); color: var(--blue); }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--text-xs); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
tbody tr.clickable { cursor: pointer; }
td.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.person { display: flex; align-items: center; gap: 10px; }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; background: var(--tint); color: var(--blue); }
.person strong { display: block; font-weight: 600; }
.person small { color: var(--faint); font-size: var(--text-xs); }
.cap { display: grid; gap: 4px; min-width: 120px; }
.cap span { font-size: 12px; color: var(--muted); }

/* Toolbar / tabs */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.chip-btn { border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-full); padding: 5px 12px; font-size: var(--text-xs); font-weight: 600; color: var(--muted); cursor: pointer; }
.chip-btn.on { background: var(--navy); border-color: var(--navy); color: #fff; }
[data-theme='dark'] .chip-btn.on { background: var(--blue); border-color: var(--blue); }
.field-sm { border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-sm); padding: 7px 10px; font: 400 var(--text-sm) var(--font-body); color: var(--text); }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--space-6); overflow-x: auto; }
.subtabs a { padding: 10px 14px; font-size: var(--text-sm); font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subtabs a.on { color: var(--blue); border-bottom-color: var(--blue); }

/* Lists */
.list { display: grid; }
.list-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.list-item:last-child { border-bottom: 0; }
.list-item p { color: var(--muted); font-size: var(--text-xs); }
.list-item .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ico.ok { background: var(--ok-bg); color: var(--ok); } .ico.warn { background: var(--warn-bg); color: var(--warn); } .ico.bad { background: var(--bad-bg); color: var(--bad); } .ico.info { background: var(--tint); color: var(--blue); }

/* Conversations */
.inbox { display: grid; grid-template-columns: 320px 1fr 300px; height: 100%; }
.inbox > * { min-height: 0; }
.ib-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); }
.ib-list-head { padding: 16px; border-bottom: 1px solid var(--border); display: grid; gap: 10px; }
.ib-list-head h1 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.ib-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.conv { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; border-left: 3px solid transparent; }
.conv:hover { background: var(--hover); }
.conv.on { background: var(--tint); border-left-color: var(--blue); }
.conv strong { font-size: var(--text-sm); display: block; }
.conv p { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.conv .meta { text-align: right; font-size: 11px; color: var(--faint); display: grid; gap: 4px; justify-items: end; }
.conv .unread { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.conv .ai { font-size: 10.5px; font-weight: 700; color: var(--blue); background: var(--tint); border-radius: 4px; padding: 0 5px; }
.ib-thread { display: flex; flex-direction: column; background: var(--bg); }
.th-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); }
.th-head strong { display: block; font-size: var(--text-sm); }
.th-head small { color: var(--faint); font-size: var(--text-xs); }
.th-head .actions { margin-left: auto; }
.agent-strip { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--tint); color: var(--blue); font-size: var(--text-xs); font-weight: 600; }
.agent-strip .btn { margin-left: auto; }
.th-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; font-size: 11px; color: var(--faint); margin: 8px 0; }
.bub { max-width: 62%; padding: 8px 12px; border-radius: 18px; font-size: var(--text-sm); line-height: 1.4; }
.bub.out { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 5px; }
.bub.out.sms { background: #34B35A; }
.bub.in { align-self: flex-start; background: var(--bubble-in); border-bottom-left-radius: 5px; }
.bub-meta { font-size: 11px; color: var(--faint); align-self: flex-end; margin-bottom: 6px; }
.bub-meta.l { align-self: flex-start; }
.note { align-self: stretch; background: var(--warn-bg); border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent); border-radius: 10px; padding: 8px 12px; font-size: var(--text-xs); color: var(--text); margin: 6px 0; }
.note b { color: var(--warn); }
.sys { align-self: center; font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px 10px; margin: 6px 0; }
.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 16px; display: grid; gap: 8px; }
.composer-tabs { display: flex; gap: 4px; }
.composer-tabs button { border: 0; background: none; font-size: var(--text-xs); font-weight: 600; padding: 4px 10px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.composer-tabs button.on { background: var(--tint); color: var(--blue); }
.composer-tabs button.on.note-tab { background: var(--warn-bg); color: var(--warn); }
.composer textarea { width: 100%; resize: none; border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; font: inherit; font-size: var(--text-sm); background: var(--bg); color: var(--text); min-height: 64px; }
.composer-row { display: flex; align-items: center; gap: 6px; }
.composer-row .btn.primary { margin-left: auto; }
.composer-row small { color: var(--faint); font-size: 11px; }
.ib-side { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; overscroll-behavior: contain; padding: 20px; display: grid; align-content: start; gap: 18px; }
.ib-side h3 { font-size: var(--text-xs); color: var(--faint); font-weight: 600; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 6px 10px; font-size: var(--text-sm); }
.kv dt { color: var(--muted); }
.kv dd { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(7,12,23,.35); z-index: 40; display: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface); border-left: 1px solid var(--border); z-index: 41; transform: translateX(100%); transition: transform .3s var(--ease); overflow-y: auto; padding: 24px; display: grid; align-content: start; gap: 20px; }
.drawer.open { transform: none; }
.drawer-bg.open { display: block; }
.drawer h2 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; }
.timeline { display: grid; gap: 12px; border-left: 2px solid var(--border); padding-left: 14px; font-size: var(--text-sm); }
.timeline small { display: block; color: var(--faint); font-size: 11px; }

/* Workflow builder */
.builder { display: grid; grid-template-columns: 1fr 300px; gap: var(--space-4); }
.canvas { background: var(--surface-2); background-image: radial-gradient(var(--border-strong) 1px, transparent 1px); background-size: 18px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; display: flex; flex-direction: column; align-items: center; min-height: 560px; }
.node { width: 300px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; }
.node.sel { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.node .k { font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.node .k.trigger { color: var(--ok); } .node .k.cond { color: var(--warn); } .node .k.action { color: var(--blue); } .node .k.ai { color: #8B5CF6; }
[data-theme='dark'] .node .k.ai { color: #B79BFF; }
.node strong { font-size: var(--text-sm); display: block; }
.node p { font-size: var(--text-xs); color: var(--muted); }
.edge { width: 2px; height: 26px; background: var(--border-strong); position: relative; }
.edge.plus::after { content: '+'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); font-size: 12px; line-height: 16px; text-align: center; color: var(--muted); }
.branch { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 100%; max-width: 680px; position: relative; padding-top: 22px; }
.branch::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 22px; border: 2px solid var(--border-strong); border-bottom: 0; border-radius: 10px 10px 0 0; }
.branch > div { display: flex; flex-direction: column; align-items: center; }
.branch .node { width: 100%; max-width: 300px; }
.branch-label { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); padding: 1px 8px; margin-bottom: 8px; }
.inspector { display: grid; gap: 14px; align-content: start; }
.inspector label { display: grid; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.inspector input, .inspector select, .inspector textarea { border: 1px solid var(--border); background: var(--bg); border-radius: var(--r-sm); padding: 8px 10px; font: 400 var(--text-sm) var(--font-body); color: var(--text); width: 100%; }
.inspector textarea { min-height: 90px; resize: vertical; }

/* Permission matrix */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.p-full, .p-view, .p-own { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.p-full { background: var(--tint); color: var(--blue); }
.p-view { background: var(--hover); color: var(--muted); }
.p-own { background: var(--ok-bg); color: var(--ok); }
.p-none { color: var(--faint); }
.matrix th.me-col, .matrix td.me-col { background: color-mix(in srgb, var(--blue) 6%, transparent); }

/* Code */
.code { background: var(--midnight); color: #DCE6FA; border-radius: var(--r-md); padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; overflow-x: auto; white-space: pre; }
[data-theme='dark'] .code { background: #070C17; border: 1px solid var(--border); }
.c-blue { color: #7FB2FF; } .c-dim { color: #7D89A3; } .c-ok { color: #8BD5B5; } .c-str { color: #F2C98A; }
.secret { display: flex; align-items: center; gap: 8px; }
.secret code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px 8px; border-radius: 6px; }

/* Toggle */
.switch { width: 36px; height: 20px; border-radius: var(--r-full); background: var(--border-strong); position: relative; border: 0; cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked='true'] { background: var(--blue); }
.switch[aria-checked='true']::after { transform: translateX(16px); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting strong { font-size: var(--text-sm); display: block; }
.setting p { color: var(--muted); font-size: var(--text-xs); }

/* Toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: var(--r-md); font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: all .3s var(--ease); z-index: 60; }
[data-theme='dark'] .toast { background: var(--blue); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty-hint { color: var(--faint); font-size: var(--text-xs); }
.mockup-note { font-size: var(--text-xs); color: var(--faint); margin-top: var(--space-8); }

@media (max-width: 1200px) {
  .inbox { grid-template-columns: 300px 1fr; }
  .ib-side { display: none; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar, .main { grid-column: 1; }
  .g3, .g2, .g21, .builder { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .ib-thread { display: none; }
  .role-pick { display: none; }
  .page { padding: 20px 16px 40px; }
}

/* explicit grid placement */
.sandbox-banner { grid-row: 1; }
.sidebar { grid-column: 1; grid-row: 2 / 4; }
.topbar { grid-column: 2; grid-row: 2; }
.main { grid-column: 2; grid-row: 3; }
.subtabs { scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
@media (max-width: 900px) { .topbar, .main { grid-column: 1; } }
