.nav-section { margin-top:10px; min-width:0; }
.nav-section-toggle { width:100%; display:flex; justify-content:space-between; align-items:center; gap:8px; background:transparent; color:var(--text); border:0; border-radius:8px; padding:12px 10px; font:inherit; font-size:14px; font-weight:600; line-height:1.3; cursor:pointer; text-align:left; }
.nav-section-toggle:hover, .nav-section-toggle:focus-visible { background:var(--accent-wash); }
.nav-section-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.nav-section-chevron { width:14px; height:14px; flex-shrink:0; color:var(--muted); }
.nav-section-toggle[aria-expanded="false"] .nav-section-chevron { transform:rotate(-90deg); }
.nav-section-links { display:grid; gap:3px; margin-left:10px; padding-left:10px; border-left:1px solid var(--border); }
.nav a.nav-ready { border:1px solid rgba(92,158,255,.25); }
.handoff-files { display:grid; gap:8px; }
.handoff-file { display:flex; gap:8px; align-items:center; justify-content:space-between; overflow-wrap:anywhere; }
.handoff-tags { display:flex; flex-wrap:wrap; gap:6px; }
.handoff-form textarea { min-height:140px; }
.handoff-form progress, #submission-progress progress { display:block; width:100%; accent-color:var(--accent); }
.production-card.changes-requested { border-color:#e9b75a; }
.production-deliverable { max-width:100%; max-height:240px; object-fit:contain; }
@media (max-width:720px) {
  .nav-section { min-width:150px; }
  .nav-section-toggle { min-height:44px; }
  .handoff-file { flex-wrap:wrap; }
  .production-tabs { overflow-x:auto; flex-wrap:nowrap; }
  .production-tabs .btn { flex-shrink:0; }
  .production-file .row-actions { flex-wrap:wrap; }
}
:root {
  --bg: #0b0d0b;
  --canvas: #0b0d0b;
  --sidebar: #141714;
  --card: #111318;
  --inset: #0c0e0c;
  --border: #2a2e2a;
  --border-soft: #1c201c;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-wash: rgba(59, 130, 246, 0.16);
  --hit: #e8c36a;
  --hit-wash: rgba(232, 195, 106, 0.16);
  --text: #e8eadf;
  --muted: #8b9084;
  --muted-2: #6a6f66;
  --danger: #d4786a;
  --danger-wash: rgba(212, 120, 106, 0.14);
  --mid: #c4b48a;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 240px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* The HTML hidden attribute must win over component display declarations. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

.auth-root:empty { display: none; }
.auth-root {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 18%, rgba(59,130,246,.13), transparent 38%), var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 24px 70px rgba(0,0,0,.36);
}
.auth-card h1 { margin: 0 0 6px; font-size: 25px; }
.auth-card p { margin: 0 0 22px; color: var(--muted); }
.auth-card form { display: grid; gap: 14px; }
.auth-card .btn { justify-content: center; margin-top: 4px; }
.auth-error { color: var(--danger); min-height: 20px; margin-top: 12px; }
.auth-cli-note { display: grid; gap: 10px; color: var(--muted); }
.auth-cli-note code { padding: 12px; border-radius: var(--radius-sm); background: var(--inset); color: var(--text); overflow-wrap: anywhere; }
.auth-logout { margin-top: 8px; width: 100%; }
.auth-account { margin-top: 8px; width: 100%; }
#auth-user-label { overflow-wrap: anywhere; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.google-button { min-height: 44px; display: flex; justify-content: center; }
.account-method { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.account-method:last-child { border-bottom: 0; }

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}
.mark {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  border-radius: 6px;
}
.brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.channel-block { padding: 0 4px; }
.field-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.select, .input, textarea.input {
  width: 100%;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  outline: none;
}
.select { color-scheme: dark; }
.select:focus, .input:focus, textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}
.channel-switcher { position: relative; }
.channel-pick-wrap { display: flex; gap: 6px; align-items: stretch; }
.channel-pick {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
}
.channel-pick:hover { border-color: #3d433d; }
.channel-pick-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-chevron { width:16px; height:16px; margin-left:auto; flex-shrink:0; }
.mobile-header, .mobile-nav-close, .mobile-nav-backdrop { display:none; }
.channel-pick-del {
  flex-shrink: 0;
  border: 1px solid #5a3530;
  background: transparent;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}
.channel-pick-del:hover { background: var(--danger-wash); }
.channel-pick-del[hidden] { display: none !important; }
.avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  background: #1a1e1a;
  flex-shrink: 0;
}
.channel-menu {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 20;
  background: #101310;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  max-height: 320px;
  overflow-y: auto;
  display: grid;
  gap: 2px;
}
.channel-menu[hidden] { display: none !important; }
.channel-row-opt {
  display: flex;
  align-items: center;
  gap: 2px;
}
.channel-avatar-placeholder {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-wash);
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 700;
}
.channel-avatar-placeholder[hidden] { display: none !important; }
.channel-option {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 7px 8px;
  border-radius: 8px;
  text-align: left;
  font-size: 13px;
}
.channel-option:hover, .channel-option.on { background: var(--accent-wash); color: var(--accent); }
.channel-del, .channel-profile-retry {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted-2);
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}
.channel-del:hover { background: var(--danger-wash); color: var(--danger); }
.channel-profile-retry { color: #93c5fd; border: 1px solid rgba(59,130,246,.45); background: var(--accent-wash); }
.channel-row-opt:not(.avatar-missing) .channel-profile-retry { display: none; }
.channel-profile-retry:hover { background: rgba(59,130,246,.3); color: #dbeafe; }
.channel-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}
.channel-add-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: 1px dashed #3b4f7a;
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.channel-add-option:hover { background: var(--accent-wash); }
.add-panel { margin-top: 4px; display: grid; gap: 8px; padding: 4px; }
.add-panel[hidden] { display: none !important; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
}
.nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav a.active {
  background: var(--accent-wash);
  color: var(--accent);
}
.nav a .count {
  margin-left: auto;
  font-style: normal;
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--mono);
}
.nav a.active .count { color: var(--accent-hover); }
.nav a .count:empty { display: none; }

.sidebar-foot {
  padding: 10px 8px 4px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 2px;
}
.sidebar-foot span {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.sidebar-foot strong {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}

/* ----- Main ----- */
.main {
  background: var(--canvas);
  min-width: 0;
  padding: 28px 36px 56px;
}
.page-head { margin-bottom: 22px; }
.crumb {
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.crumb span { color: var(--muted); }
.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.title-row h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 52ch;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.2;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #f8fafc;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: #3d433d; background: rgba(255,255,255,0.03); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: #5a3530;
}
.btn-sm { padding: 5px 11px; font-size: 12px; font-weight: 500; }
.btn-block { width: 100%; }

/* ----- Cards / stats ----- */
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 12px;
  min-height: 108px;
}
.stat .spark {
  display: block;
  width: 100%;
  height: 28px;
  margin-top: 10px;
  color: var(--accent);
  opacity: 0.85;
}
.stat .num {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.stat .lbl {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card h3 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-bottom: 14px;
}

/* ----- Table ----- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
table.data tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
table.data tbody tr:hover { background: rgba(59, 130, 246, 0.06); }
table.data .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data a.url { color: var(--muted); }
table.data a.url:hover { color: var(--accent); }

/* ----- Chips / filters ----- */
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
}
.chip-live { background: var(--accent-wash); color: var(--accent); }
.chip-frozen { background: rgba(255,255,255,0.05); color: var(--muted); }
.chip-hit { background: var(--hit-wash); color: var(--hit); }
.chip-mid { background: rgba(196,180,138,0.14); color: var(--mid); }
.chip-weak { background: var(--danger-wash); color: var(--danger); }
.chip-idea { background: rgba(255,255,255,0.06); color: var(--muted); }
.chip-sent { background: var(--accent-wash); color: var(--accent); }
.chip-active { background: var(--accent-wash); color: var(--accent); }
.chip-exhausted { background: var(--danger-wash); color: var(--danger); }
.chip-error { background: var(--danger-wash); color: var(--danger); }
.chip-disabled { background: rgba(255,255,255,0.05); color: var(--muted); }
.chip-posted { background: var(--accent-wash); color: var(--accent); }
.chip-killed { background: var(--danger-wash); color: var(--danger); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filters-row .filters { margin-bottom: 0; }
.view-toggle { display: flex; gap: 6px; }
.filter-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
}
.filter-chip.on {
  background: var(--accent-wash);
  color: var(--accent);
  border-color: transparent;
}

/* ----- Ideas / pipeline cards ----- */
.idea-list, .pipe-list { display: grid; gap: 10px; }
.idea-card, .pipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.idea-card h4, .pipe-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.idea-card .brief, .pipe-card .brief {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--muted-2);
  font-size: 12px;
}
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ----- Chart ----- */
.bar-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.bar-row .lab { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: #1a1e1a; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; opacity: 0.85; }
.bar-row .val { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.attn-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.attn-item:last-child { border-bottom: none; }
.attn-item .k { color: var(--text); }
.attn-item .v { color: var(--muted); font-size: 12px; }
.attn-empty { color: var(--muted-2); font-size: 13px; }

/* ----- Settings ----- */
.settings-stack { display: grid; gap: 14px; max-width: 760px; }
.form-grid { display: grid; gap: 12px; }
.form-grid label span, .field > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.channel-row:last-child { border-bottom: none; }
.token-row {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.token-row:last-child { border-bottom: none; }
.token-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.token-secret { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }

/* ----- Empty / pick channel ----- */
.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  color: var(--muted);
}
.empty h3 { color: var(--text); margin: 0 0 8px; font-size: 18px; text-transform: none; letter-spacing: -0.02em; }

/* ----- Drawer / modal ----- */
.drawer-root, .modal-root {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}
.drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  background: #101310;
  border-left: 1px solid var(--border);
  padding: 24px 22px 32px;
  overflow: auto;
}
.modal {
  --modal-gap: clamp(12px, 6vh, 48px);
  position: relative;
  margin: var(--modal-gap) auto;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100vh - var(--modal-gap) - var(--modal-gap));
  max-height: calc(100dvh - var(--modal-gap) - var(--modal-gap));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background: #101310;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 22px 20px;
  z-index: 1;
}
.drawer h2, .modal h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.03em;
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.drawer-head h2 { margin: 0; flex: 1; }
.drawer-foot {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.drawer .sub, .modal .sub { margin-bottom: 18px; }
.stack { display: grid; gap: 12px; }
textarea.input { min-height: 110px; resize: vertical; }
.hint { color: var(--muted-2); font-size: 12px; margin: 0; }
.hint.err { color: var(--danger); }

.review-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.review-grid pre {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}

.refresh-meta { color: var(--muted); font-size: 13px; margin: 14px 0 18px; display: grid; gap: 4px; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.results-grid div {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.results-grid .num { font-family: var(--mono); font-size: 20px; }
.results-grid .lbl { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

.warn {
  background: var(--danger-wash);
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  z-index: 60;
}
.toast {
  background: #1a1e18;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  min-width: 200px;
}
.toast.ok { border-color: #3d4a1c; }
.toast.bad { border-color: #5a3530; color: var(--danger); }

/* ----- Persistent AI jobs tray ----- */
.ai-jobs-tray, .ai-jobs-pill {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  box-shadow: 0 18px 48px rgba(0,0,0,.5);
}
.ai-jobs-tray {
  width: min(370px, calc(100vw - 36px));
  max-height: min(560px, 62vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #11151d;
  border: 1px solid rgba(59,130,246,.48);
  border-radius: 14px;
}
.ai-jobs-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: #151a23;
}
.ai-jobs-head strong { flex: 1; font-size: 14px; }
.ai-jobs-head .btn { padding: 5px 8px; font-size: 11px; }
.ai-jobs-list { overflow-y: auto; padding: 6px; }
.ai-job {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.ai-job:last-child { border-bottom: none; }
.ai-job-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-job-title strong { flex: 1; min-width: 0; font-size: 13px; }
.ai-job-icon {
  width: 18px;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}
.ai-job-running .ai-job-icon {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(59,130,246,.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  font-size: 0;
  animation: ai-job-spin .8s linear infinite;
}
.ai-job-completed .ai-job-icon { color: #9ccf77; }
.ai-job-completed_with_errors .ai-job-icon,
.ai-job-failed .ai-job-icon,
.ai-job-interrupted .ai-job-icon { color: var(--danger); }
@keyframes ai-job-spin { to { transform: rotate(360deg); } }
.ai-job-meta, .ai-job-status { color: var(--muted); font-size: 11px; }
.ai-job-status { color: var(--text); }
.ai-job-progress {
  height: 5px;
  overflow: hidden;
  background: #252a32;
  border-radius: 999px;
}
.ai-job-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width .2s ease;
}
.ai-job-counts { color: var(--muted); font-family: var(--mono); font-size: 10px; }
.ai-job-error { color: var(--danger); font-size: 11px; line-height: 1.35; }
.competitor-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.competitor-card { display: grid; gap: 14px; align-content: start; }
.competitor-card h3 { margin: 0 0 4px; }
.competitor-stats { display: flex; flex-wrap: wrap; gap: 7px; }
.competitor-stats span { padding: 5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font: 11px var(--mono); }
.competitor-range-field { display: grid; gap: 7px; }
.competitor-range-field > span { color: var(--muted); font-size: 12px; }
.segmented { display: inline-grid; grid-template-columns: repeat(2, minmax(88px, 1fr)); gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); width: min(100%, 240px); }
.segment { appearance: none; border: 0; border-radius: 7px; padding: 8px 12px; color: var(--muted); background: transparent; cursor: pointer; font: inherit; font-weight: 700; }
.segment.on { color: white; background: var(--blue); }
.run-list { display: grid; gap: 8px; margin-top: 16px; }
.run-row { width: 100%; display: grid; gap: 4px; padding: 13px; text-align: left; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.run-row:hover { border-color: var(--blue); }
.run-row span, .run-row em { color: var(--muted); font-size: 12px; font-style: normal; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.summary-grid div { padding: 12px; background: var(--surface-2); border-radius: 10px; text-align: center; }
.summary-grid strong, .summary-grid span { display: block; }
.summary-grid strong { font-size: 20px; color: var(--blue); }
.summary-grid span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.stack-actions { display: grid; gap: 8px; margin: 14px 0; }
.stack-actions .btn { justify-content: center; text-decoration: none; }
.ai-job-actions { display: flex; gap: 7px; align-items: center; }
.ai-job-actions .btn { padding: 5px 8px; font-size: 11px; }
.ai-jobs-pill {
  border: 1px solid rgba(59,130,246,.55);
  border-radius: 999px;
  background: #151a23;
  color: #bfdbfe;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 600;
}
.ai-jobs-pill:hover { background: #1a2230; border-color: var(--accent); }
body.ai-jobs-visible .toasts { top: 20px; bottom: auto; }

.pin-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.pin-manual { margin-top: 10px; }
.pin-manual summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}
.pin-manual summary::-webkit-details-marker { display: none; }
.pin-manual[open] summary { color: var(--text); margin-bottom: 8px; }

.last-refresh-line {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
}
.last-refresh-line button.linkish {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.last-refresh-line button.linkish:hover { text-decoration: underline; }
.refresh-banner {
  background: var(--accent-wash);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  white-space: pre-wrap;
  font-family: var(--mono);
  line-height: 1.45;
}
.refresh-detail {
  font-size: 12px;
  color: var(--muted);
  margin: -6px 0 14px;
  font-family: var(--mono);
  white-space: pre-wrap;
  line-height: 1.45;
}
.hashtags { color: var(--muted); font-size: 12px; max-width: 180px; }

.thumbs-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.thumb-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.thumb-cover {
  display: block;
  position: relative;
  aspect-ratio: 9 / 16;
  width: 100%;
  padding: 0;
  background: #000;
  overflow: hidden;
}
.thumb-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.thumb-ph {
  position: absolute;
  inset: 0;
  padding: 0;
  background: #000;
}
.thumb-body { padding: 10px 12px 12px; display: grid; gap: 8px; }
.thumb-hook {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}
.thumb-hook:hover { color: var(--accent); }
.thumb-date { color: var(--muted-2); font-size: 11px; }
.thumb-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 8px;
}
.metric {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.metric strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.metric em {
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.thumb-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip-tag {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 500;
  gap: 4px;
}
.chip-tag .tag-x {
  border: none;
  background: transparent;
  color: var(--muted-2);
  padding: 0 0 0 2px;
  font-size: 13px;
  line-height: 1;
}
.chip-tag .tag-x:hover { color: var(--text); }
.chip-tag-add {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
  cursor: pointer;
}
.tag-editor { display: grid; gap: 8px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-picker {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
}
.tag-pick {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}
.tag-pick:hover { background: var(--accent-wash); }

.script-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--inset);
}
.dropzone {
  border: none;
  border-bottom: 1px dashed var(--border);
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.dropzone.on { background: var(--accent-wash); color: var(--text); }
.dropzone input[type="file"] { display: none; }
.script-preview {
  white-space: pre-wrap;
  min-height: 180px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  border: none;
  border-radius: 0;
  background: transparent;
}
.script-pre {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  color: var(--text);
}
.toast { white-space: pre-wrap; max-width: min(380px, calc(100vw - 48px)); }
.toast.toast-list {
  max-height: 11.5em;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.4;
}
.pick-video { display: grid; gap: 4px; margin-top: 10px; }
.pick-video span { font-size: 12px; color: var(--muted); }

/* ----- Reposting ----- */
.repost-ai-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.repost-toolbar { align-items: end; gap: 14px; }
.repost-tabs { margin-bottom: 0; }
.repost-tabs .filter-chip span { font-family: var(--mono); color: var(--muted-2); }
.repost-selects { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.repost-selects label { display: grid; gap: 4px; min-width: 132px; }
.repost-selects label > span { color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.repost-grid { padding-bottom: 72px; }
.repost-card { position: relative; transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.repost-card[data-section="needs"] { cursor: crosshair; user-select: none; touch-action: none; }
.repost-card[data-section="prepared"] { cursor: pointer; user-select: none; touch-action: none; }
.repost-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,.25);
  transform: translateY(-1px);
}
.repost-cover { pointer-events: none; }
.repost-cover img { -webkit-user-drag: none; user-select: none; }
.repost-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: none;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--accent);
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
  font-weight: 700;
}
.repost-card.selected .repost-check { display: grid; }
.repost-platforms { display: flex; flex-wrap: wrap; gap: 5px; }
.repost-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--muted-2);
  background: rgba(255,255,255,.025);
  font-family: var(--mono);
  font-size: 9px;
}
.repost-pill b { color: var(--muted); font-weight: 500; }
.repost-pill.repost-ready { color: #93c5fd; border-color: rgba(59,130,246,.35); background: var(--accent-wash); }
.repost-pill.repost-posted { color: #bfdbfe; border-color: var(--accent); background: rgba(37,99,235,.22); }
.repost-card-actions { justify-content: space-between; align-items: center; margin-top: auto; }
.repost-card-actions .hint { font-size: 10px; }
.repost-selection-bar {
  position: fixed;
  left: calc(var(--sidebar-w) + 50%);
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(560px, calc(100vw - var(--sidebar-w) - 40px));
  padding: 9px 10px 9px 14px;
  border: 1px solid rgba(59,130,246,.5);
  border-radius: 12px;
  background: #151a23;
  box-shadow: 0 12px 36px rgba(0,0,0,.45);
}
.repost-selection-bar[hidden] { display: none !important; }
.repost-selection-bar strong { white-space: nowrap; font-size: 13px; }
.repost-selecting, .repost-selecting * { cursor: crosshair !important; user-select: none !important; }
.repost-setting {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
  background: var(--inset);
}
.repost-setting-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.repost-setting-head strong { margin-right: auto; }
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.repost-prompt { min-height: 125px; white-space: pre-wrap; }
.prepare-platform { padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; }
.repost-detail-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.muted-tab { opacity: .55; }
.repost-detail-status { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.repost-ready { background: var(--accent-wash); color: #93c5fd; }
.repost-posted { background: rgba(37,99,235,.22); color: #bfdbfe; }
.repost-not_prepared { background: rgba(255,255,255,.05); color: var(--muted); }
.repost-copy { min-height: 240px; white-space: pre-wrap; font-family: var(--font); }
.repost-posted-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ----- Clip Picker ----- */
.clip-picker-layout { display: grid; gap: 18px; max-width: 1050px; }
.clip-library-card { display: grid; gap: 14px; }
.clip-library-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.clip-library-head > div:first-child { flex: 1; min-width: 220px; max-width: 430px; }
.clip-library-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.clip-library-meta span {
  padding: 4px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--muted);
  background: var(--inset);
  font-size: 11px;
}
.clip-root, .clip-path {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clip-pick-button { justify-self: start; min-width: 190px; }
.clip-pick-controls { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.clip-duration-filter { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.clip-duration-filter > span:last-child { display: inline-flex; align-items: center; gap: 7px; }
.clip-duration-filter .input { width: 92px; min-height: 38px; }
.clip-result-empty {
  min-height: 270px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 34px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,.015);
}
.clip-result-empty > span { font-size: 28px; color: #93c5fd; }
.clip-result-empty h3, .clip-result-empty p { margin: 0; }
.clip-result-empty h3 { color: var(--text); }
.clip-result-card {
  display: grid;
  grid-template-columns: minmax(300px, 1.2fr) minmax(280px, .8fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.clip-preview {
  position: relative;
  min-height: 310px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #050605;
}
.clip-preview video { width: 100%; height: 100%; max-height: 520px; object-fit: contain; background: #050605; pointer-events: none; -webkit-user-drag: none; }
.clip-preview-fallback { max-width: 330px; display: grid; gap: 5px; padding: 24px; color: var(--muted); text-align: center; }
.clip-preview-fallback[hidden] { display: none; }
.clip-preview-fallback strong { color: var(--text); }
.clip-result-info { display: flex; flex-direction: column; gap: 14px; justify-content: center; padding: 24px; min-width: 0; }
.clip-result-info h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.clip-native-drag, .clip-native-required {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(59,130,246,.48);
  border-radius: 9px;
  color: #dbeafe;
  background: rgba(37,99,235,.14);
  font-size: 12px;
  font-weight: 650;
  user-select: none;
  -webkit-user-drag: element;
}
.clip-native-drag { cursor: grab; }
.clip-native-drag:active { cursor: grabbing; }
.clip-native-drag.unavailable, .clip-native-required {
  cursor: default;
  border-color: var(--border-soft);
  color: var(--muted);
  background: var(--inset);
  -webkit-user-drag: none;
}
.clip-folder-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.ideation-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ideation-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 14px; }
.ideation-controls > label { flex: 1 1 160px; min-width: 150px; display: grid; gap: 6px; }
.ideation-controls > label > span { font-size: 12px; color: var(--muted); }
.ideation-controls .hint { line-height: 1.25; }
.ideation-custom-days { flex-basis: 130px !important; max-width: 160px; }
.ideation-custom-days > div { display: flex; align-items: center; gap: 7px; }
.ideation-custom-days .input { min-width: 0; }
.ideation-scan-all { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ideation-competitors { display: grid; grid-template-columns: repeat(auto-fit,minmax(250px,1fr)); gap: 10px; margin: 12px 0 18px; }
.ideation-competitor { display: flex; flex-direction: column; gap: 10px; }
.ideation-competitor.disabled { opacity: .68; }
.ideation-competitor:not(.disabled) { cursor: pointer; }
.ideation-competitor:not(.disabled):hover { border-color: rgba(73,131,255,.55); }
.ideation-competitor.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(61,124,255,.18); }
.ideation-competitor-title { display: flex; align-items: center; gap: 9px; }
.ideation-competitor-title .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.ideation-competitor-metrics { display: flex; gap: 8px; flex-wrap: wrap; }
.ideation-competitor-metrics span { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.035); border: 1px solid var(--border); border-radius: 999px; padding: 4px 8px; }
.ideation-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; padding-bottom: 80px; }
.ideation-card { cursor: pointer; transition: border-color .12s,box-shadow .12s,transform .12s; user-select: none; }
.ideation-card:hover { border-color: rgba(73,131,255,.55); transform: translateY(-1px); }
.ideation-card.selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(61,124,255,.24); }
.ideation-cover .thumb-ph { background: linear-gradient(145deg,#172033,#101623); }
.ideation-check { position: absolute; top: 9px; right: 9px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; background: var(--blue); color: white; font-weight: 800; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.ideation-card.selected .ideation-check { display: grid; }
.ideation-new { position: absolute; left: 9px; top: 9px; background: var(--blue); color: #fff; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ideation-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ideation-card-top span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ideation-caption { margin: 0; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.ideation-selection-bar { z-index: 39; }
.ideation-selecting .ideation-card { cursor: crosshair; }

@media (max-width: 900px) {
  .clip-result-card { grid-template-columns: 1fr; }
  .clip-library-head { align-items: stretch; flex-direction: column; }
  .clip-library-head > div:first-child { max-width: none; }
  .ideation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .grid-2, .review-grid { grid-template-columns: 1fr; }
  .thumbs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ideation-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows:auto 1fr; }
  .mobile-header { display:flex; align-items:center; gap:10px; min-width:0; padding:calc(8px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); position:sticky; top:0; z-index:21; background:var(--sidebar); border-bottom:1px solid var(--border); }
  .mobile-logo { flex-shrink:0; }
  .mobile-channel-slot { flex:1; min-width:0; }
  .mobile-channel-slot .channel-block { padding:0; }
  .mobile-channel-slot .field-label { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .mobile-channel-slot .channel-pick { min-height:44px; width:100%; }
  .mobile-channel-slot .channel-pick-label { flex:1; min-width:0; }
  .mobile-channel-slot .channel-pick-del { display:none !important; }
  .mobile-channel-slot .channel-menu { max-height:min(380px, calc(100dvh - 90px)); }
  .channel-option, .channel-profile-retry, .channel-del, .channel-add-option { min-height:44px; }
  .mobile-menu-button, .mobile-nav-close { display:grid; place-items:center; width:44px; height:44px; flex-shrink:0; border:1px solid var(--border); border-radius:10px; color:var(--text); background:var(--inset); }
  .mobile-menu-button svg { width:22px; height:22px; }
  .mobile-menu-button:focus-visible, .mobile-nav-close:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
  .mobile-nav-close { margin-left:auto; font-size:26px; }
  .mobile-nav-backdrop { display:block; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:38; }
  .sidebar { position:fixed; inset:0 0 0 auto; width:min(340px, calc(100vw - 16px)); height:100vh; height:100dvh; z-index:39; padding:calc(12px + env(safe-area-inset-top, 0px)) 16px calc(20px + env(safe-area-inset-bottom, 0px)); border-right:0; border-left:1px solid var(--border); gap:18px; visibility:hidden; transform:translateX(100%); overscroll-behavior:contain; }
  .sidebar { display:none; }
  .mobile-nav-open .sidebar { display:flex; visibility:visible; transform:translateX(0); }
  .sidebar #desktop-channel-slot { display:none; }
  .mobile-nav-open .repost-selection-bar, .mobile-nav-open .ideation-selection-bar { visibility:hidden; }
  .sidebar .nav { flex-direction:column; flex-wrap:nowrap; gap:4px; }
  .sidebar .nav-section { min-width:0; width:100%; margin-top:8px; }
  .sidebar .nav a, .sidebar .nav-section-toggle { min-height:44px; }
  .sidebar .nav-section-links { display:flex; flex-direction:column; min-width:0; }
  .sidebar .sidebar-foot { margin-top:8px; padding-bottom:0; }
  .sidebar .sidebar-foot #auth-user-label { font-size:12px; text-transform:none; letter-spacing:0; margin-top:10px; }
  .sidebar .auth-account, .sidebar .auth-logout { min-height:44px; margin-top:6px; }
  .main { padding:20px 14px 48px; }
  .title-row { flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .thumbs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repost-selection-bar { left: 50%; max-width: calc(100vw - 28px); }
  .repost-toolbar { align-items: stretch; }
  .repost-selects { margin-left: 0; }
  .ai-jobs-tray, .ai-jobs-pill { right: 12px; bottom: 12px; }
  .ai-jobs-tray { width: min(370px, calc(100vw - 24px)); max-height: 58vh; }
  .ideation-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .ideation-card-body .row-actions { flex-direction: column; align-items: stretch; }
}
/* Team & Access */
.team-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0}
.team-section-head{display:flex;justify-content:space-between;gap:16px;align-items:center;margin-bottom:12px}
.team-list{display:grid;gap:10px}
.team-row{display:flex;justify-content:space-between;gap:16px;align-items:center;padding:13px 14px;border:1px solid var(--border);border-radius:12px;background:rgba(255,255,255,.018)}
.team-row-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.team-access-heading{margin-top:20px}
.team-grants{display:grid;gap:10px;margin-top:10px;max-height:48vh;overflow:auto;padding-right:4px}
.team-channel-card{border:1px solid var(--border);border-radius:12px;padding:12px;background:rgba(255,255,255,.018)}
.team-channel-toggle{display:flex;gap:8px;align-items:center}
.team-capability-groups{display:grid;gap:9px;margin-top:12px}
.team-capability-group{display:grid;grid-template-columns:minmax(130px,.7fr) 2fr;gap:12px;align-items:start}
.team-capability-group>span{color:var(--muted);font-size:13px}
.team-capability-group>div{display:flex;gap:12px;flex-wrap:wrap}
.team-capability-group label{display:flex;gap:6px;align-items:center;font-size:13px}
.team-editor-actions{margin-top:18px;justify-content:flex-end}
.invite-card .invite-mark{color:var(--accent);font-weight:700;letter-spacing:.06em;text-transform:uppercase;font-size:12px}

@media (max-width: 720px){
  .team-section-head,.team-row{align-items:stretch;flex-direction:column}
  .team-row-actions{justify-content:flex-start}
  .team-capability-group{grid-template-columns:1fr}
  .team-grants{max-height:none}
}
/* Production work stays usable on mobile without drag or hover interactions. */
.editing-job-card { display:flex; flex-direction:column; gap:10px; }
.editing-job-card h3 { margin:0; }
.editing-card-actions { margin-top:auto; padding-top:18px; border-top:1px solid var(--border-soft); gap:10px; }
.production-dropzone { display:flex; flex-direction:column; align-items:center; gap:8px; padding:24px 16px; border:2px dashed var(--border); border-radius:12px; background:var(--inset); text-align:center; cursor:pointer; }
.production-dropzone svg { width:28px; height:28px; color:var(--accent); }
.production-dropzone span, .production-dropzone small { color:var(--muted); }
.production-dropzone:hover, .production-dropzone:focus-visible, .production-dropzone.drag-over { border-color:var(--accent); background:var(--accent-wash); box-shadow:0 0 0 3px rgba(59,130,246,.12); }
.production-dropzone:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.production-dropzone[aria-disabled="true"] { cursor:default; opacity:.7; }
.production-file-list { display:grid; gap:12px; margin-top:12px; }
.production-selected-file { display:flex; gap:10px; align-items:flex-start; border:1px solid var(--border-soft); padding:12px; border-radius:10px; }
.production-selected-file > div { flex:1; min-width:0; overflow-wrap:anywhere; }
.production-file-icon { color:var(--accent); flex-shrink:0; }
.production-selected-file progress { display:block; width:100%; margin-top:8px; accent-color:var(--accent); }
.publishing-default { display:flex; align-items:flex-end; gap:12px; margin-bottom:20px; }
@media (max-width:600px) {
  .editing-card-actions .btn { min-height:44px; flex:1 1 auto; }
  .production-selected-file { flex-wrap:wrap; }
  .production-selected-file > div { flex-basis:calc(100% - 40px); }
  .production-dropzone { min-height:160px; }
  .publishing-default { align-items:stretch; flex-direction:column; }
}
.production-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.production-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 16px; }
.production-card { min-width: 0; overflow-wrap: anywhere; }
.production-card h3 { margin: 10px 0; }
.production-card .row-actions { flex-wrap: wrap; }
.production-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.production-file { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.production-file > div { min-width: 0; max-width: 100%; }
.production-file .row-actions { flex-wrap: wrap; }
.production-thumb { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; }
.production-video { width: 100%; max-height: 65vh; background: #000; }
.production-feedback { border-left: 3px solid var(--accent); padding-left: 12px; margin: 12px 0; }
.production-upload { margin: 14px 0; padding: 12px; background: var(--inset); border-radius: 8px; }
.production-upload progress { display: block; width: 100%; margin: 8px 0; accent-color: var(--accent); }
.production-transfer { margin:12px 0; padding:14px; border:1px solid var(--border); border-radius:10px; background:var(--inset); overflow-wrap:anywhere; }
.production-transfer.is-working { border-color:var(--accent); }
.production-transfer progress { display:block; width:100%; margin:10px 0; accent-color:var(--accent); }
.production-transfer .row-actions { gap:10px; flex-wrap:wrap; margin-top:12px; }
.upload-current-file { margin:10px 0 4px; font-weight:500; }
.upload-keep-open, .upload-dismiss-feedback { padding:10px; border-left:3px solid var(--accent); background:rgba(172,216,126,.08); }
.upload-working { display:inline-block; width:13px; height:13px; margin-right:8px; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:upload-spin .9s linear infinite; }
@keyframes upload-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .upload-working { animation:none; } }
@media (max-width: 600px) {
  .production-tabs .btn, .production-file .btn { min-height: 44px; }
  .production-file { align-items: flex-start; flex-direction: column; }
  .production-grid { grid-template-columns: minmax(0, 1fr); }
}
