/* New Line Systems — Operations Suite */
:root {
  --accent: #a8432f;
  --accent-dark: #8a3524;
  --accent-soft: #f6e7e3;
  --bg: #f4f3f1;
  --card: #ffffff;
  --ink: #23201e;
  --muted: #7a7470;
  --line: #e4e1dd;
  --side: #ece4d6;            /* warm sand side menu / drawer */
  --side-2: #dbd4c7;
  --side-hover: #dbd4c7;
  --side-line: #cbc4b8;
  --side-ink: #1e293b;
  --side-strong: #0f172a;
  --side-muted: #475569;
  --side-ico: #475569;
  --top: #f2ecdf;             /* top bar + menu row */
  --top-line: #d0cbc0;
  --drop-hover: #f2ecdf;
  --accent-tint: #fbeae5;
  --green: #2f7d4f; --green-bg: #e5f3ea;
  --amber: #9a6a12; --amber-bg: #fbf0d9;
  --red: #b3321f;   --red-bg: #fbe4df;
  --gray: #5f5a56;  --gray-bg: #eeecea;
  --blue: #2c5d8a;  --blue-bg: #e3edf6;
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12.5px; white-space: nowrap; }
.muted { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar (light) ---------- */
.sidebar { width: 286px; flex: 0 0 286px; background: var(--side); color: var(--side-ink);
  border-right: 1px solid var(--side-line); box-shadow: 1px 0 6px rgba(15,23,42,.05);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 16px 18px; border-bottom: 1px solid var(--side-line); }
.brand-mark { min-width: 42px; height: 42px; padding: 0 8px; box-sizing: border-box; flex: 0 0 auto; border-radius: 7px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; letter-spacing: .6px; font-size: 16px; line-height: 1; white-space: nowrap; }
.brand-name { color: var(--side-strong); font-weight: 800; font-size: 16px; letter-spacing: 1px; white-space: nowrap; }
.brand-sub { color: var(--accent-dark); font-size: 13px; letter-spacing: 1.9px; margin-top: 2px; font-weight: 600; white-space: nowrap; }
.side-nav { padding: 10px 8px; flex: 1; }
.side-link, .side-head { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 8px;
  border: 0; background: none; color: var(--side-ink); border-radius: 6px; cursor: pointer; text-decoration: none; border-left: 3px solid transparent; }
.side-link:hover, .side-head:hover { background: var(--side-hover); color: var(--side-strong); }
.side-link .ico, .side-head .ico { width: 16px; flex: 0 0 16px; text-align: center; color: var(--side-ico); }
.side-link:hover .ico, .side-head:hover .ico { color: var(--accent-dark); }
.side-link .lbl, .side-head .lbl { flex: 1; min-width: 0; line-height: 1.3; }
.side-top, .side-group.depth-0 > .side-head { font-weight: 600; margin-top: 2px; font-size: 13px; }
.side-head .caret { font-size: 10px; color: var(--side-muted); transition: transform .15s ease; }
.side-group.open > .side-head .caret { transform: rotate(90deg); }
.side-group.open > .side-head, .side-group.has-active > .side-head { color: var(--side-strong); }
.side-group.has-active > .side-head .ico, .side-link.active .ico { color: var(--accent); }
.side-sub { display: none; }
.side-group.open > .side-sub { display: block; }
.side-group.depth-0 > .side-sub { margin: 2px 0 6px 16px; padding-left: 8px; border-left: 1px solid var(--side-line); }
.side-sub .side-link, .side-sub .side-head { padding: 6px 8px; font-size: 13px; }
.side-group.depth-1 > .side-head { font-weight: 600; color: var(--side-muted); font-size: 12px; letter-spacing: .2px; }
.side-group.depth-1 > .side-sub { margin: 0 0 4px 8px; padding-left: 8px; border-left: 1px dashed #b8b2a7; }
.side-link.active { background: #fff; color: var(--accent-dark); border-left-color: var(--accent); font-weight: 700; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.side-link.active:hover { background: #fff; color: var(--accent-dark); }
.side-link:focus-visible, .side-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.side-foot { padding: 12px 16px; font-size: 11px; color: var(--side-muted); border-top: 1px solid var(--side-line); }

/* ---------- Main / header ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 44px; background: var(--top); border-bottom: 1px solid var(--top-line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; }
.crumbs { color: #334155; font-size: 13px; }
.crumbs b { color: var(--ink); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.today { font-size: 12.5px; color: #1e293b; }

/* ---------- Top menu bar (click-to-open dropdowns) ---------- */
.top-nav { background: var(--top); border-bottom: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(15,23,42,.05); display: flex; flex-wrap: wrap; align-items: stretch;
  padding: 0 4px; gap: 0; position: sticky; top: 0; z-index: 30; }
.tm-group { position: relative; }
.tm-btn { height: 36px; padding: 0 8px; border: 0; background: none; cursor: pointer; font-weight: 600; color: #1e293b; font-size: 12.5px;
  display: flex; align-items: center; gap: 4px; border-radius: 0; text-decoration: none; white-space: nowrap; }
.tm-btn .caret { font-size: 9px; opacity: .75; transition: transform .15s ease; }
.tm-btn:hover, .tm-group.open > .tm-btn { background: var(--side-hover); color: var(--accent-dark); }
.tm-group.open > .tm-btn .caret { transform: rotate(180deg); }
.tm-group.active > .tm-btn, .tm-direct.active { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.tm-drop { display: none; position: absolute; top: 100%; left: 0; min-width: 230px; max-width: 300px; background: #fff; border: 1px solid var(--line);
  border-top: 2px solid var(--accent); box-shadow: 0 10px 24px rgba(0,0,0,.12); border-radius: 0 0 8px 8px; padding: 6px; z-index: 40;
  max-height: calc(100vh - 110px); overflow-y: auto; }
.tm-drop.align-right { left: auto; right: 0; }
.tm-group.open > .tm-drop { display: block; }
.tm-link { display: block; width: 100%; padding: 7px 10px; border: 0; background: none; text-align: left; font-size: 13.5px;
  cursor: pointer; border-radius: 6px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.tm-link:hover { background: var(--drop-hover); }
.tm-link.active { background: var(--accent-tint); color: var(--accent-dark); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.tm-sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none;
  text-align: left; cursor: pointer; border-radius: 6px; font-weight: 600; color: var(--ink); font-size: 13.5px; }
.tm-sub-head:hover { background: var(--drop-hover); }
.tm-sub-head .caret { font-size: 10px; opacity: .6; transition: transform .15s ease; }
.tm-subgroup.open > .tm-sub-head .caret { transform: rotate(90deg); }
.tm-subgroup.active > .tm-sub-head { color: var(--accent); }
.tm-sub { display: none; margin: 2px 0 4px 12px; padding-left: 6px; border-left: 2px solid var(--accent-soft); }
.tm-subgroup.open > .tm-sub { display: block; }
.tm-sub .tm-link { font-size: 13px; padding: 6px 10px; }
.tm-icon { width: 34px; height: 36px; flex: 0 0 34px; display: grid; place-items: center; color: #475569; text-decoration: none; font-size: 17px; }
.tm-icon:hover { background: var(--accent-soft); color: var(--accent-dark); }
.tm-icon.active { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }

/* page title: "Heading › Item" */
.page-head h1 .h1-group { color: var(--muted); font-weight: 500; font-size: 15px; letter-spacing: 0; margin-right: 2px; }

/* filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: #4b4541; text-decoration: none; font-size: 12.5px; font-weight: 600; }
.chip:hover { border-color: #cfcac5; background: var(--bg); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.card.is-focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168,67,47,.12); }
.card.is-focus .card-head { background: var(--accent-soft); }
.card:focus { outline: none; }
.kpis.four { grid-template-columns: repeat(4, 1fr); }
.tag.skill { font-weight: 600; margin: 1px 0; }
.tag-list { white-space: normal; display: flex; flex-wrap: wrap; gap: 4px; }
.tag-list:not(:first-child) { margin-top: 4px; }
.small { font-size: 13px; }
.settings-form .modal-body { padding: 16px; }
.settings-form .modal-foot { border-radius: 0; }

/* ---------- Content ---------- */
.content { padding: 22px 24px 40px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.2px; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; }

.btn { background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 6px; padding: 8px 14px;
  cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); border-color: #cfcac5; color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.icon-btn { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); gap: 12px; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-body { padding: 14px 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; border-top: 3px solid var(--accent); cursor: default; }
.kpi[data-nav] { cursor: pointer; }
.kpi[data-nav]:hover { box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.kpi-value.money { font-size: 19px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  background: #faf9f8; padding: 9px 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
table.data td { padding: 9px 12px; border-bottom: 1px solid #efedea; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fcfbfa; }
table.data th.num { text-align: right; }
td.actions, table.data td:first-child, table.data td:last-child { white-space: nowrap; }
.empty { padding: 18px 16px; color: var(--muted); font-style: italic; }

/* status select + tags */
select.st { border: 1px solid transparent; border-radius: 999px; padding: 3px 24px 3px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.tone-green { color: var(--green); background-color: var(--green-bg); }
.tone-amber { color: var(--amber); background-color: var(--amber-bg); }
.tone-red { color: var(--red); background-color: var(--red-bg); }
.tone-gray { color: var(--gray); background-color: var(--gray-bg); }
.tone-blue { color: var(--blue); background-color: var(--blue-bg); }
.tag { display: inline-block; border-radius: 4px; padding: 2px 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.tag-urgent { background: var(--red); color: #fff; margin-left: 6px; }

/* AMC cards */
.amc-card .card-head { align-items: flex-start; }
.amc-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.amc-meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.amc-meta b { color: var(--ink); }
.amc-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.building { border-top: 1px solid var(--line); }
.building:first-child { border-top: 0; }
.building-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: #fbfaf9; }
.building-head h3 { margin: 0; font-size: 13.5px; }

/* Schedule board */
.day-label { display: flex; align-items: baseline; gap: 10px; }
.day-label .rel { font-weight: 700; }
.day-label .date { color: var(--muted); font-size: 13px; font-weight: 500; }
.card.is-today { border-color: var(--accent); }
.card.is-today .card-head { background: var(--accent-soft); }
.note { background: #fff8ec; border: 1px solid #f0dfbd; color: #6b5016; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(25,20,18,.45); display: flex; align-items: flex-start; justify-content: center;
  padding: 50px 16px; z-index: 100; overflow-y: auto; }
.modal-backdrop[hidden], .print-overlay[hidden], .toast[hidden] { display: none; }
.modal { background: #fff; width: 100%; max-width: 640px; border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide, .form-note { grid-column: 1 / -1; }
.field-label { font-size: 12px; font-weight: 600; color: #4b4541; }
.field-label em { color: var(--accent); font-style: normal; }
.field input, .field select, .field textarea, .lines input { border: 1px solid #d8d3ce; border-radius: 6px; padding: 7px 9px; background: #fff; width: 100%; }
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .lines input:focus { outline: 2px solid rgba(168,67,47,.25); border-color: var(--accent); }
.form-note { margin: 0; font-size: 12.5px; color: #6b5016; background: #fff8ec; border: 1px solid #f0dfbd; padding: 8px 10px; border-radius: 6px; }
.lines-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.lines-table th { font-size: 11px; text-transform: uppercase; color: var(--muted); text-align: left; padding: 4px; letter-spacing: .5px; }
.lines-table th.num { text-align: right; }
.lines-table td { padding: 3px 4px; }
.lines-table td.l-total { text-align: right; white-space: nowrap; font-size: 13px; min-width: 110px; }
.lines-table .l-qty { width: 70px; text-align: right; }
.lines-table .l-price { width: 120px; text-align: right; }
.rm-line { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.rm-line:hover { color: var(--red); }
.lines-totals { margin-left: auto; width: 280px; font-size: 13px; }
.lines-totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.lines-totals .grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-weight: 700; font-size: 14px; }
/* client contacts (form) */
.contacts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.contact-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fcfbfa; }
.contact-row.is-primary { border-left: 3px solid var(--accent); }
.contact-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.contact-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #4b4541; }
.contact-btns { display: flex; align-items: center; gap: 6px; }
.contact-btns [hidden] { display: none; }
.rm-contact { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.rm-contact:hover { color: var(--red); }
.contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.contact-grid label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.contact-grid label span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.contact-grid input { border: 1px solid #d8d3ce; border-radius: 6px; padding: 7px 9px; background: #fff; width: 100%; min-width: 0; }
.contact-grid input:focus { outline: 2px solid rgba(168,67,47,.25); border-color: var(--accent); }
/* client contacts (tables / print) */
.cc { min-width: 0; }
.nowrap { white-space: nowrap; }
.small-2 { font-size: 12px; margin-top: 2px; }
a.tel, a.mail, a.web { color: var(--accent); text-decoration: none; }
a.tel { white-space: nowrap; }
a.mail, a.web { overflow-wrap: break-word; }
a.tel:hover, a.mail:hover, a.web:hover { text-decoration: underline; }
.doc-box p.doc-attn { font-size: 12px; color: #444; }
.print-doc a.tel, .print-doc a.mail { color: inherit; }
.modal-error { margin: 0 18px 10px; background: var(--red-bg); color: var(--red); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: #faf9f8; border-radius: 0 0 10px 10px; }

.toast { position: fixed; bottom: 22px; right: 22px; background: #1e293b; color: #fff; padding: 10px 16px; border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.2); z-index: 200; font-size: 13px; border-left: 4px solid var(--accent); }

/* ---------- Print overlay ---------- */
.print-overlay { position: fixed; inset: 0; background: #e9e7e4; z-index: 150; overflow-y: auto; }
.print-toolbar { position: sticky; top: 0; background: #1e293b; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; }
.print-toolbar .btn-ghost { background: transparent; color: #fff; border-color: #5a524c; }
.print-doc { background: #fff; max-width: 820px; margin: 24px auto; padding: 40px 48px; box-shadow: 0 6px 24px rgba(0,0,0,.12); color: #1d1b1a; font-size: 13px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--accent); padding-bottom: 14px; margin-bottom: 18px; }
.doc-brand { font-size: 22px; font-weight: 800; letter-spacing: 1.5px; color: var(--accent); text-transform: uppercase; }
.doc-brand-sub { font-size: 11.5px; color: #555; margin-top: 3px; line-height: 1.5; }
.doc-type { text-align: right; }
.doc-type h2 { margin: 0; font-size: 20px; letter-spacing: 1px; text-transform: uppercase; }
.doc-type div { color: #555; margin-top: 4px; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 18px; }
.doc-box h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); }
.doc-box p { margin: 2px 0; }
table.doc-lines { width: 100%; border-collapse: collapse; margin: 10px 0 14px; }
table.doc-lines th { background: #2a2623; color: #fff; text-align: left; padding: 7px 9px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
table.doc-lines td { padding: 7px 9px; border-bottom: 1px solid #e5e2de; vertical-align: top; }
table.doc-lines th.num, table.doc-lines td.num { text-align: right; }
.doc-totals { margin-left: auto; width: 300px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #eee; }
.doc-totals .grand { font-weight: 800; font-size: 15px; border-bottom: 2px solid var(--accent); }
.doc-section-title { font-size: 13px; font-weight: 700; margin: 18px 0 4px; color: var(--accent); text-transform: uppercase; letter-spacing: .8px; }
.doc-foot { margin-top: 28px; font-size: 11.5px; color: #666; border-top: 1px solid #ddd; padding-top: 10px; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; }
.doc-sign div { border-top: 1px solid #999; padding-top: 6px; font-size: 12px; color: #555; }
.doc-warn { background: #fdecea; color: #8a2a1b; border: 1px solid #f0b8ad; border-radius: 6px; padding: 8px 12px; margin-bottom: 14px; font-size: 12.5px; }

@media print {
  body { background: #fff; }
  body > *:not(#print-overlay) { display: none !important; }
  .print-overlay { position: static; background: #fff; overflow: visible; }
  .print-toolbar, .no-print { display: none !important; }
  .print-doc { box-shadow: none; margin: 0; max-width: none; padding: 0; }
  table.doc-lines th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}


/* =====================================================================
 * MOBILE / TABLET  (desktop ≥1025px is unaffected)
 * All rules are screen-only so printing is never affected.
 * ===================================================================== */
.m-header, .drawer-close, .drawer-overlay { display: none; }

@media screen and (max-width: 1024px) {
  /* compact sticky header replaces sidebar + top menu bar */
  .m-header { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 60; height: 52px;
    padding: 0 12px 0 4px; padding-left: max(4px, env(safe-area-inset-left)); background: var(--top); color: var(--side-strong);
    border-bottom: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(15,23,42,.06); }
  .m-header .brand-mark { min-width: 38px; height: 36px; padding: 0 6px; font-size: 14px; }
  .m-title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .hamburger { width: 44px; height: 44px; flex: 0 0 44px; border: 0; background: none; cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 5px; border-radius: 8px; }
  .hamburger span { display: block; width: 22px; height: 2px; background: var(--side-strong); border-radius: 2px; }
  .hamburger:active, .hamburger:focus-visible { background: var(--side-hover); }
  .top-nav { display: none; }

  /* the sidebar becomes a slide-in drawer (same MENU tree) */
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: 100%; width: min(86vw, 320px); flex: none; z-index: 90;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(15,23,42,.25);
    padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain; visibility: hidden; }
  body.drawer-open .sidebar { transform: none; visibility: visible; }
  body.drawer-open { overflow: hidden; }
  .drawer-overlay { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 80; }
  .drawer-overlay[hidden] { display: none; }
  .drawer-close { display: grid; place-items: center; margin-left: auto; width: 44px; height: 44px; flex: 0 0 44px; border: 0; background: none;
    color: var(--side-muted); font-size: 28px; line-height: 1; cursor: pointer; border-radius: 8px; }
  .drawer-close:hover { background: var(--side-hover); color: var(--side-strong); }
  .brand { padding: 8px 8px 8px 16px; }
  .side-link, .side-head { min-height: 44px; }
  .side-sub .side-link, .side-sub .side-head { min-height: 44px; font-size: 14px; }
  .side-top, .side-group.depth-0 > .side-head { font-size: 15px; }

  .main { width: 100%; }
  .card { overflow-x: auto; }   /* wide tables scroll inside their card on tablets */
  .topbar { height: auto; min-height: 36px; padding: 6px 14px; gap: 8px; }
  .crumbs { font-size: 12px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content { padding: 16px 16px 40px; }
  .kpis, .kpis.four { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 36px; padding: 6px 12px; }
  select.st { min-height: 34px; }
}

@media screen and (max-width: 640px) {
  body { -webkit-text-size-adjust: 100%; }
  .today { display: none; }
  .content { padding: 0 12px 32px; }
  /* page header stays reachable: sticks under the compact header */
  .page-head { position: sticky; top: 52px; z-index: 20; background: var(--bg); margin: 0 -12px 12px; padding: 10px 12px;
    align-items: center; border-bottom: 1px solid var(--line); }
  .page-head h1 { font-size: 18px; }
  .page-head h1 .h1-group, .page-sub { display: none; }
  .page-actions .btn { padding: 9px 14px; min-height: 44px; }

  .kpis, .kpis.four, .kpis.three { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 10px 12px; min-width: 0; }
  .kpi-label { font-size: 11px; }
  .kpi-value { font-size: 20px; }
  .kpi-value.money { font-size: 15px; word-break: break-word; }

  /* filter chips scroll sideways instead of wrapping */
  .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px 12px; padding: 0 12px 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; padding: 10px 14px; min-height: 40px; display: inline-flex; align-items: center; }

  .card-head { flex-wrap: wrap; padding: 10px 12px; }
  .card-head h2 { font-size: 14.5px; }
  .note { font-size: 12.5px; }

  /* tables -> stacked cards (label: value) */
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tr { padding: 8px 12px; border-bottom: 1px solid var(--line); }
  table.data tr:last-child { border-bottom: 0; }
  table.data td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right;
    white-space: normal; min-height: 30px; overflow-wrap: anywhere; }
  table.data td::before { content: attr(data-label); flex: 0 0 38%; max-width: 38%; text-align: left; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
  table.data td:not([data-label])::before, table.data td[data-label=""]::before { display: none; }
  table.data td > * { max-width: 100%; }
  table.data td:last-child { white-space: normal; }
  table.data td .tag-list { justify-content: flex-end; }
  table.data .num { white-space: nowrap; }
  table.data tbody tr:hover td { background: none; }
  table.data td .btn + .btn { margin-left: 6px; }
  .mono { white-space: normal; overflow-wrap: anywhere; }

  .amc-card .card-head { flex-direction: column; align-items: stretch; }
  .amc-actions { justify-content: flex-start; }
  .building-head { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .day-label { flex-wrap: wrap; gap: 2px 10px; }

  /* modals: full screen, single column, sticky footer, 16px inputs (no iOS zoom) */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal, .modal.wide { max-width: none; min-height: 100%; border-radius: 0; display: flex; flex-direction: column; }
  .modal-head { position: sticky; top: 0; background: #fff; z-index: 2; padding: 6px 8px 6px 16px; }
  .modal-head .icon-btn { width: 44px; height: 44px; }
  #modal-form { flex: 1; display: flex; flex-direction: column; }
  .modal-body { grid-template-columns: 1fr; padding: 14px 16px; flex: 1; align-content: start; }
  .modal-foot { position: sticky; bottom: 0; border-radius: 0; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); z-index: 2; }
  .modal-foot .btn { flex: 1; min-height: 46px; }
  .field input, .field select, .field textarea, .lines input { font-size: 16px; min-height: 44px; }
  .settings-form .modal-foot { position: static; }

  /* line items: each line becomes a small grid */
  .lines-table thead { display: none; }
  .lines-table, .lines-table tbody { display: block; }
  .lines-table tr { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 6px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
  .lines[data-price="1"] .lines-table tr { grid-template-columns: 80px 1fr 44px; }
  .lines-table td { padding: 0; }
  .lines-table td:first-child { grid-column: 1 / -1; }
  .lines-table td:nth-child(2), .lines[data-price="1"] .lines-table td:nth-child(3) { display: flex; flex-direction: column; gap: 2px; grid-row: 2; }
  .lines-table td:nth-child(2)::before { content: 'Qty'; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
  .lines[data-price="1"] .lines-table td:nth-child(3)::before { content: 'Unit price'; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
  .lines-table td:last-child { grid-column: -2; grid-row: 2; align-self: end; }
  .lines-table .l-qty, .lines-table .l-price { width: 100%; }
  .lines-table td.l-total { grid-column: 1 / -1; grid-row: 3; text-align: right; min-width: 0; color: var(--muted); }
  .lines-table td.l-total::before { content: 'Line total: '; }
  .rm-line { width: 44px; height: 44px; font-size: 22px; }
  .lines-totals { width: 100%; }
  .add-line { min-height: 40px; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-grid input { font-size: 16px; min-height: 44px; }
  .rm-contact { width: 44px; height: 44px; font-size: 22px; }
  .add-contact, .make-primary { min-height: 40px; }
  table.data td .cc { text-align: right; }

  /* print preview readable on a phone */
  .print-toolbar { padding: 8px 12px; gap: 8px; }
  .print-toolbar #print-title { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .print-toolbar .btn { min-height: 40px; }
  .print-doc { margin: 0; padding: 18px 14px; font-size: 12.5px; box-shadow: none; }
  .doc-head { flex-direction: column; gap: 10px; }
  .doc-type { text-align: left; }
  .doc-brand { font-size: 18px; }
  .doc-parties, .doc-sign { grid-template-columns: 1fr; gap: 12px; }
  .doc-sign { margin-top: 28px; }
  .doc-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.doc-lines { min-width: 520px; font-size: 12px; }
  .doc-totals { width: 100%; }
}

@media screen and (max-width: 359px) {
  .kpis, .kpis.four, .kpis.three { grid-template-columns: 1fr; }
}

/* Projects: cancel / delete */
.btn-danger { background: #fff; color: var(--red); border-color: #e7b9b4; }
.btn-danger:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }
tr.row-cancelled td { color: var(--muted); }
tr.row-cancelled td b { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.25); }
.cancel-info { white-space: normal; max-width: 240px; }
.cancel-reason { margin-top: 3px; }
tr.row-highlight td { background: #eef8ef; }
tr.row-highlight td:first-child { box-shadow: inset 3px 0 0 var(--green, #2e7d32); }

/* Project detail: PO & payment terms */
.card-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 18px; padding: 14px 16px; }
.fact { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fact-k { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.fact-v { font-size: 13.5px; }
.po-card .card-head h2 .tag { vertical-align: middle; margin-left: 6px; }
.po-file { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fbfaf8; flex-wrap: wrap; }
.po-icon { background: var(--red); color: #fff; font-weight: 800; font-size: 11px; border-radius: 4px; padding: 8px 6px; letter-spacing: .5px; }
.po-meta { flex: 1 1 180px; min-width: 0; word-break: break-word; }
.po-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.po-warn { color: var(--red); font-weight: 600; }
.po-note { margin-right: auto; }
.po-card .modal-foot { align-items: center; gap: 10px; }
.terms-top { grid-template-columns: repeat(4, 1fr); }
.terms-card table.data td { vertical-align: middle; }
.terms-card input { border: 1px solid #d8d3ce; border-radius: 6px; padding: 6px 8px; background: #fff; width: 100%; font: inherit; }
.terms-card input[readonly] { background: #f3f1ee; color: var(--muted); }
.terms-card .t-pct { width: 80px; text-align: right; }
.terms-card .t-notes { min-width: 160px; }
.t-stage { display: flex; align-items: center; gap: 6px; min-width: 190px; }
.t-stage .t-label { min-width: 150px; }
.terms-card td.num, .terms-card .t-amt { white-space: nowrap; }
.terms-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.terms-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.terms-total { font-weight: 700; font-size: 13.5px; padding: 4px 10px; border-radius: 6px; }
.terms-total.ok { color: var(--green); background: var(--green-bg); }
.terms-total.bad { color: var(--red); background: var(--red-bg); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.pay-sum { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pay-sum.done { color: var(--green); }
.doc-stage { margin: 8px 0 0; padding: 8px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
@media (max-width: 1100px) { .facts { grid-template-columns: repeat(2, 1fr); } .terms-top { grid-template-columns: 1fr 1fr; } }
@media screen and (max-width: 640px) {
  .facts, .terms-top { grid-template-columns: 1fr; }
  .terms-card .t-pct, .terms-card .t-notes, .t-stage .t-label { width: 100%; min-width: 0; }
  .t-stage { min-width: 0; width: 100%; }
  .terms-foot { flex-direction: column; align-items: stretch; }
}

/* PO acknowledgement gate */
.btn-ack { background: var(--accent); }
tr.row-awaiting td:first-child { box-shadow: inset 3px 0 0 #d48a1c; }
.row-acts { display: flex; flex-wrap: wrap; gap: 6px; max-width: 250px; }
table.data td .row-acts .btn + .btn { margin-left: 0; }
.ack-badge { margin-bottom: 3px; }
.ack-gate p { margin: 0 0 10px; }
.lock-note { margin: 12px 16px 0; }
select[disabled], .btn[disabled] { opacity: .55; cursor: not-allowed; }
@media screen and (max-width: 640px) { .row-acts { max-width: none; justify-content: flex-end; } }
.po-card .modal-body { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .po-card .modal-body { grid-template-columns: 1fr 1fr; } }
@media screen and (max-width: 640px) { .po-card .modal-body { grid-template-columns: 1fr; } }
/* Manage Projects table: keep all columns reachable on laptop widths */
.projects-card { overflow-x: auto; }
.projects-card:not(.proj-list-v19) table.data td { padding: 9px 10px; }
.projects-card:not(.proj-list-v19) table.data td:nth-child(2) { min-width: 200px; }
.proj-client { color: #4b4541; margin-top: 3px; }
.projects-card .row-acts { display: grid; grid-template-columns: repeat(2, max-content); gap: 6px; max-width: none; }
@media screen and (max-width: 640px) { .projects-card .row-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; } }

/* ---------- Invoice requests ---------- */
.ir-calc { border: 1px solid var(--line, #e3e6ea); border-radius: 10px; padding: 10px 14px; background: #f8fafc; }
.ir-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13.5px; }
.ir-row.sep { border-top: 1px dashed #cfd6de; margin-top: 6px; padding-top: 8px; }
.ir-row.grand { font-size: 15px; }
.ir-row.bad span:last-child { color: #b42318; }
.ir-warn { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: #fef3f2; color: #b42318; font-size: 13px; font-weight: 600; }
.ir-badges { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.ir-card { border-left: 4px solid #f5a623; }
.ir-popup { max-height: 55vh; overflow: auto; }
.ir-popup table { width: 100%; }
.stage-inv { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.nav-badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px;
  background: #f5a623; color: #1b1b1b; font-size: 11px; font-weight: 700; text-align: center; vertical-align: middle; }
.inv-ack { margin-top: 3px; }
.ir-popup th, .ir-popup td { padding: 8px 7px; font-size: 13px; }
.ir-popup td:first-child, .ir-popup th:first-child { padding-left: 4px; }
.ir-popup .btn { padding: 6px 10px; font-size: 12.5px; white-space: nowrap; }
.ir-popup .num { white-space: nowrap; }

/* ---------- Work progress & financials ---------- */
.prog { display: flex; align-items: center; gap: 8px; min-width: 110px; margin-top: 6px; }
.prog-track { position: relative; display: block; flex: 1; height: 8px; border-radius: 4px; background: #e8ebef; overflow: visible; }
.prog-fill { display: block; height: 100%; border-radius: 4px; background: #2e9d5b; }
.prog-over .prog-fill { background: #d97706; }
.prog-inv { position: absolute; top: -3px; width: 2px; height: 14px; background: #b42318; margin-left: -1px; }
.prog-pct { font-size: 12px; font-weight: 700; min-width: 34px; text-align: right; }
.prog-big .prog-track { height: 14px; border-radius: 7px; }
.prog-big .prog-inv { top: -3px; height: 20px; }
.prog-big .prog-pct { font-size: 15px; min-width: 44px; }
.prog-btn { display: block; width: 100%; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.prog-btn:disabled { cursor: not-allowed; opacity: .55; }
.prog-btn:hover:not(:disabled) .prog-track { box-shadow: 0 0 0 2px rgba(46,157,91,.25); }
.over-billed { margin-top: 4px; }
.fin-mini { margin-top: 3px; line-height: 1.45; color: #475467; max-width: 170px; }
.fin-mini .nowrap { display: block; }
.fin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fin-cell { border: 1px solid #e3e6ea; border-radius: 10px; padding: 10px 12px; background: #fafbfc; }
.fin-cell.good { border-color: #b7e0c4; background: #f3fbf6; }
.fin-cell.warn { border-color: #f6d69a; background: #fffaf0; }
.fin-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #667085; }
.fin-v { font-size: 18px; font-weight: 700; margin: 3px 0 2px; }
.fin-s { font-size: 12px; color: #667085; line-height: 1.4; }
.fin-prog { margin-top: 14px; }
.fin-prog-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prog-log { margin-top: 10px; }
.prog-log summary { cursor: pointer; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.prog-range { width: 100%; accent-color: #2e9d5b; }
.report-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; }
.report-card .total-row td { background: #f4f6f8; border-top: 2px solid #cfd6de; }
.report-card .row-over td:first-child { box-shadow: inset 3px 0 0 #d97706; }
@media (max-width: 1100px) { .fin-grid { grid-template-columns: repeat(2, 1fr); } }
@media screen and (max-width: 600px) { .fin-grid { grid-template-columns: 1fr; } }
@media print {
  body.print-report > .app { display: block !important; }
  body.print-report .sidebar, body.print-report .topbar, body.print-report .top-nav, body.print-report .m-header,
  body.print-report .page-actions, body.print-report .no-print, body.print-report .drawer-overlay { display: none !important; }
  body.print-report .main, body.print-report .content { margin: 0 !important; padding: 0 !important; }
  body.print-report .card { box-shadow: none; border: 1px solid #ccc; }
  body.print-report table.data th, body.print-report table.data td { font-size: 10.5px; padding: 5px 6px; }
  body.print-report .prog-fill, body.print-report .total-row td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media screen and (min-width: 1025px) {
  .report-card table.data th, .report-card table.data td { padding: 8px 6px; font-size: 12.5px; }
  .report-card table.data th { font-size: 10.5px; white-space: normal; }
  .report-card table.data td:nth-child(2) { max-width: 190px; }
  .report-card .rep-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
  .report-card .prog { min-width: 90px; }
  .report-card .num { white-space: nowrap; }
}
@media screen and (min-width: 1025px) {
  .projects-card:not(.proj-list-v19) table.data td { padding: 9px 7px; }
  .projects-card:not(.proj-list-v19) table.data td:nth-child(2) { min-width: 170px; }
  .projects-card .row-acts .btn { padding: 5px 9px; font-size: 12px; }
  .projects-card .prog { min-width: 96px; }
}

/* ---------- Sign-in ---------- */
body.logged-out .app { display: none !important; }
.login-screen { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 20% 15%, #ffffff 0, #f6f1e7 55%, #ece4d6 100%); }
.login-screen[hidden] { display: none; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--side-line); border-radius: 16px; padding: 28px 28px 22px; box-shadow: 0 12px 40px rgba(15,23,42,.12); display: flex; flex-direction: column; gap: 12px; }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand .brand-mark { min-width: 48px; height: 48px; font-size: 18px; }
.login-brand .brand-name { color: var(--side-strong); }
.login-brand .brand-sub { color: var(--accent-dark); }
.login-title { margin: 6px 0 0; font-size: 20px; }
.login-card .field { display: flex; flex-direction: column; gap: 4px; }
.login-card input[name="username"], .login-card input[name="password"] { padding: 10px 12px; font-size: 15px; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475467; }
.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.login-note { margin: 0; font-size: 12px; color: #667085; text-align: center; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-right: 4px; }
.user-chip:empty { display: none; }
.user-chip .uc-role { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 9px; background: #f2e6e3; color: #a8432f; }
@media screen and (max-width: 1024px) { .user-chip .uc-name { display: none; } }
@media print { .login-screen { display: none !important; } }
.topbar { gap: 12px; }
.topbar .crumbs { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { gap: 8px; flex: 0 0 auto; }
.topbar .today, .user-chip { white-space: nowrap; }

/* ---------- Advance recovery ---------- */
.ir-row.adv span:last-child { color: #b42318; }
.fin-grid { grid-template-columns: repeat(5, 1fr); }
.fin-cell.adv { border-style: dashed; }
.fin-v { font-size: 17px; }
.fm-adv { color: #9a3412; }
.adv-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.adv-l { white-space: nowrap; font-size: 12px; }
.adv-k { font-size: 10px; font-weight: 700; color: #667085; text-transform: uppercase; }
.doc-totals .doc-adv span:last-child { color: #b42318; }
@media (max-width: 1100px) { .fin-grid { grid-template-columns: repeat(2, 1fr); } }
@media screen and (max-width: 600px) { .fin-grid { grid-template-columns: 1fr; } .adv-stack { align-items: flex-start; } }
@media screen and (min-width: 1025px) {
  .report-card table.data th, .report-card table.data td { padding: 7px 5px; font-size: 12px; }
  .report-card table.data th { font-size: 9.5px; letter-spacing: .3px; }
  .report-card table.data td:nth-child(2), .report-card .rep-name { max-width: 150px; }
  .report-card .prog { min-width: 78px; gap: 5px; }
  .report-card .prog-pct { min-width: 28px; font-size: 11.5px; }
  .report-card .rep-sub { white-space: normal; font-size: 10.5px; line-height: 1.25; max-width: 90px; margin-left: auto; }
  .report-card td:nth-child(10) .muted { font-size: 10.5px; white-space: nowrap; }
  .report-card .adv-l { font-size: 11px; }
  .report-card .tag { font-size: 10.5px; padding: 2px 6px; }
}
/* Payment terms: advance section separate from the 100% work value stages */
.terms-card tr.t-sec td { background: #f6f3ef; padding: 7px 10px; border-top: 2px solid var(--line); }
.terms-card tr.t-sec-adv td { background: #fff7e8; }
.terms-card tr.t-sec td::before { display: none !important; }
.t-adv-hint { margin-top: 2px; font-weight: 400; }
.doc-lines tr.doc-sec td { background: #f6f3ef; }
.t-stage:has(.t-adv-hint) { flex-wrap: wrap; row-gap: 2px; }
.t-stage .t-adv-hint { flex-basis: 100%; }

/* Live version: sync badge, login states */
.sync-badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 9px; white-space: nowrap; }
.sync-ok { background: #e6f4ea; color: #1e7b3a; }
.sync-busy { background: #fff4d6; color: #8a6100; }
.sync-off { background: #fde8e6; color: #b42318; }
.login-info { background: #eef4ff; color: #1d4ed8; border-color: #c7d7fe; }
.login-retry { display: none; }
.login-card.is-blocked .login-retry { display: inline-flex; }
.login-card.is-blocked #login-btn { display: none; }
.login-card [hidden] { display: none !important; }

/* ---------- Inventory ---------- */
.inv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.inv-tab { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #4b4541; font-size: 13px; text-decoration: none; }
.inv-tab.on { background: var(--accent-tint); color: var(--accent-dark); border-color: var(--accent); }
.inv-tab .nav-badge { margin-left: 4px; }
.inv-rows-wrap { overflow-x: auto; }
.inv-rows { width: 100%; }
.inv-rows select, .inv-rows input { width: 100%; min-width: 70px; }
.inv-rows .ir-item { min-width: 190px; }
.inv-rows tr.needs-map td:first-child select { border-color: #d9822b; background: #fff7ec; }
.inv-rows .ir-chk { white-space: nowrap; font-size: 12px; }
.inv-read { margin: 0; }
.inv-read-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#inv-read-status.is-bad { color: #b3261e; }
.inv-warn { background: #fff7ec; border: 1px solid #f0d3a8; border-radius: 6px; padding: 8px 10px; margin: 8px 0; font-size: 12.5px; }
.inv-pre { max-height: 180px; overflow: auto; background: #f6f3ef; padding: 8px; font-size: 11.5px; white-space: pre-wrap; }
.inv-pick { margin: 0 0 12px; }
.inv-pick select { min-width: 260px; }

/* ---- divisions ---- */
.user-chip .uc-div, .m-header .uc-div { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 9px; background: #e3edf7; color: #1f5f99; white-space: nowrap; }
.div-switch { font: inherit; font-size: 12px; font-weight: 600; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.div-switch[hidden] { display: none; }
table.data tr.group-row td { background: #f4f1ee; border-top: 2px solid var(--line); padding-top: 8px; padding-bottom: 8px; }
table.data tr.group-row .group-actions { float: right; }
table.data tr.group-empty td { font-style: italic; }
table.data tr.total-row td { background: #faf8f6; border-top: 2px solid var(--line); }

.consol-note { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.consol-h { margin: 14px 0 6px; font-size: 15px; padding: 4px 10px; background: #e3edf7; color: #1f5f99; border-radius: 6px; display: inline-block; }
td.div-cell { white-space: nowrap; font-weight: 600; color: #1f5f99; }

/* =====================================================================
 * CALENDAR  (tasks = blue, meetings = green, calls = orange)
 * ===================================================================== */
:root { --cal-task: #2f6fd0; --cal-meeting: #2f9e5f; --cal-call: #e08a1e; --cal-ppm: #7b3fb5; --cal-visit: #0b7a7c; --cal-complaint: #c0264a; }
.field[hidden] { display: none; }
.cal-wrap { display: flex; gap: 16px; align-items: flex-start; }
.cal-wrap.side-closed .cal-side { display: none; }
.cal-side { width: 236px; flex: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cal-main { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cal-h { margin: 14px 0 6px; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.cal-mini-h { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 6px; }
.cal-mini-h .cal-arrow { margin-left: 2px; }
.cal-mini-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; font-size: 12px; }
.cal-mini-g .dw { color: var(--muted); font-weight: 700; font-size: 11px; padding: 2px 0; }
.cal-md { display: block; padding: 4px 0; border-radius: 50%; color: var(--ink); text-decoration: none; position: relative; }
.cal-md:hover { background: var(--bg); }
.cal-md.other { color: #b3aca6; }
.cal-md.today { font-weight: 800; color: var(--cal-task); }
.cal-md.sel { background: var(--cal-task); color: #fff; }
.cal-md.has::after { content: ''; position: absolute; left: 50%; bottom: 1px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--cal-task); }
.cal-md.sel.has::after { background: #fff; }
.cal-people { max-height: 200px; overflow: auto; margin-bottom: 6px; }
.cal-chk { display: flex; align-items: center; gap: 6px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.cal-chk input { margin: 0; }
.cal-input { width: 100%; border: 1px solid #d8d3ce; border-radius: 6px; padding: 6px 9px; font-size: 13px; background: #fff; }
.cal-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--cal-task); }
.cal-sw.t-meeting, .cal-type.t-meeting { background-color: var(--cal-meeting); }
.cal-sw.t-call, .cal-type.t-call { background-color: var(--cal-call); }
.cal-sw.t-ppm, .cal-type.t-ppm { background-color: var(--cal-ppm); }
.cal-sw.t-complaint, .cal-type.t-complaint { background-color: var(--cal-complaint); }
.cal-sw.t-visit, .cal-type.t-visit { background-color: var(--cal-visit); }
.cal-type { display: inline-block; padding: 2px 8px; border-radius: 999px; color: #fff; font-size: 11.5px; font-weight: 700; background-color: var(--cal-task); }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-title { margin: 0 6px; font-size: 19px; font-weight: 600; }
.cal-spacer { flex: 1; }
.cal-toolbar .cal-input { width: 150px; }
.cal-icon, .cal-arrow { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); font-size: 20px; text-decoration: none; cursor: pointer; }
.cal-icon:hover, .cal-arrow:hover { background: var(--bg); }
.cal-create { position: relative; }
.cal-create-btn { background: #1a73e8; border-color: #1a73e8; border-radius: 999px; padding: 7px 16px; font-weight: 600; }
.cal-create-btn:hover { background: #1765cc; border-color: #1765cc; }
.cal-menu { display: none; position: absolute; top: 100%; left: 0; z-index: 30; min-width: 160px; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 4px 0; }
.cal-create.open .cal-menu { display: block; }
.cal-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 14px; font-size: 13.5px; cursor: pointer; }
.cal-menu button:hover { background: var(--bg); }
.cal-views { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal-views a { padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; border-left: 1px solid var(--line); background: #fff; }
.cal-views a:first-child { border-left: 0; }
.cal-views a.on { background: #e8f0fe; color: #1a5dc8; }
/* events */
.cal-ev { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; border: 0; border-radius: 999px; padding: 0 8px; height: 20px; line-height: 20px; margin: 1px 3px; font-size: 12px; font-weight: 600; color: #fff; background: var(--cal-task); cursor: pointer; }
.cal-ev i { font-style: normal; font-weight: 500; opacity: .9; }
.cal-ev.t-meeting { background: var(--cal-meeting); }
.cal-ev.t-call { background: var(--cal-call); }
.cal-ev.t-ppm { background: var(--cal-ppm); }
.cal-ev.t-complaint { background: var(--cal-complaint); }
.cal-ev.t-visit { background: var(--cal-visit); }
.sched-card tr.is-today td { background: rgba(168,67,47,.06); }
.cal-ev.s-done { opacity: .6; text-decoration: line-through; }
.cal-ev.s-cancelled { opacity: .5; text-decoration: line-through; background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.25) 6px 12px); }
.cal-ev.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-ev.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-ev:focus-visible { outline: 2px solid #1a73e8; outline-offset: 1px; }
/* month */
.cal-dows { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-bottom: 0; }
.cal-dow { text-align: center; padding: 6px 0; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: 26px repeat(3, 22px) 18px; border: 1px solid var(--line); border-top: 0; position: relative; }
.cal-day { grid-row: 1 / -1; border-left: 1px solid var(--line); cursor: pointer; text-align: right; padding: 2px 6px 0; min-width: 0; }
.cal-day:first-child { border-left: 0; }
.cal-day:hover { background: #f7f9fe; }
.cal-day.other { background: #fafaf9; }
.cal-day.other .cal-dnum { color: #b3aca6; }
.cal-dnum { display: inline-block; min-width: 22px; height: 22px; line-height: 22px; border-radius: 999px; padding: 0 5px; font-size: 12.5px; color: var(--ink); text-decoration: none; }
.cal-dnum:hover { background: var(--bg); }
.cal-day.today .cal-dnum { background: #1a73e8; color: #fff; font-weight: 700; }
.cal-week > .cal-ev { z-index: 1; margin-top: 2px; }
.cal-more { z-index: 1; font-size: 11.5px; font-weight: 700; color: var(--muted); text-decoration: none; padding: 0 8px; line-height: 16px; }
.cal-more:hover { color: #1a5dc8; text-decoration: underline; }
/* week / day */
.cal-timegrid { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.cal-tg-head, .cal-band { display: grid; grid-template-columns: 52px repeat(var(--n), 1fr); border-bottom: 1px solid var(--line); }
.cal-band { grid-template-columns: 52px 1fr; }
.cal-gutter { font-size: 11px; color: var(--muted); padding: 4px 4px 0; text-align: right; }
.cal-th { text-align: center; padding: 6px 0; text-decoration: none; color: var(--ink); border-left: 1px solid var(--line); }
.cal-th span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.cal-th b { font-size: 20px; font-weight: 500; }
.cal-th.today b { display: inline-block; width: 34px; height: 34px; line-height: 34px; border-radius: 50%; background: #1a73e8; color: #fff; }
.cal-bandgrid { display: grid; grid-template-columns: repeat(var(--n, 1), 1fr); min-height: 24px; }
.cal-timegrid[data-days="7"] .cal-bandgrid { grid-template-columns: repeat(7, 1fr); }
.cal-timegrid[data-days="1"] .cal-bandgrid { grid-template-columns: 1fr; }
.cal-bandcell { border-left: 1px solid var(--line); cursor: pointer; }
.cal-bandcell:hover { background: #f7f9fe; }
.cal-bandgrid > .cal-ev { z-index: 1; margin-top: 2px; }
.cal-scroll { max-height: 560px; overflow-y: auto; }
.cal-time { display: grid; grid-template-columns: 52px 1fr; position: relative; }
.cal-hour { height: 48px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: right; padding-right: 4px; box-sizing: border-box; }
.cal-hour:first-child { border-top: 0; }
.cal-hour span { position: relative; top: -7px; }
.cal-cols { display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-col.today { background: #fbfdff; }
.cal-slot { height: 48px; border-top: 1px solid var(--line); box-sizing: border-box; cursor: pointer; }
.cal-slot:first-child { border-top: 0; }
.cal-slot:hover { background: #f1f6fe; }
.cal-ev.timed { position: absolute; border-radius: 6px; height: auto; line-height: 1.25; padding: 2px 6px; margin: 0; white-space: normal; box-sizing: border-box; border-left: 3px solid rgba(0,0,0,.2); }
/* year */
.cal-year { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 22px; }
.cal-year-m { min-width: 0; }
.cal-mini-t { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--ink); text-decoration: none; }
.cal-mini-t:hover { color: #1a5dc8; }
.cal-year .cal-md { font-size: 11.5px; padding: 3px 0; }
.cal-mini-g .blank { display: block; }
/* schedule + details */
.cal-schedule table.data td { vertical-align: middle; }
.cal-link { background: none; border: 0; padding: 0; color: #1a5dc8; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.cal-link:hover { text-decoration: underline; }
.cal-details h3 { margin: 10px 0 8px; font-size: 18px; }
.cal-dl { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0 0 14px; font-size: 13.5px; }
.cal-dl dt { color: var(--muted); font-weight: 600; }
.cal-dl dd { margin: 0; white-space: pre-wrap; }
.cal-acts-row { display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.cal-att { display: flex; flex-wrap: wrap; gap: 4px 16px; max-height: 110px; overflow: auto; border: 1px solid #d8d3ce; border-radius: 6px; padding: 6px 9px; }
@media (max-width: 1100px) { .cal-year { grid-template-columns: repeat(3, 1fr); } }
@media screen and (max-width: 900px) {
  .cal-wrap { flex-direction: column; }
  .cal-side { width: 100%; box-sizing: border-box; }
  .cal-main { width: 100%; box-sizing: border-box; }
  .cal-year { grid-template-columns: repeat(2, 1fr); }
  .cal-toolbar .cal-input { width: 110px; }
  .cal-views a { padding: 6px 8px; }
}
@media screen and (max-width: 640px) {
  .cal-week { grid-template-rows: 24px repeat(3, 20px) 16px; }
  .cal-ev { font-size: 11px; padding: 0 5px; }
  .cal-dl { grid-template-columns: 1fr; }
}
@media print {
  .cal-side { display: none; }
  .cal-wrap { display: block; }
  .cal-main { border: 0; padding: 0; }
  .cal-scroll { max-height: none; overflow: visible; }
  .cal-ev { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Read PO: progress, editable text, low-confidence rows */
#inv-read-prog { width: 100%; height: 8px; margin-top: 6px; accent-color: var(--accent); }
#inv-paste, #inv-read-raw { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; border: 1px solid #d8d3ce; border-radius: 6px; padding: 8px; background: #fff; }
.inv-read details { margin-top: 8px; }
.inv-read summary { cursor: pointer; font-size: 12.5px; color: var(--accent-dark); font-weight: 600; }
.inv-read-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.inv-read-tools input[type="text"] { flex: 1 1 260px; border: 1px solid #d8d3ce; border-radius: 6px; padding: 6px 9px; }
#inv-read-cols select { width: 92px; padding: 3px; font-size: 12px; }
.inv-rows tr.low-conf td { background: #fff8ee; }
.inv-rows tr.low-conf .ir-chk { color: #8a5a00; font-weight: 700; }
.inv-rows .ir-chk { white-space: nowrap; font-size: 12px; }

/* Menu colours: user chip text on the tinted top bar */
.topbar .user-chip, .topbar .today { color: #1e293b; }

/* Dashboard tabs, blocks and bar charts */
.dash-tabs { margin-bottom: 16px; }
.dash-h { margin: 4px 0 8px; font-size: 13px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted, #6b655f); }
.dash-block { margin-bottom: 6px; }
.dash-block .kpis { margin-bottom: 12px; }
.bar-track { display: block; width: 100%; min-width: 90px; height: 10px; border-radius: 5px; background: #ece7df; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--blue); }
.bar-fill.tone-green { background: #2e9d5b; } .bar-fill.tone-amber { background: #d9822b; } .bar-fill.tone-red { background: #c0392b; } .bar-fill.tone-gray { background: #8b8680; } .bar-fill.tone-blue { background: #2f6fd0; }
table.chart td:nth-child(2), table.chart th:nth-child(2) { width: 38%; }
.dash-more { padding: 6px 12px 10px; }
.dash-list .card-head .btn { white-space: nowrap; }
@media print { .dash-tabs { display: none; } }

/* ===== v13 dashboards: soft tinted boxes (blue / green / amber / rose / lavender / teal) with a thin accent, dark text, warm sand theme ===== */
:root {
  --t-blue: #eaf1f8;     --t-blue-line: #4f7fae;
  --t-green: #e9f4ed;    --t-green-line: #4a9468;
  --t-amber: #fbf2de;    --t-amber-line: #c79635;
  --t-rose: #f9e9e8;     --t-rose-line: #c2584f;
  --t-lavender: #efecf7; --t-lavender-line: #7d6db0;
  --t-teal: #e4f3f1;     --t-teal-line: #3a9a92;
  --t-ink: #2a2622;
}
.kpi[class*="tint-"], .card[class*="tint-"] { color: var(--t-ink); }
.kpi.tint-blue, .card.tint-blue { --tc: var(--t-blue); --tl: var(--t-blue-line); }
.kpi.tint-green, .card.tint-green { --tc: var(--t-green); --tl: var(--t-green-line); }
.kpi.tint-amber, .card.tint-amber { --tc: var(--t-amber); --tl: var(--t-amber-line); }
.kpi.tint-rose, .card.tint-rose { --tc: var(--t-rose); --tl: var(--t-rose-line); }
.kpi.tint-lavender, .card.tint-lavender { --tc: var(--t-lavender); --tl: var(--t-lavender-line); }
.kpi.tint-teal, .card.tint-teal { --tc: var(--t-teal); --tl: var(--t-teal-line); }
.kpi[class*="tint-"] { background: var(--tc); border: 1px solid color-mix(in srgb, var(--tl) 22%, #fff); border-top: 1px solid color-mix(in srgb, var(--tl) 22%, #fff); border-left: 4px solid var(--tl); border-radius: 10px; padding: 13px 16px 12px; box-shadow: 0 1px 2px rgba(60,45,30,.05); }
.kpi[class*="tint-"][data-nav]:hover { box-shadow: 0 4px 14px rgba(60,45,30,.10); transform: translateY(-1px); }
.kpi[class*="tint-"] .kpi-label { color: #5b534b; font-size: 11.5px; letter-spacing: .5px; }
.kpi[class*="tint-"] .kpi-value { color: var(--t-ink); font-size: 25px; font-weight: 700; margin-top: 5px; line-height: 1.15; }
.kpi[class*="tint-"] .kpi-value.money { font-size: 18.5px; }
.kpi-sub { margin-top: 3px; font-size: 11.5px; color: #6b635b; line-height: 1.3; }
.card[class*="tint-"] { background: #fff; border: 1px solid color-mix(in srgb, var(--tl) 25%, #e4e1dd); border-top: 3px solid var(--tl); border-radius: 10px; box-shadow: 0 1px 2px rgba(60,45,30,.05); }
.card[class*="tint-"] > .card-head { background: var(--tc); border-bottom: 1px solid color-mix(in srgb, var(--tl) 22%, #fff); }
.card[class*="tint-"] > .card-head h2 { color: var(--t-ink); font-size: 14.5px; font-weight: 700; letter-spacing: .1px; }
.card[class*="tint-"] table.data th { background: color-mix(in srgb, var(--tc) 45%, #fff); color: #5b534b; }
.card[class*="tint-"] table.data tbody tr:hover td { background: color-mix(in srgb, var(--tc) 35%, #fff); }
.dash-h { display: flex; align-items: center; gap: 8px; margin: 10px 0 9px; font-size: 12px; letter-spacing: .9px; text-transform: uppercase; color: #5b534b; font-weight: 700; }
.dash-h::after { content: ""; flex: 1; height: 1px; background: var(--side-line, #cbc4b8); opacity: .7; }
.dash-block { margin-bottom: 10px; }
.dash-block .kpis { gap: 12px; margin-bottom: 12px; }
.dash-range { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px 6px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(60,45,30,.05); }
.dash-range .chips { margin-bottom: 8px; }
.dash-dates { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding-bottom: 6px; font-size: 12.5px; color: #5b534b; }
.dash-dates label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.dash-dates input[type="date"] { border: 1px solid #d8d3ce; border-radius: 6px; padding: 4px 8px; background: #fff; font-size: 12.5px; }
.dash-range-text { color: #5b534b; margin-left: auto; }
.dash-open { color: var(--accent-dark); font-weight: 600; cursor: pointer; text-decoration: none; border-bottom: 1px dotted var(--accent); }
.dash-open:hover { color: var(--accent); }
.dash-list td a:not(.dash-open), .dash-chart td a { color: var(--accent-dark); text-decoration: none; font-weight: 600; }
.dash-list td a:not(.dash-open):hover { text-decoration: underline; }
.bar-track { height: 9px; background: #ebe5db; }
.bar-track.b2 { margin-top: 3px; }
.bar-fill.tone-green { background: #4a9468; } .bar-fill.tone-amber { background: #d6a34a; } .bar-fill.tone-red { background: #c2584f; } .bar-fill.tone-blue { background: #5b8bb8; } .bar-fill.tone-gray { background: #a39d95; }
.dash-legend { display: flex; gap: 10px; align-items: center; padding: 8px 16px 0; font-size: 12px; color: #5b534b; }
.dash-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.dash-legend i.tone-blue { background: #5b8bb8; } .dash-legend i.tone-green { background: #4a9468; } .dash-legend i.tone-red { background: #c2584f; } .dash-legend i.tone-amber { background: #d6a34a; }
table.chart td:nth-child(2) { width: 40%; }
@media (max-width: 700px) { .dash-range-text { margin-left: 0; } .kpi[class*="tint-"] .kpi-value { font-size: 21px; } .kpi[class*="tint-"] .kpi-value.money { font-size: 15px; } }
@media print { .dash-range .dash-dates input { border: 0; } }

/* ===== AMC renewal warnings: badges, bell, list rows ===== */
.renew-tag { font-weight: 700; border: 1px solid transparent; }
.renew-amber { background: #fbf0d9; color: #7a5410; border-color: #e6c98a; }
.renew-orange { background: #fde6d2; color: #8a4310; border-color: #eab184; }
.renew-red { background: #f9e0dc; color: #9c2a1c; border-color: #e3a79f; }
.renew-dark { background: #4a2a26; color: #fff; border-color: #4a2a26; }
.amc-meta .renew-tag { margin-left: 4px; }
tr.renew-row-amber td:first-child { box-shadow: inset 4px 0 0 #d6a34a; }
tr.renew-row-orange td:first-child { box-shadow: inset 4px 0 0 #e08a3c; }
tr.renew-row-red td:first-child { box-shadow: inset 4px 0 0 #c2584f; }
tr.renew-row-dark td:first-child { box-shadow: inset 4px 0 0 #4a2a26; }
tr.group-row td { background: #f6f1e6; font-size: 12.5px; padding: 6px 12px; border-top: 1px solid var(--line); }
tr.renew-grp-red td { box-shadow: inset 4px 0 0 #c2584f; } tr.renew-grp-orange td { box-shadow: inset 4px 0 0 #e08a3c; } tr.renew-grp-amber td { box-shadow: inset 4px 0 0 #d6a34a; } tr.renew-grp-dark td { box-shadow: inset 4px 0 0 #4a2a26; }
.renew-list .card-head .muted { text-align: right; }
.bell-wrap { position: relative; display: inline-block; }
.bell-btn { position: relative; border: 1px solid var(--top-line); background: #fff; border-radius: 8px; width: 34px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; color: #1e293b; }
.bell-btn:hover { background: var(--drop-hover); }
.bell-count { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d6a34a; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--top); box-sizing: content-box; }
.bell-count.bell-orange { background: #e08a3c; } .bell-count.bell-red { background: #c2584f; } .bell-count.bell-dark { background: #4a2a26; }
.bell-drop { position: absolute; right: 0; top: 38px; width: 400px; max-width: 92vw; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 0 0 10px 10px; box-shadow: 0 12px 28px rgba(0,0,0,.16); z-index: 80; max-height: 70vh; overflow-y: auto; }
.bell-drop[hidden] { display: none; }
.bell-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px 8px; border-bottom: 1px solid var(--line); background: #f6f1e6; }
.bell-group { padding: 8px 14px 3px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: #5b534b; }
.bell-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid #f0ede8; font-size: 13px; }
.bell-item:hover { background: #fbf8f2; }
.bell-main { min-width: 0; } .bell-main .small-2 { display: block; }
.bell-item .tag { white-space: nowrap; flex: 0 0 auto; }
.bell-empty, .bell-more { padding: 12px 14px; }
.bell-foot { display: block; padding: 9px 14px; text-align: center; font-weight: 600; font-size: 12.5px; color: var(--accent-dark); text-decoration: none; background: #fbf8f2; }
.settings-sec { font-weight: 700; color: #5b534b; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; text-transform: uppercase; letter-spacing: .6px; font-size: 12px; }
.reminder-ok { color: #2f7d4f; font-weight: 600; } .reminder-bad { color: #b3321f; font-weight: 600; }
@media (max-width: 1024px) { .bell-drop { position: fixed; left: 8px; right: 8px; top: 96px; width: auto; max-width: none; } }
@media print { .bell-wrap { display: none; } }

/* ---- v13: Reports hub + team tabs ---- */
.rep-hub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 4px 0 12px; }
.rep-tile { display: block; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 10px; padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(60,45,30,.05); }
.rep-tile:hover { border-color: var(--accent); box-shadow: 0 3px 10px rgba(60,45,30,.12); }
.rep-tile h3 { margin: 0 0 6px; font-size: 16px; color: var(--accent-dark); }
.rep-tile p { margin: 0 0 10px; color: #5b534b; font-size: 13px; min-height: 36px; }
.rep-tile .rep-open { font-size: 12px; font-weight: 600; color: var(--accent); }
.rep-hint { margin: 6px 0 14px; }
.rep-div { margin: -4px 0 10px; }
.rep-tabs { margin-top: 4px; }
.rep-kpis { padding: 12px 14px 2px; grid-template-columns: repeat(4, 1fr); }
.rep-main .card-head { flex-wrap: wrap; gap: 8px; }
.rep-card table.rep-table th, .rep-card table.rep-table td { font-size: 12.5px; }
.rep-total td, tr.rep-total td { font-weight: 700; background: #f4f0e8; border-top: 2px solid #cfc7b8; }
.rep-note { padding: 6px 14px 10px; }
.rep-links { padding: 10px 14px 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.rep-print-h { margin: 16px 0 4px; font-size: 14px; }
.team-tabs .tab-n { opacity: .7; font-size: 12px; }
@media (max-width: 900px) { .rep-hub { grid-template-columns: repeat(2, 1fr); } .rep-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .rep-hub { grid-template-columns: 1fr; } }

/* ===== v14 Quotation builder + template print ===== */
.qb-modal { max-width: 980px; }
.qb { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#modal-body:has(.qb) { display: block; }
.qb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 12px; }
.qb-l { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #4b4541; }
.qb-l input, .qb-l select, .qb-l textarea, .qb-sys input, .qb-sys textarea { border: 1px solid #d8d3ce; border-radius: 6px; padding: 6px 8px; background: #fff; width: 100%; font-weight: 400; font-size: 13px; }
.qb-chks { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 2px; }
.qb-chk { display: inline-flex; gap: 5px; align-items: center; font-weight: 500; font-size: 13px; }
.qb-chk input { width: auto; }
.qb-sys { border: 1px solid #d8d3ce; border-radius: 8px; padding: 10px; background: #fcfbfa; display: flex; flex-direction: column; gap: 8px; }
.qb-sys-h { display: flex; gap: 8px; align-items: center; background: #333; color: #fff; padding: 6px 8px; border-radius: 6px; }
.qb-sys-h input, .qb-sys-h select, .qb-sys-h textarea { background: #fff; color: #1f1b18; -webkit-text-fill-color: #1f1b18; caret-color: #1f1b18; }
.qb-sys-h input::placeholder, .qb-sys-h textarea::placeholder { color: #756d66; opacity: 1; -webkit-text-fill-color: #756d66; }
.qb-sys-h input::selection, .qb-sys-h textarea::selection { background: #cfe3ff; color: #111; -webkit-text-fill-color: #111; }
.qb-sys-h input:disabled { background: #ece8e3; color: #4a443f; -webkit-text-fill-color: #4a443f; }
.qb-sys-h .qb-title { flex: 3; font-weight: 700; } .qb-sys-h .qb-brand { flex: 1.3; }
.qb-sys-h .btn { color: #fff; border-color: #888; white-space: nowrap; }
.qb-items { margin: 0; } .qb-items td.qb-n { width: 28px; color: #777; text-align: center; font-size: 12px; }
.qb-items td.qb-amt { text-align: right; white-space: nowrap; min-width: 90px; font-size: 13px; }
.qb-ops .btn { padding: 2px 6px; min-width: 26px; }
.qb-lump { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px; background: #fff7d6; border: 1px solid #ecd98a; border-radius: 6px; }
.qb-lump label { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; } .qb-lump input { width: 160px; }
.qb-tot { display: flex; gap: 18px; flex-wrap: wrap; justify-content: flex-end; font-size: 13px; }
.qb-words, .qb-tot .qb-words { font-weight: 700; flex-basis: 100%; text-align: right; color: #333; }
.qb-sum { text-align: right; font-size: 14px; padding: 8px 10px; background: #f3f1ee; border-radius: 6px; } .qb-sum:empty { display: none; }
.qb-terms { border: 1px solid #e3dfdb; border-radius: 8px; padding: 8px 10px; } .qb-terms summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.qb-terms .qb-l { margin-top: 8px; }
.qb-rev { display: flex; gap: 8px; align-items: center; font-weight: 600; padding: 8px; background: #eef4ff; border-radius: 6px; font-size: 13px; }
.print-doc.qt-doc { max-width: 794px; padding: 8mm 9mm; font-size: 13px; }
.print-doc.qt-doc .qt { zoom: 1; }
.qt-page { width: 100%; }
.qt-page > thead > tr > td, .qt-page > tbody > tr > td, .qt-page > tfoot > tr > td { padding: 0; border: 0; }
@media print {
  .print-doc.qt-doc { max-width: none; padding: 0; margin: 0; }
  .qt-page > thead { display: table-header-group; } .qt-page > tfoot { display: table-footer-group; }
  .qt-t th, .qt-t td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 640px) { .qb-sys-h { flex-wrap: wrap; } .qb-items thead { display: none; } .qb-items tr { grid-template-columns: 1fr 1fr 44px; } .print-doc.qt-doc { overflow-x: auto; padding: 8px; } }
.qb-hint { display: none; font-size: 11px; color: #9a3412; margin-top: 2px; font-weight: 600; }
.qb-row-blank td { background: #fff4e0; }
.qb-row-blank .l-qty { border: 2px solid #e07b00; outline: none; }
.qb-row-blank .qb-hint { display: block; }
.qb-row-zero td { opacity: .5; background: #f1efec; }
.qb-row-zero .qb-n::after { content: ' (left out)'; font-size: 10px; display: block; white-space: nowrap; }
pre.qb-blanklist { margin: 0; white-space: pre-wrap; font: 13px/1.5 inherit; background: #fff4e0; border: 1px solid #e07b00; border-radius: 6px; padding: 8px 10px; }

/* ===== v15: dashboard range buttons + tabs bolder/bigger ===== */
.dash-range .chip { font-weight: 700; font-size: 14px; padding: 6px 14px; }
.dash-tabs .inv-tab { font-weight: 700; font-size: 15px; padding: 9px 18px; }

/* ===== v15: AMC register, filters, systems, import ===== */
.amc-reg-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.amc-reg-wrap table.data { min-width: 1500px; margin: 0; }
.amc-reg th { white-space: nowrap; }
.amc-reg td { vertical-align: top; }
.amc-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.amc-tools .amc-reg-count { margin-left: auto; }
.amc-filter-row th, .col-filter-row th { padding: 4px 5px; background: #faf7f2; font-weight: 400; vertical-align: top; }
.amc-filter-row input, .amc-filter-row select, .col-filter-row input, .col-filter-row select { width: 100%; min-width: 70px; max-width: 170px; padding: 4px 6px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-sizing: border-box; }
.fl-pair { display: flex; flex-direction: column; gap: 3px; }
.fl-pair input { min-width: 90px; }
.sys-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.sys-tags .tag, .sys-tags span { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-tint, #f6e9df); color: var(--accent-dark, #7a3e17); border: 1px solid #ead7c8; white-space: nowrap; }
.amc-meta2 { margin-top: 4px; }
.amc-sys-chks { max-width: 100%; }
.amc-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.proj-filter-count { margin-left: 8px; }
.imp-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 16px; margin: 10px 0; padding: 10px 12px; background: #faf7f2; border: 1px solid var(--line); border-radius: 8px; }
.imp-counter { grid-column: 1 / -1; }
.imp-pick { margin: 8px 0 12px; }
.imp-sumtop { margin: 8px 0; font-weight: 600; }
.imp-table { min-width: 1500px; }
.imp-table th { white-space: nowrap; }
.imp-in { width: 120px; padding: 3px 5px; font-size: 12px; border: 1px solid var(--line); border-radius: 5px; box-sizing: border-box; }
.imp-in.w-sys { width: 190px; }
.imp-in.w-date { width: 98px; }
.imp-in.w-num { width: 70px; }
.imp-in.w-wide { width: 160px; }
.imp-row-err td { background: #fdecea; }
.imp-row-skip td { background: #f4f1ec; color: #7b756e; }
.imp-flags { display: flex; flex-direction: column; gap: 3px; min-width: 190px; }
.imp-flag { font-size: 11.5px; padding: 2px 7px; border-radius: 6px; line-height: 1.3; }
.imp-flag.imp-err { background: #fbd9d4; color: #8d241a; }
.imp-flag.imp-warn { background: #fdecc8; color: #7a4d00; }
.imp-flag.imp-info { background: #e1ecfb; color: #1f4f95; }
.imp-flag.imp-ok { background: #dff3e6; color: #1d6b3c; }
.imp-warn-text { color: #7a4d00; }
.imp-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.imp-error { background: #fbd9d4; color: #8d241a; border-radius: 8px; padding: 8px 12px; }
@media (max-width: 700px) { .amc-filter-row input, .amc-filter-row select { max-width: none; } }
#side-nav a[hidden], #top-nav a[hidden] { display: none !important; }

/* ===== v15: remarks, attachments, PPM schedule list ===== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.att-link { text-decoration: none; color: var(--accent-dark, #7a3e17); }
.att-link:hover { text-decoration: underline; }
.remarks-cell { white-space: pre-wrap; word-break: break-word; display: inline-block; max-width: 260px; }
.remarks-edit { padding: 0 6px; min-height: 0; line-height: 1.4; }
.svc-list { list-style: none; margin: 0 0 6px; padding: 0; }
.svc-list li { margin: 3px 0; }
.svc-add { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.ppm-table { min-width: 1900px; }
.ppm-overdue td { background: #fff6f4; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: left; white-space: nowrap; }
.ppm-custom { display: flex; gap: 12px; align-items: center; margin: 0 0 10px; }
.ppm-team { display: inline-flex; gap: 6px; align-items: center; margin-right: 6px; font-size: 13px; }
.note-warn { background: #fdf3dc; border-color: #ecd08b; }
.cal-side select.cal-input { width: 100%; }
.member-login { margin-top: 2px; }

/* ===== v15: readable wide lists (AMC Contracts = colour-banded header; PPM Schedule List = plain) =====
   Thin vertical lines, zebra rows, darker header, sticky header. Screen only; exports and the stacked phone layout are unchanged. */
@media (min-width: 701px) {
  .amc-reg-wrap { max-height: calc(100vh - 210px); min-height: 280px; overflow: auto; border-color: #c9c2b8; }
  .amc-reg { border-collapse: separate; border-spacing: 0; }
  .amc-reg thead th { position: sticky; top: 0; z-index: 3; height: 38px; box-sizing: border-box; background: #e6dfd5; color: #3b342d;
    border-bottom: 0; box-shadow: inset 0 -2px 0 #b9b0a3; }
  .amc-reg th, .amc-reg td { border-right: 1px solid #d4cfc8; }
  .amc-reg th:last-child, .amc-reg td:last-child { border-right: 0; }
  .amc-reg tbody td { border-bottom: 1px solid #e6e2dc; }
  .amc-reg tbody tr:nth-child(even) td { background: #faf6f1; }
  .amc-reg tbody tr:nth-child(odd) td { background: #fff; }
  .amc-reg tbody tr:hover td { background: #f1e8dc; }
  .amc-reg tbody tr.ppm-overdue td { background: #fff3ef; }
  .amc-reg tbody tr.ppm-overdue:nth-child(even) td { background: #fdeae4; }
  .amc-reg .amc-filter-row td { position: sticky; z-index: 2; top: 38px; background: #f6f1ea; border-bottom: 1px solid #c9c2b8; vertical-align: top; }
  .amc-reg .amc-filter-row td { border-right: 1px solid #d4cfc8; }
  .amc-reg .amc-filter-row td:last-child { border-right: 0; }
  .amc-reg .th-sort { color: #3b342d; }
  /* AMC Contracts only: band row + tinted header cells */
  .amc-grouped .amc-band td { position: sticky; top: 0; z-index: 4; height: 24px; box-sizing: border-box; padding: 3px 10px; font-size: 11px; font-weight: 700;
    letter-spacing: .6px; text-transform: uppercase; color: #4a4239; border-right: 1px solid #fff; border-bottom: 0; vertical-align: middle; }
  .amc-grouped thead tr.amc-heads th { top: 24px; }
  .amc-grouped .amc-filter-row td { top: 62px; }
  .amc-grouped .amc-band td, .amc-grouped thead th { white-space: nowrap; }
  .amc-grouped .amc-band td.g-c { background: #cfe0f1; } .amc-grouped thead th.g-c { background: #dce9f6; }
  .amc-grouped .amc-band td.g-d { background: #cfe5cb; } .amc-grouped thead th.g-d { background: #deeedb; }
  .amc-grouped .amc-band td.g-a { background: #f2dca6; } .amc-grouped thead th.g-a { background: #f8e9c3; }
  .amc-grouped .amc-band td.g-g { background: #d6d3cf; } .amc-grouped thead th.g-g { background: #e4e2df; }
  .amc-grouped thead th { border-right: 1px solid #c9c2b8; }
}
@media print {
  .amc-reg-wrap { max-height: none !important; overflow: visible !important; }
  .amc-reg thead th, .amc-reg .amc-filter-row td, .amc-grouped .amc-band td { position: static !important; }
  .amc-reg th, .amc-reg td { border-right: 1px solid #bbb; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .amc-reg thead { display: table-header-group; }
  .amc-reg tbody tr { page-break-inside: avoid; }
}

/* ===== v16: roomier left menu (desktop). The sidebar already scrolls, so a long menu stays reachable on a laptop screen.
   Phones / tablets keep the 44 px drawer rows from the mobile block. ===== */
@media (min-width: 1025px) {
  .side-nav { padding: 14px 10px 18px; }
  .side-link, .side-head { padding: 11px 10px; margin-bottom: 3px; }
  .side-top, .side-group.depth-0 > .side-head { margin-top: 3px; font-size: 13.5px; }
  .side-group.depth-0 > .side-sub { margin: 3px 0 10px 18px; padding-left: 8px; }
  .side-sub .side-link, .side-sub .side-head { padding: 9px 10px; margin-bottom: 2px; }
  .side-group.depth-1 > .side-sub { margin: 2px 0 8px 8px; }
  .side-group.depth-1 > .side-head { padding-top: 9px; padding-bottom: 9px; }
}
@media (max-width: 1024px) {
  .side-link, .side-head { margin-bottom: 2px; }
}

/* v16: Data: Backup, Export & Import */
.nav-badge.nav-badge-soft { background: #f3dfb2; color: #7a4b00; border: 1px solid #e2c27a; }
.bk-card .card-body { padding-top: 4px; }
.bk-opts { display: grid; gap: 8px; margin: 10px 0 12px; }
.bk-opts label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.35; cursor: pointer; }
.bk-opts input { margin-top: 3px; }
.bk-go { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 8px; }
.bk-go .btn { padding: 9px 18px; }
#bk-preview { margin-top: 12px; display: grid; gap: 10px; }
.note.note-warn { background: #fff4dc; border-color: #e8c97a; color: #6b4300; }
@media print { #bk-preview, .bk-card .btn { display: none; } }

/* v16: PPM checklist */
.cl-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.cl-scroll { overflow-x: auto; max-width: 100%; }
.cl-table input:not([type=checkbox]) { width: 100%; min-width: 110px; padding: 6px 8px; border: 1px solid var(--line, #d9cfbd); border-radius: 5px; font: inherit; background: #fff; }
.cl-table select { min-width: 120px; padding: 6px 8px; border: 1px solid var(--line, #d9cfbd); border-radius: 5px; font: inherit; background: #fff; }
.cl-table td, .cl-table th { vertical-align: top; }
.cl-c { text-align: center; }
.cl-c input { width: 20px; height: 20px; }
tr.cl-nw td { background: #fdebe8; }
.cl-bad { color: #b3261e; font-weight: 700; }
.cl-sum { margin: 6px 0; font-size: 13px; }
.cl-ph { display: inline-flex; align-items: center; gap: 3px; margin: 0 6px 4px 0; font-size: 12px; }
.cl-ph-x { border: 0; background: none; cursor: pointer; color: #8a7a62; font-size: 12px; }
.cl-ph-add { cursor: pointer; }
.cl-sign { margin-top: 10px; }
.cl-signname input { margin-left: 6px; padding: 6px 8px; border: 1px solid var(--line, #d9cfbd); border-radius: 5px; font: inherit; }
#cl-sig { display: block; width: 100%; max-width: 560px; height: auto; aspect-ratio: 560 / 170; background: #fff; border: 1px dashed #a89a80; border-radius: 6px; margin: 8px 0 6px; touch-action: none; cursor: crosshair; }
.cl-sigimg img, .cl-sigimg-print { max-width: 280px; height: auto; background: #fff; border: 1px solid #e3dac8; border-radius: 4px; }
.cl-flag { margin-left: 4px; }
.cl-signoff { display: flex; gap: 40px; margin-top: 18px; }
.cl-signoff > div { flex: 1; }
.cl-sigblank { height: 70px; border-bottom: 1px solid #444; margin-bottom: 4px; }
.cl-doc td.cl-c { text-align: center; }
@media (max-width: 700px) { .cl-table input:not([type=checkbox]) { min-width: 90px; } }

/* v16: form controls always have dark text on their own light background, even when they sit inside a dark bar (the global `color: inherit` made them white there) */
.qb-sys input, .qb-sys select, .qb-sys textarea, .modal input:not([type=checkbox]):not([type=radio]):not([type=file]), .modal select, .modal textarea { color: #1f1b18; }
.qb-sys input::placeholder, .modal input::placeholder, .modal textarea::placeholder { color: #756d66; opacity: 1; }

/* ===== v17 ===== */
.field[hidden] { display: none !important; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent-dark); text-decoration: underline; cursor: pointer; font: inherit; font-weight: 600; min-height: 32px; }
.btn-link:hover { color: var(--accent); }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }
.ppm-plan-tbl td, .ppm-plan-tbl th { white-space: normal; vertical-align: top; }
.hol-add { margin-top: 10px; }
#hol-tbl .tag { margin-left: 4px; }
.cl-table input.cl-ip, .cl-table input.cl-ip-v { min-width: 110px; }
.tag.ppm-visited { margin-left: 4px; }
.cc { line-height: 1.35; }
@media (max-width: 720px) {
  .ppm-plan-tbl { font-size: 12.5px; }
  .hol-add { grid-template-columns: 1fr; }
}

/* ===== v18: Calendar Team + Date filters (toolbar) ===== */
.cal-filters { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-right: 4px; }
.cal-date-filter { display: inline-flex; align-items: center; gap: 6px; }
.cal-date-filter .cal-input { width: 140px; }
.cal-date-filter .cal-date-in { width: 138px; }
.cal-date-sep { color: var(--muted, #6b655f); font-weight: 600; }
.cal-date-hint { white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
@media screen and (max-width: 720px) {
  .cal-filters { width: 100%; }
  .cal-date-filter { width: 100%; flex-wrap: wrap; }
  .cal-date-filter .cal-input, .cal-date-filter .cal-date-in { flex: 1; min-width: 120px; width: auto; }
}

.cal-team-filter { display: inline-flex; align-items: center; gap: 6px; margin-right: 4px; }
.cal-team-filter .cal-team-lbl { font-size: 12px; font-weight: 700; color: var(--muted, #6b655f); text-transform: uppercase; letter-spacing: .5px; }
.cal-team-filter .cal-input { width: 160px; }
@media screen and (max-width: 720px) {
  .cal-team-filter { width: 100%; }
  .cal-team-filter .cal-input { flex: 1; width: auto; }
}

/* ===== v18: Schedule | Calendar tabs ===== */
.sched-tabs { margin: 0 0 12px; }

/* ===== v19: AMC Contracts list ===== */
.amc-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.amc-tools-left { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.amc-top-filter {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 7px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 8px; box-shadow: 0 1px 2px rgba(15,23,42,.04); margin-left: auto;
}
.amc-qf-lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .55px; color: var(--muted); padding: 0 2px; }
.amc-top-filter select, .amc-top-filter input[type="text"] {
  border: 1px solid #d8d3ce; border-radius: 6px; padding: 5px 8px; font-size: 13px; background: #fff; font-family: inherit;
}
.amc-top-filter select { min-width: 150px; }
.amc-top-filter input[type="text"] { width: 170px; }
.amc-reg.amc-list-v19 { min-width: 1680px !important; width: max-content; table-layout: auto; }
.amc-reg-count { margin: 0 0 4px; }
.amc-reg-wrap { overflow-x: auto; }
.amc-list-v19 th, .amc-list-v19 td { padding: 1px 14px; vertical-align: middle; line-height: 1.2; white-space: nowrap; }
.amc-list-v19 thead th { padding: 2px 14px; line-height: 1.15; }
.amc-list-v19 .amc-loc { margin-top: 0; line-height: 1.1; font-size: 11px; white-space: normal; }
.amc-list-v19 .bld { font-weight: 600; }
.amc-list-v19 .st, .amc-list-v19 select.st { padding: 0 6px; font-size: 12px; min-height: 0; height: auto; min-width: 110px; }
.amc-list-v19 .tag { padding: 0 5px; font-size: 10.5px; }
.amc-list-v19 th:nth-child(2), .amc-list-v19 td:nth-child(2) { min-width: 140px; } /* Contract No. */
.amc-list-v19 th:nth-child(3), .amc-list-v19 td:nth-child(3) { min-width: 180px; white-space: normal; } /* Building + loc */
.amc-list-v19 th:nth-child(4), .amc-list-v19 td:nth-child(4) { min-width: 160px; } /* Client */
.amc-list-v19 th:nth-child(5), .amc-list-v19 td:nth-child(5),
.amc-list-v19 th:nth-child(6), .amc-list-v19 td:nth-child(6),
.amc-list-v19 th:nth-child(7), .amc-list-v19 td:nth-child(7),
.amc-list-v19 th:nth-child(8), .amc-list-v19 td:nth-child(8) { min-width: 110px; } /* dates */
.amc-list-v19 th:nth-child(9), .amc-list-v19 td:nth-child(9) { min-width: 130px; } /* PPM Frequency */
.amc-list-v19 th:nth-child(10), .amc-list-v19 td:nth-child(10) { min-width: 130px; } /* Status */
.amc-list-v19 th:nth-child(11), .amc-list-v19 td:nth-child(11),
.amc-list-v19 th:nth-child(12), .amc-list-v19 td:nth-child(12),
.amc-list-v19 th:nth-child(13), .amc-list-v19 td:nth-child(13) { min-width: 130px; text-align: right; } /* Contract / Received / Balance excl. VAT */
.amc-list-v19 th:nth-child(14), .amc-list-v19 td:nth-child(14) { min-width: 90px; text-align: right; } /* % received */
.amc-list-v19 thead th .small-2 { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 10px; }

/* v20 list polish: Balance colour, Due soon, % received hidden on phone */
.bal-bad { color: #b91c1c; font-weight: 700; }
.bal-good { color: #15803d; font-weight: 700; }
.due-soon {
  display: inline-block; margin-left: 4px; font-size: 10px; font-weight: 700;
  color: #9a3412; background: #ffedd5; border: 1px solid #fdba74;
  padding: 0 5px; border-radius: 999px; vertical-align: middle; line-height: 1.4;
}
.amc-list-v19 .th-sort, .proj-list-v19 .th-sort { font-weight: 700; }
.amc-list-v19 th.num .th-sort, .proj-list-v19 th.num .th-sort { width: 100%; text-align: right; }
@media screen and (max-width: 640px) {
  .amc-list-v19 .col-pct,
  .proj-list-v19 .col-pct { display: none !important; }
}


.amc-act-th, .amc-act-td { width: 48px; min-width: 48px; text-align: center; padding-left: 6px; padding-right: 6px; white-space: nowrap; }
.amc-act-wrap { position: relative; display: inline-block; }

/* Action ☰ menus: sit above zebra cells; don't clip inside the register scroll box */
.amc-act-wrap.open { z-index: 50; }
.amc-act-menu { z-index: 50; max-height: min(70vh, 420px); overflow-y: auto; }
.card.amc-register { overflow: visible; }
.card.projects-card.proj-list-v19 { overflow: visible; }
.amc-reg-wrap:has(.amc-act-wrap.open),
#amc-reg-wrap:has(.amc-act-wrap.open),
#proj-reg-wrap:has(.amc-act-wrap.open) {
  overflow: visible;
}

.amc-act-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 24px; padding: 0; border: 1px solid #d8d3ce; border-radius: 5px;
  background: #fff; color: var(--accent-dark); font-size: 14px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 1px rgba(15,23,42,.04);
}
.amc-act-btn:hover, .amc-act-wrap.open .amc-act-btn {
  background: var(--accent-tint); border-color: #e0b5aa; color: var(--accent);
}
.amc-act-menu {
  display: none; position: absolute; left: calc(100% + 6px); top: -4px; z-index: 50;
  max-height: min(70vh, 420px); overflow-y: auto;
  min-width: 188px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 28px rgba(42,38,35,.16); padding: 5px; text-align: left;
}
.amc-act-wrap.open .amc-act-menu { display: block; }
.amc-act-menu::before {
  content: ""; position: absolute; left: -6px; top: 10px;
  border: 6px solid transparent; border-right-color: #fff;
  filter: drop-shadow(-1px 0 0 var(--line));
}
.amc-mi {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; padding: 7px 10px; border-radius: 6px;
  font-size: 12.5px; color: var(--ink); cursor: pointer; font-family: inherit; text-align: left;
}
.amc-mi:hover { background: var(--accent-tint); color: var(--accent-dark); }
.amc-mi.danger { color: #a8432f; }
.amc-mi-ico { width: 16px; text-align: center; color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.amc-mi.danger .amc-mi-ico { color: #a8432f; }
.amc-mi-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.amc-pdf-dot { font-size: 11px; margin-left: 2px; }
@media screen and (max-width: 720px) {
  .amc-tools { flex-direction: column; align-items: stretch; }
  .amc-top-filter { margin-left: 0; width: 100%; }
  .amc-top-filter input[type="text"] { flex: 1; width: auto; min-width: 120px; }
  /* If the Action menu would go off-screen on the right, it still opens to the right of the button */
  .amc-act-menu { left: calc(100% + 4px); }
}

/* ===== v19: Manage Projects list (same Action / filter / density as AMC) ===== */
.projects-card.proj-list-v19 { overflow: visible; }
.projects-card.proj-list-v19 .card-body { overflow: visible; }
.proj-list-v19.amc-reg { min-width: 1320px !important; width: max-content; table-layout: auto; }
.proj-list-v19 th, .proj-list-v19 td { padding: 1px 14px; vertical-align: middle; line-height: 1.2; white-space: nowrap; }
.proj-list-v19 thead th { padding: 2px 14px; line-height: 1.15; }
.proj-list-v19 thead th .small-2 { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 10px; }
.proj-list-v19 .proj-pc { white-space: normal; min-width: 180px; max-width: 260px; }
.proj-list-v19 .proj-name { font-weight: 650; }
.proj-list-v19 .proj-client { margin-top: 0; line-height: 1.1; font-size: 11px; }
.proj-list-v19 .proj-dates { font-size: 12px; }
.proj-list-v19 .proj-arrow { color: var(--muted); margin: 0 3px; }
.proj-list-v19 .proj-bal { color: var(--accent-dark); font-weight: 700; }
.proj-list-v19 .num { font-variant-numeric: tabular-nums; }
.proj-list-v19 .prog-btn { border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; }
.proj-list-v19 .st, .proj-list-v19 select.st { padding: 0 6px; font-size: 12px; min-height: 0; height: auto; min-width: 110px; }
.proj-list-v19 .tag { padding: 0 5px; font-size: 10.5px; }
.proj-list-v19 th:nth-child(2), .proj-list-v19 td:nth-child(2) { min-width: 110px; } /* Job # */
.proj-list-v19 th:nth-child(4), .proj-list-v19 td:nth-child(4) { min-width: 100px; } /* Team */
.proj-list-v19 th:nth-child(5), .proj-list-v19 td:nth-child(5) { min-width: 170px; } /* dates */
.proj-list-v19 th:nth-child(7), .proj-list-v19 td:nth-child(7) { min-width: 120px; } /* progress */
.proj-list-v19 th:nth-child(8), .proj-list-v19 td:nth-child(8),
.proj-list-v19 th:nth-child(9), .proj-list-v19 td:nth-child(9),
.proj-list-v19 th:nth-child(10), .proj-list-v19 td:nth-child(10) { min-width: 110px; text-align: right; }
.proj-list-v19 th:nth-child(11), .proj-list-v19 td:nth-child(11) { min-width: 90px; text-align: right; }

/* v20: AMC list payment columns */
.amc-list-v19 th .small-2, .amc-list-v19 thead th .small-2 { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 10px; }
.amc-list-v19 td .num { font-variant-numeric: tabular-nums; }
