/* ===== css/ui.css ===== */
/* FlacosMedia UI — single source of truth. Do not stack page CSS on top. */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  /* Rampa no escuro: página mais funda, card mais claro — no claro é o
     contrário (--soft cinza, --surface branco). Sem isso os cartões viram
     buracos pretos no cinza e o modo escuro fica chapado. */
  --bg: #09090b;
  --elevated: #121214;
  --surface: #1c1c20;
  --hover: #27272c;
  --soft: #111113;
  --line: rgba(255,255,255,.11);
  --line-strong: rgba(255,255,255,.18);
  --text: #fafafa;
  --secondary: #c6c6ce;
  --muted: #8e8e99;
  --primary: #fafafa;
  --primary-fg: #09090b;
  --accent: #5b9dff;
  --accent-soft: rgba(91,157,255,.22);
  --ok: #4ade80;
  --ok-bg: rgba(74,222,128,.14);
  --bad: #f87171;
  --bad-bg: rgba(248,113,113,.14);
  --warn: #fb923c;
  --warn-bg: rgba(251,146,60,.14);
  --overlay: rgba(0,0,0,.55);
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.42);
  --r: 8px;
  --r-lg: 12px;
  --sidebar: 232px;
  --sidebar-c: 52px;
  --topbar: 52px;
  --px: clamp(16px, 2.2vw, 28px);
  --max: none;
  --font: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.22,1,.36,1);

  /* Legacy aliases — page CSS (reels/bot/pixel/accounts) still use these names */
  --bg-elevated: var(--elevated);
  --sidebar-bg: var(--elevated);
  --surface-hover: var(--hover);
  --soft-2: #25252b;
  --text-secondary: var(--secondary);
  --border: var(--line);
  --border-strong: var(--line-strong);
  --ring: var(--line-strong);
  --primary-hover: #ffffff;
  --accent-hover: #7eb4ff;
  --success: var(--ok);
  --success-bg: var(--ok-bg);
  --danger: var(--bad);
  --error-bg: var(--bad-bg);
  --gold: #facc15;
  --gold-soft: rgba(250,204,21,.1);
  --shadow-xs: var(--shadow);
  --shadow-sm: var(--shadow-lg);
  --shadow-card: 0 0 0 1px var(--line);
  --radius-sm: 6px;
  --radius-md: var(--r);
  --radius-lg: var(--r-lg);
  --radius-full: 999px;
  --sidebar-w: var(--sidebar);
  --sidebar-w-collapsed: var(--sidebar-c);
  --sidebar-pad: 16px;
  --sidebar-nav-gap: 2px;
  --topbar-h: var(--topbar);
  --header-h: var(--topbar);
  --page-x: var(--px);
  --page-py: 28px;
  --page-pb: 64px;
  --panel-x: 20px;
  --page-max: none;
  --content-form: 420px;
  --font-body: var(--font);
  --font-mono: var(--mono);
  --font-xs: 11px;
  --font-sm: 12px;
  --font-md: 13px;
  --font-base: 14px;
  --font-lg: 15px;
  --font-xl: 22px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --gap-page: var(--space-6);
  --gap-section: var(--space-5);
  --gap-card: var(--space-4);
  --gap-inline: var(--space-3);
  --gap-tight: var(--space-2);
  --gap-micro: var(--space-1);
  --ease-out: var(--ease);
  --duration-fast: 100ms;
  --duration: 160ms;
  --duration-slow: 240ms;
  --chart-1: #60a5fa;
  --chart-2: #f472b6;
  --chart-3: #a78bfa;
  --chart-4: #4ade80;
  --chart-5: #fb923c;
  --chart-6: #facc15;
  --chart-7: #22d3ee;
  --chart-8: #f87171;
  --chart-line: var(--chart-1);
  --chart-line-fill: rgba(96,165,250,.18);
  --input-bg: var(--surface);
  --inset-bg: var(--elevated);
  --panel-muted: var(--secondary);
  --shell-glass: color-mix(in srgb, var(--elevated) 90%, transparent);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafa;
  --elevated: #fff;
  --surface: #fff;
  --hover: #f4f4f5;
  --soft: #f4f4f5;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --text: #3f3f46;
  --secondary: #71717a;
  --muted: #a1a1aa;
  --primary: #52525b;
  --primary-fg: #fafafa;
  --accent: #2563eb;
  --accent-soft: rgba(37,99,235,.1);
  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --warn: #c2410c;
  --warn-bg: #fff7ed;
  --overlay: rgba(0,0,0,.4);
  --shadow: 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 24px 64px rgba(0,0,0,.12);
  --soft-2: #e4e4e7;
  --primary-hover: #3f3f46;
  --accent-hover: #1d4ed8;
  --sidebar-bg: var(--elevated);
  --gold: #ca8a04;
  --gold-soft: #fefce8;
  --chart-1: #2563eb;
  --chart-2: #db2777;
  --chart-3: #7c3aed;
  --chart-4: #16a34a;
  --chart-5: #ea580c;
  --chart-6: #ca8a04;
  --chart-7: #0891b2;
  --chart-8: #dc2626;
  --chart-line: var(--chart-1);
  --chart-line-fill: rgba(37,99,235,.12);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
html, body { overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  letter-spacing: -.011em;
}
button, input, select, textarea, optgroup, dialog, table, th, td, label { font: inherit; font-family: inherit; }
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -.03em; line-height: 1.25; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
.sr-only, .visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@keyframes fm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fm-pulse { 50% { opacity: .4; } }

/* Shell */
.app { position: relative; z-index: 1; min-height: 100vh; }
.tabs { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.tabs > input[type="radio"], .sidebar-toggle { position: absolute; opacity: 0; pointer-events: none; }
.app-shell { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.app-main { flex: 1; }
.tab-panel { display: none !important; }
#tab-productivity:checked ~ .app-shell #panel-productivity,
#tab-reels:checked ~ .app-shell #panel-reels,
#tab-accounts:checked ~ .app-shell #panel-accounts,
#tab-publish:checked ~ .app-shell #panel-publish,
#tab-analytics:checked ~ .app-shell #panel-analytics,
#tab-downloader:checked ~ .app-shell #panel-downloader,
#tab-studio:checked ~ .app-shell #panel-studio,
#tab-team:checked ~ .app-shell #panel-team,
#tab-bot:checked ~ .app-shell #panel-bot,
#tab-pixel:checked ~ .app-shell #panel-pixel {
  display: block !important;
}

/* Sidebar — see core/sidebar.css (loaded via app.css) */

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: var(--primary-fg);
}
.brand-mark__logo {
  display: block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
[data-theme="light"] .brand-mark {
  background: #111;
  color: #fff;
  border-color: var(--line);
}
.brand--lg .brand-mark { width: 32px; height: 32px; }
.brand--lg .brand-mark__logo { width: 18px; height: 18px; }
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-text strong { font-size: 13px; font-weight: 650; }
.brand-text span { color: var(--muted); font-size: 11px; }
.user-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 999px; background: var(--soft); font-size: 11px; font-weight: 650;
}
.theme-toggle__icon--light { display: none; }
[data-theme="light"] .theme-toggle__icon--dark { display: none; }
[data-theme="light"] .theme-toggle__icon--light { display: flex; }
.theme-toggle .theme-toggle__label::before { content: "Modo escuro"; }
[data-theme="light"] .theme-toggle .theme-toggle__label::before { content: "Modo claro"; }

@media (max-width: 768px) {
  .tabs { display: block; }
}

.app-main,
.tab-panels,
.tab-panel {
  width: 100%;
  max-width: none;
  min-width: 0;
}

/* Page — full width beside sidebar */
.page, .fm-page, .bot-dash, .pixel-page, .pixel-dash, .team-page, .publish-page, .accounts-page, .reels-dash, .reel {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px var(--px) 56px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: calc(100dvh - var(--topbar-h, var(--topbar)));
  box-sizing: border-box;
}
.fm-hero, .page-hero, .dash-hero, .bot-dash__hero {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px;
}
.fm-hero h2, .page-hero__intro h2, .dash-hero h2, .bot-dash__hero h2 {
  font-size: 22px; font-weight: 650; letter-spacing: -.035em;
}
.fm-hero p, .page-hero__desc, .fm-muted { margin: 0; color: var(--muted); font-size: 13px; }
.fm-stats, .fm-props {
  display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0;
}
.fm-stat, .fm-prop {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow);
  font-size: 12px; color: var(--secondary);
}
.fm-stat strong, .fm-prop strong, .fm-prop__value { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.fm-prop__name { color: var(--muted); font-size: 11px; }

/* Primitives */
.btn, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--r);
  background: var(--primary); color: var(--primary-fg); font-size: 13px; font-weight: 550; cursor: pointer;
}
.btn:hover, .button:hover { filter: brightness(1.05); }
.btn--primary { background: var(--primary); color: var(--primary-fg); }
.btn--primary:hover { background: var(--primary-hover); color: var(--primary-fg); }
.btn--secondary, .button.secondary, .dropdown-trigger {
  background: var(--surface); border-color: var(--line); color: var(--secondary); box-shadow: var(--shadow);
}
.btn--secondary:hover, .button.secondary:hover, .dropdown-trigger:hover { background: var(--hover); color: var(--text); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--secondary); }
.btn--ghost:hover { background: var(--hover); color: var(--text); }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn--icon { min-height: 0; padding: 0; width: 30px; height: 30px; }
.card, .fm-card, .integrations-card, .bot-card, .pixel-card {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow);
}
label { display: block; margin-bottom: 6px; color: var(--secondary); font-size: 12px; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--elevated); color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line-strong));
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field { margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px;
  border: 1px dashed var(--line); border-radius: var(--r-lg); text-align: center;
}
.empty-state__icon {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 999px; background: var(--soft); color: var(--muted);
}
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; max-width: 36ch; }
.badge, .account-badge, .fm-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  background: var(--soft); color: var(--secondary); font-size: 11px; font-weight: 600;
}
.account-badge--warming, .fm-tag--warming { background: var(--warn-bg); color: var(--warn); }
.account-badge--ready, .fm-tag--ready { background: var(--ok-bg); color: var(--ok); }
.account-badge--in_use, .fm-tag--in_use { background: var(--accent-soft); color: var(--accent); }
.account-badge--banned, .fm-tag--banned { background: var(--bad-bg); color: var(--bad); }
.toast, .notice {
  margin: 0; padding: 10px var(--px); text-align: center; font-size: 13px; font-weight: 500;
}
.toast--success, .notice.success { background: var(--ok-bg); color: var(--ok); }
.toast--error, .notice.error { background: var(--bad-bg); color: var(--bad); }
.hint, .quiet, .empty { color: var(--muted); font-size: 12px; }

/* Subnav */
.fm-tabs, .publish-subnav, .dash-subnav, .dash-subnav__tabs, .notion-views {
  display: inline-flex; flex-wrap: wrap; gap: 2px; width: fit-content; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--soft);
}
.fm-tabs button, .publish-subnav__btn, .dash-subnav__tab, .notion-view {
  min-height: 30px; padding: 0 12px; border: 0; border-radius: var(--r); background: transparent;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 550; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.fm-tabs button.is-active, .publish-subnav__btn.is-active, .dash-subnav__tab.active, .notion-view.is-active {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}

/* Accounts */
.fm-toolbar, .notion-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.fm-toolbar__bar, .notion-db__views {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.fm-search, .notion-toolbar__search { position: relative; display: flex; align-items: center; margin: 0; }
.fm-search svg, .notion-toolbar__search svg { position: absolute; left: 11px; z-index: 1; color: var(--muted); pointer-events: none; }
.fm-search input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.notion-toolbar__search input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  width: min(220px, 52vw); min-height: 32px; padding: 0 12px 0 34px; font-size: 12px; background: var(--surface);
}
.fm-chip, .notion-chip {
  min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--secondary); font: inherit; font-size: 12px; font-weight: 550; cursor: pointer;
}
.fm-chip.is-active, .notion-chip.is-active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); color: var(--text); }
[data-theme="light"] .fm-chip.is-active,
[data-theme="light"] .notion-chip.is-active {
  color: var(--accent);
  font-weight: 600;
}
.fm-board, .acc-board {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; align-items: start;
}
.fm-col, .acc-col {
  display: flex; flex-direction: column; gap: 8px; min-height: 160px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: color-mix(in srgb, var(--surface) 75%, transparent);
}
.fm-col__head, .acc-col__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fm-col__count, .acc-col__count {
  min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted);
  font-size: 11px; font-weight: 650; text-align: center;
}
.fm-col__list, .acc-col__list, .accounts-column__cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.fm-col__empty, .acc-col__empty { margin: 0; padding: 14px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.fm-col.is-drop, .acc-col--drop-target { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.fm-col.is-invalid, .acc-col--drop-invalid { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); opacity: .7; }
.fm-item, .acc-item, .accounts-column__item { margin: 0; }
.fm-card-acc, .acc-card, .account-card {
  display: flex; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow);
}
.fm-card-acc:hover, .acc-card:hover { border-color: var(--line-strong); background: var(--hover); }
.fm-card-acc__drag, .acc-card__drag, .account-card__drag-handle {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; border: 0; background: transparent;
  color: var(--muted); cursor: grab; opacity: .55; padding: 0;
}
.fm-card-acc__body, .acc-card__body, .account-card__main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; cursor: pointer;
}
.fm-card-acc__row, .notion-card__row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fm-card-acc__name, .acc-card__name, .account-card__name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.fm-card-acc__actions, .acc-card__menu, .account-card__actions { display: inline-flex; gap: 2px; }
.fm-icon-btn, .acc-menu-btn, .account-card__action, .notion-card__btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 0; border-radius: var(--r); background: transparent; color: var(--muted); cursor: pointer; padding: 0; min-height: 0;
}
.fm-icon-btn:hover, .acc-menu-btn:hover { background: var(--soft); color: var(--text); }
.fm-icon-btn.is-danger:hover, .acc-menu-btn--danger:hover { background: var(--bad-bg); color: var(--bad); }
.fm-card-acc__tags, .acc-card__props { display: flex; flex-wrap: wrap; gap: 4px; }
.accounts-column__placeholder {
  min-height: 52px; border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: var(--r-lg); background: var(--accent-soft);
}
.fm-table-wrap, .notion-table-wrap {
  overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
}
.fm-table, .accounts-table, .notion-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fm-table th, .fm-table td, .accounts-table th, .accounts-table td, .notion-table th, .notion-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap;
}
.fm-table th, .accounts-table th, .notion-table th {
  background: var(--soft); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
}
.fm-table tr:last-child td, .accounts-table tr:last-child td { border-bottom: 0; }
.fm-toast, .acc-toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 80; max-width: min(340px, calc(100vw - 32px));
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface);
  box-shadow: var(--shadow-lg); font-size: 13px;
}
.fm-toast.is-success, .acc-toast.is-success { border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.fm-toast.is-error, .acc-toast.is-error { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.fm-view[hidden], .notion-view-panel[hidden], [data-view-panel][hidden] { display: none !important; }
.accounts-table__account { display: flex; align-items: center; gap: 10px; }
.accounts-table__avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--soft); color: var(--secondary);
}
.accounts-table__avatar--instagram { color: #e1306c; background: color-mix(in srgb, #e1306c 10%, var(--soft)); border-color: color-mix(in srgb, #e1306c 22%, var(--line)); }
.accounts-table__avatar--tiktok { color: var(--text); background: color-mix(in srgb, var(--text) 6%, var(--soft)); }
[data-theme="light"] .accounts-table__avatar--tiktok { color: var(--text); }
.accounts-table__username { font-weight: 600; }
.accounts-table__muted { color: var(--muted); }
.accounts-table__password { display: flex; align-items: center; gap: 8px; }
.accounts-table__pass { font-family: var(--mono); font-size: 12px; }
.accounts-table__actions { display: flex; align-items: center; gap: 6px; }
.accounts-table__copy, .accounts-table__delete {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px;
}
.accounts-table__growth--up { color: var(--ok); }
.accounts-table__growth--down { color: var(--bad); }

/* Publish */
.publish-composer, .publish-queue, .publish-accounts { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: none; padding: 18px; }
.publish-composer__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.publish-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px 0 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--elevated); color: var(--secondary);
  font-size: 12px; font-weight: 550; cursor: pointer;
}
.publish-chip input { width: auto; margin: 0; accent-color: var(--accent); }
.publish-chip:has(input:checked) { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--text); }
.publish-composer__footer { display: flex; justify-content: flex-end; }
.publish-alert { padding: 10px 12px; border-radius: var(--r); background: var(--bad-bg); color: var(--bad); font-size: 13px; border: 1px solid transparent; }
.publish-alert.is-success { background: var(--ok-bg); color: var(--ok); }
.publish-view { display: none; }
.publish-view.is-active { display: block; }
.publish-queue__list { display: flex; flex-direction: column; gap: 8px; }
.publish-post {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--elevated);
}
.publish-post__title { margin: 0; font-size: 13px; font-weight: 600; }
.publish-post__meta { color: var(--muted); font-size: 12px; }
.publish-post__status { padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 650; text-transform: uppercase; }
.publish-post__status--SCHEDULED { background: var(--accent-soft); color: var(--accent); }
.publish-post__status--DRAFT { background: var(--soft); color: var(--muted); }
.publish-post__status--PUBLISHED { background: var(--ok-bg); color: var(--ok); }
.publish-post__status--ERROR, .publish-post__status--FAILED { background: var(--bad-bg); color: var(--bad); }
.publish-accounts__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.publish-account { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--elevated); }
.publish-account__top { display: flex; align-items: center; gap: 10px; }
.publish-account__avatar {
  width: 36px; height: 36px; border-radius: 999px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  background: var(--soft); font-weight: 650; font-size: 12px;
}
.publish-account__avatar img { width: 100%; height: 100%; object-fit: cover; }
.publish-accounts__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.publish-queue__filters { display: flex; flex-wrap: wrap; gap: 4px; }
.publish-queue__filters .btn.is-active { background: var(--accent-soft); color: var(--text); }

/* Login styles live in pages/login.css */

/* Dash / Bot / Pixel / Reels alignment */
.dash-subnav__tab svg { width: 14px; height: 14px; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 180px;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg);
  display: none;
}
.dropdown.open .dropdown-menu, .dropdown-menu.is-open { display: block; }
.dropdown-item {
  padding: 8px 10px; border-radius: var(--r); color: var(--secondary); font-size: 13px; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item.active { background: var(--hover); color: var(--text); }
.bot-dash section, .pixel-page section, .reels-dash section { display: flex; flex-direction: column; gap: 14px; }
.bot-dash table, .pixel-page table, .reels-dash table, .data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface);
}
.bot-dash th, .bot-dash td, .pixel-page th, .pixel-page td, .reels-dash th, .reels-dash td, .data-table th, .data-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left;
}
.bot-dash th, .pixel-page th, .reels-dash th, .data-table th { background: var(--soft); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.stat-card, .metric-card, .overview-card, .page-stat, .accounts-stat {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow);
}
.item {
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow);
}
.reel-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Modals */
.accounts-modal, .team-modal, .bot-modal {
  margin: auto; padding: 0; max-height: min(90vh, 760px); overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.accounts-modal:not([open]), .team-modal:not([open]), .bot-modal:not([open]) { display: none; }
.accounts-modal::backdrop, .team-modal::backdrop, .bot-modal::backdrop { background: var(--overlay); backdrop-filter: blur(4px); }
.accounts-modal__form, .team-modal__form, .bot-modal__form { display: flex; flex-direction: column; max-height: inherit; min-height: 0; }
.accounts-modal__header, .team-modal__header, .bot-modal__header {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.accounts-modal__body, .team-modal__body, .bot-modal__body {
  flex: 1; min-height: 0; overflow: auto; padding: 18px;
}
.accounts-modal__footer, .team-modal__footer, .bot-modal__footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 18px;
  border-top: 1px solid var(--line); flex-shrink: 0;
}
.accounts-modal__close, .team-modal__close, .bot-modal__close {
  margin-left: auto; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r); background: transparent; color: var(--muted); cursor: pointer; padding: 0; min-height: 0;
}
.accounts-modal__close:hover, .team-modal__close:hover, .bot-modal__close:hover { background: var(--hover); color: var(--text); }
.platform-picker, .platform-picker__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.platform-picker__card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--elevated); color: var(--secondary); cursor: pointer;
}
.platform-picker__card input { display: none; }
.platform-picker__card:has(input:checked) { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--text); }
body.modal-open { overflow: hidden; }
body.modal-open .topbar { visibility: hidden; }

