/* Bramley Engineering dashboard – clean and plain */
:root {
  --navy: #1B2A41;
  --yellow: #FABA0F;
  --grey: #EEF0F3;
  --white: #FFFFFF;
  --text: #1B2A41;
  --muted: #5F6B7A;
  --line: #D9DDE3;
  --red: #C0262D;
  --red-bg: #FDECEC;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--grey);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

h1, h2, h3, p { margin: 0; }

a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- Top bar ---- */
.topbar { background: var(--navy); color: var(--white); border-bottom: 4px solid var(--yellow); }
.topbar-inner {
  max-width: 1500px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 14px; height: 36px; background: var(--yellow); border-radius: 2px; }
.brand-name { display: block; font-weight: 700; font-size: 18px; letter-spacing: 0.01em; }
.brand-sub { display: block; font-size: 13px; opacity: 0.75; }
.sample-badge {
  background: var(--yellow); color: var(--navy);
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}

.wrap { max-width: 1500px; margin: 0 auto; padding: 20px 24px 48px; }

/* ---- Toolbar ---- */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; }
.seg button {
  font: inherit; font-weight: 600; border: 0; background: transparent; color: var(--navy);
  padding: 8px 16px; border-radius: 6px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.seg button:focus-visible, .btn:focus-visible, select:focus-visible, .stat-link:focus-visible {
  outline: 3px solid var(--yellow); outline-offset: 2px;
}
.toolbar-hint { color: var(--muted); font-size: 14px; }
.me-picker { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.me-picker select {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--navy);
}

.btn {
  display: inline-block; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  background: var(--yellow); color: var(--navy); border: 0; border-radius: 6px; padding: 9px 14px;
}
.btn-small { font-size: 13px; padding: 6px 10px; white-space: nowrap; }
.btn-plain { background: var(--white); border: 1px solid var(--line); }

/* ---- Totals ---- */
.totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--white); border-radius: var(--radius); padding: 18px 20px;
  border-top: 4px solid var(--navy);
}
.stat-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.stat-value { font-size: 34px; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 14px; color: var(--muted); }
.stat-note { font-size: 13px; color: var(--muted); margin-top: 6px; font-style: italic; }
.stat-link { display: inline-block; margin-top: 10px; font-weight: 600; font-size: 14px; }

/* ---- Breakdown panel ---- */
.panel { background: var(--white); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.panel-title { font-size: 17px; font-weight: 700; }
.panel-sub { font-size: 13px; color: var(--muted); margin: 2px 0 12px; }
.breakdown { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.breakdown th, .breakdown td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--grey); }
.breakdown thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.breakdown tbody th { font-weight: 600; }
.breakdown td:last-child { text-align: right; }
.red-count { color: var(--white); background: var(--red); font-weight: 700; padding: 1px 8px; border-radius: 999px; }

/* ---- Three columns ---- */
.columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.col { background: #E3E6EB; border-radius: var(--radius); padding: 12px; }
.col-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 4px 4px 12px; }
.col-title { font-size: 17px; font-weight: 700; }
.col-sub { font-size: 13px; color: var(--muted); }
.col-body { display: grid; gap: 10px; }

