/* ============================================================
   SIIVORA COMMAND — Design System
   Premium fragrance × fashion identity, Linear/Stripe-grade UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* --- Light mode (default) --- */
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --surface-2: #F3F1EC;
  --border: #E6E2D8;
  --text: #17140F;
  --text-muted: #6B665C;
  --text-faint: #A39D8E;

  --accent: #B08D3E;          /* champagne gold */
  --accent-soft: #F2E8D2;
  --accent-contrast: #17140F;

  --positive: #1F7A4D;
  --positive-soft: #E4F3EA;
  --negative: #C24A3B;
  --negative-soft: #FBEAE7;
  --info: #2F5EA8;
  --info-soft: #E8EEFA;
  --warning: #B27B1E;
  --warning-soft: #FBF0DC;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(23,20,15,0.06), 0 1px 1px rgba(23,20,15,0.04);
  --shadow-md: 0 8px 24px rgba(23,20,15,0.08);
  --shadow-lg: 0 20px 48px rgba(23,20,15,0.14);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --nav-h: 68px;
  --bottom-nav-h: 76px;
}

[data-theme="dark"] {
  --bg: #0E0D0B;
  --surface: #17150F;
  --surface-2: #1E1C15;
  --border: #2C2A21;
  --text: #F5F2EA;
  --text-muted: #A69F8C;
  --text-faint: #6E6858;

  --accent: #D9B463;
  --accent-soft: #2A2417;
  --accent-contrast: #0E0D0B;

  --positive: #4CBE85;
  --positive-soft: #16261E;
  --negative: #E37360;
  --negative-soft: #2B1917;
  --info: #6E9CE0;
  --info-soft: #17222F;
  --warning: #E0B455;
  --warning-soft: #2A2213;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg: 0 24px 56px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
img { max-width: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  transition: background .25s ease, color .25s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Layout shells ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-brand {
  padding: 0 10px 24px;
  display: flex;
  align-items: center;
}
.brand-logo-sidebar svg { width: 168px; height: auto; }
.brand-logo-mini svg { width: 34px; height: 34px; display: block; border-radius: 50%; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 60px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.greeting { font-size: 26px; }
.greeting .sub { color: var(--text-muted); font-size: 14px; font-family: var(--font-body); margin-top: 4px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); position: relative;
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn .badge {
  position: absolute; top: -2px; right: -2px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--negative); border: 2px solid var(--bg);
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 16px; min-width: 220px;
  color: var(--text-faint); font-size: 13px;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border); cursor: pointer;
}

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-2 { grid-template-columns: 2fr 1fr; }
.grid-charts { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.card-eyebrow { font-size: 11px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- KPI card ---------- */
.kpi-card { position: relative; overflow: hidden; }
.kpi-value { font-family: var(--font-display); font-size: 30px; margin: 6px 0 8px; }
.kpi-trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.kpi-trend.up { color: var(--positive); background: var(--positive-soft); }
.kpi-trend.down { color: var(--negative); background: var(--negative-soft); }
.kpi-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }

.progress-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--positive)); border-radius: 999px; transition: width .6s ease; }

