/* ==========================================================================
   SocialPilot — app.css  (light, futuristic, animated)
   Vocabulary is fixed by the build contract (ADDENDUM v2 "UI split").
   No external assets: system fonts, CSS-only gradients and patterns.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;

  /* brand */
  --brand: #4F2BD9;
  --brand-600: #4321C2;
  --brand-700: #3718A6;
  --brand-300: #8B72F0;
  --brand-100: #ECE8FF;
  --brand-50: #F5F3FF;
  --teal: #00B3A6;
  --teal-700: #00756C;        /* AA text on white */
  --teal-100: #DDF7F4;
  --orange: #FF7A1A;
  --orange-700: #A84A00;      /* AA text on white */
  --orange-100: #FFEEDF;

  /* platforms */
  --fb: #1877F2;
  --fb-ink: #0B4DA8;
  --fb-tint: #E8F1FE;
  --ig-1: #F58529;
  --ig-2: #DD2A7B;
  --ig-3: #8134AF;
  --ig-grad: linear-gradient(135deg, #F58529 0%, #DD2A7B 52%, #8134AF 100%);
  --ig-ink: #9C1758;
  --tt: #111111;
  --tt-cyan: #25F4EE;
  --tt-red: #FE2C55;

  /* neutrals */
  --bg: #F7F7FD;
  --ink: #14112B;
  --ink-2: #2E2A4A;
  --muted: #5D5A78;           /* 6.3:1 on white */
  --faint: #8C89A6;
  --line: rgba(64, 52, 140, 0.13);
  --line-strong: rgba(64, 52, 140, 0.22);
  --surface: rgba(255, 255, 255, 0.66);
  --surface-strong: rgba(255, 255, 255, 0.86);
  --surface-solid: #FFFFFF;

  /* semantic */
  --ok: #12A150;
  --ok-ink: #0E6E39;
  --warn: #F59E0B;
  --warn-ink: #8A4B00;
  --danger: #D92D3A;
  --danger-ink: #A3122B;
  --info: #2F6FEB;

  /* shape + depth */
  --r-xs: 6px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --shadow-sm: 0 1px 2px rgba(20, 17, 43, 0.06), 0 1px 1px rgba(20, 17, 43, 0.04);
  --shadow: 0 1px 2px rgba(20, 17, 43, 0.05), 0 8px 24px -6px rgba(40, 30, 110, 0.14);
  --shadow-lg: 0 2px 6px rgba(20, 17, 43, 0.06), 0 24px 60px -12px rgba(40, 30, 110, 0.28);
  --glow: 0 6px 22px -4px rgba(79, 43, 217, 0.45), 0 0 0 1px rgba(79, 43, 217, 0.25) inset;
  --ring: 0 0 0 3px rgba(79, 43, 217, 0.22);

  /* motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 150ms;
  --t: 200ms;
  --t-slow: 250ms;

  /* type */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-display: "Segoe UI Variable Display", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --sidebar-w: 252px;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}
img, svg, video, canvas { max-width: 100%; }
img, video, canvas { display: block; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); color: var(--ink); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-700); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(79, 43, 217, 0.18); }

:focus { outline: none; }
:focus-visible {
  outline: 3px solid rgba(79, 43, 217, 0.6);
  outline-offset: 2px;
  border-radius: 6px;
}

/* thin elegant scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(79, 43, 217, 0.28) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(79, 43, 217, 0.22); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(79, 43, 217, 0.38); }

.grad-text {
  background: linear-gradient(100deg, var(--brand) 0%, #7A4DFF 45%, var(--teal) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 3. Animated aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, 0.9), transparent 70%),
    linear-gradient(180deg, #FBFAFF 0%, #F4F3FC 100%);
}
/* faint tech grid that fades out */
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(79, 43, 217, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 43, 217, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
}
.aurora span {
  position: absolute;
  width: 62vmax;
  height: 62vmax;
  border-radius: 50%;
  opacity: 0.55;
  will-change: transform;
}
.aurora span:nth-child(1) {
  top: -26vmax; left: -18vmax;
  background: radial-gradient(circle at center, rgba(122, 77, 255, 0.55), rgba(122, 77, 255, 0) 62%);
  animation: aurora-a 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(2) {
  top: -20vmax; right: -24vmax;
  background: radial-gradient(circle at center, rgba(0, 179, 166, 0.45), rgba(0, 179, 166, 0) 62%);
  animation: aurora-b 32s ease-in-out infinite alternate;
}
.aurora span:nth-child(3) {
  bottom: -34vmax; left: 18vmax;
  background: radial-gradient(circle at center, rgba(255, 122, 26, 0.32), rgba(255, 122, 26, 0) 60%);
  animation: aurora-c 38s ease-in-out infinite alternate;
}
@keyframes aurora-a { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(14vmax, 10vmax, 0) scale(1.15); } }
@keyframes aurora-b { from { transform: translate3d(0, 0, 0) scale(1.05); } to { transform: translate3d(-12vmax, 14vmax, 0) scale(0.9); } }
@keyframes aurora-c { from { transform: translate3d(0, 0, 0) scale(0.95); } to { transform: translate3d(-16vmax, -10vmax, 0) scale(1.12); } }