/* ---- Cards ---- */
.card {
  background: var(--white); border-radius: var(--radius); padding: 14px 16px;
  border-left: 4px solid var(--navy);
}
.card-red { border-left-color: var(--red); background: var(--red-bg); }
.card-top { margin-bottom: 6px; }
.card-customer { font-size: 16px; font-weight: 700; }
.card-job { color: var(--muted); font-size: 14px; margin: 2px 0 10px; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.field-value { font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.field.is-red .field-value { color: var(--red); font-weight: 700; }
.muted { color: var(--muted); font-weight: 400; }
.no-value { color: #8A94A3; font-weight: 400; font-style: italic; }

.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.tag-new { background: var(--yellow); color: var(--navy); }
.tag-assess { background: var(--navy); color: var(--white); }

.warn { margin-top: 10px; color: var(--red); font-weight: 600; font-size: 13px; }

.steps { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin-top: 12px; }
.step { height: 5px; background: var(--grey); border-radius: 2px; }
.step.done { background: var(--navy); }

.empty { color: var(--muted); font-size: 14px; padding: 8px 4px; }

/* ---- Job board ---- */
.page-head { margin-bottom: 16px; }
.page-title { font-size: 24px; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 14px; }
.board { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 12px; align-items: start; }
.board-col { background: #E3E6EB; border-radius: var(--radius); padding: 10px; display: grid; gap: 10px; }
.board-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 4px; }
.board-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: var(--white);
  font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.board-title { font-size: 14px; font-weight: 700; flex: 1; }
.board-count { font-size: 12px; font-weight: 700; background: var(--white); border-radius: 999px; padding: 1px 8px; }
.board .card { padding: 12px; }
.board .fields { grid-template-columns: 1fr; gap: 6px; }

/* ---- Smaller screens ---- */
@media (max-width: 1400px) {
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .columns, .totals { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .topbar-inner, .wrap { padding-left: 16px; padding-right: 16px; }
  .board { grid-template-columns: 1fr; }
  .stat-value { font-size: 30px; }

  /* Breakdown table turns into one block per person */
  .breakdown thead { display: none; }
  .breakdown, .breakdown tbody, .breakdown tr, .breakdown th, .breakdown td { display: block; width: 100%; }
  .breakdown tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; }
  .breakdown th, .breakdown td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .breakdown th::before, .breakdown td::before {
    content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 500; text-align: left;
  }
  .breakdown td:last-child { justify-content: flex-end; }
  .breakdown td:last-child::before { content: none; }
}

/* ---- Live mode: signed-in user, sign-in screen ---- */
[hidden] { display: none !important; }
.user-area { font-size: 14px; display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; }
.user-out { color: var(--yellow); font-weight: 600; }
.toolbar-right { margin-left: auto; }
.toolbar-right a { font-weight: 600; }
.signin { max-width: 520px; margin: 40px auto; display: grid; gap: 14px; }
.unset { margin-top: 16px; }
.unset .panel-title { display: flex; align-items: center; gap: 8px; }
.unset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.unset .card { background: var(--grey); }
.unset .card-red { background: var(--red-bg); }
.unset .fields { grid-template-columns: 1fr; gap: 6px; }

/* ---- Tappable cards ---- */
a.card-link { display: block; color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow .12s ease, transform .12s ease; }
a.card-link:hover { box-shadow: 0 2px 10px rgba(27, 42, 65, .14); }
a.card-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { a.card-link { transition: none; } }

/* ---- Deal, customer and contact pages ---- */
.rec-toolbar { margin-bottom: 14px; }
.rec-head { display: grid; gap: 8px; border-top: 4px solid var(--yellow); }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rec-head .page-title { text-wrap: balance; }
.rec-who { font-size: 15px; }
.rec-link, .rec-panel a, .rec-head a { color: var(--navy); font-weight: 600; }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 6px; }
.rec-panel { display: grid; gap: 10px; }
.rec-panel .panel-title { margin-bottom: 0; }
.rec-text { white-space: pre-wrap; max-width: 75ch; }
.rec-message { display: grid; gap: 12px; }
.small { font-size: 13px; }
.note-line { font-size: 14px; color: var(--muted); }
.rec-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.rec-main, .rec-side { display: grid; gap: 0; min-width: 0; }
.next-panel { border-left: 4px solid var(--yellow); }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.pill-open { background: var(--grey); color: var(--navy); border: 1px solid var(--line); }
.pill-sent { background: var(--navy); color: #fff; }
.pill-draft { background: var(--grey); color: var(--muted); }
.pill-won { background: #E3F2E8; color: #1E6B3D; }
.pill-lost { background: var(--red-bg); color: var(--red); }
.pill-superseded { background: var(--grey); color: var(--muted); text-decoration: line-through; }

/* Progress bar: done = navy, current = yellow, to do = grey */
.stepper { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.stepper li { display: grid; gap: 6px; }
.step-bar { height: 10px; border-radius: 3px; background: #D5DAE1; }
.step-done .step-bar { background: var(--navy); }
.step-current .step-bar { background: var(--yellow); }
.step-name { font-size: 12px; color: var(--muted); line-height: 1.25; overflow-wrap: anywhere; }
.step-done .step-name { color: var(--navy); }
.step-current .step-name { color: var(--navy); font-weight: 700; }
.is-late { color: var(--red); font-weight: 700; }
.is-late-panel { border-left: 4px solid var(--red); }
.late-flag { color: var(--red); font-weight: 600; font-size: 14px; }

/* Rows: a table on desktop, stacked blocks on a phone */
.rtable-wrap { overflow-x: auto; }
.rtable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.rtable th, .rtable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grey); vertical-align: top; }
.rtable th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }

/* Notes */
.note-form { display: grid; gap: 8px; }
.note-form textarea { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; min-height: 70px; color: var(--navy); background: var(--white); }
.note-form textarea:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.note-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.note-status { font-size: 13px; color: var(--muted); margin-right: auto; }
.btn:disabled { opacity: .6; cursor: default; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note { border-top: 1px solid var(--grey); padding-top: 10px; display: grid; gap: 3px; }
.note-meta { font-size: 13px; color: var(--muted); }
.note-meta strong { color: var(--navy); }
.note-title { font-weight: 600; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .rec-grid { grid-template-columns: minmax(0, 1fr); }
  .fields-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .fields-3, .fields-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 10px; }
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; margin-bottom: 8px; }
  .rtable td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .rtable td > * { min-width: 0; }
}

/* ---- Installed web app: keep content clear of the phone's notch and home bar ---- */
.topbar { padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner, .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap { padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 701px) { .topbar-inner, .wrap { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); } }

/* ---- Outlook calendar (dashboard only) ---- */
.cal-panel { display: grid; gap: 12px; }
.cal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.cal-head .panel-title { margin: 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-week { font-weight: 600; margin-left: 6px; font-variant-numeric: tabular-nums; }
.cal-book { margin-left: auto; }
.cal-note { font-size: 13px; color: var(--muted); }
.cal-msg { background: #E3F2E8; color: #1E6B3D; font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 6px; }
.cal-people { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-chip { font: inherit; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--muted); cursor: pointer; }
.cal-chip[aria-pressed="true"] { color: var(--navy); border-color: var(--who); background: color-mix(in srgb, var(--who) 10%, white); }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--who); opacity: .35; }
.cal-chip[aria-pressed="true"] .cal-dot { opacity: 1; }
.cal-chip:focus-visible, .cal-add:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.cal-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, .7fr)); gap: 8px; }
.cal-day { background: var(--grey); border-radius: var(--radius); padding: 8px; display: grid; align-content: start; gap: 6px; min-width: 0; }
.cal-day.is-weekend { background: #F4F5F7; }
.cal-day.is-today { box-shadow: inset 0 3px 0 var(--yellow); background: #FFF8E1; }
.cal-day-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.cal-add { font: inherit; font-weight: 700; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--navy); cursor: pointer; line-height: 1; }
.cal-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cal-event { background: var(--white); border-left: 4px solid var(--who); border-radius: 4px; padding: 5px 7px; display: grid; gap: 1px; font-size: 13px; min-width: 0; }
.cal-event.is-free { opacity: .7; border-left-style: dashed; }
.cal-time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12px; }
.cal-subject { overflow-wrap: anywhere; }
.cal-who { font-size: 12px; font-weight: 600; color: var(--who); }
.cal-loc { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cal-empty { font-size: 12px; color: var(--muted); }

.cal-form { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; background: #FBFBFC; }
.cal-form-title { font-size: 16px; font-weight: 700; }
.cal-form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
.cal-form-grid label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cal-form-grid .span-2 { grid-column: span 2; }
.cal-form-grid input[type="text"], .cal-form-grid input[type="date"], .cal-form-grid input[type="time"], .cal-form-grid select, .cal-form-grid textarea {
  font: inherit; font-weight: 400; color: var(--navy); padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); width: 100%; min-width: 0;
}
.cal-form-grid input:disabled { opacity: .5; }
.cal-check { display: flex !important; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; color: var(--navy) !important; }
.cal-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-form-status { margin-right: auto; font-size: 13px; color: var(--red); font-weight: 600; }

@media (max-width: 1000px) {
  .cal-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-book { margin-left: 0; }
}
@media (max-width: 520px) {
  .cal-form-grid { grid-template-columns: minmax(0, 1fr); }
  .cal-form-grid .span-2 { grid-column: auto; }
}
.cal-whos { display: flex; flex-wrap: wrap; align-items: baseline; }
.cal-sep { font-size: 12px; color: var(--muted); white-space: pre; }
.cal-event.is-shared { border-left-width: 6px; }

/* ---- Forms: new enquiry and quote editor ---- */
.edit-form { display: grid; gap: 16px; }
.edit-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.edit-form legend { font-weight: 700; padding: 0 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.form-grid .span-2 { grid-column: span 2; }
.edit-form label, .form-grid label, .qline-nums label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.edit-form input, .edit-form select, .edit-form textarea,
.form-grid input, .form-grid select, .form-grid textarea,
.qline input, .qline textarea, #q_notes, #po_notes {
  font: inherit; font-weight: 400; color: var(--navy); background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; min-width: 0;
}
.edit-form input:focus-visible, .edit-form select:focus-visible, .edit-form textarea:focus-visible,
.form-grid input:focus-visible, .form-grid textarea:focus-visible, .form-grid select:focus-visible,
.qline input:focus-visible, .qline textarea:focus-visible, #q_notes:focus-visible, #po_notes:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.form-status { margin-right: auto; font-size: 13px; color: var(--muted); font-weight: 600; }
.form-error { background: var(--red-bg); color: var(--red); font-weight: 600; padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--grey); padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); z-index: 5; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow: auto; }
.pick-list button { font: inherit; text-align: left; width: 100%; background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; color: var(--navy); }
.pick-list button:hover, .pick-list button:focus-visible { border-color: var(--navy); outline: none; }
.pick-chosen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: -4px; }

