/* HQ Client Portal — Branded Theme */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #21242f;
  --bg-hover: #282c3a;
  --bg-input: #181b24;
  --border: #2a2e3b;
  --border-light: #333;
  --border-focus: #ff5900;
  --text-primary: #f0f0f0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #ff5900;
  --accent-hover: #e04f00;
  --accent-light: rgba(255,89,0,0.12);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #a855f7;
  --blue: #3b82f6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-card: #f8f8f8;
  --bg-hover: #eee;
  --bg-input: #ffffff;
  --border: #ddd;
  --border-light: #ccc;
  --border-focus: #ff5900;
  --text-primary: #111;
  --text-secondary: #555;
  --text-muted: #999;
  --accent: #ff5900;
  --accent-hover: #e04f00;
  --accent-light: rgba(255,89,0,0.08);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

[data-theme="light"] body {
  background-image: radial-gradient(rgba(0,0,0,0.06) 1px, transparent 1px);
  background-size: 20px 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.app-shell { max-width: 900px; margin: 0 auto; padding: 20px; }

.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; margin-bottom: 24px; border-bottom: 1px solid var(--border);
}
.header-brand {
  display: flex; align-items: center; gap: 10px;
}
.header-brand img { height: 32px; }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* --- Theme toggle --- */
.theme-toggle {
  background: var(--bg-card); border: 1px solid var(--border-light);
  color: var(--text-secondary); padding: 6px 12px; border-radius: 20px;
  cursor: pointer; font-size: 13px; transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* --- Forms --- */
.input, textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary);
  font-size: 15px; font-family: inherit; transition: border-color 0.15s;
}
.input:focus, textarea:focus { outline: none; border-color: var(--border-focus); }
textarea { resize: vertical; min-height: 100px; }
label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.form-group { margin-bottom: 16px; }

/* --- Login --- */
.login-wrapper {
  display: flex; align-items: center; justify-content: center;
  min-height: 85vh; flex-direction: column;
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px; width: 100%; max-width: 420px;
  text-align: center; box-shadow: var(--shadow);
}
.login-logo { margin-bottom: 24px; }
.login-logo img { height: 36px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; font-weight: 700; }
.login-card .subtitle { color: var(--text-muted); font-size: 15px; margin-bottom: 24px; }
.login-card .input { margin-bottom: 16px; text-align: center; }
.login-card .btn { width: 100%; justify-content: center; }
.login-success { color: var(--success); font-size: 14px; margin-top: 12px; }
.login-error { color: var(--danger); font-size: 14px; margin-top: 12px; }
.login-footer { margin-top: 24px; font-size: 12px; color: var(--text-muted); }
.login-theme { position: absolute; top: 16px; right: 16px; }

/* hCaptcha container */
.hcaptcha-wrap { display: flex; justify-content: center; margin-bottom: 16px; }

/* --- Stats --- */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
}
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.stat-received .stat-value { color: var(--warning); }
.stat-progress .stat-value { color: var(--blue); }
.stat-review .stat-value { color: var(--purple); }
.stat-complete .stat-value { color: var(--success); }

/* --- Task list --- */
.task-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
}
.task-item:hover { background: var(--bg-hover); border-color: var(--accent); transform: translateX(2px); }
.task-title { flex: 1; font-size: 15px; font-weight: 500; }
.task-meta { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; }

