:root{
  --bg:#0a0d12; --surface:#12161d; --surface-2:#191f28; --surface-3:#212936;
  --border:#232b37; --text:#e9eef4; --text-dim:#8f9bab; --text-faint:#5a6473;
  --green:#3ddc97; --green-dim:#1d5c46; --blue:#4f8cff; --blue-dim:#1f3a6b;
  --amber:#f5a83c; --amber-dim:#5c4319; --red:#f2685c; --red-dim:#5c2622; --gold:#e0b24a;
  --radius:14px; --mono:'SF Mono','Cascadia Code',Consolas,monospace;
  --sans:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --nav-h:64px; --topbar-h:54px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font-family:var(--sans);height:100%;}
#root{min-height:100vh;display:flex;flex-direction:column;}
a{color:inherit;}

/* ---------------- TOPBAR ---------------- */
.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  height:var(--topbar-h);min-height:var(--topbar-h);padding:0 14px;
  background:linear-gradient(180deg,#141a22,#10141a);border-bottom:1px solid var(--border);
  position:sticky;top:0;z-index:20;
}
.brand{display:flex;align-items:center;gap:9px;font-weight:700;font-size:14px;letter-spacing:.2px;min-width:0;}
.brand .bolt{width:26px;height:26px;border-radius:8px;flex-shrink:0;
  background:linear-gradient(135deg,var(--green),#1b9d6b);display:flex;align-items:center;justify-content:center;color:#04150e;font-size:14px;font-weight:900;}
.brand .txt{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.role-pill{
  display:flex;align-items:center;gap:7px;background:var(--surface);border:1px solid var(--border);
  padding:6px 10px 6px 6px;border-radius:999px;cursor:pointer;flex-shrink:0;
}
.role-pill .dot{width:8px;height:8px;border-radius:50%;}
.role-pill.reception .dot{background:var(--green);box-shadow:0 0 8px var(--green);}
.role-pill.mechanic .dot{background:var(--blue);box-shadow:0 0 8px var(--blue);}
.role-pill.owner .dot{background:var(--gold);box-shadow:0 0 8px var(--gold);}
.role-pill .lbl{font-size:12px;font-weight:600;}
.role-pill .chev{color:var(--text-faint);font-size:10px;}

/* ---------------- ROLE SWITCH SHEET ---------------- */
.sheet-backdrop{
  position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:40;
  display:flex;align-items:flex-end;justify-content:center;
}
@media(min-width:640px){.sheet-backdrop{align-items:center;}}
.sheet{
  background:var(--surface);border:1px solid var(--border);border-bottom:none;
  border-radius:18px 18px 0 0;padding:10px 14px calc(20px + env(safe-area-inset-bottom));
  width:100%;max-width:480px;
}
@media(min-width:640px){.sheet{border-radius:18px;border-bottom:1px solid var(--border);padding:18px;}}
.sheet-handle{width:36px;height:4px;background:var(--surface-3);border-radius:99px;margin:6px auto 14px;}
.sheet-title{font-size:13px;color:var(--text-faint);text-transform:uppercase;letter-spacing:.6px;margin:4px 4px 10px;font-weight:700;}
.sheet-item{
  display:flex;align-items:center;gap:12px;padding:14px 12px;border-radius:12px;cursor:pointer;
}
.sheet-item:active,.sheet-item:hover{background:var(--surface-2);}
.sheet-item .dot{width:10px;height:10px;border-radius:50%;}
.sheet-item.reception .dot{background:var(--green);}
.sheet-item.mechanic .dot{background:var(--blue);}
.sheet-item.owner .dot{background:var(--gold);}
.sheet-item .t{font-weight:700;font-size:14.5px;}
.sheet-item .s{font-size:11.5px;color:var(--text-faint);}
.sheet-item.active{background:var(--surface-3);}

/* ---------------- BODY / LAYOUT ---------------- */
.body-wrap{flex:1;display:flex;min-height:0;}
.content{flex:1;overflow-y:auto;padding:16px 16px calc(var(--nav-h) + 24px);}
.content-inner{max-width:1180px;margin:0 auto;}

/* ---------------- NAV: bottom bar (mobile) / sidebar (desktop) ---------------- */
.nav{
  position:fixed;left:0;right:0;bottom:0;z-index:20;
  display:flex;background:var(--surface);border-top:1px solid var(--border);
  padding:6px 4px calc(6px + env(safe-area-inset-bottom));height:var(--nav-h);
}
.nav-item{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  color:var(--text-faint);cursor:pointer;border-radius:10px;font-size:10px;font-weight:600;padding:4px 2px;
}
.nav-item .ic{font-size:18px;line-height:1;}
.nav-item.active{color:var(--text);background:var(--surface-2);}
.nav-item.active.reception{color:var(--green);}
.nav-item.active.mechanic{color:var(--blue);}
.nav-item.active.owner{color:var(--gold);}

@media(min-width:900px){
  .body-wrap{padding-top:0;}
  .nav{
    position:sticky;top:var(--topbar-h);left:0;bottom:auto;height:calc(100vh - var(--topbar-h));
    flex-direction:column;width:220px;min-width:220px;border-top:none;border-right:1px solid var(--border);
    padding:16px 10px;gap:2px;align-items:stretch;
  }
  .nav-item{flex:none;flex-direction:row;justify-content:flex-start;gap:10px;padding:10px 12px;font-size:13.5px;}
  .nav-item .ic{font-size:15px;width:18px;text-align:center;}
  .content{padding:24px 28px calc(24px + 40px);}
}

/* ---------------- TYPE ---------------- */
h1.page-title{font-size:19px;margin:2px 0 4px;letter-spacing:.2px;}
p.page-sub{color:var(--text-faint);font-size:12.5px;margin:0 0 18px;}

/* ---------------- GRID ---------------- */
.grid{display:grid;gap:12px;}
.grid-2{grid-template-columns:1fr;}
.grid-3{grid-template-columns:1fr;}
.grid-4{grid-template-columns:repeat(2,1fr);}
@media(min-width:640px){.grid-4{grid-template-columns:repeat(4,1fr);}.grid-3{grid-template-columns:repeat(3,1fr);}}
@media(min-width:800px){.grid-2{grid-template-columns:1fr 1fr;}}

.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;}
.card-title{font-size:11.5px;color:var(--text-faint);text-transform:uppercase;letter-spacing:.6px;margin:0 0 10px;font-weight:700;}

.stat{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:14px 15px;}
.stat .label{font-size:10.5px;color:var(--text-faint);text-transform:uppercase;letter-spacing:.4px;margin-bottom:7px;}
.stat .value{font-size:22px;font-weight:700;font-family:var(--mono);}
.stat .value.green{color:var(--green);} .stat .value.blue{color:var(--blue);}
.stat .value.amber{color:var(--amber);} .stat .value.red{color:var(--red);}
.stat .delta{font-size:10.5px;color:var(--text-faint);margin-top:4px;}

/* ---------------- BUTTONS ---------------- */
.btn{appearance:none;border:1px solid var(--border);background:var(--surface-3);color:var(--text);
  padding:12px 16px;border-radius:12px;font-size:14px;font-weight:600;cursor:pointer;transition:.12s;min-height:44px;
  text-decoration:none;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;}
.btn:active{filter:brightness(1.2);}
.btn.primary{background:linear-gradient(135deg,var(--green),#1b9d6b);border:none;color:#04170f;}
.btn.primary.blue{background:linear-gradient(135deg,var(--blue),#2a5dc7);color:#eef3ff;}
.btn.primary.gold{background:linear-gradient(135deg,var(--gold),#b8872a);color:#1c1204;}
.btn.ghost{background:transparent;}
.btn.danger{background:var(--red-dim);border-color:#7a3630;color:#ffcfc9;}
.btn.sm{padding:8px 12px;font-size:12.5px;min-height:36px;}
.btn.block{width:100%;text-align:center;}
.btn:disabled{opacity:.4;}
.btn-row{display:flex;gap:10px;margin-top:16px;flex-wrap:wrap;}
.btn-row .btn{flex:1;min-width:140px;}

/* ---------------- BADGES ---------------- */
.badge{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;font-size:10.5px;font-weight:700;white-space:nowrap;}
.badge.diag{background:var(--amber-dim);color:var(--amber);} .badge.repair{background:var(--blue-dim);color:var(--blue);}
.badge.ready{background:var(--green-dim);color:var(--green);} .badge.wait{background:var(--red-dim);color:var(--red);}
.badge.out{background:var(--surface-3);color:var(--text-dim);}

/* ---------------- LISTS ---------------- */
.list{display:flex;flex-direction:column;gap:8px;}
.row{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--surface-2);
  border:1px solid var(--border);border-radius:12px;padding:12px;cursor:pointer;min-height:56px;}
.row:active{background:var(--surface-3);}
.row .left{display:flex;align-items:center;gap:11px;min-width:0;flex:1;}
.row .car-ic{width:34px;height:34px;border-radius:9px;background:var(--surface-3);display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0;overflow:hidden;}
.row .info{min-width:0;}
.row .info .id{font-family:var(--mono);font-size:11px;color:var(--text-faint);}
.row .info .name{font-size:13.5px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.row .info .sub{font-size:11px;color:var(--text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

table{width:100%;border-collapse:collapse;font-size:12.5px;}
th{text-align:left;color:var(--text-faint);font-size:10px;text-transform:uppercase;letter-spacing:.4px;padding:0 8px 8px;font-weight:700;}
td{padding:9px 8px;border-top:1px solid var(--border);}
td.num{font-family:var(--mono);text-align:right;white-space:nowrap;}

/* ---------------- FORMS ---------------- */
.field{margin-bottom:13px;}
.field label{display:block;font-size:12px;color:var(--text-dim);margin-bottom:6px;font-weight:600;}
.field input,.field textarea,.field select{width:100%;background:var(--surface-2);border:1px solid var(--border);
  border-radius:10px;padding:12px;color:var(--text);font-size:15px;font-family:var(--sans);}
.field textarea{resize:vertical;min-height:80px;}
.field input:focus,.field textarea:focus,.field select:focus{outline:none;border-color:var(--green);}

/* ---------------- PHOTOS ---------------- */
.photo-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;}
@media(min-width:560px){.photo-grid{grid-template-columns:repeat(4,1fr);}}
.photo{aspect-ratio:4/3;border-radius:11px;border:1px solid var(--border);
  background:linear-gradient(135deg,var(--surface-3),var(--surface-2));
  display:flex;align-items:center;justify-content:center;font-size:22px;color:var(--text-faint);position:relative;overflow:hidden;cursor:pointer;}
.photo.captured{border-color:var(--green);}
.photo .ok{position:absolute;top:6px;right:6px;width:18px;height:18px;border-radius:50%;background:var(--green);color:#04170f;font-size:11px;display:flex;align-items:center;justify-content:center;font-weight:900;}
.photo .cap{position:absolute;bottom:0;left:0;right:0;background:rgba(0,0,0,.55);font-size:10px;padding:4px 6px;color:var(--text-dim);}

/* ---------------- BARS ---------------- */
.bars{display:flex;align-items:flex-end;gap:6px;height:80px;margin-top:8px;}
.bars .bar{flex:1;background:linear-gradient(180deg,var(--green),#0d5138);border-radius:5px 5px 0 0;min-height:4px;cursor:pointer;}
.bars .bar.blue{background:linear-gradient(180deg,var(--blue),#1a3a75);}
.bar-lbl{display:flex;gap:6px;margin-top:6px;}
.bar-lbl span{flex:1;text-align:center;font-size:9px;color:var(--text-faint);}

/* ---------------- MISC ---------------- */
.divider{height:1px;background:var(--border);margin:14px 0;}
.flex-between{display:flex;align-items:center;justify-content:space-between;gap:10px;}
.muted{color:var(--text-faint);}
.kv{display:flex;justify-content:space-between;padding:8px 0;font-size:13px;border-bottom:1px dashed var(--border);}
.kv:last-child{border-bottom:none;}
.kv .k{color:var(--text-dim);} .kv .v{font-weight:700;font-family:var(--mono);}
.back-link{display:inline-flex;align-items:center;gap:6px;color:var(--text-faint);font-size:13px;cursor:pointer;margin-bottom:14px;padding:6px 0;}
.pill-tabs{display:flex;gap:8px;margin-bottom:16px;overflow-x:auto;padding-bottom:2px;-webkit-overflow-scrolling:touch;}
.pill-tab{padding:8px 14px;border-radius:999px;background:var(--surface-2);border:1px solid var(--border);font-size:12.5px;color:var(--text-dim);cursor:pointer;font-weight:600;white-space:nowrap;flex-shrink:0;}
.pill-tab.active{background:var(--surface-3);color:var(--text);border-color:#3a4757;}
.toast{position:fixed;bottom:calc(var(--nav-h) + 16px);left:50%;transform:translateX(-50%) translateY(20px);
  background:var(--surface-3);border:1px solid #33404f;color:var(--text);padding:12px 18px;border-radius:11px;
  font-size:13px;box-shadow:0 10px 30px rgba(0,0,0,.5);opacity:0;transition:.25s;pointer-events:none;z-index:999;
  display:flex;align-items:center;gap:8px;max-width:90vw;}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}
.toast .tic{color:var(--green);font-weight:900;}
.empty{padding:34px 16px;text-align:center;color:var(--text-faint);font-size:13px;}
.msg-log{display:flex;flex-direction:column;gap:8px;margin-top:12px;}
.msg-item{background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:10px 12px;font-size:12.5px;}
.msg-item .t{color:var(--text-faint);font-size:10px;font-family:var(--mono);margin-bottom:3px;}
.stepper{display:flex;align-items:center;gap:10px;}
.stepper button{width:36px;height:36px;border-radius:9px;border:1px solid var(--border);background:var(--surface-3);color:var(--text);font-size:17px;cursor:pointer;}
.stepper .n{font-family:var(--mono);font-weight:700;min-width:22px;text-align:center;}
.low-dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:6px;}
.mic-btn{width:84px;height:84px;border-radius:50%;border:2px solid var(--border);background:var(--surface-2);
  display:flex;align-items:center;justify-content:center;font-size:30px;margin:6px auto;cursor:pointer;transition:.15s;}
.mic-btn.rec{border-color:var(--red);background:var(--red-dim);animation:pulse 1.2s infinite;}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(242,104,92,.5);}70%{box-shadow:0 0 0 14px rgba(242,104,92,0);}100%{box-shadow:0 0 0 0 rgba(242,104,92,0);}}
.timer-display{font-family:var(--mono);font-size:44px;font-weight:700;text-align:center;letter-spacing:1px;margin:14px 0;}
.qr-box{width:150px;height:150px;margin:0 auto;background:#fff;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:11px;color:#111;font-family:var(--mono);padding:10px;text-align:center;}
.check-row{display:flex;align-items:center;gap:10px;padding:12px;border-radius:11px;background:var(--surface-2);border:1px solid var(--border);cursor:pointer;}
.check-row input{width:18px;height:18px;flex-shrink:0;}
.spinner{display:flex;justify-content:center;padding:40px;color:var(--text-faint);}
.suggest-box{position:relative;margin-top:-8px;margin-bottom:8px;}
.suggest-item{background:var(--surface-2);border:1px solid var(--border);border-top:none;padding:10px 12px;cursor:pointer;}
.suggest-item:first-child{border-top:1px solid var(--border);border-radius:0 0 0 0;}
.suggest-item:last-child{border-radius:0 0 10px 10px;}
.suggest-item:hover,.suggest-item:active{background:var(--surface-3);}
.suggest-item .s-main{font-size:13.5px;font-weight:600;}
.suggest-item .s-sub{font-size:11px;color:var(--text-faint);}
.linked-badge{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--green-dim);border:1px solid #1d5c46;border-radius:10px;padding:10px 12px;margin-bottom:14px;font-size:12.5px;color:var(--green);}
.linked-badge button{background:none;border:none;color:var(--text-dim);font-size:11px;cursor:pointer;text-decoration:underline;}
.ocr-status{font-size:11.5px;line-height:1.5;margin-top:8px;min-height:0;}
::-webkit-scrollbar{width:8px;height:8px;} ::-webkit-scrollbar-thumb{background:var(--surface-3);border-radius:6px;}