.qlines { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.qline { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: #FBFBFC; }
.qline.is-read { background: var(--white); }
.qline-num { font-weight: 700; color: var(--muted); padding-top: 8px; }
.qline.is-read .qline-num { padding-top: 0; }
.qline-body { display: grid; gap: 8px; min-width: 0; }
.qline-body input[data-f="title"] { font-weight: 700; }
.qline-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1fr); gap: 8px; align-items: end; }
.qline-net { display: grid; gap: 4px; text-align: right; padding-bottom: 8px; font-variant-numeric: tabular-nums; }
.qline-tools { display: flex; gap: 6px; justify-content: flex-end; }
.qline-title { font-weight: 700; }
.qline-details { white-space: pre-wrap; color: var(--muted); font-size: 14px; }
.qline-money { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; font-size: 14px; }
.qtotals { margin-left: auto; max-width: 320px; display: grid; gap: 6px; font-variant-numeric: tabular-nums; }
.qtotals > div { display: flex; justify-content: space-between; gap: 12px; }
.qtotal { background: var(--navy); color: #fff; padding: 8px 10px; border-radius: 4px; font-weight: 700; }
.send-panel { border-top: 4px solid var(--yellow); }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .qline-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qline-net { grid-column: span 2; text-align: left; }
  .qtotals { max-width: none; }
}