.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.status-received { background: rgba(245,158,11,0.15); color: var(--warning); }
.status-in-progress { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-under-review { background: rgba(168,85,247,0.15); color: var(--purple); }
.status-complete { background: rgba(34,197,94,0.15); color: var(--success); }

/* --- Task detail --- */
.task-detail-header { margin-bottom: 24px; }
.task-detail-header h2 { font-size: 20px; margin-bottom: 8px; }
.task-description {
  color: var(--text-secondary); font-size: 15px; line-height: 1.7; margin-top: 12px;
  white-space: pre-wrap; background: var(--bg-secondary); border-radius: var(--radius-sm);
  padding: 14px; border: 1px solid var(--border);
}

.section-title {
  font-size: 14px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px; margin: 24px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* --- Comments --- */
.comment {
  padding: 12px 16px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  margin-bottom: 10px; border-left: 3px solid var(--border);
}
.comment.from-client { border-left-color: var(--accent); }
.comment.from-team { border-left-color: var(--success); }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-date { font-size: 12px; color: var(--text-muted); }
.comment-body { font-size: 15px; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; }

.comment-form { margin-top: 16px; }
.comment-form textarea { margin-bottom: 10px; }

/* --- Files --- */
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: 13px;
}
.file-item a { color: var(--accent); }
.file-size { color: var(--text-muted); font-size: 12px; }

/* --- New ticket --- */
.new-ticket-form { max-width: 600px; }

/* --- Empty state --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* --- Toast --- */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 14px; z-index: 1000;
  box-shadow: var(--shadow); transform: translateY(100px); opacity: 0;
  transition: all 0.3s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* --- Powered by --- */
.powered-by {
  text-align: center; padding: 24px; font-size: 12px; color: var(--text-muted);
}
.powered-by a { color: var(--text-muted); }
.powered-by a:hover { color: var(--accent); }

/* --- Responsive --- */
@media (max-width: 640px) {
  /* Layout */
  .app-shell { padding: 14px; }
  .header { flex-direction: column; gap: 12px; text-align: center; }
  .header-actions { flex-wrap: wrap; justify-content: center; }

  /* Login */
  .login-card { padding: 28px 22px; margin: 0 14px; }
  .login-card h1 { font-size: 24px; }
  .login-card .subtitle { font-size: 16px; margin-bottom: 28px; }
  .login-card .input { font-size: 17px; padding: 14px 16px; margin-bottom: 18px; }
  .login-card .btn { font-size: 17px; padding: 14px 24px; }
  .login-footer { font-size: 13px; }

  /* Stats */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px 10px; }
  .stat-value { font-size: 32px; }
  .stat-label { font-size: 13px; margin-top: 2px; }

  /* Task list */
  .task-item { flex-direction: column; align-items: flex-start; padding: 18px; gap: 10px; }
  .task-title { font-size: 18px; line-height: 1.4; }
  .task-meta { margin-top: 2px; font-size: 15px; gap: 10px; }
  .status-badge { font-size: 13px; padding: 5px 14px; }

  /* Task detail */
  .task-detail-header h2 { font-size: 24px; line-height: 1.3; }
  .task-description { font-size: 17px; line-height: 1.75; padding: 18px; }
  .section-title { font-size: 16px; margin: 24px 0 14px; }

  /* Comments */
  .comment { padding: 16px 18px; margin-bottom: 14px; }
  .comment-author { font-size: 16px; }
  .comment-date { font-size: 14px; }
  .comment-body { font-size: 17px; line-height: 1.75; }

  /* Forms — 16px+ prevents iOS zoom */
  .input, textarea, select { font-size: 17px; padding: 14px 16px; }
  textarea { min-height: 120px; }
  label { font-size: 15px; margin-bottom: 8px; }
  .form-group { margin-bottom: 20px; }

  /* Buttons — bigger touch targets */
  .btn { padding: 14px 22px; font-size: 16px; min-height: 48px; }
  .btn-sm { padding: 12px 18px; font-size: 15px; min-height: 44px; }
  .theme-toggle { padding: 10px 16px; font-size: 14px; }

  /* Files */
  .file-item { padding: 14px 16px; font-size: 16px; }
  .file-size { font-size: 14px; }

  /* New ticket form */
  .new-ticket-form h2 { font-size: 24px; }

  /* General text */
  body { font-size: 17px; }
  a { font-size: inherit; }
  .empty-state p { font-size: 18px; }
  .powered-by { font-size: 13px; padding: 20px; }

  /* Image gallery nav */
  #image-viewer-overlay img { max-width: 95vw; max-height: 75vh; }
}

/* --- Guide link --- */
.guide-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.guide-link:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--accent); }