/* Mobile dock styles live in core/mobile-nav.css */
.mobile-dock { display: none; }
@media (max-width: 768px) {
  .fm-board, .acc-board { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .accounts-modal[open], .team-modal[open], .bot-modal[open] {
    position: fixed; inset: auto 0 0 0; width: 100%; max-width: none; margin: 0;
    border-radius: 14px 14px 0 0; max-height: min(92dvh, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Placeholder dos painéis carregados sob demanda (/panel/:tab) */
.panel-remote-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40vh;
    color: var(--muted, #8a8f98);
    font-size: 14px;
}
.panel-remote-loading button {
    padding: 6px 14px;
    border: 1px solid var(--line, #333);
    border-radius: 8px;
    background: var(--surface, #1a1c1f);
    color: var(--text, #eee);
    cursor: pointer;
}

/* ===== core/backdrop.css ===== */
/* Ambient backdrop — minimal */

.app-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: var(--bg);
}

.app-backdrop::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 70% 50% at 50% -20%,
        color-mix(in srgb, var(--accent) 8%, transparent),
        transparent 70%
    );
}

[data-theme="light"] .app-backdrop::before {
    background: radial-gradient(
        ellipse 80% 55% at 50% -15%,
        color-mix(in srgb, var(--accent) 8%, transparent),
        transparent 72%
    );
}

.app-backdrop::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 5%, transparent 100%);
    opacity: 0.22;
}

[data-theme="light"] .app-backdrop::after {
    background-image: radial-gradient(circle, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px);
    opacity: 0.15;
}

.app-backdrop__orb {
    display: none;
}

/* ===== core/design-system.css ===== */
/* FlacosMedia — minimal design system */

:root,
[data-theme="dark"] {
    --r-xl: 12px;
    --r-2xl: 14px;
    --shadow-rich: var(--shadow);
    --shadow-card: 0 0 0 1px var(--line);
}

[data-theme="light"] {
    --shadow-card: 0 0 0 1px var(--border, var(--line));
}

/* Page headers — flat, no card wrapper */
.fm-hero,
.page-hero,
.dash-hero,
.bot-dash__hero,
#panel-reels .ig-page__head,
#panel-reels .ig-head,
#panel-team .team-page__header,
#panel-pixel .pixel-dash__header {
    position: static;
    isolation: auto;
    overflow: visible;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.fm-hero::before,
.page-hero::before,
.dash-hero::before,
.bot-dash__hero::before,
#panel-reels .ig-page__head::before,
#panel-reels .ig-head::before,
#panel-team .team-page__header::before,
#panel-pixel .pixel-dash__header::before,
.fm-hero::after,
.page-hero::after,
.dash-hero::after,
.bot-dash__hero::after,
#panel-reels .ig-page__head::after,
#panel-reels .ig-head::after,
#panel-team .team-page__header::after,
#panel-pixel .pixel-dash__header::after {
    content: none;
    display: none;
}

.fm-hero h2,
.page-hero__intro h2,
.dash-hero h2,
.bot-dash__hero h2,
#panel-reels .ig-page__title h2,
#panel-reels .ig-head__title h2 {
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.035em;
}

.fm-stat,
.fm-prop,
.page-hero__tag,
.notion-prop,
.page-stat,
#panel-reels .ig-metric,
#panel-reels .ig-stat {
    border-radius: var(--r, 8px);
    box-shadow: none;
}

.page-stat__icon,
.page-hero .team-stat__icon,
.page-hero .accounts-stat__icon {
    background: var(--soft);
    color: var(--secondary, var(--text-secondary));
}

#panel-reels .ig-metric {
    background: transparent;
    backdrop-filter: none;
}

#panel-reels button.ig-metric:not(:disabled):hover {
    border-color: var(--border-strong, var(--line-strong));
    box-shadow: none;
    background: var(--surface);
}

/* Primary — flat accent */
.btn--primary,
.btn-primary,
.accounts-modal__btn--primary {
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: none;
}

.btn--primary:hover,
.btn-primary:hover,
.accounts-modal__btn--primary:hover {
    background: var(--accent-hover);
    filter: none;
    color: #fff;
}

.btn--primary:active,
.btn-primary:active {
    transform: none;
}

/* Cards — hairline border, light shadow */
.card,
.fm-card,
.integrations-card,
.bot-card,
.pixel-card,
.stat-card,
.metric-card,
.overview-card,
.item,
.publish-composer,
.publish-post,
.publish-account,
.fm-col,
.acc-col,
.fm-table-wrap,
.notion-table-wrap,
.fm-card-acc,
.acc-card,
.account-card,
.team-panel,
.accounts-panel,
.import-panel {
    border-radius: var(--r-lg, 12px);
    box-shadow: var(--shadow);
}

.page-stat {
    box-shadow: var(--shadow);
}

/* Form controls */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
    min-height: 36px;
    padding: 8px 11px;
    border-radius: var(--r, 8px);
    background: var(--input-bg, var(--elevated));
}

[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: var(--surface);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
    background: var(--hover);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.fm-search,
.notion-toolbar__search {
    margin-bottom: 0;
}

.fm-search input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.notion-toolbar__search input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
    padding: 0 12px 0 34px;
}

#panel-reels .ig-search input {
    padding-left: 32px;
}

label {
    font-weight: 500;
}

.input-group {
    min-height: 40px;
    border-radius: var(--r, 8px);
    background: var(--input-bg, var(--elevated));
}

[data-theme="light"] .input-group {
    background: var(--surface);
}

.input-group__icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--soft);
    color: var(--muted);
}

.input-group:focus-within {
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Subnav */
.fm-tabs,
.publish-subnav,
.dash-subnav,
.dash-subnav__tabs,
.notion-views {
    border-radius: var(--r-lg, 12px);
    box-shadow: none;
}

.fm-tabs button.is-active,
.publish-subnav__btn.is-active,
.dash-subnav__tab.active,
.notion-view.is-active {
    box-shadow: none;
    color: var(--text);
}

/* Modals */
.accounts-modal,
.team-modal,
.bot-modal {
    border-radius: var(--r-lg, 12px);
    box-shadow: var(--shadow-lg);
}

.accounts-modal__header,
.team-modal__header,
.bot-modal__header {
    background: var(--surface);
}

/* Sidebar */
#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"],
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"],
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"],
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"],
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"],
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"],
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"] {
    background: var(--accent-soft);
    box-shadow: none;
}

#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"] .sidebar__link-icon,
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"] .sidebar__link-icon,
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"] .sidebar__link-icon,
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"] .sidebar__link-icon,
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"] .sidebar__link-icon,
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"] .sidebar__link-icon,
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"] .sidebar__link-icon {
    color: var(--text);
    opacity: 1;
}

.topbar {
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    box-shadow: none;
}

.empty-state {
    border-radius: var(--r-lg, 12px);
    background: transparent;
}

.empty-state__icon {
    background: var(--soft);
    color: var(--muted);
}

.mobile-dock {
    box-shadow: none;
}

@media (max-width: 768px) {
    .fm-hero,
    .page-hero,
    .dash-hero,
    .bot-dash__hero,
    #panel-reels .ig-page__head,
    #panel-team .team-page__header,
    #panel-pixel .pixel-dash__header {
        padding: 0;
        border-radius: 0;
    }
}

/* ===== core/theme-dark.css ===== */
/* Dark theme — unified surfaces, type and controls across all panels */

[data-theme="dark"] {
    --input-bg: var(--surface);
    --inset-bg: var(--elevated);
    --panel-muted: var(--secondary);
    --shell-glass: color-mix(in srgb, var(--elevated) 90%, transparent);
}

/* Typography */
[data-theme="dark"] h1 {
    color: var(--text);
}

[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] .panel-header h3,
[data-theme="dark"] .chart-card h3,
[data-theme="dark"] .section-label,
[data-theme="dark"] .team-filter-group__label,
[data-theme="dark"] .topbar__nav-label {
    color: var(--secondary);
}

[data-theme="dark"] .hint,
[data-theme="dark"] .quiet,
[data-theme="dark"] .empty,
[data-theme="dark"] .field-hint,
[data-theme="dark"] .publish-empty__text,
[data-theme="dark"] .editor-kicker,
[data-theme="dark"] .pixel-card-head__sub {
    color: var(--secondary);
}

[data-theme="dark"] label,
[data-theme="dark"] .field__label,
[data-theme="dark"] .stat-card .label,
[data-theme="dark"] .page-stat__label,
[data-theme="dark"] .team-stat__label,
[data-theme="dark"] .accounts-stat__label {
    color: var(--secondary);
}

/* Shell */
[data-theme="dark"] .topbar {
    background: var(--shell-glass);
    border-bottom-color: color-mix(in srgb, var(--line) 80%, transparent);
    box-shadow: none;
}

[data-theme="dark"] .mobile-dock {
    background: color-mix(in srgb, var(--elevated) 96%, transparent);
    border-top-color: var(--line);
}

[data-theme="dark"] .mobile-nav__link {
    color: var(--secondary);
}

[data-theme="dark"] .mobile-nav__icon {
    opacity: 0.88;
}

/* Cards & panels */
[data-theme="dark"] .card,
[data-theme="dark"] .fm-card,
[data-theme="dark"] .integrations-card,
[data-theme="dark"] .bot-card,
[data-theme="dark"] .pixel-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .overview-card,
[data-theme="dark"] .publish-composer,
[data-theme="dark"] .publish-queue,
[data-theme="dark"] .publish-post,
[data-theme="dark"] .publish-account,
[data-theme="dark"] .team-panel,
[data-theme="dark"] .accounts-panel,
[data-theme="dark"] .fm-col,
[data-theme="dark"] .acc-col,
[data-theme="dark"] .fm-card-acc,
[data-theme="dark"] .acc-card,
[data-theme="dark"] .account-card,
[data-theme="dark"] #panel-bot .panel,
[data-theme="dark"] #panel-bot .chart-card,
[data-theme="dark"] #panel-pixel .pixel-products,
[data-theme="dark"] #panel-pixel .pixel-editor,
[data-theme="dark"] #panel-downloader .dl-shell,
[data-theme="dark"] #panel-reels .ig-composer {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}

[data-theme="dark"] .fm-table-wrap,
[data-theme="dark"] .notion-table-wrap,
[data-theme="dark"] .table-wrap {
    background: var(--surface);
    border-color: var(--line);
}

/* Form controls */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .input-group,
[data-theme="dark"] .fm-select__trigger,
[data-theme="dark"] .dt-picker__trigger,
[data-theme="dark"] #panel-pixel .code-input,
[data-theme="dark"] #panel-pixel .pixel-name-input,
[data-theme="dark"] #panel-pixel .pixel-logs-bar__select,
[data-theme="dark"] #panel-downloader .dl-textarea {
    background: var(--input-bg);
    border-color: var(--line);
    color: var(--text);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--muted);
}

[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] .input-group:focus-within,
[data-theme="dark"] .fm-select__trigger:focus-visible,
[data-theme="dark"] .dt-picker__trigger:focus-visible {
    background: var(--hover);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

/* Tables */
[data-theme="dark"] .fm-table th,
[data-theme="dark"] .accounts-table th,
[data-theme="dark"] .notion-table th,
[data-theme="dark"] .data-table th,
[data-theme="dark"] #panel-bot .data-table th,
[data-theme="dark"] #panel-team .team-table th {
    background: var(--soft);
    color: var(--secondary);
}

[data-theme="dark"] .fm-table td,
[data-theme="dark"] .accounts-table td,
[data-theme="dark"] .notion-table td,
[data-theme="dark"] .data-table td,
[data-theme="dark"] #panel-bot .data-table td,
[data-theme="dark"] #panel-team .team-table td {
    color: var(--text);
    border-color: var(--line);
}

/* Segmented controls */
[data-theme="dark"] .fm-tabs,
[data-theme="dark"] .publish-subnav,
[data-theme="dark"] .dash-subnav,
[data-theme="dark"] .dash-subnav__tabs,
[data-theme="dark"] .notion-views,
[data-theme="dark"] .team-segment,
[data-theme="dark"] .accounts-toolbar__segment,
[data-theme="dark"] #panel-reels .ig-seg,
[data-theme="dark"] #panel-publish .publish-seg,
[data-theme="dark"] #panel-downloader .dl-composer__platforms {
    background: var(--soft);
    border-color: var(--line);
}

[data-theme="dark"] .fm-tabs button,
[data-theme="dark"] .publish-subnav__btn,
[data-theme="dark"] .dash-subnav__tab,
[data-theme="dark"] .notion-view,
[data-theme="dark"] .team-segment__btn,
[data-theme="dark"] .accounts-toolbar__seg,
[data-theme="dark"] #panel-reels .ig-seg__btn,
[data-theme="dark"] #panel-publish .publish-seg__btn,
[data-theme="dark"] .fm-chip,
[data-theme="dark"] .notion-chip,
[data-theme="dark"] #panel-reels .ig-chip {
    color: var(--secondary);
}

[data-theme="dark"] .fm-tabs button.is-active,
[data-theme="dark"] .publish-subnav__btn.is-active,
[data-theme="dark"] .dash-subnav__tab.active,
[data-theme="dark"] .dash-subnav__tab.is-active,
[data-theme="dark"] .notion-view.is-active,
[data-theme="dark"] .team-segment__btn.is-active,
[data-theme="dark"] .accounts-toolbar__seg.is-active,
[data-theme="dark"] #panel-reels .ig-seg__btn.is-active,
[data-theme="dark"] #panel-publish .publish-seg__btn.is-active,
[data-theme="dark"] .fm-chip.is-active,
[data-theme="dark"] .notion-chip.is-active,
[data-theme="dark"] #panel-reels .ig-chip.is-active {
    background: var(--hover);
    color: var(--text);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line-strong) 70%, transparent);
}

[data-theme="dark"] .fm-chip.is-active,
[data-theme="dark"] .notion-chip.is-active {
    border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
    color: var(--text);
}

/* Secondary buttons */
[data-theme="dark"] .btn--secondary,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn--ghost,
[data-theme="dark"] .dropdown-trigger {
    color: var(--text);
    border-color: var(--line);
}

[data-theme="dark"] .btn--secondary:hover,
[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn--ghost:hover,
[data-theme="dark"] .dropdown-trigger:hover {
    background: var(--hover);
    color: var(--text);
}

/* Modals & overlays */
[data-theme="dark"] .accounts-modal,
[data-theme="dark"] .team-modal,
[data-theme="dark"] .bot-modal,
[data-theme="dark"] .publish-modal,
[data-theme="dark"] .fm-select__menu,
[data-theme="dark"] .dt-picker__popover {
    background: var(--elevated);
    border-color: var(--line);
    color: var(--text);
}

[data-theme="dark"] .accounts-modal__header,
[data-theme="dark"] .team-modal__header,
[data-theme="dark"] .bot-modal__header {
    background: var(--surface);
    border-color: var(--line);
}

/* Page-specific shells */
[data-theme="dark"] #panel-downloader .dl-composer {
    background: color-mix(in srgb, var(--soft) 45%, var(--surface));
}

[data-theme="dark"] #panel-downloader .dl-cookies {
    background: var(--surface);
    border-color: var(--line);
}

[data-theme="dark"] #panel-reels .ig-composer {
    background: color-mix(in srgb, var(--soft) 40%, var(--surface));
}

[data-theme="dark"] #panel-reels .ig-toolbar,
[data-theme="dark"] #panel-reels .ig-queue__item {
    background: var(--surface);
    border-color: var(--line);
}

[data-theme="dark"] #panel-publish .publish-queue__body,
[data-theme="dark"] #panel-publish .publish-strip,
[data-theme="dark"] #panel-publish .publish-dropzone--reel {
    background: color-mix(in srgb, var(--soft) 35%, var(--surface));
    border-color: var(--line);
}

[data-theme="dark"] #panel-pixel .platform-switch {
    background: var(--soft);
    border-color: var(--line);
}

[data-theme="dark"] #panel-pixel .product-item {
    color: var(--secondary);
}

[data-theme="dark"] #panel-pixel .product-item.is-active,
[data-theme="dark"] #panel-pixel .product-item:hover {
    background: var(--hover);
    color: var(--text);
}

[data-theme="dark"] #panel-bot .stat-card:hover,
[data-theme="dark"] #panel-bot .panel:hover {
    background: var(--hover);
    border-color: var(--line-strong);
}

[data-theme="dark"] #panel-team .team-search input,
[data-theme="dark"] #panel-accounts .accounts-toolbar__search input,
[data-theme="dark"] .fm-search input,
[data-theme="dark"] .notion-toolbar__search input {
    background: var(--input-bg);
    color: var(--text);
}

[data-theme="dark"] .empty-state__icon {
    background: var(--soft);
    color: var(--secondary);
}

[data-theme="dark"] .page-stat__icon,
[data-theme="dark"] .team-stat__icon,
[data-theme="dark"] .accounts-stat__icon {
    background: var(--soft);
    color: var(--text);
}

[data-theme="dark"] .fm-toast,
[data-theme="dark"] .acc-toast {
    background: var(--elevated);
    border-color: var(--line);
    color: var(--text);
}

/* ===== core/page-hero.css ===== */
/* Shared page header */

.page-hero,
.notion-page__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px 20px;
}

.page-hero__intro,
.notion-page__intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    max-width: 44rem;
}

.page-hero__intro h2,
.notion-page__title {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.035em;
    line-height: 1.2;
}

.page-hero__desc,
.notion-page__desc {
    margin: 0;
    max-width: 52ch;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.notion-page__icon { display: none; }

.page-hero__stats,
.page-hero__tags,
.notion-props {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-hero__tag,
.notion-prop {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 12px;
    box-shadow: var(--shadow-xs);
}

.notion-prop__icon {
    display: inline-flex;
    color: var(--muted);
}

.notion-prop__name {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.notion-prop__value {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.page-stat,
.page-hero .team-stat,
.page-hero .accounts-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.page-stat__icon,
.page-hero .team-stat__icon,
.page-hero .accounts-stat__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm, 6px);
    background: var(--soft);
    color: var(--text-secondary);
}

.page-stat__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.page-stat__label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.page-stat__value {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.page-stat__hint,
.reels-stat__hint,
.accounts-stat__hint,
.team-stat__hint,
.accounts-panel__count-hint {
    display: none;
}

.page-stat--warn .page-stat__icon {
    background: var(--warn-bg);
    color: var(--warn);
}

.page-stat--warn .page-stat__value { color: var(--warn); }

.team-panel,
.accounts-panel,
.import-panel {
    box-shadow: var(--shadow-card);
}

@media (max-width: 768px) {
    .page-hero,
    .notion-page__header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-hero__desc,
    .notion-page__desc { max-width: none; }
}

/* ===== core/sidebar.css ===== */
/* Sidebar — Sequoia Settings structure (solid, aligned rail) */

.sidebar {
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
    width: var(--sidebar-w);
    height: 100vh;
    border-right: 1px solid var(--line);
    background: var(--elevated);
    box-shadow: none;
    transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-pad: 12px;
    --sidebar-inset: 6px;
    --sidebar-rail: 28px;
    --sidebar-gap: 10px;
    --sidebar-control: 28px;
    --sidebar-text-x: calc(var(--sidebar-inset) + var(--sidebar-rail) + var(--sidebar-gap));
    --sidebar-item-h: 32px;
    --sidebar-section-gap: 18px;
}

.sidebar__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Header — locked to topbar height for a continuous shell line */
.sidebar__header {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 8px;
    justify-content: space-between;
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    padding: 0 var(--sidebar-pad);
    box-sizing: border-box;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    min-height: var(--sidebar-control);
}

.sidebar__brand .brand {
    display: flex;
    align-items: center;
    gap: var(--sidebar-gap);
    min-width: 0;
    width: 100%;
    height: var(--sidebar-control);
    padding-left: var(--sidebar-inset);
    box-sizing: border-box;
}

.sidebar__brand .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    border-radius: 7px;
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    box-shadow: none;
    color: var(--accent);
    flex-shrink: 0;
    height: var(--sidebar-rail);
    width: var(--sidebar-rail);
}

.sidebar__brand .brand-mark svg,
.sidebar__brand .brand-mark__logo {
    display: block;
    height: 16px;
    width: 16px;
}

.sidebar__brand .brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    line-height: 1;
}

.sidebar__brand .brand-text strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__brand .brand-text span {
    display: none;
}

.sidebar__toolbar {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 2px;
    height: var(--sidebar-control);
}

.sidebar__collapse,
.sidebar__close {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: none;
    flex-shrink: 0;
    height: var(--sidebar-control);
    justify-content: center;
    padding: 0;
    position: relative;
    transition: background 120ms ease, color 120ms ease;
    width: var(--sidebar-control);
}

.sidebar__collapse:hover,
.sidebar__close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.sidebar__collapse-icon {
    display: block;
    flex-shrink: 0;
    height: 16px;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
}

.sidebar__collapse .sidebar__collapse-icon--out {
    display: none;
}

html[data-sidebar-collapsed="true"] .sidebar__collapse .sidebar__collapse-icon--in {
    display: none;
}

html[data-sidebar-collapsed="true"] .sidebar__collapse .sidebar__collapse-icon--out {
    display: block;
}

/* Body / nav */
.sidebar__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px var(--sidebar-pad) 12px;
    scrollbar-color: color-mix(in srgb, var(--border) 70%, transparent) transparent;
    scrollbar-width: thin;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: var(--sidebar-section-gap);
}

.sidebar__section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar__section + .sidebar__section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.sidebar__section-title {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
    margin: 0 0 2px;
    padding: 4px var(--sidebar-inset) 4px var(--sidebar-text-x);
    text-transform: none;
}

.sidebar__section:first-child .sidebar__section-title {
    padding-top: 2px;
}

.sidebar__menu {
    display: flex;
    flex-direction: column;
    gap: 1px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar__item {
    margin: 0;
}

/* Tree group — fixed sub-topics (Social) */
.sidebar__tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
}

.sidebar__tree-head {
    align-items: center;
    color: var(--secondary);
    display: flex;
    font-size: 12px;
    font-weight: 600;
    gap: var(--sidebar-gap);
    letter-spacing: 0.04em;
    line-height: 1;
    min-height: 30px;
    padding: 0 var(--sidebar-inset);
    text-transform: uppercase;
}

.sidebar__tree-head-icon {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    height: var(--sidebar-rail);
    justify-content: center;
    opacity: 0.75;
    width: var(--sidebar-rail);
}

.sidebar__tree-head-icon svg {
    display: block;
    height: 15px;
    width: 15px;
}

.sidebar__tree-head-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__tree-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    list-style: none;
    margin: 0 0 2px;
    padding: 0 0 0 calc(var(--sidebar-text-x) - 10px);
    position: relative;
}

