/* ============================================================
   app.css — SideFric (survey hambatan samping)
   Palet dari logo aplikasi: aspal gelap, krem lapangan,
   oranye kerucut. Tema terang, kartu hitung gelap.
   ============================================================ */

/* ===== 1. TOKENS ===== */
:root{
  --bg:#EDEAE4;
  --surface:#FFFFFF;
  --surface-2:#E2DDD3;
  --ink:#262F36;
  --card:#2C3640;
  --card-2:#333E49;
  --cream:#EDEAE4;
  --muted:#6E6A60;
  --line:#D8D2C6;
  --outline:#C6C0B2;
  --orange:#FD9420;
  --orange-dark:#E07F12;
  --ok:#12805C;
  --danger:#B3401F;
  --radius-sm:8px;
  --radius:12px;
  --radius-lg:16px;
  --shadow-sm:0 1px 2px rgba(38,47,54,.06), 0 1px 3px rgba(38,47,54,.08);
  --shadow-md:0 4px 14px rgba(38,47,54,.12);
  --font:'Inter','Segoe UI',system-ui,-apple-system,Roboto,sans-serif;
  --mono:'Cascadia Mono','Consolas','SF Mono',ui-monospace,monospace;
}

*{ box-sizing:border-box; margin:0; padding:0; }
html{ -webkit-text-size-adjust:100%; }
body{
  font-family:var(--font);
  background:var(--bg);
  color:var(--ink);
  min-height:100vh;
  -webkit-tap-highlight-color:transparent;
}
button{ font:inherit; color:inherit; background:none; border:none; cursor:pointer; }
input{ font:inherit; }
.hidden{ display:none !important; }

.ic{ width:18px; height:18px; flex:0 0 auto; }
.ic-lg{ width:24px; height:24px; }

/* ===== 2. CANGKANG ===== */
.app{
  max-width:600px;
  margin:0 auto;
  padding-bottom:28px;
  min-height:100vh;
}

/* ===== 3. HEADER ===== */
.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:11px;
  background:var(--ink);
  color:var(--cream);
  padding:10px 14px calc(10px) 14px;
  padding-top:calc(10px + env(safe-area-inset-top, 0px));
}
.brand{ display:flex; align-items:center; gap:10px; min-width:0; flex:1; }
.brand-logo{
  width:34px; height:34px; border-radius:9px;
  object-fit:cover; flex:0 0 auto;
}
.brand-text{ min-width:0; }
.brand-name{
  font-size:16px; font-weight:800; letter-spacing:-.01em;
  line-height:1.1;
}
.brand-sub{
  font-size:8.5px; font-weight:700; letter-spacing:.14em;
  color:var(--orange); margin-top:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* badge koneksi */
.conn{
  display:inline-flex; align-items:center; gap:6px;
  padding:5px 10px;
  border-radius:999px;
  background:rgba(237,234,228,.10);
  border:1px solid rgba(237,234,228,.16);
  font-size:11px; font-weight:650;
  color:var(--cream);
  white-space:nowrap;
}
.conn-dot{
  width:7px; height:7px; border-radius:50%;
  background:var(--muted);
}
.conn.online .conn-dot{ background:#38D39F; }
.conn.syncing .conn-dot{ background:var(--orange); animation:pulse 1.1s infinite; }
.conn.offline .conn-dot,
.conn.lokal .conn-dot{ background:#F97066; }
@keyframes pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }

/* ===== 4. TAB ===== */
.tabs{
  display:grid; grid-template-columns:1fr 1fr;
  background:var(--ink);
  position:sticky; top:0; z-index:39;
  padding:0 8px;
}
.tab{
  position:relative;
  padding:12px 8px 13px;
  font-size:14px; font-weight:600;
  color:rgba(237,234,228,.62);
  transition:color .15s ease;
}
.tab.active{ color:var(--cream); }
.tab.active::after{
  content:"";
  position:absolute; left:12px; right:12px; bottom:0;
  height:3px; border-radius:3px 3px 0 0;
  background:var(--orange);
}

/* ===== 5. PANEL IDENTITAS ===== */
main{ padding:12px; }
.panel{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-sm);
}
.identity{
  display:flex; flex-direction:column; gap:11px;
  padding:14px;
  margin-bottom:10px;
}
.field{ display:flex; flex-direction:column; gap:5px; min-width:0; }
.field label{
  font-size:11px; font-weight:700;
  letter-spacing:.06em; text-transform:uppercase;
  color:var(--muted);
}
.hint-inline{ font-weight:600; text-transform:none; letter-spacing:0; }
.field input{
  height:44px; width:100%;
  padding:0 13px;
  border:1.5px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  color:var(--ink);
  font-size:15px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder{ color:#A9A296; }
.field input:focus{
  outline:none;
  border-color:var(--ink);
  box-shadow:0 0 0 3px rgba(38,47,54,.08);
}

/* identitas ringkas saat sesi berjalan */
.identity-strip{
  display:none;
  align-items:center; gap:8px;
  background:var(--surface-2);
  border-radius:var(--radius);
  padding:9px 12px;
  margin-bottom:10px;
  font-size:13px; font-weight:600;
  color:var(--ink);
  min-width:0;
}
.identity-strip span{
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
body.running .identity-strip{ display:flex; }
body.running .identity{ display:none; }

/* ===== 6. KARTU JAM ===== */
.clock-card{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  background:var(--card);
  color:var(--cream);
  border:1px solid rgba(255,255,255,.08);
  border-radius:var(--radius);
  padding:12px 14px;
  margin-bottom:10px;
}
.clock-left{ min-width:0; }
.clock-right{ text-align:right; flex:0 0 auto; }
.clock-label{
  font-size:9.5px; font-weight:800;
  letter-spacing:.12em;
  color:var(--orange);
  text-transform:uppercase;
  margin-bottom:2px;
}
.clock-date{
  font-size:12px; font-weight:650;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.clock-status{
  font-size:11px; color:rgba(237,234,228,.68);
  margin-top:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.clock-time{
  font-family:var(--mono);
  font-size:30px; font-weight:700;
  color:var(--orange);
  font-variant-numeric:tabular-nums;
  letter-spacing:-.02em;
  flex:0 0 auto;
}

/* ===== 7. KARTU KATEGORI ===== */
.kartu-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin-bottom:12px;
}
.kartu{
  position:relative;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:10px;
  min-height:196px;
  padding:20px 14px 18px;
  background:var(--card);
  color:var(--cream);
  border:1px solid rgba(255,255,255,.09);
  border-radius:var(--radius);
  text-align:center;
  user-select:none;
  -webkit-user-select:none;
  touch-action:manipulation;
  transition:transform .06s ease, background .15s ease, opacity .2s ease, border-color .15s ease;
}
.kartu:not(.dispasif):active{ transform:scale(.977); background:var(--card-2); }
.kartu.dispasif{ opacity:.45; pointer-events:none; }
.kartu-ikon{
  width:48px; height:48px;
  fill:none; stroke:var(--cream);
  stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round;
}
.kartu-label{
  font-size:12.5px; font-weight:800;
  letter-spacing:.09em;
  line-height:1.35;
  text-transform:uppercase;
  max-width:95%;
}
.kartu-angka{
  font-size:54px; font-weight:800;
  line-height:1;
  color:var(--orange);
  font-variant-numeric:tabular-nums;
  letter-spacing:-.02em;
}
.kartu-undo{
  position:absolute; top:8px; right:8px;
  display:flex; align-items:center; justify-content:center;
  width:42px; height:42px;
  border-radius:50%;
  color:rgba(237,234,228,.55);
  transition:background .15s ease, color .15s ease;
}
.kartu-undo .ic{ width:20px; height:20px; }
.kartu-undo:hover{ color:var(--cream); }
.kartu-undo:active{ background:rgba(255,255,255,.10); }
.kartu-undo.nonaktif{ opacity:.35; pointer-events:none; }

/* ===== 8. TOMBOL ===== */
.aksi{ display:flex; flex-direction:column; gap:8px; margin-top:2px; }
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.btn-row{ display:grid; grid-template-columns:1.3fr 1fr 1fr; gap:8px; }
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  height:50px;
  padding:0 16px;
  border-radius:11px;
  border:1.5px solid transparent;
  font-size:14.5px; font-weight:700;
  transition:background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  white-space:nowrap;
}
.btn:active{ transform:translateY(1px); }
.btn:disabled{ opacity:.42; cursor:not-allowed; transform:none; }
.btn-block{ width:100%; }
.btn-primary{
  background:var(--orange);
  color:var(--ink);
  border-color:var(--orange);
}
.btn-primary:hover{ background:#FFA43A; border-color:#FFA43A; }
.btn-primary:disabled{
  background:var(--surface-2); border-color:var(--surface-2);
  color:var(--muted); cursor:not-allowed;
}
.btn-dark{ background:var(--ink); color:var(--cream); border-color:var(--ink); }
.btn-dark:hover{ background:#33404A; }
.btn-outline{
  background:var(--surface);
  color:var(--ink);
  border-color:var(--ink);
}
.btn-outline:hover{ background:var(--surface-2); }
.btn-ghost{
  background:transparent;
  color:var(--muted);
  height:40px;
  font-size:13px; font-weight:650;
}
.btn-ghost:hover{ color:var(--ink); }
.btn-danger{ background:var(--danger); color:#fff; border-color:var(--danger); }
.hint{
  font-size:11.5px; line-height:1.45;
  color:var(--muted);
  text-align:center;
  margin-top:2px;
}

/* ===== 9. LAYAR DATA ===== */
.rekap-card{
  background:var(--surface-2);
  border:1px solid var(--line);
  border-radius:var(--radius-lg);
  padding:14px;
  margin-bottom:12px;
}
.rekap-title{
  font-size:11px; font-weight:800;
  letter-spacing:.10em;
  color:var(--ink);
}
.rekap-grid{
  display:grid; grid-template-columns:1fr 1fr;
  gap:10px;
  margin:12px 0 10px;
}
.rekap-cell{ min-width:0; }
.rekap-cell b{
  display:block;
  font-size:23px; font-weight:800;
  line-height:1.1;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
}
.rekap-cell span{
  display:block;
  font-size:11px; color:var(--muted);
  margin-top:1px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.rekap-total{
  font-size:12px; color:var(--muted);
  border-top:1px solid var(--line);
  padding-top:9px;
}

.empty{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:8px;
  padding:44px 16px;
  text-align:center;
  color:var(--muted);
  font-size:13px; line-height:1.5;
}
.data-list{ display:flex; flex-direction:column; gap:10px; margin-top:12px; }
.sesi-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow-sm);
  padding:12px 13px;
}
.sesi-head{ display:flex; align-items:flex-start; gap:8px; }
.sesi-info{ flex:1; min-width:0; }
.sesi-jalan{
  font-size:15px; font-weight:750;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.sesi-meta{
  font-size:11px; color:var(--muted);
  margin-top:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:38px; height:38px;
  border-radius:9px;
  color:var(--muted);
  transition:background .15s ease, color .15s ease;
  flex:0 0 auto;
}
.icon-btn:hover{ background:var(--surface-2); color:var(--ink); }
.icon-btn.danger:hover{ background:rgba(179,64,31,.10); color:var(--danger); }
.sesi-chips{
  display:grid; grid-template-columns:repeat(4, 1fr);
  gap:6px;
  margin-top:10px;
}
.chip{
  background:var(--card);
  border-radius:8px;
  padding:6px 4px;
  text-align:center;
  min-width:0;
}
.chip b{
  display:block;
  font-size:15px; font-weight:800;
  color:var(--orange);
  font-variant-numeric:tabular-nums;
}
.chip span{
  display:block;
  font-size:8.5px; font-weight:600;
  color:var(--cream);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* ===== 10. DIALOG & TOAST ===== */
.overlay{
  position:fixed; inset:0; z-index:100;
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  background:rgba(20,25,30,.55);
  opacity:0; visibility:hidden;
  transition:opacity .18s ease, visibility .18s ease;
}
.overlay.show{ opacity:1; visibility:visible; }
.dialog{
  width:100%; max-width:390px;
  background:var(--surface);
  border-radius:var(--radius-lg);
  padding:20px;
  box-shadow:0 18px 50px rgba(20,25,30,.30);
  transform:translateY(6px) scale(.985);
  transition:transform .18s ease;
}
.overlay.show .dialog{ transform:none; }
.dialog-title{ font-size:16px; font-weight:750; margin-bottom:7px; }
.dialog-text{ font-size:13px; line-height:1.55; color:var(--muted); }
.dialog-actions{ display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:18px; }
.toast{
  position:fixed; left:50%; bottom:26px; z-index:120;
  transform:translate(-50%, 14px);
  background:var(--ink);
  color:var(--cream);
  font-size:13px; font-weight:600;
  padding:11px 17px;
  border-radius:999px;
  box-shadow:var(--shadow-md);
  opacity:0; pointer-events:none;
  transition:opacity .2s ease, transform .2s ease;
  max-width:calc(100vw - 40px);
  text-align:center;
}
.toast.show{ opacity:1; transform:translate(-50%, 0); }

/* ===== 11. RESPONSIF ===== */
@media (max-width:420px){
  main{ padding:10px; }
  .kartu{ min-height:172px; padding:16px 10px 14px; gap:8px; }
  .kartu-angka{ font-size:46px; }
  .kartu-label{ font-size:11px; letter-spacing:.05em; }
  .kartu-ikon{ width:40px; height:40px; }
  .kartu-undo{ width:40px; height:40px; }
  .clock-time{ font-size:23px; }
  .btn{ height:47px; font-size:13.5px; }
}
@media (min-width:620px){
  main{ padding:14px 16px; }
  .kartu{ min-height:214px; }
}