/* --- Guide page --- */
.guide { max-width: 680px; }
.guide h2 { font-size: 22px; margin-bottom: 8px; }
.guide-intro { color: var(--text-secondary); font-size: 15px; margin-bottom: 28px; line-height: 1.7; }
.guide-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px;
}
.guide-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.guide-section p { color: var(--text-secondary); font-size: 14px; line-height: 1.7; margin-bottom: 10px; }
.guide-section p:last-child { margin-bottom: 0; }
.guide-section ul, .guide-section ol {
  color: var(--text-secondary); font-size: 14px; line-height: 1.7;
  padding-left: 20px; margin-bottom: 10px;
}
.guide-section ul:last-child, .guide-section ol:last-child { margin-bottom: 0; }
.guide-section li { margin-bottom: 6px; }
.guide-section .status-badge { font-size: 10px; vertical-align: middle; }

@media (max-width: 640px) {
  .guide-section { padding: 16px 18px; }
  .guide-section h3 { font-size: 18px; }
  .guide-section p, .guide-section ul, .guide-section ol { font-size: 16px; }
  .guide-link { width: 36px; height: 36px; font-size: 16px; }
}

/* --- Loading --- */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PRODUCT REVIEW TOOL
   ============================================================ */

/* --- Hamburger button --- */
.hamburger-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 18px; line-height: 1;
  cursor: pointer; transition: all 0.2s; font-family: inherit; flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }

/* --- Side nav drawer --- */
.nav-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 2000;
}
.nav-overlay.open { display: block; }

.nav-drawer {
  position: fixed; top: 0; right: -320px; width: 280px; max-width: 88vw;
  height: 100vh; background: var(--bg-secondary); border-left: 1px solid var(--border);
  z-index: 2001; display: flex; flex-direction: column;
  transition: right 0.25s ease; box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  overflow-y: auto;
}
.nav-drawer.open { right: 0; }

.nav-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.nav-drawer-header img { height: 24px; }
.nav-close-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 4px;
  line-height: 1; transition: color 0.15s; font-family: inherit;
}
.nav-close-btn:hover { color: var(--text-primary); }

.nav-drawer-body { flex: 1; padding: 12px 10px; }

.nav-section-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 12px 12px 4px; margin-top: 4px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-primary); text-decoration: none;
  font-size: 15px; font-weight: 500; transition: background 0.15s;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-link:hover { background: var(--bg-hover); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-light); }

.nav-sub-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px 9px 28px; border-radius: var(--radius-sm);
  color: var(--text-secondary); text-decoration: none;
  font-size: 14px; transition: background 0.15s;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  font-family: inherit;
}
.nav-sub-link:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-sub-link.active { color: var(--accent); }

.nav-drawer-footer {
  padding: 14px 10px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.nav-drawer-footer .btn { width: 100%; justify-content: center; }

/* --- Product page link --- */
.pr-product-link {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; color: var(--accent); text-decoration: none;
  margin-top: 5px; padding: 2px 0; font-weight: 500;
}
.pr-product-link:hover { text-decoration: underline; }

/* --- Group description --- */
.pr-group-desc {
  font-size: 13px; color: var(--text-secondary); margin-top: -6px;
  margin-bottom: 16px; line-height: 1.6; max-width: 700px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
}

/* --- Section header --- */
.pr-section-header {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px;
}

/* --- Progress bar --- */
.pr-progress-wrap {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
}
.pr-progress-bar {
  flex: 1; height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden;
}
.pr-progress-fill {
  height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.4s ease;
}
.pr-progress-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* --- Overview grid --- */
.pr-overview-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.pr-overview-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; cursor: pointer;
  transition: all 0.15s; display: flex; gap: 14px; align-items: flex-start;
}
.pr-overview-card:hover { background: var(--bg-hover); border-color: var(--accent); transform: translateY(-1px); }
.pr-overview-card.done { border-color: var(--success); }
.pr-card-icon { font-size: 24px; flex-shrink: 0; }
.pr-card-body { flex: 1; }
.pr-card-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.pr-card-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.pr-badge-done {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; background: rgba(34,197,94,0.15); color: var(--success); margin-left: 6px;
}