.sidebar__tree-menu::before {
    background: color-mix(in srgb, var(--line) 80%, transparent);
    bottom: 8px;
    content: "";
    left: calc(var(--sidebar-inset) + var(--sidebar-rail) / 2 - 0.5px);
    position: absolute;
    top: 6px;
    width: 1px;
}

.sidebar__tree-item {
    margin: 0;
    position: relative;
}

.sidebar__tree-item::before {
    background: color-mix(in srgb, var(--line) 80%, transparent);
    content: "";
    height: 1px;
    left: calc(var(--sidebar-inset) + var(--sidebar-rail) / 2 - 8px);
    position: absolute;
    top: calc(var(--sidebar-item-h) / 2);
    width: 8px;
}

.sidebar__sublink {
    align-items: center;
    border-radius: 8px;
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    font-size: 13.5px;
    font-weight: 500;
    gap: 8px;
    line-height: 1.2;
    margin: 0;
    min-height: calc(var(--sidebar-item-h) - 2px);
    padding: 0 10px 0 4px;
    position: relative;
    transition: background 120ms ease, color 120ms ease;
}

.sidebar__sublink-icon {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    height: 24px;
    justify-content: center;
    opacity: 0.8;
    width: 24px;
}

.sidebar__sublink-icon svg {
    display: block;
    height: 16px;
    width: 16px;
}

.sidebar__sublink-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__sublink:hover {
    background: var(--hover);
    color: var(--text);
}

.sidebar__sublink:hover .sidebar__sublink-icon {
    opacity: 1;
}

.sidebar__sublink.is-active {
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 600;
}

.sidebar__sublink.is-active .sidebar__sublink-icon {
    color: var(--accent);
    opacity: 1;
}

.sidebar__tree.has-active-child .sidebar__tree-head {
    color: var(--text);
}

.sidebar__tree.has-active-child .sidebar__tree-head-icon {
    color: var(--accent);
    opacity: 0.9;
}

.sidebar__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--sidebar-gap);
    min-height: var(--sidebar-item-h);
    margin: 0;
    padding: 0 var(--sidebar-inset);
    border-radius: 8px;
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.2;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.sidebar__link::before {
    display: none;
}

.sidebar__link-icon {
    align-items: center;
    color: inherit;
    display: flex;
    flex-shrink: 0;
    height: var(--sidebar-rail);
    justify-content: center;
    width: var(--sidebar-rail);
    opacity: 0.88;
}

.sidebar__link-icon svg {
    display: block;
    height: 16px;
    width: 16px;
}

.sidebar__link[for="tab-pixel"] .sidebar__link-icon svg {
    transform: scale(1.04);
    transform-origin: center;
}

.sidebar__link-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__link:hover {
    background: var(--hover);
    color: var(--text);
}

.sidebar__link:hover .sidebar__link-icon {
    opacity: 1;
}

.sidebar__badge {
    background: var(--accent);
    border-radius: 999px;
    color: #fff;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    min-width: 18px;
    padding: 3px 6px;
    text-align: center;
}

#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"],
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"],
#tab-accounts:checked ~ .sidebar .sidebar__link[for="tab-accounts"],
#tab-publish:checked ~ .sidebar .sidebar__link[for="tab-publish"],
#tab-analytics:checked ~ .sidebar .sidebar__link[for="tab-analytics"],
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"],
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"],
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"],
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"],
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"] {
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 600;
}

#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"]::before,
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"]::before,
#tab-accounts:checked ~ .sidebar .sidebar__link[for="tab-accounts"]::before,
#tab-publish:checked ~ .sidebar .sidebar__link[for="tab-publish"]::before,
#tab-analytics:checked ~ .sidebar .sidebar__link[for="tab-analytics"]::before,
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"]::before,
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"]::before,
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"]::before,
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"]::before,
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"]::before {
    display: none;
}

#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"] .sidebar__link-icon,
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"] .sidebar__link-icon,
#tab-accounts:checked ~ .sidebar .sidebar__link[for="tab-accounts"] .sidebar__link-icon,
#tab-publish:checked ~ .sidebar .sidebar__link[for="tab-publish"] .sidebar__link-icon,
#tab-analytics:checked ~ .sidebar .sidebar__link[for="tab-analytics"] .sidebar__link-icon,
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"] .sidebar__link-icon,
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"] .sidebar__link-icon,
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"] .sidebar__link-icon,
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"] .sidebar__link-icon,
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"] .sidebar__link-icon {
    color: var(--accent);
    opacity: 1;
}

/* Footer */
.sidebar__footer {
    border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    flex-shrink: 0;
    padding: 10px var(--sidebar-pad) 12px;
}

.sidebar__profile {
    align-items: center;
    border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--soft) 45%, var(--surface));
    display: flex;
    gap: var(--sidebar-gap);
    min-height: 44px;
    min-width: 0;
    padding: 6px var(--sidebar-inset) 6px 6px;
    transition: background 120ms ease, border-color 120ms ease;
}

.sidebar__profile:hover {
    background: var(--hover);
    border-color: var(--line-strong);
}

.sidebar__avatar {
    align-items: center;
    background: color-mix(in srgb, var(--accent) 14%, var(--soft));
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 650;
    height: 28px;
    justify-content: center;
    width: 28px;
}

.sidebar__user-meta {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
    min-width: 0;
}

.sidebar__user-name {
    color: var(--text);
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__user-role {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__quick-actions {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 2px;
}

.sidebar__icon-btn,
.sidebar__theme.theme-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    flex-shrink: 0;
    height: var(--sidebar-control);
    justify-content: center;
    padding: 0;
    transition: background 120ms ease, color 120ms ease;
    width: var(--sidebar-control);
}

.sidebar__icon-btn:hover,
.sidebar__theme.theme-toggle:hover {
    background: color-mix(in srgb, var(--surface-hover) 80%, var(--border));
    color: var(--text);
}

.sidebar__logout {
    margin: 0;
}

.sidebar__logout-btn svg,
.sidebar__theme.theme-toggle svg {
    display: block;
}

.theme-toggle__icon {
    align-items: center;
    display: flex;
    justify-content: center;
}

.theme-toggle__icon--light {
    display: none;
}

[data-theme="light"] .theme-toggle__icon--dark {
    display: none;
}

[data-theme="light"] .theme-toggle__icon--light {
    display: flex;
}

.theme-toggle--floating {
    position: fixed;
    right: var(--space-4);
    top: var(--space-4);
    z-index: 50;
}

.sidebar-backdrop {
    display: none;
}

/* Theme — keep sidebar on shared tokens (same tone as the app) */
[data-theme="dark"] .sidebar__link-icon,
[data-theme="dark"] .sidebar__sublink-icon {
    opacity: 0.9;
}

[data-theme="dark"] .sidebar__collapse,
[data-theme="dark"] .sidebar__close,
[data-theme="dark"] .sidebar__icon-btn,
[data-theme="dark"] .sidebar__theme.theme-toggle {
    color: var(--secondary);
}

[data-theme="dark"] .sidebar__collapse:hover,
[data-theme="dark"] .sidebar__close:hover,
[data-theme="dark"] .sidebar__icon-btn:hover,
[data-theme="dark"] .sidebar__theme.theme-toggle:hover {
    background: var(--hover);
    color: var(--text);
}

/* Collapsed (desktop) */
@media (min-width: 769px) {
    .sidebar__collapse {
        display: flex;
    }

    html[data-sidebar-collapsed="true"] .sidebar {
        overflow: visible;
        width: var(--sidebar-w-collapsed);
    }

    html[data-sidebar-collapsed="true"] .sidebar__inner {
        overflow: visible;
    }

    html[data-sidebar-collapsed="true"] .sidebar__header {
        flex-direction: column;
        align-items: center;
        gap: 6px;
        height: auto;
        min-height: var(--topbar-h);
        padding: 10px 8px 8px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__brand {
        display: flex;
        flex: none;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    html[data-sidebar-collapsed="true"] .sidebar__brand .brand {
        gap: 0;
        justify-content: center;
        width: auto;
        padding-left: 0;
        margin: 0;
    }

    html[data-sidebar-collapsed="true"] .sidebar__brand .brand-mark {
        height: 28px;
        width: 28px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__toolbar {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    html[data-sidebar-collapsed="true"] .sidebar__section-title,
    html[data-sidebar-collapsed="true"] .sidebar__link-label,
    html[data-sidebar-collapsed="true"] .sidebar__tree-head-label,
    html[data-sidebar-collapsed="true"] .sidebar__sublink-label,
    html[data-sidebar-collapsed="true"] .sidebar__user-meta,
    html[data-sidebar-collapsed="true"] .sidebar .brand-text {
        display: none;
    }

    html[data-sidebar-collapsed="true"] .sidebar__section + .sidebar__section {
        border-top: 0;
        margin-top: 0;
        padding-top: 0;
    }

    html[data-sidebar-collapsed="true"] .sidebar__body {
        overflow: visible;
        padding: 8px 8px 12px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__nav {
        gap: 8px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__item {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    html[data-sidebar-collapsed="true"] .sidebar__menu {
        align-items: center;
    }

    html[data-sidebar-collapsed="true"] .sidebar__link {
        height: 40px;
        justify-content: center;
        min-height: 40px;
        padding: 0;
        width: 40px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__link::before {
        left: 2px;
        height: 0;
        width: 3px;
    }

    html[data-sidebar-collapsed="true"] #tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"]::before,
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"]::before,
    html[data-sidebar-collapsed="true"] #tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"]::before,
    html[data-sidebar-collapsed="true"] #tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"]::before,
    html[data-sidebar-collapsed="true"] #tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"]::before,
    html[data-sidebar-collapsed="true"] #tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"]::before,
    html[data-sidebar-collapsed="true"] #tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"]::before {
        height: 18px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__tree-head {
        display: none;
    }

    html[data-sidebar-collapsed="true"] .sidebar__tree-menu {
        align-items: center;
        gap: 4px;
        padding: 0;
    }

    html[data-sidebar-collapsed="true"] .sidebar__tree-menu::before,
    html[data-sidebar-collapsed="true"] .sidebar__tree-item::before {
        display: none;
    }

    html[data-sidebar-collapsed="true"] .sidebar__tree-item {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    html[data-sidebar-collapsed="true"] .sidebar__sublink {
        height: 40px;
        justify-content: center;
        min-height: 40px;
        padding: 0;
        width: 40px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__sublink-icon {
        height: 20px;
        opacity: 0.88;
        width: 20px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__sublink,
    html[data-sidebar-collapsed="true"] .sidebar__sublink:hover::after {
        position: relative;
    }

    html[data-sidebar-collapsed="true"] .sidebar__sublink:hover::after {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 6px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
        color: var(--text);
        content: attr(data-tooltip);
        font-size: 12px;
        font-weight: 500;
        left: calc(100% + 8px);
        letter-spacing: normal;
        line-height: 1.2;
        padding: 6px 8px;
        pointer-events: none;
        position: absolute;
        text-transform: none;
        top: 50%;
        transform: translateY(-50%);
        white-space: nowrap;
        z-index: 400;
    }

    html[data-sidebar-collapsed="true"] .sidebar__link-icon {
        height: 20px;
        opacity: 0.88;
        width: 20px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__badge {
        font-size: 0;
        height: 7px;
        min-width: 7px;
        padding: 0;
        position: absolute;
        right: 5px;
        top: 5px;
        width: 7px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__footer {
        padding: 8px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__profile {
        align-items: center;
        flex-direction: column;
        gap: 6px;
        padding: 0;
    }

    html[data-sidebar-collapsed="true"] .sidebar__profile:hover {
        background: transparent;
    }

    html[data-sidebar-collapsed="true"] .sidebar__quick-actions {
        flex-direction: column;
        gap: 4px;
        width: 100%;
    }

    html[data-sidebar-collapsed="true"] .sidebar__avatar {
        height: 32px;
        width: 32px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__theme.theme-toggle,
    html[data-sidebar-collapsed="true"] .sidebar__logout-btn {
        height: 40px;
        width: 40px;
    }

    html[data-sidebar-collapsed="true"] .sidebar__link,
    html[data-sidebar-collapsed="true"] .sidebar__collapse,
    html[data-sidebar-collapsed="true"] .sidebar__avatar,
    html[data-sidebar-collapsed="true"] .sidebar__theme,
    html[data-sidebar-collapsed="true"] .sidebar__logout-btn {
        position: relative;
    }

    html[data-sidebar-collapsed="true"] .sidebar__link:hover::after,
    html[data-sidebar-collapsed="true"] .sidebar__collapse:hover::after,
    html[data-sidebar-collapsed="true"] .sidebar__avatar:hover::after,
    html[data-sidebar-collapsed="true"] .sidebar__theme:hover::after,
    html[data-sidebar-collapsed="true"] .sidebar__logout-btn:hover::after {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 6px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
        color: var(--text);
        content: attr(data-tooltip);
        font-size: 12px;
        font-weight: 500;
        left: calc(100% + 8px);
        letter-spacing: normal;
        line-height: 1.2;
        padding: 6px 8px;
        pointer-events: none;
        position: absolute;
        text-transform: none;
        top: 50%;
        transform: translateY(-50%);
        white-space: nowrap;
        z-index: 400;
    }
}

/* Mobile drawer */
@media (max-width: 768px) {
    .sidebar {
        --sidebar-pad: 16px;
        border-right: none;
        height: 100dvh;
        left: 0;
        max-width: min(300px, 84vw);
        position: fixed;
        top: 0;
        transform: translateX(-100%);
        transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1);
        width: min(300px, 84vw);
        z-index: 200;
    }

    .sidebar__inner {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .sidebar__header {
        height: var(--topbar-h);
        min-height: var(--topbar-h);
        padding: 0 var(--sidebar-pad);
    }

    .sidebar__toolbar .sidebar__collapse {
        display: none;
    }

    .sidebar__close {
        display: flex;
    }

    .sidebar__body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 12px var(--sidebar-pad) 16px;
    }

    .sidebar__link {
        min-height: 40px;
    }

    .sidebar__footer {
        padding:
            10px
            var(--sidebar-pad)
            max(14px, env(safe-area-inset-bottom, 0px));
    }

    .sidebar__profile {
        min-height: 40px;
    }

    .sidebar-backdrop {
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        background: var(--overlay);
        display: block;
        inset: 0;
        opacity: 0;
        pointer-events: none;
        position: fixed;
        transition: opacity 240ms ease;
        z-index: 150;
    }

    .sidebar-toggle:checked ~ .sidebar {
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
        transform: translateX(0);
    }

    .sidebar-toggle:checked ~ .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ===== core/topbar.css ===== */
/* Topbar — minimal SaaS shell header */

.topbar {
    --shell-control: 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    isolation: isolate;
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    padding: 0 var(--page-x, 24px);
    box-sizing: border-box;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    background: var(--bg);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.topbar__lead {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    height: 100%;
}

.topbar__menu {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--secondary);
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.topbar__menu:hover {
    border-color: var(--line-strong);
    background: var(--hover);
    color: var(--text);
}

.topbar__brand {
    display: none;
    min-width: 0;
}

.topbar__brand .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 100%;
}

.topbar__brand .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
}

.topbar__brand .brand-mark svg,
.topbar__brand .brand-mark__logo {
    display: block;
    width: 16px;
    height: 16px;
    transform: translateY(0.5px);
}

.topbar__brand .brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1;
}

.topbar__brand .brand-text strong {
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.topbar__nav {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: var(--shell-control);
}

.topbar__nav-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.topbar__nav-page {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 0;
    height: var(--shell-control);
    min-height: var(--shell-control);
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1;
    white-space: nowrap;
}

.topbar__page {
    display: none;
    animation: topbar-crumb-in 180ms var(--ease, ease);
}

#tab-productivity:checked ~ .app-shell .topbar__page[data-tab="productivity"],
#tab-reels:checked ~ .app-shell .topbar__page[data-tab="reels"],
#tab-accounts:checked ~ .app-shell .topbar__page[data-tab="accounts"],
#tab-publish:checked ~ .app-shell .topbar__page[data-tab="publish"],
#tab-analytics:checked ~ .app-shell .topbar__page[data-tab="analytics"],
#tab-downloader:checked ~ .app-shell .topbar__page[data-tab="downloader"],
#tab-studio:checked ~ .app-shell .topbar__page[data-tab="studio"],
#tab-team:checked ~ .app-shell .topbar__page[data-tab="team"],
#tab-bot:checked ~ .app-shell .topbar__page[data-tab="bot"],
#tab-pixel:checked ~ .app-shell .topbar__page[data-tab="pixel"] {
    display: inline;
}

.topbar__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
    height: 100%;
}

.topbar__queue {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 220px;
    height: var(--shell-control);
    min-height: var(--shell-control);
    padding: 0 11px;
    border: 1px solid color-mix(in srgb, var(--warn) 24%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--warn-bg) 80%, var(--surface));
    color: var(--warn);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.topbar__queue-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 16%, transparent);
    animation: topbar-pulse 1.6s ease infinite;
}

.topbar__queue-count,
.topbar__queue-trigger {
    display: none;
}

.topbar__cluster {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: calc(var(--shell-control) + 6px);
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 88%, var(--soft));
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

.topbar__tool,
.topbar__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--shell-control);
    height: var(--shell-control);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--secondary);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.topbar__tool:hover,
.topbar__icon:hover {
    background: var(--hover);
    color: var(--text);
}

.topbar__tool .theme-toggle__label {
    display: none;
}

.topbar__tool .theme-toggle__icon {
    align-items: center;
    justify-content: center;
}

.topbar__tool .theme-toggle__icon--light {
    display: none;
}

.topbar__tool .theme-toggle__icon--dark {
    display: inline-flex;
}

[data-theme="light"] .topbar__tool .theme-toggle__icon--dark {
    display: none;
}

[data-theme="light"] .topbar__tool .theme-toggle__icon--light {
    display: inline-flex;
}

.topbar__user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 176px;
    height: var(--shell-control);
    min-height: var(--shell-control);
    padding: 0 10px 0 3px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    transition: background 140ms ease;
}

.topbar__user:hover {
    background: var(--hover);
}

.topbar__avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--accent) 65%, var(--primary)));
    color: var(--primary-fg);
}

.topbar__user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 0;
    padding-right: 2px;
}

.topbar__user-name {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: -0.01em;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar__user-role {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

.topbar__user-role.is-admin {
    padding: 1px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent-soft) 75%, var(--surface));
    color: var(--accent);
}

.topbar__logout {
    margin: 0;
}

.topbar__logout-btn:hover {
    background: var(--bad-bg);
    color: var(--bad);
}

@keyframes topbar-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .55; transform: scale(.86); }
}

@keyframes topbar-crumb-in {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .topbar {
        height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
        min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
        padding:
            env(safe-area-inset-top, 0px)
            max(var(--page-x), env(safe-area-inset-right, 0px))
            0
            max(var(--page-x), env(safe-area-inset-left, 0px));
        background: color-mix(in srgb, var(--elevated) 90%, transparent);
    }

    .topbar__lead,
    .topbar__actions {
        height: var(--topbar-h);
        min-height: var(--topbar-h);
        align-items: center;
    }

    .topbar__menu {
        display: inline-flex;
        width: var(--shell-control);
        height: var(--shell-control);
    }

    .topbar__brand {
        display: flex;
        align-items: center;
        height: var(--shell-control);
    }

    .topbar__nav {
        display: none;
    }

    .topbar__cluster {
        gap: 2px;
        height: calc(var(--shell-control) + 6px);
        padding: 3px;
    }

    .topbar__tool,
    .topbar__icon {
        width: var(--shell-control);
        height: var(--shell-control);
    }

    .topbar__action--desktop {
        display: none;
    }

    .topbar__queue {
        justify-content: center;
        width: var(--shell-control);
        min-width: var(--shell-control);
        height: var(--shell-control);
        padding: 0;
    }

    .topbar__queue-dot,
    .topbar__queue-text {
        display: none;
    }

    .topbar__queue-count {
        display: block;
        font-size: 12px;
        font-weight: 700;
        line-height: 1;
    }

    .topbar__user {
        max-width: none;
        height: var(--shell-control);
        min-height: var(--shell-control);
        padding: 0 3px;
    }

    .topbar__user-info {
        display: none;
    }

    .topbar__avatar {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
}

@media (min-width: 420px) and (max-width: 768px) {
    .topbar__user {
        gap: 8px;
        padding: 3px 10px 3px 3px;
    }

    .topbar__user-info {
        display: flex;
        justify-content: center;
    }

    .topbar__user-role {
        display: none;
    }

    .topbar__user-name {
        max-width: 72px;
        font-size: 11px;
    }
}

@media (max-width: 380px) {
    .topbar__brand .brand-text {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .topbar__page,
    .topbar__queue-dot {
        animation: none;
    }
}

/* ===== core/mobile.css ===== */
/* Mobile shell — spacing, safe areas, shared panel patterns */

@media (max-width: 768px) {
    :root,
    [data-theme="dark"],
    [data-theme="light"] {
        --page-x: 16px;
        --page-py: 16px;
        --page-pb: 20px;
        --panel-x: var(--page-x);
        --gap-page: 16px;
        --gap-section: 14px;
        --topbar-h: 56px;
        --mobile-nav-h: 56px;
        --mobile-stack-gap: 14px;
        --mobile-section-gap: 12px;
        --mobile-stat-gap: 8px;
        --mobile-stat-pad-y: 8px;
        --mobile-stat-pad-x: 8px;
        --mobile-stat-value: 18px;
        --mobile-stat-label: 9px;
        --mobile-hero-title: 20px;
        --mobile-touch-min: 44px;
        --px: var(--page-x);
    }

    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        min-height: 100dvh;
        overflow-x: clip;
    }

    .app,
    .tabs {
        min-height: 100dvh;
        overflow-x: clip;
    }

    .app-shell {
        min-height: 100dvh;
        min-width: 0;
        overflow-x: clip;
        width: 100%;
    }

    .app-main,
    .tab-panels,
    .tab-panel {
        max-width: 100%;
        min-width: 0;
        overflow-x: clip;
    }

    .app-main {
        padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    /* Unified page shell — same inset everywhere */
    .page,
    .fm-page,
    .bot-dash,
    .pixel-page,
    .pixel-dash,
    .team-page,
    .publish-page,
    .accounts-page,
    .reels-dash,
    .dl-page,
    .ig-page,
    .reel,
    #panel-reels .ig-page,
    #panel-reels .reel,
    #panel-downloader .dl-page,
    #panel-publish .publish-page,
    #panel-analytics .anx,
    #panel-accounts .accounts-page,
    #panel-team .team-page,
    #panel-bot .bot-dash,
    #panel-pixel .pixel-dash {
        box-sizing: border-box;
        gap: var(--mobile-stack-gap);
        margin: 0;
        min-width: 0;
        padding: var(--page-py) var(--page-x) var(--page-pb);
        width: 100%;
    }

    .page-hero,
    .accounts-hero,
    .team-page__header,
    #panel-bot .dash-hero,
    #panel-pixel .pixel-dash__header,
    #panel-reels .ig-head,
    #panel-reels .reel-head,
    #panel-accounts .accounts-page__head,
    #panel-publish .publish-page__head,
    #panel-analytics .anx-head,
    #panel-downloader .dl-head {
        gap: var(--mobile-section-gap);
        min-width: 0;
        width: 100%;
    }

    .page-hero__intro,
    .accounts-hero .page-hero__intro,
    .team-page__intro,
    #panel-bot .dash-hero__copy,
    #panel-pixel .dash-hero__copy,
    #panel-reels .ig-head__title,
    #panel-reels .reel-head__identity {
        gap: var(--space-1);
        min-width: 0;
    }

    .page-hero__intro h2,
    .accounts-hero .page-hero__intro h2,
    .team-page__intro h2,
    #panel-bot .dash-hero__copy h2,
    #panel-pixel .dash-hero__copy h2,
    #panel-reels .ig-head__title h2,
    #panel-reels .reel-head h2,
    #panel-accounts .accounts-page__head h2,
    #panel-publish .publish-page__head h2,
    #panel-analytics .anx-head__title,
    #panel-downloader .dl-head__title,
    h2 {
        font-size: var(--mobile-hero-title);
        letter-spacing: -0.02em;
        line-height: 1.15;
    }

    .page-hero__desc {
        font-size: var(--font-sm);
        max-width: none;
    }

    .toast,
    .notice {
        font-size: var(--font-sm);
        margin-inline: var(--page-x);
        padding: var(--space-3) var(--space-4);
    }

    /* Hero stats — compact grid */
    .page-hero__stats,
    .import-summary,
    .team-page__stats,
    .team-stats,
    .accounts-stats,
    .accounts-summary,
    .ranking-summary {
        display: grid;
        gap: var(--mobile-stat-gap);
        grid-template-columns: repeat(3, minmax(0, 1fr));
        min-width: 0;
        width: 100%;
    }

    .accounts-stats,
    .accounts-summary,
    .team-page__stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-stat,
    .accounts-stat,
    .team-stat {
        align-items: center;
        flex-direction: column;
        gap: var(--space-1);
        max-width: none;
        min-width: 0;
        padding: var(--mobile-stat-pad-y) var(--mobile-stat-pad-x);
        text-align: center;
    }

    .accounts-stat--total,
    .team-stat--total {
        flex-direction: row;
        gap: var(--space-2);
        grid-column: 1 / -1;
        padding: var(--space-3);
        text-align: left;
    }

    .accounts-stat--total .accounts-stat__body,
    .team-stat--total .team-stat__body {
        align-items: flex-start;
    }

    .page-stat__body,
    .accounts-stat__body,
    .team-stat__body {
        align-items: center;
        gap: 2px;
        min-width: 0;
    }

    .page-stat__icon,
    .accounts-stat__icon,
    .team-stat__icon {
        height: 30px;
        width: 30px;
    }

    .accounts-stat--total .accounts-stat__icon,
    .team-stat--total .team-stat__icon {
        height: 32px;
        width: 32px;
    }

    .page-stat__value,
    .accounts-stat__value,
    .team-stat__value {
        font-size: var(--mobile-stat-value);
        line-height: 1;
    }

    .accounts-stat--total .accounts-stat__value,
    .team-stat--total .team-stat__value {
        font-size: 22px;
    }

    .page-stat__label,
    .accounts-stat__label,
    .team-stat__label {
        font-size: var(--mobile-stat-label);
        letter-spacing: 0.03em;
        line-height: 1.2;
    }

    .page-stat__hint,
    .accounts-stat__hint,
    .team-stat__hint {
        display: none;
    }

    /* Full-bleed panels edge-to-edge */
    .accounts-panel,
    .team-panel,
    .import-panel,
    .ranking-panel,
    .ranking-panel--queue {
        border-left: 0;
        border-radius: 0;
        border-right: 0;
        margin-left: calc(-1 * var(--page-x));
        margin-right: calc(-1 * var(--page-x));
        overflow: hidden;
    }

    .import-panel__head,
    .import-panel__body,
    .import-panel__foot,
    .accounts-panel__head,
    .accounts-panel__toolbar,
    .accounts-panel__body,
    .team-panel__head,
    .team-panel__toolbar,
    .team-panel__body,
    .ranking-panel__head,
    .ranking-panel__filters,
    .ranking-panel__body {
        padding-left: var(--page-x);
        padding-right: var(--page-x);
    }

    .import-layout {
        display: flex;
        flex-direction: column;
        gap: var(--mobile-section-gap);
        min-width: 0;
    }

    /* Filter scroll — shared pattern */
    .accounts-filter-scroll,
    .team-filter-scroll,
    .ranking-filter-scroll {
        -webkit-overflow-scrolling: touch;
        margin-inline: calc(-1 * var(--page-x));
        min-width: 0;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding-block: 1px;
        padding-inline: var(--page-x);
        position: relative;
        scroll-padding-inline: var(--page-x);
        scrollbar-width: none;
    }

    .accounts-filter-scroll::after,
    .team-filter-scroll::after,
    .ranking-filter-scroll::after {
        background: linear-gradient(to right, transparent, var(--bg));
        content: '';
        height: 100%;
        pointer-events: none;
        position: absolute;
        right: 0;
        top: 0;
        width: 24px;
    }

    .accounts-filter-scroll::-webkit-scrollbar,
    .team-filter-scroll::-webkit-scrollbar,
    .ranking-filter-scroll::-webkit-scrollbar {
        display: none;
    }

    .accounts-search input,
    .team-search input,
    .import-editor textarea,
    .accounts-modal input,
    .team-modal input,
    .accounts-modal select,
    .team-modal select,
    .accounts-modal textarea,
    .team-modal textarea {
        font-size: 16px;
    }

    .accounts-search,
    .team-search {
        min-height: var(--mobile-touch-min);
        width: 100%;
    }

    .btn,
    .accounts-modal__footer .btn,
    .team-modal__footer .btn {
        min-height: var(--mobile-touch-min);
    }

    .btn--sm {
        min-height: 40px;
    }

    /* Disable hover lift on touch */
    @media (hover: none) {
        .page-stat:hover,
        .accounts-stat:hover,
        .team-stat:hover,
        .item:hover,
        .account-card:hover {
            box-shadow: var(--shadow-xs);
            transform: none;
        }
    }
}

