/* =========================================================================
   Social Agent – design system (plum, cream, chocolate, warm brown; gradients on hover only)
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Text on dark or coloured surfaces (sidebar, primary buttons, active tabs). Never flips with the theme:
     --white is a surface colour and turns dark in dark mode. */
  --on-accent: #ffffff;
  color-scheme: light;

  /* Typography */
  /* Headings and UI chrome: IBM Plex Sans (enterprise dashboards). Body copy: Inter. */
  --font-sans: 'IBM Plex Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font: var(--font-sans);
  --font-serif: var(--font-sans);

  /* Modern Gradient Palette */
  --primary-from: #5D0B42;
  --primary-to: #5D0B42;  /* same colour: --primary-gradient renders solid */
  --primary-gradient: linear-gradient(135deg, var(--primary-from) 0%, var(--primary-to) 100%);
  --primary-hover: linear-gradient(135deg, #5D0B42 0%, #4a1530 55%, #3B1F13 100%);  /* hover only */
  --primary-glow: rgba(93, 11, 66, 0.35);
  --primary-glow-sm: rgba(93, 11, 66, 0.18);
  --primary-tint: rgba(93, 11, 66, 0.08);

  /* Brand Accents */
  --navy: #0a0a0b;
  --navy-2: #141416;
  --sea: #8a6650;
  --sea-dark: #6b4b3a;
  --sky: #e6d3c3;
  --sky-soft: #f3e9e1;
  --white: #ffffff;

  /* Backgrounds & Canvas */
  --paper: #E6D3C3;
  --surface: #ffffff;
  --surface-2: #f7efe8;
  --surface-3: #f1e6dc;
  --surface-glass: rgba(255, 255, 255, 0.85);
  --sidebar-bg: #0a0a0b;
  --sidebar-surface: rgba(255, 255, 255, 0.04);
  --sidebar-hover: rgba(255, 255, 255, 0.08);

  /* Lines & Borders */
  --line: #dcc8b6;
  --line-subtle: rgba(220, 200, 182, 0.7);
  --line-strong: #d2bba7;
  --border-glass: rgba(255, 255, 255, 0.12);

  /* Modern Slate Typography */
  --text: #3B1F13;
  --text-2: #4a2f22;
  --muted: #7d5f4f;

  /* Vibrant Functional States */
  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --ok-border: #a7f3d0;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --err: #c0392b;
  --err-soft: #fef2f2;
  --err-border: #fecaca;

  /* Corner Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 9999px;

  /* Layered Ambient Shadows */
  --sh-sm: 0 1px 2px 0 rgba(10, 10, 11, 0.05);
  --sh-1: 0 1px 3px 0 rgba(10, 10, 11, 0.06), 0 4px 12px -2px rgba(10, 10, 11, 0.03);
  --sh-2: 0 10px 25px -4px rgba(10, 10, 11, 0.08), 0 6px 12px -3px rgba(10, 10, 11, 0.04);
  --sh-hover: 0 14px 34px -4px rgba(10, 10, 11, 0.12), 0 8px 16px -4px rgba(93, 11, 66, 0.08);
  --sh-modal: 0 25px 60px -12px rgba(10, 10, 11, 0.28), 0 0 0 1px rgba(10, 10, 11, 0.06);

  --sidebar-w: 240px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =========================================================================
   Dark Theme System
   ========================================================================= */
[data-theme="dark"] {
  color-scheme: dark;

  /* brown reads warmer on black */
  --sea: #B88F78;
  --sea-dark: #cbab96;
  --sky: rgba(184, 143, 120, 0.35);
  --sky-soft: rgba(184, 143, 120, 0.12);

  --navy: #f7efe8;
  --navy-2: #f1e6dc;
  --white: #141416;

  /* Canvas & Surfaces: true black canvas, neutral charcoal cards */
  --paper: #0a0a0b;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #232327;
  --surface-glass: rgba(20, 20, 22, 0.85);

  --sidebar-bg: #050506;
  --sidebar-surface: rgba(255, 255, 255, 0.05);
  --sidebar-hover: rgba(255, 255, 255, 0.09);

  /* Lines & Borders */
  --line: rgba(255, 255, 255, 0.09);
  --line-subtle: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(255, 255, 255, 0.18);
  --border-glass: rgba(255, 255, 255, 0.14);

  /* Typography */
  --text: #f4f1f3;
  --text-2: #cfc6cc;
  --muted: #9a8f96;

  /* Functional States */
  --ok-soft: rgba(16, 185, 129, 0.14);
  --ok-border: rgba(16, 185, 129, 0.35);
  --warn-soft: rgba(245, 158, 11, 0.14);
  --warn-border: rgba(245, 158, 11, 0.35);
  --err-soft: rgba(239, 68, 68, 0.14);
  --err-border: rgba(239, 68, 68, 0.35);

  /* Shadows */
  --sh-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --sh-1: 0 4px 16px rgba(0, 0, 0, 0.5);
  --sh-2: 0 12px 36px rgba(0, 0, 0, 0.7);
  --sh-hover: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(93, 11, 66, 0.35);
  --sh-modal: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] body {
  background: var(--paper);
  background-image: none; /* one plain colour, no tinted glow */
}

/* =========================================================================
   Page sky (app pages only, not the login screen)
   Dark: a night sky with small stars, some twinkling.
   Light: a daytime sky with slow drifting clouds.
   ========================================================================= */
@keyframes twinkle {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
@keyframes clouds-drift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 1400px 0, -1100px 0, 900px 0; }
}

