/* Viewport — night violet with neon that means something.
 *
 * The glow is kept, but spent where it carries information: the one primary
 * action, where you are, what state a post is in, what has focus. Everything
 * else is quiet glass, so the lit things are the things to look at. */
:root {
  --bg: #0A0713;
  --surface: rgba(24, 17, 36, 0.72);
  --surface-solid: #181124;
  --surface-2: #231833;
  --glass: rgba(24, 17, 36, 0.66);
  --border: rgba(149, 128, 255, 0.16);
  --edge-strong: rgba(168, 143, 255, 0.5);
  --accent: #9580FF;
  --accent-active: #C9BCFF;
  --accent-tint: rgba(149, 128, 255, 0.16);
  --text: #F4F0FC;
  --text-muted: #ABA2CC;
  --text-faint: #7F77A0;
  --success: #34E4A8;
  --success-bg: rgba(52, 228, 168, 0.13);
  --danger: #FF6B85;
  --danger-bg: rgba(255, 107, 133, 0.13);
  --ring-pending: #9580FF;
  --ring-posted: #34E4A8;
  --ring-failed: #FF6B85;
  --glow-neon: rgba(149, 128, 255, 0.55);
  --glow-posted: rgba(52, 228, 168, 0.45);
  --glow-failed: rgba(255, 107, 133, 0.45);
  --aurora-bg:
    radial-gradient(38% 42% at 18% 12%, rgba(196, 107, 255, 0.2), transparent 60%),
    radial-gradient(32% 38% at 82% 8%, rgba(77, 235, 209, 0.1), transparent 60%),
    radial-gradient(46% 50% at 60% 92%, rgba(139, 61, 255, 0.15), transparent 60%);
  --card-blur: blur(16px);
  --sidebar-bg: rgba(10, 7, 18, 0.72);
  --sidebar-bg-elevated: rgba(149, 128, 255, 0.14);
  --sidebar-text: #F4F0FC;
  --sidebar-text-muted: #A69DC8;
  --sidebar-border: rgba(149, 128, 255, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Cabinet Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
/* The off-screen panels sit at translateX(100%) and the aurora is wider than
   the viewport; neither may add sideways scroll. */
body { font-family: var(--font-ui); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; letter-spacing: -0.003em; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
button { font-family: inherit; }
h1, h2, h3 { text-wrap: balance; }
::selection { background: rgba(149, 128, 255, 0.35); }

/* The `hidden` attribute, made to mean it: author `display` rules outrank the
   browser's own `[hidden]`, which once left TikTok's disclosure sub-options
   visible while their question was switched off. */
[hidden] { display: none !important; }

/* ---------- Ambient background ---------- */
.aurora {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background-color: var(--bg); background-image: var(--aurora-bg);
  animation: aurora-drift 32s ease-in-out infinite alternate;
  filter: blur(60px) saturate(120%);
}
@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(-2%, 2%, 0) scale(1.04); }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Sign in ---------- */
.screen-password, .app { position: relative; z-index: 2; }
.screen-password { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: min(420px, 100%); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  background: var(--glass); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border); border-radius: 22px; padding: 36px 32px 28px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  animation: rise-in .6s var(--ease-out) both;
}
.auth-logo { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 10px 34px -8px var(--glow-neon); animation: logo-float 6s ease-in-out infinite; }
@keyframes logo-float { 50% { transform: translateY(-4px); } }
.screen-password h1 { font-family: var(--font-display); font-weight: 700; font-size: 32px; letter-spacing: -0.02em; margin: 0; }
.auth-sub { color: var(--text-muted); max-width: 34ch; margin: -4px 0 6px; font-size: 14.5px; }
.auth-title { font-size: 17px; font-weight: 600; margin: 6px 0 0; }
.auth-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.auth-form input {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.auth-form input::placeholder { color: var(--text-faint); }
.auth-form input:focus-visible { outline: none; border-color: var(--accent); background: rgba(149, 128, 255, 0.06); box-shadow: 0 0 0 3px var(--accent-tint), 0 0 18px -4px var(--glow-neon); }
.auth-form .btn-primary { margin-top: 4px; padding: 12px 16px; font-size: 15px; }
.auth-links { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.auth-links .btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.auth-links .btn-ghost:hover { background: var(--accent-tint); color: var(--text); }
.auth-note { color: var(--text-muted); max-width: 36ch; margin: 0; font-size: 14px; }
.legal-links { display: flex; gap: 16px; justify-content: center; font-size: 13px; }
.legal-links a { color: var(--text-muted); text-decoration: none; }
.legal-links a:hover { color: var(--text); text-decoration: underline; }
.legal-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.legal-links-settings { justify-content: flex-start; margin: -8px 0 18px; }
.screen-password .warning-banner { margin: 0; width: 100%; text-align: left; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; }
.view { display: none; padding: 32px 40px 56px; max-width: 1040px; }
.view.active { display: block; }
.view-enter { animation: view-in .28s var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: var(--sidebar-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--sidebar-border); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 22px 16px 16px; gap: 26px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; box-shadow: 0 6px 18px -6px var(--glow-neon); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #fff; }
.brand-sub { font-size: 12px; color: var(--sidebar-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-text-muted);
  font-size: 14.5px; font-weight: 500; cursor: pointer; border: none; background: transparent; text-align: left; width: 100%;
  position: relative; transition: color .15s var(--ease), background-color .15s var(--ease);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(149, 128, 255, 0.08); color: var(--sidebar-text); }
.nav-item.active { background: linear-gradient(90deg, var(--sidebar-bg-elevated), transparent); color: var(--sidebar-text); }
.nav-item.active svg { color: var(--accent-active); filter: drop-shadow(0 0 6px var(--glow-neon)); }
.nav-item.active::before {
  content: ''; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--glow-neon);
  animation: grow-y .3s var(--ease-out) both;
}
@keyframes grow-y { from { transform: translateY(-50%) scaleY(0); } }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 9px; padding-top: 16px; border-top: 1px solid var(--sidebar-border); }
.conn-chip { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--sidebar-text-muted); padding: 0 6px; }
.conn-chip svg { width: 14px; height: 14px; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ring-posted); flex-shrink: 0; box-shadow: 0 0 8px var(--glow-posted); }
.conn-chip.not-connected { opacity: 0.55; }
.conn-chip.not-connected .conn-dot { background: var(--text-faint); box-shadow: none; }
.conn-chip.unknown .conn-dot { background: var(--accent); box-shadow: none; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--sidebar-border); font-size: 12.5px; color: var(--sidebar-text-muted); }
.account-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-ui); }
.account-row .btn-ghost { padding: 6px 10px; font-size: 12.5px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: #fff;
  background: linear-gradient(160deg, #A794FF, #7A62F0);
  border: 1px solid rgba(201, 188, 255, 0.55); border-radius: 11px; padding: 10px 17px; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 6px 22px -6px var(--glow-neon);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 10px 30px -6px var(--glow-neon); filter: brightness(1.06); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-active); outline-offset: 2px; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-ui); font-size: 13.5px; font-weight: 500;
  color: var(--text); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 13px; cursor: pointer; transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn-ghost svg { width: 14px; height: 14px; }