@media (max-width: 560px) {
    :root,
    [data-theme="dark"],
    [data-theme="light"] {
        --page-x: 14px;
        --page-py: 14px;
        --page-pb: 18px;
        --mobile-stack-gap: 12px;
        --mobile-section-gap: 12px;
        --mobile-stat-gap: 8px;
        --mobile-stat-pad-y: 8px;
        --mobile-stat-pad-x: 6px;
        --mobile-stat-value: 17px;
        --mobile-stat-label: 8px;
        --mobile-hero-title: 20px;
        --px: var(--page-x);
    }

    .page-hero__stats,
    .import-summary,
    .team-stats,
    .ranking-summary,
    .accounts-stats,
    .accounts-summary,
    .team-page__stats {
        gap: var(--mobile-stat-gap);
    }

    .page-stat__icon,
    .accounts-stat__icon,
    .team-stat__icon {
        height: 28px;
        width: 28px;
    }

    .accounts-stat--total,
    .team-stat--total {
        padding: var(--space-2) var(--space-3);
    }

    .accounts-stat--total .accounts-stat__value,
    .team-stat--total .team-stat__value {
        font-size: 20px;
    }

    .account-card__credentials {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    :root,
    [data-theme="dark"],
    [data-theme="light"] {
        --page-x: 12px;
        --mobile-stat-value: 16px;
        --mobile-stat-label: 8px;
        --px: var(--page-x);
    }

    .page-stat__label,
    .accounts-stat__label,
    .team-stat__label,
    .ranking-summary .page-stat__label {
        letter-spacing: 0.02em;
    }
}

/* Scroll lock when mobile drawer is open */
body.sidebar-open {
    overflow: hidden;
    touch-action: none;
}

/* ===== core/mobile-nav.css ===== */
/* Mobile dock — unified action bar + bottom tabs */

.mobile-dock {
    display: none;
}

.mobile-dock__action {
    display: none;
}

@media (max-width: 768px) {
    :root,
    [data-theme="dark"],
    [data-theme="light"] {
        --mobile-dock-action-h: 48px;
    }

    .mobile-dock {
        -webkit-backdrop-filter: blur(20px) saturate(1.2);
        backdrop-filter: blur(20px) saturate(1.2);
        background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
        border-top: 1px solid var(--border);
        bottom: 0;
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.07);
        display: flex;
        flex-direction: column;
        left: 0;
        padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
        position: fixed;
        right: 0;
        z-index: 120;
    }

    [data-theme="dark"] .mobile-dock {
        box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.38);
    }

    .mobile-dock__action {
        align-items: center;
        border-bottom: 1px solid var(--border);
        box-sizing: border-box;
        display: none;
        flex-shrink: 0;
        gap: var(--space-3);
        min-height: var(--mobile-dock-action-h);
        padding: var(--space-2) var(--safe-right, 16px) var(--space-2) var(--safe-left, 16px);
    }

    #tab-reels:checked ~ .mobile-dock .mobile-dock__action--import {
        display: flex;
    }

    .mobile-dock .mobile-dock__action--import[hidden] {
        display: none !important;
    }

    #tab-accounts:checked ~ .mobile-dock .mobile-dock__action--accounts {
        display: flex;
    }

    #tab-team:checked ~ .mobile-dock .mobile-dock__action--team {
        display: flex;
    }

    #tab-downloader:checked ~ .mobile-dock .mobile-dock__action--downloader {
        display: flex;
    }

    .mobile-dock .import-sticky-bar,
    .mobile-dock .accounts-sticky-bar,
    .mobile-dock .team-sticky-bar,
    .mobile-dock .dl-sticky-bar {
        background: transparent;
        border: 0;
        box-shadow: none;
        position: static;
        width: 100%;
    }

    .import-sticky-bar__info {
        display: flex;
        flex: 1;
        flex-direction: column;
        gap: 1px;
        justify-content: center;
        min-width: 0;
        padding-right: var(--space-2);
    }

    .import-sticky-bar__count {
        color: var(--text);
        font-size: var(--font-sm);
        font-weight: 700;
        line-height: 1.15;
    }

    .import-sticky-bar__hint {
        color: var(--muted);
        font-size: 11px;
        line-height: 1.2;
    }

    .import-sticky-bar__submit {
        flex-shrink: 0;
        font-size: var(--font-sm);
        font-weight: 600;
        min-height: 44px;
        min-width: 108px;
        padding-inline: var(--space-4);
        position: relative;
        touch-action: manipulation;
        z-index: 1;
    }

    .import-sticky-bar__submit:not(:disabled):active {
        transform: scale(0.98);
    }

    .import-sticky-bar__submit:disabled {
        background: var(--soft);
        border: 1px solid var(--border);
        color: var(--muted);
        cursor: not-allowed;
        opacity: 1;
        pointer-events: none;
    }

    .accounts-sticky-bar__btn {
        justify-content: center;
        min-height: 40px;
        width: 100%;
    }

    .team-sticky-bar__btn {
        justify-content: center;
        min-height: 40px;
        width: 100%;
    }

    .dl-sticky-bar {
        width: 100%;
    }

    .dl-sticky-bar__submit {
        align-items: center;
        border-radius: 14px;
        display: inline-flex;
        flex: 1 1 auto;
        font-size: 16px;
        font-weight: 650;
        gap: 8px;
        justify-content: center;
        min-height: 48px;
        min-width: 0;
        width: 100%;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    #tab-downloader:checked ~ .mobile-dock .mobile-dock__action--downloader {
        min-height: var(--mobile-dock-action-h, 48px);
        padding: 8px var(--safe-right, 16px) 8px var(--safe-left, 16px);
    }

    /* Tab bar lives inside dock — not fixed on its own */
    .mobile-dock .mobile-nav {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        background: transparent;
        border-top: 0;
        box-shadow: none;
        display: block;
        flex-shrink: 0;
        padding-bottom: 0;
        position: static;
    }

    .mobile-nav__inner {
        align-items: stretch;
        box-sizing: border-box;
        display: flex;
        gap: 4px;
        height: var(--mobile-nav-h);
        justify-content: stretch;
        padding: 4px max(16px, var(--page-x), env(safe-area-inset-right, 0px)) 4px max(16px, var(--page-x), env(safe-area-inset-left, 0px));
        width: 100%;
    }

    .mobile-nav__link {
        align-items: center;
        background: transparent;
        border: 0;
        color: var(--muted);
        cursor: pointer;
        display: flex;
        flex: 1 1 0;
        justify-content: center;
        min-width: 0;
        padding: 0;
        position: relative;
        -webkit-tap-highlight-color: transparent;
        text-decoration: none;
        transition: color 150ms ease;
    }

    .mobile-nav__pill {
        align-items: center;
        border-radius: var(--radius-lg);
        display: flex;
        flex-direction: column;
        gap: 3px;
        justify-content: center;
        max-width: 100%;
        min-height: 44px;
        min-width: 0;
        padding: 6px 10px;
        position: relative;
        transition: background 180ms ease, transform 120ms ease;
        width: 100%;
    }

    .mobile-nav__link:active .mobile-nav__pill {
        transform: scale(0.96);
    }

    .mobile-nav__icon-wrap {
        display: inline-flex;
        flex-shrink: 0;
        position: relative;
    }

    .mobile-nav__icon {
        align-items: center;
        color: inherit;
        display: inline-flex;
        height: 24px;
        justify-content: center;
        opacity: 0.72;
        transition: color 150ms ease, opacity 150ms ease;
        width: 24px;
    }

    .mobile-nav__icon svg {
        display: block;
    }

    .mobile-nav__link[for="tab-pixel"] .mobile-nav__icon svg {
        transform: scale(1.08);
        transform-origin: center;
    }

    .mobile-nav__label {
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.01em;
        line-height: 1.1;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-nav__badge {
        align-items: center;
        background: var(--warn);
        border: 2px solid var(--bg-elevated);
        border-radius: var(--radius-full);
        color: #fff;
        display: inline-flex;
        font-size: 9px;
        font-weight: 700;
        height: 16px;
        justify-content: center;
        min-width: 16px;
        padding: 0 4px;
        position: absolute;
        right: -8px;
        top: -4px;
    }

    #tab-productivity:checked ~ .mobile-dock .mobile-nav__link[for="tab-productivity"],
    #tab-reels:checked ~ .mobile-dock .mobile-nav__link[for="tab-reels"],
    #tab-accounts:checked ~ .mobile-dock .mobile-nav__link[for="tab-accounts"],
    #tab-publish:checked ~ .mobile-dock .mobile-nav__link[for="tab-publish"],
    #tab-analytics:checked ~ .mobile-dock .mobile-nav__link[for="tab-analytics"],
    #tab-downloader:checked ~ .mobile-dock .mobile-nav__link[for="tab-downloader"],
    #tab-studio:checked ~ .mobile-dock .mobile-nav__link[for="tab-studio"],
    #tab-team:checked ~ .mobile-dock .mobile-nav__link[for="tab-team"],
    #tab-bot:checked ~ .mobile-dock .mobile-nav__link[for="tab-bot"],
    #tab-pixel:checked ~ .mobile-dock .mobile-nav__link[for="tab-pixel"] {
        color: var(--text);
    }

    #tab-reels:checked ~ .mobile-dock .mobile-nav__link[for="tab-reels"] .mobile-nav__pill,
    #tab-accounts:checked ~ .mobile-dock .mobile-nav__link[for="tab-accounts"] .mobile-nav__pill,
    #tab-publish:checked ~ .mobile-dock .mobile-nav__link[for="tab-publish"] .mobile-nav__pill,
    #tab-downloader:checked ~ .mobile-dock .mobile-nav__link[for="tab-downloader"] .mobile-nav__pill,
    #tab-studio:checked ~ .mobile-dock .mobile-nav__link[for="tab-studio"] .mobile-nav__pill,
    #tab-team:checked ~ .mobile-dock .mobile-nav__link[for="tab-team"] .mobile-nav__pill,
    #tab-bot:checked ~ .mobile-dock .mobile-nav__link[for="tab-bot"] .mobile-nav__pill,
    #tab-pixel:checked ~ .mobile-dock .mobile-nav__link[for="tab-pixel"] .mobile-nav__pill {
        background: var(--soft);
    }

    #tab-productivity:checked ~ .mobile-dock .mobile-nav__link[for="tab-productivity"] .mobile-nav__icon,
    #tab-reels:checked ~ .mobile-dock .mobile-nav__link[for="tab-reels"] .mobile-nav__icon,
    #tab-accounts:checked ~ .mobile-dock .mobile-nav__link[for="tab-accounts"] .mobile-nav__icon,
    #tab-publish:checked ~ .mobile-dock .mobile-nav__link[for="tab-publish"] .mobile-nav__icon,
    #tab-downloader:checked ~ .mobile-dock .mobile-nav__link[for="tab-downloader"] .mobile-nav__icon,
    #tab-studio:checked ~ .mobile-dock .mobile-nav__link[for="tab-studio"] .mobile-nav__icon,
    #tab-team:checked ~ .mobile-dock .mobile-nav__link[for="tab-team"] .mobile-nav__icon,
    #tab-bot:checked ~ .mobile-dock .mobile-nav__link[for="tab-bot"] .mobile-nav__icon,
    #tab-pixel:checked ~ .mobile-dock .mobile-nav__link[for="tab-pixel"] .mobile-nav__icon {
        opacity: 1;
    }

    #tab-productivity:checked ~ .mobile-dock .mobile-nav__link[for="tab-productivity"] .mobile-nav__label,
    #tab-reels:checked ~ .mobile-dock .mobile-nav__link[for="tab-reels"] .mobile-nav__label,
    #tab-accounts:checked ~ .mobile-dock .mobile-nav__link[for="tab-accounts"] .mobile-nav__label,
    #tab-publish:checked ~ .mobile-dock .mobile-nav__link[for="tab-publish"] .mobile-nav__label,
    #tab-analytics:checked ~ .mobile-dock .mobile-nav__link[for="tab-analytics"] .mobile-nav__label,
    #tab-downloader:checked ~ .mobile-dock .mobile-nav__link[for="tab-downloader"] .mobile-nav__label,
    #tab-studio:checked ~ .mobile-dock .mobile-nav__link[for="tab-studio"] .mobile-nav__label,
    #tab-team:checked ~ .mobile-dock .mobile-nav__link[for="tab-team"] .mobile-nav__label,
    #tab-bot:checked ~ .mobile-dock .mobile-nav__link[for="tab-bot"] .mobile-nav__label,
    #tab-pixel:checked ~ .mobile-dock .mobile-nav__link[for="tab-pixel"] .mobile-nav__label {
        font-weight: 700;
    }

    /* Extra page padding when dock has action row */
    .tabs:has(#tab-reels:checked) #panel-reels .ig-view.is-active[data-reels-view="import"],
    .tabs:has(#tab-reels:checked) #panel-reels .reel-view.is-active[data-reels-view="import"] {
        padding-bottom: calc(var(--mobile-nav-h) + var(--mobile-dock-action-h) + env(safe-area-inset-bottom, 0px) + var(--space-2));
    }

    .tabs:has(#tab-accounts:checked):has([data-accounts-sticky]) .accounts-page {
        padding-bottom: calc(var(--mobile-nav-h) + var(--mobile-dock-action-h) + env(safe-area-inset-bottom, 0px) + var(--space-2));
    }

    .tabs:has(#tab-team:checked):has([data-team-sticky]) .team-page {
        padding-bottom: calc(var(--mobile-nav-h) + var(--mobile-dock-action-h) + env(safe-area-inset-bottom, 0px) + var(--space-2));
    }

    .tabs:has(#tab-downloader:checked) #panel-downloader .dl-page {
        padding-bottom: calc(var(--mobile-dock-action-h) + var(--space-3));
    }

    #tab-downloader:checked ~ .mobile-dock {
        bottom: var(--dl-kb, 0px);
        transition: bottom 140ms ease;
    }

    html.dl-kb-open #tab-downloader:checked ~ .mobile-dock {
        padding-bottom: 0;
    }

    html.dl-kb-open #tab-downloader:checked ~ .mobile-dock .mobile-nav {
        display: none;
    }

    /* Toasts clear the dock */
    .toast,
    .notice,
    .notion-toast,
    .acc-toast,
    .toast-container {
        bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 16px) !important;
    }

    .tabs:has(.mobile-dock__action:not([hidden])) .toast,
    .tabs:has(.mobile-dock__action:not([hidden])) .toast-container {
        bottom: calc(var(--mobile-nav-h) + var(--mobile-dock-action-h) + env(safe-area-inset-bottom, 0px) + 16px) !important;
    }
}

