/* ============================================================
   Flog — dashboard-gauge design system
   Palette: graphite + amber headlight + teal readout
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

:root{
  --bg: #12151A;
  --surface: #1B1F27;
  --surface-2: #232833;
  --surface-3: #2A2F3A;
  --accent: #FF8A3D;
  --accent-dim: #FF8A3D33;
  --accent-2: #2DD4BF;
  --accent-2-dim: #2DD4BF26;
  --warn: #F2545B;
  --warn-dim: #F2545B26;
  --text: #EDEEF0;
  --text-dim: #8A8F99;
  --text-faint: #565C68;
  --border: #2A2F3A;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,body{
  margin:0; padding:0; height:100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

/* ---------- Light theme override ---------- */
html.theme-light{
  --bg: #F3F4F7;
  --surface: #FFFFFF;
  --surface-2: #F0F1F5;
  --surface-3: #E3E5EB;
  --text: #171A21;
  --text-dim: #5B606B;
  --text-faint: #9096A2;
  --border: #E3E5EB;
}
html.theme-light body{
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, #FF8A3D12, transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, #2DD4BF0d, transparent 55%);
}

body{
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, #FF8A3D14, transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, #2DD4BF10, transparent 55%);
  background-attachment: fixed;
}

.num, .gauge-value, .odo{
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

h1,h2,h3,.display{
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}

a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; }

#app{
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 18px calc(92px + var(--safe-bottom));
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar{
  display:flex; align-items:center; justify-content: space-between;
  margin-bottom: 18px;
}
.topbar .brand{
  display:flex; align-items:center; gap:10px;
}
.brand .mark{
  width:34px; height:34px; border-radius:10px;
  background: linear-gradient(135deg, var(--accent), #d9631e);
  display:flex; align-items:center; justify-content:center;
  font-family:'Rajdhani',sans-serif; font-weight:700; color:#12151A; font-size:16px;
  box-shadow: 0 0 0 1px #ffffff14, 0 6px 16px -6px var(--accent);
}
.brand h1{ font-size: 22px; color: var(--text); }
.brand .sub{ font-size: 11px; color: var(--text-dim); font-family:'Inter'; font-weight:500; }
.icon-btn{
  width: 36px; height: 36px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
}
.icon-btn:active{ background: var(--surface-2); }
.top-actions{ display:flex; align-items:center; gap:6px; }
.icon-btn.lang-btn{ width:auto; padding: 0 10px; font-size: 11px; font-weight:700; letter-spacing:.02em; }
.avatar-chip{
  width:36px; height:36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-2), #1f8e7f);
  color: #0C1210; font-weight:700; font-size: 12px; font-family:'Rajdhani';
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
@media (max-width: 400px){
  .top-actions .icon-btn.lang-btn{ display:none; }
}

/* ---------- Page header (list pages) ---------- */
.page-header{
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
  margin-bottom: 16px;
}
.page-sub{ font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.btn-mini{
  border:none; border-radius: 12px; padding: 10px 15px; font-weight:700; font-size:13px;
  font-family:'Rajdhani'; cursor:pointer; white-space:nowrap; flex-shrink:0;
}
.btn-mini.accent{ background: linear-gradient(135deg, var(--accent-2), #189d8c); color:#0C1210; }
.btn-mini.teal{ background: linear-gradient(135deg, #8B5CF6, #6d3fd6); color:#fff; }

/* ---------- Dashboard action row ---------- */
.dash-actions{ display:flex; gap:10px; margin: 16px 0 4px; }
.dash-actions .btn-primary{ font-size: 13.5px; padding: 13px; }
.dash-strip{ position:absolute; left:0; top:0; bottom:0; width:3px; border-radius: 10px 0 0 10px; }
.stat-card{ position:relative; overflow:hidden; }

/* ---------- Engine oil health card ---------- */
.oil-card{
  background: var(--surface); border:1px solid var(--border); border-left: 3px solid #F2A93B;
  border-radius: var(--radius); padding: 16px; margin-top:14px;
}
.oil-icon{
  width:42px; height:42px; border-radius: 12px; background: #F2A93B22;
  display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0;
}
.oil-title-row{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.oil-title{ font-family:'Rajdhani'; font-weight:700; font-size:15.5px; }
.oil-sub{ font-size: 12px; color: var(--text-dim); margin-top:3px; }
.oil-badge{ font-size: 10.5px; font-weight:700; padding: 3px 9px; border-radius:999px; text-transform:uppercase; letter-spacing:.03em; }
.oil-badge.ok{ background: var(--accent-2-dim); color: var(--accent-2); }
.oil-badge.soon{ background: #F2A93B26; color: #F2A93B; }
.oil-badge.warn{ background: var(--warn-dim); color: var(--warn); }
.oil-progress{ height:8px; border-radius:999px; background: var(--surface-3); overflow:hidden; }
.oil-progress-fill{ height:100%; border-radius:999px; background: var(--accent-2); }
.oil-progress-fill.soon{ background: #F2A93B; }
.oil-progress-fill.warn{ background: var(--warn); }

/* ---------- Service category checklist ---------- */
.cat-list{ display:flex; flex-direction:column; gap:8px; }
.cat-item{ width:100%; }

/* ---------- Vehicle selector ---------- */
.vehicle-pill{
  display:flex; align-items:center; gap:12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 18px;
  cursor:pointer;
}
.vehicle-pill .avatar{
  width:40px; height:40px; border-radius: 11px;
  background: linear-gradient(155deg, var(--accent-dim), transparent);
  border: 1px solid var(--accent-dim);
  display:flex; align-items:center; justify-content:center;
  font-size: 18px;
}
.vehicle-pill .info{ flex:1; min-width:0; }
.vehicle-pill .name{ font-family:'Rajdhani'; font-weight:700; font-size:16px; }
.vehicle-pill .meta{ font-size: 11.5px; color: var(--text-dim); }
.vehicle-pill .chev{ color: var(--text-faint); }

/* ---------- Section headers ---------- */
.section-title{
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600; font-family:'Inter';
  margin: 22px 0 10px;
}

/* ---------- Gauge (signature element) ---------- */
.gauge-card{
  background: radial-gradient(120% 140% at 50% 0%, #1F2430 0%, var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 18px 18px;
  display:flex; flex-direction:column; align-items:center;
  position: relative; overflow: hidden;
}
.gauge-card::before{
  content:''; position:absolute; inset:0;
  background: linear-gradient(180deg, var(--accent-dim), transparent 40%);
  opacity:.5; pointer-events:none;
}
.gauge-wrap{ position:relative; width: 220px; height: 130px; }
.gauge-wrap svg{ width:100%; height:100%; }
.gauge-center{
  position:absolute; left:0; right:0; bottom:6px; text-align:center;
}
.gauge-value{ font-size: 40px; font-weight:700; color: var(--accent); line-height:1; }
.gauge-unit{ font-size: 11px; color: var(--text-dim); letter-spacing:.06em; text-transform:uppercase; margin-top:4px; }
.gauge-label{ font-size: 12px; color: var(--text-dim); margin-top: 10px; z-index:1; }
.gauge-sub{
  display:flex; gap: 22px; margin-top: 14px; z-index:1;
}
.gauge-sub .item{ text-align:center; }
.gauge-sub .item .v{ font-size:15px; font-weight:700; color: var(--text); }
.gauge-sub .item .l{ font-size: 10.5px; color: var(--text-faint); text-transform:uppercase; letter-spacing:.06em; }

/* ---------- Stat cards grid ---------- */
.stat-grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
}
.stat-card .label{ font-size: 11px; color: var(--text-dim); text-transform:uppercase; letter-spacing:.04em; }
.stat-card .value{ font-size: 21px; font-weight:700; margin-top: 4px; }
.stat-card .value.accent{ color: var(--accent); }
.stat-card .value.teal{ color: var(--accent-2); }
.stat-card .value.warn{ color: var(--warn); }

/* ---------- Entry cards (log list) ---------- */
.entry-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}
.entry-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; }
.tag{
  display:inline-flex; align-items:center; gap:6px;
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
}
.tag.fuel{ background: var(--accent-dim); color: var(--accent); }
.tag.service{ background: var(--accent-2-dim); color: var(--accent-2); }
.entry-meta{ font-size: 12.5px; color: var(--text-dim); }
.entry-meta b{ color: var(--text); font-weight:600; }
.entry-body{ display:flex; align-items:center; gap: 16px; }
.entry-primary{ min-width: 84px; }
.entry-primary .num{ font-size: 26px; font-weight:700; color: var(--accent); line-height:1; }
.entry-primary.teal .num{ color: var(--accent-2); }
.entry-primary .unit{ font-size: 11px; color: var(--text-dim); margin-top:3px; }
.entry-facts{ flex:1; display:grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.fact{ display:flex; align-items:center; gap:7px; font-size: 12.5px; color: var(--text-dim); }
.dot{ width:8px; height:8px; border-radius:2px; flex-shrink:0; }
.fact b{ color: var(--text); font-weight:600; }
.entry-note{ margin-top:10px; font-size:12.5px; color:var(--text-dim); border-top:1px dashed var(--border); padding-top:10px; }
.entry-menu{ position:absolute; top:14px; right:14px; color: var(--text-faint); cursor:pointer; padding:4px; }

.empty-state{
  text-align:center; padding: 46px 20px; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: var(--radius); font-size: 13.5px;
}
.empty-state .big{ font-size: 30px; margin-bottom: 8px; }

/* ---------- Chart card ---------- */
.chart-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.chart-card canvas{ max-height: 220px; }
.chart-tabs{ display:flex; gap:8px; margin-bottom: 12px; }
.chip{
  font-size:12px; padding:6px 12px; border-radius:999px; border:1px solid var(--border);
  color: var(--text-dim); cursor:pointer; background: var(--surface-2); font-weight:500;
}
.chip.active{ background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }

/* ---------- Forms ---------- */
.form-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 90px;
}
.field{ margin-bottom: 18px; }
.field label{
  display:flex; align-items:center; gap:8px;
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; font-weight:500;
}
.field label .req{ color: var(--accent); }
.field input[type=text],
.field input[type=number],
.field input[type=date],
.field textarea, .field select{
  width:100%; background: var(--surface-2); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 13px; color: var(--text);
  font-size: 15px; font-family:'JetBrains Mono', monospace;
}
.field input[type=text]:not(.mono), .field textarea{ font-family:'Inter'; }
.field textarea{ resize: vertical; min-height: 60px; }
.field input:focus, .field select:focus, .field textarea:focus{
  outline:none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.field-row{ display:flex; gap:10px; }
.field-row .field{ flex:1; }
.check-row{ display:flex; gap:10px; }
.check-card{
  flex:1; display:flex; align-items:center; gap:10px;
  background: var(--surface-2); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 13px; cursor:pointer; font-size: 13px;
  color: var(--text-dim);
}
.check-card.checked{ border-color: var(--accent); color: var(--text); }
.checkbox{
  width:20px; height:20px; border-radius:6px; border: 1.5px solid var(--text-faint);
  flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:13px;
}
.check-card.checked .checkbox{ background: var(--accent); border-color: var(--accent); color:#12151A; }

.btn-primary{
  width:100%; padding: 15px; border:none; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #E8712A);
  color: #16130E; font-weight:700; font-size: 15px; font-family:'Rajdhani'; letter-spacing:.02em;
  cursor:pointer; box-shadow: 0 10px 24px -10px var(--accent);
}
.btn-primary:active{ transform: translateY(1px); }
.btn-secondary{
  width:100%; padding: 14px; border-radius:14px; border:1px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-weight:600; cursor:pointer; font-size: 14px;
}
.btn-danger{ color: var(--warn); }
.hint{ font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }

/* ---------- Fab ---------- */
.fab{
  position: fixed; right: calc(50% - 240px + 18px); bottom: calc(92px + var(--safe-bottom));
  width: 56px; height: 56px; border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #E8712A);
  color:#16130E; display:flex; align-items:center; justify-content:center;
  font-size: 26px; box-shadow: 0 14px 28px -10px var(--accent);
  border: none; cursor:pointer; z-index: 20;
}
@media (max-width: 520px){
  .fab{ right: 18px; }
}

/* ---------- Bottom nav ---------- */
.bottom-nav{
  position: fixed; left:0; right:0; bottom:0;
  background: rgba(18,21,26,0.9); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 10px 10px calc(10px + var(--safe-bottom));
  z-index: 30;
}
.bottom-nav .row{
  max-width: 480px; margin:0 auto; display:flex; justify-content:space-around;
}
.nav-item{
  display:flex; flex-direction:column; align-items:center; gap:3px;
  color: var(--text-faint); font-size: 10px; cursor:pointer; padding: 4px 10px;
  font-weight:600; border:none; background:none;
}
.nav-item svg{ width:21px; height:21px; }
.nav-item.active{ color: var(--accent); }
.nav-item .dot-mark{
  width:4px; height:4px; border-radius:50%; background: var(--accent);
  opacity:0; margin-top: 1px;
}
.nav-item.active .dot-mark{ opacity:1; }

/* ---------- Modal / sheet ---------- */
.sheet-overlay{
  position: fixed; inset:0; background: #000000a8; z-index: 50;
  display:flex; align-items:flex-end; justify-content:center;
}
.sheet{
  background: var(--surface); width:100%; max-width: 480px;
  border-radius: 20px 20px 0 0; border:1px solid var(--border); border-bottom:none;
  padding: 20px 18px calc(24px + var(--safe-bottom)); max-height: 82vh; overflow-y:auto;
}
.sheet-handle{ width:36px; height:4px; background: var(--surface-3); border-radius:2px; margin: 0 auto 16px; }
.sheet h3{ font-size: 18px; margin-bottom: 14px; }
.sheet-item{
  display:flex; align-items:center; gap:12px; padding: 13px 4px; border-bottom: 1px solid var(--border);
  cursor:pointer;
}
.sheet-item:last-child{ border-bottom:none; }
.sheet-item .avatar{
  width:36px; height:36px; border-radius:10px; background: var(--accent-dim);
  display:flex; align-items:center; justify-content:center; font-size:15px;
}

/* ---------- Auth ---------- */
.auth-wrap{
  min-height: 100vh; display:flex; flex-direction:column; justify-content:center;
  max-width: 380px; margin:0 auto; padding: 30px;
}
.auth-wrap .mark{
  width:56px; height:56px; border-radius:16px; margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--accent), #d9631e);
  display:flex; align-items:center; justify-content:center; font-size:26px;
  box-shadow: 0 12px 28px -10px var(--accent);
}
.auth-wrap h1{ text-align:center; font-size: 26px; margin-bottom: 4px; }
.auth-wrap p.sub{ text-align:center; color: var(--text-dim); font-size:13px; margin-bottom: 26px; }
.auth-toggle{ text-align:center; margin-top: 16px; font-size:13px; color: var(--text-dim); }
.auth-toggle b{ color: var(--accent); cursor:pointer; }
.auth-error{ color: var(--warn); font-size:12.5px; margin-top: -8px; margin-bottom:14px; }
.auth-divider{ display:flex; align-items:center; text-align:center; color: var(--text-faint); font-size:12px; margin: 4px 0 18px; }
.auth-divider::before, .auth-divider::after{ content:''; flex:1; border-bottom:1px solid var(--border); }
.auth-divider span{ padding: 0 12px; }

.loading-screen{
  min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
}
.spinner{
  width:30px; height:30px; border-radius:50%; border:3px solid var(--surface-3);
  border-top-color: var(--accent); animation: spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.toast{
  position: fixed; left:50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-bottom));
  background: var(--surface-2); border:1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 12px; font-size: 13px; z-index: 60;
  box-shadow: 0 10px 24px -10px #000;
}
