/* =============================================
   REVIEWLY v4 — PREMIUM DARK UI
   ============================================= */
:root {
  --bg: #08080f;
  --bg2: #0d0d1a;
  --bg3: #12121f;
  --surface: #181828;
  --surface2: #1e1e32;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --text: #eeeeff;
  --text2: #8888aa;
  --text3: #555570;

  --green: #22c55e; --green-dim: rgba(34,197,94,0.12); --green-glow: rgba(34,197,94,0.3);
  --amber: #f59e0b; --amber-dim: rgba(245,158,11,0.12);
  --red:   #ef4444; --red-dim:   rgba(239,68,68,0.12);
  --blue:  #3b82f6; --blue-dim:  rgba(59,130,246,0.12);
  --purple:#a855f7; --purple-dim:rgba(168,85,247,0.12);
  --teal:  #14b8a6; --teal-dim:  rgba(20,184,166,0.12);
  --pink:  #ec4899; --pink-dim:  rgba(236,72,153,0.12);
  --orange:#f97316; --orange-dim:rgba(249,115,22,0.12);
  --indigo:#6366f1;

  --radius:16px; --radius-sm:12px; --radius-xs:8px;
  --header-h:60px; --nav-h:68px;
  --safe-bottom: env(safe-area-inset-bottom,0px);
}

* { box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }

html, body {
  height:100%; overflow:hidden;
  background:var(--bg); color:var(--text);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,sans-serif;
  font-size:16px; -webkit-font-smoothing:antialiased;
  overscroll-behavior:none;
}

/* ---- SCREENS ---- */
.screen { position:fixed; inset:0; z-index:1; }
.screen.hidden { display:none; }
.screen.active { display:flex; flex-direction:column; }

/* ---- AUTH ---- */
#auth-screen { background:var(--bg); justify-content:flex-end; overflow:hidden; }
.auth-bg { position:absolute; inset:0; pointer-events:none; }
.auth-orb { position:absolute; border-radius:50%; filter:blur(80px); opacity:.4; animation:orbFloat 6s ease-in-out infinite alternate; }
.orb1 { width:300px; height:300px; background:#6366f1; top:-80px; left:-80px; }
.orb2 { width:240px; height:240px; background:#8b5cf6; top:80px; right:-80px; animation-delay:2s; }
.orb3 { width:220px; height:220px; background:#3b82f6; bottom:160px; left:15%; animation-delay:4s; }
@keyframes orbFloat { from{transform:translate(0,0) scale(1)} to{transform:translate(12px,-18px) scale(1.06)} }

.auth-container {
  position:relative; z-index:2;
  background:var(--bg2);
  border-top-left-radius:32px; border-top-right-radius:32px;
  padding:32px 24px calc(44px + var(--safe-bottom));
  border-top:1px solid var(--border2);
}
.auth-logo { text-align:center; margin-bottom:24px; }
.auth-logo-icon { font-size:52px; display:block; margin-bottom:8px; filter:drop-shadow(0 0 24px #6366f1); }
.auth-title {
  font-size:30px; font-weight:900;
  background:linear-gradient(135deg,#818cf8,#c084fc);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
}
.auth-subtitle { color:var(--text2); font-size:13px; margin-top:4px; }

.auth-tabs { display:flex; background:var(--surface); border-radius:var(--radius); padding:4px; margin-bottom:20px; gap:4px; }
.auth-tab { flex:1; padding:11px; border:none; background:transparent; color:var(--text2); border-radius:12px; font-size:14px; font-weight:600; cursor:pointer; transition:all .2s; font-family:inherit; }
.auth-tab.active { background:var(--surface2); color:var(--text); box-shadow:0 2px 8px rgba(0,0,0,.4); }

.input-group {
  display:flex; align-items:center;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:0 14px;
  margin-bottom:10px; min-height:52px; transition:border-color .2s;
}
.input-group:focus-within { border-color:#6366f1; box-shadow:0 0 0 3px rgba(99,102,241,.1); }
.input-group-textarea { align-items:flex-start; padding:12px 14px; }
.input-icon { font-size:18px; margin-right:10px; opacity:.7; flex-shrink:0; }
.input-group input, .input-group textarea, .input-group select {
  flex:1; background:transparent; border:none; outline:none;
  color:var(--text); font-size:15px; font-family:inherit; caret-color:#6366f1;
}
.input-group input::placeholder, .input-group textarea::placeholder { color:var(--text2); }
.input-group textarea { resize:none; line-height:1.5; }
.toggle-pw { background:none; border:none; cursor:pointer; font-size:18px; color:var(--text2); padding:0; margin-left:8px; }
.input-row-2 { display:flex; gap:8px; }
.input-row-2 .input-group { flex:1; }

.btn-primary {
  width:100%; padding:16px; border:none; border-radius:var(--radius-sm);
  background:linear-gradient(135deg,#6366f1,#8b5cf6);
  color:white; font-size:16px; font-weight:700; font-family:inherit;
  cursor:pointer; transition:all .2s;
  box-shadow:0 4px 20px rgba(99,102,241,.4); letter-spacing:.3px;
}
.btn-primary:active { transform:scale(.98); }
.btn-secondary {
  width:100%; padding:14px; border:1px solid var(--border2);
  border-radius:var(--radius-sm); background:transparent;
  color:var(--text2); font-size:15px; font-weight:600;
  font-family:inherit; cursor:pointer; margin-top:10px; transition:all .2s;
}
.auth-submit { margin-top:8px; }
.auth-error {
  background:var(--red-dim); border:1px solid rgba(239,68,68,.3);
  color:#fca5a5; border-radius:var(--radius-xs);
  padding:10px 14px; font-size:13px; margin-bottom:12px;
}
.hidden { display:none !important; }

/* ---- APP LAYOUT ---- */
#app-screen { background:var(--bg); flex-direction:column; }

.app-header {
  height:var(--header-h); display:flex; align-items:center;
  justify-content:space-between; padding:0 14px;
  background:var(--bg2); border-bottom:1px solid var(--border); z-index:10; flex-shrink:0;
}
.header-left { display:flex; align-items:center; gap:10px; }
.header-logo { font-size:22px; filter:drop-shadow(0 0 8px #6366f1); }
.header-title { font-size:16px; font-weight:800; }
.header-user { font-size:11px; color:var(--text2); }
.header-right { display:flex; gap:4px; }

.icon-btn {
  width:38px; height:38px; display:flex; align-items:center; justify-content:center;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-xs); cursor:pointer; color:var(--text2); transition:all .15s;
}
.icon-btn svg { width:17px; height:17px; }
.icon-btn:active { background:var(--surface2); color:var(--text); }
.pulse-btn { animation:pulseGlow 2.5s infinite; }
@keyframes pulseGlow {
  0%,100% { box-shadow:none; }
  50% { box-shadow:0 0 12px rgba(99,102,241,.5); border-color:rgba(99,102,241,.4); }
}

.bottom-nav {
  position:fixed; bottom:0; left:0; right:0;
  height:calc(var(--nav-h) + var(--safe-bottom));
  background:var(--bg2); border-top:1px solid var(--border);
  display:flex; align-items:center; z-index:100;
  padding-bottom:var(--safe-bottom);
}
.nav-btn {
  flex:1; display:flex; flex-direction:column; align-items:center;
  justify-content:center; gap:3px; background:none; border:none;
  cursor:pointer; color:var(--text2); font-size:10px; font-weight:600;
  font-family:inherit; padding:8px 0; transition:color .15s;
}
.nav-btn svg { width:21px; height:21px; transition:all .15s; }
.nav-btn.active { color:#818cf8; }
.nav-btn.active svg { filter:drop-shadow(0 0 6px #818cf8); }
.add-center-btn {
  width:50px; height:50px;
  background:linear-gradient(135deg,#6366f1,#8b5cf6);
  border-radius:50%; display:flex; align-items:center; justify-content:center;
  box-shadow:0 4px 18px rgba(99,102,241,.5); color:white; margin-bottom:2px;
}
.add-center-btn svg { width:22px; height:22px; }

/* ---- VIEWS ---- */
.view {
  position:absolute; top:var(--header-h); left:0; right:0;
  bottom:calc(var(--nav-h) + var(--safe-bottom));
  overflow:hidden;
}
.view.active { display:block; }
.view.hidden { display:none; }

.view-content {
  height:100%; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:14px 13px 0; overscroll-behavior-y:contain;
}
.view-content::-webkit-scrollbar { width:2px; }
.view-content::-webkit-scrollbar-thumb { background:var(--surface2); border-radius:2px; }

/* Map special */
#view-map { display:flex; flex-direction:column; }
#view-map.active { display:flex; }
#view-map.hidden { display:none; }

/* ---- DASHBOARD ---- */
.today-banner {
  background:linear-gradient(135deg,#1a1740,#2d2060,#1a1740);
  border-radius:var(--radius); padding:18px 18px 14px; margin-bottom:14px;
  border:1px solid rgba(99,102,241,.2);
}
.today-date { font-size:11px; color:#a5b4fc; font-weight:700; text-transform:uppercase; letter-spacing:1px; margin-bottom:4px; }
.today-greeting { font-size:22px; font-weight:800; color:white; }
.streak-badge {
  display:inline-flex; align-items:center; gap:5px;
  background:rgba(245,158,11,.18); border:1px solid rgba(245,158,11,.3);
  border-radius:20px; padding:4px 12px; font-size:12px; color:var(--amber); font-weight:700;
}

.kpi-scroll {
  display:flex; gap:9px; overflow-x:auto; padding-bottom:8px; margin-bottom:14px;
  -webkit-overflow-scrolling:touch; scrollbar-width:none;
}
.kpi-scroll::-webkit-scrollbar { display:none; }
.kpi-card {
  flex-shrink:0; width:108px; background:var(--surface);
  border-radius:var(--radius); padding:13px 10px;
  border:1px solid var(--border); cursor:pointer;
  transition:transform .15s,box-shadow .15s; text-align:center;
}
.kpi-card:active { transform:scale(.94); }
.kpi-icon { font-size:22px; margin-bottom:5px; }
.kpi-value { font-size:21px; font-weight:900; color:var(--text); line-height:1; margin-bottom:4px; }
.kpi-label { font-size:10px; color:var(--text2); font-weight:600; line-height:1.2; }

.kpi-indigo { border-color:rgba(99,102,241,.3); }
.kpi-green  { border-color:rgba(34,197,94,.3);  }
.kpi-amber  { border-color:rgba(245,158,11,.3); }
.kpi-red    { border-color:rgba(239,68,68,.3);  }
.kpi-purple { border-color:rgba(168,85,247,.3); }
.kpi-teal   { border-color:rgba(20,184,166,.3); }
.kpi-pink   { border-color:rgba(236,72,153,.3); }
.kpi-orange { border-color:rgba(249,115,22,.3); }

.section-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:15px; margin-bottom:11px;
}
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:13px; }
.section-title { font-size:13px; font-weight:700; color:var(--text); }
.section-badge { font-size:10px; background:var(--surface2); border-radius:20px; padding:3px 9px; color:var(--text2); }
.link-btn { background:none; border:none; color:#818cf8; font-size:12px; font-weight:700; cursor:pointer; font-family:inherit; }

.progress-row {
  display:flex; height:8px; border-radius:4px; overflow:hidden;
  background:var(--bg3); margin-bottom:9px; gap:2px;
}
.progress-bar-wrap { height:100%; border-radius:4px; transition:flex .6s cubic-bezier(.25,.46,.45,.94); min-width:0; }
.progress-legend { display:flex; gap:14px; }
.leg { font-size:11px; font-weight:600; }
.leg-green { color:var(--green); }
.leg-amber { color:var(--amber); }
.leg-red   { color:var(--red); }

.chart-wrap { position:relative; width:100%; }
.chart-wrap canvas { width:100% !important; }

.records-grid { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.record-item {
  background:var(--bg3); border-radius:var(--radius-sm);
  padding:11px; border:1px solid var(--border); text-align:center;
}
.record-emoji { font-size:18px; margin-bottom:5px; }
.record-value { font-size:17px; font-weight:800; color:var(--text); }
.record-label { font-size:10px; color:var(--text2); margin-top:3px; font-weight:600; }
.record-date { font-size:10px; color:var(--text3); margin-top:2px; }

.forecast-card { background:linear-gradient(135deg,rgba(99,102,241,.08),rgba(168,85,247,.08)); border-color:rgba(99,102,241,.2); }
.forecast-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:6px; }
.forecast-item { text-align:center; }
.forecast-val { font-size:18px; font-weight:800; color:#c084fc; }
.forecast-lbl { font-size:10px; color:var(--text2); margin-top:2px; }

/* Cat preview */
.cat-preview-item { display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--border); }
.cat-preview-item:last-child { border-bottom:none; }
.cat-rank { font-size:14px; font-weight:800; color:var(--text2); width:22px; flex-shrink:0; text-align:center; }
.cat-info { flex:1; min-width:0; }
.cat-name { font-size:13px; font-weight:700; color:var(--text); }
.cat-sub { font-size:11px; color:var(--text2); margin-top:1px; }
.cat-rate-badge { font-size:12px; font-weight:800; padding:4px 10px; border-radius:20px; flex-shrink:0; }
.rate-high { background:var(--green-dim); color:var(--green); }
.rate-mid  { background:var(--amber-dim); color:var(--amber); }
.rate-low  { background:var(--red-dim);   color:var(--red); }

/* Recent visits */
.visit-mini { display:flex; align-items:center; gap:9px; padding:9px 0; border-bottom:1px solid var(--border); cursor:pointer; }
.visit-mini:last-child { border-bottom:none; padding-bottom:0; }
.visit-mini:active { opacity:.7; }
.visit-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.visit-mini-info { flex:1; min-width:0; }
.visit-mini-name { font-size:13px; font-weight:700; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.visit-mini-sub  { font-size:11px; color:var(--text2); }
.visit-mini-time { font-size:11px; color:var(--text2); flex-shrink:0; }

/* ---- STATS ---- */
.stats-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.stats-title { font-size:20px; font-weight:800; }
.export-btn {
  display:flex; align-items:center; gap:5px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-xs); padding:7px 11px;
  color:var(--text2); font-size:11px; font-weight:700; cursor:pointer; font-family:inherit;
}
.stats-totals { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-bottom:11px; }
.stat-total-item { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px; text-align:center; }
.stat-total-val { font-size:22px; font-weight:900; color:var(--text); }
.stat-total-val.st-green  { color:var(--green); }
.stat-total-val.st-purple { color:var(--purple); }
.stat-total-val.st-blue   { color:var(--blue); }
.stat-total-val.st-amber  { color:var(--amber); }
.stat-total-val.st-teal   { color:var(--teal); }
.stat-total-val.st-pink   { color:var(--pink); }
.stat-total-val.st-red    { color:var(--red); }
.stat-total-lbl { font-size:10px; color:var(--text2); margin-top:3px; font-weight:600; }

.best-time-badge { text-align:center; font-size:12px; color:var(--text2); margin-top:8px; font-weight:600; }

.donut-wrap { display:flex; align-items:center; gap:14px; }
.donut-chart-wrap { flex:1; }
.donut-legend { flex-shrink:0; display:flex; flex-direction:column; gap:7px; }
.donut-leg-item { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text2); }
.donut-leg-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }

/* Rankings */
.rank-item { display:flex; align-items:center; gap:10px; padding:11px 0; border-bottom:1px solid var(--border); }
.rank-item:last-child { border-bottom:none; padding-bottom:0; }
.rank-num { font-size:17px; font-weight:900; color:var(--text2); width:26px; flex-shrink:0; text-align:center; }
.rank-num.gold { color:#fbbf24; }
.rank-num.silver { color:#94a3b8; }
.rank-num.bronze { color:#d97706; }
.rank-info { flex:1; min-width:0; }
.rank-name { font-size:13px; font-weight:700; color:var(--text); }
.rank-details { font-size:11px; color:var(--text2); margin-top:1px; }
.rank-bar-wrap { width:80px; height:5px; background:var(--bg3); border-radius:3px; margin-top:4px; }
.rank-bar { height:100%; border-radius:3px; background:linear-gradient(90deg,#6366f1,#8b5cf6); }
.rank-rate { font-size:13px; font-weight:800; color:var(--green); flex-shrink:0; }
.rank-extra { font-size:10px; color:var(--text2); flex-shrink:0; text-align:right; margin-left:4px; }

/* Price analysis */
.price-item { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.price-item:last-child { border-bottom:none; }
.price-tag { font-size:15px; font-weight:800; color:var(--purple); min-width:60px; }
.price-info { flex:1; }
.price-details { font-size:12px; color:var(--text2); }
.price-profit { font-size:13px; font-weight:700; color:var(--green); }

/* Rejection */
.rej-bar-item { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); }
.rej-bar-item:last-child { border-bottom:none; }
.rej-label { flex:1; font-size:13px; color:var(--text); }
.rej-count { font-size:13px; font-weight:800; color:var(--red); min-width:30px; text-align:right; }
.rej-bar-bg { height:5px; background:var(--bg3); border-radius:3px; margin-top:4px; }
.rej-bar-fill { height:100%; border-radius:3px; background:var(--red); }

/* ---- ADD FORM ---- */
.form-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.back-btn {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-xs); width:36px; height:36px;
  display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--text2);
}
.form-title { font-size:17px; font-weight:800; }

.status-select-section { margin-bottom:15px; }
.status-label { font-size:11px; color:var(--text2); font-weight:700; text-transform:uppercase; letter-spacing:1px; margin-bottom:9px; }
.status-btns { display:flex; gap:7px; }
.status-btn {
  flex:1; display:flex; flex-direction:column; align-items:center;
  gap:5px; padding:13px 6px; border:2px solid var(--border);
  border-radius:var(--radius); background:var(--surface); color:var(--text2);
  font-size:11px; font-weight:700; font-family:inherit; cursor:pointer; transition:all .2s;
}
.status-btn-icon { font-size:22px; }
.status-passed.selected { background:var(--green-dim); border-color:var(--green); color:var(--green); box-shadow:0 4px 16px var(--green-glow); }
.status-follow.selected { background:var(--amber-dim); border-color:var(--amber); color:var(--amber); box-shadow:0 4px 14px rgba(245,158,11,.25); }
.status-failed.selected { background:var(--red-dim);   border-color:var(--red);   color:var(--red);   box-shadow:0 4px 14px rgba(239,68,68,.2); }

.form-section { margin-bottom:17px; }
.form-section-title { font-size:11px; color:var(--text2); font-weight:700; text-transform:uppercase; letter-spacing:.8px; margin-bottom:9px; }

/* GPS */
.gps-section { margin-top:8px; }
.gps-row { display:flex; align-items:center; gap:9px; margin-bottom:8px; }
.geo-btn {
  display:flex; align-items:center; gap:6px; padding:8px 13px;
  border:1px solid var(--border); border-radius:var(--radius-xs);
  background:var(--surface2); color:var(--text2); font-size:12px;
  font-weight:700; cursor:pointer; font-family:inherit; transition:all .15s; flex-shrink:0;
}
.geo-btn.captured { border-color:var(--green); color:var(--green); background:var(--green-dim); }
.geo-status { font-size:12px; color:var(--text2); }
.gps-hint { font-size:11px; color:var(--text3); margin-top:6px; line-height:1.4; background:var(--bg3); padding:8px 10px; border-radius:8px; border:1px solid var(--border); }

/* Category grid */
.category-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.cat-tile {
  padding:9px 5px; border:1px solid var(--border);
  border-radius:var(--radius-xs); background:var(--surface);
  color:var(--text2); font-size:11px; font-weight:600; text-align:center;
  cursor:pointer; transition:all .15s; line-height:1.3; user-select:none;
}
.cat-tile:active { transform:scale(.93); }
.cat-tile.selected { background:rgba(99,102,241,.15); border-color:#6366f1; color:#a5b4fc; }
/* Quick chips for Cards & Price */
.quick-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.quick-chip {
  flex: 1 1 calc(33.333% - 8px);
  min-width: 85px;
  padding: 13px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  user-select: none;
}
.quick-chip:active {
  transform: scale(0.94);
}
.quick-chip.selected {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 14px var(--green-glow);
}
.price-chip.selected {
  background: var(--purple-dim);
  border-color: #a855f7;
  color: #c084fc;
  box-shadow: 0 0 14px rgba(168,85,247,0.3);
}

.stepper-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.stepper-btn {
  width: 50px;
  height: 50px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  user-select: none;
  flex-shrink: 0;
}
.stepper-btn:active {
  background: var(--surface);
  transform: scale(0.92);
}
.stepper-input-group {
  flex: 1;
  margin-bottom: 0 !important;
}

.deal-calc-box {
  background: linear-gradient(135deg, rgba(34,197,94,0.12), rgba(168,85,247,0.12));
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.deal-calc-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
  font-weight: 700;
  margin-bottom: 4px;
}
.deal-calc-math {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}
.deal-calc-profit {
  font-size: 24px;
  font-weight: 900;
  color: var(--green);
  margin-top: 4px;
  text-shadow: 0 0 14px var(--green-glow);
}

/* Rejection grid */
.rejection-grid { display:flex; flex-wrap:wrap; gap:8px; }
.rej-chip {
  padding:8px 14px; border:1px solid var(--border); border-radius:20px;
  background:var(--surface); color:var(--text2); font-size:12px; font-weight:600;
  cursor:pointer; font-family:inherit; transition:all .15s;
}
.rej-chip:active { transform:scale(.95); }
.rej-chip.selected { background:var(--red-dim); border-color:var(--red); color:var(--red); }

/* Star rating */
.rating-row { display:flex; gap:6px; margin-bottom:6px; }
.star-btn {
  font-size:26px; background:none; border:none; cursor:pointer;
  opacity:.3; transition:opacity .15s, transform .15s; padding:2px 4px;
}
.star-btn.active { opacity:1; }
.star-btn:active { transform:scale(1.2); }
.rating-hint { font-size:12px; color:var(--text2); }

.submit-btn { margin-top:4px; }

/* ---- MAP ---- */
.map-controls {
  padding:9px 13px 6px; background:var(--bg2);
  border-bottom:1px solid var(--border); z-index:10; flex-shrink:0;
}
.map-filter-chips { display:flex; gap:7px; overflow-x:auto; scrollbar-width:none; margin-bottom:6px; }
.map-filter-chips::-webkit-scrollbar { display:none; }
.map-chip {
  flex-shrink:0; padding:6px 13px; border-radius:20px;
  border:1px solid var(--border); background:var(--surface);
  color:var(--text2); font-size:11px; font-weight:700; cursor:pointer;
  font-family:inherit; white-space:nowrap; transition:all .15s;
}
.map-chip.active        { background:#6366f1; border-color:#6366f1; color:white; }
.chip-green.active { background:var(--green); border-color:var(--green); }
.chip-amber.active { background:var(--amber); border-color:var(--amber); }
.chip-red.active   { background:var(--red);   border-color:var(--red); }
.chip-blue.active  { background:var(--blue);  border-color:var(--blue); }

.map-stats-bar { display:flex; gap:12px; font-size:11px; color:var(--text2); padding:0 2px; }
.map-stat { display:flex; align-items:center; gap:4px; font-weight:600; }

#map { flex:1; z-index:1; }
.map-legend {
  position:absolute; bottom:calc(var(--nav-h) + var(--safe-bottom) + 10px); left:10px;
  background:rgba(8,8,15,.9); backdrop-filter:blur(10px);
  border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:7px 11px; display:flex; gap:11px; z-index:10;
}
.map-leg-item { display:flex; align-items:center; gap:4px; font-size:10px; color:var(--text2); }
.map-dot { width:8px; height:8px; border-radius:50%; }
.green-dot { background:var(--green); }
.amber-dot { background:var(--amber); }
.red-dot   { background:var(--red); }

/* Leaflet dark */
.leaflet-container { background:#0d0d1a !important; font-family:'Inter',sans-serif; }
.leaflet-control-zoom a { background:var(--surface) !important; color:var(--text) !important; border-color:var(--border) !important; }
.leaflet-popup-content-wrapper { background:var(--bg2) !important; color:var(--text) !important; border:1px solid var(--border2); border-radius:12px !important; }
.leaflet-popup-tip { background:var(--bg2) !important; }
.leaflet-popup-close-button { color:var(--text2) !important; }

/* User Live GPS Marker */
.user-gps-dot {
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px #3b82f6;
  animation: pulseGps 1.8s infinite;
}
@keyframes pulseGps {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  70% { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.map-locate-btn {
  position: absolute;
  top: 70px;
  right: 12px;
  z-index: 1000;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ---- LIST ---- */
.list-sticky {
  position:sticky; top:0; z-index:5;
  background:var(--bg2); border-bottom:1px solid var(--border);
  padding:10px 13px 6px;
}
.search-bar {
  display:flex; align-items:center; gap:9px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:9px 13px; margin-bottom:9px;
}
.search-bar svg { color:var(--text2); flex-shrink:0; }
.search-bar input { flex:1; background:none; border:none; outline:none; color:var(--text); font-size:14px; font-family:inherit; }
.search-bar input::placeholder { color:var(--text2); }
.clear-search { background:none; border:none; color:var(--text2); cursor:pointer; font-size:13px; padding:0; }

.filter-row { display:flex; align-items:center; gap:8px; margin-bottom:7px; }
.filter-chips { display:flex; gap:7px; overflow-x:auto; flex:1; scrollbar-width:none; }
.filter-chips::-webkit-scrollbar { display:none; }
.chip {
  flex-shrink:0; padding:5px 13px; border-radius:20px;
  border:1px solid var(--border); background:var(--surface);
  color:var(--text2); font-size:11px; font-weight:700; cursor:pointer;
  font-family:inherit; transition:all .15s;
}
.chip.active         { background:#6366f1; border-color:#6366f1; color:white; }
.chip-green.active { background:var(--green); border-color:var(--green); }
.chip-amber.active { background:var(--amber); border-color:var(--amber); }
.chip-red.active   { background:var(--red);   border-color:var(--red); }

.sort-select-wrap { flex-shrink:0; }
.sort-select {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-xs); padding:6px 10px;
  color:var(--text); font-size:11px; font-weight:600;
  font-family:inherit; outline:none; cursor:pointer;
}

.list-summary { font-size:11px; color:var(--text2); padding:0 2px 2px; }

/* Visit cards */
.visit-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:13px; margin-bottom:9px;
  cursor:pointer; transition:transform .15s; position:relative; overflow:hidden;
}
.visit-card::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; }
.visit-card.vc-passed::before { background:var(--green); }
.visit-card.vc-follow_up::before { background:var(--amber); }
.visit-card.vc-failed::before { background:var(--red); }
.visit-card:active { transform:scale(.98); }
.vc-top { display:flex; align-items:flex-start; justify-content:space-between; gap:9px; }
.vc-name { font-size:14px; font-weight:700; color:var(--text); margin-bottom:2px; }
.vc-street { font-size:12px; color:var(--text2); }
.vc-status-pill { font-size:10px; font-weight:700; padding:4px 9px; border-radius:20px; white-space:nowrap; flex-shrink:0; }
.pill-passed   { background:var(--green-dim); color:var(--green); }
.pill-follow_up{ background:var(--amber-dim); color:var(--amber); }
.pill-failed   { background:var(--red-dim);   color:var(--red); }
.vc-bottom { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:7px; }
.vc-tag { font-size:10px; color:var(--text2); background:var(--bg3); border-radius:5px; padding:2px 7px; }
.vc-profit { font-size:12px; font-weight:700; color:var(--green); margin-left:auto; }
.vc-rating { font-size:11px; }

/* Empty / Skeleton */
.empty-state { text-align:center; padding:50px 20px; color:var(--text2); }
.empty-emoji { font-size:44px; margin-bottom:10px; }
.empty-text  { font-size:15px; font-weight:700; color:var(--text); margin-bottom:5px; }
.empty-sub   { font-size:12px; }
.skeleton-list { padding:12px 13px; }
.skeleton-item { height:75px; background:var(--surface); border-radius:var(--radius); margin-bottom:9px; animation:shimmer 1.4s infinite; }
@keyframes shimmer { 0%,100%{opacity:.35} 50%{opacity:.7} }

/* ---- BOTTOM SHEET ---- */
.overlay { position:fixed; inset:0; background:rgba(0,0,0,.6); backdrop-filter:blur(4px); z-index:200; }
.bottom-sheet {
  position:fixed; left:0; right:0; bottom:0; z-index:201;
  background:var(--bg2); border-top-left-radius:24px; border-top-right-radius:24px;
  border-top:1px solid var(--border2); max-height:88vh; overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding-bottom:calc(24px + var(--safe-bottom));
}
.bottom-sheet.hidden { display:none; }
.sheet-handle { width:38px; height:4px; background:var(--surface2); border-radius:2px; margin:11px auto 15px; }
.sheet-content { padding:0 18px 18px; }
.sheet-header { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:14px; }
.sheet-title { font-size:17px; font-weight:800; color:var(--text); margin-bottom:3px; }
.sheet-subtitle { font-size:12px; color:var(--text2); }
.sheet-status-badge { padding:5px 12px; border-radius:20px; font-size:11px; font-weight:700; flex-shrink:0; }
.sheet-body { background:var(--surface); border-radius:var(--radius-sm); padding:13px; margin-bottom:14px; }
.sheet-field { display:flex; justify-content:space-between; align-items:flex-start; padding:7px 0; border-bottom:1px solid var(--border); }
.sheet-field:last-child { border-bottom:none; }
.sheet-field-label { font-size:11px; color:var(--text2); font-weight:600; }
.sheet-field-value { font-size:12px; font-weight:700; color:var(--text); text-align:right; max-width:210px; word-break:break-word; }
.sheet-actions { display:flex; gap:9px; }
.btn-icon-label {
  flex:1; display:flex; align-items:center; justify-content:center;
  gap:7px; padding:12px; border-radius:var(--radius-sm);
  font-size:13px; font-weight:700; font-family:inherit; cursor:pointer; border:none; transition:all .15s;
}
.btn-edit   { background:var(--surface2); color:var(--text); }
.btn-delete { background:var(--red-dim); color:var(--red); border:1px solid rgba(239,68,68,.3); }

/* ---- TOAST ---- */
.toast {
  position:fixed; bottom:calc(var(--nav-h) + var(--safe-bottom) + 14px);
  left:50%; transform:translateX(-50%);
  background:var(--surface2); border:1px solid var(--border2);
  border-radius:var(--radius-sm); padding:11px 18px;
  font-size:13px; font-weight:700; color:var(--text); z-index:999;
  white-space:nowrap; box-shadow:0 4px 24px rgba(0,0,0,.5);
  animation:toastIn .3s ease;
}
.toast-success { background:var(--green-dim); border-color:var(--green); color:var(--green); }
.toast-error   { background:var(--red-dim);   border-color:var(--red);   color:var(--red); }
@keyframes toastIn { from{opacity:0;transform:translateX(-50%) translateY(10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }

/* ---- SPINNER ---- */
.spinner {
  display:inline-block; width:17px; height:17px;
  border:2px solid rgba(255,255,255,.2); border-top-color:white;
  border-radius:50%; animation:spin .7s linear infinite; vertical-align:middle;
}
@keyframes spin { to{transform:rotate(360deg)} }