@media (max-width: 560px) {
    .mobile-nav__inner {
        gap: 2px;
        padding-inline: max(var(--page-x), env(safe-area-inset-left, 0px)) max(var(--page-x), env(safe-area-inset-right, 0px));
    }

    .mobile-nav__pill {
        gap: 2px;
        padding: 5px 4px;
    }

    .mobile-nav__label {
        font-size: 10px;
    }

    .mobile-nav__icon {
        height: 22px;
        width: 22px;
    }

    .import-sticky-bar__submit {
        min-height: 44px;
        min-width: 96px;
    }
}

/* ===== core/modals.css ===== */
/* Shared modal shell */

.accounts-modal,
.team-modal,
.bot-modal {
    margin: auto;
    padding: 0;
    overflow: hidden;
    max-height: min(90vh, 760px);
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.accounts-modal:not([open]),
.team-modal:not([open]),
.bot-modal:not([open]) {
    display: none;
}

.accounts-modal::backdrop,
.team-modal::backdrop,
.bot-modal::backdrop {
    background: var(--overlay);
    backdrop-filter: blur(4px);
}

.accounts-modal__form,
.team-modal__form,
.bot-modal__form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: inherit;
}

.accounts-modal__header,
.team-modal__header,
.bot-modal__header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.accounts-modal__body,
.team-modal__body,
.bot-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 18px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.accounts-modal__footer,
.team-modal__footer,
.bot-modal__footer {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
}

.accounts-modal__close,
.team-modal__close,
.bot-modal__close {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.accounts-modal__close:hover,
.team-modal__close:hover,
.bot-modal__close:hover {
    background: var(--surface-hover);
    color: var(--text);
}

@media (max-width: 768px) {
    .accounts-modal[open],
    .team-modal[open],
    .team-modal--create[open],
    .bot-modal[open] {
        position: fixed;
        inset: auto 0 0 0;
        top: auto;
        width: 100%;
        max-width: none;
        max-height: min(92dvh, 100%);
        margin: 0;
        border-radius: 14px 14px 0 0;
        border-bottom: 0;
        transform: none;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.3);
    }

    .accounts-modal__footer,
    .team-modal__footer,
    .bot-modal__footer {
        flex-direction: column-reverse;
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .accounts-modal__footer .btn,
    .team-modal__footer .btn,
    .bot-modal__footer .btn {
        width: 100%;
        min-height: 44px;
    }

    .accounts-modal input,
    .team-modal input,
    .accounts-modal select,
    .team-modal select,
    .accounts-modal textarea,
    .team-modal textarea,
    .bot-modal input,
    .bot-modal select,
    .bot-modal textarea {
        font-size: 16px;
    }
}

body.modal-open { overflow: hidden; }
body.modal-open .topbar { visibility: hidden; }

/* ===== core/panels.css ===== */
/* Panel-specific layouts & reel cards */

/* Ranking */
.reels-summary {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-tight);
}

.summary-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--muted);
    font-size: var(--font-sm);
    font-weight: 500;
    padding: var(--space-2) var(--space-3);
}

.summary-pill strong {
    color: var(--text);
}

.summary-pill--warn {
    background: var(--warn-bg);
    border-color: rgba(194, 65, 12, 0.15);
    color: var(--warn);
}

.reels-summary-action {
    margin: 0;
}

.section-block {
    display: grid;
    gap: var(--gap-card);
}

.section-label {
    color: var(--muted);
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.reel-grid {
    display: grid;
    gap: var(--gap-card);
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.reel-grid-full {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.item.is-processing {
    background: var(--surface);
    border-color: var(--border-strong);
    border-style: dashed;
}

.item.is-error {
    background: var(--surface);
    border-color: rgba(248, 113, 113, 0.35);
}

.item.item-top-pick {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.15);
}

.item-body {
    display: flex;
    flex-direction: column;
    gap: var(--gap-tight);
    padding: var(--space-3) var(--space-4) var(--space-4);
}

.item-top {
    align-items: flex-start;
    display: flex;
    gap: var(--gap-tight);
    justify-content: space-between;
}

.item-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-micro);
}

.item-actions {
    display: flex;
    flex-shrink: 0;
    gap: var(--gap-inline);
}

.item-actions a,
.item-actions button {
    font-size: var(--font-sm);
    font-weight: 500;
    min-height: auto;
    padding: 0;
}

.item-thumb {
    aspect-ratio: 9 / 14;
    background: var(--soft-2);
    overflow: hidden;
    position: relative;
}

.item-thumb a {
    display: block;
    height: 100%;
}

.item-thumb img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.thumb-overlay {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 55%);
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap-micro);
    left: 0;
    padding: var(--space-3);
    pointer-events: none;
    position: absolute;
    right: 0;
}

.thumb-views {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1;
}

.thumb-views span {
    color: rgba(255, 255, 255, 0.6);
    display: block;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.06em;
    margin-bottom: var(--gap-micro);
    text-transform: uppercase;
}

.thumb-rank {
    border-radius: 6px;
    color: #fff;
    font-size: var(--font-xs);
    font-weight: 600;
    left: var(--gap-tight);
    padding: var(--gap-micro) var(--gap-tight);
    position: absolute;
    top: var(--gap-tight);
}

.thumb-rank.rank-1 { background: #ca8a04; }
.thumb-rank.rank-2 { background: #737373; }
.thumb-rank.rank-3 { background: #ea580c; }

.thumb-score {
    border-radius: 6px;
    color: #fff;
    font-size: var(--font-sm);
    font-weight: 600;
    padding: var(--gap-micro) var(--gap-tight);
    position: absolute;
    right: var(--gap-tight);
    top: var(--gap-tight);
}

.thumb-score.score-hot { background: rgba(22, 101, 52, 0.9); }
.thumb-score.score-warm { background: rgba(194, 65, 12, 0.9); }
.thumb-score.score-cool { background: rgba(82, 82, 82, 0.9); }

.item-caption {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--text);
    display: -webkit-box;
    font-size: var(--font-md);
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
}

.meta {
    color: var(--muted);
    font-size: var(--font-sm);
    margin: 0;
    overflow-wrap: anywhere;
}

.ratio-highlight {
    color: var(--text);
    font-weight: 600;
}

.recommendation {
    background: var(--soft);
    border-left: 2px solid var(--border-strong);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-size: var(--font-sm);
    line-height: 1.45;
    margin: 0;
    padding: var(--gap-tight) var(--gap-inline);
}

.metric-grid {
    display: grid;
    gap: var(--gap-tight);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
}

.metric {
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    padding: var(--space-2) var(--gap-micro);
    text-align: center;
}

.metric strong {
    color: var(--text);
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    line-height: 1.2;
}

.metric.featured {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-secondary);
    grid-column: span 4;
}

.metric.featured strong {
    color: var(--primary-fg);
    font-size: var(--font-lg);
}

.metric--score.score-hot {
    background: var(--success-bg);
    border-color: rgba(22, 101, 52, 0.15);
    color: var(--success);
}

.metric--score.score-hot strong { color: var(--success); }

.metric--score.score-warm {
    background: var(--warn-bg);
    border-color: rgba(194, 65, 12, 0.15);
    color: var(--warn);
}

.metric--score.score-warm strong { color: var(--warn); }

.metric-grid.compact-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid.compact-metrics .metric.featured {
    grid-column: span 3;
}

/* Responsive */
@media (min-width: 900px) {
    .reel-grid-full { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
    .reel-grid-full { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1600px) {
    .reel-grid-full { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .reel-grid,
    .reel-grid-full {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 560px) {
    .reel-grid,
    .reel-grid-full {
        grid-template-columns: 1fr;
    }

    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metric.featured {
        grid-column: span 3;
    }
}

/* ===== components/permission-fields.css ===== */
/* Permission form fields — team modals & employee create */

.permission-fields {
    border: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin: 0;
    min-width: 0;
    padding: 0;
}

.permission-fields--cards .permission-fields__legend {
    margin-bottom: var(--space-1);
}

.permission-fields__legend {
    color: var(--text);
    font-size: var(--font-sm);
    font-weight: 600;
    padding: 0;
}

.permission-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.permission-option {
    cursor: pointer;
    display: block;
    position: relative;
}

.permission-option input {
    height: 0;
    opacity: 0;
    position: absolute;
    width: 0;
}

.permission-option__card {
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.permission-option:hover .permission-option__card {
    background: var(--accent-soft);
    border-color: var(--border-strong);
}

.permission-option input:checked + .permission-option__card {
    background: var(--accent-soft);
    border-color: var(--text);
    box-shadow: inset 0 0 0 1px var(--text);
}

.permission-option input:focus-visible + .permission-option__card {
    box-shadow: 0 0 0 2px var(--ring);
}

.permission-option__icon {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    display: flex;
    flex-shrink: 0;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.permission-option input:checked + .permission-option__card .permission-option__icon {
    background: var(--text);
    border-color: var(--text);
    color: var(--primary-fg);
}

.permission-option__copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.permission-option__copy strong {
    font-size: var(--font-sm);
    font-weight: 600;
}

.permission-option__copy span {
    color: var(--muted);
    font-size: var(--font-xs);
}

.permission-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.permission-chip {
    cursor: pointer;
    display: inline-flex;
    position: relative;
}

.permission-chip input {
    height: 0;
    opacity: 0;
    position: absolute;
    width: 0;
}

.permission-chip__label {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--muted);
    font-size: var(--font-xs);
    font-weight: 600;
    line-height: 1;
    padding: 8px 12px;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
    user-select: none;
    white-space: nowrap;
}

.permission-chip:hover .permission-chip__label {
    background: var(--accent-soft);
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.permission-chip input:checked + .permission-chip__label {
    background: var(--text);
    border-color: var(--text);
    color: var(--primary-fg);
}

.permission-chip input:focus-visible + .permission-chip__label {
    box-shadow: 0 0 0 2px var(--ring);
}

.permission-chips--accounts {
    margin-top: var(--space-1);
}

.permission-account-scope {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-1);
    padding: var(--space-3);
}

.permission-account-scope--set {
    margin-top: var(--space-2);
}

.permission-account-scope__head {
    align-items: flex-start;
    display: flex;
    gap: var(--space-2);
}

.permission-account-scope__icon {
    align-items: center;
    background: var(--soft-2);
    border-radius: var(--radius-sm);
    color: var(--muted);
    display: inline-flex;
    flex-shrink: 0;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.permission-account-scope__title {
    font-size: var(--font-sm);
    font-weight: 600;
    margin: 0;
}

.permission-account-scope__hint {
    font-size: var(--font-xs);
    margin: 2px 0 0;
}

.permission-account-scope__grid {
    display: grid;
    gap: var(--space-2);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permission-scope-option {
    cursor: pointer;
    display: block;
    position: relative;
}

.permission-scope-option input {
    height: 0;
    opacity: 0;
    position: absolute;
    width: 0;
}

.permission-scope-option__card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 100%;
    padding: var(--space-2);
    transition: border-color 150ms ease, background 150ms ease;
}

.permission-scope-option__card strong {
    font-size: var(--font-sm);
}

.permission-scope-option__card span {
    color: var(--muted);
    font-size: var(--font-xs);
    line-height: 1.35;
}

.permission-scope-option input:checked + .permission-scope-option__card {
    background: var(--accent-soft);
    border-color: var(--border-strong);
}

.permission-scope-option input:focus-visible + .permission-scope-option__card {
    box-shadow: 0 0 0 2px var(--ring);
}

@media (max-width: 768px) {
    .permission-account-scope__grid {
        grid-template-columns: 1fr;
    }
}

/* ===== components/datetime-picker.css ===== */
/* Datetime picker — modern SaaS */

.dt-picker {
    position: relative;
    width: 100%;
}

.dt-picker__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--r, 8px);
    background: var(--elevated);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

[data-theme="light"] .dt-picker__trigger {
    background: var(--surface);
}

.dt-picker__trigger:hover {
    border-color: var(--line-strong);
}

.dt-picker__trigger:focus-visible,
.dt-picker__trigger[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

.dt-picker__value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dt-picker__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.dt-picker__popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 500;
    width: min(420px, calc(100vw - 24px));
    border: 1px solid var(--line);
    border-radius: var(--r-lg, 12px);
    background: var(--surface);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.32);
}

.dt-picker__popover.is-fixed {
    position: fixed;
    top: auto;
    left: auto;
}

.dt-picker__popover[hidden] {
    display: none;
}

.dt-picker__panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 156px;
    gap: 0;
    border-bottom: 1px solid var(--line);
}

.dt-picker__calendar {
    padding: 14px 14px 12px;
    border-right: 1px solid var(--line);
    min-width: 0;
}

.dt-picker__cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.dt-picker__month {
    flex: 1;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: center;
}

.dt-picker__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.dt-picker__nav:hover {
    background: var(--hover);
    color: var(--text);
}

.dt-picker__weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 6px;
}

.dt-picker__weekdays span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.dt-picker__days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.dt-picker__day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 100ms ease, color 100ms ease;
}

.dt-picker__day:hover {
    background: var(--hover);
}

.dt-picker__day.is-outside {
    color: var(--muted);
    opacity: 0.45;
}

.dt-picker__day.is-today:not(.is-selected) {
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

.dt-picker__day.is-selected {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.dt-picker__day.is-selected:hover {
    background: color-mix(in srgb, var(--accent) 88%, #fff);
}

.dt-picker__time {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding: 14px 10px 12px;
    background: color-mix(in srgb, var(--soft) 30%, var(--surface));
}

.dt-picker__time-block {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.dt-picker__time-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.dt-picker__time-scroll {
    display: flex;
    flex-direction: column;
    gap: 3px;
    height: 176px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--elevated);
    scroll-padding-block: 68px;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}

[data-theme="light"] .dt-picker__time-scroll {
    background: var(--surface);
}

.dt-picker__time-scroll::-webkit-scrollbar {
    width: 6px;
}

.dt-picker__time-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: color-mix(in srgb, var(--muted) 35%, transparent);
}

.dt-picker__time-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 100%;
    min-height: 32px;
    padding: 0 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
    transition: background 100ms ease, color 100ms ease;
}

.dt-picker__time-item:hover {
    background: var(--hover);
    color: var(--text);
}

.dt-picker__time-item.is-selected {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.dt-picker__time-sep {
    flex-shrink: 0;
    align-self: center;
    margin-top: 28px;
    color: var(--muted);
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.dt-picker__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--soft) 22%, var(--surface));
}

.dt-picker__foot-btn {
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.dt-picker__foot-btn:hover {
    background: var(--hover);
    color: var(--text);
}

.dt-picker__foot-btn--primary {
    color: var(--accent);
    font-weight: 600;
}

.dt-picker__foot-btn--primary:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

@media (max-width: 480px) {
    .dt-picker__panel {
        grid-template-columns: 1fr;
    }

    .dt-picker__calendar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .dt-picker__time {
        padding: 12px 14px 14px;
    }

    .dt-picker__time-scroll {
        height: 140px;
        scroll-padding-block: 48px;
    }
}

/* ===== components/fm-datepicker.css ===== */
/* ==========================================================================
   fm-datepicker — seletor de data/hora (substitui o picker nativo do Chrome)
   Forma macOS: sólido, hairline, raios pequenos. Cores vêm do tema.
   ========================================================================== */

.fm-date {
    position: relative;
    display: block;
    width: 100%;
}

/* Input nativo continua no DOM (carrega o valor do form), só sai da tela. */
.fm-date__native {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    overflow: hidden;
    white-space: nowrap;
}

/* --------------------------------------------------------------- trigger */

.fm-date__trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-height: var(--pd-ctrl, 32px);
    padding: 0 9px;
    border: 1px solid var(--macos-hairline, var(--line));
    border-radius: var(--macos-control-radius, 7px);
    background: var(--elevated);
    box-shadow: var(--macos-control-shadow);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

[data-theme="light"] .fm-date__trigger {
    background: var(--surface);
}

.fm-date__trigger:hover {
    border-color: var(--line-strong, var(--line));
}

.fm-date__trigger:focus-visible,
.fm-date__trigger[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

.fm-date__trigger-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--muted);
}

.fm-date__trigger.is-set .fm-date__trigger-icon {
    color: var(--accent);
}

/* Vencida / hoje ganham cor no rótulo — status legível sem abrir o popover. */
.fm-date__trigger.is-overdue .fm-date__trigger-icon,
.fm-date__trigger.is-overdue .fm-date__label {
    color: #ef4444;
}

.fm-date__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-date__trigger:not(.is-set) .fm-date__label {
    color: var(--muted);
    font-weight: 400;
}

.fm-date__time-tag {
    flex-shrink: 0;
    color: var(--secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* Botão de limpar aparece no hover, no lugar do chevron. */
.fm-date__clear {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.fm-date__clear:hover {
    background: var(--hover);
    color: var(--text);
}

.fm-date__trigger.is-set:hover .fm-date__clear,
.fm-date__trigger.is-set:focus-within .fm-date__clear {
    display: inline-flex;
}

/* --------------------------------------------------------------- popover */

.fm-date__pop {
    position: fixed;
    z-index: 10050;
    width: 282px;
    border: 1px solid var(--macos-hairline, var(--line));
    border-radius: var(--macos-window-radius, 12px);
    background: var(--surface);
    box-shadow: var(--macos-window-shadow, 0 16px 48px rgba(0, 0, 0, 0.34));
    overflow: hidden;
    animation: fm-date-in 120ms cubic-bezier(0.2, 0, 0.2, 1);
}

.fm-date__pop[hidden] {
    display: none;
}

dialog .fm-date__pop {
    position: absolute;
}

@keyframes fm-date-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .fm-date__pop { animation: none; }
}

/* --------------------------------------------- campo de linguagem natural */

.fm-date__nl {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    border-bottom: 1px solid var(--line);
}

.fm-date__nl svg {
    flex-shrink: 0;
    color: var(--muted);
}

.fm-date__nl input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    outline: none;
}

.fm-date__nl input::placeholder {
    color: var(--muted);
}

/* Eco do que foi entendido — some quando não há match. */
.fm-date__nl-hint {
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.fm-date__nl-hint[hidden] {
    display: none;
}

/* -------------------------------------------------------------- atalhos */

.fm-date__presets {
    display: flex;
    flex-direction: column;
    padding: 5px;
    border-bottom: 1px solid var(--line);
}

.fm-date__preset {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 30px;
    padding: 0 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background 90ms ease;
}

.fm-date__preset:hover,
.fm-date__preset.is-active {
    background: var(--hover);
}

.fm-date__preset svg {
    flex-shrink: 0;
    color: var(--muted);
}

.fm-date__preset-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-date__preset-when {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* Ícones herdam a cor semântica do atalho (hoje verde, amanhã âmbar…). */
.fm-date__preset[data-tone="today"] svg { color: #22c55e; }
.fm-date__preset[data-tone="tomorrow"] svg { color: #f59e0b; }
.fm-date__preset[data-tone="weekend"] svg { color: #6366f1; }
.fm-date__preset[data-tone="next"] svg { color: #8b5cf6; }

/* ------------------------------------------------------------- calendário */

.fm-date__cal {
    padding: 9px 11px 11px;
}

.fm-date__cal-head {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 7px;
}

.fm-date__month {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-date__nav {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--secondary);
    cursor: pointer;
    transition: background 90ms ease, color 90ms ease;
}

.fm-date__nav:hover {
    background: var(--hover);
    color: var(--text);
}

.fm-date__weekdays,
.fm-date__days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}

.fm-date__weekdays {
    margin-bottom: 3px;
}

.fm-date__weekdays span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.fm-date__day {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 90ms ease, color 90ms ease;
}

.fm-date__day:hover:not(:disabled) {
    background: var(--hover);
}

.fm-date__day.is-outside {
    color: color-mix(in srgb, var(--muted) 65%, transparent);
}

.fm-date__day.is-past:not(.is-selected) {
    color: var(--muted);
}

.fm-date__day:disabled {
    cursor: default;
    opacity: 0.3;
}

/* Hoje: ponto abaixo do número, não anel — anel disputa com o selecionado. */
.fm-date__day.is-today::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accent);
    transform: translateX(-50%);
}

.fm-date__day.is-selected {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.fm-date__day.is-selected::after {
    background: #fff;
}

.fm-date__day.is-selected:hover {
    background: color-mix(in srgb, var(--accent) 88%, #000);
}

.fm-date__day:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* ------------------------------------------------------------------ hora */

.fm-date__time {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    border-top: 1px solid var(--line);
}

.fm-date__time > svg {
    flex-shrink: 0;
    color: var(--muted);
}

.fm-date__time-field {
    width: 74px;
    min-height: 26px;
    padding: 0 7px;
    border: 1px solid var(--macos-hairline, var(--line));
    border-radius: 6px;
    background: var(--elevated);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

[data-theme="light"] .fm-date__time-field {
    background: var(--surface);
}

.fm-date__time-field:focus {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

/* Esconde o relógio nativo do WebKit — abriria o popup do SO por cima. */
.fm-date__time-field::-webkit-calendar-picker-indicator {
    display: none;
}

.fm-date__time-chips {
    display: flex;
    flex: 1;
    gap: 3px;
    min-width: 0;
    justify-content: flex-end;
}

.fm-date__time-chip {
    min-height: 24px;
    padding: 0 7px;
    border: 0;
    border-radius: 5px;
    background: var(--soft);
    color: var(--secondary);
    font: inherit;
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 90ms ease, color 90ms ease;
}

.fm-date__time-chip:hover {
    background: var(--hover);
    color: var(--text);
}

.fm-date__time-chip.is-selected {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

/* ---------------------------------------------------------------- rodapé */

.fm-date__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--soft) 22%, var(--surface));
}

.fm-date__foot-btn {
    min-height: 26px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 110ms ease, color 110ms ease;
}

.fm-date__foot-btn:hover {
    background: var(--hover);
    color: var(--text);
}

.fm-date__foot-btn--primary {
    border: 1px solid transparent;
    background: var(--accent);
    box-shadow: var(--macos-control-shadow);
    color: #fff;
    font-weight: 600;
}

.fm-date__foot-btn--primary:hover {
    background: color-mix(in srgb, var(--accent) 88%, #000);
    color: #fff;
}

/* ------------------------------------------------------------ compacto */

@media (max-width: 400px) {
    .fm-date__pop {
        width: calc(100vw - 20px);
    }
}

/* ===== components/select.css ===== */
/* Custom select — fm-select (matches datetime-picker) */

.fm-select {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.fm-select--compact {
    width: auto;
}

.fm-select__native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fm-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--r, 8px);
    background: var(--elevated);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

[data-theme="light"] .fm-select__trigger {
    background: var(--surface);
}

.fm-select--compact .fm-select__trigger {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.fm-select__trigger:hover {
    border-color: var(--line-strong);
}

.fm-select__trigger:focus-visible,
.fm-select__trigger[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

.fm-select__value {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.fm-select__value > span,
.fm-select__option > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ui.css: `svg { max-width: 100% }` esmaga o ícone num traço vertical
   quando ele é filho de flex (menu/trigger). Travar o tamanho. */
.fm-select__flag {
    display: block;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    max-width: none;
    overflow: visible;
}

.fm-select__chevron {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: transform 140ms ease, color 140ms ease;
}

.fm-select__trigger[aria-expanded="true"] .fm-select__chevron {
    transform: rotate(180deg);
    color: var(--secondary);
}

.fm-select__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 1200;
    width: 100%;
    max-height: 240px;
    overflow: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg, 12px);
    background: var(--surface);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    box-sizing: border-box;
}

.fm-select__menu.is-fixed {
    position: fixed;
    top: auto;
    left: auto;
    z-index: 10050;
}

/* Inside <dialog>, absolute to the dialog box. position:fixed is captured by
   the dialog top-layer (and by contain:layout on ancestors) so viewport
   coordinates land off-screen and the menu looks like it never opened. */
dialog .fm-select__menu.is-fixed {
    position: absolute;
    z-index: 10050;
}

.fm-select__menu[hidden] {
    display: none !important;
}

.fm-select__option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: calc(var(--r, 8px) - 2px);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    overflow: visible;
    transition: background 100ms ease, color 100ms ease;
}

.fm-select__option:hover:not(:disabled) {
    background: var(--hover);
}

.fm-select__option.is-selected {
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 600;
}

.fm-select__option:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
    outline-offset: -2px;
}

.fm-select__option:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Fallback native select styling (before JS / data-native-select) */
select:not(.fm-select__native):not([data-native-select]) {
    appearance: none;
    -webkit-appearance: none;
    min-height: 36px;
    padding: 0 34px 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--r, 8px);
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%23888' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        no-repeat right 10px center / 14px,
        var(--elevated);
    color: var(--text);
    cursor: pointer;
}

[data-theme="light"] select:not(.fm-select__native):not([data-native-select]) {
    background-color: var(--surface);
}

select:not(.fm-select__native):not([data-native-select]):hover {
    border-color: var(--line-strong);
}

select:not(.fm-select__native):not([data-native-select]):focus {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

/* ===== pages/login.css ===== */
/* Login — minimal */

.login-page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

.login-page .theme-toggle__label {
    display: none;
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: var(--bg);
}

.login-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 70% 50% at 50% -20%,
        color-mix(in srgb, var(--accent) 5%, transparent),
        transparent 70%
    );
}

[data-theme="light"] .login-bg::before {
    background: radial-gradient(
        ellipse 80% 55% at 50% -15%,
        color-mix(in srgb, var(--accent) 8%, transparent),
        transparent 72%
    );
}

.login-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px clamp(20px, 4vw, 32px);
}

.login-top .brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-top .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-top .brand-mark svg,
.login-top .brand-mark__logo {
    display: block;
    transform: translateY(0.5px);
}

.login-top .brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1;
}

.login-top .brand-text strong {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.login-box__mark svg,
.login-box__mark .brand-mark__logo {
    display: block;
    transform: translateY(0.5px);
}

.login-top__tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-top__theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border, var(--line));
    border-radius: var(--r, 8px);
    background: var(--surface);
    color: var(--text-secondary, var(--secondary));
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.login-top__theme:hover {
    background: var(--surface-hover, var(--hover));
    color: var(--text);
}

.login-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: 16px 20px 32px;
}

.login-box {
    width: 100%;
    max-width: 380px;
    padding: 28px 26px 24px;
    border: 1px solid var(--border, var(--line));
    border-radius: var(--r-lg, 12px);
    background: var(--surface);
    box-shadow: var(--shadow);
}

[data-theme="light"] .login-box {
    background: var(--bg-elevated, var(--elevated));
}

.login-box__head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    text-align: center;
}

.login-box__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
    border: 1px solid var(--border, var(--line));
    border-radius: var(--r, 8px);
    background: #111;
    color: #fff;
}

.login-box__head h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.login-box__head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--danger, var(--bad)) 24%, transparent);
    border-radius: var(--r, 8px);
    background: var(--error-bg, var(--bad-bg));
    color: var(--danger, var(--bad));
    font-size: 12px;
    line-height: 1.45;
}