/* ---------- 4. Glass surfaces ---------- */
.glass, .card, .panel, .sidebar, .topbar, .modal, .toast, .login-card, .calendar {
  --glass-bg: var(--surface);
}
.glass {
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  border-radius: var(--r-lg);
}
.card {
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  outline: 1px solid var(--line);
  outline-offset: -1px;
  box-shadow: var(--shadow);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.panel {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass, .card, .sidebar, .topbar, .toast, .login-card, .modal { background: rgba(255, 255, 255, 0.96) !important; }
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::before {
  content: "";
  width: 18px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand), var(--teal));
  flex: none;
}
.divider {
  height: 1px;
  border: 0;
  margin: 4px 0;
  background: linear-gradient(90deg, transparent, var(--line-strong) 15%, var(--line-strong) 85%, transparent);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 44px 24px;
  border-radius: var(--r-lg);
  border: 1.5px dashed rgba(79, 43, 217, 0.25);
  background:
    radial-gradient(400px 160px at 50% 0%, rgba(79, 43, 217, 0.07), transparent 70%),
    rgba(255, 255, 255, 0.55);
  color: var(--muted);
}
.empty::before {
  content: "";
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), transparent 40%),
    linear-gradient(135deg, var(--brand-300), var(--teal));
  box-shadow: 0 10px 24px -8px rgba(79, 43, 217, 0.5);
  animation: float 5s ease-in-out infinite;
}
.empty h2, .empty h3, .empty strong { color: var(--ink); }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }

/* ---------- 5. Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.grid, .grid-2, .grid-3 { display: grid; gap: 16px; min-width: 0; }
.grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > *, .grid-2 > *, .grid-3 > * { min-width: 0; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; justify-content: center; align-items: center; }

/* ---------- 6. App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 16px;
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.8) inset;
  z-index: 20;
  min-width: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 6px; }
.logo { flex: none; filter: drop-shadow(0 6px 12px rgba(79, 43, 217, 0.35)); }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }

.nav { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.nav a .ico {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  font-size: 15px;
  line-height: 1;
  background: rgba(79, 43, 217, 0.07);
  transition: background var(--t) var(--ease), transform var(--t) var(--ease);
}
.nav a:hover { background: rgba(79, 43, 217, 0.07); color: var(--brand-700); }
.nav a:hover .ico { transform: scale(1.06); }
.nav a.active {
  color: #fff;
  background: linear-gradient(120deg, #6A45FF 0%, var(--brand) 55%, #3B22B8 100%);
  box-shadow: 0 8px 22px -6px rgba(79, 43, 217, 0.55);
}
.nav a.active .ico { background: rgba(255, 255, 255, 0.2); }
.nav a.active::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--tt-cyan);
  box-shadow: 0 0 0 3px rgba(37, 244, 238, 0.25), 0 0 12px var(--tt-cyan);
}

#sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}
#sidebar-footer:empty { display: none; }

.main { min-width: 0; padding: 0 28px 40px; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 -28px;
  padding: 16px 28px 14px;
  background: linear-gradient(180deg, rgba(247, 247, 253, 0.92), rgba(247, 247, 253, 0.7));
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
#topbar-actions:empty, #status-pills:empty { display: none; }
#status-pills { gap: 6px; }
#banner { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
#banner:empty { display: none; }
.view { padding-top: 20px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.view > * { animation: rise 360ms var(--ease) both; }
.view > *:nth-child(2) { animation-delay: 40ms; }
.view > *:nth-child(3) { animation-delay: 80ms; }
.view > *:nth-child(n+4) { animation-delay: 120ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.noscript {
  position: relative;
  z-index: 5;
  max-width: 560px;
  margin: 40px auto;
  padding: 18px 22px;
  color: var(--ink);
}

/* ---------- 7. Login ---------- */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.login-card {
  position: relative;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 30px 26px;
  border-radius: var(--r-xl);
  border: 1.5px solid transparent;
  background:
    linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)) padding-box,
    conic-gradient(from var(--spin), rgba(79, 43, 217, 0.65), rgba(0, 179, 166, 0.6), rgba(255, 122, 26, 0.55), rgba(79, 43, 217, 0.65)) border-box;
  box-shadow: var(--shadow-lg), 0 0 80px -20px rgba(79, 43, 217, 0.35);
  animation: spin-border 8s linear infinite, rise 500ms var(--ease) both;
}
@keyframes spin-border { to { --spin: 360deg; } }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-title { font-family: var(--font-display); font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.login-sub { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.login-lead { color: var(--muted); font-size: 14px; }
.login-foot { text-align: center; }
.btn-block { width: 100%; padding-top: 12px; padding-bottom: 12px; font-size: 15px; }

/* ---------- 8. Buttons ---------- */
.btn {
  --btn-bg: rgba(255, 255, 255, 0.85);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--btn-bg);
  color: var(--ink);
  font-weight: 650;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease), opacity var(--t) var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(79, 43, 217, 0.35); color: var(--brand-700); box-shadow: 0 6px 16px -6px rgba(40, 30, 110, 0.25); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring), var(--shadow-sm); border-color: var(--brand); }