.btn-ghost:hover { background: var(--accent-tint); border-color: var(--edge-strong); }
.btn-ghost:active { transform: scale(0.97); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-secondary { font-size: 13.5px; font-weight: 500; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- View header ---------- */
.view-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.view-header h1 { font-family: var(--font-display); font-weight: 700; font-size: 30px; margin: 0; letter-spacing: -0.02em; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.queue-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; line-height: 1.5;
  background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px;
}
.queue-note strong { font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 9px; }
.queue-note strong::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--glow-neon); animation: breathe 2.4s ease-in-out infinite; }
.queue-note span { color: var(--text-muted); }
@keyframes breathe { 50% { opacity: 0.45; transform: scale(0.8); } }

/* ---------- Tabs ---------- */
.filters { display: flex; gap: 24px; margin-bottom: 22px; border-bottom: 1px solid var(--border); position: relative; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { font-size: 14.5px; font-weight: 500; color: var(--text-muted); background: transparent; border: none; padding: 0 2px 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; white-space: nowrap; transition: color .15s var(--ease); }
.filter:hover { color: var(--text); }
.filter .count { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-muted); background: rgba(255, 255, 255, 0.06); border-radius: 999px; padding: 1px 8px; transition: color .15s var(--ease), background-color .15s var(--ease); }
.filter.active { color: var(--text); }
.filter.active .count { color: var(--accent-active); background: var(--accent-tint); }
.filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.tab-indicator { position: absolute; bottom: -1px; height: 2px; border-radius: 2px; left: 0; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--glow-neon); transition: left .32s var(--ease-out), width .32s var(--ease-out); }

/* ---------- Queue ---------- */
.log { display: flex; flex-direction: column; gap: 10px; }
.log-section { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 14px 0 2px; letter-spacing: 0.01em; }
.log-section:first-child { margin-top: 0; }
.log-section span { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-faint); background: rgba(255, 255, 255, 0.05); border-radius: 999px; padding: 0 8px; }
.log-empty { font-size: 15px; color: var(--text-muted); padding: 48px 16px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.log-empty strong { color: var(--accent-active); font-weight: 600; }

.card {
  display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 16px; align-items: start;
  background: var(--glass); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; position: relative;
  animation: card-rise .45s var(--ease-out) both;
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease);
}
.card:hover { border-color: var(--edge-strong); box-shadow: 0 12px 34px -16px var(--glow-neon); transform: translateY(-1px); }
@keyframes card-rise { from { opacity: 0; transform: translateY(10px); } }
.log > .card:nth-child(2), .log > :nth-child(2) { animation-delay: .04s; }
.log > :nth-child(3) { animation-delay: .08s; }
.log > :nth-child(4) { animation-delay: .12s; }
.log > :nth-child(5) { animation-delay: .16s; }
.log > :nth-child(6) { animation-delay: .2s; }
.log > :nth-child(n+7) { animation-delay: .24s; }