/* ---- PDF viewer (inside the dashboard, so the phone app never gets stuck) ---- */
body.pdf-open { overflow: hidden; }
.pdf-viewer { position: fixed; inset: 0; z-index: 100; background: #3A4150; display: flex; flex-direction: column; }
.pdf-bar { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.pdf-name { flex: 1; text-align: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-pages { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 12px 8px calc(24px + env(safe-area-inset-bottom, 0px)); }
.pdf-pages canvas { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); max-width: 100%; height: auto; }
.pdf-msg { color: #fff; text-align: center; margin-top: 40px; }

/* ---- Face ID / fingerprint unlock ---- */
.pk-offer { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; background: #FFF6DB; border-bottom: 1px solid #F1D98A; color: var(--navy); font-size: 14px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.pk-actions { display: flex; gap: 8px; }
.pk-msg { width: 100%; font-size: 13px; color: var(--red); font-weight: 600; }
.pk-unlock { display: grid; gap: 6px; }
.pk-btn { font-size: 17px; padding: 14px 18px; }
.pk-status { font-size: 13px; color: var(--red); font-weight: 600; min-height: 1em; }
.rec-actions { justify-content: flex-start; margin-top: 0; }

/* ---- Job (sales order) page ---- */
.job-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line, #DDE1E7); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.job-form .span-2 { grid-column: 1 / -1; }
.pre { white-space: pre-wrap; }
.money-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 6px; }
.money-strip > div { background: var(--grey, #EEF0F3); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.money-strip strong { font-size: 17px; }
.checklist { list-style: none; margin: 8px 0 0; padding: 0; }
.check { border-top: 1px solid var(--line, #DDE1E7); }
.check:first-child { border-top: 0; }
.check label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--navy, #1B2A41); }
.check-text { display: grid; gap: 2px; min-width: 0; }
.check-subject { font-weight: 600; }
.check-meta { font-size: 13px; color: var(--muted); }
.check.is-done .check-subject { color: var(--muted); text-decoration: line-through; }
@media (max-width: 700px) {
  .job-form { grid-template-columns: minmax(0, 1fr); }
  .money-strip { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Job section on the deal page, setting up a job, recently completed ---- */
.job-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.job-block.is-late-panel { border-left: 4px solid var(--red); }
.job-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.job-block-title { margin: 0; font-size: 17px; }
.job-block .stepper { margin-bottom: 10px; }
.step-switches { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.step-switches legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
.form-grid label.step-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--grey); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.form-grid label.step-switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy); }
.form-grid label.step-switch:has(input:not(:checked)) { color: var(--muted); text-decoration: line-through; background: #fff; border: 1px dashed var(--line); }
.form-grid fieldset.span-2 { border: 0; padding: 0; margin: 0; }
.form-grid fieldset.span-2 legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
.form-grid label.radio-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--text); font-size: 15px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.form-grid label.radio-row input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--navy); }
.done-flag { background: #E7F5EC; color: #1E6B3A; border-radius: var(--radius); padding: 10px 14px; font-weight: 600; }
.recent-panel { margin-top: 20px; }
.recent-list { list-style: none; margin: 8px 0 0; padding: 0; }
.recent-list li { border-top: 1px solid var(--line); }
.recent-list li:first-child { border-top: 0; }
.recent-row { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding: 10px 2px; color: inherit; text-decoration: none; }
.recent-row:hover .recent-main strong { text-decoration: underline; }
.recent-meta { color: var(--muted); font-size: 14px; }
.form-grid fieldset.step-switches { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Folding lists on the dashboard (phones and narrow screens only) ---- */
.col-h { margin: 0; font: inherit; }
.col-toggle { all: unset; display: flex; gap: 8px; align-items: flex-start; cursor: default; }
.col-toggle .col-title, .col-toggle .col-sub { display: block; }
.recent-panel .col-title { font-size: 17px; font-weight: 700; }
.recent-panel .col-body { display: block; }
.col-chev { display: none; }
@media (max-width: 1000px) {
  .col-toggle { cursor: pointer; flex: 1; min-width: 0; padding: 4px 0; border-radius: 6px; }
  .col-toggle:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
  .col-chev { display: block; flex: none; width: 10px; height: 10px; margin-top: 6px; border-right: 2.5px solid var(--navy); border-bottom: 2.5px solid var(--navy);
    transform: rotate(45deg); transition: transform .15s; }
  .is-folded .col-chev { transform: rotate(-45deg); }
  .is-folded .col-body { display: none !important; }
  .col.is-folded .col-head { padding-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) { .col-chev { transition: none; } }

/* ---- Purchase orders ---- */
.inline-pick { display: flex; gap: 8px; align-items: center; }
.inline-pick select { flex: 1; min-width: 0; }
.inline-pick .btn { flex: none; white-space: nowrap; }
.po-nums { grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1fr); }
.form-grid fieldset.new-supplier { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.form-grid fieldset.new-supplier legend { padding: 0 4px; }
@media (max-width: 520px) {
  .inline-pick { flex-direction: column; align-items: stretch; }
}

/* "Sign in with Zoho once more" bar on the dashboard */
.rescope-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between;
  background: #FFF6DB; border: 1px solid #F1D98A; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; color: var(--navy); font-size: 14px; }

/* ---- Customers ---- */
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head-row .panel-title, .panel-head-row .page-title { margin: 0; }
.cust-search { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 6px; background: var(--white); color: var(--navy); }
.cust-search:focus-visible { outline: 3px solid var(--yellow); outline-offset: 1px; }
.cust-list, .buyers, .activity, .ch-matches { list-style: none; margin: 6px 0 0; padding: 0; }
.cust-list li + li, .activity li + li { border-top: 1px solid var(--line); }
.cust-row { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; padding: 10px 2px; color: inherit; text-decoration: none; }
.cust-row:hover strong { text-decoration: underline; }
.dup-warn { background: #FFF6DB; border: 1px solid #F1D98A; border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.dup-warn ul { margin: 6px 0; padding-left: 18px; }
.enrich-btn { background: var(--navy); color: #fff; border-color: var(--navy); }
.enrich-box { background: var(--grey); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0 14px; }
.enrich-box p { margin: 0 0 8px; }
.ch-matches li + li { margin-top: 6px; }
.ch-match { all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.ch-match:hover, .ch-match:focus-visible { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px var(--yellow); }
.ch-match .muted { display: block; margin-top: 2px; }
.enrich-table td { vertical-align: top; }
.site-row, .contact-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.site-row:first-of-type, .contact-row:first-of-type { border-top: 0; }
.site-row.is-editing, .contact-row.is-editing { display: block; }
.site-row.is-archived { opacity: .65; }
.site-links { display: flex; gap: 14px; margin-top: 4px; font-size: 14px; }
.contact-lines { display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: 3px; font-size: 14px; overflow-wrap: anywhere; }
.contact-lines .dot { color: var(--muted); }
.inline-form { background: var(--grey); border-radius: var(--radius); padding: 12px; }
.form-grid label.check-inline { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.form-grid label.check-inline input { width: 18px; height: 18px; }
.link-btn { all: unset; cursor: pointer; color: var(--navy); text-decoration: underline; font-size: 14px; }
.link-btn:focus-visible { outline: 3px solid var(--yellow); }
.buyers { counter-reset: b; }
.buyers li { display: grid; gap: 2px; padding: 8px 0 8px 30px; position: relative; border-top: 1px solid var(--line); }
.buyers li:first-child { border-top: 0; }
.buyers li::before { counter-increment: b; content: counter(b); position: absolute; left: 0; top: 9px; width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); color: var(--navy); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--white); color: var(--navy); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip[aria-pressed="true"] .muted { color: #C9D2DF; }
.act-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 2px; color: inherit; text-decoration: none; }
.act-row:hover strong { text-decoration: underline; }
.act-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; text-align: center; border-radius: 6px; padding: 3px 0; background: var(--grey); color: var(--navy); }
.act-main { display: grid; min-width: 0; }
.act-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-side { text-align: right; white-space: nowrap; font-size: 14px; }
.cust-totals { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0 0 16px; }
.cust-totals > div { background: var(--white); }
@media (max-width: 1000px) { .cust-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .cust-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .act-row { grid-template-columns: 48px minmax(0, 1fr); }
  .act-side { grid-column: 2; text-align: left; }
}

/* ---- Archive and delete ---- */
.btn-danger { background: var(--white); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-danger[data-confirm="1"] { background: var(--red); color: #fff; }
.archived-flag { background: var(--grey); border-radius: var(--radius); padding: 8px 12px; color: var(--navy); font-size: 14px; margin: 6px 0 10px; }
.form-actions .form-left { margin-right: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.contact-row.is-archived { opacity: .65; }
.row-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.enrich-table td.en-tick { width: 34px; }
.enrich-table td.en-tick input { width: 20px; height: 20px; accent-color: var(--navy); }
.enrich-table label { cursor: pointer; }
.en-select { font: inherit; font-weight: 700; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--navy); }
@media (max-width: 700px) { .enrich-table td.en-tick { width: auto; } }
