/* ===== GMS UI — industrial gate theme ===== */
[hidden]{display:none!important}
:root{
  --steel-900:#141b24;
  --steel-800:#1c2632;
  --steel-700:#26333f;
  --steel-600:#33424f;
  --line:#e2e7ec;
  --line-dark:#33424f;
  --paper:#f5f7f9;
  --white:#ffffff;
  --ink:#1c2632;
  --ink-soft:#5a6a78;
  --amber:#f0a020;
  --amber-dark:#c47f0a;
  --green:#22a06b;
  --green-bg:#e3f5ec;
  --red:#d94f4f;
  --red-bg:#fbe8e8;
  --gray-bg:#eceff2;
  --blue:#3b7dd8;
  --radius:10px;
  --radius-sm:7px;
  --shadow:0 1px 2px rgba(20,27,36,.06),0 4px 16px rgba(20,27,36,.06);
  --font-display:'Sora',system-ui,sans-serif;
  --font-body:'Inter',system-ui,sans-serif;
  --font-mono:'JetBrains Mono',ui-monospace,monospace;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:var(--font-body);
  color:var(--ink);
  background:var(--paper);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{font-family:var(--font-display);margin:0}
button{font-family:inherit;cursor:pointer}
input,select{font-family:inherit}

/* ---------- gate mark ---------- */
.gate-mark{display:inline-flex;gap:3px;align-items:flex-end;height:26px}
.gate-mark span{width:5px;background:var(--amber);border-radius:2px;display:block}
.gate-mark span:nth-child(1){height:14px}
.gate-mark span:nth-child(2){height:26px}
.gate-mark span:nth-child(3){height:20px}
.gate-mark--sm{height:18px}
.gate-mark--sm span{width:3.5px}
.gate-mark--sm span:nth-child(1){height:9px}
.gate-mark--sm span:nth-child(2){height:18px}
.gate-mark--sm span:nth-child(3){height:14px}

/* ---------- login ---------- */
.login-screen{
  min-height:100vh;display:grid;place-items:center;padding:24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, #26333f 0%, transparent 60%),
    linear-gradient(180deg,var(--steel-900),var(--steel-800));
}
.login-panel{
  width:100%;max-width:400px;background:var(--white);
  border-radius:16px;padding:34px 30px 26px;box-shadow:0 24px 60px rgba(0,0,0,.35);
}
.login-brand{text-align:center;margin-bottom:22px}
.login-brand h1{font-size:34px;letter-spacing:-1px;margin-top:10px}
.login-brand .tagline{color:var(--ink-soft);font-size:13px;margin:4px 0 0}
.seg{display:flex;background:var(--gray-bg);border-radius:var(--radius);padding:4px;margin-bottom:20px}
.seg-btn{
  flex:1;border:0;background:transparent;padding:9px;border-radius:var(--radius-sm);
  font-weight:600;font-size:13px;color:var(--ink-soft);transition:.15s;
}
.seg-btn.is-active{background:var(--white);color:var(--ink);box-shadow:var(--shadow)}
.field{margin-bottom:14px}
.field label{display:block;font-size:12.5px;font-weight:600;margin-bottom:6px;color:var(--ink-soft)}
.field input,.field select{
  width:100%;padding:11px 12px;border:1.5px solid var(--line);border-radius:var(--radius-sm);
  font-size:14px;background:var(--white);transition:border-color .15s;
}
.field input:focus,.field select:focus{outline:0;border-color:var(--amber)}
#in-factorykey{font-family:var(--font-mono);letter-spacing:.5px}
.form-error{
  background:var(--red-bg);color:#a13030;border-radius:var(--radius-sm);
  padding:9px 11px;font-size:13px;margin:0 0 14px;
}
.login-foot{text-align:center;color:var(--ink-soft);font-size:12px;font-family:var(--font-mono);margin:18px 0 0}

/* ---------- buttons ---------- */
.btn{
  border:0;border-radius:var(--radius-sm);padding:10px 16px;font-weight:600;
  font-size:14px;transition:.15s;display:inline-flex;align-items:center;gap:7px;justify-content:center;
}
.btn-block{width:100%}
.btn-sm{padding:7px 12px;font-size:13px}
.btn-primary{background:var(--amber);color:#3a2a05}
.btn-primary:hover{background:var(--amber-dark);color:#fff}
.btn-ghost{background:transparent;color:var(--ink-soft);border:1.5px solid var(--line)}
.btn-ghost:hover{border-color:var(--ink-soft);color:var(--ink)}
.btn-danger{background:var(--red-bg);color:#a13030}
.btn-danger:hover{background:var(--red);color:#fff}
.btn:disabled{opacity:.55;cursor:not-allowed}

/* ---------- topbar ---------- */
.topbar{
  height:58px;background:var(--steel-800);color:#fff;display:flex;align-items:center;
  justify-content:space-between;padding:0 20px;position:sticky;top:0;z-index:10;
}
.topbar-left{display:flex;align-items:center;gap:11px;font-family:var(--font-display)}
.topbar-left strong{font-size:17px;letter-spacing:-.3px}
.scope-badge{
  font-size:11px;font-weight:600;padding:3px 9px;border-radius:20px;
  background:rgba(240,160,32,.18);color:var(--amber);text-transform:uppercase;letter-spacing:.6px;
}
.topbar-right{display:flex;align-items:center;gap:14px}
.who{font-size:13px;color:#b7c2cc}
.topbar .btn-ghost{color:#cdd6de;border-color:var(--steel-600)}
.topbar .btn-ghost:hover{border-color:#6c7c89;color:#fff}

/* ---------- panel ---------- */
.panel{max-width:1120px;margin:0 auto;padding:26px 20px 60px}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:20px;gap:16px;flex-wrap:wrap}
.page-head h2{font-size:23px;letter-spacing:-.5px}
.page-head p{margin:4px 0 0;color:var(--ink-soft);font-size:13.5px}

/* ---------- stat cards ---------- */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(165px,1fr));gap:13px;margin-bottom:26px}
.stat{
  background:var(--white);border:1px solid var(--line);border-radius:var(--radius);
  padding:16px 16px 14px;box-shadow:var(--shadow);position:relative;overflow:hidden;
}
.stat::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--amber)}
.stat.green::before{background:var(--green)}
.stat.red::before{background:var(--red)}
.stat.blue::before{background:var(--blue)}
.stat .num{font-family:var(--font-display);font-size:29px;font-weight:700;line-height:1}
.stat .lbl{font-size:12px;color:var(--ink-soft);margin-top:6px;font-weight:500}

/* ---------- table card ---------- */
.card{background:var(--white);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.card-head{padding:15px 18px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:12px}
.card-head h3{font-size:15.5px}
table{width:100%;border-collapse:collapse}
thead th{
  text-align:left;font-size:11px;letter-spacing:.5px;text-transform:uppercase;color:var(--ink-soft);
  font-weight:600;padding:11px 18px;border-bottom:1px solid var(--line);background:#fafbfc;
}
tbody td{padding:13px 18px;font-size:13.5px;border-bottom:1px solid var(--line);vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tbody tr:hover{background:#fafbfc}
.mono{font-family:var(--font-mono);font-size:12.5px}
.muted{color:var(--ink-soft)}
.row-actions{display:flex;gap:6px;justify-content:flex-end}

/* ---------- status badge ---------- */
.badge{font-size:11.5px;font-weight:600;padding:3px 10px;border-radius:20px;text-transform:capitalize;white-space:nowrap}
.badge.active{background:var(--green-bg);color:#177a4d}
.badge.expired,.badge.disabled{background:var(--gray-bg);color:#5a6a78}
.badge.suspended{background:var(--red-bg);color:#a13030}

/* ---------- modal ---------- */
.modal-root{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:20px}
.modal-backdrop{position:absolute;inset:0;background:rgba(20,27,36,.5);backdrop-filter:blur(2px)}
.modal{
  position:relative;background:var(--white);border-radius:14px;width:100%;max-width:440px;
  box-shadow:0 30px 70px rgba(0,0,0,.35);max-height:90vh;overflow:auto;
}
.modal-head{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;border-bottom:1px solid var(--line)}
.modal-head h3{font-size:17px}
.modal-x{border:0;background:transparent;font-size:24px;line-height:1;color:var(--ink-soft)}
.modal-body{padding:20px}
.modal-body .field:last-of-type{margin-bottom:18px}
.modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:4px}
.modal-note{background:#fff8ec;border:1px solid #f3dfb0;color:#8a6516;font-size:12.5px;padding:9px 11px;border-radius:var(--radius-sm);margin-bottom:16px}

.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:12px}

/* ---------- toast ---------- */
.toast{
  position:fixed;bottom:24px;left:50%;transform:translateX(-50%);
  background:var(--steel-800);color:#fff;padding:12px 20px;border-radius:var(--radius);
  font-size:13.5px;font-weight:500;box-shadow:0 10px 30px rgba(0,0,0,.3);z-index:100;
}
.toast.err{background:var(--red)}
.toast.ok{background:var(--green)}

/* ---------- empty / loading ---------- */
.empty{padding:44px 20px;text-align:center;color:var(--ink-soft);font-size:14px}
.spinner{width:18px;height:18px;border:2.5px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite;display:inline-block}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- license key pill ---------- */
.keypill{display:inline-flex;align-items:center;gap:8px;background:var(--steel-800);color:#fff;padding:8px 12px;border-radius:var(--radius-sm);font-family:var(--font-mono);font-size:13px;letter-spacing:.5px}
.keypill button{background:rgba(255,255,255,.14);border:0;color:#fff;border-radius:5px;padding:3px 8px;font-size:11px}

/* ---------- factory nav layout ---------- */
.flayout{display:grid;grid-template-columns:200px 1fr;gap:24px;align-items:start}
.fnav{display:flex;flex-direction:column;gap:3px;position:sticky;top:82px}
.fnav-btn{
  text-align:left;border:0;background:transparent;padding:11px 14px;border-radius:var(--radius-sm);
  font-weight:600;font-size:14px;color:var(--ink-soft);transition:.12s;
}
.fnav-btn:hover{background:var(--white);color:var(--ink)}
.fnav-btn.is-active{background:var(--steel-800);color:#fff}
.fbody{min-width:0}
.more-toggle{
  border:0;background:transparent;color:var(--amber-dark);font-weight:600;font-size:13.5px;
  padding:6px 0;margin:2px 0 12px;cursor:pointer;
}
@media(max-width:760px){
  .flayout{grid-template-columns:1fr}
  .fnav{flex-direction:row;overflow-x:auto;position:static;padding-bottom:6px}
  .fnav-btn{white-space:nowrap}
}

/* ---------- visitor pass ---------- */
.pass{
  width:340px;margin:0 auto;background:#fff;border:2px solid var(--steel-800);
  border-radius:10px;overflow:hidden;font-family:var(--font-body);color:var(--ink);
}
.pass-head{background:var(--steel-800);color:#fff;padding:12px 16px;text-align:center}
.pass-head .fac{font-family:var(--font-display);font-size:17px;font-weight:700;letter-spacing:-.3px}
.pass-head .sub{font-size:10px;letter-spacing:2px;text-transform:uppercase;color:var(--amber);margin-top:2px}
.pass-no{background:var(--amber);color:#3a2a05;text-align:center;font-family:var(--font-mono);font-weight:600;font-size:15px;padding:6px}
.pass-body{padding:14px 16px}
.pass-name{font-family:var(--font-display);font-size:20px;font-weight:700;margin-bottom:2px}
.pass-company{color:var(--ink-soft);font-size:13px;margin-bottom:12px}
.pass-row{display:flex;justify-content:space-between;padding:6px 0;border-top:1px dashed #d8dee3;font-size:13px}
.pass-row .k{color:var(--ink-soft)}
.pass-row .v{font-weight:600;text-align:right}
.pass-foot{text-align:center;font-size:10px;color:var(--ink-soft);padding:8px;border-top:1px dashed #d8dee3}

/* print: sirf pass dikhe, baaqi sab chhupe */
@media print{
  *{box-sizing:border-box!important}
  html, body{margin:0!important;padding:0!important;background:#fff!important;height:auto!important;width:100%!important}
  body *{visibility:hidden!important}
  .topbar, .sidebar, .fnav, .rep-filters, .rep-actions, .vd-filter,
  .quick-range, .page-head, .row-actions, .card-head{display:none!important}

  /* ===== Visitor Pass ===== */
  #print-area, #print-area *{visibility:visible!important}
  #print-area{position:absolute;left:0;top:0;width:100%;padding:16px}
  .pass{border-color:#000}
  .pass-head{background:#1c2632!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .pass-no{background:#f0a020!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}

  /* ===== Reports — professional style (A2Zee jaisा) ===== */
  #rep-result, #rep-result *, #veh-wrap, #veh-wrap *, #del-wrap, #del-wrap *,
  #fleet-rep, #fleet-rep *, #emp-report, #emp-report *{visibility:visible!important}
  #rep-result, #veh-wrap, #del-wrap, #fleet-rep, #emp-report{
    position:absolute!important;left:0!important;right:0!important;top:0!important;bottom:0!important;
    width:auto!important;max-width:none!important;padding:0!important;margin:0!important;
  }
  #emp-report{display:flex!important;flex-direction:column!important;min-height:100%!important}
  #emp-report .emp-body{flex:1 0 auto!important}
  #emp-report .emp-foot{margin-top:auto!important}
  #rep-result .card, #veh-wrap .card, #del-wrap .card, #fleet-rep .card{
    border:0!important;box-shadow:none!important;margin:0!important;padding:0!important;
    width:100%!important;max-width:100%!important;
  }

  /* centered heading */
  .print-head{display:block!important;text-align:center;margin:0 0 16px;padding:0 0 12px;border-bottom:2px solid #1c2632}
  .print-head .ph-title{font-family:var(--font-display);font-size:22px;font-weight:700;letter-spacing:-.3px}
  .print-head .ph-sub{font-size:12px;color:#555;margin-top:4px}

  /* table — readable font, good spacing */
  #rep-result table, #veh-wrap table, #del-wrap table, #fleet-rep table{
    font-size:10px;table-layout:fixed;width:100%!important;max-width:100%!important;
    border-collapse:collapse;
  }
  /* colored header row (A2Zee style) */
  #rep-result thead th, #veh-wrap thead th, #del-wrap thead th, #fleet-rep thead th{
    padding:8px 6px;font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.4px;
    background:#1c2632!important;color:#fff!important;text-align:left;
    -webkit-print-color-adjust:exact;print-color-adjust:exact;
    word-break:break-word;overflow-wrap:anywhere;
  }
  #rep-result tbody td, #veh-wrap tbody td, #del-wrap tbody td, #fleet-rep tbody td{
    padding:7px 6px;border-bottom:1px solid #e2e7ec;
    word-break:break-word;overflow-wrap:anywhere;white-space:normal;vertical-align:top;
    line-height:1.35;font-weight:400;color:#1c2632;
  }
  /* print mein visitor name bhi normal (bold nahi) */
  #rep-result tbody td strong, #veh-wrap tbody td strong,
  #del-wrap tbody td strong, #fleet-rep tbody td strong{font-weight:600}
  /* zebra rows for readability */
  #rep-result tbody tr:nth-child(even) td, #veh-wrap tbody tr:nth-child(even) td,
  #del-wrap tbody tr:nth-child(even) td, #fleet-rep tbody tr:nth-child(even) td{
    background:#f7f9fb!important;-webkit-print-color-adjust:exact;print-color-adjust:exact;
  }
  #rep-result tbody tr, #veh-wrap tbody tr, #del-wrap tbody tr, #fleet-rep tbody tr{
    page-break-inside:avoid;
  }
  .mono{font-size:10px;font-weight:400}

  /* Visitor report: 10 cols (Gate added) */
  #rep-result thead th:nth-child(1),#rep-result tbody td:nth-child(1){width:6%}
  #rep-result thead th:nth-child(2),#rep-result tbody td:nth-child(2){width:13%}
  #rep-result thead th:nth-child(3),#rep-result tbody td:nth-child(3){width:12%}
  #rep-result thead th:nth-child(4),#rep-result tbody td:nth-child(4){width:10%}
  #rep-result thead th:nth-child(5),#rep-result tbody td:nth-child(5){width:9%}
  #rep-result thead th:nth-child(6),#rep-result tbody td:nth-child(6){width:10%}
  #rep-result thead th:nth-child(7),#rep-result tbody td:nth-child(7){width:8%}
  #rep-result thead th:nth-child(8),#rep-result tbody td:nth-child(8){width:11%}
  #rep-result thead th:nth-child(9),#rep-result tbody td:nth-child(9){width:11%}
  #rep-result thead th:nth-child(10),#rep-result tbody td:nth-child(10){width:10%}
  /* status text chhoti taake "Checked Out" ek line mein */
  #rep-result tbody td:nth-child(10){font-size:9px}
  .badge{background:transparent!important;padding:0!important;font-size:9px!important;white-space:nowrap;font-weight:400!important}

  /* Vehicles report: 8 cols */
  /* Vehicles report: 9 cols (Gate added) */
  #veh-wrap thead th:nth-child(1),#veh-wrap tbody td:nth-child(1){width:6%}
  #veh-wrap thead th:nth-child(2),#veh-wrap tbody td:nth-child(2){width:11%}
  #veh-wrap thead th:nth-child(3),#veh-wrap tbody td:nth-child(3){width:8%}
  #veh-wrap thead th:nth-child(4),#veh-wrap tbody td:nth-child(4){width:12%}
  #veh-wrap thead th:nth-child(5),#veh-wrap tbody td:nth-child(5){width:14%}
  #veh-wrap thead th:nth-child(6),#veh-wrap tbody td:nth-child(6){width:15%}
  #veh-wrap thead th:nth-child(7),#veh-wrap tbody td:nth-child(7){width:10%}
  #veh-wrap thead th:nth-child(8),#veh-wrap tbody td:nth-child(8){width:12%}
  #veh-wrap thead th:nth-child(9),#veh-wrap tbody td:nth-child(9){width:12%}

  /* Deliveries report: 9 cols (Gate added) */
  #del-wrap thead th:nth-child(1),#del-wrap tbody td:nth-child(1){width:6%}
  #del-wrap thead th:nth-child(2),#del-wrap tbody td:nth-child(2){width:13%}
  #del-wrap thead th:nth-child(3),#del-wrap tbody td:nth-child(3){width:12%}
  #del-wrap thead th:nth-child(4),#del-wrap tbody td:nth-child(4){width:16%}
  #del-wrap thead th:nth-child(5),#del-wrap tbody td:nth-child(5){width:9%}
  #del-wrap thead th:nth-child(6),#del-wrap tbody td:nth-child(6){width:10%}
  #del-wrap thead th:nth-child(7),#del-wrap tbody td:nth-child(7){width:12%}
  #del-wrap thead th:nth-child(8),#del-wrap tbody td:nth-child(8){width:11%}
  #del-wrap thead th:nth-child(9),#del-wrap tbody td:nth-child(9){width:11%}

  /* Fleet report: with Gate col */
  #fleet-rep thead th:nth-child(1),#fleet-rep tbody td:nth-child(1){width:11%}
  #fleet-rep thead th:nth-child(2),#fleet-rep tbody td:nth-child(2){width:12%}
  #fleet-rep thead th:nth-child(3),#fleet-rep tbody td:nth-child(3){width:12%}
  #fleet-rep thead th:nth-child(4),#fleet-rep tbody td:nth-child(4){width:13%}
  #fleet-rep thead th:nth-child(5),#fleet-rep tbody td:nth-child(5){width:11%}
  #fleet-rep thead th:nth-child(6),#fleet-rep tbody td:nth-child(6){width:12%}
  #fleet-rep thead th:nth-child(7),#fleet-rep tbody td:nth-child(7){width:12%}
  #fleet-rep thead th:nth-child(8),#fleet-rep tbody td:nth-child(8){width:8%}
  #fleet-rep thead th:nth-child(9),#fleet-rep tbody td:nth-child(9){width:9%}
  #fleet-rep thead th:nth-child(10),#fleet-rep tbody td:nth-child(10){display:none!important}

  /* date+time — do line, saaf */
  .stacked-dt{white-space:normal}
  .stacked-dt div{display:block;font-size:9px;line-height:1.3}

  /* Single employee report — compact single page */
  #emp-report .emp-rep-head{text-align:center;margin:0 0 8px;padding:0 0 8px;border-bottom:2px solid #1c2632}
  #emp-report .erh-company{font-family:var(--font-display);font-size:18px;font-weight:700;color:#1c2632!important}
  #emp-report .erh-title{font-size:11px;color:#555!important;margin-top:2px}
  #emp-report .erh-emp{display:flex;justify-content:space-between;font-size:11px;margin-top:6px;color:#1c2632!important}
  #emp-report .emp-table{width:100%!important;border-collapse:collapse!important;font-size:9.5px!important}
  #emp-report .emp-table thead th{background:#1c2632!important;color:#fff!important;padding:3px 5px!important;text-align:left;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  #emp-report .emp-table tbody td{padding:2.5px 5px!important;border-bottom:1px solid #e6eaee!important;color:#1c2632!important;line-height:1.25}
  #emp-report .emp-table tbody tr:nth-child(even) td{background:#f7f9fb!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  #emp-report .emp-foot{margin-top:auto}
  #emp-report .emp-sum-line{font-size:8px;font-weight:600;color:#1c2632!important;padding:6px 4px;border:1px solid #d0d7de;border-radius:4px;background:#f7f9fb!important;-webkit-print-color-adjust:exact;print-color-adjust:exact;text-align:center;line-height:1.4;white-space:nowrap;letter-spacing:-0.1px}
  #emp-report .emp-sign{display:flex;justify-content:space-between;gap:40px;padding-top:55px;padding-bottom:6px}
  #emp-report .sign-box{flex:1;text-align:center}
  #emp-report .sign-line{border-top:1px solid #1c2632;margin-bottom:4px}
  #emp-report .sign-label{font-size:10px;color:#555!important}
  #emp-report .emp-table th:nth-child(8),#emp-report .emp-table td:nth-child(8){width:22%}

  @page{size:A4 portrait;margin:10mm}
}

/* ---------- camera capture ---------- */
.cam-box{margin-top:4px}
.cam-stage{background:#0d141b;border-radius:var(--radius-sm);overflow:hidden;max-width:320px;aspect-ratio:4/3;display:flex;align-items:center;justify-content:center}
.cam-video,.cam-preview{width:100%;height:100%;object-fit:cover;display:block}
.cam-actions{display:flex;gap:8px;margin-top:10px}

/* ---------- radio cards (settings) ---------- */
.radio-card{display:flex;gap:12px;align-items:flex-start;padding:13px 14px;border:1.5px solid var(--line);border-radius:var(--radius-sm);margin-bottom:10px;cursor:pointer;transition:.12s}
.radio-card:hover{border-color:var(--ink-soft)}
.radio-card.is-active{border-color:var(--amber);background:#fff8ec}
.radio-card input{margin-top:3px}
.rc-title{font-weight:600;font-size:14px}
.rc-desc{font-size:12.5px;color:var(--ink-soft);margin-top:2px}

/* ---------- pass photo ---------- */
.pass-photo{text-align:center;margin-bottom:10px}
.pass-photo img{width:96px;height:96px;object-fit:cover;border-radius:8px;border:2px solid var(--steel-800)}

/* ---------- reports ---------- */
.rep-filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:14px}
.rep-filters .field{margin-bottom:0}
.rep-actions{display:flex;gap:8px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:14px}
.rep-check{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;font-weight:500;color:var(--ink-soft);margin-bottom:14px;cursor:pointer}
.rep-check input{width:16px;height:16px}
.quick-range{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.vd-filter{display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap}
.vd-filter .field{margin-bottom:0}
.vd-filter .field input{min-width:150px}
.chip{border:1.5px solid var(--line);background:#fff;border-radius:20px;padding:6px 14px;font-size:13px;font-weight:600;color:var(--ink-soft);cursor:pointer;transition:.12s}
.chip:hover{border-color:var(--ink-soft)}
.chip.is-active{background:var(--steel-800);color:#fff;border-color:var(--steel-800)}
.print-head{display:none}

/* ---------- factory sidebar shell ---------- */
.shell{display:grid;grid-template-columns:250px 1fr;min-height:calc(100vh - 58px);align-items:stretch}
.panel--full{max-width:none!important;padding:0!important;margin:0!important}

.sidebar{
  display:flex;flex-direction:column;padding:18px 14px;gap:4px;
  border-right:1px solid var(--line);position:sticky;top:58px;height:calc(100vh - 58px);overflow-y:auto;
}
.side-brand{display:flex;align-items:center;gap:11px;padding:4px 8px 16px;margin-bottom:6px;border-bottom:1px solid var(--line)}
.side-logo .gate-mark{height:22px}
.side-fac{font-family:var(--font-display);font-weight:700;font-size:15px;line-height:1.15;letter-spacing:-.2px}
.side-sys{font-size:11px;opacity:.7;margin-top:2px}
.side-sec{font-size:10.5px;letter-spacing:1.2px;text-transform:uppercase;opacity:.55;font-weight:600;padding:12px 10px 5px}
.side-nav{display:flex;flex-direction:column;gap:2px}
.side-btn{
  display:flex;align-items:flex-start;gap:11px;padding:10px 11px;border:0;border-radius:8px;
  background:transparent;font-size:14px;font-weight:600;cursor:pointer;transition:.12s;width:100%;text-align:left;
  line-height:1.35;
}
.side-ic{width:18px;height:18px;display:inline-flex;flex-shrink:0;margin-top:1px}
.side-ic svg{width:18px;height:18px}
.side-tx{white-space:normal;overflow-wrap:anywhere;word-break:break-word;flex:1;min-width:0}
.side-foot{margin-top:auto;padding-top:12px;border-top:1px solid var(--line)}
.side-theme{opacity:.85}

.fbody{background:var(--paper);padding:26px 26px 60px;min-width:0}

/* --- DARK sidebar theme --- */
body[data-sidebar="dark"] .sidebar{background:var(--steel-800);border-right-color:var(--steel-700)}
body[data-sidebar="dark"] .side-brand{border-bottom-color:var(--steel-700)}
body[data-sidebar="dark"] .side-fac{color:#fff}
body[data-sidebar="dark"] .side-sys{color:#8fa0ad}
body[data-sidebar="dark"] .side-sec{color:#8fa0ad}
body[data-sidebar="dark"] .side-btn{color:#c4cfd8}
body[data-sidebar="dark"] .side-btn:hover{background:var(--steel-700);color:#fff}
body[data-sidebar="dark"] .side-btn.is-active{background:var(--amber);color:#3a2a05}
body[data-sidebar="dark"] .side-foot{border-top-color:var(--steel-700)}

/* --- LIGHT sidebar theme --- */
body[data-sidebar="light"] .sidebar{background:#fff;border-right-color:var(--line)}
body[data-sidebar="light"] .side-fac{color:var(--ink)}
body[data-sidebar="light"] .side-sys{color:var(--ink-soft)}
body[data-sidebar="light"] .side-sec{color:var(--ink-soft)}
body[data-sidebar="light"] .side-btn{color:var(--ink-soft)}
body[data-sidebar="light"] .side-btn:hover{background:var(--paper);color:var(--ink)}
body[data-sidebar="light"] .side-btn.is-active{background:var(--steel-800);color:#fff}

/* Hamburger button (base first, then media queries) */
.menu-toggle{
  display:none;flex-direction:column;justify-content:center;gap:4px;
  width:34px;height:34px;padding:7px;background:transparent;
  border:1px solid var(--steel-600);border-radius:8px;cursor:pointer;
}
.menu-toggle span{display:block;height:2px;width:100%;background:#cdd6de;border-radius:2px}
.sidebar-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:150}

@media(max-width:860px){
  .shell{grid-template-columns:1fr}
  .sidebar{
    position:fixed;top:0;left:0;bottom:0;width:260px;z-index:200;
    transform:translateX(-100%);transition:transform .25s ease;
    height:100vh;overflow-y:auto;border-right:1px solid var(--line);
    flex-direction:column;
  }
  .sidebar--open{transform:translateX(0);box-shadow:4px 0 24px rgba(0,0,0,.25)}
  .side-sec{display:block}
  .side-nav{flex-direction:column;flex-wrap:nowrap}
  .side-btn{width:100%}
  .menu-toggle{display:flex!important}
}
@media(min-width:861px){
  .menu-toggle{display:none!important}
  .sidebar-overlay{display:none!important}
}
body.is-master-view .menu-toggle{display:none!important}

/* ---------- backup & restore ---------- */
.bk-row{display:flex;gap:10px;flex-wrap:wrap}
.bk-note{margin-top:12px;font-size:12.5px;color:var(--ink-soft);background:var(--paper);border:1px solid var(--line);border-radius:8px;padding:10px 12px}
.bk-hr{border:0;border-top:1px solid var(--line);margin:18px 0}
.bk-auto{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.bk-switch{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:600;cursor:pointer}
.bk-switch input{width:16px;height:16px}
.bk-warn{background:#fff4e5;border:1px solid #f0a020;border-radius:8px;padding:12px 14px;font-size:13px;color:#7a4a00}

.badge.manual{background:#fff4e5;color:#9a5a00;border:1px solid #f0a020;font-size:10px}
.manual-box{border:1px dashed var(--line);border-radius:10px;padding:14px;margin-top:8px}
.manual-toggle{display:flex;align-items:flex-start;gap:10px;cursor:pointer;font-size:13.5px;color:var(--ink-soft)}
.manual-toggle input{width:17px;height:17px;margin-top:1px}
.manual-note{font-size:12.5px;color:#9a5a00;background:#fff4e5;border:1px solid #f0a020;border-radius:8px;padding:8px 10px;margin:12px 0}

/* Urdu labels — thoda bara aur saaf */
.side-tx, label, .manual-toggle{unicode-bidi:plaintext}

.gate-add{display:flex;gap:8px}
.gate-add input{flex:1;padding:9px 11px;border:1px solid var(--line);border-radius:8px;font-size:14px;background:var(--paper);color:var(--ink)}
.gate-item{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border:1px solid var(--line);border-radius:8px;margin-bottom:8px;font-size:14px;font-weight:600}
.gate-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent,#e8a33d);margin-right:9px}

@media(max-width:560px){
  .grid-2{grid-template-columns:1fr}
  .page-head h2{font-size:20px}
  .page-head{flex-wrap:wrap;gap:10px}
  thead{display:none}
  tbody td{display:block;padding:6px 16px;border:0}
  tbody tr{display:block;border-bottom:1px solid var(--line);padding:10px 0;margin-bottom:6px}
  .row-actions{justify-content:flex-start;padding:8px 16px 4px;flex-wrap:wrap}
  .topbar{padding:0 12px}
  .topbar-right .who{display:none}
  .panel{padding:16px 12px 50px}
  .card{padding:16px!important}
  .seg{flex-wrap:wrap}
  .modal{width:96vw!important;max-width:96vw!important}
  .dash-grid{grid-template-columns:1fr 1fr!important}
}

@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* shifts */
.shift-add{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.shift-add input{padding:9px 11px;border:1px solid var(--line);border-radius:8px;font-size:14px;background:var(--paper);color:var(--ink)}
.shift-add input#sh-name{flex:2;min-width:140px}

.chk{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--ink-soft);cursor:pointer}
.chk input{width:auto;margin:0}

/* ===== Dashboard colorful cards (reference style) ===== */
.dash-grid{
  display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:18px;margin-bottom:20px;
}
.dash-card{
  display:flex;flex-direction:column;align-items:flex-start;gap:16px;padding:24px;border-radius:18px;
  border:1px solid var(--line);background:var(--paper);transition:transform .12s, box-shadow .12s;
}
.dash-card:hover{transform:translateY(-3px);box-shadow:0 10px 28px rgba(0,0,0,.10)}
.dash-ic{
  width:72px;height:72px;border-radius:18px;display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.dash-ic svg{width:38px;height:38px}
.dash-val{font-family:var(--font-display,inherit);font-size:38px;font-weight:700;line-height:1;color:var(--ink)}
.dash-label{font-size:14px;color:var(--ink-soft);margin-top:6px;font-weight:600}

/* tones — soft bg + colored icon */
.dash-blue .dash-ic{background:#e8f0fe;color:#2563eb}
.dash-green .dash-ic{background:#e6f7ec;color:#16a34a}
.dash-red .dash-ic{background:#fdeaea;color:#dc2626}
.dash-amber .dash-ic{background:#fef3e2;color:#d97706}
.dash-grey .dash-ic{background:#eef1f4;color:#64748b}

/* colored left accent bar */
.dash-blue{border-left:4px solid #2563eb}
.dash-green{border-left:4px solid #16a34a}
.dash-red{border-left:4px solid #dc2626}
.dash-amber{border-left:4px solid #d97706}
.dash-grey{border-left:4px solid #94a3b8}

.dash-foot{
  display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-radius:16px;
}
.dash-foot-label{font-size:12px;color:var(--ink-soft);text-transform:uppercase;letter-spacing:.5px}
.dash-foot-date{font-size:20px;font-weight:700;color:var(--ink);margin-top:2px;font-family:var(--font-display,inherit)}

/* employee summary cards */
.emp-sum-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px}
.emp-sum-card{padding:14px 16px;border-radius:12px;border:1px solid var(--line);text-align:center;background:var(--paper)}
.emp-sum-val{font-size:24px;font-weight:700;color:var(--ink);font-family:var(--font-display,inherit)}
.emp-sum-label{font-size:12px;color:var(--ink-soft);margin-top:4px;font-weight:600}
.emp-green{border-top:3px solid #16a34a}
.emp-red{border-top:3px solid #dc2626}
.emp-amber{border-top:3px solid #d97706}
.emp-blue{border-top:3px solid #2563eb}
.emp-grey{border-top:3px solid #94a3b8}
@media print{ .emp-sum-card{break-inside:avoid} .emp-sum-grid{gap:8px} }

/* Employee report — screen view */
#emp-report .emp-rep-head{text-align:center;margin-bottom:16px;padding-bottom:12px;border-bottom:2px solid var(--line)}
#emp-report .erh-company{font-size:20px;font-weight:700;color:var(--ink)}
#emp-report .erh-title{font-size:13px;color:var(--ink-soft);margin-top:3px}
#emp-report .erh-emp{display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;font-size:13px;margin-top:8px;color:var(--ink)}
#emp-report .emp-body{background:var(--paper);border:1px solid var(--line);border-radius:12px;overflow:hidden;margin-bottom:14px}
#emp-report .emp-table{width:100%;border-collapse:collapse;font-size:13px}
#emp-report .emp-table thead th{background:var(--bg-soft,#f0f3f6);padding:9px 10px;text-align:left;font-size:12px;color:var(--ink-soft);border-bottom:1px solid var(--line)}
#emp-report .emp-table tbody td{padding:8px 10px;border-bottom:1px solid var(--line)}
#emp-report .emp-sum-line{font-size:13px;font-weight:600;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--paper);text-align:center;line-height:1.9;color:var(--ink)}
#emp-report .emp-sign{display:flex;justify-content:space-between;gap:40px;margin-top:24px}
#emp-report .sign-box{flex:1;text-align:center}
#emp-report .sign-line{border-top:1px solid var(--ink-soft);margin-bottom:5px}
#emp-report .sign-label{font-size:12px;color:var(--ink-soft)}

/* ===== Payslip (screen) ===== */
#payslip{background:#fff;color:#1c2632;padding:24px;max-width:700px;margin:0 auto;font-size:13px}
.ps-head{text-align:center;border-bottom:2px solid #1c2632;padding-bottom:10px;margin-bottom:12px}
.ps-company{font-size:20px;font-weight:700}
.ps-title{font-size:13px;color:#555;margin-top:2px}
.ps-emp{display:flex;justify-content:space-between;font-size:12px;margin-bottom:8px}
.ps-att{font-size:11px;background:#f7f9fb;padding:7px 10px;border-radius:6px;margin-bottom:14px;text-align:center;color:#333}
.ps-cols{display:flex;gap:16px}
.ps-col{flex:1}
.ps-col-h{font-weight:700;font-size:12px;padding:6px 10px;border-radius:5px 5px 0 0;color:#fff}
.ps-earn{background:#16a34a}
.ps-ded{background:#dc2626}
.ps-table{width:100%;border-collapse:collapse;font-size:12px;border:1px solid #e2e7ec}
.ps-table td{padding:6px 10px;border-bottom:1px solid #eef1f4}
.ps-total td{border-top:2px solid #d0d7de;background:#f7f9fb}
.ps-net{display:flex;justify-content:space-between;align-items:center;background:#1c2632;color:#fff;padding:12px 18px;border-radius:8px;margin-top:14px;font-size:16px;font-weight:700}
.ps-sign{display:flex;justify-content:space-between;gap:50px;margin-top:40px}
.ps-sign-box{flex:1;text-align:center;font-size:11px;color:#555}
.ps-sign-line{border-top:1px solid #1c2632;margin-bottom:5px}

@media print{
  body.printing-payslip{margin:0!important;padding:0!important}
  body.printing-payslip *{visibility:hidden!important}
  body.printing-payslip #payslip, body.printing-payslip #payslip *{visibility:visible!important}
  body.printing-payslip #modal-root{position:static!important;background:none!important}
  body.printing-payslip #modal-root .modal{position:static!important;transform:none!important;box-shadow:none!important;max-width:none!important;width:auto!important;max-height:none!important;margin:0!important;padding:0!important}
  body.printing-payslip #modal-root .modal-head, body.printing-payslip #modal-root .modal-actions{display:none!important}
  body.printing-payslip #modal-root .modal-body{max-height:none!important;overflow:visible!important;padding:0!important}
  body.printing-payslip #payslip{position:absolute!important;left:0!important;top:0!important;width:100%!important;max-width:none!important;max-height:none!important;overflow:visible!important;box-shadow:none!important;border:0!important;margin:0!important;padding:8mm!important}
  body.printing-payslip .payslip-scroll{max-height:none!important;overflow:visible!important;border:0!important;margin:0!important}
  body.printing-payslip #payslip *{overflow:visible!important;max-height:none!important}
  body.printing-payslip .ps-att,
  body.printing-payslip .ps-col-h, body.printing-payslip .ps-net{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  body.printing-payslip .ps-net{color:#fff!important}
  @page{size:A4 portrait;margin:10mm}
}

.tada-total-row{display:flex;justify-content:flex-end;gap:8px;align-items:center;padding:10px 12px;background:var(--bg-soft,#f0f3f6);border-radius:8px;margin:8px 0;font-size:15px}
.tada-total-row strong{font-size:18px;color:var(--ink)}

.ps-stamp{font-size:10px;color:#888;margin-top:3px}

/* Import modal */
.import-fmt{background:var(--bg-soft,#f0f3f6);border:1px solid var(--line);border-radius:8px;padding:12px 14px}
.imp-ok{background:#e6f7ec;color:#16a34a;border:1px solid #b7e4c7;border-radius:8px;padding:10px 12px;font-weight:600;font-size:13px}
.imp-err-head{color:#dc2626;font-weight:600;font-size:13px;margin:12px 0 6px}
.imp-err-list{max-height:180px;overflow:auto;border:1px solid var(--line);border-radius:8px;padding:8px}
.imp-err-item{font-size:12px;color:var(--ink-soft);padding:3px 0;border-bottom:1px solid var(--line)}

/* Off day / holiday */
.off-banner{background:#eef2ff;border:1px solid #c7d2fe;color:#3730a3;border-radius:10px;padding:12px 16px;margin-bottom:16px;font-size:13px}
#emp-report .off-row td{background:#f4f6fb!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.off-tag{background:#e0e7ff;color:#3730a3;padding:1px 8px;border-radius:10px;font-size:11px;font-weight:600}

/* Late policy */
.late-policy-box{margin-top:16px;padding:14px;background:var(--bg-soft,#f0f3f6);border:1px solid var(--line);border-radius:10px}
.late-policy-note{margin-top:10px;padding:8px 12px;background:#fff7ed;border:1px solid #fed7aa;border-radius:8px;font-size:11px;color:#9a3412;-webkit-print-color-adjust:exact;print-color-adjust:exact}

.sunday-toggle{display:flex;align-items:flex-start;gap:8px;padding:12px;background:var(--bg-soft,#f0f3f6);border-radius:10px;font-size:13px;line-height:1.5}
.sunday-toggle input{margin-top:2px}

/* Employee profile */
.prof-row{display:flex;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--line)}
.prof-row:last-child{border-bottom:none}
.prof-k{color:var(--ink-soft);font-size:13px}
.prof-v{font-weight:600}