/* A thin bar down the left edge says the state before anything is read. */
.card::before { content: ''; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--state, transparent); box-shadow: 0 0 10px var(--state-glow, transparent); }
.card[data-status="pending"] { --state: var(--accent); --state-glow: var(--glow-neon); }
.card[data-status="posted"] { --state: var(--success); --state-glow: var(--glow-posted); }
.card[data-status="failed"], .card[data-status="partial"] { --state: var(--danger); --state-glow: var(--glow-failed); }
.card[data-status="cancelled"] { opacity: 0.62; }

.thumb { width: 58px; height: 76px; border-radius: 10px; flex-shrink: 0; background: linear-gradient(155deg, var(--accent-tint), var(--surface-2) 65%); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb svg { width: 22px; height: 22px; color: var(--text-faint); }
.thumb video, .thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.card-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.card-time { font-size: 13.5px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.card-rel { font-size: 13px; color: var(--text-muted); }
.caption { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: 999px; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status.pending { color: var(--accent-active); background: var(--accent-tint); }
.status.pending::before { background: var(--accent); box-shadow: 0 0 8px var(--glow-neon); animation: breathe 2.4s ease-in-out infinite; }
.status.posted { color: var(--success); background: var(--success-bg); }
.status.posted::before { background: var(--success); box-shadow: 0 0 8px var(--glow-posted); }
.status.partial, .status.failed { color: var(--danger); background: var(--danger-bg); }
.status.partial::before, .status.failed::before { background: var(--danger); box-shadow: 0 0 8px var(--glow-failed); }
.status.cancelled { color: var(--text-muted); background: rgba(255, 255, 255, 0.05); }
.status.cancelled::before { background: var(--text-faint); }

.platforms { display: flex; gap: 6px; }
.ring { position: relative; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: transparent; border: none; padding: 0; font-family: inherit; transition: transform .15s var(--ease), background-color .15s var(--ease); }
.ring svg { width: 15px; height: 15px; position: relative; z-index: 2; }
.ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--ring-color); z-index: 1; }
.ring.pending { --ring-color: var(--ring-pending); color: var(--ring-pending); cursor: default; }
.ring.pending::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--ring-pending); box-shadow: 0 0 10px var(--glow-neon); animation: ring-pulse 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.ring.posted { --ring-color: var(--ring-posted); color: var(--ring-posted); background: var(--success-bg); cursor: default; box-shadow: 0 0 12px -3px var(--glow-posted); }
.ring.failed { --ring-color: var(--ring-failed); color: var(--ring-failed); background: var(--danger-bg); cursor: pointer; box-shadow: 0 0 12px -3px var(--glow-failed); }
button.ring.failed:hover { transform: scale(1.08); }
button.ring.failed::after { content: '↻'; position: absolute; right: -4px; bottom: -4px; z-index: 3; width: 15px; height: 15px; border-radius: 50%; font-size: 10px; line-height: 15px; text-align: center; background: var(--danger); color: #1A0710; font-weight: 700; }
.ring.failed:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ring.cancelled { --ring-color: var(--text-faint); color: var(--text-faint); cursor: default; }
@keyframes ring-pulse { 0% { transform: scale(0.85); opacity: 0.7; } 70% { transform: scale(1.25); opacity: 0; } 100% { transform: scale(1.25); opacity: 0; } }

.cancel-slot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cancel-slot .btn-ghost { padding: 6px 12px; font-size: 13px; }
.cancel-ask { font-size: 13px; color: var(--text-muted); }
.cancel-slot .cancel-yes { color: var(--danger); border-color: rgba(255, 107, 133, 0.35); }
.cancel-slot .cancel-yes:hover { background: var(--danger-bg); border-color: var(--danger); }

/* Each reason on its own line, whole: a reason cut off mid-sentence is not
   a reason. Errors carry their platform's icon so the eye pairs them with the
   red ring above. */
.card-notes { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.note { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; line-height: 1.45; border-radius: 10px; padding: 8px 11px; overflow-wrap: anywhere; }
.note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 2px; }
.note strong { font-weight: 600; }
.note-error { color: #FFC2CD; background: var(--danger-bg); border: 1px solid rgba(255, 107, 133, 0.22); }
.note-error svg { color: var(--danger); }
.note-wait { color: var(--accent-active); background: var(--accent-tint); border: 1px solid var(--border); }
.note-info { color: var(--text-muted); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); }
/* Used when a cancel is refused - the post went out meanwhile. */
.error-note { font-size: 13px; color: var(--danger); }

/* Loading: the shape of what is coming, shimmering. */
.card-skeleton { animation: none; }
.card-skeleton .thumb { background: var(--surface-2); }
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(149,128,255,0.12) 50%, rgba(255,255,255,0.04) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk-short { width: 32%; }
.sk-mid { width: 58%; }
.card-skeleton .card-body { gap: 12px; padding-top: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* A post that just went out lights up where it is, so the change is seen
   rather than inferred from a count. */
.card.just-posted { animation: card-rise .45s var(--ease-out) both, lit-posted 1.8s var(--ease) .1s both; }
.card.just-posted .ring.posted { animation: ring-pop .6s var(--ease-out) both; }
.card.just-posted .status { animation: ring-pop .5s var(--ease-out) .1s both; }
.card.just-failed, .card.just-partial { animation: card-rise .45s var(--ease-out) both, lit-failed 1.8s var(--ease) .1s both; }
@keyframes lit-posted { 0% { box-shadow: 0 0 0 1px var(--success), 0 0 40px -6px var(--glow-posted); border-color: var(--success); } 100% { box-shadow: none; } }
@keyframes lit-failed { 0% { box-shadow: 0 0 0 1px var(--danger), 0 0 40px -6px var(--glow-failed); border-color: var(--danger); } 100% { box-shadow: none; } }
@keyframes ring-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ---------- Slide-over panel (composer, post detail) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(6, 3, 12, 0.6); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); z-index: 20; }
.scrim.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw; z-index: 21; display: flex; flex-direction: column;
  background: rgba(18, 12, 28, 0.9); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--edge-strong); box-shadow: -30px 0 80px -20px rgba(0, 0, 0, 0.7), -1px 0 24px -12px var(--glow-neon);
  transform: translateX(100%); transition: transform .45s var(--ease-out);
}
.panel.open { transform: translateX(0); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.panel-close { width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer; transition: color .15s var(--ease), background-color .15s var(--ease), transform .2s var(--ease); }
.panel-close:hover { color: var(--text); background: var(--accent-tint); transform: rotate(90deg); }
.panel-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.panel-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.panel-footer { padding: 16px 24px 22px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 10px; }

.step-forward { animation: step-in-right .32s var(--ease-out) both; }
.step-back { animation: step-in-left .32s var(--ease-out) both; }
@keyframes step-in-right { from { opacity: 0; transform: translateX(18px); } }
@keyframes step-in-left { from { opacity: 0; transform: translateX(-18px); } }

.composer-steps { display: flex; padding: 16px 24px 0; gap: 6px; }
.step { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.step-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); position: relative; overflow: hidden; }
.step-bar::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--accent); box-shadow: 0 0 10px var(--glow-neon); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease-out); }
.step.done .step-bar::after, .step.active .step-bar::after { transform: scaleX(1); }
.step-label { font-size: 12.5px; font-weight: 500; color: var(--text-faint); transition: color .2s var(--ease); }
.step.done .step-label { color: var(--text-muted); }
.step.active .step-label { color: var(--accent-active); font-weight: 600; }

/* ---------- Forms ---------- */
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.draft-section { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 4px; }
.draft-section:first-of-type { border-top: 0; padding-top: 0; }
.draft-scope { font-size: 13px; color: var(--text-muted); margin: -4px 0 10px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.field {
  width: 100%; font-family: var(--font-ui); font-size: 15px; color: var(--text); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border); border-radius: 11px; padding: 11px 13px; margin-bottom: 20px; resize: vertical;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.field:focus-visible { outline: none; border-color: var(--accent); background: rgba(149, 128, 255, 0.06); box-shadow: 0 0 0 3px var(--accent-tint), 0 0 18px -6px var(--glow-neon); }
select.field { cursor: pointer; }
.field option { background: var(--surface-solid); }

.dropzone {
  border: 1.5px dashed var(--edge-strong); border-radius: var(--radius); padding: 40px 18px; text-align: center; color: var(--text-muted);
  font-size: 15px; margin-bottom: 16px; cursor: pointer; background: rgba(149, 128, 255, 0.04);
  transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.dropzone.dragover, .dropzone:hover { border-color: var(--accent); color: var(--text); background: var(--accent-tint); box-shadow: 0 0 34px -10px var(--glow-neon) inset; transform: translateY(-1px); }
.dropzone.dragover { transform: scale(1.01); }
.dropzone strong { color: var(--accent-active); font-weight: 600; }
.upload-progress { font-size: 13.5px; color: var(--text-muted); margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.warning-banner { background: var(--danger-bg); border: 1px solid rgba(255, 107, 133, 0.3); color: #FFC2CD; padding: 11px 13px; border-radius: 11px; font-size: 14px; margin-bottom: 16px; animation: rise-in .3s var(--ease-out) both; }

/* Wraps rather than squeezing; min-width:0 lets the boxes shrink below their label. */
.platform-toggles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.toggle {
  flex: 1 1 120px; min-width: 0; display: flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
  border-radius: 12px; padding: 10px 11px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: border-color .15s var(--ease), box-shadow .2s var(--ease), background-color .15s var(--ease), transform .1s var(--ease);
}
.toggle:active { transform: scale(0.98); }
.toggle svg { width: 16px; height: 16px; flex-shrink: 0; }
.toggle input { margin: 0; flex-shrink: 0; accent-color: var(--accent); }
.toggle.on { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-active); box-shadow: 0 0 16px -5px var(--glow-neon); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- Analytics ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-tile { background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; animation: card-rise .45s var(--ease-out) both; }
.stat-tile:nth-child(2) { animation-delay: .06s; }
.stat-tile:nth-child(3) { animation-delay: .12s; }
.stat-tile:nth-child(4) { animation-delay: .18s; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 32px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: 13px; color: var(--success); }

.stat-tile.gate { position: relative; padding-left: 20px; gap: 6px; overflow: hidden; }
.stat-tile.gate::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gate-color); box-shadow: 0 0 12px var(--gate-color); }
.stat-tile.gate.pass { --gate-color: var(--success); }
.stat-tile.gate.warn { --gate-color: var(--accent); }
.stat-tile.gate.fail { --gate-color: var(--danger); }
.stat-tile.gate.nodata { --gate-color: var(--border); }
.stat-tile.gate .stat-value { color: var(--gate-color); text-shadow: 0 0 22px color-mix(in srgb, var(--gate-color) 45%, transparent); }
.stat-tile.gate.nodata .stat-value { color: var(--text-muted); text-shadow: none; }
.gate-unit { font-family: var(--font-ui); font-size: 15px; font-weight: 600; margin-left: 2px; }
.gate-nodata { font-size: 24px; }
.gate-scale { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-muted); padding-top: 8px; border-top: 1px solid var(--border); }
.gate-scale strong { color: var(--text); font-weight: 600; }
.gate-note { font-size: 12px; line-height: 1.4; color: var(--text-muted); }

.video-card { position: relative; overflow: hidden; }
.video-card.vc-strong, .video-card.vc-mixed, .video-card.vc-weak { padding-left: 18px; }
.video-card.vc-strong::before, .video-card.vc-mixed::before, .video-card.vc-weak::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--verdict); box-shadow: 0 0 12px var(--verdict); }
.video-card.vc-strong { --verdict: var(--success); border-color: rgba(52, 228, 168, 0.3); }
.video-card.vc-mixed { --verdict: var(--accent); }
.video-card.vc-weak { --verdict: var(--danger); border-color: rgba(255, 107, 133, 0.28); }
.video-card.vc-strong:hover { border-color: var(--success); box-shadow: 0 12px 30px -16px var(--glow-posted); }
.video-card.vc-weak:hover { border-color: var(--danger); box-shadow: 0 12px 30px -16px var(--glow-failed); }

.score-block { display: flex; flex-direction: column; gap: 7px; padding-top: 14px; border-top: 1px solid var(--border); margin-bottom: 18px; }
.score-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline; font-size: 13.5px; color: var(--text-muted); padding-left: 14px; position: relative; }
.score-row::before { content: ''; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; border-radius: 50%; }
.score-row.ok::before { background: var(--success); box-shadow: 0 0 6px var(--glow-posted); }
.score-row.bad::before { background: var(--danger); box-shadow: 0 0 6px var(--glow-failed); }
.score-row strong { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.score-row.ok strong { color: var(--success); }
.score-row.bad strong { color: var(--danger); }
.score-row em { font-style: normal; font-size: 12px; color: var(--text-muted); }

.signal-trend { background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 26px; }
.trend-heading { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 16px; }
.trend-row { margin-bottom: 14px; }
.trend-row:last-child { margin-bottom: 0; }
.trend-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; color: var(--text-muted); margin-bottom: 6px; }
.trend-top strong { font-size: 16px; color: var(--text); font-weight: 600; font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.trend-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.trend-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #7A62F0, #B4A4FF); box-shadow: 0 0 12px var(--glow-neon); transform-origin: left; animation: bar-grow .9s var(--ease-out) both; }
.trend-row:nth-of-type(2) .trend-bar i { animation-delay: .1s; }
.trend-row:nth-of-type(3) .trend-bar i { animation-delay: .2s; }
@keyframes bar-grow { from { transform: scaleX(0); } }
.trend-sub { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 5px; font-family: var(--font-ui); }
.vc-zero strong { color: var(--danger); }
.spark { width: 100%; height: 32px; margin-top: 4px; }

.grid-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.grid-count { font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--text-muted); }
.grid-sorts { display: flex; gap: 4px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 11px; padding: 3px; }
.grid-sort { font-size: 13px; font-weight: 500; color: var(--text-muted); background: transparent; border: 0; border-radius: 8px; padding: 6px 11px; cursor: pointer; transition: color .15s var(--ease), background-color .15s var(--ease); }
.grid-sort:hover { color: var(--text); }
.grid-sort.active { color: var(--text); background: var(--accent-tint); box-shadow: 0 0 0 1px var(--border) inset; }
.grid-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid-more { display: block; margin: 16px auto 0; }
.video-grid-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.video-card {
  background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; display: flex; gap: 13px; cursor: pointer; text-align: left; font-family: inherit; color: inherit;
  animation: card-rise .45s var(--ease-out) both; transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease);
}
.video-card:hover { border-color: var(--edge-strong); transform: translateY(-2px); box-shadow: 0 12px 30px -16px var(--glow-neon); }
.video-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.video-card .thumb { width: 50px; height: 66px; }
.video-card .vc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.video-card .vc-platform { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.video-card .vc-platform svg { width: 12px; height: 12px; }
.video-card .vc-caption { font-size: 14px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.video-card .vc-stats { display: flex; gap: 14px; margin-top: auto; }
.video-card .vc-stat { font-size: 13px; color: var(--text-muted); font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
.video-card .vc-stat strong { color: var(--text); font-weight: 600; }
.vc-chip { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; color: var(--text-muted); background: rgba(255, 255, 255, 0.06); }
.vc-chip svg { width: 12px; height: 12px; }
.vc-chip.strong { color: var(--success); background: var(--success-bg); }
.vc-chip.weak { color: var(--danger); background: var(--danger-bg); }
.vc-chip.mixed { color: var(--accent-active); background: var(--accent-tint); }

.detail-thumb { width: 100%; aspect-ratio: 9/16; max-height: 240px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; overflow: hidden; }
.detail-thumb svg { width: 32px; height: 32px; color: var(--text-faint); }
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-stat { text-align: center; margin-bottom: 22px; padding: 18px; background: var(--accent-tint); border: 1px solid var(--border); border-radius: var(--radius); }
.hero-stat .stat-label { color: var(--accent-active); }
.hero-stat .stat-value { font-size: 38px; color: #fff; text-shadow: 0 0 26px var(--glow-neon); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.detail-stat { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.detail-stat .stat-label { font-size: 12px; }
.detail-stat .stat-value { font-size: 20px; font-family: var(--font-ui); }
.detail-extra { display: flex; flex-direction: column; gap: 9px; padding-top: 14px; border-top: 1px solid var(--border); margin-bottom: 16px; }
.detail-extra-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--text-muted); }
.detail-extra-row strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-link { font-size: 14px; color: var(--accent-active); text-decoration: none; font-weight: 500; }
.detail-link:hover { text-decoration: underline; }
.detail-reach { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.detail-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-tab { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px; cursor: pointer; transition: color .15s var(--ease), border-color .15s var(--ease); }
.detail-tab svg { width: 13px; height: 13px; }
.detail-tab em { font-style: normal; opacity: 0.75; }
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--text); border-color: var(--edge-strong); background: var(--accent-tint); }
.detail-tab.strong.active { border-color: var(--success); }
.detail-tab.weak.active { border-color: var(--danger); }
.detail-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Freshness ---------- */
.freshness { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.fresh-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fresh-dot.fresh { background: var(--success); box-shadow: 0 0 10px var(--glow-posted); animation: breathe 2.8s ease-in-out infinite; }
.fresh-dot.aging { background: var(--accent); }
.fresh-dot.stale { background: var(--danger); box-shadow: 0 0 10px var(--glow-failed); }
.fresh-text { font-size: 13.5px; font-weight: 500; color: var(--text-muted); }
.fresh-note { font-size: 13px; color: var(--text-muted); opacity: 0.85; }
.fresh-refresh { margin-left: auto; }
.fresh-refresh[disabled] { opacity: 0.5; cursor: default; }
/* A platform that stopped syncing while the others did not: its own line,
   because the badge above it is still green. */
.fresh-warn { flex: 0 0 100%; margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: #FFC2CD; background: var(--danger-bg); border: 1px solid rgba(255, 107, 133, 0.22); border-radius: 11px; padding: 9px 12px; }
.trend-warn { margin: -6px 0 14px; font-size: 13px; color: var(--danger); font-family: var(--font-ui); }
.rate-step { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Insights ---------- */
.insight-summary { background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 24px; animation: card-rise .45s var(--ease-out) both; }
.insight-summary .stat-label { margin-bottom: 8px; display: block; }
.insight-summary p { margin: 0; font-size: 15.5px; line-height: 1.65; color: var(--text); max-width: 68ch; }
.insight-summary p + p { margin-top: 10px; }
.insight-empty { font-size: 15px; color: var(--text-muted); padding: 48px 16px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.insight-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
.insight-col { background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; animation: card-rise .45s var(--ease-out) .06s both; }
.insight-col h3 { margin: 0 0 14px; font-family: var(--font-display); font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.insight-col h3::before { content: ''; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.insight-col.working h3::before { background: var(--success); box-shadow: 0 0 10px var(--glow-posted); }
.insight-col.watch h3::before { background: var(--danger); box-shadow: 0 0 10px var(--glow-failed); }
.insight-col ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.insight-col li { font-size: 14.5px; line-height: 1.55; color: var(--text); padding-left: 15px; position: relative; }
.insight-col li::before { content: '–'; position: absolute; left: 0; color: var(--text-faint); }
.insight-col li .evidence { display: block; font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.ideas-heading { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin: 0 0 12px; }
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.idea-card { background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 7px; animation: card-rise .45s var(--ease-out) .12s both; transition: border-color .2s var(--ease), transform .2s var(--ease); }
.idea-card:hover { border-color: var(--edge-strong); transform: translateY(-2px); }
.idea-card .idea-title { font-weight: 600; font-size: 15px; }
.idea-card .idea-why { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.idea-card .idea-tag { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--accent-active); background: var(--accent-tint); border-radius: 999px; padding: 2px 9px; margin-top: 2px; }

/* ---------- TikTok posting options ---------- */
.tt-panel { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; animation: rise-in .35s var(--ease-out) both; }
.tt-account { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-muted); padding-bottom: 13px; margin-bottom: 13px; border-bottom: 1px solid var(--border); }
.tt-account img { width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent-tint); }
.tt-account strong { color: var(--text); font-weight: 600; }
.tt-panel .field { margin-bottom: 0; }
.tt-checks { display: flex; flex-direction: column; gap: 9px; }
.tt-check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--text); cursor: pointer; }
.tt-check input { margin: 0; }
.tt-check.disabled { color: var(--text-faint); cursor: not-allowed; }
.tt-check em { font-style: normal; font-size: 12.5px; color: var(--text-muted); }
/* The commercial-content question and the two answers it opens, indented and
   ruled so the pair reads as belonging to it. */
.tt-check-lead { align-items: flex-start; margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--border); }
.tt-check-lead input { margin-top: 3px; }
.tt-sub { margin: 10px 0 0 10px; padding-left: 13px; border-left: 2px solid var(--border); animation: rise-in .25s var(--ease-out) both; }
/* TikTok's own label wording; the audit checks it verbatim. */
.tt-label { font-size: 14px; font-weight: 600; color: var(--accent-active); background: var(--accent-tint); border-radius: 10px; padding: 9px 12px; margin: 12px 0 0; animation: rise-in .25s var(--ease-out) both; }
/* Publishing is not instant, and the audit expects that said. */
.tt-terms { flex: 0 0 100%; display: flex; flex-direction: column; gap: 4px; }
.tt-processing { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); margin: 0; }
.tt-terms .tt-disclosure { font-size: 12.5px; line-height: 1.45; margin: 0; padding-top: 0; border-top: 0; }
/* A choice and TikTok's one-line explanation of it. */
.tt-check-hint { align-items: flex-start; }
.tt-check-hint input { margin-top: 3px; }
.tt-check-name { display: block; }
.tt-hint { display: block; font-size: 12.5px; line-height: 1.4; color: var(--text-muted); margin-top: 1px; }
.tt-check.disabled .tt-hint { color: var(--text-faint); }
.tt-note { font-size: 12.5px; line-height: 1.4; color: var(--accent-active); margin: 6px 0 0; }
.tt-sub .tt-note { margin: -3px 0 0 26px; }
/* The post as TikTok gets it, kept short so the choices below stay in view. */
.tt-preview { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: start; margin-bottom: 14px; }
.tt-preview-video { width: 90px; aspect-ratio: 9 / 16; border-radius: 8px; background: #000; border: 1px solid var(--border); object-fit: cover; }
.tt-preview-text { min-width: 0; }
.tt-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.tt-preview-edit { background: none; border: 0; padding: 2px 4px; font: inherit; font-size: 12.5px; color: var(--accent-active); cursor: pointer; border-radius: 6px; }
.tt-preview-edit:hover { background: var(--accent-tint); }
.tt-preview-edit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tt-preview-caption { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 76px; overflow-y: auto; }
.tt-preview-caption em { color: var(--text-muted); }
.tt-disclosure { font-size: 13px; line-height: 1.5; color: var(--text-muted); margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.tt-disclosure a { color: var(--accent-active); }
.tt-loading { font-size: 14px; color: var(--text-muted); margin: 0 0 20px; line-height: 1.5; }

/* ---------- Pre-publish preview ---------- */
/* TikTok requires the content be seen before it is sent; it is also the only
   place all three captions are visible together. */
#composer-preview:not(:empty) { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.preview-shell { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: start; }
.preview-video { width: 100%; max-width: 100%; aspect-ratio: 9 / 16; border-radius: 12px; background: #000; border: 1px solid var(--border); box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.9); }
.preview-cards { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.preview-card { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; min-width: 0; }
.preview-card header { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; }
.preview-card header svg { width: 14px; height: 14px; flex-shrink: 0; }
.preview-title { display: block; font-size: 14.5px; line-height: 1.4; margin-bottom: 5px; }
.preview-body { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 140px; overflow-y: auto; }

/* ---------- Why the publish button is off ---------- */
/* Full width above the button: each entry is one thing to do. */
.blocker-list { flex: 0 0 100%; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.blocker-list li { display: flex; align-items: center; gap: 9px; font-size: 14px; line-height: 1.45; color: var(--accent-active); background: var(--accent-tint); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; animation: rise-in .25s var(--ease-out) both; }
.blocker-list li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--glow-neon); flex-shrink: 0; }

/* ---------- Settings ---------- */
.settings-heading { font-family: var(--font-display); font-weight: 700; font-size: 19px; margin: 0 0 6px; }
.settings-intro { font-size: 15px; color: var(--text-muted); line-height: 1.55; margin: 0 0 18px; max-width: 62ch; }
.settings-accounts { display: flex; flex-direction: column; gap: 10px; max-width: 660px; }
.setting-row { display: flex; align-items: center; gap: 14px; background: var(--surface); backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 17px; animation: card-rise .45s var(--ease-out) both; }
.setting-row:nth-child(2) { animation-delay: .05s; }
.setting-row:nth-child(3) { animation-delay: .1s; }
.setting-icon { display: flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 11px; background: rgba(255, 255, 255, 0.05); color: var(--text-muted); flex-shrink: 0; }
.setting-icon svg { width: 18px; height: 18px; }
.setting-row.connected .setting-icon { color: var(--success); background: var(--success-bg); box-shadow: 0 0 16px -6px var(--glow-posted); }
.setting-row.expired .setting-icon { color: var(--danger); background: var(--danger-bg); }
.setting-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.setting-text strong { font-size: 15px; font-weight: 600; }
.setting-status { font-size: 13.5px; color: var(--text-muted); }
.setting-row.connected .setting-status { color: var(--success); }
.setting-row.expired .setting-status { color: var(--danger); }
/* The way in when the login window did not open, and back when it was closed. */
.setting-manual { font-size: 13.5px; color: var(--accent-active); margin-top: 4px; }
.setting-manual:hover { color: var(--text); }
.setting-note { font-size: 13px; color: var(--text-muted); text-align: right; max-width: 190px; line-height: 1.45; }
.setting-action { flex-shrink: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(380px, calc(100vw - 32px));
  font-size: 14.5px; font-weight: 500; color: var(--text); padding: 12px 16px; border-radius: 13px;
  background: rgba(24, 17, 36, 0.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--edge-strong); box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.9), 0 0 24px -10px var(--glow-neon);
  animation: toast-in .4s var(--ease-out) both;
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--glow-neon); flex-shrink: 0; }
.toast-success { border-color: rgba(52, 228, 168, 0.45); box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.9), 0 0 24px -10px var(--glow-posted); }
.toast-success::before { background: var(--success); box-shadow: 0 0 10px var(--glow-posted); }
.toast-error { border-color: rgba(255, 107, 133, 0.45); }
.toast-error::before { background: var(--danger); box-shadow: 0 0 10px var(--glow-failed); }
.toast-leave { animation: toast-out .3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Narrow screens ---------- */
@media (max-width: 780px) {
  .insight-columns { grid-template-columns: 1fr; }
  .view { padding: 24px 20px 48px; }
}

/* On a phone the app reads like one: a slim header with the account, the
   page, and the four sections on a bar under the thumb. */
@media (max-width: 680px) {
  .app { flex-direction: column; }
  /* No backdrop-filter here: it would make this bar the containing block of
     the fixed tab bar below, pinning the tabs to the top instead of the screen. */
  .sidebar {
    position: sticky; top: 0; z-index: 10; width: 100%; height: auto; flex-direction: row; align-items: center; justify-content: space-between;
    padding: 10px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--sidebar-border);
    background: rgba(10, 7, 18, 0.94); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .brand { padding: 0; }
  .brand-sub, .sidebar-bottom { display: none; }
  .account-row { border-top: 0; padding: 0; }
  .account-row span { display: none; }
  .nav {
    position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 15;
    flex-direction: row; justify-content: space-around; gap: 2px; padding: 6px;
    background: rgba(16, 11, 26, 0.88); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.9);
  }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; padding: 8px 4px; font-size: 11.5px; text-align: center; justify-content: center; }
  .nav-item svg { width: 20px; height: 20px; }
  .nav-item.active { background: var(--sidebar-bg-elevated); }
  .nav-item.active::before { left: 50%; top: -6px; width: 22px; height: 3px; transform: translateX(-50%); animation: none; }
  .main { padding-bottom: 92px; }
  .view { padding: 20px 16px 24px; }
  .view-header h1 { font-size: 26px; }
  .card { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 12px 13px; }
  .thumb { width: 48px; height: 64px; }
  .caption { font-size: 14.5px; }
  .queue-note { font-size: 13.5px; }
  .filters { gap: 14px; }
  .filter { font-size: 14px; gap: 6px; }
  .panel { width: 100%; }
  .toasts { left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); align-items: stretch; }
  .setting-row { flex-wrap: wrap; }
  .setting-note, .setting-action { margin-left: auto; }
  .stat-value { font-size: 28px; }
}

@media (max-width: 560px) {
  .preview-shell { grid-template-columns: 1fr; }
  .preview-video { max-width: 190px; }
}

/* Anyone who asked their system for less motion gets the final state of
   every animation, immediately. */
@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; }
}