.login-alert svg {
    flex-shrink: 0;
    margin-top: 1px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.login-field__label {
    color: var(--text-secondary, var(--secondary));
    font-size: 12px;
    font-weight: 550;
}

.login-field input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border, var(--line));
    border-radius: var(--r, 8px);
    background: var(--soft);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

[data-theme="light"] .login-field input {
    background: var(--bg);
}

.login-field input::placeholder {
    color: var(--muted);
}

.login-field input:focus {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border, var(--line)));
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-password {
    position: relative;
}

.login-password input {
    padding-right: 40px;
}

.login-password__toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background 120ms ease, color 120ms ease;
}

.login-password__toggle:hover {
    color: var(--text);
    background: var(--surface-hover, var(--hover));
}

.login-submit {
    height: 40px;
    margin-top: 4px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--r, 8px);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: background 140ms ease;
}

.login-submit:hover {
    background: var(--accent-hover);
}

.login-foot {
    position: relative;
    z-index: 2;
    padding: 16px 20px 24px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

@media (max-width: 480px) {
    .login-box {
        padding: 22px 18px 20px;
    }

    .login-box__head h1 {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-top__theme,
    .login-field input,
    .login-submit,
    .login-password__toggle {
        transition: none;
    }
}

/* ===== core/spacing.css ===== */
/* Unified spacing & alignment across panels */

.accounts-page,
.team-page,
.ig-page,
.reel {
    gap: var(--gap-section);
}

/* Panel internal padding — team only (accounts uses accounts.css) */
.team-panel__head,
.team-panel__body {
    padding-left: var(--panel-x);
    padding-right: var(--panel-x);
}

.team-panel__head {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.team-panel__body {
    padding-top: var(--space-5);
    padding-bottom: var(--space-5);
}

.team-panel__body--empty {
    padding-top: var(--space-6);
    padding-bottom: var(--space-6);
}

/* Page heroes */
.team-page__header,
.team-hero,
.ig-head,
.reel-head {
    gap: var(--gap-section);
}

.accounts-hero__copy h2,
.team-page__intro h2,
.team-hero__copy h2,
.ig-head__title h2,
.reel-head h2 {
    margin: 0;
}

/* ===== core/macos.css ===== */
/* macOS Sequoia materials — solid (no glass/blur), FlacosMedia colors */

:root {
    --macos-hairline: color-mix(in srgb, var(--line) 90%, var(--text) 10%);
    --macos-window-shadow:
        0 0 0 1px color-mix(in srgb, var(--line) 75%, transparent),
        0 8px 24px color-mix(in srgb, #000 7%, transparent),
        0 1px 3px color-mix(in srgb, #000 4%, transparent);
    --macos-control-shadow: 0 0.5px 1px color-mix(in srgb, #000 8%, transparent);
    --macos-control-radius: 7px;
    --macos-window-radius: 12px;
    --macos-seg-radius: 8px;
    --macos-ctrl-h: 28px;
}

[data-theme="dark"] {
    --macos-window-shadow:
        0 0 0 1px color-mix(in srgb, var(--line) 90%, transparent),
        0 12px 32px color-mix(in srgb, #000 38%, transparent);
    --macos-control-shadow: 0 1px 2px color-mix(in srgb, #000 30%, transparent);
}

/* Kill glass everywhere in the shell */
.sidebar,
.topbar,
.sidebar__header,
.app-shell {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Sidebar — Sequoia Settings (solid, no glass) */
.sidebar {
    --sidebar-pad: 10px;
    --sidebar-inset: 8px;
    --sidebar-rail: 28px;
    --sidebar-gap: 10px;
    --sidebar-control: 28px;
    --sidebar-text-x: calc(var(--sidebar-inset) + var(--sidebar-rail) + var(--sidebar-gap));
    --sidebar-item-h: 32px;
    --sidebar-section-gap: 16px;
    --sidebar-sel-radius: 7px;
    border-right: 1px solid var(--macos-hairline);
    background: color-mix(in srgb, var(--soft) 55%, var(--elevated));
    box-shadow: none;
}

[data-theme="dark"] .sidebar {
    background: color-mix(in srgb, var(--elevated) 92%, #000);
}

.sidebar__header {
    height: 52px;
    min-height: 52px;
    padding: 0 10px 0 var(--sidebar-pad);
    border-bottom: 1px solid var(--macos-hairline);
    background: transparent;
}

.sidebar__footer {
    padding: 8px var(--sidebar-pad) 10px;
    border-top: 1px solid var(--macos-hairline);
    background: transparent;
}

.sidebar__brand .brand {
    padding-left: var(--sidebar-inset);
    gap: 8px;
}

.sidebar__brand .brand-mark {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

.sidebar__brand .brand-mark svg,
.sidebar__brand .brand-mark__logo {
    width: 16px;
    height: 16px;
    color: #fff;
}

.sidebar__brand .brand-text strong {
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text);
}

.sidebar__brand .brand-text span {
    display: none;
}

.sidebar__collapse,
.sidebar__close {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    color: var(--muted);
}

.sidebar__collapse:hover,
.sidebar__close:hover {
    background: color-mix(in srgb, var(--text) 6%, transparent);
    color: var(--text);
}

.sidebar__body {
    padding: 8px var(--sidebar-pad) 10px;
}

.sidebar__nav {
    gap: var(--sidebar-section-gap);
}

.sidebar__section {
    gap: 1px;
}

.sidebar__section + .sidebar__section {
    border-top: 0;
    padding-top: 0;
}

.sidebar__section-title {
    margin: 0 0 3px !important;
    padding: 2px var(--sidebar-inset) 3px var(--sidebar-text-x) !important;
    color: var(--muted) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    line-height: 1.2 !important;
    text-transform: none !important;
}

.sidebar__menu {
    gap: 1px;
}

.sidebar__link,
.sidebar__sublink {
    min-height: var(--sidebar-item-h) !important;
    padding: 0 var(--sidebar-inset) !important;
    border-radius: var(--sidebar-sel-radius) !important;
    color: var(--secondary) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    letter-spacing: -0.015em !important;
    box-shadow: none !important;
}

.sidebar__link::before {
    display: none !important;
}

.sidebar__link-icon,
.sidebar__sublink-icon {
    width: var(--sidebar-rail) !important;
    height: var(--sidebar-rail) !important;
    color: var(--muted) !important;
    opacity: 1 !important;
}

.sidebar__link-icon svg,
.sidebar__sublink-icon svg {
    width: 16px !important;
    height: 16px !important;
}

/* Sidebar interaction states are owned by shell-premium.css. */

.sidebar__badge {
    min-width: 16px;
    min-height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 650;
    line-height: 16px;
}

.sidebar__profile {
    gap: 8px;
    min-height: 40px;
    padding: 4px;
    border: 0 !important;
    border-radius: 8px;
    background: transparent !important;
}

.sidebar__profile:hover {
    background: color-mix(in srgb, var(--text) 5.5%, transparent) !important;
    border-color: transparent !important;
}

.sidebar__avatar {
    width: 26px;
    height: 26px;
    border: 0;
    background: color-mix(in srgb, var(--accent) 18%, var(--soft));
    color: var(--text);
    font-size: 11px;
    font-weight: 650;
}

.sidebar__user-name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.sidebar__user-role {
    color: var(--muted);
    font-size: 12px;
}

.sidebar__icon-btn,
.sidebar__theme.theme-toggle {
    width: 26px;
    height: 26px;
    border-radius: 6px;
}

.sidebar__icon-btn:hover,
.sidebar__theme.theme-toggle:hover {
    background: color-mix(in srgb, var(--text) 6%, transparent);
}

@media (min-width: 769px) {
    html[data-sidebar-collapsed="true"] .sidebar__link,
    html[data-sidebar-collapsed="true"] .sidebar__sublink {
        justify-content: center;
        width: 32px;
        padding: 0 !important;
    }

    html[data-sidebar-collapsed="true"] .sidebar__profile {
        justify-content: center;
    }
}

/* Topbar — solid titlebar */
.topbar {
    border-bottom: 1px solid var(--macos-hairline);
    background: var(--bg) !important;
    box-shadow: none;
}

.app-shell {
    background: var(--bg);
}

/* Cards = solid document windows */
.card,
.fm-card,
.integrations-card,
.bot-card,
.pixel-card,
.stat-card,
.metric-card,
.overview-card {
    border: 1px solid var(--macos-hairline);
    border-radius: var(--macos-window-radius);
    background: var(--surface);
    box-shadow: var(--macos-window-shadow);
}

/* Push buttons — Sequoia density */
.btn,
.button {
    min-height: var(--macos-ctrl-h);
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: var(--macos-control-radius);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    font-weight: 550;
    letter-spacing: -0.01em;
    box-shadow: var(--macos-control-shadow);
    filter: none;
}

.btn:hover,
.button:hover {
    filter: none;
    background: var(--hover);
    border-color: var(--line-strong);
}

.btn:active,
.button:active {
    background: var(--soft);
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 10%, transparent);
}

.btn--primary,
.btn-primary,
.accounts-modal__btn--primary {
    border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--line));
    border-radius: var(--macos-control-radius);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.btn--primary:hover,
.btn-primary:hover,
.accounts-modal__btn--primary:hover {
    filter: none;
    background: var(--accent-hover);
    color: #fff;
}

.btn--secondary,
.button.secondary,
.dropdown-trigger {
    background: var(--surface);
    border-color: var(--line);
    color: var(--secondary);
    box-shadow: var(--macos-control-shadow);
}

.btn--ghost {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    color: var(--secondary);
}

.btn--ghost:hover {
    background: var(--hover);
    color: var(--text);
}

.btn--sm {
    min-height: 26px;
    padding: 0 9px;
    font-size: 12px;
}

/* Fields — solid inset */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
    min-height: var(--macos-ctrl-h);
    border: 1px solid var(--line);
    border-radius: var(--macos-control-radius);
    background: var(--elevated);
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 4%, transparent);
}

input:focus,
select:focus,
textarea:focus {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* —— Publish document window —— */
#panel-publish .publish-composer,
#panel-publish .publish-composer.card,
#panel-publish .publish-composer--reels,
#panel-publish .publish-queue {
    border: 1px solid var(--publish-border);
    border-radius: var(--publish-radius);
    background: var(--publish-surface);
    box-shadow: var(--macos-window-shadow);
    overflow: hidden;
}

#panel-publish .publish-toolbar {
    --tb-h: 30px;
    --tb-track: color-mix(in srgb, var(--soft) 78%, var(--elevated));
    --tb-pill-shadow:
        0 0.5px 0 color-mix(in srgb, #fff 8%, transparent),
        0 1px 2px color-mix(in srgb, #000 14%, transparent);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px 14px;
    border-bottom: 1px solid var(--publish-border);
    background: var(--publish-surface);
}

[data-theme="dark"] #panel-publish .publish-toolbar {
    --tb-track: color-mix(in srgb, var(--elevated) 70%, #000);
    --tb-pill-shadow:
        0 0.5px 0 color-mix(in srgb, #fff 5%, transparent),
        0 1px 3px color-mix(in srgb, #000 36%, transparent);
}

#panel-publish .publish-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 16px 22px;
}

#panel-publish .publish-toolbar__cluster,
#panel-publish .publish-compose-mode--bar {
    display: grid;
    grid-template-rows: auto var(--tb-h);
    align-content: start;
    align-items: start;
    justify-items: start;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
    border-left: 0;
    background: transparent;
    min-height: 0;
}

#panel-publish .publish-toolbar__cluster:first-child {
    padding-left: 0;
    border-left: 0;
}

#panel-publish .publish-toolbar__cluster + .publish-toolbar__cluster,
#panel-publish .publish-toolbar__cluster + .publish-compose-mode--bar:not([hidden]),
#panel-publish .publish-compose-mode--bar:not([hidden]) + .publish-toolbar__cluster {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
}

#panel-publish .publish-toolbar__cluster + .publish-toolbar__cluster::before,
#panel-publish .publish-toolbar__cluster + .publish-compose-mode--bar:not([hidden])::before,
#panel-publish .publish-compose-mode--bar:not([hidden]) + .publish-toolbar__cluster::before {
    display: none !important;
    content: none !important;
}

#panel-publish .publish-toolbar__label {
    display: block;
    height: auto;
    margin: 0;
    padding: 0 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: -0.01em;
    text-transform: none;
    line-height: 1.2;
}

/* Shared NSSegmentedControl track */
#panel-publish .publish-page__head .publish-subnav,
#panel-publish .publish-page__head .fm-tabs.publish-subnav,
#panel-publish .publish-toolbar .publish-platforms--compact,
#panel-publish .publish-toolbar .publish-seg--format,
#panel-publish .publish-compose-mode__inner,
#panel-publish .publish-queue .publish-seg {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: stretch;
    width: fit-content;
    max-width: 100%;
    height: var(--tb-h, 30px);
    min-height: var(--tb-h, 30px);
    margin: 0;
    padding: 2px;
    gap: 0;
    border: 0;
    border-radius: 8px;
    background: var(--tb-track, var(--soft));
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 7%, transparent);
    overflow: hidden;
}

#panel-publish .publish-page__head .publish-subnav,
#panel-publish .publish-page__head .fm-tabs.publish-subnav {
    overflow-x: auto;
}

#panel-publish .publish-toolbar .publish-seg--format {
    min-width: 0;
}

#panel-publish .publish-compose-mode__inner {
    min-width: 0;
}

#panel-publish .publish-page__head .publish-subnav__btn,
#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform,
#panel-publish .publish-toolbar .publish-seg--format .publish-seg__btn,
#panel-publish .publish-compose-mode__card,
#panel-publish .publish-queue .publish-seg__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--secondary);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1;
    box-shadow: none;
    outline: none;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

#panel-publish .publish-page__head .publish-subnav__btn::after {
    display: none !important;
}

#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform {
    padding: 0 11px;
}

#panel-publish .publish-page__head .publish-subnav__btn:hover,
#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform:hover,
#panel-publish .publish-toolbar .publish-seg--format .publish-seg__btn:hover,
#panel-publish .publish-compose-mode__card:hover {
    color: var(--text);
    background: transparent;
}

#panel-publish .publish-page__head .publish-subnav__btn.is-active,
#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform:has(input:checked),
#panel-publish .publish-toolbar .publish-seg--format .publish-seg__btn.is-active,
#panel-publish .publish-toolbar .publish-seg--format .publish-seg__btn:has(input:checked),
#panel-publish .publish-compose-mode__card.is-active,
#panel-publish .publish-queue .publish-seg__btn.is-active {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--tb-pill-shadow, var(--macos-control-shadow));
}

#panel-publish .publish-page__head .publish-subnav__btn.is-active svg,
#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform:has(input:checked) .publish-platform__icon {
    color: var(--publish-blue);
}

#panel-publish .publish-page__head .publish-subnav__btn.is-active::after {
    display: none !important;
}

#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    line-height: 0;
    color: var(--muted);
}

#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform__icon svg {
    width: 14px;
    height: 14px;
}

#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform:focus-within {
    outline: none;
}

#panel-publish .publish-compose-mode__copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#panel-publish .publish-compose-mode__copy strong {
    font-size: inherit;
    font-weight: inherit;
}

#panel-publish .publish-toolbar__accounts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--publish-border);
}

#panel-publish .publish-accounts-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    min-height: 30px;
}

#panel-publish .publish-accounts-head__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#panel-publish .publish-accounts-head__meta .publish-toolbar__label {
    padding: 0;
    font-size: 11px;
    font-weight: 500;
}

#panel-publish .publish-accounts-bar__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 22px;
    padding: 0 8px;
    border: 0;
    border-radius: 999px;
    background: var(--tb-track, var(--soft));
    color: var(--secondary);
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

#panel-publish .publish-accounts-head__actions {
    display: inline-grid;
    grid-auto-flow: column;
    align-items: stretch;
    height: 28px;
    padding: 2px;
    border: 0;
    border-radius: 7px;
    background: var(--tb-track, var(--soft));
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 6%, transparent);
}

#panel-publish .publish-accounts-head__actions .btn {
    min-height: 0;
    height: 100%;
    padding: 0 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--secondary);
    font-size: 12px;
    font-weight: 500;
    box-shadow: none;
}

