/* Bhartiya ERP — one stylesheet, phone-first. Brand: red #D2232A, gold #B8975A. */
:root {
  --brand: #d2232a;
  --brand-dark: #a8161c;
  --brand-soft: #fdecec;
  --gold: #b8975a;
  --gold-soft: #f6f0e4;
  --ink: #1f2328;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e5e7eb;
  --line-2: #f0f1f3;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ok: #157f3b;
  --ok-soft: #e7f6ec;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --info: #1d5fa8;
  --info-soft: #e8f1fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari",
          "Helvetica Neue", Arial, sans-serif;
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem;
  height: 56px; padding: 0 .75rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 600; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand img { height: 40px; width: auto; }
.topbar .brand span { display: none; }
.topbar .spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); text-decoration: none; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: .8rem; font-weight: 700;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.12);
  padding: .4rem; display: none;
}
.menu.open .menu-panel { display: block; }
.menu-panel .who { padding: .5rem .6rem .6rem; border-bottom: 1px solid var(--line-2); margin-bottom: .3rem; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem; border: 0; background: none;
  border-radius: 8px; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--line-2); text-decoration: none; }

/* ---------- Layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 1rem .75rem 4rem; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; flex: 1; min-width: 200px; }
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: .35rem; }
.crumbs a { color: var(--ink-3); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; margin-bottom: 1rem;
}
.card > h2:first-child, .card > h3:first-child { margin-bottom: .75rem; }
.card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; flex: 1; }
.grid-2 { display: grid; gap: 1rem; }
.stack > * + * { margin-top: .75rem; }

/* ---------- App grid (home) ---------- */
.hello { margin: .5rem 0 1.25rem; }
.hello h1 { font-size: 1.4rem; }
.apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem .5rem; margin-bottom: 1.5rem; }
.app-tile {
  display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .6rem .25rem;
  border-radius: 14px; color: var(--ink); text-align: center; font-size: .85rem; font-weight: 500;
}
.app-tile:hover { background: var(--card); text-decoration: none; box-shadow: var(--shadow); }
.app-icon {
  display: flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 16px;
  color: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15);
}
.app-icon .icon { width: 28px; height: 28px; }
.app-icon.red { background: linear-gradient(135deg, #e5484d, #b4161c); }
.app-icon.gold { background: linear-gradient(135deg, #cfb27c, #9c7a3c); }
.app-icon.slate { background: linear-gradient(135deg, #5b6472, #2f3640); }
.app-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.app-icon.green { background: linear-gradient(135deg, #22a35a, #146c3a); }
.app-icon.orange { background: linear-gradient(135deg, #f59e0b, #c2410c); }
.app-icon.purple { background: linear-gradient(135deg, #8b5cf6, #5b21b6); }
.app-icon.teal { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.app-desc { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: var(--tap);
  padding: .55rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { color: var(--bad); border-color: #f3c3bd; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-row form { margin: 0; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label, .label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.field .help { font-size: .8rem; color: var(--ink-3); margin-top: .25rem; }
.field .errorlist, .errorlist { list-style: none; margin: .3rem 0 0; padding: 0; color: var(--bad); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .7rem; border: 1px solid #cfd4dc; border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit; font-size: 16px; /* 16px stops iPhone zooming in */
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 3px solid rgba(210, 35, 42, .25); outline-offset: 1px; border-color: var(--brand);
}
.has-error input, .has-error select { border-color: var(--bad); }
.code-input { font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 3rem; }
.pw-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; }
.checks label, label.check {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border: 1px solid var(--line);
  border-radius: 8px; font-weight: 500; cursor: pointer; margin: 0;
}
.checks input, label.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.form-error { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: .7rem .8rem; margin-bottom: 1rem; }
.filters { display: grid; gap: .5rem; margin-bottom: 1rem; }

/* ---------- Messages / badges ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .9rem; border-radius: 8px; margin-bottom: .5rem; }
.msg-success { background: var(--ok-soft); color: var(--ok); }
.msg-error { background: var(--bad-soft); color: var(--bad); }
.msg-info { background: var(--info-soft); color: var(--info); }
.msg-warning { background: var(--warn-soft); color: var(--warn); }
.badge {
  display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.twin-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: .75rem; }
.twin { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; display: grid; gap: .3rem; align-content: start; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-gold { background: var(--gold-soft); color: #7a5c22; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ---------- Tabs / segmented ---------- */
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .6rem .8rem; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.on { color: var(--brand-dark); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs .count { color: var(--ink-3); font-weight: 400; }
.tabs .count-bad { color: var(--bad); font-weight: 700; }

/* ---------- Lists: cards on phone, table on laptop ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row-card {
  display: flex; gap: .75rem; align-items: center; padding: .8rem; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; color: var(--ink);
}
.row-card:hover { text-decoration: none; border-color: #cfd4dc; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { font-size: .85rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.table-wrap { display: none; }
table.data { width: 100%; border-collapse: collapse; background: var(--card); }
table.data th, table.data td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); background: #fafbfc; }
table.data tr:hover td { background: #fcfcfd; }
dl.facts { display: grid; grid-template-columns: 1fr; gap: .15rem .75rem; margin: 0; }
dl.facts dt { color: var(--ink-3); font-size: .8rem; }
dl.facts dd { margin: 0 0 .5rem; font-weight: 500; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: center; gap: .5rem; align-items: center; margin: 1rem 0; }
.empty { text-align: center; color: var(--ink-3); padding: 2rem 1rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .55rem 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.timeline li:last-child { border: 0; }
.changes { margin: .3rem 0 0; font-size: .8rem; color: var(--ink-2); }
.changes del { color: var(--bad); }
.changes ins { color: var(--ok); text-decoration: none; }

/* ---------- Login screens ---------- */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #fff 0%, var(--bg) 100%); }
.auth-wrap { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: block; margin: .5rem auto 1.25rem; max-width: 230px; height: auto; }
.auth-card .card { padding: 1.25rem; }
.auth-title { text-align: center; margin-bottom: 1.25rem; }
.auth-title h1 { font-size: 1.25rem; margin-bottom: .2rem; }
.auth-foot { text-align: center; color: var(--ink-3); font-size: .85rem; padding: 1rem; }
.lang-switch { display: flex; justify-content: center; gap: .25rem; margin-top: 1rem; }
.lang-switch form { margin: 0; }
.lang-switch button { border: 0; background: none; padding: .4rem .6rem; border-radius: 6px; color: var(--ink-3); font: inherit; cursor: pointer; }
.lang-switch button.on { color: var(--brand-dark); font-weight: 700; background: var(--brand-soft); }
.qr { display: flex; justify-content: center; margin: .5rem 0 1rem; }
.qr svg { width: 210px; height: 210px; }
.secret-box { background: var(--line-2); border-radius: 8px; padding: .6rem; text-align: center; font-size: 1rem; letter-spacing: .05em; overflow-wrap: anywhere; }
.steps { padding-left: 1.2rem; margin: 0 0 1rem; }
.steps li { margin-bottom: .4rem; }
.temp-pw { font-size: 1.6rem; font-weight: 700; text-align: center; padding: 1rem; border: 2px dashed var(--gold);
           border-radius: 10px; background: var(--gold-soft); letter-spacing: .05em; margin: 1rem 0; user-select: all; }

/* ---------- Laptop and bigger ---------- */
@media (min-width: 640px) {
  .apps { grid-template-columns: repeat(4, 1fr); }
  .filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; }
  .filters.filters-5 { grid-template-columns: 1fr 1fr; }
  dl.facts { grid-template-columns: 160px 1fr; }
  dl.facts dd { margin-bottom: .35rem; }
  .checks { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  body { font-size: 14.5px; }
  .topbar { padding: 0 1.25rem; }
  .topbar .brand span { display: inline; }
  .page { padding: 1.5rem 1.25rem 4rem; }
  .apps { grid-template-columns: repeat(6, 1fr); gap: 1.5rem 1rem; }
  .app-desc { display: block; font-size: .75rem; font-weight: 400; color: var(--ink-3); }
  .grid-2 { grid-template-columns: 1.4fr 1fr; }
  .table-wrap { display: block; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
  .cards-only { display: none; }
  .auth-wrap { align-items: center; }
}
.print-head, .print-sign { display: none; }
@media print {
  .topbar, .btn, .no-print, .crumbs, .history { display: none !important; }
  body { background: #fff; }
  .print-head { display: block; text-align: center; border-bottom: 2px solid #000; padding-bottom: .5rem; margin-bottom: 1rem; }
  .print-company { font-size: 1.1rem; font-weight: 700; }
  .print-title { display: none; font-size: 1.9rem; font-weight: 800; letter-spacing: .06em; margin: .35rem 0 .15rem; }
  .print-title span { font-size: 1.2rem; letter-spacing: 0; font-weight: 700; }
  .print-sub { font-size: .9rem; }
  body:not([data-printing]) .print-title[data-paper-title=""],
  body[data-printing="gate_pass"] .print-title[data-paper-title="gate_pass"],
  body[data-printing="challan"] .print-title[data-paper-title="challan"],
  body[data-printing="bill"] .print-title[data-paper-title="bill"] { display: block; }
  .print-sign { display: flex; justify-content: space-between; gap: 2rem; margin-top: 4rem; }
  .print-sign div { flex: 1; border-top: 1px solid #000; padding-top: .3rem; text-align: center; font-size: .85rem; }
}

/* ---------- Role permission grid ---------- */
.perm-module { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .75rem; overflow: hidden; }
.perm-module > summary { cursor: pointer; padding: .7rem .9rem; font-weight: 700; background: #fafbfc; list-style: none; }
.perm-module > summary::-webkit-details-marker { display: none; }
.perm-module > summary::before { content: "▸ "; color: var(--ink-3); }
.perm-module[open] > summary::before { content: "▾ "; }
.perm-res { padding: .6rem .9rem .8rem; border-top: 1px solid var(--line-2); }
.perm-res-name { font-weight: 600; margin-bottom: .35rem; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .3rem 0; font-weight: 400; margin: 0; }
.perm-row span { flex: 1; }
.perm-row select { width: auto; min-width: 9.5rem; min-height: 38px; padding: .3rem .5rem; }
.perm-select.all { border-color: #9fd3b0; background: var(--ok-soft); }
.perm-select.own { border-color: #f1cf8f; background: var(--warn-soft); }
.perm-res .check { margin-top: .35rem; }
.access-list { list-style: none; margin: 0; padding: 0; }
.access-list li { padding: .35rem 0; border-bottom: 1px solid var(--line-2); font-size: .9rem; }
.access-list li:last-child { border: 0; }
.void-banner { background: var(--line-2); color: var(--ink-2); border-left: 4px solid var(--ink-3); }
.org-chips { margin-bottom: .75rem; }
.org-chips .badge { padding: .35rem .7rem; font-size: .85rem; }
.icon-tile { width: 42px; height: 42px; border-radius: 12px; }
.icon-tile .icon { width: 22px; height: 22px; }
@media (min-width: 640px) { .filters.filters-2 { grid-template-columns: 1fr auto; } }

/* ---------- Attachments ---------- */
.attach { margin-bottom: .75rem; }
.attach-list { list-style: none; margin: 0 0 .5rem; padding: 0; }
.attach-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line-2); }
.attach-list li a:first-child { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; overflow-wrap: anywhere; }
.attach-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.attach-form input[type=file] { font-size: .85rem; max-width: 100%; }

/* ---------- Orders ---------- */
.badge-lg { font-size: .8rem; padding: .2rem .65rem; vertical-align: middle; }
.stepper { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; font-size: .85rem; counter-reset: step; }
.stepper li { flex: 1; padding: .5rem .7rem; border-radius: 8px; background: var(--line-2); color: var(--ink-3); counter-increment: step; }
.stepper li::before { content: counter(step) ". "; font-weight: 700; }
.stepper li.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.form-grid, .row-form-grid { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.row-form { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .8rem .4rem; margin-bottom: .75rem; background: #fcfcfd; }
.row-form.removed { opacity: .45; background: var(--bad-soft); }
.row-form-status { margin-bottom: .5rem; }
.remove-toggle { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--bad); margin: 0 0 .5rem; cursor: pointer; font-weight: 500; }
.remove-toggle input { width: 18px; height: 18px; accent-color: var(--bad); }
.radio-field ul, .radio-field div > div { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 0; }
.radio-field label:not(:first-child), .radio-field li label, .radio-field div > div label {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 999px;
  font-weight: 500; cursor: pointer; margin: 0; background: #fff; }
.radio-field input[type=radio] { accent-color: var(--brand); width: 18px; height: 18px; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(245,246,248,0), var(--bg) 35%); padding: 1rem 0 .75rem; z-index: 5; }
.stat-row { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow); }
.stat-label { font-size: .8rem; color: var(--ink-3); }
.stat-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-card { padding: .7rem 0; border-bottom: 1px solid var(--line-2); }
.item-card:last-child { border: 0; }
.table-wrap.flat { box-shadow: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: span 2; }
  .row-form-grid { grid-template-columns: repeat(4, 1fr); }
  .items-grid { grid-template-columns: repeat(4, 1fr); }
  .items-grid .span-2 { grid-column: span 2; }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1000px) { .filters.filters-5 { grid-template-columns: 2fr 1.4fr 1.2fr 1fr 1fr auto; } }

/* ---------- Home: app groups ---------- */
.app-group { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem .75rem .5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.app-group-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 .25rem .75rem; }
.app-group .apps { margin-bottom: .5rem; }

/* ---------- Field service ---------- */
.next-step { border-left: 4px solid var(--brand); }
.next-step h2 { margin: .15rem 0 .6rem; }
.steps-list { list-style: none; margin: 0; padding: 0; }
.steps-list li { display: flex; gap: .7rem; padding: .45rem 0; color: var(--ink-3); position: relative; }
.steps-list li .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex: none; margin-top: .25rem; background: #fff; }
.steps-list li.done { color: var(--ink); }
.steps-list li.done .dot { background: var(--ok); border-color: var(--ok); }
.steps-list li.current { color: var(--brand-dark); font-weight: 600; }
.steps-list li.current .dot { border-color: var(--brand); }
@media (min-width: 640px) { .row-form-grid .span-2 { grid-column: span 2; } }

/* ---------- My work (technician phone) ---------- */
.work-card .card-head { align-items: flex-start; }
.step-buttons { display: grid; gap: .5rem; margin-bottom: .75rem; }
.step-btn { min-height: 54px; font-size: 1.05rem; }
.step-btn[disabled] { opacity: .45; cursor: not-allowed; }
.step-btn.done-now { background: var(--ok-soft); color: var(--ok); border-color: #9fd3b0; opacity: 1; }
.work-section { border-top: 1px solid var(--line-2); padding: .6rem 0; }
.work-section > summary { cursor: pointer; font-weight: 600; padding: .35rem 0; list-style: none; }
.work-section > summary::-webkit-details-marker { display: none; }
.work-section > summary::before { content: "▸ "; color: var(--ink-3); }
.work-section[open] > summary::before { content: "▾ "; }
.work-section form { margin-top: .5rem; }
.voice-row { align-items: center; margin-bottom: .75rem; }
.voice-row .recording { background: var(--bad-soft); color: var(--bad); border-color: #f3c3bd; }
audio { width: 100%; margin-top: .35rem; }
.text-bad { color: var(--bad); font-weight: 600; }
.qty-input { width: 5.5rem !important; min-height: 38px; text-align: center; }
.outbox-bar { position: sticky; top: 56px; z-index: 15; margin: -1rem -0.75rem 1rem; padding: .6rem .9rem; font-size: .9rem;
  background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #f1cf8f; }
.outbox-bar.ok { background: var(--ok-soft); color: var(--ok); border-color: #9fd3b0; }
.outbox-bar.bad { background: var(--bad-soft); color: var(--bad); border-color: #f3c3bd; }
a.stat { color: inherit; text-decoration: none; }
.expense-decide { margin-top: .4rem; align-items: center; }
.expense-decide .reason-input { width: auto; flex: 1; min-width: 140px; min-height: 34px; padding: .3rem .5rem; font-size: .85rem; }

/* ---------- Reports ---------- */
.report-filters { margin-bottom: 1rem; }
.report-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: flex-end; margin-bottom: .5rem; }
.report-actions .muted { margin-right: auto; }
.report-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.report-table th, .report-table td { padding: .5rem .6rem; font-size: .85rem; }
.report-table tfoot td { font-weight: 700; background: #fafbfc; border-top: 2px solid var(--line); }
@media (min-width: 900px) { .report-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Items to buy ---------- */
.row-card .pick { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.pick-actions { margin-bottom: .75rem; }
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.row-card.unread { border-left: 4px solid var(--brand); }
.dispatch-line { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.qty-box { display: flex; flex-direction: column; align-items: flex-end; margin: 0; font-weight: 500; }
.qty-box input { width: 5.5rem; text-align: right; }
.money-table { width: 100%; border-collapse: collapse; }
.money-table td { padding: .35rem 0; border-bottom: 1px solid var(--line-2); }
.money-table td.num { text-align: right; }
.money-table tr.total td { font-weight: 700; border-bottom: 0; font-size: 1.05rem; }
.undo-box { margin: .5rem 0 .75rem; font-size: .9rem; }
.undo-box summary { cursor: pointer; color: var(--ink-3); }
.undo-box form { margin-top: .5rem; }

/* ---------- Dashboard widgets (home) ---------- */
.dash { margin-bottom: 1.25rem; }
.dash .app-group-title { margin: .75rem .25rem .5rem; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.dash-card { display: block; color: var(--ink); }
.dash-card:hover { text-decoration: none; border-color: #cfd4dc; }
.dash-card.tone-bad { border-left: 4px solid var(--bad); }
.dash-card.tone-warn { border-left: 4px solid var(--warn); }
.dash-card.tone-bad .stat-value { color: var(--bad); }
.dash-lines { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .78rem; color: var(--ink-2); }
.dash-lines li { padding: .15rem 0; border-top: 1px solid var(--line-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) { .filters.filters-3 { grid-template-columns: 1fr 12rem auto; } }

/* ---------- Store ---------- */
.store-boxes { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-bottom: 1rem; }
.store-box { margin: 0; }
.store-box-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.store-box-head h2 { margin: 0; }
.supply-cats { list-style: none; padding: 0; margin: 0 0 .5rem; }
.supply-cats li { display: flex; gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--line-2); }
.supply-cats li a:first-child { flex: 1; font-weight: 500; }
.qty-neg { color: var(--bad); font-weight: 700; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); max-height: 16rem; overflow-y: auto; list-style: none; margin: 2px 0 0; padding: 0; }
.picker-list li { padding: .45rem .6rem; cursor: pointer; font-size: .9rem; border-bottom: 1px solid var(--line-2); }
.picker-list li:hover, .picker-list li.on { background: var(--brand-soft); }
.picker-name { font-size: .8rem; color: var(--ink-3); margin-top: .2rem; }
@media (min-width: 900px) { .store-boxes { grid-template-columns: repeat(3, 1fr); } }
.tabs-sub a { font-size: .85rem; padding: .45rem .65rem; }
.picker-list li.picker-add { color: var(--brand-dark); font-weight: 600; }
.line-grid { grid-template-columns: 1fr; }
@media (min-width: 640px) { .row-form-grid.line-grid { grid-template-columns: 1.3fr 2fr 1fr; } }
.picker-list .pk-num { color: var(--ink-2); margin-left: .35rem; }
.picker-list .pk-name { font-size: .85rem; color: var(--ink-3); }
.take-back .qty-input { width: 5rem; text-align: right; }
td.gap-bad { background: var(--bad-soft); } td.gap-bad [data-flag], td.gap-bad [data-flag-faulty] { color: var(--bad); font-weight: 700; }
td.gap-warn { background: var(--warn-soft); } td.gap-warn [data-flag], td.gap-warn [data-flag-faulty] { color: var(--warn); font-weight: 700; }
td.gap-ok [data-flag], td.gap-ok [data-flag-faulty] { color: var(--ok); }
.qty-pair { display: flex; gap: .35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.row-card.has-error { border-color: var(--bad); }
.btn-col { display: flex; flex-direction: column; gap: .4rem; align-items: stretch; }
.papers .paper-row { padding: .4rem 0; border-top: 1px solid var(--line-2); }
.papers .paper-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; margin-top: .35rem; }
.papers .paper-fields[hidden] { display: none; }
.field-label { font-weight: 600; }
.step-last { margin-top: 1rem; }
/* Big confirmation box (step buttons, removing an expense) */
.confirm-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.confirm-box { background: #fff; border-radius: 16px; padding: 1.4rem 1.2rem 1.1rem; width: 100%; max-width: 26rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center; }
.confirm-question { font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
.confirm-sub { color: var(--ink-3); margin-top: .4rem; }
.confirm-buttons { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.2rem; }
.confirm-buttons .btn { min-height: 52px; font-size: 1.1rem; }
.inline-form { display: inline; margin-left: .4rem; }
.qty-split { margin-top: .2rem; }
.dispatch-line .norest { display: block; margin-top: .3rem; }
/* Technician's return list: two clearly labelled boxes per part */
.return-legend { margin: .2rem 0 .6rem 1rem; padding: 0; }
.return-row { padding: .55rem 0; border-top: 1px solid var(--line-2); }
.return-boxes { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .35rem; }
.return-box { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; font-weight: 500; margin: 0; }
.return-box .qty-input { width: 6rem; }
.list-entry-row { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .5rem; }
.list-entry-row textarea { flex: 1; min-width: 0; }
.sign-preview { display: flex; gap: 1rem; align-items: center; margin: .5rem 0 1rem; }
.sign-preview img { max-height: 70px; max-width: 45%; background: #fff; border: 1px solid var(--line, #ddd); border-radius: 6px; padding: 4px; }

/* Field Service – technicians on the map (27/10/26) */
.tech-map { height: 62vh; min-height: 320px; border-radius: 10px; border: 1px solid var(--line); margin: .5rem 0; z-index: 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .5rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.dot-live { background: #16a34a; } .dot-today { background: #d97706; } .dot-old { background: #6b7280; }
.dot-none { background: transparent; border: 2px solid #9ca3af; }