/* --- Group tabs / pills --- */
.pr-group-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
.pr-tab {
  padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
  transition: all 0.15s; font-family: inherit;
}
.pr-tab:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.pr-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pr-tab.active:hover { background: var(--accent); }
.pr-badge-new {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 10px; background: var(--accent); color: #fff; margin-left: 6px;
}
.pr-tab-count {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px;
  border-radius: 10px; background: var(--bg-hover); color: var(--text-muted); margin-left: 6px;
}
.pr-badge-new-inline {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 4px; background: var(--accent); color: #fff; letter-spacing: 0.5px;
}
.pr-reco-card-new { border-left: 3px solid var(--accent); }

/* --- Group header --- */
.pr-group { margin-bottom: 32px; }
.pr-group-title {
  font-size: 14px; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
}

/* --- Decision cards --- */
.pr-cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
}
.pr-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s;
}
.pr-card-img {
  width: 100%; height: 160px; object-fit: cover; display: block;
}
.pr-card-content { padding: 14px; }
.pr-sku {
  font-size: 11px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.pr-card-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.pr-card-desc-text { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; line-height: 1.5; }
.pr-card-brand { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }

.pr-decision-btns {
  display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap;
}
.pr-btn-keep, .pr-btn-remove, .pr-btn-disc {
  flex: 1; padding: 7px 6px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; background: var(--bg-hover);
  color: var(--text-secondary); font-family: inherit; min-width: 60px;
}
.pr-btn-keep:hover { background: rgba(34,197,94,0.15); border-color: var(--success); color: var(--success); }
.pr-btn-remove:hover { background: rgba(239,68,68,0.15); border-color: var(--danger); color: var(--danger); }
.pr-btn-disc:hover { background: rgba(245,158,11,0.15); border-color: var(--warning); color: var(--warning); }
.pr-btn-keep.active-keep { background: rgba(34,197,94,0.2); border-color: var(--success); color: var(--success); }
.pr-btn-remove.active-remove { background: rgba(239,68,68,0.2); border-color: var(--danger); color: var(--danger); }
.pr-btn-disc.active-disc { background: rgba(245,158,11,0.2); border-color: var(--warning); color: var(--warning); }

.pr-notes-wrap { margin-top: 4px; }
.pr-notes-input {
  width: 100%; padding: 8px 10px; font-size: 12px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); font-family: inherit; resize: vertical; min-height: 56px;
}
.pr-notes-input:focus { outline: none; border-color: var(--border-focus); }

/* --- Description cards --- */
.pr-desc-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  transition: border-color 0.3s;
}
.pr-desc-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input);
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  resize: vertical; min-height: 160px; transition: border-color 0.15s;
}
.pr-desc-textarea:focus { outline: none; border-color: var(--border-focus); }

.pr-thumb {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border); flex-shrink: 0;
}

/* --- Brand table --- */
.pr-brand-table { display: flex; flex-direction: column; gap: 0; }
.pr-brand-header {
  display: grid; grid-template-columns: 1fr 220px; gap: 12px;
  padding: 8px 14px; font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.pr-brand-row {
  display: grid; grid-template-columns: 1fr 220px; gap: 12px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.pr-brand-row:last-child { border-bottom: none; }
.pr-brand-row:hover { background: var(--bg-hover); }
.pr-brand-product { display: flex; gap: 10px; align-items: flex-start; }
.pr-brand-select-wrap { display: flex; flex-direction: column; }
.pr-brand-select {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary);
  font-size: 13px; font-family: inherit;
}
.pr-thumb-sm {
  width: 40px; height: 40px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border); flex-shrink: 0;
}