#panel-publish .publish-accounts-head__actions .btn:hover {
    color: var(--text);
    background: transparent;
}

#panel-publish .publish-accounts-bar__search {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
    width: min(200px, 100%);
    max-width: 200px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: var(--tb-track, var(--soft));
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 6%, transparent);
}

#panel-publish .publish-accounts-bar__search svg {
    left: 9px;
    width: 13px;
    height: 13px;
    color: var(--muted);
}

#panel-publish .publish-accounts-bar__search input {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0 10px 0 28px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    box-shadow: none;
}

#panel-publish .publish-accounts-bar__search input::placeholder {
    color: var(--muted);
}

#panel-publish .publish-account-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-height: none;
    overflow: visible;
    padding: 0;
}

#panel-publish .publish-account-pill,
#panel-publish .publish-toolbar .publish-account-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 2px 10px 2px 2px;
    border: 0;
    border-radius: 999px;
    background: var(--tb-track, var(--soft));
    color: var(--secondary);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1;
    box-shadow: none;
    outline: none;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

#panel-publish .publish-account-pill:hover,
#panel-publish .publish-toolbar .publish-account-pill:hover {
    background: color-mix(in srgb, var(--soft) 55%, var(--hover));
    color: var(--text);
    transform: none;
}

#panel-publish .publish-account-pill:has(input:checked),
#panel-publish .publish-toolbar .publish-account-pill:has(input:checked) {
    border: 0;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    box-shadow: var(--tb-pill-shadow, var(--macos-control-shadow));
}

#panel-publish .publish-account-pill__avatar,
#panel-publish .publish-toolbar .publish-account-pill__avatar {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 0.5px color-mix(in srgb, #000 12%, transparent);
}

#panel-publish .publish-account-pill__name {
    max-width: 148px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#panel-publish .publish-account-pill__badges {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--muted);
}

#panel-publish .publish-account-pill:has(input:checked) .publish-account-pill__badges {
    color: var(--publish-blue);
}

#panel-publish .publish-bulk-stats--bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    min-height: 36px;
    margin: 0;
    padding: 8px 16px;
    border: 0;
    border-bottom: 1px solid var(--publish-border);
    border-radius: 0;
    background: color-mix(in srgb, var(--soft) 40%, var(--surface));
}

#panel-publish .publish-bulk-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 4px 9px;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--elevated) 55%, transparent);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1;
}

#panel-publish .publish-bulk-stat strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

#panel-publish .publish-bulk-stat--status {
    margin-left: auto;
    padding: 5px 10px;
    border: 0 !important;
    border-style: solid !important;
    border-radius: 7px;
    background: color-mix(in srgb, var(--publish-blue) 12%, var(--surface));
    color: var(--publish-blue);
    font-size: 12px;
    font-weight: 600;
}

#panel-publish .publish-bulk-stat--status.is-warning {
    background: color-mix(in srgb, #d97706 14%, var(--surface));
    color: color-mix(in srgb, #d97706 82%, var(--text));
    border: 0 !important;
}

@media (max-width: 760px) {
    #panel-publish .publish-toolbar__row {
        gap: 12px;
    }

    #panel-publish .publish-toolbar__cluster,
    #panel-publish .publish-compose-mode--bar {
        width: 100%;
    }

    #panel-publish .publish-toolbar .publish-platforms--compact,
    #panel-publish .publish-toolbar .publish-seg--format,
    #panel-publish .publish-compose-mode__inner {
        width: 100%;
        grid-auto-columns: 1fr;
    }

    #panel-publish .publish-toolbar__cluster + .publish-toolbar__cluster,
    #panel-publish .publish-toolbar__cluster + .publish-compose-mode--bar:not([hidden]),
    #panel-publish .publish-compose-mode--bar:not([hidden]) + .publish-toolbar__cluster {
        padding-top: 0;
        border-top: 0;
    }

    #panel-publish .publish-accounts-bar__search {
        margin-left: 0;
        width: 100%;
        max-width: none;
    }

    #panel-publish .publish-bulk-stat--status {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

#panel-publish .publish-workspace {
    background: var(--publish-canvas);
}

#panel-publish .publish-compose-zone--media,
#panel-publish .publish-stage__media {
    gap: 12px;
    padding: 14px 16px 16px;
    background: var(--publish-surface);
}

#panel-publish .publish-stage__media-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    min-height: 28px;
}

#panel-publish .publish-stage__title {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

#panel-publish .publish-stage__media-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    min-width: 0;
}

#panel-publish .publish-media-panel__count {
    min-width: 22px;
    min-height: 20px;
    padding: 0 7px;
    border: 0;
    border-radius: 999px;
    background: var(--tb-track, var(--soft));
    color: var(--secondary);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#panel-publish .publish-stage__hint {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

#panel-publish .publish-stage__limits {
    margin: 0;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: color-mix(in srgb, var(--soft) 55%, var(--surface));
    color: var(--secondary);
    font-size: 11.5px;
    line-height: 1.35;
}

#panel-publish .publish-stage__limits[hidden],
#panel-publish .publish-media-list[hidden],
#panel-publish .publish-media-panel__toolbar[hidden],
#panel-publish .publish-bulk-media-tools[hidden],
#panel-publish .publish-url-fallback[hidden] {
    display: none !important;
}

#panel-publish .publish-media-panel__toolbar {
    display: inline-grid;
    grid-auto-flow: column;
    align-items: stretch;
    height: 26px;
    margin: 0;
    padding: 2px;
    border: 0;
    border-radius: 7px;
    background: var(--tb-track, var(--soft));
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 6%, transparent);
    width: auto;
}

#panel-publish .publish-media-panel__toolbar .btn {
    min-height: 0;
    height: 100%;
    padding: 0 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--secondary);
    font-size: 12px;
    font-weight: 500;
    box-shadow: none;
}

#panel-publish .publish-media-panel__toolbar .btn:hover {
    color: var(--text);
    background: transparent;
}

#panel-publish .publish-media-panel__toolbar .btn[hidden] {
    display: none !important;
}

#panel-publish .publish-dropzone--reel,
#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel,
#panel-publish .publish-composer.publish-composer--bulk .publish-compose-zone--media .publish-dropzone--reel,
#panel-publish .publish-dropzone--reel.publish-dropzone--bulk {
    display: grid !important;
    place-items: center;
    box-sizing: border-box;
    flex: 0 0 auto !important;
    align-self: stretch;
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 9 / 16;
    height: auto !important;
    min-height: 0 !important;
    max-height: min(58vh, 460px) !important;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 18px;
    background: color-mix(in srgb, var(--soft) 55%, var(--elevated));
    box-shadow: inset 0 0 0 1px var(--publish-border);
    cursor: pointer;
    transition: background 140ms ease, box-shadow 140ms ease;
    overflow: hidden;
}

#panel-publish .publish-composer--post .publish-dropzone--reel,
#panel-publish .publish-composer--post .publish-compose-zone--media .publish-dropzone--reel {
    aspect-ratio: 1 / 1;
    width: 100% !important;
    max-height: min(42vh, 320px) !important;
    border-radius: 14px;
}

#panel-publish .publish-stage__media:has(.publish-media-list--bulk:not([hidden])) .publish-dropzone--reel,
#panel-publish .publish-stage__media:has(.publish-media-list--grid:not([hidden])) .publish-dropzone--reel {
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(42vh, 340px) !important;
    align-self: stretch;
    margin-inline: 0;
}

#panel-publish .publish-composer--story .publish-dropzone--reel,
#panel-publish .publish-composer--story .publish-compose-zone--media .publish-dropzone--reel,
#panel-publish .publish-composer--reel .publish-dropzone--reel,
#panel-publish .publish-composer--reel .publish-compose-zone--media .publish-dropzone--reel,
#panel-publish .publish-composer--reels .publish-dropzone--reel,
#panel-publish .publish-composer--reels .publish-compose-zone--media .publish-dropzone--reel {
    aspect-ratio: 9 / 16;
    border-radius: 18px;
}

#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel:hover,
#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel.is-dragover {
    background: color-mix(in srgb, var(--publish-blue) 10%, var(--surface));
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, var(--publish-blue) 40%, var(--publish-border)),
        0 0 0 3px color-mix(in srgb, var(--publish-blue) 12%, transparent);
}

#panel-publish .publish-dropzone__frame {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 10px;
    width: 100%;
    height: 100%;
    padding: 20px 14px;
    text-align: center;
}

#panel-publish .publish-dropzone__icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--surface);
    color: var(--publish-blue);
    box-shadow: var(--tb-pill-shadow, var(--macos-control-shadow));
}

#panel-publish .publish-dropzone__copy {
    display: grid;
    gap: 4px;
    justify-items: center;
}

#panel-publish .publish-dropzone__copy strong {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
}

#panel-publish .publish-dropzone__copy span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

#panel-publish .publish-dropzone__badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--publish-blue);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: 0.01em;
    box-shadow: var(--macos-control-shadow);
    pointer-events: none;
}

#panel-publish .publish-media-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    align-self: stretch;
    box-sizing: border-box;
    overflow-x: hidden;
}

#panel-publish .publish-media-list__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 30px;
    margin: 0;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: var(--tb-track, var(--soft));
    font-size: 12px;
    box-sizing: border-box;
}

#panel-publish .publish-media-list__summary.is-pending {
    background: color-mix(in srgb, #d97706 12%, var(--surface));
    color: color-mix(in srgb, #d97706 80%, var(--text));
}

#panel-publish .publish-media-list__summary.is-ready {
    background: color-mix(in srgb, #16a34a 12%, var(--surface));
    color: color-mix(in srgb, #16a34a 78%, var(--text));
}

#panel-publish .publish-media-list__grid,
#panel-publish .publish-media-list--grid .publish-media-list__grid,
#panel-publish .publish-media-list--bulk .publish-media-list__grid {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 !important;
    max-height: none;
    overflow: visible !important;
    scrollbar-gutter: auto !important;
    box-sizing: border-box;
}

#panel-publish .publish-media-card,
#panel-publish .publish-toolbar .publish-media-card {
    display: grid !important;
    grid-template-columns: 24px minmax(0, 1fr) 28px !important;
    align-items: center !important;
    justify-items: stretch;
    column-gap: 8px !important;
    row-gap: 0 !important;
    gap: 0 8px !important;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    padding: 6px 8px !important;
    border: 0 !important;
    border-radius: 8px;
    background: var(--tb-track, var(--soft));
    box-sizing: border-box;
    transform: none !important;
}

#panel-publish .publish-media-card--single {
    grid-template-columns: minmax(0, 1fr) 28px !important;
}

#panel-publish .publish-media-card__index {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    max-width: 24px;
    margin: 0;
    padding: 0;
    border-radius: 6px;
    background: color-mix(in srgb, var(--publish-blue) 14%, var(--surface));
    color: var(--publish-blue);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    justify-self: start;
}

#panel-publish .publish-media-card__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

#panel-publish .publish-media-card__body strong,
#panel-publish .publish-media-card__body span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
}

#panel-publish .publish-media-card__body strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

#panel-publish .publish-media-card__body span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
}

#panel-publish .publish-media-card__remove {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    max-width: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    color: var(--muted);
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    justify-self: end;
    transform: none !important;
}

#panel-publish .publish-media-card__remove:hover {
    background: color-mix(in srgb, #ef4444 12%, var(--surface));
    color: #ef4444;
}

#panel-publish .publish-bulk-media-tools {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 2px 8px 0 !important;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    box-sizing: border-box;
}

#panel-publish .publish-bulk-media-tools .publish-check--compact {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
    box-sizing: border-box;
}

#panel-publish .publish-bulk-media-tools .publish-check--compact input {
    width: 14px;
    height: 14px;
    min-width: 14px;
    margin: 0 !important;
    padding: 0;
    flex-shrink: 0;
    align-self: center;
    accent-color: var(--publish-blue);
    vertical-align: middle;
}

#panel-publish .publish-bulk-media-tools .publish-check--compact span {
    display: block;
    min-width: 0;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

#panel-publish .publish-url-fallback {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

#panel-publish .publish-url-fallback summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
}

#panel-publish .publish-url-fallback summary::-webkit-details-marker {
    display: none;
}

#panel-publish .publish-url-fallback summary:hover {
    color: var(--publish-blue);
}

#panel-publish .publish-url-fallback[open] summary {
    margin-bottom: 8px;
    color: var(--text);
}

#panel-publish .publish-url-fallback textarea {
    min-height: 64px;
    border: 1px solid var(--publish-border);
    border-radius: 8px;
    background: var(--elevated);
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 3%, transparent);
    font-size: 12.5px;
}

#panel-publish .publish-rail-card--preview,
#panel-publish .publish-rail-card:not(.publish-rail-card--preview) {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid var(--publish-border);
    border-radius: 10px;
    background: var(--publish-surface);
    box-shadow: var(--macos-control-shadow);
}

#panel-publish .publish-post-preview__card {
    width: 100%;
    max-width: none;
    margin-inline: 0;
}

#panel-publish .publish-caption__field textarea,
#panel-publish .publish-stage__caption textarea {
    border: 1px solid var(--publish-border);
    border-radius: 8px;
    background: var(--elevated);
    box-shadow: inset 0 1px 1px color-mix(in srgb, #000 3%, transparent);
    font-size: 13px;
}

#panel-publish .publish-rail__submit .btn--lg {
    min-height: 36px;
    border-radius: var(--macos-control-radius);
    background: var(--publish-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--publish-blue) 28%, transparent);
}

#panel-publish .publish-rail__submit .btn--lg:hover {
    background: var(--publish-blue-hover);
}

#panel-publish .publish-page__actions .btn {
    min-height: var(--macos-ctrl-h);
    border-radius: var(--macos-control-radius);
    box-shadow: var(--macos-control-shadow);
}

#panel-publish .publish-page__head h2 {
    font-size: clamp(22px, 2vw, 28px);
    font-weight: 680;
    letter-spacing: -0.04em;
}

#panel-publish .publish-page__eyebrow {
    color: var(--publish-blue);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#panel-publish .publish-queue .publish-post {
    border: 1px solid var(--publish-border);
    border-radius: 10px;
    box-shadow: var(--macos-control-shadow);
}

/* -----------------------------------------------------------
   Publish motion — Sequoia (presence + hierarchy, not noise)
   ----------------------------------------------------------- */

@keyframes macos-pub-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes macos-pub-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes macos-pub-pop {
    0% {
        transform: scale(0.94);
    }
    55% {
        transform: scale(1.03);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes macos-pub-pill {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes macos-pub-breathe {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-1.5px);
    }
}

@keyframes macos-pub-ring {
    0%,
    100% {
        box-shadow:
            0 0 0 0 color-mix(in srgb, var(--publish-blue) 0%, transparent),
            inset 0 1px 1px color-mix(in srgb, #000 4%, transparent);
    }
    50% {
        box-shadow:
            0 0 0 3px color-mix(in srgb, var(--publish-blue) 12%, transparent),
            inset 0 1px 1px color-mix(in srgb, #000 4%, transparent);
    }
}

#panel-publish .publish-page__head {
    animation: macos-pub-fade 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#panel-publish .publish-view.is-active .publish-composer,
#panel-publish .publish-view.is-active .publish-queue,
#panel-publish .publish-view.is-active .publish-accounts {
    animation: macos-pub-enter 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#panel-publish .publish-view.is-active .publish-toolbar {
    animation: macos-pub-fade 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 40ms;
}

#panel-publish .publish-view.is-active .publish-stage {
    animation: macos-pub-fade 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 80ms;
}

#panel-publish .publish-view.is-active .publish-rail {
    animation: macos-pub-fade 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 120ms;
}

#panel-publish .publish-alert:not([hidden]),
#panel-publish .publish-bulk-stats--bar:not([hidden]) {
    animation: macos-pub-fade 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#panel-publish .publish-page__head .publish-subnav__btn,
#panel-publish .publish-toolbar .publish-platforms--compact .publish-platform,
#panel-publish .publish-toolbar .publish-seg--format .publish-seg__btn,
#panel-publish .publish-compose-mode__card,
#panel-publish .publish-queue .publish-seg__btn {
    transition:
        background 160ms cubic-bezier(0.22, 1, 0.36, 1),
        color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

#panel-publish .publish-account-pill,
#panel-publish .publish-toolbar .publish-account-pill {
    animation: none;
    transition:
        border-color 120ms ease,
        background 120ms ease,
        color 120ms ease,
        box-shadow 120ms ease;
}

#panel-publish .publish-account-pills.is-entering .publish-account-pill {
    animation: macos-pub-pill 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--pill-i, 0) * 18ms);
}

#panel-publish .publish-account-pill:hover {
    transform: none;
}

#panel-publish .publish-account-pill.is-pop {
    animation: macos-pub-pop 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

#panel-publish .publish-media-list__summary,
#panel-publish .publish-media-card {
    animation: macos-pub-fade 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#panel-publish .publish-media-card {
    animation-delay: calc(var(--card-i, 0) * 36ms);
    transition: background 140ms ease;
}

#panel-publish .publish-media-card__remove {
    transition: background 140ms ease, color 140ms ease;
}

#panel-publish .publish-dropzone--reel,
#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel {
    transition:
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease,
        transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--publish-blue) 10%, transparent);
}

#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel.is-dragover {
    transform: scale(1.012);
    animation: macos-pub-ring 1.2s ease-in-out infinite;
}

#panel-publish .publish-dropzone__icon {
    animation: macos-pub-breathe 2.8s ease-in-out infinite;
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), background 160ms ease, color 160ms ease;
}

#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel:hover .publish-dropzone__icon,
#panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel.is-dragover .publish-dropzone__icon {
    animation: none;
    transform: translateY(-2px) scale(1.06);
}

#panel-publish .publish-dropzone--reel.is-filled .publish-dropzone__icon {
    animation: none;
    background: rgb(0 0 0 / 48%);
    color: #fff;
    box-shadow: none;
}

#panel-publish .publish-dropzone__icon {
    color: var(--publish-blue);
}

#panel-publish .publish-dropzone__icon svg {
    color: inherit;
    stroke: currentColor;
}

#panel-publish .publish-compose-options__body {
    animation: macos-pub-fade 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#panel-publish .publish-compose-options:not([open]) .publish-compose-options__body {
    animation: none;
}

#panel-publish .publish-compose-options__summary::after {
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

#panel-publish .publish-rail-card:not(.publish-rail-card--preview),
#panel-publish .publish-post-preview__card {
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms ease;
}

#panel-publish .publish-rail-card:not(.publish-rail-card--preview):hover {
    transform: translateY(-1px);
}

#panel-publish .publish-rail-card--preview:hover .publish-post-preview__card {
    transform: translateY(-2px);
}

#panel-publish .publish-rail__submit .btn--lg {
    position: relative;
    overflow: hidden;
    transition:
        transform 160ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 180ms ease,
        filter 160ms ease,
        background 160ms ease;
}

#panel-publish .publish-rail__submit .btn--lg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 28%,
        color-mix(in srgb, #fff 20%, transparent) 48%,
        transparent 64%
    );
    transform: translateX(-120%);
    transition: transform 520ms ease;
    pointer-events: none;
}

#panel-publish .publish-rail__submit .btn--lg:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--publish-blue) 28%, transparent);
}

#panel-publish .publish-rail__submit .btn--lg:hover::after {
    transform: translateX(120%);
}

#panel-publish .publish-rail__submit .btn--lg:active {
    transform: translateY(0) scale(0.985);
}

#panel-publish .publish-queue .publish-post {
    animation: macos-pub-fade 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--post-i, 0) * 32ms);
    transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease;
}

#panel-publish .publish-queue .publish-post:hover {
    transform: translateY(-1px);
}

#panel-publish .publish-page__actions .btn {
    transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease, background 160ms ease;
}

#panel-publish .publish-page__actions .btn:hover {
    transform: translateY(-0.5px);
}

#panel-publish .publish-page__actions .btn:active {
    transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
    #panel-publish .publish-page__head,
    #panel-publish .publish-view.is-active .publish-composer,
    #panel-publish .publish-view.is-active .publish-queue,
    #panel-publish .publish-view.is-active .publish-accounts,
    #panel-publish .publish-view.is-active .publish-toolbar,
    #panel-publish .publish-view.is-active .publish-stage,
    #panel-publish .publish-view.is-active .publish-rail,
    #panel-publish .publish-alert:not([hidden]),
    #panel-publish .publish-bulk-stats--bar:not([hidden]),
    #panel-publish .publish-account-pill,
    #panel-publish .publish-toolbar .publish-account-pill,
    #panel-publish .publish-page__head .publish-subnav__btn.is-active,
    #panel-publish .publish-toolbar .publish-platforms--compact .publish-platform:has(input:checked),
    #panel-publish .publish-toolbar .publish-seg--format .publish-seg__btn.is-active,
    #panel-publish .publish-compose-mode__card.is-active,
    #panel-publish .publish-queue .publish-seg__btn.is-active,
    #panel-publish .publish-media-list__summary,
    #panel-publish .publish-media-card,
    #panel-publish .publish-dropzone__icon,
    #panel-publish .publish-compose-options__body,
    #panel-publish .publish-queue .publish-post,
    #panel-publish .publish-composer .publish-compose-zone--media .publish-dropzone--reel.is-dragover {
        animation: none !important;
    }

    #panel-publish .publish-account-pill,
    #panel-publish .publish-media-card,
    #panel-publish .publish-dropzone--reel,
    #panel-publish .publish-rail-card:not(.publish-rail-card--preview),
    #panel-publish .publish-post-preview__card,
    #panel-publish .publish-rail__submit .btn--lg,
    #panel-publish .publish-queue .publish-post,
    #panel-publish .publish-page__actions .btn,
    #panel-publish .publish-page__head .publish-subnav__btn,
    #panel-publish .publish-toolbar .publish-platforms--compact .publish-platform,
    #panel-publish .publish-toolbar .publish-seg--format .publish-seg__btn,
    #panel-publish .publish-compose-mode__card {
        transition: none !important;
        transform: none !important;
    }

    #panel-publish .publish-rail__submit .btn--lg::after {
        display: none;
    }
}