body:not(.auth-body)::before,
body:not(.auth-body)::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* Light: a soft morning sky - pale blue at the very top, then beige/cream for most of the page */
body:not(.auth-body) {
  background: linear-gradient(180deg, #dbe8f0 0%, #e7ebec 22%, #ebe2d8 50%, #E6D3C3 100%) fixed;
}
body:not(.auth-body)::before {
  display: block;
  background-repeat: repeat-x;
  background-image:
    radial-gradient(ellipse 160px 46px at 220px 90px, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(ellipse 220px 60px at 760px 150px, rgba(255, 255, 255, 0.4), transparent 70%),
    radial-gradient(ellipse 130px 38px at 1180px 70px, rgba(255, 255, 255, 0.5), transparent 70%);
  background-size: 1400px 260px, 1100px 300px, 900px 220px;
  animation: clouds-drift 160s linear infinite;
}
body:not(.auth-body)::after {
  display: block;
  background: radial-gradient(circle 240px at 92% 4%, rgba(255, 240, 200, 0.4), rgba(255, 240, 200, 0.1) 45%, transparent 70%);
}
@media (prefers-reduced-motion: reduce) {
  body:not(.auth-body)::before { animation: none; }
}

/* Dark: night sky on black */
[data-theme="dark"] body:not(.auth-body) {
  background: #0a0a0b;
}
[data-theme="dark"] body:not(.auth-body)::before {
  display: block;
  animation: none;
  background-repeat: repeat;
  background-image:
    radial-gradient(1px 1px at 24px 36px, rgba(255, 255, 255, 0.85), transparent 70%),
    radial-gradient(1px 1px at 132px 92px, rgba(255, 255, 255, 0.6), transparent 70%),
    radial-gradient(1.6px 1.6px at 214px 168px, rgba(255, 255, 255, 0.95), transparent 70%),
    radial-gradient(1px 1px at 296px 44px, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(1px 1px at 352px 238px, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(1.3px 1.3px at 86px 274px, rgba(255, 236, 190, 0.8), transparent 70%),
    radial-gradient(1px 1px at 168px 330px, rgba(255, 255, 255, 0.5), transparent 70%),
    radial-gradient(1px 1px at 250px 110px, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(1.2px 1.2px at 40px 190px, rgba(255, 255, 255, 0.8), transparent 70%),
    radial-gradient(1px 1px at 110px 20px, rgba(255, 255, 255, 0.55), transparent 70%),
    radial-gradient(1px 1px at 280px 250px, rgba(255, 245, 220, 0.7), transparent 70%);
  background-size: 300px 280px;
}
[data-theme="dark"] body:not(.auth-body)::after {
  display: block;
  background-repeat: repeat;
  background-image:
    radial-gradient(1.8px 1.8px at 70px 120px, #ffffff, transparent 70%),
    radial-gradient(1.4px 1.4px at 410px 60px, rgba(255, 240, 205, 0.95), transparent 70%),
    radial-gradient(1.6px 1.6px at 300px 400px, #ffffff, transparent 70%),
    radial-gradient(1.2px 1.2px at 520px 300px, rgba(255, 255, 255, 0.9), transparent 70%);
  background-size: 640px 520px;
  animation: twinkle 4.5s ease-in-out infinite;
}

[data-theme="dark"] h1 {
  color: var(--text);
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
}

[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select,
[data-theme="dark"] .input,
[data-theme="dark"] .select,
[data-theme="dark"] .toolbar__input,
[data-theme="dark"] .toolbar__select,
[data-theme="dark"] .composer__title {
  background: #111113;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f7efe8;
}

[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field textarea:focus,
[data-theme="dark"] .field select:focus,
[data-theme="dark"] .composer__title:focus {
  background: #141416;
  border-color: var(--primary-from);
  box-shadow: 0 0 0 3.5px var(--primary-glow);
}

[data-theme="dark"] .btn {
  background: #232327;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f7efe8;
}

[data-theme="dark"] .btn:hover {
  background: #273549;
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

[data-theme="dark"] .btn--primary {
  background: var(--primary-gradient);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .btn--primary:hover {
  background: var(--primary-hover);
}

[data-theme="dark"] .btn--ghost {
  background: transparent;
  color: #d2bba7;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .card,
[data-theme="dark"] .composer,
[data-theme="dark"] .account,
[data-theme="dark"] .post,
[data-theme="dark"] .product,
[data-theme="dark"] .comment,
[data-theme="dark"] .kpis,
[data-theme="dark"] .top-post,
[data-theme="dark"] .profile__hero,
[data-theme="dark"] .profile__block,
[data-theme="dark"] .bot-row,
[data-theme="dark"] .channel-hl-card,
[data-theme="dark"] .topbar {
  background: var(--surface);
  border-color: var(--line);
}

[data-theme="dark"] .toolbar--sticky {
  background: rgba(10, 10, 11, 0.85);
  border-bottom-color: var(--line);
}

[data-theme="dark"] .dialog {
  background: #141416;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f4f1f3;
}

[data-theme="dark"] .dialog--preview {
  background: #111113;
}

[data-theme="dark"] .pv {
  background: #1b1b1e;
  color: #f7efe8;
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .pv__sub,
[data-theme="dark"] .pv__dots,
[data-theme="dark"] .pv__fbbar {
  color: #B88F78;
  border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .product__overlay {
  background: rgba(10, 10, 11, 0.95);
  border-top-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .pill-select {
  background: #111113;
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .pill-select select {
  color: #f7efe8;
}

[data-theme="dark"] .pl__card {
  background: #141416;
  border-color: var(--line);
}

[data-theme="dark"] .pl__dot {
  background: #141416;
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .auth__form-wrap,
[data-theme="dark"] .auth-body {
  background: #0a0a0b;
}

[data-theme="dark"] .auth__card {
  background: #141416;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .prompt-chip {
  background: #232327;
  border-color: rgba(255, 255, 255, 0.1);
  color: #d2bba7;
}

[data-theme="dark"] .prompt-chip:hover {
  background: rgba(93, 11, 66, 0.2);
  color: #e6d3c3;
}

[data-theme="dark"] .toolbar__tabs {
  background: #141416;
  border-color: var(--line);
}

[data-theme="dark"] .tab-pill:hover {
  background: #232327;
  color: #ffffff;
}

[data-theme="dark"] .empty {
  background: #111113;
  border-color: rgba(255, 255, 255, 0.12);
}

/* =========================================================================
   Top Bar Navigation Component & Theme Switcher
   ========================================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding: 12px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  transition: all 0.25s var(--ease);
  position: relative;
  z-index: 20;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__breadcrumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
}

.topbar__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid var(--ok-border);
  padding: 3px 10px;
  border-radius: var(--r-full);
}

/* The badge mirrors the real Meta switch: green live, red stopped, grey off/unknown. */
.topbar__badge--stopped { color: var(--err); background: var(--err-soft); border-color: var(--err); }
.topbar__badge--off, .topbar__badge--loading { color: var(--muted); background: var(--surface-3, transparent); border-color: var(--line); }

.nav__link { position: relative; }
.nav__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #B88F78; /* sand: stands out on the olive sidebar */
  color: #3B1F13;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.nav__badge[hidden] { display: none; }
.sidebar-collapsed .nav__badge {
  position: absolute;
  top: 6px;
  right: 10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 16px;
}

.topbar__crumb {
  color: var(--muted);
}

.topbar__crumb--active {
  color: var(--text);
  font-weight: 700;
}

.topbar__sep {
  color: var(--line-strong);
  font-size: 14px;
}

.topbar__center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__engine-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.engine-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot 2s infinite;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* =========================================================================
   Segmented Theme Switcher Pill (Linear & Raycast Style)
   ========================================================================= */
.theme-switch-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 3px;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: all 0.25s var(--ease);
}

.theme-switch-pill:hover {
  border-color: var(--line-strong);
}

.theme-switch-btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: var(--r-full);
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.theme-switch-btn svg {
  width: 13.5px;
  height: 13.5px;
  stroke-width: 2.2;
  transition: transform 0.3s var(--ease);
}

.theme-switch-btn.is-active {
  color: var(--text);
  font-weight: 700;
}

[data-theme="dark"] .theme-switch-btn.is-active {
  color: #ffffff;
}

.theme-switch-btn:hover svg {
  transform: rotate(20deg) scale(1.1);
}

.theme-switch-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: var(--r-full);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(10, 10, 11, 0.12), 0 2px 8px rgba(10, 10, 11, 0.08);
  transition: transform 0.28s var(--ease-spring), background 0.25s ease;
  pointer-events: none;
  z-index: 1;
}

[data-theme="dark"] .theme-switch-indicator {
  background: #232327;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-switch-pill .theme-switch-indicator {
  transform: translateX(100%);
}

[data-theme="light"] .theme-switch-pill .theme-switch-indicator {
  transform: translateX(0);
}

@media (max-width: 1024px) {
  .topbar__center {
    display: none;
  }
}

.brand__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--r-xs);
  color: #B88F78;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
}

.theme-toggle:hover {
  color: var(--on-accent);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: rotate(15deg) scale(1.08);
}

/* Base Reset & Core Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  letter-spacing: -0.015em;
  font-weight: 600;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
}

h2 {
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

small {
  font-size: 13px;
}

a {
  color: var(--sea);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.18s var(--ease);
}

a:hover {
  color: var(--sea-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

::selection {
  background: var(--primary-glow-sm);
  color: var(--primary-from);
}

:focus-visible {
  outline: 2px solid var(--primary-from);
  outline-offset: 2px;
}

/* Modern Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #d2bba7 transparent;
}

*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #d2bba7;
  border-radius: var(--r-full);
}

*::-webkit-scrollbar-thumb:hover {
  background: #B88F78;
}

.muted {
  color: var(--muted);
}

.error {
  color: var(--err);
  font-size: 13.5px;
  font-weight: 500;
}

/* Keyframes */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* =========================================================================
   App Shell & Navigation
   ========================================================================= */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 20px;
  background: #3B1F13; /* dark olive, one solid colour */
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #dcc8b6;
  /* only the width moves; padding and the page content stay still while it slides */
  transition: width 0.22s ease-out, flex-basis 0.22s ease-out;
  will-change: width;
  z-index: 40;
  /* never cut off: on short screens the sidebar scrolls on its own */
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 6px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 24px;
}

.brand__logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 20px;
  color: var(--on-accent);
  background: var(--primary-gradient);
  box-shadow: 0 4px 14px rgba(93, 11, 66, 0.4);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease);
}

.brand:hover .brand__logo {
  transform: scale(1.06) rotate(-4deg);
  box-shadow: 0 6px 20px rgba(93, 11, 66, 0.55);
}

.brand__text {
  min-width: 0;
}

.brand__name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 16.5px;
  color: var(--on-accent);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand__sub {
  font-size: 12px;
  font-weight: 500;
  color: #B88F78;
  letter-spacing: -0.01em;
}

.brand--lg .brand__logo {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  font-size: 24px;
  border-radius: var(--r);
}

.brand--lg .brand__name {
  font-size: 22px;
}

.sidebar__toggle {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  color: #B88F78;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
}

.sidebar__toggle:hover {
  color: var(--on-accent);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.sidebar__toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.25s var(--ease);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7d5f4f;
  padding: 16px 10px 8px;
}

.nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  color: #d2bba7;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s var(--ease);
}

.nav__link svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  opacity: 0.75;
  transition: transform 0.2s var(--ease), opacity 0.2s ease, color 0.2s ease;
}

.nav__link:hover {
  color: var(--on-accent);
  background: var(--sidebar-hover);
  text-decoration: none;
  transform: translateX(3px);
}

.nav__link:hover svg {
  opacity: 1;
  color: #cbab96;
}

.nav__link--active {
  color: var(--on-accent);
  background: rgba(93, 11, 66, 0.55);
  border: 1px solid rgba(93, 11, 66, 0.35);
  box-shadow: 0 2px 8px rgba(93, 11, 66, 0.15);
}

.nav__link--active svg {
  color: #B88F78;
  opacity: 1;
}

.nav__link--active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3.5px;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: var(--primary-gradient);
  box-shadow: 0 0 12px var(--primary-from);
}

.sidebar__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* System Status Pill */
.sys {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  font-weight: 500;
  color: #B88F78;
  transition: all 0.2s ease;
}

.sys:hover {
  background: rgba(255, 255, 255, 0.07);
}

.sys__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7d5f4f;
  flex: 0 0 8px;
}

.sys--ok .sys__dot {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  animation: pulse-dot 2.5s infinite;
}

.sys--warn .sys__dot {
  background: var(--warn);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.sys--bad .sys__dot {
  background: var(--err);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Meta Emergency Stop Killswitch */
.meta-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s var(--ease);
}

.meta-switch__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.meta-switch__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--on-accent);
}

.meta-switch__state {
  font-size: 11.5px;
  font-weight: 500;
  color: #B88F78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-switch--live .meta-switch__state {
  color: #34d399;
}

.meta-switch--stopped {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.meta-switch--stopped .meta-switch__state {
  color: #f87171;
  font-weight: 600;
}

.meta-switch--off .meta-switch__state {
  color: #fbbf24;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: var(--r-full);
  padding: 0;
  border: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.25s var(--ease);
}

.switch[aria-checked="true"] {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.meta-switch--stopped .switch {
  background: #c0392b;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.switch:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.switch:focus-visible {
  outline: 2px solid #B88F78;
  outline-offset: 2px;
}

.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s var(--ease-spring);
}

.switch[aria-checked="true"] .switch__knob {
  transform: translateX(18px);
}

/* User Card in Sidebar */
.user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 6px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user__avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--on-accent);
  background: var(--primary-gradient);
  box-shadow: 0 2px 8px rgba(93, 11, 66, 0.3);
}

.user__meta {
  min-width: 0;
  flex: 1;
}

.user__name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--on-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user__email {
  font-size: 12px;
  color: #B88F78;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user .icon-btn {
  color: #B88F78;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.user .icon-btn:hover {
  color: var(--on-accent);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Collapsed Sidebar Rail */
@media (min-width: 901px) {
  .sidebar-collapsed {
    --sidebar-w: 78px;
  }
  .sidebar-collapsed .sidebar {
    padding: 24px 12px 20px;
  }
  .sidebar-collapsed .brand {
    flex-direction: column;
    gap: 12px;
    padding: 2px 0 16px;
  }
  .sidebar-collapsed .brand__text,
  .sidebar-collapsed .nav__link span,
  .sidebar-collapsed .sys__text,
  .sidebar-collapsed .user__meta {
    display: none;
  }
  .sidebar-collapsed .sidebar__toggle {
    margin-left: 0;
  }
  .sidebar-collapsed .sidebar__toggle svg {
    transform: scaleX(-1);
  }
  .sidebar-collapsed .nav__label {
    padding: 12px 0 4px;
    font-size: 0;
  }
  .sidebar-collapsed .nav__label::after {
    content: "";
    display: block;
    height: 1px;
    margin: 0 8px;
    background: rgba(255, 255, 255, 0.1);
  }
  .sidebar-collapsed .nav__link {
    justify-content: center;
    padding: 12px 0;
  }
  .sidebar-collapsed .nav__link--active::before {
    left: -12px;
  }
  .sidebar-collapsed .sys {
    justify-content: center;
    padding: 9px 0;
  }
  .sidebar-collapsed .meta-switch {
    justify-content: center;
    padding: 9px 0;
  }
  .sidebar-collapsed .meta-switch__text {
    display: none;
  }
  .sidebar-collapsed .user {
    flex-direction: column;
    gap: 8px;
    padding: 12px 0 2px;
  }
}

/* Main Content Layout */
.main {
  flex: 1;
  min-width: 0;
  padding: 40px 56px 80px;
  max-width: 1400px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.page-head > div:first-child {
  max-width: 760px;
}

.page-head p {
  color: var(--muted);
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.55;
}

.page-head__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-from);
  background: var(--primary-tint);
  padding: 4px 10px;
  border-radius: var(--r-full);
  margin-bottom: 8px;
  border: 1px solid rgba(93, 11, 66, 0.2);
}

/* =========================================================================
   Cards & Surfaces
   ========================================================================= */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 26px;
  box-shadow: var(--sh-1);
  transition: all 0.25s var(--ease);
}

.card:hover {
  border-color: #d2bba7;
  box-shadow: var(--sh-hover);
}

.card + .card {
  margin-top: 22px;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.card__head p {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

.card__hint {
  color: var(--muted);
  margin-bottom: 18px;
  font-size: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 28px;
  align-items: start;
}

.layout-2__main > * + * {
  margin-top: 24px;
}

.layout-2__side {
  position: sticky;
  top: 28px;
}

/* =========================================================================
   Modern Form Controls
   ========================================================================= */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field--full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > span, .field__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.field > span small {
  font-weight: 400;
  color: var(--muted);
}

.field input, .field textarea, .field select,
.input, .select, .toolbar__input, .toolbar__select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: all 0.2s var(--ease);
  box-shadow: var(--sh-sm);
}

.field input:hover, .field textarea:hover, .field select:hover,
.toolbar__input:hover, .toolbar__select:hover {
  border-color: #B88F78;
}

.field input:focus, .field textarea:focus, .field select:focus,
.input:focus, .select:focus,
.toolbar__input:focus, .toolbar__select:focus {
  border-color: var(--primary-from);
  background: var(--white);
  box-shadow: 0 0 0 3.5px var(--primary-glow-sm);
}

.field textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.field input::placeholder, .field textarea::placeholder {
  color: #B88F78;
}

.form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form__actions--start {
  justify-content: flex-start;
  margin-top: 16px;
}

.checks {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.check input, input[type="radio"], input[type="checkbox"] {
  accent-color: var(--primary-from);
  width: 17px;
  height: 17px;
  border-radius: 4px;
  cursor: pointer;
}

/* =========================================================================
   Buttons & Interactive Elements
   ========================================================================= */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.25;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--sh-sm);
  transition: all 0.2s var(--ease);
  overflow: hidden;
}

.btn svg {
  flex: 0 0 auto;
  transition: transform 0.2s var(--ease);
}

.btn:hover {
  background: var(--surface-3);
  border-color: #B88F78;
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--sh-1);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Primary Button (Gradient + Ambient Halo) */
.btn--primary {
  color: var(--on-accent);
  background: var(--primary-gradient);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 10px var(--primary-glow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn--primary:hover {
  background: var(--primary-hover);
  color: var(--on-accent);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 20px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1.5px);
}

.btn--primary:active:not(:disabled) {
  background: #4a0935;
  box-shadow: 0 2px 6px var(--primary-glow-sm);
}

/* Ghost Button */
.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--line);
  box-shadow: none;
}

.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: #d2bba7;
}

/* Danger Button */
.btn--danger {
  background: transparent;
  color: var(--err);
  border-color: transparent;
  box-shadow: none;
}

.btn--danger:hover {
  background: var(--err-soft);
  color: var(--err);
  border-color: var(--err-border);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: var(--r-xs);
}

.btn--lg {
  padding: 13px 24px;
  font-size: 15.5px;
  border-radius: var(--r);
  font-weight: 700;
}

.btn--block {
  width: 100%;
}

.link {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary-from);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.18s ease;
}

.link:hover {
  color: var(--primary-to);
  text-decoration: underline;
}

.link--danger {
  color: var(--err);
}

.link--danger:hover {
  color: #b91c1c;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-2);
  cursor: pointer;
  font-size: 14px;
  box-shadow: var(--sh-sm);
  transition: all 0.2s var(--ease);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease);
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-3);
  border-color: var(--line-strong);
  transform: scale(1.05);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn--sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

/* =========================================================================
   Badges, Chips & Status Pills
   ========================================================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.chip--muted {
  text-transform: none;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--line);
}

.chip--instagram {
  color: #be185d;
  background: #fdf2f8;
  border-color: #fbcfe8;
}

.chip--facebook {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.chip--status-published {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-border);
}

.chip--status-scheduled, .chip--status-approved {
  color: var(--sea-dark);
  background: var(--sky-soft);
  border-color: var(--sky);
}

.chip--status-awaiting_approval, .chip--status-publishing {
  color: #b45309;
  background: #fffbeb;
  border-color: #fde68a;
}

.chip--status-failed {
  color: var(--err);
  background: var(--err-soft);
  border-color: var(--err-border);
}

.chip--status-cancelled {
  opacity: 0.65;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.dot.err {
  background: var(--err);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.dot.pending {
  background: var(--warn);
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

/* Flash Toast Notifications */
.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: var(--r);
  margin-bottom: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-2);
  font-weight: 600;
  font-size: 14.5px;
  white-space: pre-line;
  animation: slide-down 0.28s var(--ease-spring);
}

.flash--ok {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
  border-left: 5px solid var(--ok);
}

.flash--error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
  border-left: 5px solid var(--err);
}

/* Sticky Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar--sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 0;
  margin-bottom: 18px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.toolbar__input {
  flex: 1;
  min-width: 240px;
}

.toolbar__select {
  width: auto;
  min-width: 180px;
}

/* Empty State */
.empty {
  grid-column: 1 / -1;
  list-style: none;
  text-align: center;
  padding: 56px 24px;
  border: 1.5px dashed #d2bba7;
  border-radius: var(--r-xl);
  color: var(--muted);
  background: var(--surface);
}

.empty strong {
  display: block;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
}

/* =========================================================================
   Create Page & Composer
   ========================================================================= */
.composer {
  position: relative;
  padding: 30px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.composer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

.composer__head h2 {
  font-size: 24px;
  letter-spacing: -0.02em;
}

.composer__head p {
  color: var(--muted);
  margin-top: 8px;
  max-width: 680px;
  font-size: 14.5px;
}

.composer form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.composer__title {
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--r);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  outline: none;
  transition: all 0.2s var(--ease);
  box-shadow: var(--sh-sm);
}

.composer__title::placeholder {
  color: #B88F78;
  font-weight: 400;
}

.composer__title:focus {
  border-color: var(--primary-from);
  background: var(--white);
  box-shadow: 0 0 0 4px var(--primary-glow-sm);
}

.composer__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.composer__row > * {
  min-width: 0;
}

.composer__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding-top: 8px;
}

.composer__foot .error {
  margin-right: auto;
}

.composer__hint {
  font-size: 13.5px;
  color: var(--muted);
}

.pill-select {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--sh-sm);
  transition: all 0.2s var(--ease);
  min-width: 0;
  overflow: hidden;
}

.pill-select:focus-within {
  border-color: var(--primary-from);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--primary-glow-sm);
}

.pill-select__label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.pill-select select {
  flex: 1;
  width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 4px;
  outline: none;
  cursor: pointer;
}

.image-source {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-source__options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.image-attached {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--sky-soft);
  border: 1px solid var(--sky);
  animation: pop-in 0.25s var(--ease);
}

.image-attached img {
  width: 58px;
  height: 58px;
  border-radius: var(--r-sm);
  object-fit: cover;
  box-shadow: var(--sh-sm);
}

.image-attached__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.image-attached__meta strong {
  font-size: 14px;
  color: var(--text);
}

.image-attached__meta span {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-btn {
  cursor: pointer;
}

/* =========================================================================
   Today's Plan (Daily Planner Widget)
   ========================================================================= */
.plan-card {
  border-radius: var(--r-xl);
}

.plan-card__sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.plan-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
}

.plan-progress__bar {
  flex: 1;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}

.plan-progress__bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--primary-gradient);
  transition: width 0.5s var(--ease);
}

.plan-progress__text {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.plan-list {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pl {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 12px;
}

.pl + .pl {
  margin-top: 10px;
}

.pl__rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.pl__rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -10px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--line);
}

.pl:first-child .pl__rail::before {
  top: 18px;
}

.pl:last-child .pl__rail::before {
  bottom: calc(100% - 18px);
}

.pl__dot {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  transition: all 0.25s var(--ease);
}

.pl--next .pl__dot {
  border-color: var(--primary-from);
  background: var(--primary-from);
  box-shadow: 0 0 10px var(--primary-glow);
}

.pl--done .pl__dot {
  border-color: var(--ok);
  background: var(--ok);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.pl--missed .pl__dot {
  border-style: dashed;
}

.pl__card {
  min-width: 0;
  padding: 13px 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-sm);
  transition: all 0.2s var(--ease);
}

.pl__card:hover {
  border-color: #d2bba7;
  transform: translateX(2px);
  box-shadow: var(--sh-1);
}

.pl--next .pl__card {
  border-color: rgba(93, 11, 66, 0.4);
  box-shadow: 0 2px 10px rgba(93, 11, 66, 0.1), inset 3px 0 0 var(--primary-from);
}

.pl--done .pl__card {
  background: var(--surface-2);
}

.pl--done .pl__title, .pl--done .pl__top {
  opacity: 0.65;
}

.pl--missed .pl__card {
  background: var(--surface-2);
  border-style: dashed;
}

.pl--leaving {
  opacity: 0.3;
  pointer-events: none;
  transform: translateX(10px);
  transition: all 0.25s ease;
}

.pl__top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pl__time {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pl__plat {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 5px;
}

.pl__plat svg {
  width: 13px;
  height: 13px;
}

.pl__plat--instagram {
  color: #fff;
  background: #d62976;
}

.pl__plat--facebook {
  color: #fff;
  background: #1877f2;
}

.pl__acc {
  min-width: 0;
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl__tag {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 700;
}

.pl__tag--next {
  color: var(--on-accent);
  background: var(--primary-gradient);
  box-shadow: 0 2px 6px var(--primary-glow-sm);
}

.pl__tag--missed {
  color: var(--muted);
  background: var(--surface-3);
}

.pl__title {
  margin: 7px 0 0;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pl__why {
  margin-top: 7px;
  font-size: 13px;
}

.pl__why summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  color: var(--text-2);
  user-select: none;
}

.pl__why summary::-webkit-details-marker {
  display: none;
}

.pl__why-more {
  color: var(--primary-from);
  font-weight: 500;
}

.pl__why summary:hover .pl__why-more {
  text-decoration: underline;
}

.pl__why[open] .pl__why-more {
  display: none;
}

.pl__why p {
  margin: 6px 0 0;
  line-height: 1.5;
  color: var(--text-2);
}

.pl__why p.muted {
  color: var(--muted);
}

.pl__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pl__actions .plan-draft {
  flex: 1;
}

.pl--done .pl__actions {
  justify-content: space-between;
}

.pl__done-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ok);
}

.pl__done-label svg {
  width: 16px;
  height: 16px;
}

.basis-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  cursor: help;
}

.basis-dot.basis--data {
  background: var(--ok);
}

.basis-dot.basis--history {
  background: #c0392b;
}

.basis-dot.basis--estimate {
  background: #f59e0b;
}

/* =========================================================================
   Accounts Page
   ========================================================================= */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.account {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  transition: all 0.25s var(--ease);
}

.account:hover {
  border-color: #d2bba7;
  box-shadow: var(--sh-hover);
  transform: translateY(-3px);
}

.account--paused {
  background: var(--surface-2);
}

.account--paused .account__top {
  opacity: 0.65;
}

.account--warn {
  border-color: var(--err-border);
  box-shadow: inset 4px 0 0 var(--err), var(--sh-1);
}

.account__top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.account__avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: var(--r-full);
  object-fit: cover;
  background: var(--surface-3);
  border: 2px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.account__body {
  min-width: 0;
  flex: 1;
}

.account__name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account__badges {
  display: flex;
  gap: 6px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.account__meta {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.5;
}

.account__fields {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
}

.account__health {
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--err-soft);
  border: 1px solid var(--err-border);
  color: var(--err);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account__actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.account__actions .account__remove {
  margin-left: auto;
}

/* =========================================================================
   Posts List & Rows
   ========================================================================= */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post {
  position: relative;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  transition: all 0.25s var(--ease);
}

.post:hover {
  border-color: #d2bba7;
  box-shadow: var(--sh-hover);
  transform: translateY(-2px);
}

.post--published {
  border-left: 4px solid var(--ok);
}

.post--scheduled, .post--approved {
  border-left: 4px solid var(--primary-from);
}

.post--awaiting_approval, .post--publishing {
  border-left: 4px solid var(--warn);
}

.post--failed {
  border-left: 4px solid var(--err);
}

.post__thumb img {
  width: 96px;
  height: 96px;
  border-radius: var(--r);
  object-fit: cover;
  background: var(--surface-3);
  display: block;
  box-shadow: var(--sh-sm);
  transition: transform 0.3s var(--ease);
}

.post:hover .post__thumb img {
  transform: scale(1.03);
}

.post__body {
  min-width: 0;
}

.post__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.post__account {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}

.post__caption {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

.post__meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.post__error {
  margin-top: 6px;
  font-size: 13px;
}

.post__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 120px;
}

.post__story {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}

.post__story-text {
  font-size: 13px;
  color: var(--muted);
}

/* =========================================================================
   Products Grid
   ========================================================================= */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  transition: all 0.25s var(--ease);
}

.product:hover {
  border-color: #d2bba7;
  box-shadow: var(--sh-hover);
  transform: translateY(-4px);
}

.product__thumb {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.product__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}

.product:hover .product__thumb img {
  transform: scale(1.05);
}

.product__placeholder {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.product__overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(220, 200, 182, 0.8);
  opacity: 0;
  transform: translateY(100%);
  transition: all 0.25s var(--ease);
}

.product:hover .product__overlay,
.product:focus-within .product__overlay {
  opacity: 1;
  transform: translateY(0);
}

.product__body {
  padding: 16px 18px 18px;
}

.product__name {
  font-weight: 700;
  font-size: 15.5px;
  color: var(--text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.product__price strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
}

.product__price s {
  color: var(--muted);
  margin-right: 6px;
  font-size: 13px;
}

.product__meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================================
   Inbox & Comments
   ========================================================================= */
.bot-settings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.bot-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--sh-sm);
}

.bot-row__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bot-row__controls select {
  width: auto;
  min-width: 120px;
}

/* Page logo with a small platform badge */
.bot-row__name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bot-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-gradient);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--line);
}
.bot-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.bot-avatar.has-img .bot-avatar__letter { visibility: hidden; }
.bot-avatar__platform {
  position: absolute;
  right: -4px;
  bottom: -3px;
  z-index: 1;
  padding: 1px 4px;
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  border: 2px solid var(--surface);
}
.bot-avatar__platform--instagram { background: #d62976; }
.bot-avatar__platform--facebook { background: #1877f2; }
.bot-row__title { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.bot-row__title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-row__title small { color: var(--muted); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toggle switch (a real checkbox underneath, so keyboard and screen readers work) */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.toggle__track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.28s var(--ease-spring);
}
.toggle input:checked + .toggle__track {
  background: var(--primary-gradient);
  box-shadow: 0 0 10px var(--primary-glow-sm);
}
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(16px); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--sea); outline-offset: 2px; }
.toggle:hover .toggle__track { filter: brightness(1.08); }

.inbox-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-tabs .is-active {
  background: var(--primary-gradient);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 2px 8px var(--primary-glow-sm);
}

.comment {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--sh-1);
  transition: all 0.2s var(--ease);
}

.comment:hover {
  border-color: #d2bba7;
  box-shadow: var(--sh-hover);
}

.comment__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.comment__when {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--muted);
}

.comment__post {
  font-size: 13.5px;
  color: var(--muted);
}

.comment__text {
  margin: 0;
  padding: 10px 14px;
  border-left: 3.5px solid var(--sea);
  background: var(--surface-3);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  overflow-wrap: anywhere;
}

.comment__reply textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  resize: vertical;
  outline: none;
  transition: all 0.2s ease;
}

.comment__reply textarea:focus {
  border-color: var(--primary-from);
  box-shadow: 0 0 0 3px var(--primary-glow-sm);
}

.comment__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* =========================================================================
   Analytics & KPIs
   ========================================================================= */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  min-width: 0;
  transition: background 0.2s ease;
}

.kpi:hover {
  background: var(--surface-2);
}

.kpi + .kpi {
  border-left: 1px solid var(--line);
}

.kpi span {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kpi strong {
  font-family: var(--font-sans);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi--accent {
  background: rgba(93, 11, 66, 0.07);
}

.kpi--accent:hover {
  background: linear-gradient(135deg, rgba(93, 11, 66, 0.12) 0%, rgba(59, 31, 19, 0.12) 100%);
}

.kpi--accent strong {
  color: var(--primary-from);
  font-size: 22px;
  padding-top: 6px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1.5px solid var(--line-strong);
}

.table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.15s ease;
}

.table tbody tr:hover td {
  background: #f7efe8;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 13px;
  background: var(--surface-3);
  color: var(--text-2);
}

.rank--1 {
  color: var(--on-accent);
  background: #B88F78;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.rank--2 {
  color: var(--on-accent);
  background: #B88F78;
}

.rank--3 {
  color: var(--on-accent);
  background: #8a5a3a;
}

.er {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}

.er span {
  min-width: 50px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.bar {
  flex: 1;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--primary-gradient);
}

.top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.top-post {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: var(--sh-1);
  transition: all 0.25s var(--ease);
}

.top-post:hover {
  border-color: var(--primary-from);
  transform: translateY(-3px);
  box-shadow: var(--sh-hover);
  text-decoration: none;
  color: var(--text);
}

.top-post__head strong {
  font-family: var(--font-sans);
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-from);
}

/* =========================================================================
   Modern Modal Dialogs
   ========================================================================= */
.dialog {
  width: min(800px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid rgba(220, 200, 182, 0.8);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-modal);
}

.dialog[open] {
  animation: pop-in 0.25s var(--ease-spring);
}

.dialog::backdrop {
  background: rgba(10, 10, 11, 0.55);
  backdrop-filter: blur(12px) saturate(180%);
}

.dialog--draft {
  width: min(1080px, calc(100vw - 32px));
}

.dialog--ai {
  width: min(860px, calc(100vw - 32px));
}

.dialog--preview {
  width: min(540px, calc(100vw - 32px));
  background: #f7efe8;
}

.dialog--preview-story {
  width: min(900px, calc(100vw - 32px));
}

.dialog__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog__head h2 {
  font-size: 22px;
}

.dialog__head p {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

/* =========================================================================
   Post Previews (Social Simulation)
   ========================================================================= */
.pv-stage {
  display: flex;
  justify-content: center;
}

.pv {
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #ffffff;
  color: #0f1419;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
}

.pv__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.pv__avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: var(--navy);
}

.pv__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pv__avatar--ring {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px #e1306c;
}

.pv__who strong {
  font-size: 14px;
  font-weight: 700;
}

.pv__media {
  background: #000;
  display: grid;
  place-items: center;
}

.pv__media img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.pv__bar {
  display: flex;
  gap: 14px;
  padding: 12px 14px 6px;
}

.pv__bar svg {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.pv__bar svg:hover {
  transform: scale(1.15);
}

.pv__caption {
  padding: 6px 14px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.pv__likes {
  padding: 0 14px;
  font-weight: 700;
  font-size: 13.5px;
}

.pv__time {
  padding: 8px 14px 14px;
  font-size: 11px;
  color: #737373;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pv-story {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: #000;
  box-shadow: var(--sh-2);
}

.pv-story__bg {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(24px) brightness(0.7);
}

.pv-story__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pv-story__top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: 12px 14px 28px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
}

.pv-story__bars span {
  display: block;
  height: 2.5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.95);
}

/* icons, dots, Facebook bar, folded text, story header, post+story pair */
.pv__icon { display: inline-grid; place-items: center; width: 24px; height: 24px; color: #0f1419; }
.pv__icon svg { width: 24px; height: 24px; }
.pv__icon--end { margin-left: auto; }
.pv__dots { margin-left: auto; letter-spacing: 1px; color: #0f1419; font-size: 12px; }
.pv--ig .pv__dots { margin-left: auto; }
.pv__who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pv__sub { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: #65676b; }
.pv__globe { display: inline-grid; place-items: center; }
.pv__globe svg { width: 12px; height: 12px; }
.pv__text { padding: 0 14px 10px; white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.pv__media--fb img { max-height: 480px; }
.pv__media--empty { padding: 36px 20px; color: #bbb; font-size: 13px; text-align: center; }
.pv__fbbar {
  display: flex;
  justify-content: space-around;
  padding: 6px 8px;
  margin: 0 12px;
  border-top: 1px solid #e4e6eb;
  color: #65676b;
  font-size: 14px;
  font-weight: 600;
}
.pv__fbbar span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.pv__fbbar span:hover { background: #f2f2f2; }
.pv__fbbar svg { width: 18px; height: 18px; }
.pv-tag { color: #00376b; }
.pv-tag--fb { color: #216fdb; }
.pv-more { border: 0; background: none; padding: 0; font: inherit; color: #737373; cursor: pointer; }
.pv-more:hover { text-decoration: underline; }
.pv__avatar--sm { width: 32px; height: 32px; flex-basis: 32px; font-size: 13px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); }
.pv-story__bars { display: flex; gap: 4px; margin-bottom: 10px; }
.pv-story__bars span { flex: 1; }
.pv-story__who { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13.5px; }
.pv-story__who strong { font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.pv-story__who span { color: rgba(255, 255, 255, 0.75); }
.pv-story__empty { position: absolute; inset: 0; display: grid; place-items: center; color: #777; font-size: 13px; }
.pv-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 20px; align-items: start; width: 100%; }
.pv-pair__col { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pv-pair__col .pv { max-width: none; }
.pv-pair__label { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.pv-note { margin: 14px 0 0; font-size: 12.5px; text-align: center; }
@media (max-width: 760px) {
  .pv-pair { grid-template-columns: 1fr; }
  .pv-pair__col:last-child { max-width: 300px; margin: 0 auto; width: 100%; }
}

.pv-checks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
  list-style: none;
  padding: 0;
}

.pv-checks li {
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--surface-3);
}

.pv-checks li.is-ok {
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid var(--ok-border);
}

.pv-checks li.is-bad {
  color: var(--err);
  background: var(--err-soft);
  border: 1px solid var(--err-border);
}

.draft__grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 26px;
}

.draft__preview {
  position: relative;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
}

.draft__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.draft__text {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.image-tile {
  border: 2px solid transparent;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-3);
  box-shadow: var(--sh-sm);
  transition: all 0.2s var(--ease);
}

.image-tile:hover {
  border-color: #d2bba7;
  transform: translateY(-2px);
  box-shadow: var(--sh-1);
}

.image-tile--primary {
  border-color: var(--primary-from);
  box-shadow: 0 0 0 2px var(--primary-glow-sm);
}

.image-tile img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.image-tile__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 8px;
  font-size: 12px;
  background: var(--white);
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3.5px solid var(--surface-3);
  border-top-color: var(--primary-from);
  animation: spin 0.8s linear infinite;
}

/* =========================================================================
   Auth Pages
   ========================================================================= */
.auth-body {
  background: var(--paper);
}

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

.auth--single {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 32px;
  background: var(--paper);
}

.auth__panel {
  display: flex;
  align-items: center;
  padding: 72px;
  background: var(--sidebar-bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(93, 11, 66, 0.22) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(59, 31, 19, 0.18) 0%, transparent 50%);
  color: #f1e6dc;
}

.auth__panel-inner {
  max-width: 520px;
}

.auth__headline {
  margin-top: 36px;
  font-family: var(--font-sans);
  font-size: 44px;
  line-height: 1.15;
  font-weight: 700;
  color: var(--on-accent);
  letter-spacing: -0.03em;
  /* the panel is always dark: undo the gradient text that page h1s get in either theme */
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
}

.auth__headline span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth__lead {
  margin-top: 20px;
  color: #B88F78;
  font-size: 17px;
  line-height: 1.6;
}

.auth__points {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #dcc8b6;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 26px;
}

.auth__points li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 15px;
}

.auth__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary-from);
  box-shadow: 0 0 10px var(--primary-from);
  flex: 0 0 7px;
  transform: translateY(-2px);
}

.auth__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #34d399;
}

.auth__chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.auth__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 600;
  color: #d2bba7;
}

.auth__form-wrap {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px 32px;
  background: var(--paper);
  min-height: 100vh;
}

.auth__top-actions {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 30;
}

.auth__card {
  width: min(420px, 100%);
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  transition: all 0.25s var(--ease);
}

.auth__card:hover {
  border-color: #d2bba7;
  box-shadow: var(--sh-hover);
}

.auth__card h2 {
  font-size: 28px;
  letter-spacing: -0.025em;
}

.auth__hint {
  color: var(--muted);
  margin: 6px 0 24px;
  font-size: 14.5px;
}

/* =========================================================================
   Responsive Design
   ========================================================================= */
@media (max-width: 1200px) {
  .layout-2 {
    grid-template-columns: 1fr;
  }
  .layout-2__side {
    position: static;
  }
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi:nth-child(4) {
    border-left: 0;
  }
  .kpi:nth-child(n+4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 900px) {
  .app {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    flex: none;
    padding: 12px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .brand {
    padding: 0 8px 0 0;
  }
  .brand__text {
    display: none;
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
  }
  .nav__label {
    display: none;
  }
  .nav__link span {
    display: none;
  }
  .nav__link--active::before {
    display: none;
  }
  .sidebar__foot {
    margin: 0;
    flex-direction: row;
  }
  .sys, .user__meta, .sidebar__toggle {
    display: none;
  }
  .meta-switch {
    padding: 6px 10px;
  }
  .meta-switch__label {
    display: none;
  }
  .user {
    padding: 0;
    border-top: 0;
  }
  .main {
    padding: 24px 20px 60px;
  }
  h1 {
    font-size: 26px;
  }
  .auth {
    grid-template-columns: 1fr;
  }
  .auth__panel {
    padding: 48px 28px;
  }
  .auth__headline {
    font-size: 32px;
  }
  .composer__row {
    grid-template-columns: 1fr;
  }
  .form--grid, .grid-2, .profile__grid, .draft__grid, .ai-result__grid {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi:nth-child(n+3) {
    border-top: 1px solid var(--line);
  }
  .kpi:nth-child(even) {
    border-left: 1px solid var(--line) !important;
  }
  .kpi--accent {
    grid-column: 1 / -1;
    border-left: 0 !important;
  }
  .post {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .post__thumb img {
    width: 76px;
    height: 76px;
  }
  .post__actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .account-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   Motion, Staggered Entry & Micro-Interactions
   ========================================================================= */

/* Smooth Staggered Item Entrance (driven by nav.js --i) */
.post, .account, .product, .top-post, .pl, .table tbody tr {
  animation: pop-in 0.35s var(--ease) backwards;
  animation-delay: calc(min(var(--i, 0), 12) * 35ms);
}
/* a list refreshed in the background (polling) must not replay the entrance */
.is-refresh .post, .is-refresh .act, .is-refresh .comment { animation: none !important; }

/* Enhanced Card & Element Lift with colored halo */
.post:hover, .account:hover, .product:hover, .top-post:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px -4px rgba(10, 10, 11, 0.1), 0 4px 14px -2px rgba(93, 11, 66, 0.08);
}

/* Button & Link Hover Animations */
.btn--primary:hover svg {
  transform: translateX(3px);
}

.upload-btn:hover svg {
  transform: translateY(-2px);
}

#ai-image-btn:hover svg {
  transform: rotate(18deg) scale(1.1);
}

/* Interactive Details Accordions */
details summary {
  transition: color 0.15s ease;
}

details[open] summary {
  color: var(--primary-from);
}

/* Dialog Backdrop Blur Animation */
.dialog[open]::backdrop {
  animation: fade 0.25s var(--ease);
}

/* =========================================================================
   Layout & Micro-Component Enhancements
   ========================================================================= */

/* Live Status Beacon */
.live-beacon {
  display: inline-block;
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot 2s infinite;
  vertical-align: middle;
}

/* Composer Badge */
.composer__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-from);
  background: var(--primary-tint);
  border: 1px solid rgba(93, 11, 66, 0.25);
  padding: 3px 10px;
  border-radius: var(--r-full);
  margin-bottom: 8px;
}

.composer__badge svg {
  color: var(--primary-from);
}

/* Prompt Suggestions Chips */
.composer__input-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 0 4px;
}

.prompt-chips__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.prompt-chip {
  background: var(--surface-3);
  border: 1px solid rgba(220, 200, 182, 0.9);
  color: var(--text-2);
  border-radius: var(--r-full);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  box-shadow: var(--sh-sm);
}

.prompt-chip:hover {
  background: var(--sky-soft);
  color: var(--primary-from);
  border-color: rgba(93, 11, 66, 0.35);
  transform: translateY(-1px);
}

.prompt-chip:active {
  transform: scale(0.96);
}

/* Toolbar Segmented Tab Pills */
.toolbar__tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  flex-wrap: wrap;
}

.tab-pill {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.tab-pill:hover {
  color: var(--text);
  background: var(--surface-3);
}

.tab-pill.is-active {
  background: var(--primary-gradient);
  color: var(--on-accent);
  box-shadow: 0 2px 8px var(--primary-glow-sm);
}

/* Channel Highlights Grid on Accounts */
.channel-highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .channel-highlights {
    grid-template-columns: 1fr;
  }
}

.channel-hl-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  transition: all 0.2s var(--ease);
}

.channel-hl-card:hover {
  border-color: #d2bba7;
  transform: translateY(-2px);
  box-shadow: var(--sh-hover);
}

.channel-hl-card__icon {
  font-size: 24px;
  flex: 0 0 auto;
}

.channel-hl-card div {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.channel-hl-card strong {
  font-size: 14px;
  color: var(--text);
}

.channel-hl-card small {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* =========================================================================
   Advanced Workspace & Studio Layout Enhancements
   ========================================================================= */

/* Page Head Live Stats Badge */
.page-head__stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip--accent {
  background: var(--primary-tint);
  border-color: rgba(93, 11, 66, 0.3);
  color: var(--primary-from);
  font-weight: 700;
}

[data-theme="dark"] .chip--accent {
  background: rgba(93, 11, 66, 0.2);
  color: #e6d3c3;
}

/* Composer Mode Switcher Pills */
.composer-modes {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.composer-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}

.composer-mode-btn:hover {
  background: var(--sky-soft);
  color: var(--primary-from);
  border-color: rgba(93, 11, 66, 0.3);
  transform: translateY(-1px);
}

.composer-mode-btn.is-active {
  background: var(--primary-gradient);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 2px 8px var(--primary-glow-sm);
}

/* Title Meta Bar with Char Counter & Pro-Tips */
.title-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px;
}

.title-char-counter strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.title-tip {
  font-size: 11.5px;
}

@media (max-width: 768px) {
  .title-meta-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Posts Summary Ribbon */
.posts-summary-ribbon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .posts-summary-ribbon {
    grid-template-columns: repeat(2, 1fr);
  }
}

.summary-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-sm);
  transition: all 0.2s var(--ease);
}

.summary-pill:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-1);
}

.summary-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}

.summary-pill--review .summary-pill__dot {
  background: var(--warn);
  box-shadow: 0 0 6px var(--warn);
}

.summary-pill--scheduled .summary-pill__dot {
  background: var(--sea);
  box-shadow: 0 0 6px var(--sea);
}

.summary-pill--published .summary-pill__dot {
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}

.summary-pill--issues .summary-pill__dot {
  background: var(--err);
  box-shadow: 0 0 6px var(--err);
}

.summary-pill__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.summary-pill__val {
  margin-left: auto;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Post Cards Enhancement */
.post__badge-platform {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.platform--ig {
  background: rgba(214, 41, 118, 0.12);
  color: #e1306c;
  border: 1px solid rgba(225, 48, 108, 0.3);
}

.platform--fb {
  background: rgba(24, 119, 242, 0.12);
  color: #1877f2;
  border: 1px solid rgba(24, 119, 242, 0.3);
}

/* Plan Card Progress & Schedule Enhancement */
.plan-card__header-meta {
  margin-top: 4px;
}

/* Dark mode theme overrides for new components */
[data-theme="dark"] .composer-mode-btn {
  background: #232327;
  border-color: rgba(255, 255, 255, 0.1);
  color: #d2bba7;
}

[data-theme="dark"] .composer-mode-btn:hover {
  background: rgba(93, 11, 66, 0.25);
  color: #ffffff;
}

[data-theme="dark"] .summary-pill {
  background: var(--surface);
  border-color: var(--line);
}

/* =========================================================================
   Motion pack: page entrance, skeletons, toasts, tab glider, ripple, theme fade
   (all switched off by prefers-reduced-motion below)
   ========================================================================= */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(28px) scale(0.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(28px) scale(0.98); }
}
@keyframes toast-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}
@keyframes badge-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Page entrance: the header first, then each block a moment later. */
.main > :not(#flash-root):not(.topbar) {
  animation: rise 0.5s var(--ease) backwards;
}
.main > :nth-child(3) { animation-delay: 0.05s; }
.main > :nth-child(4) { animation-delay: 0.1s; }
.main > :nth-child(5) { animation-delay: 0.15s; }
.main > :nth-child(6) { animation-delay: 0.2s; }
.main > :nth-child(n + 7) { animation-delay: 0.25s; }
.topbar { animation: slide-down 0.4s var(--ease) backwards; }

/* More list items join the staggered entrance. */
.comment, .plan-list > li, .bot-row {
  animation: pop-in 0.35s var(--ease) backwards;
  animation-delay: calc(min(var(--i, 0), 12) * 35ms);
}

/* Skeleton placeholders while data loads. */
.skeleton-stack { display: flex; flex-direction: column; gap: 12px; }
.skeleton {
  height: 74px;
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton--sm { height: 44px; }
.skeleton:nth-child(2) { opacity: 0.75; }
.skeleton:nth-child(3) { opacity: 0.5; }

/* Toasts: float in the top-right corner instead of pushing the page down. */
.flash {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000;
  max-width: min(420px, calc(100vw - 32px));
  margin: 0;
  padding-right: 44px;
  overflow: hidden;
  animation: toast-in 0.35s var(--ease-spring);
}
.flash.is-leaving { animation: toast-out 0.25s var(--ease) forwards; }
.flash__close {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 14px;
}
.flash__close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.flash__timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: currentColor;
  opacity: 0.35;
  transform-origin: left;
  animation: toast-timer var(--toast-ms, 4000ms) linear forwards;
}
@media (max-width: 640px) {
  .flash { left: 12px; right: 12px; top: 12px; max-width: none; }
}

/* Segmented tabs: the active highlight slides between tabs. */
.toolbar__tabs { position: relative; }
.tab-glider {
  position: absolute;
  top: 4px;
  left: 0;
  height: calc(100% - 8px);
  border-radius: var(--r-sm);
  background: var(--primary-gradient);
  box-shadow: 0 2px 8px var(--primary-glow-sm);
  transition: transform 0.32s var(--ease-spring), width 0.32s var(--ease-spring), opacity 0.2s;
  pointer-events: none;
}
.tab-pill { position: relative; overflow: hidden; }
.toolbar__tabs.has-glider .tab-pill { z-index: 1; }
.toolbar__tabs.has-glider .tab-pill.is-active { background: transparent; box-shadow: none; }
.tab-pill span[data-count] { margin-left: 4px; opacity: 0.85; }

/* Ripple on buttons (.btn already clips its overflow). */
.ripple {
  position: absolute;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.22;
  transform: scale(0);
  pointer-events: none;
  animation: ripple 0.55s var(--ease) forwards;
}

/* Badge bump when the number goes up. */
.nav__badge.is-bumped { animation: badge-pop 0.45s var(--ease-spring); }

/* Theme switch: instant. Every transition is switched off for one frame so hundreds of
   elements do not animate their colours at once (that made switching slow and jerky). */
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: none !important;
}

/* Sidebar collapse: while it slides, nothing on the page animates or re-blurs
   (every frame used to re-run dozens of transitions, backdrop blurs and shadows). */
html.sidebar-anim .main, html.sidebar-anim .main * {
  transition: none !important;
  animation: none !important;
}
html.sidebar-anim .toolbar--sticky { backdrop-filter: none !important; }
html.sidebar-anim .sidebar * { transition: none !important; }
.sidebar .brand__text, .sidebar .nav__link span, .sidebar .sys__text, .sidebar .user__meta, .sidebar .meta-switch__text {
  white-space: nowrap;
  overflow: hidden;
}

/* =========================================================================
   Purple sidebar (both themes): #5D0B42 background; what used to be purple inside it
   (active item, logo, avatar) is dark purple #3A0629 so it still stands out. Light text.
   ========================================================================= */