/* --- Recommendations --- */
.pr-reco-controls {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.pr-reco-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.pr-reco-card-head { display: flex; gap: 12px; margin-bottom: 16px; align-items: flex-start; }
.pr-reco-fields { display: flex; flex-direction: column; gap: 16px; }
.pr-reco-field { }
.pr-field-label {
  font-size: 13px; font-weight: 700; color: var(--text-secondary);
  margin-bottom: 8px;
}
.pr-checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px;
}
.pr-checkbox-grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.pr-check-label {
  display: flex; align-items: flex-start; gap: 6px; font-size: 13px;
  color: var(--text-secondary); cursor: pointer; padding: 4px 6px;
  border-radius: 4px; transition: background 0.15s;
}
.pr-check-label:hover { background: var(--bg-hover); }
.pr-check-label input[type="checkbox"] { margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.pr-other-check-wrap { flex-direction: column; align-items: flex-start; }
.pr-radio-row { display: flex; gap: 12px; flex-wrap: wrap; }
.pr-radio-label {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text-secondary); cursor: pointer; padding: 6px 12px;
  border-radius: 6px; border: 1px solid var(--border); transition: all 0.15s;
}
.pr-radio-label:hover { border-color: var(--accent); background: var(--accent-light); }
.pr-radio-label input[type="radio"] { accent-color: var(--accent); }

/* --- Responsive --- */
@media (max-width: 640px) {
  .pr-section-header { flex-direction: column; gap: 10px; }
  .pr-cards-grid { grid-template-columns: 1fr; }
  .pr-overview-grid { grid-template-columns: 1fr; }
  .pr-brand-header { display: none; }
  .pr-brand-row { grid-template-columns: 1fr; gap: 8px; }
  .pr-brand-select-wrap { width: 100%; }
  .pr-brand-select { width: 100%; }
  .pr-reco-controls { flex-direction: column; align-items: flex-start; }
  .pr-checkbox-grid { grid-template-columns: repeat(2, 1fr); }
  .pr-radio-row { gap: 8px; }
  .header-actions { flex-wrap: wrap; }
}

/* --- AI Training card --- */
.ai-training-card {
  background: linear-gradient(135deg, #162040 0%, #1e2e58 60%, #243568 100%);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  margin-bottom: 24px;
  color: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.07);
}
.ai-training-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}
.ai-training-subtitle {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ai-training-desc {
  font-size: 14px;
  opacity: 0.8;
  line-height: 1.65;
  margin-bottom: 18px;
  max-width: 580px;
}
.ai-training-scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.ai-scenario-chip {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.ai-scenario-chip:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
}
.ai-training-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #162040;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: none;
}
.ai-training-btn:hover {
  background: #e8edf8;
  color: #162040;
  text-decoration: none;
}
.nav-sub-link-ai { color: rgba(160,180,255,0.9); }
.nav-sub-link-ai:hover { color: #fff; }

@media (max-width: 640px) {
  .ai-training-card { padding: 20px 18px; }
  .ai-training-title { font-size: 18px; }
  .ai-training-desc { font-size: 15px; }
  .ai-scenario-chip { font-size: 14px; padding: 7px 14px; }
  .ai-training-btn { font-size: 15px; padding: 12px 20px; }
}

/* ============================================================
   DASHBOARD MODULE CARDS
   ============================================================ */

.dash-module {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.dash-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.dash-module-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.dash-module-footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Stat cards inside modules -- tighter spacing */
.dash-module .stats-row {
  margin-bottom: 12px;
}
.dash-module .stat-card {
  padding: 12px 10px;
}
.dash-module .stat-value {
  font-size: 24px;
}

/* Task items inside modules */
.dash-module .task-item {
  margin-bottom: 6px;
}

/* --- Lead preview rows --- */
.dash-lead-list {
  margin-top: 4px;
}

.dash-lead-list-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.dash-lead-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.dash-lead-row:hover {
  background: var(--bg-hover);
}

.dash-lead-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 24px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.dash-lead-score.hot {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
}
.dash-lead-score.warm {
  background: rgba(245,158,11,0.15);
  color: var(--warning);
}
.dash-lead-score.cool {
  background: rgba(59,130,246,0.15);
  color: var(--blue);
}

.dash-lead-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}

.dash-lead-detail {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .dash-module { padding: 16px; }
  .dash-module-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .dash-module .stat-value { font-size: 22px; }
  .dash-lead-row { flex-wrap: wrap; gap: 6px; }
  .dash-lead-detail { width: 100%; padding-left: 50px; }
}

/* ============================================================
   LEFT SIDEBAR NAVIGATION
   ============================================================ */

.hub-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.hub-sidebar.collapsed {
  transform: translateX(-260px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
  font-family: inherit;
}
.sidebar-close:hover { color: var(--text-primary); }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 12px 6px;
  margin-top: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.sidebar-link:hover {
  background: var(--bg-hover);
  text-decoration: none;
}
.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-light);
}

