/* ============================================================
   TRACKING KANDANG — Design System
   IBM Plex Sans (UI) + IBM Plex Mono (angka/ukuran)
   ============================================================ */

:root{
  --navy:#0F2E3D; --navy-2:#163C4F; --amber:#E08A34; --amber-dark:#B96E22;
  --green:#2F9E5B; --red:#D0453A; --blue-info:#2E77B0;

  --bg:#F4F6F7; --surface:#FFFFFF; --surface-2:#EDF1F2;
  --text:#101820; --text-dim:#526270; --border:#DBE2E5;
  --accent:var(--amber); --accent-ink:#3D2A12;

  --radius:6px; --radius-lg:10px;
  --shadow:0 1px 2px rgba(16,24,32,.06), 0 1px 1px rgba(16,24,32,.04);
  --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px);
  --nav-h:64px;
}
:root[data-theme="dark"]{
  --bg:#0B1720; --surface:#12222C; --surface-2:#1A2C37;
  --text:#EAF1F4; --text-dim:#93A6AF; --border:#243947;
  --accent-ink:#FCEBD8;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0B1720; --surface:#12222C; --surface-2:#1A2C37;
    --text:#EAF1F4; --text-dim:#93A6AF; --border:#243947;
    --accent-ink:#FCEBD8;
  }
}

*{box-sizing:border-box;}
html{scroll-padding-top:var(--safe-t); -webkit-text-size-adjust:100%;}
html,body{height:100%;}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:"IBM Plex Sans",-apple-system,Segoe UI,Roboto,sans-serif;
  font-size:15px; line-height:1.5;
  padding-top:var(--safe-t); padding-bottom:var(--safe-b);
  -webkit-font-smoothing:antialiased;
}
.mono{font-family:"IBM Plex Mono",ui-monospace,monospace; font-variant-numeric:tabular-nums;}
h1,h2,h3{font-family:"IBM Plex Sans"; font-weight:600; margin:0 0 4px;}
a{color:inherit;}
button{font-family:inherit; cursor:pointer;}
button:focus-visible, input:focus-visible, a:focus-visible, [tabindex]:focus-visible{
  outline:2px solid var(--amber); outline-offset:2px;
}
@media (prefers-reduced-motion:reduce){ *{animation:none !important; transition:none !important;} }

/* ---------- App shell ---------- */
#app{min-height:100%; display:flex; flex-direction:column;}
.screen{display:none; flex:1; min-height:0;}
.screen.active{display:flex; flex-direction:column;}
#app:not(.authed) .bottomnav, #app:not(.authed) .sidebar{display:none !important;}
#app:not(.authed) #screen-login{display:flex;}
/* Layar checklist punya bar aksi sendiri (Kirim Semua) yang menempati posisi bawah —
   sembunyikan nav bawah di layar ini agar keduanya tidak bertumpuk */
#app[data-screen="checklist"] .bottomnav{display:none;}
#app[data-screen="checklist"] .submit-bar{padding-bottom:calc(12px + var(--safe-b));}

/* Top bar */
.topbar{
  position:sticky; top:0; z-index:20; background:var(--surface);
  border-bottom:1px solid var(--border);
  padding:calc(12px + var(--safe-t)) 16px 12px;
  display:flex; align-items:center; gap:12px;
}
.topbar h1{font-size:16px;}
.topbar .sub{font-size:12.5px; color:var(--text-dim); font-family:"IBM Plex Mono";}
.topbar-actions{margin-left:auto; display:flex; gap:8px; align-items:center;}
.iconbtn{
  width:38px; height:38px; border-radius:var(--radius); border:1px solid var(--border);
  background:var(--surface-2); color:var(--text); display:flex; align-items:center; justify-content:center;
  font-size:16px;
}
.back-btn{background:none;border:none;color:var(--text);font-size:20px;padding:4px 8px 4px 0;line-height:1;}

/* Content */
.content{flex:1; overflow-y:auto; padding:16px; padding-bottom:calc(16px + var(--nav-h) + var(--safe-b));}
.content.no-nav-pad{padding-bottom:16px;}
@media (min-width:640px){
  .content{max-width:640px; margin:0 auto; width:100%;}
  .content.no-nav-pad{max-width:680px;}
}

/* Bottom nav (phone/tablet) */
.bottomnav{
  position:fixed; left:0; right:0; bottom:0; z-index:30; height:calc(var(--nav-h) + var(--safe-b));
  background:var(--surface); border-top:1px solid var(--border);
  display:flex; padding-bottom:var(--safe-b);
}
.bottomnav button{
  flex:1; background:none; border:none; color:var(--text-dim); display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:3px; font-size:11px; gap:4px;
}
.bottomnav button .ic{font-size:19px;}
.bottomnav button.active{color:var(--amber-dark);}
:root[data-theme="dark"] .bottomnav button.active, .bottomnav button.active{color:var(--amber);}

/* Sidebar (desktop) */
.sidebar{display:none;}
@media (min-width:900px){
  .bottomnav{display:none;}
  .layout{display:flex; flex:1; min-height:0;}
  .sidebar{
    display:flex; flex-direction:column; width:230px; flex-shrink:0;
    background:var(--surface); border-right:1px solid var(--border);
    padding:20px 12px; gap:4px;
  }
  .sidebar .brand{font-weight:700; font-size:15px; padding:6px 10px 20px;}
  .sidebar button{
    background:none; border:none; color:var(--text-dim); text-align:left; padding:10px 12px;
    border-radius:var(--radius); font-size:14px; display:flex; align-items:center; gap:10px;
  }
  .sidebar button.active{background:var(--surface-2); color:var(--text); font-weight:600;}
  .sidebar button:hover{background:var(--surface-2);}
  .main-col{flex:1; min-width:0; display:flex; flex-direction:column;}
  .content{padding:28px 32px; padding-bottom:28px; max-width:960px;}
}

/* ---------- Login ---------- */
.login-wrap{
  flex:1; display:flex; align-items:center; justify-content:center; padding:24px;
  background:linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 60%, #1F4A5E 100%);
}
.login-card{
  width:100%; max-width:380px; background:var(--surface); border-radius:var(--radius-lg);
  padding:32px 28px; box-shadow:0 20px 50px rgba(0,0,0,.25);
}
.login-brand{display:flex; align-items:center; gap:10px; margin-bottom:22px;}
.login-brand .mark{
  width:38px; height:38px; border-radius:8px; background:var(--navy);
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:15px;
}
.login-brand .name{font-weight:700; font-size:15px; line-height:1.2;}
.login-brand .sub{font-size:11.5px; color:var(--text-dim);}
.field{margin-bottom:16px;}
.field label{display:block; font-size:12.5px; color:var(--text-dim); margin-bottom:6px; font-weight:500;}
.field input{
  width:100%; padding:12px 14px; border-radius:var(--radius); border:1.5px solid var(--border);
  background:var(--bg); color:var(--text); font-size:16px; font-family:"IBM Plex Mono";
}
.field input:focus{border-color:var(--amber);}
.btn{
  width:100%; padding:13px; border-radius:var(--radius); border:none; font-weight:600; font-size:14.5px;
}
.btn-primary{background:var(--amber); color:#22150A;}
.btn-primary:active{background:var(--amber-dark);}
.btn-ghost{background:none; border:1.5px solid var(--border); color:var(--text);}
.btn-danger{background:var(--red); color:#fff;}
.btn-block{margin-top:4px;}
.err-msg{
  background:rgba(208,69,58,.1); border:1px solid var(--red); color:var(--red);
  padding:10px 12px; border-radius:var(--radius); font-size:13px; margin-bottom:14px; display:none;
}
.err-msg.show{display:block;}

/* ---------- Home ---------- */
.continue-card{
  background:var(--navy); color:#fff; border-radius:var(--radius-lg); padding:18px 18px 20px;
  margin-bottom:20px; position:relative; overflow:hidden;
}
.continue-card .tag{font-size:11px; letter-spacing:.02em; color:#9FC4D6; margin-bottom:6px;}
.continue-card h3{color:#fff; font-size:16px; margin-bottom:2px;}
.continue-card .loc{font-size:13px; color:#C7DCE6; margin-bottom:14px;}
.continue-card .cta{
  background:var(--amber); color:#22150A; border:none; padding:10px 16px; border-radius:var(--radius);
  font-weight:600; font-size:13.5px;
}
.section-title{font-size:12.5px; font-weight:600; color:var(--text-dim); text-transform:uppercase; letter-spacing:.04em; margin:22px 0 10px;}
.section-title:first-child{margin-top:0;}

.proj-row{
  display:flex; align-items:center; gap:12px; padding:14px; background:var(--surface);
  border:1px solid var(--border); border-left:3px solid var(--amber); border-radius:var(--radius); margin-bottom:10px;
}
.proj-row.locked{border-left-color:var(--border); opacity:.62;}
.proj-row .info{flex:1; min-width:0;}
.proj-row .info .nm{font-weight:600; font-size:14.5px;}
.proj-row .info .cust{font-size:12.5px; color:var(--text-dim);}
.proj-row .pct{font-family:"IBM Plex Mono"; font-size:15px; font-weight:600;}
.proj-row .lock-ic{color:var(--text-dim); font-size:15px;}
.handover-card{
  background:var(--surface); border:1px solid var(--blue-info); border-left:3px solid var(--blue-info);
  border-radius:var(--radius); padding:14px; margin-bottom:10px;
}
.handover-card .txt{font-size:13.5px; margin-bottom:10px;}
.handover-card .txt b{font-weight:600;}
.handover-card .btns{display:flex; gap:8px;}
.handover-card .btns button{flex:1; padding:9px; font-size:13px; border-radius:var(--radius); border:none; font-weight:600;}
.handover-card .btn-accept{background:var(--green); color:#fff;}
.handover-card .btn-reject{background:var(--surface-2); color:var(--text); border:1px solid var(--border) !important;}
.progress-track{height:6px; background:var(--surface-2); border-radius:99px; overflow:hidden; margin-top:8px;}
.progress-fill{height:100%; background:var(--amber); border-radius:99px; transition:width .4s ease;}

/* ---------- Breadcrumb picker ---------- */
.crumb{display:flex; flex-wrap:wrap; gap:6px; margin-bottom:16px; font-size:13px;}
.crumb .seg{padding:6px 10px; background:var(--surface-2); border-radius:99px; color:var(--text-dim);}
.crumb .seg.on{background:var(--navy); color:#fff;}
.pick-list{display:flex; flex-direction:column; gap:8px;}
.pick-item{
  display:flex; align-items:center; justify-content:space-between; padding:14px; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius); font-size:14.5px; font-weight:500;
}
.pick-item .arrow{color:var(--text-dim);}

/* ---------- Checklist (input progres) ---------- */
.floor-head{margin-bottom:16px;}
.floor-head h2{font-size:17px;}
.floor-head .sub{color:var(--text-dim); font-size:13px;}

.task-card{
  background:var(--surface); border:1px solid var(--border); border-left:3px solid var(--sys-color, var(--amber));
  border-radius:var(--radius); padding:14px; margin-bottom:10px;
}
.task-card .row1{display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-bottom:8px;}
.task-card .nm{font-weight:600; font-size:14px;}
.task-card .qty{font-family:"IBM Plex Mono"; font-size:13px; color:var(--text-dim); white-space:nowrap;}
.task-card .qty b{color:var(--text); font-weight:600;}
.task-card .row2{display:flex; align-items:center; gap:10px;}
.task-card .row2 .progress-track{flex:1; margin-top:0;}
.add-input{
  display:flex; align-items:center; gap:8px; margin-top:10px; padding-top:10px; border-top:1px dashed var(--border);
}
.add-input label{font-size:12.5px; color:var(--text-dim); white-space:nowrap;}
.add-input input{
  width:90px; padding:9px 10px; border-radius:var(--radius); border:1.5px solid var(--border);
  background:var(--bg); color:var(--text); font-family:"IBM Plex Mono"; font-size:14px; text-align:right;
}
.add-input .unit{font-size:12.5px; color:var(--text-dim);}
.done-toggle{
  margin-left:auto; display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--text-dim);
}
.done-toggle input{width:18px; height:18px;}

.photo-row{display:flex; gap:8px; margin-top:10px; flex-wrap:wrap;}
.photo-thumb{
  width:52px; height:52px; border-radius:var(--radius); background:var(--surface-2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center; font-size:18px; color:var(--text-dim); overflow:hidden;
}
.photo-thumb img{width:100%; height:100%; object-fit:cover;}
.photo-add{
  width:52px; height:52px; border-radius:var(--radius); border:1.5px dashed var(--border); background:none;
  color:var(--text-dim); font-size:20px; display:flex; align-items:center; justify-content:center;
}

.submit-bar{
  position:sticky; bottom:0; background:var(--surface); border-top:1px solid var(--border);
  padding:12px 16px calc(12px + var(--safe-b)); display:flex; gap:10px; align-items:center;
}
.submit-bar .count{font-size:12.5px; color:var(--text-dim); margin-right:auto;}
.submit-bar .btn-primary{width:auto; padding:12px 22px;}

/* ---------- Badges / status ---------- */
.badge{display:inline-flex; align-items:center; gap:4px; padding:3px 9px; border-radius:99px; font-size:11.5px; font-weight:600;}
.badge-pending{background:rgba(224,138,52,.15); color:var(--amber-dark);}
:root[data-theme="dark"] .badge-pending{color:var(--amber);}
.badge-approved{background:rgba(47,158,91,.15); color:var(--green);}
.badge-rejected{background:rgba(208,69,58,.15); color:var(--red);}
.badge-waiting{background:rgba(46,119,176,.15); color:var(--blue-info);}

/* ---------- Toast / offline banner ---------- */
.banner{
  padding:10px 16px; font-size:13px; text-align:center; font-weight:500;
}
.banner-offline{background:var(--red); color:#fff;}
.banner-queue{background:var(--blue-info); color:#fff;}
.toast{
  position:fixed; left:50%; transform:translateX(-50%); bottom:calc(var(--nav-h) + 16px + var(--safe-b));
  background:var(--navy); color:#fff; padding:12px 18px; border-radius:var(--radius); font-size:13.5px;
  box-shadow:0 8px 24px rgba(0,0,0,.25); z-index:80; opacity:0; pointer-events:none; transition:opacity .25s, transform .25s;
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(-6px);}

/* ---------- Modal ---------- */
.modal-bg{
  position:fixed; inset:0; background:rgba(8,14,18,.55); z-index:60; display:none;
  align-items:flex-end; justify-content:center;
}
.modal-bg.show{display:flex;}
.modal{
  background:var(--surface); width:100%; max-width:480px; border-radius:16px 16px 0 0; padding:20px 20px calc(20px + var(--safe-b));
  max-height:88vh; overflow-y:auto;
}
@media (min-width:640px){
  .modal-bg{align-items:center;}
  .modal{border-radius:var(--radius-lg); max-height:80vh;}
}
.modal h3{font-size:16px; margin-bottom:14px;}
.modal .close-x{position:absolute; top:14px; right:16px; background:none; border:none; font-size:18px; color:var(--text-dim);}
select, textarea{
  width:100%; padding:11px 12px; border-radius:var(--radius); border:1.5px solid var(--border);
  background:var(--bg); color:var(--text); font-family:inherit; font-size:14.5px;
}
textarea{resize:vertical; min-height:80px;}

/* ---------- Empty state ---------- */
.empty{text-align:center; padding:48px 20px; color:var(--text-dim);}
.empty .ic{font-size:32px; margin-bottom:10px;}
.empty h3{color:var(--text); font-size:15px; margin-bottom:4px;}
.empty p{font-size:13px; max-width:280px; margin:0 auto;}

/* Utility */
.hidden{display:none !important;}
.flex-between{display:flex; justify-content:space-between; align-items:center;}
.tap-target{min-height:44px;}