.sidebar {
  background: #5D0B42;
  color: #f3e6ee;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); }
.sidebar .brand__logo,
.sidebar .user__avatar {
  background: #3A0629;
  box-shadow: 0 0 0 1px rgba(184, 143, 120, 0.45), 0 4px 12px rgba(0, 0, 0, 0.25);
}
.sidebar .brand__name { color: #ffffff; }
.sidebar .brand__sub { color: #dcbfd0; }
.sidebar .nav__label { color: #c9a3bb; }
.sidebar .nav__link { color: #f0dde8; }
.sidebar .nav__link svg { opacity: 0.9; }
.sidebar .nav__link:hover {
  color: #ffffff;
  background: linear-gradient(90deg, #3A0629 0%, #4a0935 100%);
}
.sidebar .nav__link:hover svg { color: #ffffff; }
.sidebar .nav__link--active {
  color: #ffffff;
  background: #3A0629;
  border-color: rgba(184, 143, 120, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.sidebar .nav__link--active::before { background: #B88F78; box-shadow: none; }
.sidebar .nav__link--active svg { color: #B88F78; }
.sidebar .nav__badge { background: #B88F78; color: #3A0629; }
.sidebar .sidebar__toggle,
.sidebar .user .icon-btn {
  color: #f0dde8;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}
.sidebar .sidebar__toggle:hover,
.sidebar .user .icon-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
}
.sidebar .meta-switch,
.sidebar .sys {
  background: rgba(58, 6, 41, 0.55);
  border-color: rgba(255, 255, 255, 0.12);
}
.sidebar .sys:hover { background: rgba(58, 6, 41, 0.75); }
.sidebar .sys { color: #e6cfdc; }
.sidebar .meta-switch__label { color: #ffffff; }
.sidebar .meta-switch__state { color: #dcbfd0; }
.sidebar .meta-switch--live .meta-switch__state { color: #6ee7b7; }
.sidebar .meta-switch--stopped .meta-switch__state { color: #fca5a5; }
.sidebar .meta-switch--off .meta-switch__state { color: #d9bda9; }
.sidebar .switch { background: rgba(255, 255, 255, 0.25); }
.sidebar .switch[aria-checked="true"] { background: #10b981; }
.sidebar .user { border-top-color: rgba(255, 255, 255, 0.14); }
.sidebar .user__name { color: #ffffff; }
.sidebar .user__email { color: #dcbfd0; }
.sidebar-collapsed .sidebar .nav__label::after { background: rgba(255, 255, 255, 0.15); }

/* Plum text is too dark on the dark background: small labels use the wheat accent there */
[data-theme="dark"] .eyebrow { color: #B88F78; border-color: rgba(184, 143, 120, 0.35); background: rgba(184, 143, 120, 0.08); }

/* =========================================================================
   Hover gradients (the only place gradients appear: everything rests on solid colour)
   Plum #5D0B42 · Chocolate #3B1F13 · Warm brown #B88F78 · Tan #B88F78 · Cream #E6D3C3
   ========================================================================= */
.btn--primary:hover:not(:disabled),
[data-theme="dark"] .btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6a1150 0%, #5D0B42 45%, #3A0629 100%);
}
.btn--ghost:hover:not(:disabled), .btn:not(.btn--primary):not(.btn--danger):hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(93, 11, 66, 0.10) 0%, rgba(58, 6, 41, 0.18) 100%);
  border-color: rgba(93, 11, 66, 0.45);
  color: #5D0B42;
}
[data-theme="dark"] .btn--ghost:hover:not(:disabled),
[data-theme="dark"] .btn:not(.btn--primary):not(.btn--danger):hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(93, 11, 66, 0.45) 0%, rgba(58, 6, 41, 0.6) 100%);
  border-color: rgba(184, 143, 120, 0.35);
  color: #ffffff;
}
.nav__link:hover {
  background: linear-gradient(90deg, #3A0629 0%, #4a0935 100%);
}
.tab-pill:not(.is-active):hover {
  background: linear-gradient(135deg, rgba(93, 11, 66, 0.12) 0%, rgba(58, 6, 41, 0.2) 100%);
  color: #5D0B42;
}
[data-theme="dark"] .tab-pill:not(.is-active):hover { color: #ffffff; }
.post:hover, .account:hover, .product:hover, .comment:hover, .bot-row:hover, .channel-hl-card:hover, .kpi:hover {
  background-image: linear-gradient(160deg, rgba(93, 11, 66, 0.06) 0%, rgba(58, 6, 41, 0.10) 100%);
}
.toggle:hover input:checked + .toggle__track {
  background: linear-gradient(135deg, #5D0B42 0%, #3A0629 100%);
}

/* =========================================================================
   Component polish: buttons, cards, switches, sidebar controls, icons
   (plum #5D0B42 / dark plum #3A0629 only; no brown or gold on hover)
   ========================================================================= */
.btn {
  border-radius: 10px;
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.005em;
  padding: 10px 16px;
}
.btn--sm { border-radius: 8px; padding: 7px 12px; }
.btn--lg { border-radius: 12px; padding: 13px 22px; font-weight: 600; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn--primary {
  font-weight: 600;
  border: 1px solid #4a0935;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 1px 2px rgba(58, 6, 41, 0.25), 0 6px 16px -6px rgba(93, 11, 66, 0.55);
}
.btn--primary:hover:not(:disabled) {
  border-color: #3A0629;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 2px 4px rgba(58, 6, 41, 0.3), 0 10px 24px -8px rgba(93, 11, 66, 0.7);
}
.btn--primary:active:not(:disabled) { background: #3A0629; transform: translateY(0); }
.btn--ghost, .btn:not(.btn--primary):not(.btn--danger) { font-weight: 500; }
.btn:focus-visible { outline: 2px solid #5D0B42; outline-offset: 2px; }

/* Cards: quiet at rest, a plum edge lights up on hover */
.card, .auth__card, .channel-hl-card, .kpis, .post, .account, .product, .bot-row, .top-post {
  border-radius: 14px;
}
.card::after, .channel-hl-card::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; top: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, #5D0B42, #3A0629);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.channel-hl-card { position: relative; overflow: hidden; }
.card:hover, .channel-hl-card:hover, .auth__card:hover {
  border-color: rgba(93, 11, 66, 0.35);
  box-shadow: 0 14px 34px -10px rgba(58, 6, 41, 0.28), 0 0 0 1px rgba(93, 11, 66, 0.06);
}
.card:hover::after, .channel-hl-card:hover::after { opacity: 1; }
[data-theme="dark"] .card:hover, [data-theme="dark"] .channel-hl-card:hover, [data-theme="dark"] .auth__card:hover {
  border-color: rgba(184, 143, 120, 0.3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(93, 11, 66, 0.4);
}
.kpi--accent { background: rgba(93, 11, 66, 0.06); }
.kpi--accent:hover { background: linear-gradient(135deg, rgba(93, 11, 66, 0.12) 0%, rgba(58, 6, 41, 0.16) 100%); }
[data-theme="dark"] .kpi--accent { background: rgba(93, 11, 66, 0.22); }
[data-theme="dark"] .kpi--accent strong { color: #B88F78; }

/* Highlight-card icons (SVG, not emoji) */
.channel-hl-card__icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: #5D0B42;
  background: rgba(93, 11, 66, 0.08);
  border: 1px solid rgba(93, 11, 66, 0.14);
  transition: all 0.25s var(--ease);
}
.channel-hl-card__icon svg { width: 20px; height: 20px; }
.channel-hl-card:hover .channel-hl-card__icon { color: #fff; background: linear-gradient(135deg, #5D0B42, #3A0629); border-color: #3A0629; }
[data-theme="dark"] .channel-hl-card__icon { color: #B88F78; background: rgba(184, 143, 120, 0.1); border-color: rgba(184, 143, 120, 0.2); }

.account__health { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.account__health-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.account__health-text { flex: 1 1 200px; }

.top-post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.top-post__meta .stat { display: inline-flex; align-items: center; gap: 4px; }
.top-post__meta .stat svg { width: 13px; height: 13px; opacity: 0.8; }

/* Inputs: plum focus, neutral hover (no brown) */
.field input:hover, .field textarea:hover, .field select:hover,
.toolbar__input:hover, .toolbar__select:hover { border-color: rgba(93, 11, 66, 0.4); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 0.8; }
.field input, .field textarea, .field select, .input, .select, .toolbar__input, .toolbar__select { border-radius: 10px; }

/* Switches: pill tracks with a soft inset, plum when on */
.switch { width: 44px; height: 24px; background: rgba(255, 255, 255, 0.22); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch__knob { top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.05); }
.switch[aria-checked="true"] .switch__knob { transform: translateX(20px); }
.sidebar .switch[aria-checked="true"] { background: linear-gradient(135deg, #10b981, #059669); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 12px rgba(16, 185, 129, 0.35); }
.switch:focus-visible { outline-color: #ffffff; }

.toggle__track { width: 44px; height: 24px; background: var(--line-strong); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12); }
[data-theme="dark"] .toggle__track { background: rgba(255, 255, 255, 0.16); }
.toggle__thumb { top: 3px; left: 3px; width: 18px; height: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.04); }
.toggle input:checked + .toggle__track { background: linear-gradient(135deg, #5D0B42, #3A0629); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 10px rgba(93, 11, 66, 0.3); }
.toggle input:checked + .toggle__track .toggle__thumb { transform: translateX(20px); }
.toggle:hover .toggle__track { filter: none; }
.toggle:hover input:not(:checked) + .toggle__track { background: rgba(93, 11, 66, 0.3); }

/* Theme pill: the active side is a plum slide */
.theme-switch-pill { padding: 3px; background: var(--surface-3); }
.theme-switch-indicator { background: linear-gradient(135deg, #5D0B42, #3A0629); box-shadow: 0 2px 6px rgba(58, 6, 41, 0.35); }
.theme-switch-btn.is-active, [data-theme="dark"] .theme-switch-btn.is-active { color: #ffffff; }
[data-theme="dark"] .theme-switch-indicator { background: linear-gradient(135deg, #5D0B42, #3A0629); }

/* Sidebar controls: collapse and log out are round, with a plum ring on hover */
.sidebar .sidebar__toggle,
.sidebar .user .icon-btn {
  width: 32px; height: 32px;
  border-radius: 999px;
  color: #f0dde8;
  background: rgba(58, 6, 41, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.22s var(--ease);
}
.sidebar .sidebar__toggle svg, .sidebar .user .icon-btn svg { width: 15px; height: 15px; }
.sidebar .sidebar__toggle:hover {
  color: #fff;
  background: linear-gradient(135deg, #3A0629, #5D0B42);
  border-color: rgba(184, 143, 120, 0.55);
  box-shadow: 0 0 0 3px rgba(184, 143, 120, 0.18), 0 4px 12px rgba(0, 0, 0, 0.35);
  transform: scale(1.06);
}
.sidebar .sidebar__toggle:hover svg { transform: translateX(-1px); }
.sidebar-collapsed .sidebar .sidebar__toggle:hover svg { transform: translateX(1px) rotate(180deg); }
.sidebar .user .icon-btn:hover {
  color: #fff;
  background: linear-gradient(135deg, #7f1d1d, #b91c1c);
  border-color: rgba(252, 165, 165, 0.6);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18), 0 4px 12px rgba(0, 0, 0, 0.35);
  transform: scale(1.06);
}
.sidebar .user .icon-btn:hover svg { transform: translateX(2px); }
.sidebar .user { padding-top: 14px; }
.sidebar .user__avatar { box-shadow: 0 0 0 2px rgba(184, 143, 120, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3); }
.sidebar .meta-switch, .sidebar .sys { border-radius: 12px; }
.sidebar .meta-switch:hover { background: rgba(58, 6, 41, 0.8); border-color: rgba(255, 255, 255, 0.2); }

/* Dark theme: cards sit on black, so their borders carry the edge */
[data-theme="dark"] .card, [data-theme="dark"] .post, [data-theme="dark"] .account, [data-theme="dark"] .product,
[data-theme="dark"] .kpis, [data-theme="dark"] .top-post, [data-theme="dark"] .bot-row, [data-theme="dark"] .channel-hl-card {
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .btn:not(.btn--primary):not(.btn--danger) { background: #1b1b1e; border-color: rgba(255, 255, 255, 0.14); color: #e9e4e7; }

/* =========================================================================
   Login: a calmer, product-like screen
   ========================================================================= */
.auth { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth__panel {
  padding: 64px 72px;
  background: #3A0629;
  background-image:
    linear-gradient(160deg, #4a0935 0%, #3A0629 45%, #2a041e 100%);
  color: #f3e6ee;
}
.auth__panel-inner { max-width: 500px; width: 100%; }
.auth__headline { margin-top: 44px; font-size: 36px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.auth__headline span { background: none; -webkit-text-fill-color: #B88F78; color: #B88F78; }
.auth__lead { color: #dcbfd0; font-size: 15.5px; margin-top: 14px; max-width: 440px; }
.auth__chips { margin-top: 20px; }
.auth__chip { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); color: #e6cfdc; }
.auth__points { color: #e6cfdc; border-top-color: rgba(255, 255, 255, 0.12); margin-top: 28px; padding-top: 22px; gap: 12px; }
.auth__points li { font-size: 14.5px; align-items: flex-start; gap: 10px; }
.auth__points svg { width: 16px; height: 16px; flex: 0 0 16px; color: #B88F78; margin-top: 2px; }
.auth__dot { display: none; }

/* a small "today" card that shows what the desk looks like */
.auth__demo {
  margin-top: 34px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(10, 10, 11, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.6);
}
.auth__demo-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #c9a3bb; font-weight: 500; }
.auth__demo-head b { color: #ffffff; font-weight: 600; font-size: 13px; }
.auth__demo-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 13px; color: #f0dde8; }
.auth__demo-row:first-of-type { border-top: 0; margin-top: 8px; }
.auth__demo-time { width: 64px; flex: 0 0 64px; color: #c9a3bb; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.auth__demo-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth__demo-state { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; letter-spacing: 0.02em; }
.auth__demo-state--ok { color: #6ee7b7; background: rgba(16, 185, 129, 0.14); }
.auth__demo-state--wait { color: #B88F78; background: rgba(184, 143, 120, 0.14); }
.auth__demo-state--draft { color: #dcbfd0; background: rgba(255, 255, 255, 0.08); }

.auth__form-wrap { background: var(--paper); }
.auth__card { width: min(400px, 100%); padding: 36px; border-radius: 16px; box-shadow: 0 10px 30px -12px rgba(58, 6, 41, 0.25), 0 1px 2px rgba(0, 0, 0, 0.04); }
.auth__card:hover { transform: none; }
.auth__card h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.auth__hint { margin: 6px 0 22px; }
.auth__card .field { gap: 6px; }
.auth__card .field > span { font-size: 13px; }
.auth__card .btn--primary { margin-top: 6px; }
.auth__foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.auth__foot a { color: #5D0B42; font-weight: 500; }
[data-theme="dark"] .auth__foot a { color: #B88F78; }
.auth__brand-note { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; font-size: 13px; color: var(--muted); }
.auth__brand-note .brand__logo { width: 28px; height: 28px; flex-basis: 28px; font-size: 14px; border-radius: 8px; background: #5D0B42; box-shadow: none; }
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth__panel { padding: 40px 24px 32px; }
  .auth__headline { font-size: 28px; margin-top: 28px; }
  .auth__demo { display: none; }
  .auth__form-wrap { min-height: auto; padding: 32px 20px 48px; }
}

/* =========================================================================
   "Create an image with AI" dialog
   ========================================================================= */
#ai-form { display: flex; flex-direction: column; gap: 16px; }
.ai-refs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-ref {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 16px;
  border-radius: 14px;
  border: 1.5px dashed var(--line-strong);
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.ai-ref:hover { border-color: #5D0B42; background: rgba(93, 11, 66, 0.05); }
.ai-ref--set { border-style: solid; border-color: #5D0B42; padding: 0; background: #111113; }
.ai-ref--busy { opacity: 0.6; pointer-events: none; }
.ai-ref img { width: 100%; height: auto; max-height: 240px; object-fit: contain; display: block; }
.ai-ref img[hidden] { display: none; }
.ai-ref__empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.ai-ref__empty::before {
  content: "";
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235D0B42' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='M17 8l-5-5-5 5'/%3E%3Cpath d='M12 3v12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px;
  margin-bottom: 4px;
}
.ai-ref__empty strong { font-size: 14px; color: var(--text); }
.ai-ref__empty small { font-size: 12px; line-height: 1.45; color: var(--muted); max-width: 260px; }
.ai-ref__clear {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: grid; place-items: center;
}
.ai-ref__clear:hover { background: #b91c1c; }
.ai-refs__hint { font-size: 13px; line-height: 1.5; margin: -6px 0 0; }
.ai-logo-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.ai-logo-hint a { color: inherit; font-weight: 600; text-decoration: underline; }
.ai-logo-hint--ok { color: var(--text-2); background: var(--surface-2); border-color: var(--line); }
.ai-logo-hint img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--line); flex: 0 0 32px; }
[data-theme="dark"] .ai-logo-hint { color: #fcd34d; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); }
[data-theme="dark"] .ai-logo-hint--ok { color: var(--text-2); background: var(--surface-2); border-color: var(--line); }
.ai-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 18px; }
.ai-options .check { flex: 1 1 100%; font-size: 14px; }
.field--inline-sm { flex: 1 1 180px; }
.field--inline-sm .select { width: 100%; }
.ai-result__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
#ai-result-img { width: 100%; border-radius: 14px; border: 1px solid var(--line); background: #111113; }
.ai-result__side { display: flex; flex-direction: column; gap: 12px; }
.ai-result__side h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
#ai-result-prompt { font-size: 13.5px; line-height: 1.55; max-height: 200px; overflow: auto; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
#ai-result-more img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
#ai-result-notes:empty { display: none; }
@media (max-width: 640px) {
  .ai-refs, .ai-result__grid { grid-template-columns: 1fr; }
  .ai-ref { min-height: 120px; }
}

/* Extra photos of a carousel (review dialog, manual post, AI result) */
.extra-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.extra-strip:empty { display: none; }
.extra-tile {
  position: relative;
  width: 72px; height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.extra-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.extra-tile button {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 999px;
  border: 0;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  display: grid; place-items: center;
}
.extra-tile button:hover { background: #b91c1c; }

/* Waiting on the agent / image generator */
.draft-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 220px;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
}

/* Draft review: when, story, notes, regenerate, extras */
.draft__text { display: flex; flex-direction: column; gap: 16px; }
.draft__extras { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.draft__extras p { margin: 0; font-size: 13px; }
.draft__upload { margin-top: 10px; align-self: flex-start; }
.when {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.when__title { font-size: 13px; font-weight: 600; color: var(--text); }
.when__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.when__opt:hover { border-color: rgba(93, 11, 66, 0.35); }
.when__opt:has(input:checked) { border-color: #5D0B42; color: var(--text); box-shadow: 0 0 0 3px rgba(93, 11, 66, 0.12); }
.when__opt > span { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.when__opt input[type="radio"] { flex: 0 0 auto; margin: 0; accent-color: #5D0B42; }
.when__opt input[type="datetime-local"] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.when__why { margin: 2px 0 0; font-size: 12.5px; }
.when__why:empty { display: none; }
.story-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
}
.story-opt input { margin: 3px 0 0; flex: 0 0 auto; accent-color: #5D0B42; }
.story-opt > span { display: flex; flex-direction: column; gap: 2px; }
.story-opt strong { font-size: 14px; color: var(--text); }
.story-opt small { font-size: 12.5px; line-height: 1.45; }
.draft__notes { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.draft__notes summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text); }
.draft__notes ul { margin: 10px 0 0; padding-left: 18px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.draft__regen { display: flex; gap: 8px; align-items: stretch; }
.draft__regen input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.draft__regen input:focus { outline: none; border-color: #5D0B42; box-shadow: 0 0 0 3px rgba(93, 11, 66, 0.12); }
@media (max-width: 640px) {
  .draft__regen { flex-direction: column; }
  .when__opt > span { flex-direction: column; align-items: flex-start; }
}

/* Draft done: queued / published / failed */
.draft-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 16px 12px;
}
.draft-done__icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #5D0B42, #3A0629);
  box-shadow: 0 10px 24px -8px rgba(58, 6, 41, 0.6);
  margin-bottom: 6px;
}
.draft-done--ok .draft-done__icon { background: linear-gradient(135deg, #10b981, #059669); }
.draft-done--error .draft-done__icon { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.draft-done h2 { font-size: 24px; }
.draft-done__text { max-width: 560px; font-size: 14px; line-height: 1.55; }
.draft-done__notes {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.draft-done__notes li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
}
.draft-done__notes li::before { content: "•"; color: #5D0B42; font-weight: 700; }
[data-theme="dark"] .draft-done__notes li::before { color: #cbab96; }
.draft-done__actions { display: flex; gap: 10px; margin-top: 14px; }

/* Picking one of a product's photos */
.image-grid--pick { display: flex; flex-wrap: wrap; gap: 10px; }
.image-grid--pick .image-tile {
  width: 96px; height: 96px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  position: relative;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.image-grid--pick .image-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-grid--pick .image-tile:hover { transform: translateY(-2px); border-color: rgba(93, 11, 66, 0.5); }
.image-grid--pick .image-tile--primary { border-color: #5D0B42; box-shadow: 0 0 0 3px rgba(93, 11, 66, 0.18); }
.image-grid--pick .image-tile__bar { position: absolute; left: 4px; bottom: 4px; }
.image-grid--pick .image-tile__bar .chip { font-size: 10px; padding: 1px 6px; }

/* =========================================================================
   Account logo (stamped on AI images)
   ========================================================================= */
.account__logo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}
.account__logo-box {
  width: 64px; height: 64px; flex: 0 0 64px;
  display: grid; place-items: center;
  border-radius: 10px;
  background:
    linear-gradient(45deg, rgba(0, 0, 0, 0.06) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.06) 75%),
    linear-gradient(45deg, rgba(0, 0, 0, 0.06) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.06) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
  background-color: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.account__logo-img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.account__logo-empty { font-size: 11px; color: var(--muted); }
.account__logo-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account__logo-text strong { font-size: 13.5px; color: var(--text); }
.account__logo-text small { font-size: 12px; line-height: 1.4; }
.account__logo-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.account__logo-actions .link { font-size: 13px; }
[data-theme="dark"] .account__logo-box {
  background-color: #1b1b1e;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.07) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.07) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.07) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.07) 75%);
}

/* =========================================================================
   "Post on" picker: the same brand on Instagram + Facebook
   ========================================================================= */
.pp { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.pp[hidden] { display: none; }
.pp__label { font-size: 13px; font-weight: 600; color: var(--text); }
.pp__opts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.pp__opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.pp__opt svg { width: 15px; height: 15px; flex: 0 0 15px; }
.pp__opt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp__opt:hover { background: rgba(93, 11, 66, 0.08); color: #5D0B42; }
.pp__opt.is-active {
  background: linear-gradient(135deg, #5D0B42, #3A0629);
  color: #ffffff;
  border-color: #3A0629;
  box-shadow: 0 2px 8px rgba(58, 6, 41, 0.3);
}
[data-theme="dark"] .pp__opt:hover { background: rgba(255, 255, 255, 0.06); color: #ffffff; }
.pp__hint { font-size: 12px; line-height: 1.45; }
@media (max-width: 640px) {
  .pp__opts { grid-template-columns: 1fr; }
  .pp__opt { justify-content: flex-start; }
}

/* =========================================================================
   Activity log: a day-grouped timeline
   ========================================================================= */
.kpis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi--err.is-alert strong { color: var(--err); }
.act-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
.act-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.act-filters .toolbar__input { min-width: 220px; }
.act-filters .toolbar__select { min-width: 150px; }

.act-list { display: flex; flex-direction: column; gap: 22px; }
.act-day__label {
  position: relative;
  margin: 0 0 10px;
  padding-left: 44px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.act-day__items {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* the timeline rail behind the icons */
.act-day__items::before {
  content: "";
  position: absolute;
  left: 17px; top: 8px; bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}

.act {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 16px 12px 0;
  border-radius: 12px;
  transition: background 0.2s var(--ease);
}
.act:hover { background: rgba(93, 11, 66, 0.05); }
[data-theme="dark"] .act:hover { background: rgba(255, 255, 255, 0.04); }

.act__icon {
  position: relative;
  z-index: 1;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #5D0B42;
  background: var(--surface);
  border: 1.5px solid rgba(93, 11, 66, 0.25);
  box-shadow: 0 0 0 4px var(--paper);
}
.act__icon svg { width: 16px; height: 16px; }
.act__icon--comment { color: #8a6650; border-color: rgba(184, 143, 120, 0.5); }
.act__icon--account, .act__icon--auth { color: #4a5568; border-color: rgba(74, 85, 104, 0.3); }
.act__icon--system { color: #b45309; border-color: rgba(180, 83, 9, 0.35); }
.act--ok .act__icon { color: #ffffff; background: var(--ok); border-color: var(--ok); }
.act--warn .act__icon { color: #ffffff; background: #d97706; border-color: #d97706; }
.act--error .act__icon { color: #ffffff; background: var(--err); border-color: var(--err); }
[data-theme="dark"] .act__icon { color: #cbab96; border-color: rgba(203, 171, 150, 0.35); }
[data-theme="dark"] .act--ok .act__icon, [data-theme="dark"] .act--warn .act__icon, [data-theme="dark"] .act--error .act__icon { color: #ffffff; }

.act__body { min-width: 0; padding-top: 2px; }
.act__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.act__title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; overflow-wrap: anywhere; }
.act--error .act__title { color: var(--err); }
.act__time { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.act__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.act__meta .chip { font-size: 11px; padding: 2px 8px; }
.act__kind { font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 10.5px; }
.act__actor::before { content: "by "; opacity: 0.7; }
.act__link { color: #5D0B42; font-weight: 500; }
.act__link:hover { text-decoration: underline; }
[data-theme="dark"] .act__link { color: #cbab96; }
.act__detail {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.act--foldable .act__detail { cursor: pointer; }
.act--foldable .act__detail::after { content: ""; }
.act--foldable:not(.is-open) .act__detail { mask-image: linear-gradient(180deg, #000 55%, transparent); -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent); }
.act.is-open .act__detail { -webkit-line-clamp: unset; display: block; }
.act--error .act__detail { background: var(--err-soft); border-color: var(--err-border); color: var(--err); }
.act-more { display: flex; justify-content: center; margin: 22px 0 8px; }

@media (max-width: 860px) {
  .kpis--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis--4 .kpi:nth-child(3) { border-left: 0; }
  .kpis--4 .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .act-filters .toolbar__input, .act-filters .toolbar__select { flex: 1 1 100%; min-width: 0; }
  .act__top { flex-direction: column; gap: 2px; }
  .act { padding-right: 4px; }
}

/* =========================================================================
   Login v2: one floating card on a plum canvas. Left half: plum with big dark-plum
   circles and a curved edge. Right half: the form, with icons inside the inputs.
   ========================================================================= */
.lg-body {
  min-height: 100vh;
  margin: 0;
  display: block;
  padding: 0;
  background: var(--paper);
  font-family: var(--font-body);
}
.lg-body::before { display: none; }
.lg-top { position: fixed; top: 18px; right: 18px; z-index: 5; }
body.lg-body .lg-top .theme-switch-pill { background: #3A0629; border-color: rgba(255, 255, 255, 0.2); }
body.lg-body .lg-top .theme-switch-btn { color: #e6cfdc; }
body.lg-body .lg-top .theme-switch-indicator { background: #ffffff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
body.lg-body .lg-top .theme-switch-btn.is-active { color: #3A0629; }

/* Full page: the plum half on the left, the form half on the right */
.lg {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--paper);  /* light: beige #E6D3C3, dark: black */
  overflow: hidden;
}

/* Left: plum panel with a curved right edge and solid circles */
.lg__art {
  position: relative;
  overflow: hidden;
  background: #5D0B42;
  color: #ffffff;
  padding: 72px 8vw 72px 7vw;
  display: flex;
  align-items: center;
  /* a clean slanted edge instead of a bulging circle */
  clip-path: polygon(0 0, 100% 0, calc(100% - 110px) 100%, 0 100%);
  margin-right: -70px;
  z-index: 2;
}
.lg__circle {
  position: absolute;
  border-radius: 50%;
  background: #3A0629;
  pointer-events: none;
}
.lg__circle--1 { width: 38vh; height: 38vh; left: -14vh; bottom: -16vh; }
.lg__circle--2 { width: 26vh; height: 26vh; right: 14%; bottom: 6vh; background: #4a0935; }
.lg__circle--3 { width: 16vh; height: 16vh; right: 24%; top: 8vh; }
.lg__circle--4 { width: 44px; height: 44px; right: 20%; top: calc(8vh + 11vh); background: #B88F78; opacity: 0.85; }
.lg__art-inner { position: relative; z-index: 1; max-width: 420px; }
.lg__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 42px; }
.lg__brand .brand__logo { width: 38px; height: 38px; flex-basis: 38px; font-size: 18px; border-radius: 10px; background: #3A0629; box-shadow: 0 0 0 1px rgba(184, 143, 120, 0.5); }
.lg__brand span { font-family: var(--font-sans); font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.lg__welcome {
  font-family: var(--font-sans);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.05;
  margin: 0;
  color: #ffffff;
  background: none;
  -webkit-text-fill-color: currentColor;
}
.lg__tag { margin: 14px 0 0; font-family: var(--font-sans); font-size: 15px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #B88F78; }
.lg__text { margin: 18px 0 0; font-size: 14px; line-height: 1.7; color: #e6cfdc; max-width: 320px; }
.lg__facts { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: #f0dde8; }
.lg__facts li { display: flex; align-items: center; gap: 10px; }
.lg__facts svg { width: 15px; height: 15px; flex: 0 0 15px; color: #B88F78; }

/* Right: the form */
.lg__form {
  position: relative;
  z-index: 1;
  padding: 72px 8vw 56px calc(48px + 5vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lg__form > * { max-width: 440px; width: 100%; }
.lg__form h2 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.lg__hint { margin: 8px 0 28px; font-size: 13.5px; color: var(--muted); }
.lg__form .form { gap: 14px; }
.lg__field { position: relative; display: block; }
.lg__field > span {
  position: absolute;
  left: 14px; top: -7px;
  padding: 0 6px;
  background: var(--paper);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 1;
}
.lg__field svg.lg__icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s ease;
}
.lg__field input {
  width: 100%;
  box-sizing: border-box;
  padding: 15px 44px 15px 44px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.lg__field input::placeholder { color: var(--muted); opacity: 0.7; }
.lg__field input:hover { border-color: #B88F78; }
.lg__field input:focus { border-color: #5D0B42; background: var(--surface); box-shadow: 0 0 0 4px rgba(93, 11, 66, 0.12); }
.lg__field input:focus ~ svg.lg__icon, .lg__field:focus-within > span { color: #5D0B42; }
.lg__show {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  padding: 4px 6px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #5D0B42;
  cursor: pointer;
  border-radius: 6px;
}
.lg__show:hover { background: rgba(93, 11, 66, 0.08); }
[data-theme="dark"] .lg__show { color: #cbab96; }
.lg__form .btn--primary { margin-top: 6px; padding: 15px 20px; font-size: 15px; letter-spacing: 0.02em; border-radius: 12px; }
.lg__or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 12px; }
.lg__or::before, .lg__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lg__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.45);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.lg__meta svg { width: 20px; height: 20px; flex: 0 0 20px; color: #5D0B42; }
[data-theme="dark"] .lg__meta { background: var(--surface-2); }
.lg__field input:focus { background: #ffffff; }
[data-theme="dark"] .lg__field input:focus { background: var(--surface-2); }
[data-theme="dark"] .lg__meta svg { color: #cbab96; }
.lg__meta b { color: var(--text); font-weight: 600; }
.lg__form .error { margin: 0; }

@media (max-width: 860px) {
  .lg { grid-template-columns: 1fr; min-height: 100vh; }
  .lg__art { margin-right: 0; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 36px), 0 100%); padding: 72px 28px 60px; }
  .lg__welcome { font-size: 32px; }
  .lg__facts { display: none; }
  .lg__form { padding: 36px 24px 40px; justify-content: flex-start; }
  .lg__form h2 { font-size: 28px; }
}
@media (max-width: 480px) {
  .lg-top { top: 10px; right: 10px; }
  .lg__art { padding: 60px 22px 36px; }
  .lg__circle--3 { display: none; }
}

/* =========================================================================
   Fit to the screen: short laptop screens, mid widths, phones
   (kept last so these win over the base rules above)
   ========================================================================= */

/* Laptop-height screens: a tighter sidebar so everything fits without scrolling */
@media (min-width: 901px) and (max-height: 820px) {
  html:not(.sidebar-collapsed) .sidebar { padding: 16px 14px 14px; }
  html:not(.sidebar-collapsed) .brand { padding-bottom: 12px; }
  .nav { gap: 1px; }
  html:not(.sidebar-collapsed) .nav__label { padding: 10px 10px 4px; }
  html:not(.sidebar-collapsed) .nav__link { padding: 8px 12px; }
  .sidebar__foot { gap: 6px; padding-top: 10px; }
  html:not(.sidebar-collapsed) .meta-switch { padding-top: 8px; padding-bottom: 8px; }
  html:not(.sidebar-collapsed) .sys { padding: 6px 12px; }
}

/* Very short screens: drop the section labels, status line and e-mail */
@media (min-width: 901px) and (max-height: 640px) {
  html:not(.sidebar-collapsed) .nav__label { display: none; }
  .user__email { display: none; }
  .sys { display: none; }
}

/* Mid widths (small laptops): less side padding, cards keep two columns where they fit */
@media (min-width: 901px) and (max-width: 1280px) {
  .main { padding: 32px 32px 64px; }
  .account-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* Headings scale with the screen instead of jumping */
.page-head h1 { font-size: clamp(24px, 1.1vw + 15px, 32px); }

/* Tablets and phones: the sidebar becomes a top bar. Row 1 = logo + Meta switch + user,
   row 2 = the menu icons across the full width (instead of a squeezed vertical stack). */
@media (max-width: 900px) {
  .sidebar { overflow: visible; }
  .sidebar .brand { order: 1; }
  .sidebar__foot { order: 2; margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .nav {
    order: 3;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav__link { flex: 0 0 auto; justify-content: center; padding: 10px 12px; }
}

/* ---- Every width ---------------------------------------------------------- */

/* Tables never squash names into one word per line: they scroll sideways instead */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { min-width: 860px; }
.table th, .table td { white-space: nowrap; }
.cell-account { display: flex; align-items: center; gap: 8px; }
.cell-account strong { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }

/* Long account name in the "Best account" tile wraps instead of being cut */
.kpi--accent strong { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }

/* Dropdowns never push past the screen edge */
select, .toolbar__select { max-width: 100%; }

/* Long names in cards wrap neatly */
.post__account, .account__name, .comment__head strong { overflow-wrap: anywhere; }

/* ---- Tablets and small laptops ------------------------------------------- */
@media (max-width: 1100px) {
  .post { grid-template-columns: 80px minmax(0, 1fr); gap: 16px; }
  .post__thumb img { width: 80px; height: 80px; }
  .post__actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; min-width: 0; }
}

/* Phones */
@media (max-width: 640px) {
  .main { padding: 20px 16px 48px; }
  /* cards: less padding so content gets the width */
  .card { padding: 18px 16px; border-radius: var(--r); }
  .composer { padding: 18px 16px; }
  /* list cards: small photo beside the title, everything else full width */
  .post { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding: 14px; align-items: start; }
  .post__thumb img { width: 56px; height: 56px; border-radius: var(--r-sm); }
  .post__actions .btn { flex: 1 1 auto; justify-content: center; }
  .card .post-list .post { padding: 12px; }
  /* status tabs: one row that scrolls sideways */
  .toolbar__tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .toolbar__tabs::-webkit-scrollbar { display: none; }
  .tab-pill { flex: 0 0 auto; }
  .toolbar { gap: 8px; }
  .toolbar__select { min-width: 0; flex: 1 1 160px; }
  /* products: two per row with a shorter photo */
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product__thumb { aspect-ratio: 1 / 1; }
  .product__body { padding: 10px 12px 12px; }
  /* top bar: Meta state + theme only, icons without labels */
  .topbar { padding: 8px 12px; margin-bottom: 16px; }
  .topbar__crumb, .topbar__sep { display: none; }
  .theme-switch-btn span { display: none; }
  .theme-switch-btn { padding: 5px 9px; }
  /* summary pills two per row */
  .posts-summary-ribbon { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi strong { font-size: 26px; }
}

/* Sticky filter bars: opaque enough that the list scrolling under them never shows through */
.toolbar--sticky { background: rgba(234, 228, 221, 0.85); backdrop-filter: blur(14px) saturate(140%); }
[data-theme="dark"] .toolbar--sticky { background: rgba(10, 10, 11, 0.9); }

/* Page actions on phones: controls share the row, never run off the edge */
@media (max-width: 640px) {
  .toolbar--sticky { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  /* product cards in two columns: price on its own line, category chip on one line */
  .product__row { flex-wrap: wrap; gap: 6px; }
  .product__category { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .product__price strong { font-size: 15px; white-space: nowrap; }
  .product__name { font-size: 14px; }
  .page-head__actions { width: 100%; }
  .page-head__actions > * { flex: 1 1 auto; min-width: 0; justify-content: center; }
  .page-head__actions select { flex-basis: 100%; }
}

/* Very narrow phones (older/small devices) */
@media (max-width: 340px) {
  .product-grid { grid-template-columns: minmax(0, 1fr); }
  .nav__link { padding: 9px 9px; }
}

@media (max-width: 640px) {
  .account-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .account { padding: 18px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-head__actions { flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .skeleton { background: var(--surface-2); }
}