.sidebar-sub {
  padding-left: 22px;
  font-size: 13px;
}

.sidebar-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px;
  flex-shrink: 0;
}

.sidebar-footer-link {
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  padding: 8px 12px !important;
}
.sidebar-footer-link:hover {
  color: var(--text-primary) !important;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.active {
  display: block;
}

/* Sidebar toggle (hamburger) -- hidden when sidebar is open on desktop */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* Show toggle when sidebar is collapsed */
.hub-content.sidebar-collapsed .sidebar-toggle {
  display: inline-flex;
}

/* Main content area -- offset by sidebar width */
.hub-content {
  margin-left: 260px;
  transition: margin-left 0.25s ease;
  min-height: 100vh;
}

.hub-content.sidebar-collapsed {
  margin-left: 0;
}

/* Mobile: sidebar slides over content */
@media (max-width: 768px) {
  .hub-sidebar {
    transform: translateX(-260px);
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  .hub-sidebar:not(.collapsed) {
    transform: translateX(0);
  }
  .hub-content {
    margin-left: 0 !important;
  }
  .sidebar-toggle {
    display: inline-flex !important;
  }
}


/* =====================================================
   VIDEO GENERATOR MODULE
   ===================================================== */

.video-gen-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .video-gen-layout {
    grid-template-columns: 1fr;
  }
}

.video-gen-form h3,
.video-gen-jobs h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.vg-avatar-picker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vg-avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.vg-avatar-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vg-avatar-thumb img {
  width: 100%;
  height: 48px;
  object-fit: cover;
  border-radius: 6px 6px 0 0;
}

.vg-avatar-thumb span {
  font-size: 0.6rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  padding: 0 2px;
}

.vg-avatar-thumb:hover {
  border-color: var(--accent, #4f8cff);
}

.vg-avatar-thumb.selected {
  border-color: var(--accent, #4f8cff);
  box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.3);
}

.vg-cost-estimate {
  padding: 0.5rem 0;
  color: var(--text-muted, #888);
}

.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  background: var(--input-bg, #1a1a2e);
  color: var(--text, #e0e0e0);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 160px;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--accent, #4f8cff);
}

.char-count {
  float: right;
  font-size: 0.8rem;
  color: var(--text-muted, #888);
  font-weight: normal;
}

.form-row {
  display: flex;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
  }
}

/* Job list */
.vg-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 600px;
  overflow-y: auto;
}

.vg-job-card {
  padding: 0.75rem;
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  background: var(--card-bg, #16162a);
}

.vg-job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.vg-job-status {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.status-queued { background: #334; color: #8af; }
.status-tts-generating { background: #342; color: #af8; }
.status-avatar-generating { background: #342; color: #af8; }
.status-downloading { background: #342; color: #af8; }
.status-complete { background: #243; color: #8f8; }
.status-failed { background: #433; color: #f88; }

.vg-job-script {
  font-size: 0.85rem;
  color: var(--text-muted, #aaa);
  margin: 0.25rem 0;
}

.vg-job-meta {
  color: var(--text-muted, #888);
}

.vg-job-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.vg-job-error {
  color: #f88;
  margin-top: 0.25rem;
}

/* Light theme overrides */
[data-theme="light"] .form-textarea {
  background: #fff;
  color: #333;
  border-color: #ccc;
}

[data-theme="light"] .vg-job-card {
  background: #f8f9fa;
  border-color: #dee2e6;
}

[data-theme="light"] .status-queued { background: #e3f2fd; color: #1565c0; }
[data-theme="light"] .status-tts-generating { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .status-avatar-generating { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .status-downloading { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .status-complete { background: #c8e6c9; color: #1b5e20; }
[data-theme="light"] .status-failed { background: #ffcdd2; color: #b71c1c; }
