/* Comment Guard — shared dashboard look: light canvas, dark topbar, grouped sidebar, blue accent. */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e5e7eb;
    --text: #111827;
    --text-2: #374151;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-tint: rgba(37, 99, 235, .09);
    --topbar: #1a1d24;
    --ok: #16a34a;
    --warn: #d97706;
    --danger: #dc2626;
    --ok-bg: rgba(22, 163, 74, .10);
    --warn-bg: rgba(217, 119, 6, .10);
    --danger-bg: rgba(220, 38, 38, .10);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04);
    --topbar-h: 48px;
    --sidebar-w: 224px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'Fira Code', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13.5px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); }
.icon { flex: none; }
.inline-form { margin: 0; }

/* Topbar */
.topbar {
    position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--topbar); color: #d1d5db;
}
.brand { display: flex; align-items: center; height: 100%; width: var(--sidebar-w); padding: 0 18px; background: var(--surface); font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--text); }
.brand-name { color: var(--accent); margin-left: 3px; }
.topbar-right { display: flex; align-items: center; gap: 16px; padding-right: 16px; font-size: 12.5px; }
.topbar-ws { color: #9ca3af; }
.topbar-user { color: #fff; font-weight: 600; }
.topbar-btn { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid #374151; color: #d1d5db; border-radius: var(--radius-sm); padding: 5px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.topbar-btn:hover { background: #262a33; }

/* Shell */
.shell { display: flex; padding-top: var(--topbar-h); min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; }
.nav-group { padding: 14px 10px 6px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-group:first-child { padding-top: 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); font-size: 13px; font-weight: 600; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--accent-tint); color: var(--accent); }
.nav-link.is-disabled { opacity: .55; cursor: not-allowed; }
.nav-link.is-disabled:hover { background: transparent; color: var(--muted); }
.nav-soon { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.main { flex: 1; min-width: 0; padding: 24px 28px 48px; max-width: 1280px; }

/* Page */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi.warn .kpi-value { color: var(--warn); }

.empty { padding: 18px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.empty p { margin-top: 4px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; flex-direction: column; padding: 9px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.feed-type { font-weight: 600; font-size: 12.5px; text-transform: capitalize; }
.feed-type { text-transform: lowercase; }
.feed-type::first-letter { text-transform: uppercase; }

/* Forms & buttons */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field input { font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.field input:focus { outline: 2px solid var(--accent-tint); border-color: var(--accent); }
.field.has-error input { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12px; }
.static { padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; align-self: flex-start; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-block { width: 100%; align-self: stretch; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: rgba(22, 163, 74, .25); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(220, 38, 38, .25); }
.debug { background: var(--surface-2); border: 1px solid var(--border); padding: 10px; border-radius: var(--radius-sm); font: 12px var(--mono); white-space: pre-wrap; }

/* Tables, badges, lists */
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 8px; justify-content: flex-end; }
.table-card .empty { margin: 18px; }
.small { font-size: 12px; }
.text-warn { color: var(--warn); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.setup-card { margin-bottom: 16px; border-color: rgba(217, 119, 6, .35); background: #fffcf5; }
.steps { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); }
.steps li { margin-bottom: 6px; }
code { font: 12px var(--mono); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-row > span { display: flex; flex-direction: column; gap: 2px; }
.pick-row.is-disabled { opacity: .6; cursor: not-allowed; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* Posts */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-group { display: flex; gap: 8px; align-items: center; margin: 0; }
select { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); max-width: 260px; }
.cell-post { max-width: 460px; }
.cell-post a { font-weight: 600; color: var(--text); }
.cell-post a:hover { color: var(--accent); }
.nowrap { white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); }
.alert-warn { background: var(--warn-bg); color: #92400e; border-color: rgba(217, 119, 6, .3); }
.alert a { font-weight: 600; margin-left: 6px; }
.crumbs { margin-bottom: 10px; }
.grid-wide-left { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); margin-bottom: 16px; }
.post-body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.6; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }
.meta dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.meta dd { margin: 0; }
.guard-state { margin-bottom: 10px; }
.badge-lg { font-size: 13px; padding: 4px 14px; }
.kpis-compact { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
@media (max-width: 860px) { .grid-wide-left { grid-template-columns: 1fr; } }

.btn-row { flex-direction: row; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.guard-inline { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

/* Comments */
.comments-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.comments-head .card-title { margin-bottom: 0; }
.sync-line { margin: 6px 0 14px; }
.comment-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.chip:hover { background: var(--surface-2); text-decoration: none; }
.chip.is-active { background: var(--accent-tint); border-color: rgba(37, 99, 235, .35); color: var(--accent); }
.chip-n { font-size: 11px; opacity: .75; }
input[type="search"] { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 210px; }
.comment-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.comment { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.comment-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.comment-body { white-space: pre-wrap; word-break: break-word; }
.comment-replies { margin-top: 10px; padding-left: 16px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.comment-replies .comment { background: var(--surface-2); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

.process-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.insight { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12.5px; }
.insight-pending { justify-content: space-between; }
.insight-details { margin-top: 6px; font-size: 12.5px; }
.insight-details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.insight-details .meta { margin-top: 8px; padding-top: 8px; }

/* Manual comment actions */
.btn-danger { background: var(--surface); color: var(--danger); border-color: rgba(220, 38, 38, .35); }
.btn-danger:hover { background: var(--danger-bg); }
dialog.dialog .btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.comment-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.comment-actions .inline-form { display: inline-block; }
.comment.is-deleted .comment-body { text-decoration: line-through; color: var(--muted); }
.last-action { margin-top: 6px; }
.comment-head input[type="checkbox"] { margin: 0 2px 0 0; }
.bulk-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 12px; margin: 6px 0 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.bulk-all { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.bulk-buttons { margin-left: auto; display: inline-flex; gap: 8px; flex-wrap: wrap; }
dialog.dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-width: 420px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(16, 24, 40, .25); color: var(--text); }
dialog.dialog::backdrop { background: rgba(17, 24, 39, .45); }
dialog.dialog h2 { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* App shell v2: page selector, account menu, grouped nav, icon buttons */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
kbd { font: 600 10.5px var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text-2); margin-right: 3px; }
.topbar { gap: 14px; }
.scope-form { margin: 0 auto 0 4px; }
.scope-label { display: inline-flex; align-items: center; gap: 8px; color: #9ca3af; }
.scope-label select { background: #262a33; color: #e5e7eb; border: 1px solid #374151; max-width: 240px; padding: 5px 10px; font-size: 12.5px; }
.topbar-right { gap: 8px; }
.topbar-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: transparent; color: #d1d5db; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; }
.topbar-icon:hover { background: #262a33; border-color: #374151; }
.user-menu { position: relative; }
.user-summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: #fff; font-weight: 600; padding: 3px 8px 3px 4px; border-radius: 999px; }
.user-summary::-webkit-details-marker, .menu > summary::-webkit-details-marker { display: none; }
.user-summary:hover { background: #262a33; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; }

/* Generic dropdown (details.menu): used by the account menu, More, Filters and Guard settings */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 190px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 6px; display: flex; flex-direction: column; font-weight: 500; }
.menu-panel.menu-right { left: auto; right: 0; min-width: 240px; }
.menu-panel.menu-wide { min-width: 300px; padding: 14px; }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-group { padding: 10px 10px 4px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.menu-item:hover:not(.is-disabled) { background: var(--surface-2); text-decoration: none; }
.menu-item.is-disabled { opacity: .55; cursor: not-allowed; }
.menu-item kbd { margin-left: auto; }
.menu-panel .inline-form { display: block; }
.settings-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.settings-form h3 { font-size: 13.5px; font-weight: 800; }
.settings-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.settings-form select, .settings-form input[type="number"] { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); max-width: none; }
.settings-form small { font-weight: 400; }
.head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-tools .menu-panel { left: auto; right: 0; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; background: var(--surface); color: var(--text-2); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.is-danger { color: var(--danger); border-color: rgba(220, 38, 38, .3); }
.icon-btn.is-danger:hover { background: var(--danger-bg); }
.icon-btn.is-done { color: var(--ok); border-color: rgba(22, 163, 74, .4); }
.icon-btn[disabled] { opacity: .45; cursor: not-allowed; }
.menu > summary.icon-btn { list-style: none; }

/* Sidebar */
.nav-link { position: relative; }
.nav-label { flex: 1; }
.nav-count { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; }
.nav-kbd { display: none; margin: 0; font-size: 10px; }
.nav-link:hover .nav-kbd { display: inline-block; }
.nav-link:hover .nav-count + .nav-kbd { display: none; }

/* Inbox */
.main-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.main-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.main-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.main-tab.is-disabled { opacity: .55; cursor: not-allowed; }
.inbox-card { padding: 14px 18px 18px; }
.sub-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.sub-tab { padding: 6px 0 9px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.sub-tab:hover { text-decoration: none; color: var(--text); }
.sub-tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.inbox-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.inbox-toolbar .bulk-bar { margin: 0; flex: 1 1 360px; }
.toolbar-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-tools .menu-panel { left: auto; right: 0; }
.active-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0 4px; }
.list-count { margin: 6px 0 4px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.source { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.source a { color: var(--text-2); font-weight: 600; }
.comment.is-focused { outline: 2px solid var(--accent); outline-offset: 1px; }
.comment:focus { outline: none; }
.comment.is-focused:focus { outline: 2px solid var(--accent); }

/* Shortcuts dialog */
dialog.dialog-wide { max-width: 640px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 28px; margin-top: 12px; }
.shortcut-grid h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.shortcut-grid dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; align-items: center; }
.shortcut-grid dd { margin: 0; color: var(--text-2); }

@media (max-width: 860px) {
    .topbar { gap: 8px; padding: 0 8px; }
    .scope-form { margin: 0; }
    .user-name { display: none; }
    .nav-kbd, .nav-count { display: none !important; }
    .menu-panel.menu-wide { min-width: min(300px, calc(100vw - 32px)); }
}

/* Moderation rules */
.settings-form textarea, .moderation-form textarea, .test-result + textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); resize: vertical; width: 100%; }
.switch-row { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px; font-weight: 500 !important; color: var(--text) !important; }
.switch-row input[type="checkbox"] { margin-top: 3px; }
.switch-row > span { display: flex; flex-direction: column; gap: 2px; }
.confirm-row { margin: -6px 0 0 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.test-result { margin-top: 12px; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.plain-list { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rule-chip { display: inline-block; }

/* Auth / plain pages */
body.plain { display: flex; justify-content: center; padding: 56px 16px; }
.plain-wrap { width: 100%; max-width: 400px; }
.plain-brand { text-align: center; font-weight: 800; font-size: 22px; margin-bottom: 20px; letter-spacing: -.01em; }
.auth-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.auth-alt { margin-top: 18px; text-align: center; }

/* Responsive: sidebar becomes a scrolling tab strip */
@media (max-width: 860px) {
    .topbar { position: static; flex-wrap: wrap; height: auto; }
    .brand { width: auto; height: var(--topbar-h); }
    .topbar-ws { display: none; }
    .shell { display: block; padding-top: 0; }
    .sidebar { width: auto; height: auto; position: static; display: flex; gap: 4px; overflow-x: auto; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--border); }
    .nav-group { display: none; }
    .nav-link { white-space: nowrap; }
    .main { padding: 18px 16px 40px; }
}

/* Reply templates and composer */
.settings-form input[type="text"] { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100%; }
.icon-btn.is-disabled { opacity: .45; cursor: not-allowed; }
.template-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.template-head .card-title { margin: 0; }
.variation-list { margin: 0 0 12px 18px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.is-paused { opacity: .72; }

/* Review Queue */
.review-why { margin-top: 8px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }

/* Toggle switches for on/off settings (the "I understand" confirmations stay plain checkboxes) */
.switch-row:not(.confirm-row) { flex-direction: row-reverse !important; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.switch-row:not(.confirm-row) > span { flex: 1; }
.switch-row:not(.confirm-row) > input[type="checkbox"] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 40px; height: 22px; margin: 0; border-radius: 999px; background: #cbd5e1; cursor: pointer; transition: background .15s; }
.switch-row:not(.confirm-row) > input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch-row:not(.confirm-row) > input[type="checkbox"]:checked { background: var(--accent); }
.switch-row:not(.confirm-row) > input[type="checkbox"]:checked::after { transform: translateX(18px); }
.switch-row:not(.confirm-row) > input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row:not(.confirm-row) > input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }