*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --success: #22c55e;
  --warning: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
}

body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

/* ── App Shell ── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  overflow-y: auto;
}
.sidebar-header { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 22px; color: var(--accent); line-height: 1; }
.sidebar-logo strong { display: block; font-size: 14px; font-weight: 700; color: var(--text); }
.sidebar-logo span { display: block; font-size: 11px; color: var(--text-muted); }

.sidebar-nav { padding: 12px 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 14px; line-height: 1; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-meta { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-muted); }

/* ── Menu Toggle (mobile) ── */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 50;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(15,23,42,0.4);
}
@media (max-width: 768px) {
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.visible { display: block; }
  .main-content { margin-left: 0; padding: 64px 16px 24px; }
}

/* ── Main Content ── */
.main-content { margin-left: 220px; flex: 1; padding: 24px 28px; overflow-x: hidden; }

/* ── Pages ── */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 2px; }

/* ── Grid helpers ── */
.two-column-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .two-column-grid { grid-template-columns: 1fr; } }

/* ── Plans list (editor lives in modal) ── */
.plan-list-page {
  max-width: 720px;
}

/* ── Plan modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.modal.hidden {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(92vh, 880px);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.modal-body {
  overflow-y: auto;
  padding: 16px 18px 20px;
  flex: 1;
  min-height: 0;
  background: var(--bg);
}
body.modal-open {
  overflow: hidden;
}
.plan-builder-hint { margin-bottom: 12px; line-height: 1.45; max-width: 52ch; }

/* Plan editor: one compact header row */
.plan-editor-header .plan-editor-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}
.plan-editor-header .plan-editor-header-row label { flex: 1 1 160px; min-width: 0; }
.plan-editor-header .plan-item-count {
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 8px;
  white-space: nowrap;
}

/* Plan item: preview column (media + tags) + main fields */
.plan-item-layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
@media (max-width: 560px) {
  .plan-item-layout { flex-direction: column; }
  .plan-item-preview-column { width: 100% !important; max-width: none; }
  .plan-item-thumb-wrap { width: 100% !important; }
}
.plan-item-preview-column {
  flex: 0 0 160px;
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-thumb-placeholder {
  text-align: center;
  padding: 12px 10px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.plan-thumb-placeholder strong {
  display: block;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
}
.plan-preview-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  pointer-events: none;
}
.plan-item-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.plan-item-thumb-wrap .plan-item-thumb-inner,
.plan-item-thumb-wrap img,
.plan-item-thumb-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.plan-item-preview-tags {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.plan-item-preview-tags .pill-row {
  margin: 4px 0 0;
  min-height: 22px;
}
.plan-item-preview-tags .tag-empty {
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-muted);
  font-style: italic;
}
.plan-item-flow-hint {
  margin: 0;
  max-width: 52ch;
  line-height: 1.45;
}
.plan-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
}
.plan-item-top label { flex: 1 1 120px; min-width: 0; margin: 0; }
.plan-item-date {
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 8px;
  white-space: nowrap;
}
.plan-item-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.plan-item-meta-row select {
  width: auto;
  min-width: 100px;
  max-width: 140px;
}
.plan-item-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: var(--bg);
  font-size: 12px;
}
.plan-item-details summary {
  cursor: pointer;
  padding: 8px 4px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}
.plan-item-details summary::-webkit-details-marker { display: none; }
.plan-item-details summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  margin-right: 8px;
  transform: translateY(-1px);
  transition: transform 0.15s;
}
.plan-item-details[open] summary::before { transform: rotate(90deg) translate(2px, 0); }
.plan-item-details .platform-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 12px;
  padding: 4px 4px 10px;
  border-top: 1px solid var(--border);
}
.check-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}
.check-label input { width: auto; accent-color: var(--accent); }
.field-inline-expect {
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
}
.field-inline-expect > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.field-inline-expect select { margin: 0; }
.plan-item-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.plan-item-toolbar input[type="file"] {
  font-size: 12px;
  max-width: 200px;
}
/* ── Drop zone ── */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 6px;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.inline-tag-input {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.inline-tag-input input[type="text"] {
  width: 120px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
}

/* Saved plan list: mini preview */
.saved-plan-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.saved-plan-thumb {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}
.saved-plan-thumb img,
.saved-plan-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.saved-plan-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  padding: 4px;
}
.saved-plan-body { flex: 1; min-width: 0; }
.plan-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.plan-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.plan-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.plan-progress-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* New plan wizard: tighter requirement rows */
.requirement-row { padding: 10px 12px; }
.requirement-row .pill-row { margin: 8px 0 0; }

/* ── Panels ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.panel-header h3 { font-size: 13px; font-weight: 700; color: var(--text); }
.panel-header.compact { padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }

/* ── Cards & Items ── */
.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.item-card:last-child { margin-bottom: 0; }

/* ── Stacks ── */
.stack { display: flex; flex-direction: column; }

/* ── Metric Grids ── */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.metric-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.metric-card .meta-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.metric-card strong { font-size: 22px; font-weight: 700; color: var(--text); }
.metric-card.metric-danger { background: #fef2f2; border-color: #fecaca; }
.metric-card.metric-danger strong { color: #b91c1c; }
.metric-card.metric-warning { background: #fffbeb; border-color: #fde68a; }
.metric-card.metric-warning strong { color: #b45309; }
.metric-card.metric-success { background: #f0fdf4; border-color: #bbf7d0; }
.metric-card.metric-success strong { color: #15803d; }
.metric-card.metric-info { background: #eff6ff; border-color: #bfdbfe; }
.metric-card.metric-info strong { color: #1d4ed8; }
.metric-card.metric-purple { background: #f5f3ff; border-color: #ddd6fe; }
.metric-card.metric-purple strong { color: #7c3aed; }

/* ── Forms ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
label { display: flex; flex-direction: column; gap: 4px; }
label span { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
input[type="text"], input[type="date"], select, textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
textarea { resize: vertical; font-family: inherit; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .two-column { grid-template-columns: 1fr; } }

/* ── Buttons ── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.button.small { padding: 5px 10px; font-size: 12px; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.button.secondary { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.button.secondary:hover { background: var(--border); }
.button.ghost { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.button.ghost:hover { background: var(--bg); color: var(--text); }
.button.danger { background: var(--danger); color: #fff; }
.button.danger:hover { background: #dc2626; }
.button.success { background: var(--success); color: #fff; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Pills / Tags ── */
.pill-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.pill.status-new { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.pill.status-waiting_media { background: #fef3c7; border-color: #fde68a; color: #b45309; }
.pill.status-draft { background: #f5f3ff; border-color: #ddd6fe; color: #7c3aed; }
.pill.status-rethinking { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.pill.status-approved { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.pill.status-canceled { background: var(--danger-light); border-color: #fecaca; color: #b91c1c; }
.pill.status-posted { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ── Media Preview (queue / drafts) ── */
.preview-frame {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-frame img, .preview-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.queue-item-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.queue-item-body { flex: 1; min-width: 0; }

/* ── AI Generated Text ── */
.ai-text-block {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: #0c4a6e;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* ── Empty / muted ── */
.empty {
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.empty-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}
.empty .button { margin-top: 10px; }
.muted { font-size: 11px; color: var(--text-muted); }
.subtle { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.line-meta { display: flex; flex-direction: column; gap: 2px; }
.line-meta strong { font-size: 13px; color: var(--text); }
.queue-card-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Banner ── */
.banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #92400e;
  margin-bottom: 16px;
}

/* ── Tabs ── */
.tab-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab-button {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.tab-button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-button:hover:not(.active) { background: var(--bg); }

/* ── Help Cards ── */
.help-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.help-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.help-card-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.help-card-body { flex: 1; min-width: 0; }
.help-card-title { font-size: 14px; font-weight: 600; display: block; margin-bottom: 4px; }
.help-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin: 0; }

/* ── Help content ── */
.help-content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  max-height: 500px;
  overflow-y: auto;
}
.help-content-pre {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  color: var(--text);
}

[dir="rtl"] .help-card { flex-direction: row-reverse; }
[dir="rtl"] .help-card-body { text-align: right; }

/* ── Toast ── */
@keyframes toast-in { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.25s ease-out;
}
.toast.hiding { animation: toast-out 0.2s ease-in forwards; }
.toast.hidden { display: none; }
.toast-icon { font-size: 16px; line-height: 1; flex-shrink: 0; }

/* ── Utility ── */
.hidden { display: none !important; }
.saved-plan-card { transition: border-color 0.15s; }
.saved-plan-card.active { border-color: var(--accent); background: var(--accent-light); }
.saved-plan-card:hover { border-color: var(--border-strong); }

/* ── Persona snapshot ── */
.snapshot-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.snapshot-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.snapshot-tag {
  background: var(--danger-light);
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
}
.snapshot-quote {
  font-style: italic;
  color: var(--text-muted);
  font-size: 12px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin: 4px 0;
  line-height: 1.5;
}

/* ── Status bar inside plan items ── */
.plan-item-actions { margin-top: 8px; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
.button.secondary .btn-spinner,
.button.ghost .btn-spinner {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--text-muted);
}

/* ── Language Dropdown ── */
.lang-dropdown {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 50;
}
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 18px;
  line-height: 1;
}
.lang-toggle:hover { border-color: var(--border-strong); }
.lang-caret { font-size: 10px; color: var(--text-muted); }
.lang-flag { font-size: 18px; line-height: 1; }
.lang-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 150px;
  overflow: hidden;
}
.lang-menu.open { display: block; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.lang-option:hover { background: var(--accent-light); }
.lang-option.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* ── RTL Overrides ── */
[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid var(--border);
}
[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: 220px;
}
[dir="rtl"] .menu-toggle {
  left: auto;
  right: 16px;
}
[dir="rtl"] .lang-dropdown {
  left: auto;
  right: 16px;
}
[dir="rtl"] .lang-menu {
  left: auto;
  right: 0;
}
[dir="rtl"] .lang-option {
  text-align: right;
  flex-direction: row-reverse;
}
[dir="rtl"] .nav-item {
  text-align: right;
}
[dir="rtl"] .nav-icon {
  margin-right: 0;
  margin-left: 8px;
}
[dir="rtl"] .actions {
  justify-content: flex-start;
}
[dir="rtl"] .page-header {
  flex-direction: row-reverse;
}
[dir="rtl"] .btn-spinner {
  margin-right: 0;
  margin-left: 4px;
}
[dir="rtl"] .plan-item-layout {
  direction: rtl;
}
[dir="rtl"] .plan-item-top {
  flex-direction: row-reverse;
}
[dir="rtl"] .saved-plan-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .queue-item-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .modal-header {
  flex-direction: row-reverse;
}
[dir="rtl"] .modal-header-actions {
  flex-direction: row-reverse;
}
[dir="rtl"] .two-column,
[dir="rtl"] .two-column-grid {
  direction: rtl;
}
[dir="rtl"] .line-meta {
  text-align: right;
}
[dir="rtl"] .pill-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .plan-item-preview-tags {
  text-align: right;
}
[dir="rtl"] .inline-tag-input {
  flex-direction: row-reverse;
}
[dir="rtl"] .sidebar-meta {
  text-align: right;
}
[dir="rtl"] .snapshot-section-label {
  text-align: right;
}
@media (max-width: 768px) {
  [dir="rtl"] .sidebar {
    transform: translateX(100%);
  }
  [dir="rtl"] .sidebar.open {
    transform: translateX(0);
  }
  [dir="rtl"] .main-content {
    margin-right: 0;
  }
}

/* ── Queue Cards (redesign) ── */
.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.queue-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.queue-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.queue-card-status-new { border-left-color: var(--accent); }
.queue-card-status-waiting_media { border-left-color: var(--warning); }
.queue-card-status-draft { border-left-color: #8b5cf6; }
.queue-card-status-rethinking { border-left-color: var(--warning); }
.queue-card-status-approved { border-left-color: var(--success); }
.queue-card-status-canceled { border-left-color: var(--danger); }

.queue-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.queue-card-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.queue-card-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.queue-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.queue-card-date {
  font-size: 11px;
  white-space: nowrap;
}

/* ── Review Modal ── */
.review-modal-panel {
  width: min(640px, 100%);
}
.review-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.review-text-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.review-text-label span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.review-text-label textarea {
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
}
.modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

/* RTL: queue cards */
[dir="rtl"] .queue-card {
  border-left: 1px solid var(--border);
  border-right: 4px solid var(--border-strong);
}
[dir="rtl"] .queue-card-status-new { border-right-color: var(--accent); }
[dir="rtl"] .queue-card-status-waiting_media { border-right-color: var(--warning); }
[dir="rtl"] .queue-card-status-draft { border-right-color: #8b5cf6; }
[dir="rtl"] .queue-card-status-rethinking { border-right-color: var(--warning); }
[dir="rtl"] .queue-card-status-approved { border-right-color: var(--success); }
[dir="rtl"] .queue-card-status-canceled { border-right-color: var(--danger); }
[dir="rtl"] .queue-card-header { flex-direction: row-reverse; }
[dir="rtl"] .queue-card-footer { flex-direction: row-reverse; }
[dir="rtl"] .review-meta { flex-direction: row-reverse; }
[dir="rtl"] .modal-footer { flex-direction: row-reverse; }
