/* AZ AutoZone ERP — red / black workshop theme */
:root {
  --red: #d71920; --red-ink: #b3141a; --red-soft: #fde8e9;
  --ink: #16181d; --ink-2: #4a4f5a; --ink-3: #7a808c;
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --line: #e3e5ea; --line-2: #d3d6dd;
  --side: #121316; --side-ink: #c9ccd3; --side-on: #ffffff;
  --ok: #157a3c; --ok-soft: #e3f4ea; --warn: #9a6200; --warn-soft: #fff3db;
  --info: #1d5fbf; --info-soft: #e5eefc; --err: #b3141a; --err-soft: #fde8e9;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #eceef2; --ink-2: #b4b9c3; --ink-3: #868c98;
  --bg: #0d0e11; --surface: #17191e; --surface-2: #1d2026; --line: #2a2e36; --line-2: #383d47;
  --side: #08090b; --red-soft: #3a1416; --ok-soft: #12301f; --warn-soft: #33270e; --info-soft: #152640; --err-soft: #3a1416;
  --ok: #4cc27a; --warn: #e2a640; --info: #6ea2f0; --err: #ff6b6f;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; } h3 { font-size: 14px; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .mono { font-family: var(--mono); }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.side { width: 232px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; text-decoration: none !important; border-bottom: 1px solid #23252b; }
.brand img { height: 34px; width: auto; background: #fff; border-radius: 6px; padding: 2px 4px; }
.brand .mark { width: 34px; height: 34px; border-radius: 8px; background: var(--red); display: grid; place-items: center; font-weight: 800; letter-spacing: .5px; }
.brand b { display: block; font-size: 14px; } .brand small { color: #8a8f99; font-size: 11px; }
.side nav { padding: 8px; overflow-y: auto; flex: 1; }
.navhead { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6b707a; padding: 14px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; text-decoration: none; }
.side nav a:hover { background: #1d1f24; color: #fff; }
.side nav a.on { background: var(--red); color: var(--side-on); }
.sidefoot { padding: 10px 16px; font-size: 11px; color: #555a63; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 24px; min-height: 58px; }
.top h1 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topright { display: flex; align-items: center; gap: 10px; }
.content { padding: 24px; max-width: 1280px; width: 100%; }
.burger { display: none; }
.scrim { display: none; }

/* User menu */
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--surface); display: grid; place-items: center; font-weight: 700; }
.menu { position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.14); min-width: 200px; padding: 6px; z-index: 40; }
.menu a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--ink); }
.menu a:hover { background: var(--surface-2); text-decoration: none; }
.menuhead { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menuhead small { display: block; color: var(--ink-3); }

/* Clock pill */
.pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 6px 12px; font: 600 12.5px var(--font); cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.pill-on { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.pill-on .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(21,122,60,.18); }
.pill-off { color: var(--red); border-color: var(--red); }
.pill-off .dot { background: var(--red); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.kpi { padding: 16px 18px; }
.kpi .lbl { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.kpi .val { font-size: 26px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--ink-2); }
.kpi.accent { border-top: 3px solid var(--red); }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); }
.empty { padding: 36px 18px; text-align: center; color: var(--ink-3); }

/* Forms */
label.f { display: block; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
label.f > small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=search], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; min-height: 38px; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: transparent; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; padding: 4px 0; }
.check input { margin-top: 3px; accent-color: var(--red); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: 600 13.5px var(--font); border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none !important; min-height: 38px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: 12.5px; }
.btn-lg { padding: 14px 20px; font-size: 16px; min-height: 52px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.iconbtn { background: none; border: 0; color: var(--ink); cursor: pointer; padding: 6px; border-radius: 8px; display: inline-grid; place-items: center; }

/* Badges & flashes */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.b-open, .b-pending, .b-idle { background: var(--surface-2); }
.b-in_progress, .b-running { background: var(--info-soft); color: var(--info); border-color: transparent; }
.b-paused, .b-partial, .b-unpaid { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.b-work_done, .b-done, .b-paid, .b-delivered { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.b-invoiced { background: #efe7fb; color: #6a3fb5; border-color: transparent; }
.b-cancelled { background: var(--err-soft); color: var(--err); border-color: transparent; text-decoration: line-through; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.flash-err { background: var(--err-soft); color: var(--err); }
.note { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); }

/* Tabs / filters */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--red); border-color: var(--red); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters label.f { min-width: 140px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; font-size: 12.5px; background: var(--surface); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip b { font-variant-numeric: tabular-nums; }
.chip:hover { text-decoration: none; }

/* Key-value */
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--ink-3); } dl.kv dd { margin: 0; font-weight: 500; }

/* Timer (My Jobs) */
.jobtile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.jobtile.running { border: 2px solid var(--info); }
.jobtile .plate { font: 800 20px var(--font); letter-spacing: .5px; }
.jobtile .what { font-size: 15px; font-weight: 600; margin-top: 2px; }
.clock { font: 700 34px var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.timerbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.timerbtns .btn { min-height: 56px; font-size: 16px; border-radius: 12px; }
.timerbtns .full { grid-column: span 2; }

/* Board */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; border-left: 4px solid var(--line-2); }
.bcard.st-in_progress { border-left-color: var(--info); }
.bcard.st-work_done { border-left-color: var(--ok); }
.bcard.late { box-shadow: 0 0 0 2px var(--red) inset; }
.bline { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }

/* Kiosk */
.kiosk { min-height: 100vh; background: var(--side); color: #fff; padding: 24px; }
.kiosk h1 { font-size: 26px; }
.kiosk .clockbig { font: 700 56px var(--mono); }
.staffgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 24px; }
.staff { background: #1b1d22; border: 2px solid #2a2d34; border-radius: 16px; padding: 18px; color: #fff; text-align: left; cursor: pointer; font: inherit; }
.staff b { display: block; font-size: 17px; }
.staff.in { border-color: var(--ok); }
.staff small { color: #9aa0aa; }
.pinpad { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; justify-content: center; margin-top: 18px; }
.pinpad button { height: 72px; border-radius: 14px; border: 0; background: #23262d; color: #fff; font: 700 26px var(--font); cursor: pointer; }
.pinpad button:active { background: var(--red); }
.pindots { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }
.pindots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #6b707a; }
.pindots i.f { background: #fff; border-color: #fff; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal.open { display: flex; }
.modal .box { background: #121316; border: 1px solid #2a2d34; border-radius: 18px; padding: 24px; width: 100%; max-width: 380px; text-align: center; color: #fff; }

/* Login */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #121316 0%, #121316 55%, var(--red) 55.1%, var(--red) 100%); }
.authcard { width: 100%; max-width: 380px; background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.authcard .brand { color: var(--ink); border: 0; padding: 0 0 18px; }
.authcard .brand small { color: var(--ink-3); }

/* Autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 30; max-height: 280px; overflow-y: auto; margin-top: 4px; }
.ac-list div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac-list div:last-child { border-bottom: 0; }
.ac-list div:hover, .ac-list div.hl { background: var(--surface-2); }
.ac-list small { color: var(--ink-3); }

/* Responsive */
@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 25; }
  .burger { display: inline-grid; }
  .top { padding: 8px 12px; }
  .top h1 { font-size: 16px; }
  .content { padding: 14px 12px 40px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .g4.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3.kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .kpis .kpi { padding: 10px 12px; }
  .kpis .kpi .val { font-size: 19px; }
  .kpis .kpi .sub { font-size: 11px; }
  .kpis .kpi .btn { min-height: 34px; padding: 4px 8px; }
  .span2 { grid-column: auto; }
  .hide-xs { display: none !important; }
  dl.kv { grid-template-columns: 110px 1fr; }
  .card-b { padding: 14px; }
  .tbl th, .tbl td { padding: 9px 10px; }
}

/* Print */
@media print {
  .side, .top, .no-print, .flash { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}
