/* ============================================================
   GDV Portal — Design System v2
   Inter font loaded via layout.ejs
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #60A5FA;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #F43F5E;
  --info: #3B82F6;
  --purple: #8B5CF6;
  --brand-gold: #D4AF37;

  --bg-main: #F8FAFC;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --table-header: #F1F5F9;
  --table-row-alt: #F8FAFC;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Aliases for cross-compatibility */
  --bg-primary: #ffffff;
  --bg-secondary: #F8FAFC;
  --bg-sidebar-compat: #ffffff;
  --card-bg: #ffffff;
  --accent: #3B82F6;
  --accent-light: #EFF6FF;
  --status-green: #065F46;
  --status-green-bg: #D1FAE5;
  --status-red: #991B1B;
  --status-red-bg: #FEE2E2;
  --status-amber: #92400E;
  --status-amber-bg: #FEF3C7;
  --btn-primary: #3B82F6;
  --btn-primary-text: #ffffff;
  --btn-secondary: #F1F5F9;
  --btn-secondary-text: #0F172A;
  --btn-danger: #FEE2E2;
  --btn-danger-text: #BE123C;
  --btn-success: #D1FAE5;
  --btn-success-text: #065F46;
  --btn-warning: #FEF3C7;
  --btn-warning-text: #92400E;
  --btn-download: #EFF6FF;
  --btn-download-text: #2563EB;

  --sidebar-width: 240px;
  --topbar-height: 60px;
}

[data-theme="dark"] {
  --bg-main: #0F172A;
  --bg-card: #1E293B;
  --bg-sidebar: #1E293B;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: #334155;
  --table-header: #1E293B;
  --table-row-alt: #162032;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --primary: #60A5FA;
  --primary-dark: #3B82F6;
  --primary-light: #93C5FD;

  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-sidebar-compat: #1E293B;
  --card-bg: #1E293B;
  --accent: #60A5FA;
  --accent-light: #1E3A5F;
  --status-green: #34D399;
  --status-green-bg: #022C22;
  --status-red: #FCA5A5;
  --status-red-bg: #2D0A0A;
  --status-amber: #FCD34D;
  --status-amber-bg: #2D1B00;
  --btn-primary: #3B82F6;
  --btn-primary-text: #ffffff;
  --btn-secondary: #334155;
  --btn-secondary-text: #F1F5F9;
  --btn-danger: #2D0A0A;
  --btn-danger-text: #FCA5A5;
  --btn-success: #022C22;
  --btn-success-text: #34D399;
  --btn-warning: #2D1B00;
  --btn-warning-text: #FCD34D;
  --btn-download: #1E3A5F;
  --btn-download-text: #60A5FA;
}

/* ── Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; line-height: 1.5; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - var(--topbar-height)); margin-top: var(--topbar-height); }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  z-index: 100; box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-brand { font-size: 1.1rem; font-weight: 700; color: var(--primary); letter-spacing: -0.3px; }
.topbar-center-zone {
  position: absolute; left: 50%; transform: translateX(-50%);
  pointer-events: none; white-space: nowrap;
  font-size: 0.9rem; font-weight: 600; color: var(--primary);
}
[data-theme="dark"] .topbar-center-zone { color: var(--primary-light); }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.user-name { font-weight: 500; font-size: 0.875rem; color: var(--text-primary); }

/* Role pills in topbar — solid bg, white text */
.role-badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 100px; font-size: 0.72rem; font-weight: 600; text-transform: capitalize;
  color: #ffffff;
}
.role-super_admin { background: #2563EB; }
.role-planner     { background: #3B82F6; }
.role-kam         { background: #8B5CF6; }
.role-distributor { background: #10B981; }

/* Sync status */
.sync-status { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--text-secondary); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse-dot 2s infinite; flex-shrink: 0; }
@keyframes pulse-dot { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:0.6;transform:scale(0.85)} }

.btn-icon {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; cursor: pointer; color: var(--text-primary); font-size: 1rem;
  transition: background 0.2s ease; line-height: 1;
}
.btn-icon:hover { background: var(--bg-main); }
.sidebar-toggle { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-primary); padding: 4px 8px; }
.btn-signout {
  background: var(--btn-danger); color: var(--btn-danger-text);
  padding: 5px 12px; font-size: 0.78rem; border: none; border-radius: var(--radius);
  cursor: pointer; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center;
  transition: opacity 0.2s;
}
.btn-signout:hover { opacity: 0.85; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: var(--topbar-height); bottom: 0; left: 0;
  overflow-y: auto; transition: transform 0.3s; z-index: 90;
}

/* Logo area — themed, uses actual Fragrance World logos */
.sidebar-header {
  padding: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-area {
  padding: 16px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-img {
  max-width: 148px; height: auto; display: block;
}
/* Theme-aware logo switching */
.sidebar-logo-light { display: block; }
.sidebar-logo-dark  { display: none;  }
[data-theme="dark"] .sidebar-logo-light { display: none;  }
[data-theme="dark"] .sidebar-logo-dark  { display: block; }
/* Legacy compat — hide text logo if old markup somehow persists */
.sidebar-logo { display: none; }
.sidebar-title { display: none; }
.sidebar-gold-sep { height: 2px; background: var(--brand-gold); margin: 0; opacity: 0.5; }

.sidebar-nav { flex: 1; padding: 10px 8px; }
.nav-section {
  padding: 10px 8px 4px;
  font-size: 0.625rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin: 1px 0;
  color: var(--text-secondary); text-decoration: none; font-size: 0.875rem;
  border-radius: var(--radius); transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--bg-main); color: var(--primary); }
[data-theme="dark"] .nav-item:hover { background: #1E293B; color: var(--primary); }
.nav-item.active {
  background: rgba(59,130,246,0.08); color: #3B82F6; font-weight: 600;
  box-shadow: inset 3px 0 0 #3B82F6;
}
[data-theme="dark"] .nav-item.active {
  background: rgba(59,130,246,0.15); color: #60A5FA;
  box-shadow: inset 3px 0 0 #3B82F6;
}
.nav-item-logout { color: var(--danger); }
.nav-item-logout:hover { background: #FFF1F2; color: var(--danger); }
[data-theme="dark"] .nav-item-logout:hover { background: #2D0A0A; }
.nav-icon { width: 18px; text-align: center; flex-shrink: 0; font-size: 1rem; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-version { font-size: 0.7rem; color: var(--text-muted); }

/* ── Main content ────────────────────────────────────────────── */
.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 24px; min-height: calc(100vh - var(--topbar-height)); }
.page-content { max-width: 1400px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 16px;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--bg-card);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: all 0.2s ease; white-space: nowrap;
  font-family: inherit;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: none; opacity: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: #3B82F6; color: #ffffff; }
.btn-primary:hover { background: #2563EB; opacity: 1; }
.btn-secondary { background: var(--btn-secondary); color: var(--btn-secondary-text); border: 1px solid var(--border); }
.btn-danger { background: var(--btn-danger); color: var(--btn-danger-text); }
.btn-success { background: var(--btn-success); color: var(--btn-success-text); }
.btn-warning { background: var(--btn-warning); color: var(--btn-warning-text); }
.btn-download { background: var(--btn-download); color: var(--btn-download-text); border: 1px solid var(--primary); }
.btn-download:hover { background: var(--primary); color: #ffffff; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-outline-primary { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #ffffff; }
.btn-outline-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #ffffff; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-primary);
  font-size: 0.875rem; transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.form-input:disabled, .form-select:disabled { background: var(--bg-main); cursor: not-allowed; color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }
.form-hint-inline { font-weight: 400; color: var(--text-secondary); }
.form-actions { display: flex; gap: 8px; padding-top: 8px; }
.form-select-sm { padding: 4px 8px; font-size: 0.8rem; height: auto; }
.req { color: var(--danger); }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.875rem; }
.field-error { color: var(--danger); font-size: 0.78rem; margin-top: 3px; display: block; }

/* ── File upload ─────────────────────────────────────────────── */
.file-upload-area {
  position: relative; border: 2px dashed var(--primary);
  border-radius: var(--radius); padding: 32px; text-align: center;
  cursor: pointer; transition: all 0.2s ease; background: var(--accent-light);
}
[data-theme="dark"] .file-upload-area { background: #1E3A5F; border-color: var(--primary); }
.file-upload-area:hover { border-color: var(--primary-dark); background: #DBEAFE; }
[data-theme="dark"] .file-upload-area:hover { background: #1E3A5F; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-upload-label { pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.file-upload-icon { font-size: 2.5rem; }
.file-upload-text { font-weight: 600; color: var(--primary); font-size: 0.95rem; }
.file-upload-hint { font-size: 0.78rem; color: var(--text-secondary); }
.file-selected { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--primary); font-weight: 500; padding: 8px; }
.upload-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.upload-status { font-size: 0.875rem; color: var(--text-secondary); }
.upload-result { margin-top: 12px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper, .table-scroll-wrap { overflow-x: auto; position: relative; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  background: var(--table-header); padding: 10px 14px;
  text-align: left; font-weight: 600; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-primary); vertical-align: middle;
}
.data-table tbody tr:nth-child(even) { background: var(--table-row-alt); }
.data-table tbody tr:hover { background: #EFF6FF; }
[data-theme="dark"] .data-table tbody tr:hover { background: #334155; }
.data-table tbody tr:last-child td { border-bottom: none; }
.actions-cell { white-space: nowrap; display: flex; gap: 4px; }
.text-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty { text-align: center; padding: 2rem; color: var(--text-muted); }
.col-actions-sticky { position: sticky; right: 0; z-index: 2; background: var(--bg-card); }
thead .col-actions-sticky { z-index: 3; background: var(--table-header); }
.modal-xl { max-width: 860px; width: 96%; }
.modal-sm { max-width: 420px; }

/* ── Status Pills ────────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; font-weight: 600; padding: 3px 10px;
  border-radius: 100px; white-space: nowrap;
}
.status-dot-sm { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-active { background: #dcfce7; color: #16a34a; }
.status-active .status-dot-sm { background: #16a34a; }
.status-inactive { background: #f1f5f9; color: #64748b; }
.status-inactive .status-dot-sm { background: #94a3b8; }
.status-on-hold { background: #fef3c7; color: #d97706; }
.status-on-hold .status-dot-sm { background: #d97706; }
[data-theme="dark"] .status-active  { background: #022C22; color: #34D399; }
[data-theme="dark"] .status-active .status-dot-sm  { background: #34D399; }
[data-theme="dark"] .status-inactive { background: #1E293B; color: #94A3B8; }
[data-theme="dark"] .status-on-hold  { background: #2D1B00; color: #FCD34D; }
[data-theme="dark"] .status-on-hold .status-dot-sm { background: #FCD34D; }

/* Status dots (old compat) */
.status-dot  { font-size: 0.8rem; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.status-active.status-dot, .status-dot.status-active { color: var(--success); }
.status-inactive.status-dot, .status-dot.status-inactive { color: var(--text-secondary); }
.status-on_hold { color: var(--warning); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 100px; font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: var(--status-green-bg); color: var(--status-green); }
.badge-danger  { background: var(--status-red-bg);   color: var(--status-red);   }
.badge-warning { background: var(--status-amber-bg); color: var(--status-amber); }
.badge-info    { background: #dbeafe; color: #2563eb; }
.badge-secondary { background: var(--bg-main); color: var(--text-secondary); border: 1px solid var(--border); }
[data-theme="dark"] .badge-info { background: #0c2340; color: #7dd3fc; }

/* ── Tier Badges (SKU) ───────────────────────────────────────── */
.tier-badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 4px; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.tier-T1  { background: #dbeafe; color: #1d4ed8; }
.tier-T2  { background: #dcfce7; color: #15803d; }
.tier-T3  { background: #fef9c3; color: #854d0e; }
.tier-T4  { background: #ffedd5; color: #c2410c; }
.tier-T5  { background: #fee2e2; color: #b91c1c; }
.tier-T6  { background: #f3e8ff; color: #7c3aed; }
.tier-T7  { background: #ede9fe; color: #6d28d9; }
.tier-T8  { background: #e0e7ff; color: #4338ca; }
.tier-default { background: var(--bg-main); color: var(--text-secondary); border: 1px solid var(--border); }
[data-theme="dark"] .tier-T1 { background: #0c2340; color: #7dd3fc; }
[data-theme="dark"] .tier-T2 { background: #14532d; color: #4ade80; }
[data-theme="dark"] .tier-T3 { background: #451a03; color: #fde68a; }
[data-theme="dark"] .tier-T4 { background: #431407; color: #fb923c; }
[data-theme="dark"] .tier-T5 { background: #450a0a; color: #f87171; }
[data-theme="dark"] .tier-T6 { background: #2d1b69; color: #c4b5fd; }
[data-theme="dark"] .tier-T7 { background: #2d1b69; color: #a78bfa; }
[data-theme="dark"] .tier-T8 { background: #1e1b4b; color: #818cf8; }

/* ── User Avatar ─────────────────────────────────────────────── */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; color: #ffffff;
  flex-shrink: 0; text-transform: uppercase;
}
.user-avatar-super_admin { background: #2563EB; }
.user-avatar-planner     { background: #3B82F6; }
.user-avatar-kam         { background: #8B5CF6; }
.user-avatar-distributor { background: #10B981; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 16px; border-left: 4px solid transparent; }
.alert-success { background: var(--status-green-bg); color: var(--status-green); border-left-color: var(--success); }
.alert-danger  { background: var(--status-red-bg);   color: var(--status-red);   border-left-color: var(--danger); }
.alert-info    { background: #dbeafe; color: #1d4ed8;  border-left-color: var(--info); }
.alert-warning { background: var(--status-amber-bg); color: var(--status-amber); border-left-color: var(--warning); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: var(--bg-card); border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from{opacity:0;transform:scale(0.95) translateY(-10px)} to{opacity:1;transform:none} }
.modal-lg { max-width: 700px; }
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 1.4rem; cursor: pointer;
  color: var(--text-muted); padding: 4px 8px; border-radius: 6px;
  line-height: 1; transition: background 0.2s;
}
.modal-close:hover { background: var(--bg-main); color: var(--text-primary); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Delete modal — red warning icon */
.delete-modal-icon { text-align: center; font-size: 2.5rem; margin-bottom: 12px; }
.delete-modal-title { text-align: center; font-size: 1rem; font-weight: 700; margin-bottom: 8px; }

/* ── Toast notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed; top: 72px; right: 20px;
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
  max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow-md); font-size: 0.875rem;
  min-width: 280px; max-width: 380px;
  animation: toastIn 0.3s ease; background: var(--bg-card);
  border-left: 4px solid transparent; position: relative;
  overflow: hidden;
}
.toast::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  height: 3px; border-radius: 0 0 0 var(--radius);
  animation: toastProgress 4s linear forwards;
}
@keyframes toastIn { from{opacity:0;transform:translateX(100%)} to{opacity:1;transform:none} }
@keyframes toastProgress { from{width:100%} to{width:0%} }

.toast-success { border-left-color: var(--success); }
.toast-success::after { background: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-error::after { background: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning::after { background: var(--warning); }
.toast-info    { border-left-color: var(--info); }
.toast-info::after { background: var(--info); }
.toast-close {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  color: var(--text-muted); flex-shrink: 0; padding: 0; margin-left: auto; line-height: 1;
}
.toast-close:hover { color: var(--text-primary); }

/* ── Search ──────────────────────────────────────────────────── */
.search-input {
  padding: 7px 12px 7px 34px; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--bg-card);
  color: var(--text-primary); font-size: 0.875rem; min-width: 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}
.search-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ── Info bar ────────────────────────────────────────────────── */
.info-bar {
  background: var(--accent-light); border: 1px solid var(--primary);
  border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px; font-size: 0.875rem;
}
.info-label { font-weight: 600; color: var(--primary); white-space: nowrap; }

/* ── Stats ───────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }
.stat-success .stat-value { color: var(--success); }
.stat-danger .stat-value  { color: var(--danger);  }

/* ── Info list ───────────────────────────────────────────────── */
.info-list { display: grid; grid-template-columns: 1fr; gap: 4px; }
.info-row { display: grid; grid-template-columns: 200px 1fr; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.info-row dt { font-weight: 600; color: var(--text-secondary); }
.info-row dd { color: var(--text-primary); }

/* ── Tabs ────────────────────────────────────────────────────── */
.dashboard-tabs, .tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  background: none; border: none; padding: 8px 18px; cursor: pointer;
  font-size: 0.875rem; color: var(--text-secondary); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.2s ease; font-family: inherit;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-btn:hover:not(.active) { color: var(--text-primary); }
.tab-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }

/* ── Toggle switch ───────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; vertical-align: middle; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 20px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Legend ──────────────────────────────────────────────────── */
.legend-bar {
  padding: 12px 20px; border-top: 1px solid var(--border); margin-top: 24px;
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-secondary);
}
.legend-label { font-weight: 600; color: var(--text-primary); }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-sep { color: var(--border); margin: 0 4px; }
.btn-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.legend-symbol { font-weight: 500; }

/* ── Loading / Empty ─────────────────────────────────────────── */
.loading-state { text-align: center; padding: 40px; color: var(--text-secondary); font-size: 0.9rem; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Auth — Split Layout ─────────────────────────────────────── */
.auth-split-body {
  display: flex; min-height: 100vh;
  background: #f8fafc;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.auth-split-left {
  width: 42%; min-height: 100vh;
  background: linear-gradient(150deg, #1D4ED8 0%, #3B82F6 50%, #60A5FA 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 60px 48px; position: relative; overflow: hidden;
}
/* Dot texture overlay */
.auth-split-left::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 22px 22px;
}
/* Decorative glow circles */
.auth-split-left::after {
  content: '';
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255,255,255,0.05); bottom: -100px; right: -100px; z-index: 0;
}
.auth-brand-panel {
  position: relative; z-index: 1; text-align: center; max-width: 380px;
  display: flex; flex-direction: column; align-items: center;
}
.auth-brand-logo-img { width: 200px; height: auto; margin-bottom: 28px; }
.auth-brand-title {
  font-size: 1.05rem; font-weight: 600; color: rgba(255,255,255,0.95);
  margin-bottom: 6px; line-height: 1.4;
}
.auth-brand-company-name {
  font-size: 0.85rem; color: rgba(255,255,255,0.7); margin-bottom: 36px;
}
/* Keep old class names for backwards compat (not used in new layout-auth.ejs but may appear on other auth pages) */
.auth-brand-main { font-size: 2.2rem; font-weight: 800; color: #ffffff; line-height: 1.1; margin-bottom: 8px; }
.auth-brand-sub { font-size: 1rem; color: rgba(255,255,255,0.75); margin-bottom: 32px; }
.auth-brand-company { font-size: 1rem; font-weight: 700; color: var(--brand-gold); margin-bottom: 32px; }
.auth-brand-features {
  display: flex; flex-direction: column; gap: 14px; width: 100%; text-align: left;
  margin-bottom: 36px;
}
.auth-brand-feature { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.9); font-size: 0.875rem; }
.auth-brand-feature-icon { width: 34px; height: 34px; background: rgba(255,255,255,0.15); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.auth-brand-tagline {
  font-size: 0.8rem; font-style: italic; color: rgba(255,255,255,0.55);
  text-align: center; margin-top: 4px;
}

.auth-split-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px 48px; background: #ffffff; min-height: 100vh;
}
[data-theme="dark"] .auth-split-right { background: #1e293b; }

.auth-form-box { width: 100%; max-width: 420px; }
.auth-form-logo {
  width: 48px; height: 48px; background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 900; color: #ffffff; margin-bottom: 24px;
}
.auth-form-title { font-size: 1.6rem; font-weight: 800; color: #0f172a; margin-bottom: 6px; }
[data-theme="dark"] .auth-form-title { color: #f1f5f9; }
.auth-form-subtitle { font-size: 0.9rem; color: #64748b; margin-bottom: 28px; }
.auth-form .form-input { border-radius: var(--radius); }
.auth-form .btn-primary { margin-top: 4px; font-size: 0.95rem; padding: 10px 20px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.875rem; }
.auth-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-link:hover { text-decoration: underline; }
.auth-sep { color: var(--text-muted); margin: 0 6px; }
.auth-footnote { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 12px; }
.auth-footer { text-align: center; font-size: 0.72rem; color: var(--text-muted); margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── Auth legacy compat (other auth pages) ───────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-main); padding: 20px; }
.auth-container { width: 100%; max-width: 440px; }
.auth-card { background: var(--bg-card); border-radius: var(--radius-xl); padding: 32px; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.auth-card-brand { text-align: center; margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.auth-portal-title { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 6px; }
.auth-portal-sub { font-size: 1rem; color: var(--text-secondary); margin-bottom: 8px; }
.auth-portal-company { font-size: 1.1rem; font-weight: 700; color: var(--brand-gold); }
.auth-card-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; text-align: center; }
.auth-card-footer { text-align: center; font-size: 0.72rem; color: var(--text-muted); margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); line-height: 1.5; }

/* ── Dashboard Summary KPI Cards ─────────────────────────────── */
.summary-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.summary-card {
  border-radius: var(--radius-lg); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
  border: none; color: #ffffff;
}
.summary-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,0.3);
}
.sc-icon {
  font-size: 1.5rem; flex-shrink: 0; width: 40px; height: 40px;
  border-radius: 10px; background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
}
.sc-body { flex: 1; min-width: 0; }
.summary-card-value { font-size: 2.4rem; font-weight: 800; line-height: 1; display: block; color: #ffffff; letter-spacing: -0.02em; }
.summary-card-label { font-size: 0.65rem; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(255,255,255,0.75); font-weight: 500; }
.sc-total    { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.sc-submitted{ background: linear-gradient(135deg, #10B981, #059669); }
.sc-pending  { background: linear-gradient(135deg, #F43F5E, #E11D48); }
.sc-coverage { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }

/* ── Dashboard toolbar ───────────────────────────────────────── */
.dash-toolbar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
}
.dash-toolbar-left  { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.dash-toolbar-right { display: flex; gap: 6px; flex-shrink: 0; }
.dash-filter-select {
  padding: 5px 8px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text-primary); font-size: 0.8rem; cursor: pointer;
  font-family: inherit; transition: border-color 0.2s;
}
.dash-filter-select:focus { outline: none; border-color: var(--primary); }
.dash-last-synced { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 12px; }

/* ── Dashboard Matrix Table ──────────────────────────────────── */
.matrix-scroll { overflow-x: auto; }
.matrix-table { border-collapse: collapse; font-size: 0.8rem; min-width: max-content; width: 100%; }
.matrix-table th, .matrix-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: center; }
.matrix-table th {
  background: var(--table-header); font-size: 0.72rem; white-space: nowrap;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary);
}
.dist-col { text-align: left; min-width: 220px; max-width: 280px; }
.dist-col-sticky { position: sticky; left: 0; z-index: 2; background: var(--bg-card); }
.matrix-table thead .dist-col-sticky { z-index: 3; background: var(--table-header); }
.period-col { min-width: 80px; }
.period-current-header { background: #DBEAFE !important; color: var(--primary-dark); border-top: 2px solid var(--primary); font-weight: 700; }
[data-theme="dark"] .period-current-header { background: #1E3A5F !important; color: var(--primary-light); border-top-color: var(--primary); }
/* 2x2 grid layout for distributor cell */
.dist-cell-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: baseline;
}
.dist-name { font-weight: 700; font-size: 13px; color: var(--text-primary); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-code { font-size: 11px; color: var(--text-secondary); font-weight: 500; text-align: right; white-space: nowrap; }
.dist-geo  { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-am   { font-size: 11px; color: var(--text-muted); text-align: right; white-space: nowrap; }
/* dist-code as pill badge (compat) */
.dist-code-badge {
  display: inline-block; background: var(--bg-main); border: 1px solid var(--border);
  border-radius: 4px; padding: 0 5px; font-size: 0.65rem; font-weight: 600; color: var(--text-secondary);
  margin-top: 2px;
}
.matrix-table tbody tr { background: transparent; }
.matrix-row-alt > td { background: var(--table-row-alt); }
.dist-col-sticky { background: var(--bg-card) !important; }
.matrix-table thead .dist-col-sticky { background: var(--table-header) !important; }
.matrix-row-alt > td.dist-col-sticky { background: var(--table-row-alt) !important; }
.matrix-table tbody tr:hover > td { background: #DBEAFE !important; }
.matrix-table tbody tr:hover > td.dist-col-sticky { background: #BFDBFE !important; }
[data-theme="dark"] .matrix-table tbody tr { background: transparent; }
[data-theme="dark"] .matrix-table tbody tr:hover > td { background: #334155 !important; }
[data-theme="dark"] .matrix-table tbody tr:hover > td.dist-col-sticky { background: #334155 !important; }
[data-theme="dark"] .dist-col-sticky { background: var(--bg-card) !important; }
[data-theme="dark"] .matrix-table thead .dist-col-sticky { background: var(--table-header) !important; }
[data-theme="dark"] .matrix-row-alt > td.dist-col-sticky { background: var(--table-row-alt) !important; }
.status-cell { cursor: default; vertical-align: middle; }
.status-icon { font-size: 0.85rem; font-weight: 700; }

/* Dashboard cell states — applied at TD level only, never on TR */
.cell-submitted     { background: #D1FAE5 !important; color: #065F46; }
.cell-corrected     { background: #FEF3C7 !important; color: #92400E; }
.cell-missing       { background: #FEE2E2 !important; color: #991B1B; }
.cell-current-missing { background: #DBEAFE !important; color: #1D4ED8; }
.cell-current-period { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
[data-theme="dark"] .cell-submitted      { background: #022C22 !important; color: #34D399; }
[data-theme="dark"] .cell-corrected      { background: #2D1B00 !important; color: #FCD34D; }
[data-theme="dark"] .cell-missing        { background: #2D0A0A !important; color: #FCA5A5; }
[data-theme="dark"] .cell-current-missing { background: #1E3A5F !important; color: #93C5FD; }

/* ── Distributor info bar ────────────────────────────────────── */
.dist-info-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 20px; margin-bottom: 20px;
  display: grid; grid-template-columns: repeat(4,1fr); gap: 16px;
}
.dist-info-field { display: flex; flex-direction: column; gap: 2px; }
.dist-info-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.dist-info-value { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }

/* ── Period selector ─────────────────────────────────────────── */
.period-selector-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── Period History Tiles — 90x90px ──────────────────────────── */
.period-tiles { display: flex; gap: 8px; flex-wrap: wrap; }
.period-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 90px; height: 90px;
  border-radius: var(--radius); border: 2px solid var(--border);
  gap: 2px; text-align: center; cursor: default;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.period-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.period-tile-month  { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; line-height: 1.2; }
.period-tile-icon   { font-size: 1.3rem; font-weight: 800; line-height: 1; margin: 1px 0; }
.period-tile-status { font-size: 0.58rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; line-height: 1; }
.period-tile-label  { font-size: 0.6rem; font-weight: 600; } /* legacy compat */

.period-tile.pt-submitted { background: #D1FAE5; border-color: #10B981; color: #065F46; }
.period-tile.pt-corrected { background: #FEF3C7; border-color: #F59E0B; color: #92400E; }
.period-tile.pt-open      { background: #DBEAFE; border-color: var(--primary); color: var(--primary-dark); animation: pulse-tile 2s infinite; }
.period-tile.pt-missing   { background: #FEE2E2; border-color: #F43F5E; color: #991B1B; }
.period-tile.pt-upcoming  { background: var(--bg-main); border-color: var(--border); color: var(--text-muted); }
@keyframes pulse-tile { 0%,100%{box-shadow:0 0 0 0 rgba(59,130,246,0.3)} 50%{box-shadow:0 0 0 5px rgba(59,130,246,0.1)} }

[data-theme="dark"] .period-tile.pt-submitted { background: #022C22; border-color: #34D399; color: #34D399; }
[data-theme="dark"] .period-tile.pt-corrected { background: #2D1B00; border-color: #FCD34D; color: #FCD34D; }
[data-theme="dark"] .period-tile.pt-open      { background: #1E3A5F; border-color: var(--primary); color: var(--primary-light); }
[data-theme="dark"] .period-tile.pt-missing   { background: #2D0A0A; border-color: #FCA5A5; color: #FCA5A5; }

/* Tile legend */
.tile-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; font-size: 0.75rem; }
.tile-legend-item { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-weight: 600; }
.tl-open      { background: #DBEAFE; color: var(--primary-dark); }
.tl-submitted { background: #D1FAE5; color: #065F46; }
.tl-corrected { background: #FEF3C7; color: #92400E; }
.tl-missing   { background: #FEE2E2; color: #991B1B; }
[data-theme="dark"] .tl-open      { background: #1E3A5F; color: var(--primary-light); }
[data-theme="dark"] .tl-submitted { background: #022C22; color: #34D399; }
[data-theme="dark"] .tl-corrected { background: #2D1B00; color: #FCD34D; }
[data-theme="dark"] .tl-missing   { background: #2D0A0A; color: #FCA5A5; }

/* ── Launch product cards ────────────────────────────────────── */
.launch-layout { display: grid; grid-template-columns: 40% 1fr; gap: 20px; align-items: start; }
.launch-col-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.launch-col-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.launch-product-list { display: flex; flex-direction: column; gap: 8px; }
.launch-product-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.launch-product-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.launch-product-name { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.launch-product-meta { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 8px; }
.launch-product-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.launch-product-item.is-active  { border-left: 3px solid var(--success); }
.launch-product-item.is-inactive { border-left: 3px solid var(--border); }

/* Admin card hover */
.nl-admin-card { cursor: pointer; }
.nl-admin-card:hover { box-shadow: 0 4px 18px rgba(99,102,241,0.2); transform: translateY(-1px); border-color: var(--primary) !important; }

/* Launch thumbs */
.launch-product-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.launch-thumb-wrap { flex-shrink: 0; }
.launch-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.launch-thumb-placeholder {
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-main); border-radius: var(--radius); font-size: 1.4rem;
  border: 1px solid var(--border); color: var(--text-muted);
}

/* ── Feedback aggregation ────────────────────────────────────── */
.feedback-agg-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feedback-filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.feedback-total { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 16px; }
.feedback-question { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.feedback-question:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.feedback-q-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 6px; }
.feedback-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 100px; font-size: 0.78rem; font-weight: 700; }
.fb-excellent { background: #dcfce7; color: #16a34a; }
.fb-average   { background: #fef3c7; color: #d97706; }
.fb-poor      { background: #fee2e2; color: #dc2626; }
.fb-empty     { color: var(--text-muted); font-size: 0.8rem; font-style: italic; }

/* ── New Launch — progress bar ───────────────────────────────── */
.nl-progress-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 24px;
}
.nl-progress-label { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 8px; }
.nl-progress-label strong { color: var(--text-primary); }
.nl-progress-track { height: 12px; background: var(--border); border-radius: 999px; overflow: hidden; }
.nl-progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--brand-gold));
  transition: width 0.6s ease;
}

/* Product card images */
.nl-product-img-wrap {
  width: calc(100% + 40px); height: 200px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden; background: var(--border); margin: -20px -20px 16px -20px;
}
.nl-product-img { width: 100%; height: 200px; object-fit: cover; display: block; }
.nl-product-img-placeholder {
  width: 100%; height: 200px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-main); font-size: 3rem; color: var(--text-muted);
}

/* Submitted view */
.nl-submitted-view { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.nl-submitted-grid { display: flex; flex-direction: column; gap: 8px; }
.nl-submitted-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.875rem; }
.nl-submitted-label { color: var(--text-secondary); flex-shrink: 0; }
.char-counter { font-size: 0.75rem; color: var(--text-muted); text-align: right; margin-top: 4px; }

/* Preview modal */
.nl-preview-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(212,175,55,0.1); border: 1px solid rgba(212,175,55,0.4);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px;
  font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5;
}
.nl-preview-banner strong { color: var(--brand-gold); }
.nl-preview-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.nl-preview-product-strip {
  background: var(--bg-main); border-radius: var(--radius); padding: 10px 14px;
  margin-bottom: 4px; font-size: 0.85rem; color: var(--text-secondary);
}
.nl-preview-product-strip strong { color: var(--text-primary); font-size: 1rem; }

/* ── Rating options ──────────────────────────────────────────── */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(420px,1fr)); gap: 20px; }
.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.product-name { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.product-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ratings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.rating-group { }
.rating-options { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.rating-option {
  display: flex; align-items: center; gap: 4px; font-size: 0.8rem; cursor: pointer;
  padding: 5px 10px; border: 1.5px solid var(--border); border-radius: var(--radius);
  transition: all 0.15s ease;
}
.rating-option:has(input:checked) { border-width: 2px; }
.rating-excellent { color: var(--status-green); }
.rating-excellent:has(input:checked), .rating-option.rating-excellent:has(input:checked) { background: #dcfce7; border-color: var(--success); }
.rating-average { color: var(--status-amber); }
.rating-average:has(input:checked) { background: #fef3c7; border-color: var(--warning); }
.rating-poor { color: var(--status-red); }
.rating-poor:has(input:checked) { background: #fee2e2; border-color: var(--danger); }
.rating-option input { width: 14px; height: 14px; accent-color: var(--primary); }

/* ── Template panels ─────────────────────────────────────────── */
.template-panels { display: grid; grid-template-columns: 1fr; gap: 20px; }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 1rem; font-weight: 700; }
.panel-desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Misc ────────────────────────────────────────────────────── */
code { background: var(--bg-main); padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; font-family: 'JetBrains Mono', 'Fira Code', monospace; border: 1px solid var(--border); color: var(--primary); }
.text-secondary { color: var(--text-secondary); font-size: 0.8rem; }
.text-warning { color: var(--warning); }
.brand-gold { color: var(--brand-gold); font-weight: 700; }
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; text-align: center; gap: 16px; }
.error-icon { font-size: 3rem; }
.error-title { font-size: 2rem; font-weight: 700; }
.error-message { color: var(--text-secondary); font-size: 1rem; }
.filter-tabs { display: flex; gap: 4px; }
.test-result { margin-bottom: 16px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media(max-width:1024px) {
  .auth-split-left { width: 38%; padding: 40px 32px; }
  .auth-split-right { padding: 40px 32px; }
}
@media(max-width:900px) {
  .summary-cards { grid-template-columns: repeat(2,1fr); }
  .launch-layout { grid-template-columns: 1fr; }
  .dist-info-panel { grid-template-columns: repeat(2,1fr); }
  .topbar-center-zone { display: none; }
}
@media(max-width:768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr; }
  .ratings-grid { grid-template-columns: 1fr; }
  .auth-split-body { flex-direction: column; }
  .auth-split-left { width: 100%; min-height: auto; padding: 32px 24px; }
  .auth-split-right { padding: 32px 24px; }
  .auth-brand-main { font-size: 1.6rem; }
}
@media(max-width:600px) {
  .summary-cards { grid-template-columns: 1fr 1fr; }
  .dist-info-panel { grid-template-columns: 1fr 1fr; }
  .period-tile { width: 72px; height: 72px; }
  .auth-split-left { display: none; }
  .auth-split-right { min-height: 100vh; }
}

/* ── Mobile sidebar overlay ──────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 149;
  backdrop-filter: blur(2px);
}
@media(max-width:768px) {
  .sidebar-overlay.active { display: block; }
  .sidebar-toggle { display: flex; }
  .topbar { padding: 0 12px; }
  .page-content { padding: 16px 14px 40px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .card-body { padding: 16px; }
  .card-body.p-0 { padding: 0; }
  .stat-card { padding: 14px 16px; }
  .stats-row { gap: 10px; }
  .kpi-value { font-size: 1.6rem; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .period-tiles { gap: 10px; }
  .topbar-brand { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .modal-dialog { margin: 16px; max-width: calc(100vw - 32px) !important; }
  .audit-filters { flex-direction: column; }
}
@media(max-width:480px) {
  .dist-info-panel { grid-template-columns: 1fr; gap: 8px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .summary-cards { grid-template-columns: 1fr; }
  .period-tiles { gap: 8px; }
  .period-tile { width: 68px; height: 80px; font-size: 0.7rem; }
  .page-header h1 { font-size: 1.3rem; }
}

/* ── Session timeout modal ───────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
  overflow: hidden;
}
.modal-header {
  padding: 20px 24px 0;
}
.modal-title {
  font-size: 1.1rem; font-weight: 700; margin: 0;
  color: var(--text-primary);
}
.modal-body {
  padding: 16px 24px;
  font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6;
}
.modal-body p { margin: 0 0 8px; }
.modal-body p:last-child { margin: 0; }
.modal-footer {
  padding: 12px 24px 20px;
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Tile delete button ──────────────────────────────────────── */
.tile-delete-btn {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(244,63,94,0.15);
  border: 1px solid rgba(244,63,94,0.4);
  border-radius: 4px;
  font-size: 0.65rem;
  color: var(--danger);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  padding: 0;
  line-height: 1;
}
.period-tile { position: relative; }
.period-tile:hover .tile-delete-btn { opacity: 1; }
.tile-delete-btn:hover { background: rgba(244,63,94,0.3); }
@media(max-width:768px) {
  .tile-delete-btn { opacity: 1; width: 20px; height: 20px; font-size: 0.6rem; }
}