@media (max-width: 760px) {
    #panel-publish .publish-toolbar__cluster,
    #panel-publish .publish-compose-mode--bar {
        width: 100%;
        padding: 0;
        border-left: 0;
    }

    #panel-publish .publish-toolbar__cluster + .publish-toolbar__cluster,
    #panel-publish .publish-toolbar__cluster + .publish-compose-mode--bar:not([hidden]),
    #panel-publish .publish-compose-mode--bar:not([hidden]) + .publish-toolbar__cluster {
        padding-left: 0;
        padding-top: 10px;
        border-left: 0;
        border-top: 1px solid var(--publish-border);
    }

    #panel-publish .publish-page__head .publish-subnav,
    #panel-publish .publish-page__head .fm-tabs.publish-subnav {
        width: 100%;
    }

    #panel-publish .publish-stage__media-meta {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    #panel-publish .publish-media-panel__toolbar {
        width: 100%;
        grid-auto-columns: 1fr;
    }
}

/*
 * A aba Analytics foi reescrita com o namespace .anx-* e define a própria
 * superfície em pages/analytics.css. As regras .an-* que existiam aqui
 * sobrescreviam o CSS da página (este arquivo carrega depois) e não têm mais
 * alvo.
 */

/* ===== core/shell-premium.css ===== */
/* FlacosMedia premium shell — authoritative sidebar, topbar and mobile navigation layer */
:root,
[data-theme="dark"],
[data-theme="light"] {
    --sidebar-w: 244px;
    --sidebar-w-collapsed: 52px;
    --topbar-h: 52px;
    --shell-control: 32px;
    --shell-line: color-mix(in srgb, var(--line) 82%, transparent);
    --shell-glass: color-mix(in srgb, var(--elevated) 88%, transparent);
    --shell-ease: cubic-bezier(.22, 1, .36, 1);
}

/* Global sidebar — compact, same density as productivity */
.sidebar {
    --sidebar-pad: 12px;
    --sidebar-inset: 10px;
    --sidebar-rail: 22px;
    --sidebar-gap: 10px;
    --sidebar-control: 28px;
    --sidebar-item-h: 36px;
    --sidebar-section-gap: 16px;
    width: var(--sidebar-w);
    border-right: 1px solid var(--shell-line);
    background: var(--elevated);
    transition: width 200ms var(--shell-ease), transform 200ms var(--shell-ease);
}

.sidebar__header {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    padding: 0 var(--sidebar-pad);
    border-bottom: 1px solid var(--shell-line);
}

.sidebar__brand .brand {
    gap: 9px;
    height: 32px;
    padding-left: 2px;
}

.sidebar__brand .brand-mark {
    width: 28px;
    height: 28px;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    box-shadow: none;
    color: var(--accent);
}

.sidebar__brand .brand-mark svg,
.sidebar__brand .brand-mark__logo { width: 16px; height: 16px; }
.sidebar__brand .brand-text { gap: 0; }
.sidebar__brand .brand-text strong { font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.sidebar__brand .brand-text span { display: none; }

.sidebar__collapse,
.sidebar__close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 7px;
}
.sidebar__collapse:hover,
.sidebar__close:hover {
    border-color: transparent;
    background: var(--hover);
}

.sidebar__body {
    padding: 12px var(--sidebar-pad) 12px;
    mask-image: none;
}

.sidebar__nav { gap: var(--sidebar-section-gap); }
.sidebar__section { gap: 4px; }
.sidebar__section + .sidebar__section { position: relative; padding-top: 12px; }
.sidebar__section + .sidebar__section::before {
    position: absolute;
    top: 5px;
    right: var(--sidebar-inset);
    left: var(--sidebar-inset);
    height: 1px;
    background: color-mix(in srgb, var(--line) 88%, transparent);
    content: "";
}
.sidebar__section-title {
    margin: 0;
    padding: 2px var(--sidebar-inset) 6px;
    color: var(--secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-transform: uppercase;
}
.sidebar__menu { gap: 2px; }

.sidebar__link {
    min-height: var(--sidebar-item-h);
    gap: var(--sidebar-gap);
    padding: 0 var(--sidebar-inset);
    border: 0;
    border-radius: 10px;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 550;
    letter-spacing: -0.015em;
    transition: background 120ms ease, color 120ms ease;
}
.sidebar__link::before { display: none; }
.sidebar__link-icon {
    width: var(--sidebar-rail);
    height: var(--sidebar-rail);
    border-radius: 0;
    background: transparent;
    color: var(--secondary);
    opacity: 1;
    transform: none;
    transition: color 120ms ease;
}
.sidebar__link-icon svg { width: 18px; height: 18px; stroke-width: 1.85; }
.sidebar__link:hover {
    border-color: transparent;
    background: var(--hover);
    color: var(--text);
    transform: none;
}
.sidebar__link:hover .sidebar__link-icon {
    background: transparent;
    color: var(--text);
    transform: none;
}
.sidebar__link:focus-visible { outline-offset: -2px; }

#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"],
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"],
#tab-accounts:checked ~ .sidebar .sidebar__link[for="tab-accounts"],
#tab-publish:checked ~ .sidebar .sidebar__link[for="tab-publish"],
#tab-analytics:checked ~ .sidebar .sidebar__link[for="tab-analytics"],
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"],
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"],
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"],
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"],
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"] {
    background: color-mix(in srgb, var(--accent) 16%, var(--surface));
    color: var(--accent);
    font-weight: 650;
    transform: none;
}
#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"]::before,
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"]::before,
#tab-accounts:checked ~ .sidebar .sidebar__link[for="tab-accounts"]::before,
#tab-publish:checked ~ .sidebar .sidebar__link[for="tab-publish"]::before,
#tab-analytics:checked ~ .sidebar .sidebar__link[for="tab-analytics"]::before,
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"]::before,
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"]::before,
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"]::before,
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"]::before,
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"]::before { display: none; }
#tab-productivity:checked ~ .sidebar .sidebar__link[for="tab-productivity"] .sidebar__link-icon,
#tab-reels:checked ~ .sidebar .sidebar__link[for="tab-reels"] .sidebar__link-icon,
#tab-accounts:checked ~ .sidebar .sidebar__link[for="tab-accounts"] .sidebar__link-icon,
#tab-publish:checked ~ .sidebar .sidebar__link[for="tab-publish"] .sidebar__link-icon,
#tab-analytics:checked ~ .sidebar .sidebar__link[for="tab-analytics"] .sidebar__link-icon,
#tab-downloader:checked ~ .sidebar .sidebar__link[for="tab-downloader"] .sidebar__link-icon,
#tab-studio:checked ~ .sidebar .sidebar__link[for="tab-studio"] .sidebar__link-icon,
#tab-team:checked ~ .sidebar .sidebar__link[for="tab-team"] .sidebar__link-icon,
#tab-bot:checked ~ .sidebar .sidebar__link[for="tab-bot"] .sidebar__link-icon,
#tab-pixel:checked ~ .sidebar .sidebar__link[for="tab-pixel"] .sidebar__link-icon {
    background: transparent;
    color: var(--accent);
}

.sidebar__badge {
    min-width: 18px;
    padding: 2px 6px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: none;
}

.sidebar__footer { padding: 8px var(--sidebar-pad) 10px; border-top: 1px solid var(--shell-line); }
.sidebar__profile {
    min-height: 36px;
    gap: 8px;
    padding: 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
}
.sidebar__profile:hover { border-color: transparent; background: var(--hover); }
.sidebar__avatar {
    width: 26px;
    height: 26px;
    background: color-mix(in srgb, var(--accent) 16%, var(--soft));
    color: var(--text);
    font-size: 11px;
    box-shadow: none;
}
.sidebar__user-name { font-size: 13px; font-weight: 650; }
.sidebar__user-role { font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--secondary); }
.sidebar__quick-actions { gap: 2px; }
.sidebar__icon-btn { width: 26px; height: 26px; border-radius: 7px; }

/* Collapsed sidebar */
@media (min-width: 769px) {
    .sidebar__collapse { display: inline-flex; }
    html[data-sidebar-collapsed="true"] .sidebar { width: var(--sidebar-w-collapsed); }
    html[data-sidebar-collapsed="true"] .sidebar__header {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0;
        height: var(--topbar-h);
        min-height: var(--topbar-h);
        padding: 0;
    }
    html[data-sidebar-collapsed="true"] .sidebar__brand {
        display: flex;
        flex: none;
        align-items: center;
        justify-content: center;
        width: 100%;
        cursor: pointer;
    }
    html[data-sidebar-collapsed="true"] .sidebar__brand .brand {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        padding: 0;
        margin: 0;
        gap: 0;
    }
    html[data-sidebar-collapsed="true"] .sidebar__brand .brand-mark {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }
    html[data-sidebar-collapsed="true"] .sidebar__brand .brand-text,
    html[data-sidebar-collapsed="true"] .sidebar__section-title,
    html[data-sidebar-collapsed="true"] .sidebar__link-label,
    html[data-sidebar-collapsed="true"] .sidebar__user-meta,
    html[data-sidebar-collapsed="true"] .sidebar__quick-actions,
    html[data-sidebar-collapsed="true"] .sidebar__badge,
    html[data-sidebar-collapsed="true"] .sidebar__toolbar { display: none; }
    html[data-sidebar-collapsed="true"] .sidebar__body {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 6px 0 8px;
    }
    html[data-sidebar-collapsed="true"] .sidebar__nav {
        align-items: center;
        gap: 6px;
        width: 100%;
    }
    html[data-sidebar-collapsed="true"] .sidebar__section {
        align-items: center;
        gap: 2px;
        width: 100%;
    }
    html[data-sidebar-collapsed="true"] .sidebar__section + .sidebar__section { padding-top: 6px; }
    html[data-sidebar-collapsed="true"] .sidebar__section + .sidebar__section::before {
        top: 2px;
        right: 16px;
        left: 16px;
    }
    html[data-sidebar-collapsed="true"] .sidebar__menu {
        align-items: center;
        width: 100%;
    }
    html[data-sidebar-collapsed="true"] .sidebar__link {
        justify-content: center;
        width: 32px !important;
        min-height: 32px !important;
        height: 32px;
        padding: 0 !important;
        margin-inline: auto;
    }
    html[data-sidebar-collapsed="true"] .sidebar__link-icon {
        width: 20px !important;
        height: 20px !important;
        background: transparent !important;
    }
    html[data-sidebar-collapsed="true"] .sidebar__footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 0 10px;
    }
    html[data-sidebar-collapsed="true"] .sidebar__profile {
        justify-content: center;
        width: 32px;
        min-height: 32px;
        padding: 0;
        margin-inline: auto;
        background: transparent;
        border: 0;
    }
    html[data-sidebar-collapsed="true"] .sidebar__avatar {
        width: 26px;
        height: 26px;
    }
}

/* Global topbar */
.topbar {
    --shell-control: 36px;
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    padding: 0 clamp(18px, 2.2vw, 30px);
    border-bottom: 1px solid var(--shell-line);
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    box-shadow: 0 1px 0 color-mix(in srgb, white 2%, transparent);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.topbar__lead { gap: 10px; }
.topbar__nav { gap: 7px; }
.topbar__nav-label { color: var(--muted); font-size: 11.5px; font-weight: 550; letter-spacing: 0; text-transform: none; }
.topbar__nav-separator { color: color-mix(in srgb, var(--muted) 65%, transparent); }
.topbar__nav-page {
    height: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
    font-weight: 700;
}
.topbar__page { animation: topbar-crumb-in 180ms var(--shell-ease); }
.topbar__actions { gap: 9px; }

.topbar__command {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 146px;
    height: var(--shell-control);
    padding: 0 7px 0 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    box-shadow: var(--shadow);
    color: var(--muted);
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}
.topbar__command > span { flex: 1; text-align: left; font-size: 11.5px; }
.topbar__command kbd,
.shell-switcher kbd {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-width: 22px;
    min-height: 22px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-bottom-color: var(--line-strong);
    border-radius: 6px;
    background: var(--soft);
    color: var(--muted);
    font: 10px/1 var(--mono);
}
.topbar__command:hover { border-color: var(--line-strong); background: var(--surface); color: var(--text); transform: translateY(-1px); }
.topbar__queue {
    height: var(--shell-control);
    padding: 0 10px;
    border-radius: 10px;
    box-shadow: inset 0 1px 0 color-mix(in srgb, white 5%, transparent);
}
.topbar__cluster {
    height: 42px;
    padding: 3px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
}
.topbar__tool,
.topbar__icon { border-radius: 9px; }
.topbar__user { border-radius: 9px; }
.topbar__avatar { border-radius: 8px; }
.topbar__user-role.is-admin { padding-inline: 5px; }

/* Quick switcher */
.shell-switcher {
    width: min(92vw, 560px);
    max-height: min(78vh, 620px);
    margin: max(10vh, 72px) auto auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--elevated);
    color: var(--text);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .28), inset 0 1px 0 color-mix(in srgb, white 7%, transparent);
}
.shell-switcher::backdrop { background: rgba(4, 6, 12, .52); backdrop-filter: blur(6px); }
.shell-switcher__panel { display: flex; flex-direction: column; min-height: 0; }
.shell-switcher__header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 11px;
    min-height: 62px;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
}
.shell-switcher__header input {
    width: 100%;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text);
    font-size: 16px;
    font-weight: 520;
}
.shell-switcher__header input::placeholder { color: var(--muted); }
.shell-switcher__meta,
.shell-switcher__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 34px;
    padding: 0 14px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.shell-switcher__meta { background: color-mix(in srgb, var(--soft) 52%, transparent); }
.shell-switcher__results { max-height: 390px; overflow-y: auto; padding: 7px; }
.shell-switcher__item {
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--secondary);
    cursor: pointer;
    text-align: left;
}
.shell-switcher__item:hover,
.shell-switcher__item.is-active { border-color: color-mix(in srgb, var(--accent) 16%, var(--line)); background: var(--accent-soft); color: var(--text); }
.shell-switcher__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface); color: var(--muted); }
.shell-switcher__item.is-active .shell-switcher__icon { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.shell-switcher__icon svg { width: 17px; height: 17px; }
.shell-switcher__copy { display: grid; gap: 2px; min-width: 0; }
.shell-switcher__copy strong { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.shell-switcher__copy small { color: var(--muted); font-size: 9px; }
.shell-switcher__item > kbd { opacity: 0; }
.shell-switcher__item.is-active > kbd { opacity: 1; }
.shell-switcher__footer { min-height: 38px; border-top: 1px solid var(--line); text-transform: none; }
.shell-switcher__footer span { display: inline-flex; align-items: center; gap: 4px; }
.shell-switcher__footer kbd { min-width: 20px; min-height: 20px; padding: 0 5px; }
.shell-switcher__empty { display: grid; place-items: center; min-height: 160px; color: var(--muted); text-align: center; }
.shell-switcher__empty strong { color: var(--secondary); font-size: 12px; }
.shell-switcher__empty span { font-size: 10px; }

/* Mobile shell */
@media (max-width: 768px) {
    :root,
    [data-theme="dark"],
    [data-theme="light"] { --topbar-h: 58px; }

    .topbar {
        gap: 8px;
        height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
        min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
        padding:
            env(safe-area-inset-top, 0px)
            max(12px, env(safe-area-inset-right, 0px))
            0
            max(12px, env(safe-area-inset-left, 0px));
        background: color-mix(in srgb, var(--bg) 90%, transparent);
    }
    .topbar__menu { display: inline-flex; width: 38px; height: 38px; border-radius: 10px; }
    .topbar__brand { display: none; }
    .topbar__nav { display: flex; min-width: 0; }
    .topbar__nav-label, .topbar__nav-separator { display: none; }
    .topbar__nav-page { max-width: min(34vw, 160px); overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
    .topbar__command { width: 38px; min-width: 38px; padding: 0; justify-content: center; }
    .topbar__command > span, .topbar__command kbd { display: none; }
    .topbar__queue { width: 34px; padding: 0; justify-content: center; }
    .topbar__queue-text { display: none; }
    .topbar__queue-count { display: inline; font-size: 10px; }
    .topbar__cluster { height: 40px; }
    .topbar__cluster .theme-toggle {
        display: inline-flex;
        width: 38px;
        height: 38px;
    }
    .topbar__user-info, .topbar__logout { display: none; }
    .topbar__user { width: 32px; padding: 0 3px; }

    .sidebar {
        top: 8px;
        bottom: 8px;
        left: 8px;
        width: min(314px, calc(100vw - 28px));
        height: calc(100dvh - 16px);
        border: 1px solid var(--line-strong);
        border-radius: 18px;
        box-shadow: none;
        transform: translateX(calc(-100% - 18px));
    }
    #sidebar-open:checked ~ .sidebar {
        transform: translateX(0);
        box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
    }
    .sidebar__header { padding-inline: 15px; }
    .sidebar__close { display: inline-flex; }
    .sidebar__body { padding: 14px 15px 18px; mask-image: none; }
    .sidebar__footer { padding: 12px 15px 14px; }
    .sidebar-backdrop { background: rgba(3,5,10,.48); backdrop-filter: blur(5px); }

    .mobile-dock {
        right: 0;
        bottom: 0;
        left: 0;
        overflow: hidden;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        border: 0;
        border-top: 1px solid var(--line-strong);
        border-radius: 0;
        background: var(--elevated);
        box-shadow: 0 -8px 28px rgba(0,0,0,.18);
    }
    .mobile-nav__inner { height: 56px; align-items: center; justify-content: stretch; overflow-x: hidden; padding: 4px 6px; }
    .mobile-nav__link { flex: 1 1 0; align-self: center; height: 48px; min-width: 0; }
    .mobile-nav__pill { height: 48px; min-height: 48px; border-radius: 10px; padding: 4px 2px; gap: 2px; }
    .mobile-nav__icon { width: 22px; height: 22px; }
    .mobile-nav__label { font-size: 10px; line-height: 1; }
    #tab-productivity:checked ~ .mobile-dock .mobile-nav__link[for="tab-productivity"] .mobile-nav__pill,
    #tab-reels:checked ~ .mobile-dock .mobile-nav__link[for="tab-reels"] .mobile-nav__pill,
    #tab-accounts:checked ~ .mobile-dock .mobile-nav__link[for="tab-accounts"] .mobile-nav__pill,
    #tab-publish:checked ~ .mobile-dock .mobile-nav__link[for="tab-publish"] .mobile-nav__pill,
    #tab-analytics:checked ~ .mobile-dock .mobile-nav__link[for="tab-analytics"] .mobile-nav__pill,
    #tab-downloader:checked ~ .mobile-dock .mobile-nav__link[for="tab-downloader"] .mobile-nav__pill,
    #tab-studio:checked ~ .mobile-dock .mobile-nav__link[for="tab-studio"] .mobile-nav__pill,
    #tab-team:checked ~ .mobile-dock .mobile-nav__link[for="tab-team"] .mobile-nav__pill,
    #tab-bot:checked ~ .mobile-dock .mobile-nav__link[for="tab-bot"] .mobile-nav__pill,
    #tab-pixel:checked ~ .mobile-dock .mobile-nav__link[for="tab-pixel"] .mobile-nav__pill {
        background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 15%, var(--surface)), color-mix(in srgb, var(--accent) 7%, var(--surface)));
        color: var(--accent);
    }
    .shell-switcher { margin-top: 12px; width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
    .shell-switcher__results { max-height: calc(100dvh - 190px); }
}

@media (max-width: 560px) {
    .mobile-nav__inner { gap: 1px; }
    .mobile-nav__pill { padding-inline: 3px; }
    .mobile-nav__label { max-width: 56px; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar__link,
    .sidebar__link::before,
    .sidebar__link-icon,
    .topbar__command,
    .topbar__page,
    .mobile-nav__link,
    .mobile-nav__pill,
    .mobile-nav__icon { transition-duration: .01ms !important; animation-duration: .01ms !important; }
    .mobile-nav__pill { transform: none !important; }
}

/* ==========================================================================
   Marca da sidebar: contraste do ícone
   ==========================================================================
   Acidente de camadas. macos.css define o mark com fundo azul sólido e ícone
   branco; este arquivo vem depois e troca o fundo por um gradiente quase
   branco no tema claro — mas não redefinia a cor. Sobrava estrela branca em
   fundo branco: contraste medido de 1,04, contra o mínimo de 3:1 para
   elemento gráfico.

   A cor acompanha o tema porque o gradiente também acompanha: no claro o
   fundo é pálido e pede o azul da marca (4,36); no escuro é azul-marinho e o
   branco rende muito mais (14,14 contra 3,84 do azul).
   ========================================================================== */
.sidebar__brand .brand-mark,
.sidebar__brand .brand-mark svg,
.sidebar__brand .brand-mark__logo { color: var(--accent); }

[data-theme="dark"] .sidebar__brand .brand-mark,
[data-theme="dark"] .sidebar__brand .brand-mark svg,
[data-theme="dark"] .sidebar__brand .brand-mark__logo { color: #fff; }

[data-theme="light"] .sidebar__brand .brand-mark {
    background: #111;
    border-color: var(--line);
    color: #fff;
}
[data-theme="light"] .sidebar__brand .brand-mark svg,
[data-theme="light"] .sidebar__brand .brand-mark__logo { color: #fff; }

