/* Shared appearance tokens. Media stays in its original colors. */
:root {
  color-scheme: light;
  --canvas: #f5f6fa; --surface: #ffffff; --surface-soft: #f8f9fc; --surface-raised: #eef1f8;
  --ink: #202a40; --muted: #65718a; --line: #e0e5ee; --input-line: #bcc5d5;
  --green: #5465df; --green-light: #edf0ff; --accent-text: #485ac2;
  --focus: #6374e7; --success: #24775e; --success-bg: #eaf6f0;
  --warning: #8b5e18; --warning-bg: #fff5df; --error: #b34337; --error-bg: #fff0eb;
  --shadow: 0 8px 28px #1e2c4b08;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #101521; --surface: #181f2e; --surface-soft: #1c2535; --surface-raised: #242f43;
  --ink: #e9eef8; --muted: #a4b0c7; --line: #303c52; --input-line: #53627c;
  --green: #6573e6; --green-light: #293354; --accent-text: #b5beff;
  --focus: #a2adff; --success: #88d9b8; --success-bg: #19392f;
  --warning: #f0c781; --warning-bg: #3c3020; --error: #ffafa2; --error-bg: #412929;
  --shadow: 0 8px 28px #00000020;
}
body, .auth-page { background: var(--canvas); color: var(--ink); }
::selection { background: var(--green-light); color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline-color: var(--focus); }
* { scrollbar-width: thin; scrollbar-color: var(--input-line) transparent; }
input, select, textarea, input[type=datetime-local], .search-form input, .library-filters input, .premium-composer .write-panel textarea {
  background: var(--surface); color: var(--ink); border-color: var(--input-line);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=checkbox], input[type=radio] { accent-color: var(--green); }
