:root {
  --bg: #EEF2F1; --surface: #FFFFFF; --surface-2: #F3F7F7; --ink: #10262E; --muted: #4A626A; --line: #E2EAEB; --line-2: #B9CACD;
  --nav: #0F2A33; --nav-2: #1B4450; --nav-ink: #D6E4E6; --nav-muted: #8FB0B6; --aqua: #5FC4D8;
  --primary: #0B5C7A; --primary-ink: #FFFFFF; --primary-2: #08445B; --primary-soft: #E3F0F4;
  --accent: #C8781E; --accent-ink: #1A1206;
  --ok: #1F6E52; --ok-bg: #DDEFE7; --warn: #A24E0C; --warn-bg: #FBEBDD; --bad: #B3261E; --bad-bg: #F9E1DE;
  --radius: 12px; --display: 'Bricolage Grotesque', 'Noto Sans Ethiopic', 'Segoe UI', system-ui, sans-serif;
  --sans: 'IBM Plex Sans', 'Noto Sans Ethiopic', 'Segoe UI', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); } a:hover { color: var(--primary-2); }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.2; }
h1 { font-size: 28px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #5FC4D8; outline-offset: 2px; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.nav { width: 236px; flex-shrink: 0; background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; padding: 20px 14px; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand img { display: block; width: 200px; max-width: 100%; height: auto; }
.brand b { font-family: var(--display); font-size: 17px; color: #fff; display: block; }
.brand span { font-size: 12px; color: var(--nav-muted); }
.nav a { display: flex; align-items: center; justify-content: space-between; min-height: 42px; padding: 0 12px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; font-size: 14px; }
.nav a:hover { background: #163A45; color: #fff; }
.nav a.active { background: var(--nav-2); color: #fff; font-weight: 600; }
.nav .badge { background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.nav .spacer { flex-grow: 1; }
.nav .me { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 8px 0; margin-top: 8px; border-top: 1px solid #25505C; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--aqua); color: var(--nav); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.me .who { flex-grow: 1; min-width: 0; } .me .who b { display: block; color: #fff; font-size: 13px; font-weight: 500; } .me .who span { font-size: 12px; color: var(--nav-muted); }
.me .me-btns { display: flex; gap: 4px; width: 100%; }
.me button { background: none; border: 0; color: var(--nav-muted); cursor: pointer; font-size: 13px; padding: 8px; border-radius: 6px; }
.me button:hover { color: #fff; background: #163A45; }
.main { flex-grow: 1; min-width: 0; padding: 26px 32px 60px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.crumb { font-size: 13px; text-decoration: none; display: inline-block; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards & grids */
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.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)); } .g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .label { font-size: 13px; color: var(--muted); } .kpi .value { font-family: var(--mono); font-size: 25px; font-weight: 500; }
.kpi .value small { font-size: 13px; color: var(--muted); } .kpi .foot { font-size: 12px; color: var(--muted); }
.kpi .foot.ok { color: var(--ok); } .kpi .foot.warn { color: var(--warn); }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--primary); }
.stat-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; } .stat-row > span:first-child { color: var(--muted); }
.stat-row.total { font-weight: 600; font-size: 15px; border-top: 1px solid var(--line); padding-top: 8px; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); color: var(--ink); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; } .btn.primary:hover { background: var(--primary-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { color: var(--bad); border-color: #E4B5B0; } .btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; } .btn.block { width: 100%; } .btn.lg { min-height: 50px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: inherit; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 12px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.info { background: var(--primary-soft); color: var(--primary); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.fields { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fields.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea, .input { height: 42px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 12px; background: #fff; color: var(--ink); font-size: 15px; width: 100%; min-width: 0; }
.field textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.field input.num, .field .num { font-family: var(--mono); }
.field.flag input { border: 2px solid var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; cursor: pointer; color: var(--ink); }
.check input { width: 22px; height: 22px; accent-color: var(--primary); flex-shrink: 0; }
.check.wide { grid-column: 1 / -1; }
.check.done span { color: var(--muted); text-decoration: line-through; }
.search { display: flex; gap: 8px; flex-wrap: wrap; } .search .input { max-width: 320px; }
fieldset { border: 0; padding: 0; margin: 0; } legend { font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 8px; padding: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; } td.num { white-space: nowrap; }
tr.void td { color: var(--muted); text-decoration: line-through; }
.plus { color: var(--ok); } .minus { color: var(--bad); }
.empty { color: var(--muted); padding: 24px 8px; text-align: center; font-size: 14px; }

/* Lists */
.list-item { display: flex; gap: 14px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex-grow: 1; min-width: 0; } .list-item b { display: block; font-size: 14px; } .list-item .sub { font-size: 13px; color: var(--muted); }
.list-item .time { font-family: var(--mono); font-size: 13px; width: 50px; flex-shrink: 0; }

/* Pipeline & stages */
.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; list-style: none; margin: 0; padding: 0; }
.stage { padding: 11px 13px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 2px; }
.stage .s1 { font-size: 12px; color: var(--muted); } .stage .s2 { font-weight: 600; font-size: 14px; }
.stage.done { background: var(--ok-bg); border: 1px solid transparent; } .stage.done .s1 { color: var(--ok); }
.stage.now { background: var(--primary); border-color: var(--primary); color: #fff; } .stage.now .s1 { color: #CDE7EF; }
.pipe-sum { border-radius: 10px; background: var(--surface-2); padding: 14px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.pipe-sum:hover { background: var(--primary-soft); color: var(--ink); }
.pipe-sum .n { font-family: var(--mono); font-size: 24px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #E3EAEA; border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 200px; }
.col-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; padding: 2px 4px 6px; }
.tile { background: var(--surface); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.tile:hover { border-color: var(--line-2); color: var(--ink); }
.tile b { font-size: 14px; } .tile .sub { font-size: 12px; color: var(--muted); }

/* Feasibility panel */
.feas { background: var(--nav); color: #E6F0F1; border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 20px; }
.feas .score { font-family: var(--display); font-size: 68px; font-weight: 700; color: #fff; line-height: 1; }
.feas .bar { height: 10px; border-radius: 5px; background: #25505C; overflow: hidden; } .feas .bar i { display: block; height: 100%; background: var(--aqua); }
.feas .sep { border-top: 1px solid #25505C; padding-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.feas .lbl { color: var(--nav-muted); font-size: 13px; }
.feas .f-high { color: #FFB4A8; } .feas .f-med { color: #F5CB94; } .feas .f-info { color: #CFE3E6; }
.feas .ready { color: #9EE3C5; font-weight: 600; } .feas .notready { color: #F5CB94; font-weight: 600; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; }
.cal .dow { background: var(--surface-2); font-size: 12px; color: var(--muted); padding: 8px; text-align: center; }
.cal .day { background: var(--surface); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.cal .day.out { background: #F7FAFA; color: #9AB0B5; } .cal .day.today .dn { background: var(--primary); color: #fff; border-radius: 12px; padding: 0 7px; }
.cal .dn { font-size: 12px; font-weight: 600; align-self: flex-start; } .cal .et { font-size: 10px; color: var(--muted); float: right; }
.ev { font-size: 11px; line-height: 1.25; padding: 3px 5px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ev.survey { background: #EDE7F6; color: #4A2F7F; } .ev.installation { background: var(--primary-soft); color: var(--primary); }
.ev.sla { background: var(--ok-bg); color: var(--ok); } .ev.repair, .ev.emergency { background: var(--bad-bg); color: var(--bad); } .ev.other { background: var(--warn-bg); color: var(--warn); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; cursor: pointer; font-size: 14px; color: var(--muted); white-space: nowrap; text-decoration: none; }
.tabs .on { color: var(--ink); border-bottom-color: var(--primary); font-weight: 600; }

/* Modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(15, 42, 51, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; padding: 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 60px rgba(15, 42, 51, .3); }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(480px, calc(100% - 32px)); }
.toast { background: var(--nav); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.err { background: var(--bad); } .toast.ok { background: var(--ok); }
.banner { border-radius: 10px; padding: 12px 16px; font-size: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.warn { background: var(--warn-bg); color: #6B3408; } .banner.info { background: var(--primary-soft); color: var(--primary-2); } .banner.bad { background: var(--bad-bg); color: #7D1A14; }
.problems { margin: 0; padding-left: 20px; color: #7D1A14; font-size: 14px; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login .art { background: var(--nav); color: #E6F0F1; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login .art h1 { font-size: 40px; color: #fff; max-width: 440px; }
.login .art p { color: var(--nav-muted); max-width: 420px; }
.login .pane { display: grid; place-items: center; padding: 32px 16px; }
.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }

/* Field (technician) mode */
.field-head { background: var(--nav); color: #fff; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.field-head .sub { color: var(--nav-ink); font-size: 14px; }
.field-head .btn { background: var(--nav-2); border-color: var(--nav-2); color: #fff; flex: 1; }
.job-tile { background: var(--surface); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.job-tile:hover { color: var(--ink); outline: 2px solid var(--line-2); }

/* Message templates */
.msg { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 14px; white-space: pre-wrap; }
.contract-body { white-space: pre-wrap; font-family: var(--sans); font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 16px; max-height: 480px; overflow: auto; }

/* Print documents */
.doc { background: #fff; max-width: 800px; margin: 0 auto; padding: 40px; color: #000; font-size: 13px; }
.doc h1 { font-size: 22px; } .doc .rule { border-top: 1.5px solid #000; margin: 10px 0; }
.doc table td, .doc table th { border-bottom: 1px solid #ccc; padding: 7px 6px; color: #000; }
.doc .stamp { border: 1.5px solid #000; padding: 4px 10px; font-family: var(--mono); font-size: 12px; }
.doc pre { white-space: pre-wrap; font-family: var(--sans); font-size: 13px; line-height: 1.55; }
.print-bar { display: flex; gap: 8px; justify-content: center; padding: 16px; }

@media print {
  body { background: #fff; }
  .nav, .topbar, .print-bar, .no-print, #toast-root { display: none !important; }
  .main { padding: 0; } .doc { padding: 0; max-width: none; }
}

/* Responsive */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g6, .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-side { grid-template-columns: 1fr; } .feas { position: static; }
}
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .nav { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; width: 270px; }
  .nav.open { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 42, 51, .45); }
  .topbar { display: flex; align-items: center; gap: 8px; background: var(--nav); color: #fff; padding: 8px 12px; position: sticky; top: 0; z-index: 30; }
  .topbar b { font-family: var(--display); font-size: 16px; flex-grow: 1; }
  .main { padding: 16px 16px 60px; gap: 16px; }
  .g2, .g3 { grid-template-columns: 1fr; } .fields.two { grid-template-columns: 1fr; }
  h1 { font-size: 23px; }
  .login { grid-template-columns: 1fr; } .login .art { padding: 28px 20px; } .login .art h1 { font-size: 28px; }
  .cal .day { min-height: 64px; } .cal .ev { font-size: 0; height: 6px; padding: 0; }
  .hide-sm { display: none; }
}
@media (max-width: 520px) { .g4, .g6, .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi .value { font-size: 21px; } }

/* Dashboard charts */
.kpi.mini { padding: 12px 14px; gap: 2px; } .kpi.mini .value { font-size: 20px; }
.chart { position: relative; }
.chart-grid { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid .gl { border-top: 1px solid var(--line); height: 0; position: relative; }
.chart-grid .gl span { position: absolute; left: 0; top: -9px; font-size: 11px; color: var(--muted); background: var(--surface); padding-right: 4px; font-family: var(--mono); }
.chart-cols { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding-left: 40px; }
.bar-col { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; border-radius: 6px; outline-offset: 0; cursor: default; }
.bar-col:hover, .bar-col:focus-visible { background: rgba(18, 117, 168, .06); }
.bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; }
.bar { width: 40%; max-width: 26px; border-radius: 4px 4px 0 0; position: relative; }
.bar-lbl { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; font-family: var(--mono); color: var(--ink); font-weight: 500; padding-bottom: 2px; white-space: nowrap; }
.bar-col .tip { display: none; position: absolute; bottom: calc(100% - 30px); left: 50%; transform: translateX(-50%); background: var(--nav); color: #fff; font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; white-space: nowrap; z-index: 5; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.bar-col:hover .tip, .bar-col:focus-visible .tip { display: block; }
details summary { padding: 4px 0; }

/* ===== v1.1: phone & field improvements ===== */
:root { --tabbar-h: 0px; }
.nav-search { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; margin: 0 0 10px; padding: 0 12px; border-radius: 8px; border: 1px solid #25505C; background: #133540; color: var(--nav-ink); cursor: pointer; font-size: 14px; }
.nav-search span { display: inline-flex; align-items: center; gap: 8px; } .nav-search:hover { background: #163A45; color: #fff; }
kbd { font-family: var(--mono); font-size: 11px; color: var(--nav-muted); border: 1px solid #25505C; border-radius: 4px; padding: 1px 5px; }
.tabbar { display: none; }
.net:empty { display: none; }
.conflict-btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 2px 8px; font-size: 12px; font-weight: 600; cursor: pointer; }

/* Search */
.search-input { height: 48px; font-size: 16px; }
.search-results { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.search-hit { text-decoration: none; color: inherit; padding: 10px 8px; border-radius: 8px; }
.search-hit.sel, .search-hit:hover { background: var(--primary-soft); color: inherit; }
.search-hit .pill { min-width: 78px; justify-content: center; }

/* Filters, pager, bulk */
.field.inline { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; } .field.inline .input { width: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--primary-soft); border-radius: 10px; padding: 8px 12px; }
.bulk-bar[hidden] { display: none; }
.fu-item .fu-sel { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
td.sel input, th input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

/* Photos & signature */
.photo-kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { cursor: pointer; } .chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 6px 12px; border-radius: 16px; border: 1px solid var(--line-2); font-size: 13px; }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid #5FC4D8; outline-offset: 2px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.thumb { position: relative; padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { position: absolute; left: 4px; bottom: 4px; background: rgba(15, 42, 51, .75); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
.photo-add.busy { opacity: .6; pointer-events: none; }
.sig { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.sig-pad { width: 100%; height: 170px; border: 1.5px dashed var(--line-2); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; }
.sig-saved { display: flex; flex-direction: column; gap: 4px; } .sig-saved img { max-width: 320px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Technician: sticky progress + complete button */
.sticky-done { position: sticky; bottom: calc(var(--tabbar-h) + 8px); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--nav); color: #fff; border-radius: 14px; padding: 10px 10px 10px 16px; box-shadow: 0 8px 24px rgba(15, 42, 51, .3); }
.sticky-done .prog { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--nav-ink); } .sticky-done .prog b { color: #fff; font-family: var(--mono); }
.sticky-done .btn { min-height: 48px; }

/* Day route */
.route { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.route-stop { flex-direction: row; gap: 14px; }
.route-n { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-family: var(--mono); }
.route-stop .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.share-box h2 { font-size: 17px; }

/* Folding sections (dashboard on phones) */
details.fold { background: var(--surface); border-radius: var(--radius); }
details.fold > summary { list-style: none; cursor: pointer; padding: 16px 20px; font-family: var(--display); font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; align-items: center; min-height: 52px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '+'; font-family: var(--mono); font-size: 22px; color: var(--primary); }
details.fold[open] > summary::after { content: '−'; }
details.fold .fold-body { display: flex; flex-direction: column; gap: 16px; padding: 0 0 4px; }
details.fold .fold-body > .card, details.fold .fold-body > .grid > .card { padding-top: 4px; }

@media (max-width: 860px) {
  :root { --tabbar-h: calc(62px + env(safe-area-inset-bottom)); }
  .topbar { padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar .net { color: #F5CB94; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding-bottom: calc(var(--tabbar-h) + 28px); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--surface); border-top: 1px solid var(--line-2); padding: 4px 4px env(safe-area-inset-bottom); height: var(--tabbar-h); box-shadow: 0 -4px 16px rgba(15, 42, 51, .06); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; text-decoration: none; color: var(--muted); font-size: 11.5px; background: none; border: 0; cursor: pointer; position: relative; border-radius: 10px; }
  .tabbar a.active { color: var(--primary); font-weight: 600; } .tabbar a.active svg { stroke-width: 2.2; }
  .tabbar span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
  .tabbar .dot[hidden] { display: none; }
  #toast-root { bottom: calc(var(--tabbar-h) + 12px); }
  body[data-page="print"] .tabbar { display: none; }
  .check { min-height: 52px; padding: 4px 0; font-size: 15px; } .check input { width: 26px; height: 26px; }
  .field-head .btn { min-height: 46px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .search-modal { min-height: 70vh; }
  .page-head .actions .btn { min-height: 40px; }
  .search .input, .search select.input { max-width: none !important; flex: 1 1 140px; }
  .field.inline { flex: 1 1 140px; } .field.inline .input { flex: 1; min-width: 0; }
  .nav-search kbd { display: none; }
}
@media (min-width: 861px) { details.fold > summary { display: none; } }

/* Tables become cards on phones */
@media (max-width: 640px) {
  table.cardable, table.cardable tbody, table.cardable tr, table.cardable td { display: block; width: 100%; }
  table.cardable thead { display: none; }
  table.cardable tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  table.cardable tr.click:hover td { background: none; } table.cardable tr.click:active { background: var(--surface-2); }
  table.cardable td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: right; }
  table.cardable td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex-shrink: 0; font-family: var(--sans); }
  table.cardable td[data-label=""]::before { content: none; }
  table.cardable td:first-child { display: block; text-align: left; font-size: 15px; padding-top: 2px; }
  table.cardable td:first-child::before { content: none; }
  table.cardable td.sel { display: inline-block; width: auto; float: right; padding: 0; }
  table.cardable td.hide-sm { display: none; }
  table.cardable td.r { text-align: right; }
  table.cardable tr.void td { text-decoration: none; } table.cardable tr.void { opacity: .6; }
  .table-wrap { overflow: visible; margin: 0; }
}
@media print { .tabbar, .share-box, .sticky-done { display: none !important; } }
/* Dashboard follow-ups: message buttons sit under the text on narrow screens */
@media (max-width: 640px) {
  section[aria-label="Follow-ups"] .list-item { flex-wrap: wrap; }
  section[aria-label="Follow-ups"] .list-item > .actions { width: 100%; }
}
/* Job stages and the inspection score panel used inline widths that were wider than a phone */
@media (max-width: 1180px) { .grid.g-side { grid-template-columns: minmax(0, 1fr) !important; } }
@media (max-width: 640px) {
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .stage { padding: 8px 10px; min-width: 0; } .stage .s2 { font-size: 13px; overflow-wrap: anywhere; }
}
/* Language switch on the sign-in screen */
.lang-switch { display: inline-flex; align-self: center; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.lang-switch button { border: 0; background: var(--surface); padding: 9px 18px; font-size: 14px; cursor: pointer; color: var(--muted); }
.lang-switch button.on { background: var(--primary); color: #fff; font-weight: 600; }

/* App version (sidebar footer) and "new version available" bar */
.me .app-ver { width: 100%; margin-top: -6px; font-size: 11px; color: var(--nav-muted); padding: 0 8px 2px; opacity: .85; }
.upd-bar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: var(--nav); color: #fff; padding: 8px 10px 8px 16px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 14px; max-width: calc(100vw - 32px); }
.upd-bar[hidden] { display: none; }
@media (max-width: 820px) { .upd-bar { top: 64px; left: 16px; right: 16px; transform: none; max-width: none; justify-content: space-between; } }
@media print { .upd-bar { display: none !important; } }
.app-foot { text-align: center; margin: 24px 0 8px; }

/* Logo */
.login .art .login-logo { display: block; width: 260px; max-width: 70vw; height: auto; }
.topbar .top-logo { display: block; flex: none; }
.doc .doc-logo { display: block; width: 220px; height: auto; margin-bottom: 8px; }
