/* ================= THEME ================= */
:root{
  --bg:#0b1220;
  --panel:#162034;
  --panel-2:#111a2b;
  --border:#2a3852;
  --text:#e6edf8;
  --muted:#8ea3c0;
  --accent:#3b82f6;
  --accent-2:#6366f1;
  --accent-soft:rgba(59,130,246,.14);
  --green:#22c55e;
  --red:#ef4444;
  --amber:#f59e0b;
  --violet:#8b5cf6;
  --cyan:#06b6d4;
  --radius:12px;
  --shadow:0 1px 2px rgba(0,0,0,.28), 0 10px 26px -14px rgba(0,0,0,.65);
  --shadow-lg:0 24px 56px -22px rgba(0,0,0,.85);
  --ring:0 0 0 3px rgba(59,130,246,.28);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:'Inter',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  /* two soft light sources behind a flat navy, so large empty areas aren't dead grey */
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(59,130,246,.10), transparent 60%),
    radial-gradient(900px 540px at 100% 0%, rgba(139,92,246,.09), transparent 58%),
    var(--bg);
  background-attachment:fixed;
  color:var(--text);
  font-size:14px;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

button,input,select{ font-family:inherit; font-size:inherit; color:inherit; }

/* ================= APP SHELL ================= */
.app{ display:flex; min-height:100vh; }

.sidebar{
  width:230px;
  flex-shrink:0;
  background:var(--panel-2);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  padding:18px 14px;
}

.main{ flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 24px;
  border-bottom:1px solid var(--border);
  background:var(--panel-2);
}
.topbar h1{ margin:0; font-size:18px; }
.topbar-right{ display:flex; align-items:center; gap:16px; }

.page{ display:none; padding:24px; }
.page.active{ display:block; }

/* ================= SIDEBAR ================= */
.logo{
  display:flex; align-items:center; gap:8px;
  font-weight:700; font-size:16px; margin-bottom:22px; padding:0 6px;
}
.logo span:first-of-type{ flex:1; }

.nav{ display:flex; flex-direction:column; gap:2px; flex:1; }
.nav-item{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:8px; cursor:pointer;
  color:var(--muted); font-size:13.5px;
  transition:background .15s, color .15s;
}
.nav-item:hover{ background:rgba(148,163,184,.08); color:var(--text); }
.nav-item.active{ background:var(--accent); color:#fff; }
.nav-item[hidden]{ display:none; }

.sidebar-footer{
  font-size:11px; color:var(--muted); line-height:1.6;
  padding:12px 6px 0; border-top:1px solid var(--border); margin-top:12px;
}

/* ================= TOPBAR RIGHT ================= */
.live-toggle{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); cursor:pointer; }
.switch{
  width:34px; height:18px; border-radius:999px; background:var(--border);
  position:relative; transition:background .15s;
}
.switch::after{
  content:''; position:absolute; top:2px; left:2px; width:14px; height:14px;
  border-radius:50%; background:#fff; transition:left .15s;
}
.switch.on{ background:var(--green); }
.switch.on::after{ left:18px; }

.clock{ font-variant-numeric:tabular-nums; color:var(--muted); font-size:13px; }

.avatar{
  width:34px; height:34px; border-radius:50%; background:var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-size:12.5px; font-weight:700; cursor:pointer; color:#fff;
}
.avatar-lg{ width:56px; height:56px; font-size:18px; margin:0 auto 10px; }

/* ================= BADGES ================= */
.badge{
  display:inline-block; padding:2px 8px; border-radius:999px;
  font-size:10.5px; font-weight:700; letter-spacing:.3px;
  background:rgba(148,163,184,.15); color:var(--muted);
}
.badge.green{ background:rgba(34,197,94,.15); color:var(--green); }
.badge.red{ background:rgba(239,68,68,.15); color:var(--red); }
.badge.blue{ background:rgba(59,130,246,.15); color:#60a5fa; }
.badge.gray{ background:rgba(148,163,184,.15); color:var(--muted); }
.badge.warn{ background:rgba(245,158,11,.15); color:var(--amber); }

/* ================= BUTTONS ================= */
.btn{
  border:1px solid var(--border); background:var(--panel);
  color:var(--text); padding:9px 16px; border-radius:8px;
  cursor:pointer; font-size:13px; font-weight:600;
  transition:filter .15s, background .15s;
}
.btn:hover{ filter:brightness(1.15); }
.btn-primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn-danger{ background:var(--red); border-color:var(--red); color:#fff; }
.btn-ghost{ background:transparent; }
.btn-sm{ padding:6px 12px; font-size:12px; }

/* ================= PANELS / GRIDS ================= */
.panel{
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px;
}
.panel h3{ margin:0 0 14px; font-size:14.5px; }

.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.chart-box{ position:relative; height:240px; }

.kpi-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(165px,1fr)); gap:16px; margin-bottom:20px; }
.kpi{
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px;
}
.kpi .icon{ font-size:20px; margin-bottom:6px; }
.kpi .label{ font-size:12px; color:var(--muted); }
.kpi .value{ font-size:22px; font-weight:700; margin:2px 0; }
.kpi .sub{ font-size:11px; color:var(--muted); }

/* ================= ACTIVITY FEED ================= */
.feed{ display:flex; flex-direction:column; gap:10px; max-height:320px; overflow-y:auto; }
.feed-item{ display:flex; gap:10px; font-size:13px; align-items:flex-start; }
.feed-item .fi{ font-size:15px; }
.feed-item .t{ font-size:11px; color:var(--muted); margin-top:2px; }

/* ================= LOTS / AREAS ================= */
.area-panel{ margin-bottom:20px; }
.area-panel .toolbar{ margin-bottom:12px; }
.area-select-wrap{ display:flex; align-items:center; gap:8px; }
.area-select-wrap label{ font-size:13px; color:var(--muted); white-space:nowrap; }
.area-select-wrap select{ width:auto; min-width:200px; }

.area-chips{ display:flex; gap:8px; overflow-x:auto; padding-bottom:6px; margin-bottom:10px; scrollbar-width:thin; }
.area-chip{
  flex-shrink:0; display:flex; flex-direction:column; align-items:flex-start; gap:2px;
  background:var(--panel-2); border:1px solid var(--border); color:var(--text);
  padding:8px 14px; border-radius:10px; cursor:pointer; font-size:13px; font-weight:600; text-align:left;
  transition:border-color .15s, background .15s;
}
.area-chip span{ font-size:11px; font-weight:400; color:var(--muted); }
.area-chip:hover{ border-color:var(--accent); }
.area-chip.active{ background:var(--accent); border-color:var(--accent); color:#fff; }
.area-chip.active span{ color:rgba(255,255,255,.8); }
.area-panel .chips{ margin-bottom:0; }

.area-heading{
  display:flex; align-items:baseline; gap:12px; margin:22px 0 12px; font-size:15px; font-weight:700;
}
.area-heading:first-child{ margin-top:0; }
.area-heading small{ font-size:12px; color:var(--muted); font-weight:400; }

.lots-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(270px,1fr)); gap:18px; }
.lot-card{
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px; display:flex; flex-direction:column;
}
.lot-card.closed{ opacity:.7; border-style:dashed; }
.lot-card.full .progress div, .lot-card.closed .progress div{ background:var(--red); }
.lot-card.limited .progress div{ background:var(--amber); }
.lot-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.lot-card h4{ margin:0 0 4px; font-size:15px; }
.lot-card .addr{ font-size:12px; color:var(--muted); margin-bottom:12px; }
.lot-stats{ display:flex; flex-wrap:wrap; gap:10px; font-size:12px; color:var(--muted); margin-bottom:12px; }
.progress{
  height:6px; background:var(--border); border-radius:999px; overflow:hidden; margin-bottom:14px;
}
.progress div{ height:100%; background:var(--accent); }
.lot-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:auto; }
.lot-pct{ font-size:12px; color:var(--muted); margin-left:auto; }

/* ================= SLOT MAP ================= */
.slot-toolbar{ display:flex; align-items:center; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.slot-toolbar select{
  background:var(--panel-2); border:1px solid var(--border); color:var(--text);
  padding:8px 10px; border-radius:8px; width:auto; min-width:220px; max-width:100%;
}

.chips{ display:flex; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.chip{
  background:var(--panel-2); border:1px solid var(--border);
  border-radius:999px; padding:6px 12px; font-size:12px; color:var(--muted);
}

.legend{ display:flex; align-items:center; gap:18px; font-size:12px; color:var(--muted); margin-bottom:14px; }
.legend .dot{ display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }

.slot-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); gap:10px; }
.slot{
  position:relative; border-radius:8px; padding:10px 8px; cursor:pointer;
  border:1px solid var(--border); font-size:11px; text-align:center;
  transition:transform .1s;
}
.slot:hover{ transform:translateY(-2px); }
.slot.available{ background:rgba(34,197,94,.12); border-color:rgba(34,197,94,.4); }
.slot.occupied{ background:rgba(239,68,68,.12); border-color:rgba(239,68,68,.4); }
.slot.maintenance{ background:rgba(148,163,184,.12); border-color:rgba(148,163,184,.4); }
.slot .sid{ display:block; font-weight:700; margin-bottom:6px; }
.slot .tag{ display:inline-block; border-radius:6px; padding:2px 5px; font-size:11px; margin-bottom:4px; }
.slot .veh{ display:block; font-size:9.5px; color:var(--muted); word-break:break-all; }
.slot .sst{ display:block; font-size:9.5px; color:var(--muted); }

/* ================= MODAL ================= */
.modal-bg{
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.55);
  align-items:center; justify-content:center; z-index:100;
}
.modal-bg.show{ display:flex; }
.modal{
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); padding:22px; width:min(400px,92vw);
  max-height:calc(100dvh - 32px); overflow:hidden;
  display:flex; flex-direction:column; min-height:0;
}
.modal-body{min-height:0; overflow-y:auto; overscroll-behavior:contain;}
.modal-actions{flex-shrink:0; padding-top:8px; background:var(--panel);}
.modal h3{ margin:0 0 14px; font-size:16px; }
.modal .row{
  display:flex; justify-content:space-between; padding:7px 0;
  border-bottom:1px solid var(--border); font-size:13px;
}
.modal .row:last-of-type{ border-bottom:none; }
.modal-actions{ display:flex; gap:10px; margin-top:16px; flex-wrap:wrap; }

.profile-name{ text-align:center; font-weight:700; font-size:15px; }
.profile-role{ text-align:center; font-size:12px; color:var(--muted); margin-bottom:14px; }

/* ================= FORMS ================= */
.form-group{ margin-bottom:14px; }
.form-group label{ display:block; font-size:12px; color:var(--muted); margin-bottom:5px; }
input,select{
  background:var(--panel-2); border:1px solid var(--border); color:var(--text);
  padding:9px 11px; border-radius:8px; width:100%;
}
input:focus,select:focus{ outline:none; border-color:var(--accent); }

/* ================= TOOLBAR / TABS ================= */
.toolbar{ display:flex; align-items:center; gap:14px; margin-bottom:16px; flex-wrap:wrap; }
.tabs{ display:flex; gap:6px; background:var(--panel-2); padding:4px; border-radius:8px; }
.tab{
  border:none; background:transparent; color:var(--muted);
  padding:7px 14px; border-radius:6px; cursor:pointer; font-size:12.5px; font-weight:600;
}
.tab.active{ background:var(--accent); color:#fff; }

/* ================= TABLE ================= */
.table-wrap{ overflow-x:auto; }
table{ width:100%; border-collapse:collapse; font-size:13px; }
th,td{ text-align:left; padding:10px 12px; border-bottom:1px solid var(--border); white-space:nowrap; }
th{ color:var(--muted); font-weight:600; font-size:11.5px; text-transform:uppercase; letter-spacing:.4px; }
tbody tr:hover{ background:rgba(148,163,184,.05); }

/* ================= TOASTS ================= */
#toasts{
  position:fixed; bottom:20px; right:20px; z-index:200;
  display:flex; flex-direction:column; gap:8px;
}
.toast{
  background:var(--panel); border:1px solid var(--border); border-left:3px solid var(--accent);
  padding:12px 16px; border-radius:8px; font-size:13px; box-shadow:0 4px 14px rgba(0,0,0,.35);
  animation:toast-in .15s ease-out;
}
.toast.success{ border-left-color:var(--green); }
.toast.warn{ border-left-color:var(--amber); }
.toast.error{ border-left-color:var(--red); }
@keyframes toast-in{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:translateY(0); } }

/* ================= PENALTY PANEL ================= */
.pen-rule{ font-weight:400; font-size:11px; color:var(--muted); margin-left:6px; }

.penalty-list{ display:flex; flex-direction:column; gap:8px; max-height:300px; overflow-y:auto; }
.penalty-item{
  display:flex; align-items:center; gap:10px;
  background:rgba(239,68,68,.07); border:1px solid rgba(239,68,68,.25);
  border-radius:8px; padding:10px 12px;
}
.penalty-item.paid{ background:rgba(148,163,184,.06); border-color:var(--border); opacity:.65; }
.pen-icon{ font-size:17px; }
.pen-body{ flex:1; min-width:0; }
.pen-top{ display:flex; align-items:center; gap:8px; font-size:13px; }
.pen-sub{ font-size:11.5px; color:var(--muted); margin-top:2px; }
.pen-meta{ font-size:10.5px; color:var(--muted); opacity:.75; margin-top:2px; }
.pen-right{ display:flex; flex-direction:column; align-items:flex-end; gap:6px; }
.pen-amt{ font-weight:700; font-size:14px; color:#f87171; }
.pen-empty{
  display:flex; align-items:center; justify-content:center; min-height:120px;
  color:var(--muted); font-size:13px; border:1px dashed var(--border); border-radius:8px;
}

/* ================= PENALTY ALERT POPUP ================= */
.penalty-head{
  background:var(--red); color:#fff; font-weight:800; letter-spacing:1px;
  text-align:center; padding:9px; border-radius:8px; margin-bottom:14px;
  animation:pen-flash 1s infinite;
}
@keyframes pen-flash{ 0%,100%{ filter:brightness(1); } 50%{ filter:brightness(.7); } }

.penalty-plate{
  background:#f8fafc; color:#0f172a; font-family:'Courier New',monospace;
  font-weight:800; font-size:17px; letter-spacing:2px; text-align:center;
  padding:8px; border-radius:6px; border:2px solid #0f172a; margin-bottom:14px;
}
.penalty-amount{ color:#f87171; font-weight:800; font-size:16px; }
.penalty-staff{
  margin-top:14px; font-size:12px; color:var(--muted);
  background:rgba(59,130,246,.1); border-radius:8px; padding:9px 11px;
}
.penalty-more{ margin-top:8px; font-size:11.5px; color:var(--amber); text-align:center; }

/* ================= CAMERA SCAN (ANPR) ================= */
.camera-feed{
  position:relative; aspect-ratio:16/9; border-radius:8px; overflow:hidden;
  background:
    linear-gradient(rgba(148,163,184,.08) 1px,transparent 1px) 0 0/100% 20%,
    linear-gradient(90deg,rgba(148,163,184,.08) 1px,transparent 1px) 0 0/16.6% 100%,
    radial-gradient(circle at 50% 40%,#1e293b,#0b1220 75%);
  border:1px solid var(--border);
}
.cam-live{
  position:absolute; top:10px; left:10px; z-index:2;
  display:flex; align-items:center; gap:6px;
  background:rgba(0,0,0,.55); color:#f87171; font-size:11px; font-weight:700;
  letter-spacing:.5px; padding:4px 9px; border-radius:999px;
}
.cam-live .dot{ width:7px; height:7px; border-radius:50%; background:#ef4444; animation:cam-pulse 1.2s infinite; }
@keyframes cam-pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.3; } }

.scan-line{
  position:absolute; left:4%; right:4%; top:0; height:2px;
  background:linear-gradient(90deg,transparent,#22c55e,transparent);
  box-shadow:0 0 10px 2px rgba(34,197,94,.7);
  opacity:0; z-index:2;
}
.scan-line.active{ opacity:1; animation:scan-sweep 1.6s linear infinite; }
@keyframes scan-sweep{ 0%{ top:8%; } 50%{ top:88%; } 100%{ top:8%; } }

.plate-readout{
  position:absolute; left:50%; bottom:12px; transform:translateX(-50%); z-index:2;
  background:#f8fafc; color:#0f172a; font-family:'Courier New',monospace;
  font-weight:800; font-size:15px; letter-spacing:2px;
  padding:6px 16px; border-radius:6px; border:2px solid #0f172a;
  min-height:1px;
}
.plate-readout:empty{ display:none; }

.scan-status{ margin-top:12px; font-size:13px; color:var(--muted); }

/* ================= QR RESULT ================= */
.qr-placeholder{
  min-height:170px; display:flex; align-items:center; justify-content:center;
  text-align:center; color:var(--muted); font-size:13px;
  border:1px dashed var(--border); border-radius:8px; padding:20px;
}
.qr-layout{ display:flex; gap:20px; flex-wrap:wrap; align-items:flex-start; }
.qr-side{ flex-shrink:0; width:240px; }
.qr-note{ font-size:10.5px; color:var(--muted); line-height:1.6; margin-top:8px; word-break:break-all; }
.qr-code{
  flex-shrink:0; background:#fff; border-radius:8px; padding:10px;
  display:flex; align-items:center; justify-content:center; line-height:0;
}
.qr-code svg{ display:block; width:220px; height:220px; }
.qr-details{ flex:1; min-width:200px; }
.detail-row{
  display:flex; justify-content:space-between; gap:10px;
  padding:7px 0; border-bottom:1px solid var(--border); font-size:13px;
}
.detail-row:last-child{ border-bottom:none; }

/* ================= STAFF ================= */
.staff-filter{ width:auto; }
.btn-plus{ display:inline-flex; align-items:center; gap:6px; font-size:14px; line-height:1; }
.pos-cell{ white-space:normal; min-width:240px; }
.pos-pill{
  display:inline-flex; align-items:center; gap:6px; margin:2px 6px 2px 0; white-space:nowrap;
  background:var(--panel-2); border:1px solid var(--border); border-radius:999px;
  padding:3px 10px 3px 4px; font-size:12px;
}
.pos-pill small{ color:var(--muted); }
.pos-cell a{ color:#60a5fa; }
.row-actions{ display:flex; gap:6px; }

/* Always-visible "+" on the staff page (the section is display:none elsewhere) */
.fab{
  position:fixed; right:24px; bottom:24px; z-index:90;
  width:56px; height:56px; border-radius:50%; border:none;
  background:var(--accent); color:#fff; font-size:30px; line-height:1; font-weight:600;
  box-shadow:0 8px 22px rgba(59,130,246,.45); cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:transform .15s, filter .15s;
}
.fab:hover{ transform:scale(1.06); filter:brightness(1.1); }
body[data-page="staff"] #toasts{ bottom:92px; }

.modal-wide{ width:min(640px,94vw); }
.modal .hint{ margin:-6px 0 14px; font-size:12px; color:var(--muted); line-height:1.5; }
.form-row{ display:grid; grid-template-columns:1fr 1fr; gap:0 14px; }
.positions-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
.positions-head label{ font-size:12px; color:var(--muted); }
.positions{ display:flex; flex-direction:column; gap:8px; margin-bottom:6px; }
.position-row{ display:grid; grid-template-columns:1fr 1fr 1.3fr 1.1fr auto; gap:8px; align-items:center; }
.form-row-3{ grid-template-columns:1fr 1fr 1fr; }
.username{ font-family:Consolas,'Courier New',monospace; font-size:12.5px; background:var(--panel-2); border:1px solid var(--border); border-radius:6px; padding:2px 7px; }
.position-row select{ min-width:0; }
.check-list{
  display:flex; flex-direction:column; gap:4px; max-height:180px; overflow-y:auto;
  background:var(--panel-2); border:1px solid var(--border); border-radius:8px; padding:8px 10px;
}
.check-list label{ display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer; margin:0; color:var(--text); }
.check-list input{ width:auto; margin:0; }
.check-list small{ color:var(--muted); }

/* ================= PEOPLE DIRECTORY / LANES ================= */
.muted{ color:var(--muted); }
.lane-heading{ display:flex; align-items:baseline; gap:10px; font-size:13px; font-weight:700; margin:16px 0 8px; }
.lane-heading:first-child{ margin-top:0; }
.lane-heading small{ font-size:11.5px; color:var(--muted); font-weight:400; }
.bulk-bar{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px; padding:8px 12px;
  background:var(--panel-2); border:1px solid var(--border); border-radius:8px; font-size:12.5px; }
.check-all{ display:flex; align-items:center; gap:8px; cursor:pointer; font-weight:600; }
.check-all input, .dir-table input[type=checkbox], .onboard-toggle input, .check-inline input{ width:16px; height:16px; margin:0; accent-color:var(--accent); cursor:pointer; }
.onboard-toggle{ display:inline-flex; align-items:center; gap:6px; cursor:pointer; font-size:12.5px; }
.check-inline{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text); padding:9px 0; cursor:pointer; }
.dir-table td.serial{ color:var(--muted); font-variant-numeric:tabular-nums; }
.dir-table td{ vertical-align:top; }

#lots-map[hidden], #lots-grid[hidden], .area-panel[hidden]{ display:none; }


/* =========================================================================
   POLISH — depth, motion and hierarchy layered on top of the base rules.
   Sits before the RESPONSIVE block so the mobile overrides still win.
   ========================================================================= */

/* ---- scrollbars ---- */
*{ scrollbar-width:thin; scrollbar-color:#31415e transparent; }
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:#31415e; border-radius:999px; border:2px solid transparent; background-clip:content-box; }
::-webkit-scrollbar-thumb:hover{ background:#3f5375; background-clip:content-box; }
::-webkit-scrollbar-track{ background:transparent; }

/* ---- keyboard focus, everywhere ---- */
:focus-visible{ outline:none; box-shadow:var(--ring); border-radius:8px; }

/* ---- shell ---- */
.sidebar{
  background:linear-gradient(180deg,#131d30,#0e1626);
  border-right:1px solid rgba(148,163,184,.10);
}
.topbar{
  position:sticky; top:0; z-index:50;
  background:rgba(17,26,43,.82);
  backdrop-filter:blur(12px);
  border-bottom:1px solid rgba(148,163,184,.10);
}
.topbar h1{ font-weight:700; letter-spacing:-.2px; }

/* the screen fades up on every page switch, so navigation feels responsive */
.page.active{ animation:page-in .22s ease-out; }
@keyframes page-in{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:none; } }

/* ---- sidebar brand + nav ---- */
.logo{
  font-size:17px; letter-spacing:-.3px; padding-bottom:16px; margin-bottom:14px;
  border-bottom:1px solid rgba(148,163,184,.10);
}
.logo .badge{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  color:#fff; box-shadow:0 2px 10px rgba(59,130,246,.35);
}
.nav-item{
  position:relative; font-weight:500;
  transition:background .18s, color .18s, transform .18s;
}
.nav-item:hover{ transform:translateX(2px); }
.nav-item.active{
  background:linear-gradient(90deg,rgba(59,130,246,.22),rgba(99,102,241,.10));
  color:#fff; font-weight:600;
}
/* accent rail marking the selected section */
.nav-item.active::before{
  content:''; position:absolute; left:-14px; top:50%; transform:translateY(-50%);
  width:3px; height:20px; border-radius:0 3px 3px 0;
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
}

/* ---- topbar right ---- */
.avatar{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  box-shadow:0 3px 12px rgba(59,130,246,.4);
  transition:transform .15s;
}
.avatar:hover{ transform:scale(1.07); }
.switch.on{ box-shadow:0 0 10px rgba(34,197,94,.5); }

/* ---- panels ---- */
.panel{
  background:linear-gradient(180deg,rgba(255,255,255,.028),transparent), var(--panel);
  border-color:rgba(148,163,184,.13);
  box-shadow:var(--shadow);
}
.panel h3{
  display:flex; align-items:center; gap:8px;
  font-weight:650; letter-spacing:-.1px;
}

/* ---- KPI cards ---- */
.kpi{
  position:relative; overflow:hidden;
  background:linear-gradient(180deg,rgba(255,255,255,.03),transparent), var(--panel);
  border-color:rgba(148,163,184,.13);
  box-shadow:var(--shadow);
  transition:transform .18s, box-shadow .18s, border-color .18s;
}
/* coloured cap, rotating through the palette so a row of tiles reads as distinct */
.kpi::before{
  content:''; position:absolute; inset:0 0 auto 0; height:3px;
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
}
.kpi:nth-child(2)::before{ background:linear-gradient(90deg,var(--violet),#a78bfa); }
.kpi:nth-child(3)::before{ background:linear-gradient(90deg,var(--green),#4ade80); }
.kpi:nth-child(4)::before{ background:linear-gradient(90deg,var(--cyan),#22d3ee); }
.kpi:nth-child(5)::before{ background:linear-gradient(90deg,var(--amber),#fbbf24); }
.kpi:nth-child(6)::before{ background:linear-gradient(90deg,var(--red),#f87171); }
.kpi:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow-lg);
  border-color:rgba(148,163,184,.26);
}
.kpi .icon{
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:36px; border-radius:10px; font-size:18px; margin-bottom:10px;
  background:rgba(148,163,184,.10); border:1px solid rgba(148,163,184,.13);
}
.kpi .label{ font-weight:500; letter-spacing:.2px; }
.kpi .value{ font-size:24px; letter-spacing:-.6px; font-variant-numeric:tabular-nums; }

/* ---- buttons ---- */
.btn{
  transition:transform .12s, filter .15s, background .15s, box-shadow .15s;
  border-color:rgba(148,163,184,.18);
}
.btn:active{ transform:translateY(1px); }
.btn-primary{
  background:linear-gradient(135deg,var(--accent),var(--accent-2));
  border-color:transparent; box-shadow:0 4px 14px -4px rgba(59,130,246,.6);
}
.btn-primary:hover{ box-shadow:0 8px 20px -6px rgba(59,130,246,.7); }
.btn-danger{ box-shadow:0 4px 14px -4px rgba(239,68,68,.55); }
.btn-ghost:hover{ background:rgba(148,163,184,.09); }

/* ---- badges ---- */
.badge{ border:1px solid transparent; }
.badge.green{ border-color:rgba(34,197,94,.28); }
.badge.red{ border-color:rgba(239,68,68,.28); }
.badge.blue{ border-color:rgba(59,130,246,.28); }
.badge.warn{ border-color:rgba(245,158,11,.28); }
.badge.gray{ border-color:rgba(148,163,184,.22); }

/* ---- tables ---- */
.table-wrap{
  border:1px solid rgba(148,163,184,.13); border-radius:var(--radius);
  background:var(--panel-2); box-shadow:var(--shadow);
  /* No inner vertical scroll: a scroll box inside the page caught the mouse
     wheel (the page seemed stuck and content below a table, e.g. the
     Locations map, could not be reached). The page scrolls; wide tables
     still scroll sideways. */
  overflow-x:auto;
}
.panel .table-wrap{ background:transparent; box-shadow:none; }
th{
  position:sticky; top:0; z-index:2;            /* header survives long scrolling lists */
  background:#162034;
  border-bottom:1px solid rgba(148,163,184,.18);
}
td{ border-bottom:1px solid rgba(148,163,184,.08); }
tbody tr{ transition:background .12s; }
tbody tr:hover{ background:rgba(59,130,246,.07); }
tbody tr:last-child td{ border-bottom:none; }

/* ---- forms ---- */
input,select{ transition:border-color .15s, box-shadow .15s, background .15s; }
input:hover,select:hover{ border-color:rgba(148,163,184,.34); }
input:focus,select:focus{ border-color:var(--accent); box-shadow:var(--ring); }
input::placeholder{ color:#6b7f9c; }

/* ---- tabs and chips ---- */
.tabs{ border:1px solid rgba(148,163,184,.12); }
.tab{ transition:background .15s, color .15s; }
.tab:hover:not(.active){ background:rgba(148,163,184,.08); color:var(--text); }
.tab.active{ background:linear-gradient(135deg,var(--accent),var(--accent-2)); box-shadow:0 2px 10px -2px rgba(59,130,246,.65); }
.chip{ border-color:rgba(148,163,184,.16); }
.area-chip{ transition:border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.area-chip:hover{ transform:translateY(-2px); box-shadow:var(--shadow); }
.area-chip.active{ background:linear-gradient(135deg,var(--accent),var(--accent-2)); box-shadow:0 6px 18px -6px rgba(59,130,246,.7); }

/* ---- lot cards ---- */
.lot-card{
  background:linear-gradient(180deg,rgba(255,255,255,.03),transparent), var(--panel);
  border-color:rgba(148,163,184,.13); box-shadow:var(--shadow);
  transition:transform .18s, box-shadow .18s, border-color .18s;
}
.lot-card:hover{ transform:translateY(-3px); box-shadow:var(--shadow-lg); border-color:rgba(148,163,184,.26); }
.lot-card h4{ letter-spacing:-.2px; }
.progress{ background:rgba(148,163,184,.16); }
.progress div{ background:linear-gradient(90deg,var(--accent),var(--accent-2)); transition:width .4s ease; }

/* ---- slot map ---- */
.slot{ transition:transform .14s, box-shadow .14s, border-color .14s; }
.slot:hover{ transform:translateY(-3px); box-shadow:var(--shadow); border-color:rgba(148,163,184,.5); }
.slot.available:hover{ box-shadow:0 8px 18px -8px rgba(34,197,94,.7); }
.slot.occupied:hover{ box-shadow:0 8px 18px -8px rgba(239,68,68,.7); }

/* ---- activity feed ---- */
.feed-item{
  padding:8px 10px; border-radius:9px; background:rgba(148,163,184,.045);
  border:1px solid transparent; transition:background .15s, border-color .15s;
}
.feed-item:hover{ background:rgba(59,130,246,.09); border-color:rgba(59,130,246,.2); }

/* ---- modal ---- */
.modal-bg{ backdrop-filter:blur(3px); }
.modal-bg.show .modal{ animation:modal-in .18s cubic-bezier(.2,.8,.3,1); }
@keyframes modal-in{ from{ opacity:0; transform:translateY(12px) scale(.97); } to{ opacity:1; transform:none; } }
.modal{ box-shadow:var(--shadow-lg); border-color:rgba(148,163,184,.16); }
.modal h3{ letter-spacing:-.2px; }

/* ---- toasts ---- */
.toast{ backdrop-filter:blur(10px); background:rgba(22,32,52,.94); box-shadow:var(--shadow-lg); }

/* ---- floating add button ---- */
.fab{ background:linear-gradient(135deg,var(--accent),var(--accent-2)); }

/* respect the OS reduce-motion setting */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{ animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}


/* ================= NOTIFICATION BELL ================= */
.notif{ position:relative; display:flex; align-items:center; }
.notif-bell{
  position:relative; display:flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:10px; font-size:16px; line-height:1;
  background:rgba(148,163,184,.10); border:1px solid rgba(148,163,184,.16);
  color:var(--text); cursor:pointer;
  transition:background .15s, border-color .15s, transform .15s;
}
.notif-bell:hover{ background:rgba(148,163,184,.18); border-color:rgba(148,163,184,.3); transform:translateY(-1px); }
.notif-bell.has-unread{ animation:bell-nudge 2.4s ease-in-out infinite; }
@keyframes bell-nudge{ 0%,86%,100%{ transform:rotate(0); } 90%{ transform:rotate(11deg); } 95%{ transform:rotate(-9deg); } }

.notif-count{
  position:absolute; top:-5px; right:-5px; min-width:17px; height:17px; padding:0 4px;
  display:flex; align-items:center; justify-content:center;
  border-radius:999px; background:linear-gradient(135deg,var(--red),#f87171); color:#fff;
  font-size:10px; font-weight:800; line-height:1;
  border:2px solid var(--panel-2); box-shadow:0 2px 8px rgba(239,68,68,.55);
}
.notif-count[hidden]{ display:none; }

.notif-panel{
  position:absolute; top:calc(100% + 12px); right:0; z-index:80;
  width:min(360px,calc(100vw - 32px));
  background:var(--panel); border:1px solid rgba(148,163,184,.16);
  border-radius:var(--radius); box-shadow:var(--shadow-lg);
  overflow:hidden; animation:notif-in .16s ease-out;
}
.notif-panel[hidden]{ display:none; }
@keyframes notif-in{ from{ opacity:0; transform:translateY(-6px); } to{ opacity:1; transform:none; } }

.notif-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:12px 14px; border-bottom:1px solid rgba(148,163,184,.14);
  font-size:13.5px; background:rgba(148,163,184,.05);
}
.notif-list{ max-height:min(60vh,420px); overflow-y:auto; }
.notif-item{
  display:flex; gap:10px; align-items:flex-start;
  padding:11px 14px; font-size:13px; line-height:1.45;
  border-bottom:1px solid rgba(148,163,184,.07);
}
.notif-item:last-child{ border-bottom:none; }
.notif-item .ni{ font-size:15px; flex-shrink:0; }
.notif-item .t{ font-size:11px; color:var(--muted); margin-top:3px; }
/* unread entries keep an accent rail until "mark all read" */
.notif-item.unread{ background:rgba(59,130,246,.09); box-shadow:inset 2px 0 0 var(--accent); }
.notif-item.notif-alert{ background:rgba(239,68,68,.10); box-shadow:inset 2px 0 0 var(--red); }
.notif-empty{ padding:30px 14px; text-align:center; color:var(--muted); font-size:13px; }

/* ================= ATTENDANCE REGISTER ================= */
.attendance-panel{ margin-bottom:20px; }
.att-date-wrap{ display:flex; align-items:center; gap:6px; }
.att-date-wrap input[type=date]{
  width:auto; min-width:150px; padding:7px 10px;
  color-scheme:dark;                     /* native picker follows the dark theme */
}
.att-date-wrap .btn:disabled{ opacity:.4; cursor:not-allowed; }

.att-table td{ vertical-align:middle; }
.att-actions{ display:flex; gap:6px; flex-wrap:wrap; white-space:normal; }
.att-btn{
  background:var(--panel-2); border:1px solid rgba(148,163,184,.18); color:var(--muted);
  font-weight:600; transition:background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.att-btn:hover{ color:var(--text); border-color:rgba(148,163,184,.4); }
/* the chosen state is filled; clicking it again clears the mark */
.att-btn.att-on{ color:#fff; border-color:transparent; }
.att-btn.att-on.att-present{ background:linear-gradient(135deg,var(--green),#4ade80); box-shadow:0 3px 12px -4px rgba(34,197,94,.7); }
.att-btn.att-on.att-absent{  background:linear-gradient(135deg,var(--red),#f87171);  box-shadow:0 3px 12px -4px rgba(239,68,68,.7); }
.att-btn.att-on.att-leave{   background:linear-gradient(135deg,var(--amber),#fbbf24); color:#1f1608; box-shadow:0 3px 12px -4px rgba(245,158,11,.7); }

@media (max-width:640px){
  .notif-panel{ position:fixed; top:64px; right:16px; left:16px; width:auto; }
  .att-date-wrap{ width:100%; }
  .att-date-wrap input[type=date]{ flex:1; min-width:0; }
  .att-actions .btn{ flex:1; }
}

/* ================= RESPONSIVE ================= */
@media (max-width:900px){
  .kpi-grid{ grid-template-columns:repeat(2,1fr); }
  .grid-2{ grid-template-columns:minmax(0,1fr); }
}
@media (max-width:640px){
  .sidebar{ width:64px; padding:14px 8px; }
  .logo span,.nav-item span,.sidebar-footer{ display:none; }
  .nav-item{ justify-content:center; padding:10px 0; font-size:18px; }
  .nav-item.active::before{ left:-8px; }   /* the sidebar loses padding when it collapses */
  .kpi-grid{ grid-template-columns:1fr 1fr; gap:10px; }
  .kpi .value{ font-size:18px; }
  .topbar{ padding:10px 14px; }
  .topbar h1{ font-size:15px; }
  .topbar-right{ gap:10px; }
  .clock{ display:none; }
  .page{ padding:14px; }
  .panel{ padding:14px; }

  .toolbar{ gap:8px; }
  .toolbar h3{ width:100%; }
  .area-select-wrap{ width:100%; }
  .area-select-wrap select{ flex:1; min-width:0; }
  .lots-grid{ grid-template-columns:1fr; gap:12px; }
  .lot-actions .btn{ flex:1; }
  .lot-pct{ width:100%; margin-left:0; text-align:right; }

  .staff-filter{ width:100%; }
  .bulk-bar .btn{ flex:1; }
  .btn-plus span{ display:none; }
  .row-actions{ flex-wrap:wrap; }
  .fab{ right:16px; bottom:16px; width:52px; height:52px; }
  .form-row{ grid-template-columns:1fr; }
  .position-row{ grid-template-columns:1fr 1fr; }
  .form-row-3{ grid-template-columns:1fr; }
  .modal{ padding:16px; }
  .modal-actions .btn{ flex:1; }
  #toasts{ left:16px; right:16px; }
}