.sidebar, .auth-card, .panel, .content-panel, .stat-card, .channel-card, .connection-summary,
.media-card, .draft-card, .pricing-card, .content-card, .sticky-actions, .attachment-controls,
.media-choice, .icon-button, dialog { background: var(--surface); color: var(--ink); border-color: var(--line); }
dialog { box-shadow: 0 24px 90px #0005; }
dialog::backdrop { background: #080e20a6; backdrop-filter: blur(3px); }
.brand, .topbar strong, .content-card h2, .media-empty strong { color: var(--ink); }
.brand-mark { background: #263654; color: white; }
.workspace-switch, .workspace-link.active, .studio-table th, .usage-mini, .weekday, .calendar-cell.outside,
.date-tile, .segmented, .connection-platform, .library-empty, .media-empty, .upload-panel {
  background: var(--surface-soft); border-color: var(--line);
}
.product-nav a, .topbar, .topbar strong, .section-tabs a { color: var(--muted); }
.product-nav a:hover, .workspace-link:hover, .add-workspace:hover, .studio-table tbody tr:hover,
.attachment-controls button:hover { background: var(--surface-soft); color: var(--ink); }
.product-nav a[aria-current], .filter-tabs a[aria-current], .workspace-initial, .tag-picker #id_tags label:has(input:checked) {
  background: var(--green-light); color: var(--accent-text); border-color: var(--green);
}
.filter-tabs a span, .heading-count, .library-tabs a span, .step-number { background: var(--surface-raised); color: var(--muted); }
.button { background: #5465df; border-color: #5465df; color: #fff; }
.button:hover { background: #4354c6; border-color: #4354c6; }
.button.secondary, .topbar .topbar-label, .segmented a[aria-current] { background: var(--surface); color: var(--ink); border-color: var(--line); }
.button.secondary:hover { background: var(--surface-raised); border-color: var(--input-line); }
.button.danger { background: #a33a32; border-color: #a33a32; color: #fff; }
.text-button, .field-note, .eyebrow, .nav-section, .editor-meta, .preview-title, .preview-caption,
.timezone-label, .library-results, .card-kicker, .untagged, .content-card-body p, .studio-table small,
.studio-table th, .filter-tabs a, .library-tabs a, .app-footer, .preview-account small,
.preview-engagement, .preview-dots, .plan-current p, .pricing-card ul, .usage-stats strong,
.calendar-post small, .calendar-post strong, .calendar-cell.outside, .media-choice>span,
.attachment-controls button, .library-empty p, .media-empty, .empty-state p { color: var(--muted); }
.subtle-link, .section-heading a, .media-card-actions, .upload-panel summary, .usage-mini a,
.preview-more, .day-create, .auth-footer a, .library-tabs a[aria-current] { color: var(--accent-text); }
.premium-composer .panel, .asset-editor, .schedule-field, .editor-meta, .tag-picker #id_tags label,
.studio-table td, .card-bottom, .activity-row, .team-member, .discussion-entry, .readiness-card,
.dialog-footer, .template-form .tag-picker, .content-card-actions, .attachment-card, .media-choice,
.bulk-form #id_posts, .calendar-cell, .library-toolbar { border-color: var(--line); }
.premium-preview, .preview-column { background: var(--surface-soft); border-color: var(--line); }
.facebook-preview { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.preview-body, .preview-account strong { color: var(--ink); }
.preview-engagement { border-color: var(--line); }
.preview-toggle { background: var(--surface-raised); }
.preview-toggle button { color: var(--muted); }
.preview-toggle button.is-active { background: var(--surface); color: var(--ink); }
.attachment-number, .media-choice b, .cover-format { background: var(--surface); color: var(--ink); border-color: var(--line); }
.media-choice[aria-pressed=true] { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.media-choice[aria-pressed=true] b { background: #5465df; color: #fff; border-color: #5465df; }
.attachment-card { background: var(--surface-soft); }
.page-avatar { background: var(--surface-raised); color: var(--ink); }
.page-avatar .fb-dot { border-color: var(--surface); }
.badge { background: var(--surface-raised); color: var(--muted); }
.status-published, .review-approved, .messages p { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.status-scheduled, .status-publishing { background: var(--green-light); color: var(--accent-text); }
.status-failed, .status-unknown, .review-changes_requested { background: var(--error-bg); color: var(--error); }
.status-processing, .badge-warning, .review-in_review, .notice { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.danger, .delete-link, .errorlist, .selection-error, .publish-error, .autosave-field-error,
.save-indicator [data-save-status][data-error=true] { color: var(--error); }
.readiness-card p { color: var(--muted); }
.readiness-card p.is-ready, .readiness-card p.is-ready:before { color: var(--success); }
.empty-state { background: radial-gradient(ellipse at 50% 32%,var(--green-light),var(--surface) 65%); }
.empty-symbol, .empty-library-icon, .empty-illustration, .empty-icon { background: var(--green-light); color: var(--accent-text); border-color: var(--line); box-shadow: none; }
.illustration-line { background: var(--input-line); }
.empty-illustration>span { border-color: var(--surface); }
.plan-current { background: linear-gradient(120deg,var(--surface),var(--green-light)); border-color: var(--line); }
.featured-plan { border-color: var(--green); }
.tag-indigo { color:#495ba7; }
.tag-mint { color:#286c50; }
.tag-amber { color:#805919; }
.tag-rose { color:#98415f; }
.tag-blue { color:#365f99; }
.tag-slate { color:#546078; }
.calendar-cell { background: var(--surface); }
.calendar-post { background: var(--green-light); border-color: var(--line); border-left-color: var(--green); }
.calendar-published { background: var(--success-bg); border-left-color: var(--success); }
.calendar-failed, .calendar-unknown { background: var(--error-bg); border-left-color: var(--error); }
.calendar-cell.drop-target, .day-create:hover { background: var(--green-light); color: var(--accent-text); }
progress, progress::-webkit-progress-bar { background: var(--surface-raised); }
progress::-webkit-progress-value { background: var(--green); }
html[data-theme=dark] .stat-icon, html[data-theme=dark] .post-type { background: #302b49; color: #d2bbff; border-color: var(--line); }
html[data-theme=dark] .stat-icon.mint, html[data-theme=dark] .activity-icon { background: var(--success-bg); color: var(--success); }
html[data-theme=dark] .stat-icon.blue, html[data-theme=dark] .facebook-icon { background: #213451; color: #8db8ff; }
html[data-theme=dark] .peach { background: var(--warning-bg); color: var(--warning); }
html[data-theme=dark] .content-card .text-cover { background: linear-gradient(135deg,#2d2d4e,#233349); }
html[data-theme=dark] .content-card:nth-child(3n+2) .text-cover { background: linear-gradient(135deg,#203b36,#253648); }
html[data-theme=dark] .content-card:nth-child(3n) .text-cover { background: linear-gradient(135deg,#3e342a,#303046); }
html[data-theme=dark] .text-cover-mark { color: #c0c6e9; }
html[data-theme=dark] .text-cover-caption { color: #b7bfd4; }
html[data-theme=dark] .tag-indigo, html[data-theme=dark] .tag-blue { background: #293858; color: #bbcbff; }
html[data-theme=dark] .tag-mint { background: var(--success-bg); color: var(--success); }
html[data-theme=dark] .tag-amber { background: var(--warning-bg); color: var(--warning); }
html[data-theme=dark] .tag-rose { background: #402c40; color: #efb5d2; }
html[data-theme=dark] .tag-slate { background: var(--surface-raised); color: var(--muted); }

/* A quieter shell, readable secondary text, and predictable actions. */
.sidebar { padding-top: 24px; gap: 0; scrollbar-gutter: stable; }
.sidebar>* { flex-shrink: 0; }
.sidebar .workspace-switch { margin-top: 24px; margin-bottom: 16px; }
.sidebar .nav-section { margin-top: 20px; }
.sidebar .product-nav a { padding: 9px 12px; min-height: 38px; }
.sidebar .workspace-nav { overflow: visible; }
.sidebar-preferences { margin: auto 4px 0; padding-top: 20px; }
.theme-control { display:flex; align-items:center; gap:12px; width:100%; }
.theme-control label { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; white-space:nowrap; }
.theme-control label span { font-size:18px; }
.theme-control select { width:auto; flex:1; min-width:0; padding:7px 8px; font-size:12px; background:var(--surface-soft); border-color:var(--line); }
.topbar .theme-control { width:160px; }
.topbar .theme-control label span { margin:0; color:var(--muted); }
.sidebar-bottom { margin-top:16px; padding-top:16px; }
.account-name { font-size:11px; }
.auth-appearance { max-width:210px; margin:0 0 26px auto; }
.mobile-bar, .menu-close, .nav-backdrop { display:none; }
.field-note, .page-subtitle, .library-results, .content-card-body p { font-size:12px; }
.section-heading a, .subtle-link { font-size:12px; }
.topbar { height:68px; margin-bottom:28px; }
.premium-composer .write-panel textarea { min-height:150px; height:220px; }
.asset-editor .media-empty { min-height:128px; padding:18px; }
.legal-card { background:var(--surface); border-color:var(--line); }
.legal-main p, .legal-main li { color:var(--muted); }
.publish-error { background:var(--error-bg); }
.save-indicator { padding:6px 0; }
.save-indicator:has([data-state=dirty]) .save-light { background:var(--warning); box-shadow:0 0 0 4px color-mix(in srgb,var(--warning) 12%,transparent); }
.save-indicator:has([data-state=saving]) .save-light { background:var(--green); animation:save-pulse 1s ease-in-out infinite; }
.save-indicator:has([data-state=error]) .save-light { background:var(--error); }
.save-indicator:has([data-state=idle]) .save-light { background:var(--muted); box-shadow:none; }
@keyframes save-pulse { 50% { opacity:.35; } }
.attachment-caption { display:block; font-size:11px; line-height:1.4; padding:7px 8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--ink); background:var(--surface); }
.attachment-controls button { min-height:30px; }
.content-card { transition:border-color .15s,box-shadow .15s; }
.content-card:hover { border-color:var(--input-line); box-shadow:var(--shadow); }
.library-filters { align-items:center; }
.library-filters select { cursor:pointer; }
.library-tabs a { min-height:44px; display:inline-flex; align-items:center; }
.mobile-preview-toggle { display:none; }
.skip-link:focus { background:var(--surface); color:var(--ink); z-index:100; }
@media(max-width:1100px) {
  .panel-toolbar { flex-wrap:wrap; }
  .filter-tabs { overflow:auto; max-width:100%; }
}
@media(max-width:700px) {
  .nav-ready .mobile-bar { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:14px 18px; background:var(--surface); border-bottom:1px solid var(--line); }
  .mobile-bar .brand { font-size:22px; }
  .nav-ready .sidebar { display:none; }
  .nav-ready.menu-open { overflow:hidden; }
  .nav-ready.menu-open .sidebar { display:flex; position:fixed; inset:0 auto 0 0; width:min(320px,90vw); height:100dvh; padding:25px 20px; z-index:51; border-right:1px solid var(--line); overflow-y:auto; overscroll-behavior:contain; }
  .nav-ready.menu-open .nav-backdrop { display:block; position:fixed; inset:0; width:100%; height:100%; background:#050b1eb3; border:0; border-radius:0; z-index:50; }
  .nav-ready .sidebar .menu-close { display:grid; position:absolute; right:12px; top:17px; width:36px; height:36px; }
  .nav-ready .sidebar>.brand { margin:0 28px 0 0; font-size:22px; }
  .nav-ready .sidebar .product-nav { display:grid; overflow:visible; white-space:normal; }
  .nav-ready .sidebar .product-nav a { min-height:44px; font-size:13px; padding:11px 12px; }
  .nav-ready .sidebar .workspace-switch, .nav-ready .sidebar .compose-button, .nav-ready .sidebar .nav-section, .nav-ready .sidebar .workspace-nav, .nav-ready .sidebar .sidebar-bottom { display:flex; }
  .nav-ready .sidebar .workspace-nav { flex-direction:column; }
  .nav-ready .sidebar .workspace-switch { margin-top:26px; }
  .nav-ready .sidebar .nav-section { margin-bottom:8px; }
  .nav-ready .sidebar .sidebar-bottom { padding-top:16px; border-top:1px solid var(--line); }
  .nav-ready .sidebar .account-name { max-width:175px; }
  .theme-control select { min-height:44px; font-size:14px; }
  .main { margin:0; padding:0 18px 24px; }
  .topbar { height:52px; margin-bottom:22px; }
  .topbar>div:first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .topbar-right { flex-shrink:0; }
  .topbar .theme-control { width:110px; gap:6px; }
  .topbar .theme-control label { font-size:0; }
  .topbar .topbar-label { display:none; }
  input, select, textarea, .search-form input, .premium-composer .write-panel textarea { font-size:16px; }
  .button, .button.small, .page-header .button, .composer-actions .button { min-height:44px; font-size:12px; }
  .text-button { min-height:36px; }
  .premium-composer .panel { padding:18px; }
  .premium-composer .write-panel textarea { min-height:150px; height:200px; }
  .premium-composer .section-heading { gap:8px; }
  .section-heading a { font-size:11px; }
  .attachment-controls button { min-height:40px; font-size:17px; }
  .js-preview .mobile-preview-toggle { display:inline-flex; margin:0 0 16px; }
  .js-preview .premium-composer { display:flex; flex-direction:column; }
  .js-preview .premium-composer>.compose-main { width:100%; }
  .js-preview .premium-composer>.premium-preview { display:none; order:-1; width:100%; }
  .js-preview .premium-composer.preview-open>.premium-preview { display:block; }
  .sticky-actions { position:sticky; bottom:8px; z-index:4; padding:10px; gap:6px; box-shadow:0 5px 24px #0002; }
  .sticky-actions>div { width:auto; margin-left:auto; }
  .sticky-actions .text-button { font-size:11px; }
  .sticky-actions .button { padding:9px 10px; }
  .tag-picker #id_tags label { min-height:40px; }
  .tag-picker input[type=checkbox] { width:16px; height:16px; }
  .four-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .library-filters .button { min-width:0; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }
