/* Colours in one place. Adjust to match the alfalasi.at website. */
:root {
  --brand: #0d0d0f;        /* header and bottom bar */
  --brand-text: #ffffff;
  --accent: #d62828;       /* main buttons */
  --accent-text: #ffffff;
  --in: #22a05a;           /* punch in */
  --out: #c2410c;          /* punch out */
  --bg: #1b1b1e;           /* greyish black page */
  --panel: #26262a;
  --text: #f2f2f3;
  --muted: #a6a6ad;
  --line: #3a3a40;
  --gold: #d4af37;         /* input outlines */
  --gold-bright: #f0cd5a;
  --field: #121214;        /* inside inputs */
  --warn-bg: #3a2e12;
  --warn-line: #f59e0b;
  --err-bg: #3d1818;
  --err: #ff8a8a;
  --ok-bg: #173323;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
body.has-nav { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
a { color: inherit; }
main { max-width: 860px; margin: 0 auto; padding: 14px 16px 24px; }
h1 { font-size: 1.5rem; margin: 6px 0 14px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
h3 { font-size: 1.02rem; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.pre { white-space: pre-wrap; }
code { font-size: .85em; word-break: break-all; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--brand); color: var(--brand-text); min-height: 58px; }
.brand { flex: 1; display: flex; align-items: center; text-decoration: none; }
.brand img { height: 42px; max-width: 200px; object-fit: contain; }
.brand-text { font-weight: 800; letter-spacing: .04em; font-size: 1.2rem; }
.bell { position: relative; text-decoration: none; font-size: 1.35rem; padding: 6px; }
.badge { position: absolute; top: -2px; right: -4px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; }

/* bottom nav */
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--brand); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 2px 10px; color: #9ca3af; text-decoration: none; font-size: .75rem; }
nav.bottom a.on { color: #fff; }
nav.bottom svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 18px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }
.btn.danger { color: var(--err); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.1rem; }
.btn.huge { width: 100%; min-height: 76px; font-size: 1.35rem; border-radius: 16px; margin: 10px 0; }
.btn.in { background: var(--in); color: #fff; }
.btn.out { background: var(--out); color: #fff; }
.btn.wide { width: 100%; margin-top: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.actions form { margin: 0; }
.quick { margin: 12px 0; display: grid; gap: 8px; }
.quick.two { grid-template-columns: 1fr 1fr; }

/* forms */
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
input, select, textarea { width: 100%; font: inherit; padding: 11px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); min-height: 48px; border-color: var(--gold); }
input::placeholder, textarea::placeholder { color: #7d7d85; }
select option { background: var(--field); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(212, 175, 55, .3); }
input[type=checkbox], input[type=radio] { width: 24px; height: 24px; min-height: 0; accent-color: var(--accent); }
.check, .radio { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
fieldset { border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0 0 14px; background: var(--panel); }
legend { font-weight: 700; padding: 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; align-items: end; }
@media (max-width: 520px) { .grid3 { grid-template-columns: 1fr 1fr; } }
form.inline { display: flex; gap: 8px; margin: 8px 0; }
form.inline input, form.inline select { flex: 1; min-width: 0; }
form.inline.parts input[type=number] { flex: 0 0 90px; }
.inline-form { display: inline; }
.search { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }
.search select { grid-column: 1; }
.search .btn { grid-column: 2; grid-row: 1 / span 2; }
.assign-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 4px 0; }

/* panels & messages */
.panel { background: var(--panel); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.panel.narrow { max-width: 420px; margin: 24px auto; }
.panel.warn { background: var(--warn-bg); border: 2px solid var(--warn-line); }
.panel.faded { opacity: .6; }
details.panel summary { font-weight: 650; cursor: pointer; }
.flash { padding: 12px 14px; border-radius: 12px; margin: 0 0 12px; background: var(--ok-bg); font-weight: 550; }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); border: 2px solid var(--warn-line); }
.flash.block { display: block; text-decoration: none; }
.empty { color: var(--muted); text-align: center; padding: 18px; background: var(--panel); border-radius: var(--radius); }

/* day bar */
.daybar { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: var(--radius); text-decoration: none; font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.daybar.on { background: var(--ok-bg); color: var(--in); }
.daybar.off { background: var(--in); color: #fff; }
.bigclock { text-align: center; padding: 14px; }
.bigclock .num { font-size: 2.6rem; font-weight: 800; }

/* job card tiles */
.tile { background: var(--panel); border-radius: var(--radius); margin: 0 0 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06); border: 2px solid transparent; }
.tile.live { border-color: var(--out); }
.tile-head { display: block; padding: 12px 14px 8px; text-decoration: none; }
.tile form, .tile > .btn { margin: 0 12px 12px; width: calc(100% - 24px); }
.tile form .btn { margin: 0; }
.tile .btn.big { min-height: 54px; }
.plate { display: inline-block; font-weight: 800; font-size: 1.15rem; letter-spacing: .03em; border: 2px solid #111; border-radius: 8px; padding: 1px 9px; background: #fff; color: #111; }
.plate.big { font-size: 1.5rem; }
.tile-title { font-weight: 650; margin: 6px 0 4px; }
.tile-meta { font-size: .88rem; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 650; background: var(--line); }
.chip.warn { background: var(--warn-bg); color: #fcd34d; }
.st-ready { background: #dbeafe; color: #1e40af; }
.st-in_progress { background: #4a2a12; color: #fdba74; }
.st-waiting_parts { background: #45370f; color: #fcd34d; }
.st-received { background: #33285a; color: #c4b5fd; }
.st-booked, .st-delayed { background: #123447; color: #7dd3fc; }
.st-pending_payment { background: #4a1832; color: #f9a8d4; }
.st-completed, .st-delivered { background: #dcfce7; color: #166534; }
.st-cancelled { background: #3a3a40; color: #c4c4ca; }
.tag { display: inline-block; margin-top: 6px; font-size: .85rem; padding: 4px 10px; border-radius: 8px; background: var(--warn-bg); }
.tag.ok { background: var(--ok-bg); color: var(--in); }
.cardhead { margin-bottom: 6px; }
.cardhead h1 { margin: 8px 0 6px; }
.desc { white-space: pre-wrap; background: var(--panel); padding: 10px 12px; border-radius: 10px; }

/* lists */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.list li.unread { font-weight: 650; }
.right { margin-left: auto; }
.menu { list-style: none; padding: 0; margin: 0 0 12px; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.menu a { display: flex; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 550; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.checklist li > div { flex: 1; }
.checklist li.done > div > div:first-child { text-decoration: line-through; color: var(--muted); }
.checklist form { margin: 0; }
.tick { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--gold); background: var(--field); font-size: 1.3rem; font-weight: 800; color: var(--in); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.done .tick { border-color: var(--in); background: var(--ok-bg); }
.tick.ro { cursor: default; }
.x { border: 0; background: none; font-size: 1.5rem; color: var(--muted); cursor: pointer; padding: 0 8px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.warn-text { color: #fcd34d; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0 0 10px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.thumb { margin: 0; }
.thumb img, .thumb video { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #000; }
.thumb figcaption { font-size: .78rem; color: var(--muted); }
.filelink { display: block; padding: 12px; background: var(--bg); border-radius: 10px; word-break: break-all; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; font-size: .95rem; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: #1f1f23; font-size: .85rem; color: var(--muted); }
.tbl tr.sum td { font-weight: 700; }
.tbl tr.bad td { background: var(--err-bg); }
.tbl.pin td { padding: 3px; }
.tbl.pin input { min-height: 38px; padding: 6px 8px; border-width: 1px; }
.pin-head { text-align: center; font-weight: 700; margin: 10px 0 16px; }
.pin-logo { display: block; margin: 0 auto 8px; max-height: 60px; max-width: 220px; }
.tbl.pin td.pinname { font-weight: 650; white-space: nowrap; font-size: .9rem; vertical-align: middle; }
.tbl.pin select { min-height: 40px; padding: 6px 8px; border-width: 1px; font-size: .95rem; }
.tbl.pin .other { margin-top: 4px; }
.sec-title { font-weight: 700; margin-bottom: 8px; }
.owner-only { background: var(--warn-bg); padding: 8px 10px; border-radius: 8px; }

/* owner */
.who { display: grid; gap: 6px; }
.who-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; background: var(--panel); padding: 10px 12px; border-radius: 12px; border-left: 6px solid var(--line); }
.who-row.on { border-left-color: var(--in); }
.who-row > span:last-child { grid-column: 1 / -1; }
.monthnav { display: flex; justify-content: space-between; align-items: center; background: var(--panel); border-radius: 12px; padding: 6px; margin-bottom: 12px; }
.monthnav a { text-decoration: none; font-size: 1.6rem; padding: 0 16px; }
.devchip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 8px; padding: 2px 4px 2px 8px; margin: 4px 4px 0 0; }
.fixrow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--panel); padding: 10px; border-radius: 12px; margin-bottom: 8px; }
.fixrow b, .fixrow input[name=reason], .fixrow button { grid-column: 1 / -1; }
.fixrow label { font-size: .85rem; }
.steps li { margin-bottom: 6px; }
.qr { display: block; margin: 10px auto; width: 220px; height: 220px; }

/* upload overlay */
#busy { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100; display: flex; align-items: center; justify-content: center; }
#busy[hidden] { display: none; }
.busy-box { background: var(--panel); padding: 22px; border-radius: 16px; width: min(320px, 86vw); text-align: center; font-weight: 650; }
.bar { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.bar i { display: block; height: 100%; width: 0; background: var(--in); transition: width .2s; }
[hidden] { display: none !important; }

@media print { .top, nav.bottom, .actions, form { display: none !important; } body { background: #fff; color: #111; } .panel, .tile { background: #fff; } }

/* Pinout form on phones: pin name on top, the two pick lists side by side */
@media (max-width: 700px) {
  .tbl.pin tr:first-child { display: none; }
  .tbl.pin tr { display: grid; grid-template-columns: 3fr 2fr; gap: 4px 6px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .tbl.pin td { border: 0; padding: 0; }
  .tbl.pin td:first-child { grid-column: 1 / -1; }
  .tbl.pin td.pinname { font-size: 1rem; }
}

/* Car picture */
.car-photo { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: var(--radius); margin-bottom: 8px; background: #000; }
.car-photo-form { margin: 0 0 8px; }
.car-photo-form label { cursor: pointer; }
.tile-photo { float: right; width: 86px; height: 64px; object-fit: cover; border-radius: 10px; margin-left: 10px; }

/* UAE number plates, drawn per emirate */
.uae-plate { display: inline-flex; align-items: center; gap: .45em; background: #f4f5f7; color: #111; border: 2px solid #111; border-radius: 6px; padding: .12em .6em; font-family: "Arial Narrow", Arial, sans-serif; font-size: 15px; line-height: 1; box-shadow: inset 0 0 0 2px #fff; white-space: nowrap; max-width: 100%; }
.uae-plate.big { font-size: 22px; }
.uae-plate .pl-code { font-weight: 700; font-size: 1.5em; }
.uae-plate .pl-num { font-weight: 700; font-size: 1.75em; letter-spacing: .04em; margin-left: auto; padding-left: .3em; }
.uae-plate .pl-mid { display: inline-flex; flex-direction: column; align-items: center; gap: .1em; }
.uae-plate .pl-ar { font-size: .85em; font-family: Tahoma, "Segoe UI", sans-serif; }
.uae-plate .pl-ar.small { font-size: .6em; }
.uae-plate .pl-en { font-size: .6em; font-weight: 700; letter-spacing: .06em; }
.uae-plate.plain .pl-num { font-size: 1.2em; margin: 0; padding: 0; }
.uae-plate.ad .pl-left { display: inline-grid; grid-template-columns: auto auto; align-items: center; column-gap: .25em; }
.uae-plate.ad .pl-ad-mark { background: #a8201a; color: #fff; border-radius: 40% 50% 45% 55%; font-size: .55em; padding: .35em .3em; font-family: Tahoma, sans-serif; }
.uae-plate.ad .pl-ad-word { grid-column: 1 / -1; font-size: .5em; font-style: italic; color: #444; text-align: center; }
.uae-plate.shj { background: #e6e9ef; }
.uae-plate.shj .pl-uae { font-size: .42em; font-weight: 700; line-height: 1.05; text-align: center; }
.uae-plate.rak .pl-en { letter-spacing: .02em; }

/* DT connector back view */
.dt-fig { margin: 4px 0 10px; }
.dt-view { max-width: 100%; height: auto; display: block; }
.dt-view text { font-family: Arial, sans-serif; }

/* special checklist items */
.item-form { display: grid; gap: 6px; margin-top: 6px; }
.item-form .field { margin: 0; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }

/* colour swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 4px; }
.swatch { display: flex; align-items: center; gap: 6px; padding: 6px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .85rem; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #888; flex: none; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.swatch i.new { border-style: dashed; }
.swatch:has(input:checked) { border-color: var(--gold-bright); box-shadow: 0 0 0 2px rgba(212, 175, 55, .35); }
.field > span + .swatches { margin-top: 6px; }
/* customer search */
.cust-results { list-style: none; padding: 0; margin: 0 0 10px; border: 2px solid var(--gold); border-radius: 10px; overflow: hidden; }
.cust-results button { width: 100%; text-align: left; padding: 12px; background: var(--field); color: var(--text); border: 0; border-bottom: 1px solid var(--line); font: inherit; font-size: .92rem; cursor: pointer; }
.cust-results button:hover { background: #2c2c31; }
.fit-preview { margin-top: 8px; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form input[name=q] { flex: 1 1 220px; }
.cust-item { padding: 10px 12px; border-bottom: 1px solid var(--line, #333); display: grid; gap: 4px; }
.cust-item details { margin-top: 4px; }
.cust-item.warn-row { border-left: 3px solid var(--gold); }
.warn-text { color: var(--gold); }
.car-photo { max-width: 520px; }
.photo-adjust { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: grid; place-items: center; z-index: 50; padding: 16px; }
.photo-adjust .pa-panel { background: var(--panel); border: 1px solid var(--gold); border-radius: 14px; padding: 16px; width: min(680px, 100%); display: grid; gap: 8px; }
.photo-adjust canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 10px; touch-action: none; cursor: grab; background: #000; }
.photo-adjust input[type=range] { min-height: 0; border: 0; padding: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 14px; }
.stat { background: var(--panel); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text); display: grid; gap: 2px; border: 2px solid transparent; }
.stat b { font-size: 1.6rem; }
.stat span { font-size: .85rem; color: var(--muted, #a6a6ad); }
.stat.warn { border-color: var(--gold); }
.seg { display: inline-flex; border: 2px solid var(--gold); border-radius: 999px; overflow: hidden; margin: 0 0 12px; }
.seg a { padding: 8px 16px; text-decoration: none; color: var(--text); font-weight: 600; }
.seg a.on { background: var(--gold); color: #111; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: #a6a6ad; font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.list li, .timeline li { overflow-wrap: anywhere; }
.price-total { font-size: 1.2rem; } .quote-form .check { display: block; margin: 6px 0; }
.extra-line input.qty { width: 80px; min-height: 36px; display: inline-block; padding: 4px 8px; }