/* moving sheen used by coloured buttons */
.btn-primary::after, .btn-success::after, .btn-danger::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 600ms var(--ease);
}
.btn-primary:hover::after, .btn-success:hover::after, .btn-danger:hover::after { transform: translateX(120%); }

.btn-primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #6A45FF 0%, var(--brand) 50%, #3B22B8 100%);
  box-shadow: var(--glow);
  text-shadow: 0 1px 1px rgba(30, 10, 90, 0.25);
}
.btn-primary:hover { color: #fff; border-color: transparent; box-shadow: 0 10px 30px -6px rgba(79, 43, 217, 0.6), 0 0 0 1px rgba(79, 43, 217, 0.3) inset, 0 0 24px rgba(122, 77, 255, 0.35); }
.btn-primary:focus-visible { box-shadow: var(--ring), var(--glow); }

.btn-success {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #00897E 0%, #00756C 100%);
  box-shadow: 0 6px 20px -6px rgba(0, 179, 166, 0.6);
}
.btn-success:hover { color: #fff; border-color: transparent; box-shadow: 0 10px 26px -6px rgba(0, 179, 166, 0.7), 0 0 20px rgba(0, 179, 166, 0.3); }

.btn-danger {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #E5484D 0%, #C21F2E 100%);
  box-shadow: 0 6px 20px -8px rgba(217, 45, 58, 0.6);
}
.btn-danger:hover { color: #fff; border-color: transparent; box-shadow: 0 10px 24px -6px rgba(217, 45, 58, 0.6); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-2);
}
.btn-ghost:hover { background: rgba(79, 43, 217, 0.08); border-color: transparent; box-shadow: none; color: var(--brand-700); }

.btn-sm { min-height: 30px; padding: 5px 11px; font-size: 13px; border-radius: 10px; gap: 6px; }
.btn-icon { width: 38px; min-width: 38px; padding: 0; font-size: 17px; }
.btn-icon.btn-sm { width: 30px; min-width: 30px; font-size: 15px; }

.btn[disabled], .btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
  filter: saturate(0.6);
  pointer-events: none;
}
.btn .spinner { width: 15px; height: 15px; border-width: 2px; }
.btn-primary .spinner, .btn-success .spinner, .btn-danger .spinner { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

/* ---------- 9. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field > label .counter, .field .row > .counter { margin-left: auto; }

.input, .textarea, .select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(64, 52, 140, 0.2);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 14px;
  box-shadow: inset 0 1px 2px rgba(20, 17, 43, 0.04);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .textarea:hover, .select:hover { border-color: rgba(79, 43, 217, 0.4); }
.input:focus, .textarea:focus, .select:focus,
.input:focus-visible, .textarea:focus-visible, .select:focus-visible {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: var(--ring);
}
.input[disabled], .textarea[disabled], .select[disabled] { opacity: 0.6; cursor: not-allowed; background: rgba(240, 239, 248, 0.8); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(217, 45, 58, 0.15); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brand) 50%),
    linear-gradient(135deg, var(--brand) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input { min-height: 40px; }
input[type="number"].input { font-variant-numeric: tabular-nums; }

/* switch: label.switch > input[type=checkbox] + span (span may hold label text) */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  min-height: 26px;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 42px;
  height: 24px;
  margin: 0;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
}
.switch input + span {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding-left: 42px;
}
.switch input + span:not(:empty) { padding-left: 52px; }
.switch input + span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 42px;
  height: 24px;
  margin-top: -12px;
  border-radius: 99px;
  background: #D9D6EA;
  box-shadow: inset 0 1px 3px rgba(20, 17, 43, 0.18);
  transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.switch input + span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(20, 17, 43, 0.3);
  transition: transform var(--t-slow) var(--ease);
}
.switch input:checked + span::before {
  background: linear-gradient(135deg, #6A45FF, var(--brand) 55%, var(--teal));
  box-shadow: 0 0 0 1px rgba(79, 43, 217, 0.2), 0 4px 14px -4px rgba(79, 43, 217, 0.55);
}
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span::before { box-shadow: var(--ring); }
.switch input:disabled + span { opacity: 0.5; cursor: not-allowed; }

/* colour input — either the input itself or a wrapper around it */
input.color-input, .color-input input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 46px;
  height: 38px;
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(64, 52, 140, 0.2);
  background: #fff;
  cursor: pointer;
  flex: none;
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
input.color-input::-webkit-color-swatch-wrapper, .color-input input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input.color-input::-webkit-color-swatch, .color-input input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
input.color-input::-moz-color-swatch, .color-input input[type="color"]::-moz-color-swatch { border: 0; border-radius: 7px; }
input.color-input:hover, .color-input input[type="color"]:hover { border-color: var(--brand); }
div.color-input, label.color-input, span.color-input { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.color-input .input { font-family: var(--mono); font-size: 13px; text-transform: uppercase; max-width: 120px; }

.counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.counter.over { color: var(--danger-ink); font-weight: 750; }
.counter.over::before { content: "▲ "; font-size: 9px; vertical-align: 1px; }

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  background: #FDECEE;
  border: 1px solid rgba(217, 45, 58, 0.28);
  color: var(--danger-ink);
  font-size: 13.5px;
  font-weight: 600;
  animation: shake 360ms var(--ease);
}
.form-error::before { content: "!"; display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 12px; font-weight: 800; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

/* segmented control */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px;
  border-radius: 13px;
  background: rgba(79, 43, 217, 0.07);
  border: 1px solid var(--line);
  max-width: 100%;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 6px 13px;
  min-height: 30px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  transition: background var(--t) var(--ease), color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.seg button:hover { color: var(--brand-700); background: rgba(255, 255, 255, 0.6); }
.seg button.active {
  background: #fff;
  color: var(--brand-700);
  box-shadow: 0 1px 2px rgba(20, 17, 43, 0.08), 0 4px 12px -4px rgba(79, 43, 217, 0.35);
}
.seg button:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- 10. Chips, pills, tags ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  background: rgba(79, 43, 217, 0.08);
  color: var(--brand-700);
  border: 1px solid rgba(79, 43, 217, 0.15);
}
.chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: currentColor;
}
.chip-facebook { background: var(--fb-tint); color: var(--fb-ink); border-color: rgba(24, 119, 242, 0.28); }
.chip-facebook::before { background: var(--fb); box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2); }
.chip-instagram {
  background: linear-gradient(120deg, #FFF1E5, #FDE7F1 50%, #F3E9FB);
  color: var(--ig-ink);
  border-color: rgba(221, 42, 123, 0.28);
}
.chip-instagram::before { background: var(--ig-grad); box-shadow: 0 0 0 2px rgba(221, 42, 123, 0.18); }
.chip-tiktok {
  background: var(--tt);
  color: #fff;
  border-color: #000;
  box-shadow: -1.5px 0 0 var(--tt-cyan), 1.5px 0 0 var(--tt-red);
}
.chip-tiktok::before { background: linear-gradient(135deg, var(--tt-cyan) 0 50%, var(--tt-red) 50% 100%); }

.pill {
  --pill-bg: #EEEDF5;
  --pill-ink: #4A4763;
  --pill-dot: #8C89A6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--pill-bg);
  color: var(--pill-ink);
  border: 1px solid color-mix(in srgb, var(--pill-dot) 28%, transparent);
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--pill-dot);
}
.pill-pending_review { --pill-bg: #FFF4DE; --pill-ink: #7A4300; --pill-dot: #F59E0B; }
.pill-pending_review::before { animation: pulse-dot 2s ease-in-out infinite; }
.pill-approved { --pill-bg: #DDF7F3; --pill-ink: #00665E; --pill-dot: #00B3A6; }
.pill-rejected { --pill-bg: #FDE8EB; --pill-ink: #A3122B; --pill-dot: #E5484D; }
.pill-skipped { --pill-bg: #EFEEF4; --pill-ink: #4F4C66; --pill-dot: #9D9AB4; }
.pill-publishing { --pill-bg: #ECE8FF; --pill-ink: #3D1FB8; --pill-dot: #4F2BD9; }
.pill-publishing::before { animation: pulse-dot 1s ease-in-out infinite; }
.pill-published { --pill-bg: #E1F7E8; --pill-ink: #0E6E39; --pill-dot: #12A150; }
.pill-draft_saved { --pill-bg: #E5EEFF; --pill-ink: #1C4FAF; --pill-dot: #2F6FEB; }
.pill-missed { --pill-bg: #FFEADB; --pill-ink: #9A3F05; --pill-dot: #FF7A1A; }
.pill-failed { --pill-bg: #FFE0E0; --pill-ink: #9B0F1A; --pill-dot: #D92D3A; border-color: rgba(217, 45, 58, 0.45); }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pill-dot) 55%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--pill-dot) 0%, transparent); }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 650;
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid rgba(79, 43, 217, 0.16);
  max-width: 100%;
  overflow-wrap: anywhere;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.tag:not(:has(button)) { padding-right: 10px; }
.tag:hover { background: var(--brand-100); border-color: rgba(79, 43, 217, 0.28); }
.hashtag-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.hashtag-chips .input { flex: 1 1 140px; width: auto; min-height: 32px; padding: 5px 10px; border-radius: 99px; }
.hashtag-chips .tag button.x, .tag button.x {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(79, 43, 217, 0.1);
  color: var(--brand-700);
  font-size: 13px;
  line-height: 1;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), transform var(--t) var(--ease);
}
.tag button.x:hover { background: var(--danger); color: #fff; transform: rotate(90deg); }

/* ---------- 11. Feedback ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  border: 2.5px solid rgba(79, 43, 217, 0.18);
  border-top-color: var(--brand);
  border-right-color: var(--teal);
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(79, 43, 217, 0.1);
  box-shadow: inset 0 1px 2px rgba(20, 17, 43, 0.08);
}
.progress-bar {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand) 0%, #7A4DFF 50%, var(--teal) 100%);
  box-shadow: 0 0 12px rgba(79, 43, 217, 0.5);
  transition: width 240ms var(--ease);
  overflow: hidden;
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.55) 50%, transparent 80%);
  background-size: 200% 100%;
  animation: sheen 1.4s linear infinite;
}
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  --toast-c: var(--brand);
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
  overflow: hidden;
  overflow-wrap: anywhere;
  pointer-events: auto;
  animation: toast-in 260ms var(--ease) both;
}
.toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--toast-c);
  box-shadow: 0 0 12px var(--toast-c);
}
.toast-success { --toast-c: var(--ok); }
.toast-error { --toast-c: var(--danger); }
.toast-info { --toast-c: var(--brand); }
.toast.leaving, .toast.hide { animation: toast-out 200ms var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(0.96); } }

.banner {
  --banner-c: var(--brand);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px 12px 18px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--banner-c) 30%, transparent);
  background: color-mix(in srgb, var(--banner-c) 8%, rgba(255, 255, 255, 0.85));
  color: var(--ink);
  font-size: 14px;
  position: relative;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.banner::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--banner-c);
}
.banner-warn { --banner-c: #E58A00; background: #FFF6E5; border-color: rgba(229, 138, 0, 0.35); color: #5A3300; }
.banner-info { --banner-c: var(--brand); background: rgba(236, 232, 255, 0.85); border-color: rgba(79, 43, 217, 0.25); color: #2A1780; }
.banner strong { font-weight: 750; }

/* ---------- 12. Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  font-weight: 650;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  text-decoration: none;
  border-radius: 10px 10px 0 0;
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.tab::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--brand), var(--teal));
  transform: scaleX(0);
  transition: transform var(--t-slow) var(--ease);
}
.tab:hover { color: var(--brand-700); background: rgba(79, 43, 217, 0.05); }
.tab.active { color: var(--brand-700); }
.tab.active::after { transform: scaleX(1); }

/* ---------- 13. Tables ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.table th, .table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table th {
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(245, 243, 255, 0.9);
  white-space: nowrap;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover td { background: rgba(79, 43, 217, 0.04); }
.table td { overflow-wrap: anywhere; }

/* ---------- 14. Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 17, 43, 0.32);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
  animation: fade-in 200ms var(--ease) both;
}
.modal {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
  overflow: hidden;
  animation: modal-in 250ms var(--ease) both;
}
.modal::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), #7A4DFF, var(--teal), var(--orange));
}
.modal-wide { width: min(1200px, 100%); }
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px 24px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.modal-title { flex: 1 1 auto; min-width: 0; font-size: 18px; font-weight: 750; font-family: var(--font-display); overflow-wrap: anywhere; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: transform var(--t) var(--ease), background var(--t) var(--ease), color var(--t) var(--ease);
}
.modal-close:hover { transform: rotate(90deg); background: var(--brand-100); color: var(--brand-700); }
.modal-close:focus-visible { outline: none; box-shadow: var(--ring); }
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px 24px;
}
.modal-footer {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 16px 24px;
  border-top: 1px solid var(--line);
  background: rgba(247, 246, 255, 0.85);
}
.modal-footer:empty { display: none; }
.modal-backdrop.closing { animation: fade-out 180ms var(--ease) both; }
.modal-backdrop.closing .modal { animation: modal-out 180ms var(--ease) both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(26px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(16px) scale(0.98); } }
body:has(.modal-backdrop) { overflow: hidden; }

/* ---------- 15. Queue ---------- */
.queue-group { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.queue-date {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 750;
  color: var(--ink);
}
.queue-date::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 18px;
  min-width: 0;
}
.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--r-lg);
  background: var(--surface-strong);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  outline: 1px solid var(--line);
  outline-offset: -1px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), outline-color var(--t) var(--ease);
  animation: rise 380ms var(--ease) both;
}
.post-card:nth-child(2) { animation-delay: 50ms; }
.post-card:nth-child(3) { animation-delay: 100ms; }
.post-card:nth-child(n+4) { animation-delay: 150ms; }
.post-card:hover, .card:hover:is(a, button, [tabindex], .clickable), .card.clickable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(79, 43, 217, 0.12);
  outline-color: rgba(79, 43, 217, 0.25);
}
.post-card:focus-within { outline-color: rgba(79, 43, 217, 0.45); }
.post-thumb {
  position: relative;
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(122, 77, 255, 0.12), transparent 60%),
    repeating-conic-gradient(#EFEDF8 0% 25%, #F8F7FD 0% 50%) 0 0 / 18px 18px;
  border-bottom: 1px solid var(--line);
}
.post-thumb > canvas, .post-thumb > img, .post-thumb > video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 400ms var(--ease);
}
.post-card:hover .post-thumb > canvas, .post-card:hover .post-thumb > img, .post-card:hover .post-thumb > video { transform: scale(1.03); }
.post-thumb > .chip, .post-thumb > .pill { position: absolute; top: 10px; left: 10px; z-index: 1; box-shadow: var(--shadow-sm); }
.post-thumb > .pill { left: auto; right: 10px; }
.post-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 12px; min-width: 0; flex: 1 1 auto; }
.post-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: rgba(247, 246, 255, 0.6);
}
.post-actions .btn { flex: 1 1 auto; }

/* ---------- 16. Calendar ---------- */
.calendar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow);
  min-width: 0;
}
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cal-head h2, .cal-head h3, .cal-head .cal-title { flex: 1 1 auto; font-size: 19px; font-weight: 750; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}
.cal-dow {
  padding: 4px 6px;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 112px;
  min-width: 0;
  padding: 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  overflow: hidden;
}
.cal-day:hover { background: #fff; border-color: rgba(79, 43, 217, 0.3); box-shadow: 0 6px 16px -8px rgba(40, 30, 110, 0.3); }
.cal-day.other-month { background: rgba(255, 255, 255, 0.3); }
.cal-day.other-month .cal-date { color: var(--faint); font-weight: 600; }
.cal-day.today {
  background: linear-gradient(160deg, rgba(236, 232, 255, 0.95), rgba(255, 255, 255, 0.9));
  border-color: rgba(79, 43, 217, 0.5);
  box-shadow: 0 0 0 2px rgba(79, 43, 217, 0.18), 0 8px 20px -10px rgba(79, 43, 217, 0.5);
}
.cal-date {
  display: inline-grid;
  place-items: center;
  align-self: flex-start;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.cal-day.today .cal-date {
  color: #fff;
  background: linear-gradient(135deg, #6A45FF, var(--brand));
  box-shadow: 0 4px 10px -3px rgba(79, 43, 217, 0.6);
}
.cal-post {
  --cal-c: var(--brand);
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding: 3px 7px 3px 6px;
  border: 0;
  border-left: 3px solid var(--cal-c);
  border-radius: 6px;
  background: color-mix(in srgb, var(--cal-c) 11%, #fff);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
.cal-post:hover { transform: translateX(2px); background: color-mix(in srgb, var(--cal-c) 18%, #fff); box-shadow: 0 3px 10px -4px color-mix(in srgb, var(--cal-c) 60%, transparent); color: var(--ink); }
.cal-post:focus-visible { outline: 2px solid var(--cal-c); outline-offset: 1px; }
.cal-post.facebook { --cal-c: var(--fb); }
.cal-post.instagram { --cal-c: var(--ig-2); border-image: linear-gradient(180deg, var(--ig-1), var(--ig-2), var(--ig-3)) 1; border-radius: 0 6px 6px 0; }
.cal-post.tiktok { --cal-c: #111; background: #17171C; color: #fff; border-left-color: var(--tt-cyan); box-shadow: inset -2px 0 0 var(--tt-red); }
.cal-post.tiktok:hover { background: #000; color: #fff; }
.cal-post .pill, .cal-post .chip { padding: 0 6px; font-size: 10px; }

/* ---------- 17. Editor ---------- */
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 24px;
  align-items: start;
  min-width: 0;
}
.editor-preview {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(340px, 64vh, 700px);
  padding: 16px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background:
    radial-gradient(70% 55% at 50% 45%, rgba(122, 77, 255, 0.14), transparent 70%),
    repeating-conic-gradient(#ECEAF6 0% 25%, #F8F7FD 0% 50%) 0 0 / 22px 22px;
  border: 1px solid var(--line);
  box-shadow: inset 0 2px 10px rgba(20, 17, 43, 0.06);
}
.preview-stage > canvas, .preview-stage > video, .preview-stage > img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: transparent;
  box-shadow: 0 1px 2px rgba(20, 17, 43, 0.1), 0 24px 48px -16px rgba(30, 20, 90, 0.45), 0 0 0 1px rgba(20, 17, 43, 0.06);
}
.preview-stage > .spinner, .preview-stage > .progress { position: absolute; }
.preview-stage > .progress { left: 24px; right: 24px; bottom: 20px; width: auto; }
.preview-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  min-width: 0;
}
.preview-controls input[type="range"] { flex: 1 1 140px; min-width: 0; accent-color: var(--brand); }
.preview-controls .small, .preview-controls time { font-variant-numeric: tabular-nums; }
.editor-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.scene-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  min-width: 0;
  animation: rise 260ms var(--ease) both;
}
.scene-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand), var(--teal));
}
.scene-row > * { flex: 1 1 170px; min-width: 0; }
.scene-row > .btn, .scene-row > button, .scene-row > .select, .scene-row > select { flex: 0 0 auto; }
.scene-row > .field:has(input[type="number"]), .scene-row > input[type="number"] { flex: 0 1 96px; }
.kv {
  display: grid;
  grid-template-columns: minmax(96px, max-content) minmax(0, 1fr);
  gap: 8px 18px;
  margin: 0;
  font-size: 13.5px;
}
.kv > :nth-child(odd) { color: var(--muted); font-weight: 600; }
.kv > :nth-child(even) { color: var(--ink); margin: 0; overflow-wrap: anywhere; min-width: 0; }
.kv dd { margin: 0; }

/* ---------- 18. Misc ---------- */
.kbd {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 2px 0 rgba(64, 52, 140, 0.15);
}
.code {
  display: inline-block;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #2A1780;
  background: rgba(236, 232, 255, 0.75);
  border: 1px solid rgba(79, 43, 217, 0.16);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
pre.code, div.code { display: block; padding: 10px 14px; line-height: 1.55; overflow-x: auto; }
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #B7B4CC;
  vertical-align: middle;
}
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 161, 80, 0.18), 0 0 10px rgba(18, 161, 80, 0.55); animation: glow-ok 2.4s ease-in-out infinite; }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.status-dot.off { background: #B7B4CC; box-shadow: 0 0 0 3px rgba(140, 137, 166, 0.15); }
@keyframes glow-ok { 50% { box-shadow: 0 0 0 5px rgba(18, 161, 80, 0.08), 0 0 14px rgba(18, 161, 80, 0.7); } }

/* ---------- 19. Responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .editor { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .editor-preview { position: static; }
  .preview-stage { height: clamp(300px, 56vh, 560px); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 10px 12px 8px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    z-index: 40;
  }
  .sidebar-brand { flex: 1 1 auto; padding: 0; gap: 9px; min-width: 0; }
  .sidebar-brand .logo { width: 30px; height: 30px; }
  .brand-name { font-size: 16px; }
  .brand-sub { display: none; }
  .nav {
    order: 3;
    flex: 1 0 100%;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -12px;
    padding: 2px 12px 2px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 16px), transparent);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 6px 12px 6px 6px; gap: 7px; font-size: 13.5px; border-radius: 99px; }
  .nav a .ico { width: 26px; height: 26px; border-radius: 99px; font-size: 13px; }
  .nav a.active::after { display: none; }
  #sidebar-footer {
    order: 2;
    margin: 0;
    padding: 0;
    border: 0;
    flex: 0 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    max-width: 62%;
    min-width: 0;
    overflow: hidden;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .main { padding: 0 16px 32px; }
  .topbar {
    position: static;
    margin: 0 -16px;
    padding: 14px 16px 12px;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .topbar h1 { flex-basis: 100%; font-size: 21px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .modal-backdrop:has(.modal-wide) { padding: 0; }
  .modal-wide { width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border: 0; }
  .modal-wide .modal-footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .cal-day { min-height: 84px; padding: 5px; }
}
@media (max-width: 600px) {
  body { font-size: 14px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .post-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .post-body { padding: 10px 12px; }
  .post-title { font-size: 14px; }
  .post-actions { padding: 8px; }
  .card { padding: 14px; }
  .calendar { padding: 10px; gap: 10px; border-radius: var(--r); }
  .cal-grid { gap: 3px; }
  .cal-dow { padding: 2px 0; font-size: 10px; letter-spacing: 0.02em; }
  .cal-day { min-height: 64px; padding: 3px; gap: 3px; border-radius: 8px; }
  .cal-date { min-width: 20px; height: 20px; padding: 0 4px; font-size: 11px; }
  .cal-post { padding: 1px 3px 1px 3px; border-left-width: 2px; font-size: 9.5px; gap: 2px; border-radius: 4px; }
  .cal-post .pill, .cal-post .chip { display: none; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .modal-wide { max-height: none; border-radius: 0; }
  .modal-header { padding: 14px 14px 12px 18px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1 1 auto; }
  .toasts { right: 12px; left: 12px; bottom: 12px; width: auto; align-items: stretch; }
  .login-card { padding: 26px 20px 22px; }
  .login-title { font-size: 25px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv > :nth-child(even) { margin-bottom: 8px; }
}
@media (max-width: 380px) {
  .main { padding: 0 12px 28px; }
  .topbar { margin: 0 -12px; padding: 12px; }
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .btn { padding: 8px 13px; }
  .seg button { padding: 6px 10px; }
}

/* ---------- 20. Motion + print preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .aurora span { animation: none !important; }
  .login-card { animation: none !important; }
  /* the spinner conveys "busy", keep it turning gently */
  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}
@media print {
  .aurora, .sidebar, .topbar, .toasts, #modal-root { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