/* ---------- Health score gauge ---------- */
.health-score-wrap { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.gauge { position: relative; width: 160px; height: 160px; }
.gauge svg { transform: rotate(-90deg); }
.gauge-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-value .num { font-family: var(--font-display); font-size: 34px; }
.gauge-value .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Alerts ---------- */
.alert-item { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius-sm); margin-bottom: 8px; align-items: flex-start; }
.alert-item.critical { background: var(--negative-soft); }
.alert-item.attention { background: var(--warning-soft); }
.alert-item.opportunity { background: var(--positive-soft); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alert-item.critical .alert-dot { background: var(--negative); }
.alert-item.attention .alert-dot { background: var(--warning); }
.alert-item.opportunity .alert-dot { background: var(--positive); }
.alert-text strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.alert-text span { font-size: 13px; color: var(--text-muted); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--text-faint); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.gold { background: var(--accent-soft); color: var(--accent); }
.pill.green { background: var(--positive-soft); color: var(--positive); }
.pill.red { background: var(--negative-soft); color: var(--negative); }
.pill.blue { background: var(--info-soft); color: var(--info); }
.pill.grey { background: var(--surface-2); color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: var(--radius-sm); padding: 11px 18px; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .12s, opacity .15s, background .15s; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: .88; }
.btn-accent { background: var(--accent); color: var(--accent-contrast); }
.btn-accent:hover { opacity: .9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-full { width: 100%; }
.btn-lg { padding: 15px 20px; font-size: 15px; border-radius: var(--radius-md); }

input, select, textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { font-size: 13px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state h3 { font-family: var(--font-display); font-size: 20px; color: var(--text); margin-bottom: 8px; }
.empty-state p { margin: 0 0 18px; font-size: 14px; }

/* ---------- Login screen ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, var(--surface-2), var(--bg) 60%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 40px 32px; box-shadow: var(--shadow-lg); text-align: center;
}
.login-mark { font-family: var(--font-display); font-size: 30px; margin-bottom: 4px; letter-spacing: .02em; }
.login-mark span { color: var(--accent); }
.brand-logo { display: flex; justify-content: center; margin-bottom: 4px; }
.brand-logo svg { width: 210px; height: auto; }
.login-tag { color: var(--text-muted); font-size: 13px; margin-bottom: 32px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 14px; cursor: pointer; color: var(--text);
}
.google-btn:hover { border-color: var(--accent); }

/* ---------- Mobile salesperson dashboard ---------- */
.mobile-shell { max-width: 480px; width: 100%; margin: 0 auto; padding-bottom: calc(var(--bottom-nav-h) + 16px); overflow-x: hidden; }
.mobile-header { padding: 20px 18px 8px; }
.mobile-header .greeting { font-size: 21px; overflow-wrap: break-word; word-break: break-word; }
.mobile-header .flex { min-width: 0; }
.quick-actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0 18px; margin: 18px 0; }
.qa-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text); text-align: center; }
.qa-btn:active { transform: scale(.96); }
.qa-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

@media (max-width: 360px) {
  .mobile-header { padding: 16px 14px 6px; }
  .mobile-header .greeting { font-size: 18px; }
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); padding: 0 14px; }
  .mx-18 { margin-left: 14px; margin-right: 14px; }
  .px-18 { padding-left: 14px; padding-right: 14px; }
  .kpi-value { font-size: 22px; }
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-h);
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  max-width: 480px; margin: 0 auto; z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-faint); font-size: 10.5px; font-weight: 600; flex: 1; }
.bn-item.active { color: var(--accent); }
.bn-fab { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); display: flex; align-items: center; justify-content: center; margin-top: -28px; box-shadow: var(--shadow-md); border: 4px solid var(--bg); }

.mx-18 { margin-left: 18px; margin-right: 18px; }
.px-18 { padding-left: 18px; padding-right: 18px; }

/* ---------- Sheet / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,9,6,.5); z-index: 90; display: none; align-items: flex-end; justify-content: center; }
.overlay.open { display: flex; }
.sheet { width: 100%; max-width: 480px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; animation: sheetUp .25s ease; }
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 999px; margin: 0 auto 18px; }

/* desktop modal variant */
@media (min-width: 640px) {
  .overlay { align-items: center; }
  .sheet { border-radius: var(--radius-lg); max-width: 460px; }
}

.gps-box { background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 18px; text-align: center; margin: 14px 0; }
.gps-status { font-size: 13px; color: var(--positive); font-weight: 600; margin-top: 8px; }

/* ---------- Map ---------- */
#retailer-map { width: 100%; height: 560px; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.map-popup { font-family: var(--font-body); min-width: 220px; }
.map-popup h4 { font-family: var(--font-display); font-size: 15px; margin-bottom: 2px; }
.map-popup .row { display: flex; justify-content: space-between; font-size: 12.5px; margin: 4px 0; color: var(--text-muted); }
.map-popup .actions { display: flex; gap: 6px; margin-top: 10px; }
.map-popup .actions button { flex: 1; font-size: 11.5px; padding: 7px; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 18px 16px 90px; }
  .topbar { gap: 10px; }
  .search-box { display: none; }
}


/* Added by fix-and-brand.php — sizing for the PNG logo */
.brand-logo-img { display: block; }
.brand-logo .brand-logo-img { width: 96px; height: 96px; margin: 0 auto; }
.brand-logo-sidebar .brand-logo-img { width: 40px; height: 40px; }
.brand-logo-mini .brand-logo-img { width: 34px; height: 34px; border-radius: 50%; }
