/* Système visuel : surfaces charbon, accent citron vert et typographie géométrique.
   Les couleurs métier restent distinctes : bleu IA, ambre attente, rouge erreur. */
@font-face {
  font-family: Manrope;
  src: url('/static/fonts/manrope-variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --canvas: #000000;
  --paper: #111111;
  --surface: var(--paper);
  --wash: #1b1b1b;
  --raised: #222222;
  --ink: #fbfbf8;
  --muted: #a3a49c;
  --line: #2a2a2a;
  --line-strong: #44453f;
  --accent: #9aed2c;
  --accent-hover: #b0f254;
  --accent-ink: #101608;
  --accent-soft: #1e2b12;
  --accent-border: #40592a;
  --blue: #9bc6ff;
  --blue-soft: #14243a;
  --blue-border: #2c476a;
  --amber: #efca78;
  --amber-soft: #302719;
  --amber-border: #6c5731;
  --red: #ff9b91;
  --red-soft: #341d1d;
  --red-border: #774139;
  --violet: #c5a4f5;
  --violet-soft: #291f37;
  --success: #a3ddb2;
  --radius: 16px;
  --font: Manrope, 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
html, body { background: var(--canvas); }
body { color: var(--ink); font-family: var(--font); }
::selection { background: var(--accent); color: var(--accent-ink); }
* { scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: 2px solid rgb(154 237 44 / .22); outline-offset: 2px; }
h1, h2, h3 { font-weight: 700; letter-spacing: -.035em; }
button { color: inherit; }
input, textarea, select { background: var(--wash); border-color: var(--line); border-radius: 10px; padding: 11px 13px; }
input::placeholder, textarea::placeholder { color: #96988f; }
input[type='checkbox'] { accent-color: var(--accent); }
input:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 1000px var(--wash) inset; caret-color: var(--ink); }
.button { border-radius: 999px; font-weight: 650; min-height: 40px; transition: background-color .15s ease, border-color .15s ease; }
.button:hover:not(:disabled) { filter: none; background: var(--raised); }
.button.primary, .check-mark.ready { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); box-shadow: none; }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.secondary { background: var(--raised); border-color: var(--line); }
.button.secondary:hover:not(:disabled) { background: #30312c; border-color: var(--line-strong); }
.button.danger { background: var(--red); color: #280c09; }
.button.danger:hover:not(:disabled) { background: #ffb4ac; }
.button.danger-subtle { color: var(--red); }
.button.danger-subtle:hover:not(:disabled) { background: var(--red-soft); }
.button.small { min-height: 32px; }
.badge, .prompt-badge { border-radius: 999px; padding: 5px 9px; letter-spacing: 0; text-transform: none; }
.status-dot.running { background: var(--accent); box-shadow: 0 0 0 3px rgb(154 237 44 / .1); }
.brand-mark { color: var(--accent-ink); background: var(--accent); border-radius: 11px; width: 33px; height: 33px; }
.brand-mark::after { font-style: normal; font-weight: 800; font-size: 23px; }
.brand { font-size: 26px; letter-spacing: -.065em; font-weight: 800; gap: 10px; }
.avatar { border-radius: 50%; background: var(--raised); color: var(--ink); border: 1px solid var(--line); }

/* Connexion : deux surfaces, une composition de cartes propre à Sylkchat. */
.login-shell { display: grid; grid-template-columns: 1fr 1fr; min-height: 100dvh; padding: 0; background: var(--paper); overflow: hidden; }
.login-brand { position: absolute; top: 38px; left: 42px; z-index: 1; margin: 0; color: var(--ink); font-weight: 800; font-size: 29px; letter-spacing: -.065em; }
.login-showcase { align-self: stretch; min-height: 760px; position: relative; display: flex; flex-direction: column; justify-content: center; padding: 110px 10% 60px; background: #080a06; border-right: 1px solid #1d2217; overflow: hidden; }
.login-showcase::before { content: ''; position: absolute; inset: -30%; background: repeating-radial-gradient(ellipse at 50% 55%, transparent 0 52px, rgb(154 237 44 / .045) 53px, transparent 54px 88px); pointer-events: none; }
.showcase-copy { position: relative; z-index: 1; }
.showcase-copy h2 { font-size: clamp(36px, 3.7vw, 58px); line-height: 1.12; margin-bottom: 18px; font-weight: 700; }
.showcase-copy p { color: var(--muted); font-size: 13px; max-width: 34ch; }
.showcase-cards { position: relative; height: 350px; margin-top: 40px; }
.showcase-card { position: absolute; display: flex; flex-direction: column; justify-content: space-between; width: 285px; height: 195px; padding: 25px; border-radius: 18px; box-shadow: 0 22px 55px rgb(0 0 0 / .3); }
.showcase-card-label, .showcase-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11px; font-weight: 650; }
.showcase-card-label { justify-content: flex-start; }
.showcase-card-label .icon { width: 17px; height: 17px; }
.showcase-card strong { font-size: 23px; letter-spacing: -.035em; line-height: 1.25; }
.showcase-card-lime { top: 15px; left: -12px; transform: rotate(-15deg); color: #172109; background: var(--accent); }
.showcase-card-light { top: 60px; right: -12px; transform: rotate(13deg); background: #edeee5; color: #23271e; }
.showcase-card-dark { top: 155px; left: 14%; transform: rotate(-4deg); background: linear-gradient(140deg, #1b2412, #11150c); border: 1px solid #354122; }
.showcase-card-dark .showcase-card-bottom { color: var(--accent); }
.showcase-lines { display: grid; gap: 9px; margin: 12px 0; }
.showcase-lines i { display: block; background: #c8ccbd; width: 85%; height: 7px; border-radius: 5px; }
.showcase-lines i:nth-child(2) { width: 65%; }
.showcase-lines i:nth-child(3) { width: 75%; }
.login-card { width: min(430px, calc(100% - 72px)); padding: 0; justify-self: center; background: transparent; border: 0; border-radius: 0; box-shadow: none; margin: 100px 0; }
.login-card .lock-symbol { width: 48px; height: 48px; border-radius: 50%; color: var(--accent); background: var(--wash); margin-bottom: 26px; }
.login-card h1 { font-size: 38px; line-height: 1.2; letter-spacing: -.045em; margin-bottom: 16px; }
.login-description { max-width: 40ch; font-size: 14px; margin-bottom: 32px; }
.login-card label { font-size: 12px; color: var(--muted); font-weight: 500; margin: 0 0 9px 3px; }
.login-card input { min-height: 52px; border-radius: 10px; }
.login-card form .button { min-height: 52px; margin-top: 27px; font-size: 14px; justify-content: space-between; padding: 13px 23px; }
.login-footnote { padding: 18px; background: #181818; border: 1px solid var(--line); border-radius: 12px; text-align: left; font-size: 12px; line-height: 1.8; margin-top: 28px; }
.login-shell footer { position: absolute; bottom: 24px; right: 0; width: 50%; text-align: center; margin: 0; padding: 0 24px; font-size: 11px; }

/* Navigation latérale fixe ; chaque vue conserve son comportement existant. */
.app-shell { padding: 0 24px 0 244px; }
.topbar { position: fixed; inset: 0 auto 0 0; width: 220px; height: 100dvh; padding: 30px 16px 20px; display: flex; flex-direction: column; align-items: stretch; gap: 0; background: #0c0c0c; border-right: 1px solid #232323; z-index: 4; }
.topbar .brand { padding: 0 10px; }
.workspace-identity { display: flex; gap: 10px; align-items: center; margin: 30px 0 27px; padding: 14px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.workspace-avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--raised); color: var(--accent); font-weight: 700; flex-shrink: 0; }
.workspace-identity > div { display: grid; gap: 3px; min-width: 0; }
.workspace-identity strong { font-size: 12px; }
.workspace-identity div > span { font-size: 9px; color: var(--muted); }
.main-nav { flex-direction: column; align-self: auto; gap: 7px; }
.topbar .nav-button { color: var(--muted); min-height: 46px; padding: 12px; border: 1px solid transparent; border-radius: 12px; font-size: 12px; gap: 11px; }
.nav-button .icon { width: 19px; height: 19px; }
.topbar .nav-button:hover { color: var(--ink); background: var(--wash); }
.topbar .nav-button.active { color: var(--accent); background: var(--accent-soft); border-color: #2d3b1f; font-weight: 700; }
.nav-button.active::after { display: none; }
.topbar .nav-count { color: var(--accent-ink); background: var(--accent); margin-left: auto; border-radius: 6px; min-width: 20px; }
.topbar-tools { flex-direction: column; align-items: stretch; margin-top: auto; padding-top: 24px; gap: 5px; border-top: 1px solid var(--line); }
.topbar-tools .button { justify-content: flex-start; padding: 10px 12px; gap: 12px; font-size: 12px; font-weight: 500; color: var(--muted); position: relative; }
.topbar-tools .button:hover { color: var(--ink); }
.topbar-tools .icon { width: 18px; height: 18px; }
.alert-dot { right: 12px; top: 16px; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 80px; }
.workspace-breadcrumb { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 12px; }
.workspace-breadcrumb > span { color: #626459; }
.workspace-breadcrumb strong { color: var(--ink); font-weight: 600; }
.workspace-heading-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.workspace-heading-note .icon { width: 14px; height: 14px; }
.control-strip { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px 22px; gap: 20px; margin-bottom: 18px; min-height: 100px; }
.account-status { min-width: 210px; }
.account-status strong { font-size: 13px; }
.account-status > .status-dot { width: 9px; height: 9px; }
.budget-summary { padding: 0 20px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 190px; max-width: 260px; }
.budget-track { height: 5px; background: #30312c; margin-top: 10px; }
.budget-track span { background: var(--accent); }
.global-actions { flex-wrap: wrap; justify-content: flex-end; }
.global-actions .button { min-height: 35px; }
.setup-banner, .network-banner { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; padding: 12px 16px; }
.setup-banner { background: #171a13; }
.setup-banner > div { display: block; }
.setup-banner span { display: block; font-size: 11px; margin-top: 3px; }
.app-footer { background: transparent; border: 0; padding: 12px 2px; font-size: 10px; }

/* Boîte de réception : trois panneaux, lecture et actions bien séparées. */
.workspace { grid-template-columns: 270px minmax(0, 1fr) 270px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.fans-panel, .fan-details-panel, .conversation-header, .conversation-footer, .reply-composer { background: var(--paper); }
.panel-heading { padding: 22px 18px 18px; align-items: center; }
.panel-heading h1, .panel-heading h2 { font-size: 16px; font-weight: 700; }
.search-box { margin: 0 14px 14px; }
.search-box input { border-radius: 10px; background: var(--wash); min-height: 40px; }
.search-box .icon { top: 12px; }
.fan-filters { margin: 0 14px 15px; gap: 3px; }
.fan-filters .filter-button { font-size: 10px; padding: 5px 7px; border-radius: 8px; }
.filter-button.active { color: var(--accent); background: var(--accent-soft); }
.fan-list { padding: 0 8px; }
.fan-item { color: var(--ink); padding: 15px 10px; border: 1px solid transparent; border-radius: 12px; margin-bottom: 4px; gap: 10px; }
.fan-item.selected, .fan-item.active { background: #20251a; box-shadow: none; border-color: #35442a; }
.fan-item.selected::before { display: none; }
.fan-item:hover:not(.selected):not(.active) { background: var(--wash); }
.fan-item.selected .avatar { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.fan-item-heading strong { font-size: 12px; }
.fan-preview { color: var(--muted); }
.fan-panel-foot { padding: 10px 16px; }
.conversation-header { padding: 17px 20px; gap: 10px; min-height: 78px; }
.conversation-header .button { font-size: 10px; }
.conversation-title h2 { font-size: 16px; font-weight: 700; }
.messages-list { background: #0d0e0c; padding: 18px 22px 28px; }
.message-bubble { box-shadow: none; border-radius: 16px 16px 16px 4px; }
.message.incoming .message-bubble { background: #22231f; border-color: #30322b; }
.message.outgoing:not(.ai-message) .message-bubble { background: #202b18; border-color: #35452a; }
.message.ai-message .message-bubble { background: var(--blue-soft); border-color: var(--blue-border); }
.message.outgoing .message-bubble { border-radius: 16px 16px 4px 16px; }
.message.delivery-draft .message-bubble, .message.delivery-planned .message-bubble { background: var(--amber-soft); border: 1px dashed var(--amber-border); }
.message.delivery-cancelled .message-bubble { background: var(--wash); border-color: var(--line-strong); }
.message.delivery-uncertain .message-bubble, .message.delivery-failed .message-bubble, .message.delivery-delete_failed .message-bubble { background: var(--red-soft); border-color: var(--red-border); }
.delivery-draft .delivery-label, .delivery-planned .delivery-label { color: var(--amber); }
.message-meta { color: var(--muted); }
.message-text { font-size: 13px; }
.reply-composer { padding: 14px 20px; border-top-color: var(--line); }
.reply-composer textarea { background: var(--wash); border: 1px solid var(--line); border-radius: 12px; min-height: 68px; padding: 12px 14px; }
.conversation-footer { padding: 10px 20px; min-height: 42px; }
.thread-toolbar { padding-top: 12px; }
.thread-summary { padding-bottom: 10px; }
.fan-details-panel { padding: 0 18px; }
.assistant-watch { background: #192015; border-color: #34422a; border-radius: 14px; padding: 14px; margin-bottom: 20px; }
.watch-counts { border-top-color: #34422a; }
.watch-counts strong { color: var(--accent); font-size: 25px; font-weight: 650; }
.supervision-panel { margin: 15px 0; border-top-color: var(--line); }
.supervision-panel input, .supervision-panel textarea, .supervision-panel select { font-size: 11px; }
.empty-chat-art { background: var(--accent-soft); color: var(--accent); border-radius: 26px; }
.conversation-empty h2 { font-weight: 650; }
.details-empty h2 { font-weight: 600; }

/* Bibliothèques, réglages, routes et Telegram partagent les mêmes surfaces. */
.page-heading h1, .page-heading h2 { font-weight: 700; font-size: 30px; }
.scripts-view, .vault-view, .routing-view, .outbox-view { padding: 20px 0 32px; }
.telegram-view { width: 100%; padding: 20px 0 32px; }
.settings-view { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); overflow: hidden; margin-bottom: 20px; }
.settings-nav { background: #0e0e0e; padding: 28px 20px; }
.settings-content { padding: 30px; }
.settings-tab { border-radius: 10px; padding: 12px; }
.settings-tab.active { color: var(--accent); background: var(--accent-soft); }
.settings-block { border-bottom-color: var(--line); }
.script-item, .offer-edit-card, .playground-case, .playground-variant, .tg-kpi, .routing-workspace, .vault-workspace { border-radius: 16px; }
.script-item.selected, .vault-folder.selected { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.vault-sidebar { background: var(--paper); }
.vault-selection { background: var(--wash); }
.vault-selection-zone { background: var(--paper); }
.vault-selection-zone.active { background: var(--accent-soft); }
.vault-remove { color: var(--ink); background: #33372c; }
.selected .vault-check { background: var(--accent); color: var(--accent-ink); }
.vault-footer { background: var(--paper); }
.vault-media-card { background: var(--wash); }
.routing-view { flex: 1; }
.routing-node.button { background: var(--wash); box-shadow: none; border-radius: 14px; }
.routing-viewport { background-color: #0c0d0b; background-image: radial-gradient(#30322b 1px, transparent 1px); }
.routing-wire path { stroke: #65695e; }
.routing-node-icon { background: color-mix(in srgb, var(--node-accent) 12%, var(--paper)); }
.tg-agent-card, .tg-guardrails { background: var(--paper); border: 1px solid var(--line); padding: 20px; border-radius: 16px; }
.tg-tab { border-radius: 10px 10px 0 0; }
.tg-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tg-bot { background: var(--blue-soft); border-color: var(--blue-border); }
dialog, .dialog, #cost-dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: 0 24px 100px rgb(0 0 0 / .6); }
dialog::backdrop, .dialog::backdrop, #cost-dialog::backdrop { background: rgb(0 0 0 / .76); backdrop-filter: blur(5px); }
.toast { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent-border); border-radius: 12px; box-shadow: 0 8px 35px #0008; }
.toast.error { background: var(--red-soft); color: var(--red); border-color: var(--red-border); }

/* Accueil commercial : indicateurs, lecture quotidienne et achats confirmés. */
.dashboard-view { padding: 12px 0 28px; min-width: 0; }
.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 8px 0 24px; }
.dashboard-heading h1 { font-size: 32px; margin-bottom: 8px; }
.dashboard-heading p { color: var(--muted); font-size: 12px; margin: 0; }
.dashboard-period { min-width: 185px; }
.dashboard-period label { color: var(--muted); font-size: 10px; margin: 0 0 6px 3px; }
.dashboard-period select { border-radius: 999px; font-size: 12px; padding: 10px 17px; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.dashboard-metric { display: flex; flex-direction: column; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px; min-width: 0; }
.dashboard-metric > span { font-size: 12px; font-weight: 600; }
.dashboard-metric > strong { font-size: clamp(24px, 2.1vw, 38px); letter-spacing: -.055em; font-weight: 700; line-height: 1.3; margin: 22px 0 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; max-width: 100%; }
.dashboard-metric > small { margin-top: auto; font-size: 10px; line-height: 1.6; color: var(--muted); max-width: 30ch; }
.dashboard-revenue { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.dashboard-revenue > small { color: #33471d; }
.dashboard-chart-card, .dashboard-sales-card { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); margin-bottom: 18px; overflow: hidden; }
.dashboard-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px; }
.dashboard-section-heading h2 { font-size: 17px; margin: 0 0 6px; }
.dashboard-section-heading p { color: var(--muted); font-size: 11px; margin: 0; }
#dashboard-chart-detail { font-size: 11px; color: var(--accent); text-align: right; }
.dashboard-chart { display: flex; gap: 18px; padding: 10px 24px 22px; }
.dashboard-chart-scale { display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 29px; text-align: right; color: var(--muted); font-size: 10px; min-width: 65px; }
.dashboard-chart-plot { min-width: 0; flex: 1; }
.dashboard-trend { position: relative; height: 240px; isolation: isolate; }
.dashboard-trend-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dashboard-trend-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 7; vector-effect: non-scaling-stroke; }
.dashboard-trend-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.dashboard-chart-points { position: absolute; inset: 0; }
.dashboard-chart-point { position: absolute; top: 0; bottom: 0; border: 0; padding: 0; background: transparent; touch-action: pan-y; }
.dashboard-chart-point:focus-visible { outline: 1px solid var(--accent-border); outline-offset: -1px; border-radius: 5px; }
.dashboard-chart-cursor { position: absolute; top: 0; bottom: 0; left: var(--chart-x); border-left: 1px dashed #6b7d51; pointer-events: none; }
.dashboard-chart-dot { position: absolute; left: -1px; width: 10px; height: 10px; transform: translate(-50%, -50%); border: 2px solid var(--paper); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgb(154 237 44 / .14); }
.dashboard-chart-tooltip { position: absolute; z-index: 1; top: 12px; left: clamp(0px, calc(var(--chart-x) - 82px), calc(100% - 164px)); width: 164px; display: grid; gap: 6px; padding: 13px 15px; background: #20231e; border: 1px solid #3c4830; border-radius: 12px; box-shadow: 0 8px 28px #0005; pointer-events: none; }
.dashboard-chart-tooltip > span { color: var(--muted); font-size: 10px; }
.dashboard-chart-tooltip > strong { font-size: 20px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.dashboard-chart-tooltip > small { color: var(--muted); font-size: 10px; }
.dashboard-chart-dates { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; padding-top: 13px; }
.dashboard-sales-table { overflow-x: auto; }
.dashboard-sales-table table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
.dashboard-sales-table th { background: #171717; color: var(--muted); font-size: 10px; font-weight: 500; padding: 12px 24px; }
.dashboard-sales-table td { border-top: 1px solid var(--line); padding: 10px 24px; }
.dashboard-sales-table th:nth-child(3), .dashboard-sale-amount { text-align: right; }
.dashboard-sale-amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.dashboard-sale-date { color: var(--muted); font-size: 11px; white-space: nowrap; }
.dashboard-sales-table .dashboard-fan { padding: 4px 0; border-radius: 8px; gap: 12px; font-size: 12px; max-width: 100%; white-space: normal; text-align: left; }
.dashboard-fan > span:last-child { overflow-wrap: anywhere; }
.dashboard-fan .avatar { width: 32px; height: 32px; font-size: 10px; }
.dashboard-offer { color: var(--muted); overflow-wrap: anywhere; max-width: 260px; }
.dashboard-empty { padding: 36px 24px 48px; text-align: center; }
.dashboard-empty h3 { font-size: 15px; margin-bottom: 10px; }
.dashboard-empty p { color: var(--muted); font-size: 12px; max-width: 60ch; margin: 0 auto; }
.dashboard-method { color: var(--muted); font-size: 10px; line-height: 1.8; max-width: 110ch; margin: 20px 2px 0; }
.dashboard-error { display: flex; align-items: center; gap: 15px; justify-content: space-between; background: var(--red-soft); border: 1px solid var(--red-border); border-radius: 12px; color: var(--red); padding: 14px 18px; margin-bottom: 16px; font-size: 12px; }
#dashboard-loading { margin: 0 0 14px; }
@media (max-width: 1250px) {
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-metric > strong { font-size: 30px; margin: 14px 0; }
}
@media (max-width: 720px) {
  .dashboard-heading { align-items: flex-start; flex-direction: column; gap: 18px; margin-top: 0; }
  .dashboard-heading h1 { font-size: 27px; }
  .dashboard-period { width: 100%; }
  .dashboard-metrics { gap: 10px; }
  .dashboard-metric { padding: 16px 13px; border-radius: 14px; }
  .dashboard-metric > span { font-size: 11px; }
  .dashboard-metric > strong { font-size: clamp(21px, 5vw, 30px); }
  .dashboard-metric > small { font-size: 9px; }
  .dashboard-section-heading { align-items: flex-start; flex-direction: column; padding: 19px 16px; gap: 12px; }
  #dashboard-chart-detail { text-align: left; min-height: 17px; }
  .dashboard-chart { padding: 6px 16px 18px; gap: 10px; }
  .dashboard-chart-scale { min-width: 48px; font-size: 9px; }
  .dashboard-trend { height: 190px; }
  .dashboard-sales-table th, .dashboard-sales-table td { padding: 12px 16px; }
  .dashboard-sales-table th:nth-child(2), .dashboard-sales-table .dashboard-offer { display: none; }
  .dashboard-sales-table .dashboard-fan { font-size: 11px; }
  .dashboard-fan .avatar { display: none; }
  .dashboard-sale-date { font-size: 10px; white-space: normal; }
  .dashboard-error { flex-wrap: wrap; }
}
@media (min-width: 981px) {
  .topbar { overflow-y: auto; }
  .topbar > * { flex-shrink: 0; }
}
@media (min-width: 1600px) {
  .app-shell { padding-left: 270px; padding-right: 32px; }
  .topbar { width: 238px; padding-left: 20px; padding-right: 20px; }
  .workspace { grid-template-columns: 300px minmax(0, 1fr) 300px; }
}
@media (max-width: 1250px) and (min-width: 981px) {
  .app-shell { padding-left: 212px; padding-right: 16px; }
  .topbar { width: 196px; padding-left: 12px; padding-right: 12px; }
  .topbar .brand { font-size: 24px; }
  .workspace { grid-template-columns: 245px minmax(0, 1fr); }
  .fan-details-panel { display: none; }
  #mobile-memory { display: inline-flex; }
  .workspace { position: relative; }
  .workspace.show-memory .fan-details-panel { display: block; position: absolute; inset: 0 0 0 auto; width: 300px; z-index: 2; box-shadow: -12px 0 40px #0008; }
  .workspace.show-memory #close-mobile-memory { display: inline-flex; }
  .control-strip { flex-wrap: wrap; gap: 14px; }
  .global-actions { margin-left: auto; }
}
@media (max-width: 980px) {
  .app-shell { padding: 0 16px; }
  .topbar { position: static; width: auto; height: auto; display: grid; grid-template-columns: 1fr auto; padding: 18px 0 12px; gap: 18px; background: var(--canvas); border: 0; }
  .topbar .brand { padding: 0; font-size: 25px; }
  .workspace-identity { display: none; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; flex-direction: row; overflow-x: auto; justify-content: flex-start; gap: 6px; padding-bottom: 4px; min-height: 42px; }
  .topbar .nav-button { white-space: nowrap; min-height: 40px; padding: 9px 12px; border-radius: 999px; flex-shrink: 0; font-size: 11px; gap: 7px; }
  .nav-button .icon { width: 16px; height: 16px; }
  .topbar-tools { grid-column: 2; grid-row: 1; flex-direction: row; padding: 0; margin: 0; border: 0; gap: 5px; }
  .topbar-tools .button { padding: 8px; min-height: 32px; font-size: 10px; gap: 6px; }
  .topbar-tools .tool-label { display: none; }
  .workspace-heading { min-height: 44px; margin-bottom: 12px; }
  .workspace { grid-template-columns: 270px minmax(0, 1fr); }
  .control-strip { padding: 16px; flex-wrap: wrap; gap: 16px; }
  .budget-summary { border-right: 0; padding-right: 0; min-width: 180px; }
  .workspace.show-memory .fan-details-panel { background: var(--paper); }
  .login-showcase { padding-left: 9%; padding-right: 9%; }
  .showcase-card { width: 235px; height: 170px; padding: 20px; }
  .showcase-card strong { font-size: 20px; }
  .showcase-card-light { right: -30px; }
  .showcase-card-dark { top: 145px; left: 5%; }
  .login-brand { left: 30px; }
  .login-card h1 { font-size: 31px; }
}
@media (max-width: 720px) {
  .login-shell { display: flex; flex-direction: column; padding: 115px 24px 28px; justify-content: center; }
  .login-brand { top: 30px; left: 26px; font-size: 26px; }
  .login-showcase { display: none; }
  .login-card { width: min(420px, 100%); padding: 0; margin: 0; }
  .login-card h1 { font-size: 34px; }
  .login-shell footer { position: static; width: auto; margin-top: 35px; padding: 0; }
  .app-shell { padding: 0 10px; }
  .topbar { padding-top: 15px; gap: 14px; }
  .topbar .brand { font-size: 22px; gap: 7px; }
  .topbar .brand-mark { width: 29px; height: 29px; }
  .topbar-tools .icon { width: 15px; height: 15px; }
  .topbar-tools .button { font-size: 9px; padding: 5px; }
  .topbar-tools #logout-button .icon { display: none; }
  .workspace-heading { display: none; }
  .control-strip { gap: 10px; padding: 13px; margin: 6px 0 12px; min-height: 0; border-radius: 15px; }
  .account-status { min-width: 0; gap: 7px; }
  .account-status div > span { max-width: 155px; }
  .account-status strong { font-size: 11px; }
  .account-status .badge { font-size: 9px; padding: 3px 6px; }
  .budget-summary { padding-left: 12px; min-width: 100px; max-width: 125px; }
  .budget-foot .text-button { font-size: 9px; }
  .budget-summary > div:first-child { display: block; }
  .global-actions { width: 100%; gap: 6px; margin-left: 0; justify-content: space-between; }
  .global-actions .button { font-size: 9px; padding: 7px 9px; min-height: 34px; }
  .setup-banner, .network-banner { padding: 12px; margin-bottom: 10px; }
  .workspace { display: block; border-radius: 16px; }
  .fan-list { padding: 0 8px; }
  .fan-item { padding: 15px 10px; }
  .fan-item-heading strong { font-size: 13px; }
  .fan-filters .filter-button { font-size: 11px; }
  .conversation-header { padding: 12px 10px; flex-wrap: wrap; gap: 6px; }
  .conversation-title { min-width: 75px; }
  .conversation-header .button:not(.icon-button) { min-height: 30px; font-size: 9px; padding: 5px 7px; }
  .messages-list { padding: 12px 14px 20px; }
  .message-text { font-size: 12px; }
  .thread-toolbar { padding: 8px 10px 4px; }
  .reply-composer { padding: 10px; }
  .reply-composer textarea { min-height: 48px; }
  .composer-heading .quiet-label { font-size: 9px; }
  .composer-actions { gap: 5px; }
  .composer-actions .button { font-size: 10px; }
  .conversation-footer { padding: 7px 10px; min-height: 32px; }
  .app-footer { padding: 9px 2px; gap: 3px; }
  .settings-content { padding: 22px 16px; }
  .settings-nav { padding: 22px 16px 10px; }
  .settings-nav nav { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .routing-heading { flex-wrap: wrap; }
  .routing-heading-actions { flex-wrap: wrap; }
  .tg-agent-grid { grid-template-columns: minmax(0, 1fr); }
  .tg-agent-card, .tg-guardrails { padding: 15px; }
  .page-heading h1, .page-heading h2 { font-size: 25px; }
  body:has(#inbox-view.has-selection:not([hidden])) .topbar { display: none; }
  body:has(#inbox-view.has-selection:not([hidden])) .control-strip { margin-top: 8px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
