:root {
  --brand: #1f4e9a; --brand-2: #2563c9; --accent: #5cb85c;
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f8fafc; --border: #dde3ec;
  --text: #1b2433; --text-2: #4a5568; --muted: #7a8699;
  --good: #1e7d3a; --good-bg: #e3f4e8; --warn: #9a6400; --warn-bg: #fdf1d8;
  --bad: #b42318; --bad-bg: #fde8e6; --info: #1f4e9a; --info-bg: #e6eefb; --neutral-bg: #eef1f5;
  --bar: #2563c9; --grid: #e7ebf1;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141c; --surface: #171e29; --surface-2: #1c2431; --border: #2a3444;
    --text: #e6ebf2; --text-2: #b4bfcd; --muted: #8592a6;
    --good: #6fd08c; --good-bg: #173524; --warn: #f0b955; --warn-bg: #3a2c12;
    --bad: #ff8a80; --bad-bg: #3d1a18; --info: #8db4ff; --info-bg: #1b2a45; --neutral-bg: #232c3a;
    --bar: #6c9cf0; --grid: #263041; --brand: #8db4ff; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
h1 { font-size: 20px; margin: 0; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 0 0 8px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, #1f4e9a 0%, #2a7bd6 60%, #5cb85c 140%); }
.login-card { background: var(--surface); padding: 28px; border-radius: 12px; width: min(360px, 100%); display: grid; gap: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-logo { width: 110px; justify-self: center; border-radius: 8px; }
.login-card h1 { text-align: center; color: var(--brand); }
.error { color: var(--bad); min-height: 1em; margin: 0; }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex-shrink: 0; background: #12284d; color: #cfd9ea; overflow-y: auto; height: 100vh; position: sticky; top: 0; }
.brand { display: flex; gap: 10px; align-items: center; padding: 14px; color: #fff; font-weight: 700; font-size: 17px; text-decoration: none !important; border-bottom: 1px solid #22406f; }
.brand img { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 6px; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: #9fb3d4; }
nav .grp { padding: 14px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7f95ba; }
nav a { display: flex; gap: 8px; padding: 7px 16px; color: #cfd9ea; text-decoration: none !important; border-left: 3px solid transparent; }
nav a:hover { background: #1a3563; color: #fff; }
nav a.active { background: #1f4e9a; color: #fff; border-left-color: var(--accent); }
nav a .count { margin-left: auto; background: #e8590c; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.global-search { flex: 1; max-width: 520px; }
.global-search input { width: 100%; }
.user-box { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--text-2); }
.menu-btn { display: none; }
.view { padding: 20px; max-width: 1500px; width: 100%; }

/* controls */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand-2) 40%, transparent); border-color: var(--brand-2); }
input[readonly], textarea[readonly], select:disabled { background: var(--surface-2); color: var(--text-2); }
label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
label .hint { font-weight: 400; color: var(--muted); }
.btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: 7px 14px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--brand-2); text-decoration: none; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.good { background: #1e7d3a; border-color: #1e7d3a; color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: #b42318; border-color: #b42318; color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--text); padding: 2px 6px; }

/* page bits */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; }
.toolbar .grow { flex: 1; min-width: 180px; }
.muted { color: var(--muted); } .right { text-align: right; } .nowrap { white-space: nowrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs.wrap { flex-wrap: wrap; overflow-x: visible; }
.tabs button { font: inherit; background: none; border: none; padding: 9px 14px; cursor: pointer; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--brand-2); border-bottom-color: var(--brand-2); font-weight: 600; }
.tabs button .count { margin-left: 6px; background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 600; }
.tabs button.active .count { background: var(--brand-2); color: #fff; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; background: var(--surface-2); color: var(--text-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; white-space: nowrap; cursor: pointer; user-select: none; }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr.clickable { cursor: pointer; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data tfoot td { font-weight: 700; background: var(--surface-2); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px; color: var(--text-2); }

/* status badges: colour + text label, never colour alone */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--neutral-bg); color: var(--text-2); }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); color: inherit; text-decoration: none !important; display: block; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--text-2); }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; }
.bar-row .track { height: 14px; position: relative; }
.bar-row .fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.bar-row:hover .fill { filter: brightness(1.15); }
.colchart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 18px; border-bottom: 1px solid var(--grid); }
.colchart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.colchart .col .b { width: min(34px, 80%); background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.colchart .col:hover .b { filter: brightness(1.15); }
.colchart .col .v { font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.collabels { display: flex; gap: 6px; }
.collabels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.tip { position: fixed; pointer-events: none; background: #111827; color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 12px; z-index: 50; white-space: nowrap; }

/* line-item editors & quotation builder */
.lines td { padding: 3px 4px; }
.lines input, .lines select, .lines textarea { padding: 4px 6px; font-size: 13px; }
.lines .del { color: var(--bad); }
.totals { display: grid; grid-template-columns: auto 160px; gap: 4px 16px; justify-content: end; margin-top: 10px; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 16px; }
.bod td, .bod th { padding: 3px 4px; }
.bod input, .bod select { padding: 4px 6px; font-size: 12.5px; min-width: 84px; }
.bod th:first-child, .bod td:first-child { position: sticky; left: 0; background: var(--surface-2); z-index: 1; min-width: 210px; }
.bod td.calc { background: var(--info-bg); font-variant-numeric: tabular-nums; }
/* A flush card that is also a table-wrap must scroll, not cut off (".card.flush" hides overflow) */
.card.flush.table-wrap { overflow: auto; }
/* Quotation room / BOQ tables: their own scroll box as high as the screen, so the side scrollbar is always in view;
   the room headings stay on top and the parameter / item column stays on the left */
.card.flush.q-scroll { max-height: calc(100vh - 150px); overscroll-behavior: contain; }
.q-scroll thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
.q-scroll .bod thead th:first-child { z-index: 3; }
.bod .bod-h { position: sticky; left: 10px; }
.boq .spec { font-size: 12px; color: var(--text-2); white-space: pre-wrap; max-height: 60px; overflow: hidden; }
.boq .spec.open { max-height: none; }
.boq tr.heading td { background: var(--surface-2); }
.boq input.q { width: 70px; min-width: 60px; }
.boq input.q.auto { background: var(--info-bg); }
.status-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.modal-back { position: fixed; inset: 0; background: rgba(10,20,40,.45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--surface); border-radius: 10px; padding: 20px; width: min(640px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(1100px, 100%); }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ref-input input.invalid, input.invalid { border-color: var(--bad); background: #fff5f5; }
.bell { position: relative; font-size: 18px; }
.bell .count { position: absolute; top: -4px; right: -6px; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 1px 5px; line-height: 14px; }
.bell .count.hidden { display: none; }
#popups { position: fixed; top: 64px; right: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.popup { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid #1f4e9a; border-radius: 8px; padding: 10px 30px 10px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18); cursor: pointer; position: relative; font-size: 13px; }
.popup > .icon-btn { position: absolute; top: 4px; right: 4px; }
.notif-list { max-height: 60vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; min-width: 420px; }
.notif { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; }
.notif.unread { border-left: 4px solid #1f4e9a; background: var(--surface-2); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.s-in { background: #2a78d6; } .s-out { background: #eb6834; }
.gchart { display: flex; gap: 10px; height: 170px; align-items: stretch; border-bottom: 1px solid var(--border); padding-top: 6px; }
.ggroup { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.gbars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.gbar { width: 40%; max-width: 26px; border-radius: 4px 4px 0 0; cursor: default; }
.glabel { text-align: center; font-size: 11px; color: var(--text-2); padding-top: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .s-in { background: #3987e5; } :root:not([data-theme="light"]) .s-out { background: #d95926; } }
.toast { position: fixed; bottom: 20px; right: 20px; background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transform: translateY(10px); transition: .2s; z-index: 60; max-width: 420px; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: #b42318; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.timeline { display: grid; gap: 6px; font-size: 13px; }
.timeline div { border-left: 2px solid var(--border); padding-left: 10px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; z-index: 30; transition: left .2s; }
  .sidebar.open { left: 0; }
  .menu-btn { display: block; }
  .view { padding: 16px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .user-box #user-name { display: none; }
  .bar-row { grid-template-columns: 90px 1fr 36px; }
}

/* ---------------------------------------------------------------- sectioned forms (enquiry register) */
/* Several choices as tick boxes (type 'checks') */
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.checks .check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: 13px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; }
.checks .check input { width: auto; margin: 0; accent-color: var(--brand-2); }
.checks .check:has(input:checked) { border-color: var(--brand-2); background: var(--info-bg); color: var(--info); }
.checks .check:has(input:disabled) { cursor: default; }
/* Section cards: number, title, one-line summary, filled count; two columns on a computer, one on a phone */
.sec-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
details.sec { margin: 0; padding: 0; }
details.sec > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: '▸'; color: var(--muted); margin-left: 4px; transition: transform .15s; }
details.sec[open] > summary::after { transform: rotate(90deg); }
details.sec > summary:focus-visible { outline: 2px solid var(--brand-2); outline-offset: -2px; border-radius: var(--radius); }
.sec-no { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--neutral-bg); color: var(--text-2); }
details.sec.sec-done .sec-no { background: var(--good-bg); color: var(--good); }
/* Each section tile has its own colour: a tinted header, a coloured edge and number; a ✓ when its key data is in */
.sec-form { --sec-1: #2563c9; --sec-2: #7c3aed; --sec-3: #0f8b8d; --sec-4: #c2410c; --sec-5: #0369a1; --sec-6: #15803d; --sec-7: #be123c; --sec-8: #4338ca; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sec-form { --sec-1: #6c9cf0; --sec-2: #b394f5; --sec-3: #4fc2c4; --sec-4: #f0915a; --sec-5: #5fb4e6; --sec-6: #6fd08c; --sec-7: #f27a95; --sec-8: #9a9cf5; } }
:root[data-theme="dark"] .sec-form { --sec-1: #6c9cf0; --sec-2: #b394f5; --sec-3: #4fc2c4; --sec-4: #f0915a; --sec-5: #5fb4e6; --sec-6: #6fd08c; --sec-7: #f27a95; --sec-8: #9a9cf5; }
.sec-form > details.sec:nth-child(8n+1) { --c: var(--sec-1); } .sec-form > details.sec:nth-child(8n+2) { --c: var(--sec-2); }
.sec-form > details.sec:nth-child(8n+3) { --c: var(--sec-3); } .sec-form > details.sec:nth-child(8n+4) { --c: var(--sec-4); }
.sec-form > details.sec:nth-child(8n+5) { --c: var(--sec-5); } .sec-form > details.sec:nth-child(8n+6) { --c: var(--sec-6); }
.sec-form > details.sec:nth-child(8n+7) { --c: var(--sec-7); } .sec-form > details.sec:nth-child(8n+8) { --c: var(--sec-8); }
.sec-form > details.sec { border-left: 5px solid var(--c); overflow: hidden; }
.sec-form > details.sec > summary { background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.sec-form > details.sec[open] > summary { border-bottom: 1px solid color-mix(in srgb, var(--c) 25%, var(--border)); margin-bottom: 12px; }
.sec-form > details.sec .sec-no { background: var(--c); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.sec-form > details.sec .sec-title { color: color-mix(in srgb, var(--c) 75%, var(--text)); }
.sec-form > details.sec.sec-done .sec-no { background: var(--c); color: #fff; }
.sec-form > details.sec.sec-done .sec-no::after { content: '✓'; font-size: 10px; margin-left: 1px; }
/* the files of the record, shown inside the "Files" section */
.sec .sec-files { box-shadow: none; margin: 0; border-style: dashed; }
.sec .sec-files h2 { font-size: 14px; margin-top: 0; }
/* required / mandatory fields */
.req { color: var(--bad); font-weight: 700; }
.sec-head { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sec-title { font-weight: 700; font-size: 15px; }
.sec-sum { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.sec[open] .sec-sum { display: none; }
.sec-count { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sec-hint { margin: -4px 16px 12px 56px; font-size: 13px; color: var(--text-2); }
details.sec > .form-grid { padding: 0 16px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
details.sec > .form-grid .span-2 { grid-column: 1 / -1; }
.sec-progress { padding: 12px 16px; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 8px; color: var(--text-2); }
.progress { height: 8px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--good); transition: width .2s; }
/* Register: the details of a row under it */
table.data td.expander { width: 32px; padding-right: 0; }
table.data tr.detail-row > td { background: var(--surface-2); }
dl.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 20px; margin: 4px 0; }
dl.detail-grid dt { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; }
dl.detail-grid dd { margin: 0; font-size: 13px; white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  details.sec > .form-grid { grid-template-columns: 1fr; }
  .sec-hint { margin-left: 16px; }
  /* Register on a phone: each row is a card with the column name before each value */
  table.data.cards thead { display: none; }
  table.data.cards, table.data.cards tbody, table.data.cards tr, table.data.cards td { display: block; width: 100%; }
  table.data.cards tr.clickable { position: relative; border-bottom: 1px solid var(--border); padding: 8px 12px 8px 44px; }
  table.data.cards td { border: 0; padding: 2px 0; display: flex; gap: 10px; }
  table.data.cards td[data-label]::before { content: attr(data-label); flex: none; width: 110px; color: var(--muted); font-size: 12px; }
  table.data.cards td.expander { position: absolute; left: 8px; top: 8px; width: auto; }
  table.data.cards td.clip { max-width: none; white-space: normal; }
  table.data.cards tr.detail-row > td { padding: 8px 12px; }
}

/* ---------------------------------------------------------------- print documents */
.print-root { background: #fff; color: #000; }
.doc { font: 12px/1.4 Calibri, "Segoe UI", Arial, sans-serif; color: #000; background: #fff; }
.doc .page { padding: 10mm 12mm; page-break-after: always; break-after: page; }
.doc .page:last-child { page-break-after: auto; break-after: auto; }
.doc .letterhead { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #1f4e9a; padding-bottom: 6px; margin-bottom: 10px; }
.doc .letterhead img { height: 62px; }
.doc .letterhead .co { text-align: right; font-size: 11px; color: #333; }
.doc .letterhead .co b { color: #1f4e9a; font-size: 14px; }
.doc .foot-img { width: 100%; margin-top: 14px; }
.doc .doc-foot { margin-top: 14px; padding: 6px 0 0 70px; font-size: 10.5px; line-height: 1.5; color: #444; }
.doc .doc-foot .df-co { color: #1aa3c8; font-weight: 700; font-size: 11.5px; }
.doc .doc-foot .df-k { color: #1aa3c8; }
.doc .doc-foot .df-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.doc h2 { text-align: center; color: #1f4e9a; font-size: 15px; margin: 6px 0; }
.doc h3 { text-align: center; font-size: 13px; margin: 4px 0 10px; text-decoration: underline; }
.doc table { width: 100%; border-collapse: collapse; }
.doc table th, .doc table td { border: 1px solid #555; padding: 3px 5px; vertical-align: top; }
.doc table th { background: #dbe5f5; }
.doc td.num, .doc th.num { text-align: right; white-space: nowrap; }
/* rooms side by side (Basis of Design, room-wise BOQ quantities): fixed widths, names wrap, so 8 rooms fit a page */
.doc table.rooms { table-layout: fixed; font-size: 10px; line-height: 1.25; }
.doc table.rooms th, .doc table.rooms td { padding: 2px 4px; }
.doc table.rooms th, .doc table.rooms td { overflow-wrap: anywhere; }
.doc table.rooms th.num, .doc table.rooms td.num { white-space: normal; text-align: center; }
.doc table.rooms tr { break-inside: avoid; }
.doc .spec { white-space: pre-wrap; }
.doc .usp li { margin-bottom: 6px; }
.doc .sign { margin-top: 30px; }
.doc .sign .space { height: 50px; }
.doc .landscape { }
.print-bar { position: sticky; top: 0; background: #12284d; color: #fff; padding: 8px 16px; display: flex; gap: 10px; align-items: center; z-index: 10; }
/* stamp and signatures on approved documents */
.doc img.sig { display: block; max-height: 46px; max-width: 160px; margin: 0 auto 2px; }
.doc img.stamp { display: block; height: 78px; margin: 0 auto 2px; opacity: .93; }
.doc .sign .space.signed { height: auto; min-height: 50px; display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.doc .sign .space.signed img { margin: 0; }
.doc .signame { font-size: 11px; }
/* 🧊 CAD drawing in 3D */
.p3-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
@media (max-width: 900px) { .p3-wrap { grid-template-columns: 1fr; } }
.p3-stage { position: relative; height: calc(100vh - 150px); min-height: 420px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border, #dbe2ee);
  background: radial-gradient(ellipse at 50% 18%, #ffffff 0%, #eef2f7 42%, #d5dce6 100%); box-shadow: inset 0 0 60px rgba(40, 60, 90, .08); }
.p3-stage canvas { display: block; width: 100%; height: 100%; }
.p3-fs { position: absolute; top: 10px; right: 10px; z-index: 3; width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgba(160, 175, 195, .6); background: rgba(255, 255, 255, .92); color: #15202f; font-size: 18px; cursor: pointer; box-shadow: 0 4px 12px rgba(20, 35, 60, .15); }
.p3-fs:hover { background: #fff; }
/* full screen: 3D + side panel fill the screen */
.p3-wrap:fullscreen, .p3-wrap.p3-full { background: var(--bg, #0f1722); padding: 10px; gap: 10px; }
.p3-wrap.p3-full { position: fixed; inset: 0; z-index: 1000; }
.p3-wrap:fullscreen .p3-stage, .p3-wrap.p3-full .p3-stage { height: calc(100vh - 20px); }
.p3-wrap:fullscreen .p3-side, .p3-wrap.p3-full .p3-side { max-height: calc(100vh - 20px); }
@media (max-width: 900px) { .p3-wrap:fullscreen, .p3-wrap.p3-full { grid-template-columns: 1fr; overflow: auto; } .p3-wrap:fullscreen .p3-stage, .p3-wrap.p3-full .p3-stage { height: 75vh; } }
.p3-status { position: absolute; inset: 0; display: grid; place-items: center; color: #4b5a70; font-weight: 600; padding: 20px; text-align: center; }
.p3-label.pick { pointer-events: auto; cursor: pointer; }
.p3-go3d { display: block; width: 100%; margin-top: 3px; font: inherit; font-size: 11px; font-weight: 700; color: #fff; background: #2563c9; border: 0; border-radius: 5px; padding: 2px 6px; cursor: pointer; }
.p3-go3d:hover { background: #1f4e9a; }
.p3-legend { position: absolute; left: 10px; bottom: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; background: rgba(255, 255, 255, .92); color: #15202f; font: 600 11px system-ui, 'Segoe UI', sans-serif; box-shadow: 0 2px 8px rgba(20, 35, 60, .15); pointer-events: none; }
.p3-legend span { width: 12px; height: 12px; border-radius: 3px; } .p3-legend .b { background: #2563c9; } .p3-legend .g { background: #1e9e5a; margin-left: 6px; }
.p3-otlist { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow: auto; margin-top: 6px; }
.p3-otrow { border: 1px solid var(--border); border-radius: 8px; padding: 5px 7px; }
.p3-otrow.on { border-color: #2f9bff; box-shadow: 0 0 0 1px #2f9bff; }
.p3-otline { display: flex; align-items: center; gap: 6px; }
.p3-otname { flex: 1; min-width: 0; font: inherit; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; padding: 0; }
.p3-otname b { font-size: 12px; } .p3-otname small { display: block; color: var(--muted); }
.p3-label.pick:hover { background: #dcebff; }
.p3-pickbox { border: 1px solid var(--border); }
.p3-pickbox.on { border-color: #2f9bff; box-shadow: 0 0 0 2px rgba(47, 155, 255, .25); }
.p3-pickhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p3-x { font: inherit; font-size: 18px; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 6px; }
.p3-cap { display: block; margin: 10px 0 4px; color: var(--muted); font-weight: 600; }
.p3-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.p3-chip { font: inherit; font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.p3-chip.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.p3-sws { display: flex; flex-wrap: wrap; gap: 6px; }
.p3-sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.p3-sw.on { border-color: var(--brand-2); box-shadow: 0 0 0 2px var(--brand-2); }
.p3-finlist { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.p3-studio { position: fixed; inset: 0; z-index: 1100; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 10px; padding: 10px; background: var(--bg, #0f1722); }
.p3-studio-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.p3-studio-main .p3-othead { position: relative; padding-right: 40px; }
.p3-studio-main .p3-othead .p3-x { position: absolute; right: 8px; top: 6px; font-size: 22px; color: #4b5a70; }
.p3-studio-main .eq-3d { flex: 1; height: auto; min-height: 0; border-radius: 0; }
.p3-studio-side { overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; color: var(--text); }
@media (max-width: 900px) { .p3-studio { grid-template-columns: 1fr; overflow: auto; align-content: start; } .p3-studio-main .eq-3d { flex: none; height: 62vh; } .p3-studio-side { overflow: visible; } }
.p3-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.p3-label { position: absolute; left: 0; top: 0; background: rgba(255, 255, 255, .93); color: #15202f; border: 1px solid rgba(160, 175, 195, .55); border-left: 3px solid #7b8798; border-radius: 7px; padding: 3px 8px; font: 600 11px/1.25 system-ui, 'Segoe UI', sans-serif; letter-spacing: .01em; text-align: center; white-space: nowrap; box-shadow: 0 4px 14px rgba(20, 35, 60, .14); backdrop-filter: blur(4px); }
.p3-label.k-ot { border-left-color: #2563c9; background: rgba(238, 245, 255, .95); }
.p3-label.k-ot b { color: #1f4e9a; }
.p3-label.k-cor { border-left-color: #94a3b8; }
.p3-label.k-store { border-left-color: #d08a1c; }
.p3-label.k-shaft { border-left-color: #8b5cf6; }
.p3-label.k-wet { border-left-color: #0f9d8a; }
.p3-label b { display: block; font-size: 11px; }
.p3-label span { color: #4b5a70; font-size: 10px; }
.p3-side { max-height: calc(100vh - 150px); overflow: auto; }
.p3-box { background: var(--surface, #fff); border: 1px solid var(--border, #dbe2ee); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.p3-box > b { display: block; margin-bottom: 6px; }
.p3-box select { width: 100%; margin-top: 6px; }
.p3-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.p3-otbtn { width: 100%; margin-top: 8px; background: #eef5ff; border-color: #2563c9; color: #1f4e9a; font-weight: 700; }
.p3-othead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; background: #fff; color: #15202f; padding: 10px 14px; border-radius: 12px 12px 0 0; }
.p3-othead b { font-size: 16px; }
.p3-othead span { color: #4b5a70; font-size: 13px; }
.vmodal .vmodal-in > .eq-3d { border-radius: 0; }
.p3-otbar { background: #fff; padding: 8px 10px; border-radius: 0 0 12px 12px; gap: 6px; }
.p3-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; }
.p3-row > span:first-child { min-width: 64px; color: var(--text-2, #4b5a70); }
.p3-layers { width: 100%; font-size: 12px; border-collapse: collapse; }
.p3-layers td { padding: 3px 4px; border-bottom: 1px solid var(--border, #eef1f6); vertical-align: middle; }
.p3-layers select { margin: 0; font-size: 12px; padding: 2px; }
.p3-lname { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media print {
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block !important; }
  .print-bar { display: none !important; }
  .doc .page { padding: 0; }
  @page { size: A4; margin: 12mm; }
  @page wide { size: A4 landscape; margin: 10mm; }
  .doc .page.landscape { page: wide; }
  @page gantt { size: A3 landscape; margin: 8mm; }
  .doc .page.gantt { page: gantt; }
}
@media screen {
  .print-root .doc { max-width: 1100px; margin: 16px auto; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
  .print-root { min-height: 100vh; background: #e5e7eb; }
}

/* ---------------------------------------------------------------- Project Planner (Gantt) */
.kpis.tight { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpis.tight .kpi { padding: 8px 10px; }
.gantt-wrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 300px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.gantt { border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.gantt th, table.gantt td { border-bottom: 1px solid var(--grid); padding: 0 4px; height: 27px; white-space: nowrap; background: var(--surface); }
table.gantt thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); color: var(--text-2); text-align: left; height: 38px; border-bottom: 1px solid var(--border); }
table.gantt .sticky { position: sticky; z-index: 2; }
table.gantt thead th.sticky { z-index: 4; }
table.gantt .c-sr { left: 0; width: 34px; min-width: 34px; text-align: right; }
table.gantt .c-name { left: 34px; width: 270px; min-width: 270px; max-width: 270px; overflow: hidden; text-overflow: ellipsis; }
table.gantt .c-party { left: 304px; width: 76px; min-width: 76px; }
table.gantt .c-days { left: 380px; width: 44px; min-width: 44px; text-align: right; }
table.gantt .c-after { left: 424px; width: 66px; min-width: 66px; }
table.gantt .c-start { left: 490px; width: 56px; min-width: 56px; }
table.gantt .c-finish { left: 546px; width: 56px; min-width: 56px; }
table.gantt .c-pct { left: 602px; width: 44px; min-width: 44px; text-align: right; border-right: 1px solid var(--border); }
table.gantt td.c-finish.bad { color: var(--bad); font-weight: 600; }
table.gantt td.c-time, table.gantt th.c-time { padding: 0; }
table.gantt input, table.gantt select { padding: 2px 4px; border-color: transparent; background: transparent; font-size: 12px; height: 24px; }
table.gantt input:hover, table.gantt select:hover { border-color: var(--border); }
table.gantt td.c-name input { width: calc(100% - 4px); }
table.gantt .who { color: var(--muted); font-size: 11px; margin-left: 4px; }
table.gantt tr.phase td { background: var(--surface-2); font-weight: 600; }
table.gantt tr.done td:not(.c-time) { color: var(--muted); }
table.gantt .fold { border: 0; background: none; cursor: pointer; color: var(--text-2); padding: 0 4px 0 0; font-size: 12px; }
.gt { position: relative; height: 27px; }
.gh-row { position: relative; height: 19px; }
.gh-cell { position: absolute; top: 0; height: 19px; line-height: 19px; font-size: 11px; padding-left: 3px; border-left: 1px solid var(--border); overflow: hidden; color: var(--text-2); font-weight: 600; }
.gh-row.ticks .gh-cell { font-weight: 400; color: var(--muted); }
.gh-cell.sun { background: var(--neutral-bg); }
.gb, .gb-base, .gb-phase, .gb-ms, .gb-label, .g-today { position: absolute; }
.gb { top: 6px; height: 13px; border-radius: 3px; background: var(--bar); overflow: hidden; box-sizing: border-box; }
.gb .gb-prog { height: 100%; background: rgba(0,0,0,.35); }
.gb.p-Client { background: #d97706; } .gb.p-Vendor { background: #7c3aed; } .gb.p-PMC, .gb.p-Other { background: #64748b; }
.gb.late { background: #dc2626; }
.gb.crit { box-shadow: inset 0 0 0 2px #7f1d1d; }
.gb.done { opacity: .55; }
.gb-base { top: 21px; height: 4px; border-radius: 2px; background: #94a3b8; }
.gb-phase { top: 9px; height: 7px; background: var(--text); border-radius: 1px; }
.gb-ms { top: 3px; font-size: 15px; line-height: 18px; color: var(--text); } .gb-ms.late { color: #dc2626; }
.gb-label { top: 6px; font-size: 11px; color: var(--bad); font-weight: 600; }
.g-today { top: 0; bottom: 0; width: 0; border-left: 2px solid #dc2626; opacity: .7; }
.party { font-size: 11px; padding: 1px 6px; border-radius: 8px; color: #fff; background: var(--bar); }
.party.p-Client { background: #d97706; } .party.p-Vendor { background: #7c3aed; } .party.p-PMC, .party.p-Other { background: #64748b; }
.gantt-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; margin-top: 8px; }
.gantt-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.gantt-legend .lg > span:first-child { position: static; display: inline-block; width: 22px; }
.gantt-legend .gb { height: 10px; } .gantt-legend .gb-base { height: 4px; }
/* printed bar chart */
.doc .page.gantt { padding: 6mm; font-size: 9px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.gp-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.gp-head .gp-title { flex: 1; min-width: 150mm; text-align: center; }
.gp-info { width: 120mm; } .gp-legend { width: 34mm; }
.print-root .doc:has(.page.gantt) { max-width: none; width: 420mm; }
.gp-info, .gp-legend { border-collapse: collapse; font-size: 9px; }
.gp-info th, .gp-info td, .gp-legend td { border: 1px solid #888; padding: 1px 5px; text-align: left; }
.gp-info th { background: #eef2f7; }
.gp-legend .sw { display: inline-block; width: 18px; height: 8px; }
table.gp { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.gp th, table.gp td { border: 1px solid #999; padding: 1px 2px; vertical-align: middle; }
table.gp th { background: #12284d; color: #fff; font-weight: 600; text-align: center; }
table.gp th.wk { font-size: 7px; font-weight: 400; padding: 1px 0; }
table.gp td.c { text-align: center; } table.gp td.late { color: #b42318; font-weight: 700; }
table.gp tr.phase td { background: #e8edf5; }
table.gp td.w { padding: 0; height: 13px; position: relative; }
table.gp .wb { position: absolute; left: 0; right: 0; top: 1px; height: 2px; background: #94a3b8; }
table.gp .wf { position: absolute; left: 0; right: 0; top: 4px; bottom: 2px; }
table.gp td.rm { font-size: 8px; white-space: normal; }
.wf.p-WIESPL, .gp-legend .sw.p-WIESPL { background: #2563c9; } .wf.p-Client, .gp-legend .sw.p-Client { background: #f59e0b; }
.wf.p-Vendor, .wf.p-PMC, .wf.p-Other, .gp-legend .sw.p-Vendor { background: #7c3aed; } .gp-legend .sw.base { background: #94a3b8; height: 3px; }
.wf.late { background: #dc2626 !important; } .wf.phase { background: #1b2433; top: 5px; bottom: 5px; }
.wf.ms { background: none !important; } .wf.ms::after { content: '◆'; position: absolute; left: 0; right: 0; top: -3px; text-align: center; font-size: 9px; color: #1b2433; }
.gp-sign { display: flex; gap: 30px; margin-top: 18px; font-size: 9px; }
.gp-sign > div { flex: 1; text-align: center; } .gp-sign .line { border-bottom: 1px solid #333; height: 26px; margin-bottom: 3px; }

/* language switch */
.lang-btn { font-weight: 700; }
.login-lang { margin-top: 10px; align-self: center; }
html[lang="mr"] body { font-family: "Segoe UI", "Nirmala UI", "Noto Sans Devanagari", "Mangal", system-ui, sans-serif; }

/* Control Panels & OR App page */
@keyframes pnUp { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pnPop { 0% { opacity: 0; transform: scale(.3); } 70% { transform: scale(1.25); } 100% { opacity: 1; transform: none; } }
@keyframes pnSpin { to { transform: rotate(360deg); } }
@keyframes pnPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } }
@keyframes pnGlow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pnCap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pnShine { from { background-position: -200% 0; } to { background-position: 200% 0; } }

/* the 3D stage */
.pn3 { position: relative; height: min(68vh, 560px); min-height: 380px; border-radius: 18px; overflow: hidden; margin-bottom: 16px;
  background: radial-gradient(120% 90% at 30% 15%, #1d3b63 0%, #0b1a2e 55%, #050c16 100%); box-shadow: 0 18px 50px rgba(5,12,22,.45), inset 0 0 0 1px rgba(255,255,255,.06); isolation: isolate; }
.pn3::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 40% at 50% 0%, rgba(91,155,255,.18), transparent 70%); animation: pnGlow 6s ease-in-out infinite; }
.pn3-stage { position: absolute; inset: 0; }
.pn3-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.pn3-stage canvas.pn3-flat { width: auto; height: auto; max-width: 92%; max-height: 70%; margin: 70px auto 0; border-radius: 14px; border: 10px solid #f6f8fb; box-shadow: 0 20px 40px rgba(0,0,0,.5); }
.pn3-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: #cfe0ff; font-weight: 600; }
.pn3-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: #5b9bff; animation: pnSpin .8s linear infinite; }
.pn3-tag { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: #fff;
  padding: 4px 10px; border-radius: 999px; background: rgba(37,99,201,.85); box-shadow: 0 6px 18px rgba(0,0,0,.35); backdrop-filter: blur(6px); transition: opacity .3s; }
.pn3-tag.out { background: rgba(92,184,92,.88); }
.pn3-top { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 3; }
.pn3-vers { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pn3-vers::-webkit-scrollbar { display: none; }
.pn3-ver, .pn3-chip, .pn3-btn { font: inherit; cursor: pointer; color: #e6efff; border: 1px solid rgba(255,255,255,.14); background: rgba(12,26,46,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .18s, background .18s, border-color .18s, box-shadow .18s; }
.pn3-ver { display: flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: 12px; white-space: nowrap; }
.pn3-ver b { color: #8fb8ff; } .pn3-ver span { font-size: 13px; }
.pn3-ver:hover, .pn3-chip:hover, .pn3-btn:hover { transform: translateY(-2px); background: rgba(37,99,201,.45); border-color: rgba(143,184,255,.6); }
.pn3-ver.on, .pn3-chip.on { background: linear-gradient(135deg, #2563c9, #1f4e9a); border-color: #8fb8ff; box-shadow: 0 6px 20px rgba(37,99,201,.5); }
.pn3-ver.on b { color: #fff; }
.pn3-side { position: absolute; right: 12px; top: 64px; z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.pn3-btn { padding: 7px 12px; border-radius: 10px; font-size: 13px; text-align: left; }
.pn3-btn.danger { border-color: rgba(239,68,68,.6); animation: pnPulse 2.4s infinite; }
.pn3-btn.danger:hover { background: rgba(239,68,68,.45); }
.pn3-btn:disabled { opacity: .7; cursor: default; animation: none; }
.pn3-bottom { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3; display: flex; flex-direction: column; gap: 8px; }
.pn3-cap { align-self: flex-start; max-width: min(560px, 100%); padding: 9px 14px; border-radius: 12px; color: #e6efff; background: rgba(8,18,32,.62); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.1); }
.pn3-cap b { display: block; font-size: 15px; } .pn3-cap span { font-size: 13px; color: #b8c9e4; }
.pn3-cap.pop { animation: pnCap .45s both; }
.pn3-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.pn3-chips::-webkit-scrollbar { display: none; }
.pn3-chip { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; white-space: nowrap; font-size: 13px; }
.pn3-hint { position: absolute; right: 14px; bottom: 112px; z-index: 2; font-size: 11px; color: rgba(220,232,255,.55); pointer-events: none; }
@media (max-width: 700px) {
  .pn3 { height: 74vh; min-height: 460px; }
  .pn3-side, .pn3.is-surgery .pn3-side { top: 104px; right: 12px; left: 12px; flex-direction: row; flex-wrap: wrap; }
  .pn3-btn { padding: 6px 10px; font-size: 12px; }
  .pn3-hint { display: none; }
}

.pn3 [hidden] { display: none !important; }
.pn3-modes { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(8,18,32,.6); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(10px); margin-bottom: 8px; }
.pn3-mode { font: inherit; font-size: 13px; font-weight: 700; color: #cfe0ff; background: none; border: 0; padding: 7px 14px; border-radius: 10px; cursor: pointer; transition: background .2s, color .2s; }
.pn3-mode:hover { background: rgba(255,255,255,.08); }
.pn3-mode.on { background: linear-gradient(135deg, #2563c9, #5cb85c); color: #fff; box-shadow: 0 6px 18px rgba(37,99,201,.45); }
.pn3-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 11px; font-weight: 800; }
.pn3-chip.on .pn3-n { background: #fff; color: #1f4e9a; }
.pn3.is-surgery .pn3-side { top: 66px; }
.pn-orcard { border-color: var(--brand-2); background: linear-gradient(135deg, var(--info-bg), var(--surface) 60%); }
.pn-orsteps { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.pn-orsteps li { animation: pnUp .5s both; }
.pn-orstep { width: 100%; height: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); transition: transform .2s, border-color .2s, box-shadow .2s; }
.pn-orstep:hover { transform: translateY(-3px); border-color: var(--brand-2); box-shadow: 0 10px 24px rgba(16,24,40,.14); }
.pn-orstep b { display: block; } .pn-orstep span:not(.pn-fnum) { font-size: 13px; color: var(--text-2); }
.pn-orstep .pn-fnum { background: var(--brand-2); }

/* counters */
.pn-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.pn-stat { animation: pnUp .55s both; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.pn-stat::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(91,155,255,.12) 50%, transparent 70%); background-size: 200% 100%; animation: pnShine 4s linear infinite; }
.pn-stat b { font-size: 28px; color: var(--brand-2); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pn-stat span { font-size: 13px; color: var(--muted); }
.pn-stat .pn-stat-ico { font-size: 20px; }

.pn-tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); }
.pn-in { animation: pnUp .55s both; }
.pn-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pn-card, .pn-mod { animation: pnUp .5s both; position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; will-change: transform; }
.pn-card::after, .pn-mod::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; background: radial-gradient(240px circle at var(--gx, 50%) var(--gy, 50%), rgba(91,155,255,.18), transparent 60%); }
.pn-card:hover::after, .pn-mod:hover::after { opacity: 1; }
.pn-card:hover, .pn-mod:hover { box-shadow: 0 14px 30px rgba(16,24,40,.16); border-color: var(--brand-2); }
.pn-card { text-align: left; font: inherit; color: inherit; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; }
.pn-card.on { border-color: var(--brand-2); background: var(--info-bg); box-shadow: 0 0 0 2px var(--brand-2) inset; }
.pn-card > span { font-size: 13px; color: var(--text-2); }
.pn-card .pn-meta { font-size: 12px; color: var(--muted); }
.pn-go { font-size: 12px !important; font-weight: 700; color: var(--brand-2) !important; margin-top: 4px; transition: transform .2s; display: inline-block; }
.pn-card:hover .pn-go, .pn-mod:hover .pn-go { transform: translateX(4px); }
.pn-tag { align-self: flex-start; background: linear-gradient(135deg, #2563c9, #5cb85c); color: #fff !important; font-weight: 700; font-size: 11px !important; border-radius: 999px; padding: 2px 10px; }
.pn-table th.pn-col { text-align: center; min-width: 92px; cursor: pointer; }
.pn-table th.pn-col:hover { color: var(--brand-2); }
.pn-table th.pn-col b, .pn-table th.pn-col small { display: block; } .pn-table th.pn-col small { font-weight: 400; color: var(--muted); }
.pn-table td.pn-v { text-align: center; white-space: nowrap; animation: pnPop .4s both; }
.pn-table td.pn-v.yes { color: var(--good); font-weight: 700; font-size: 15px; } .pn-table td.pn-v.no { color: var(--muted); } .pn-table td.pn-v.part { color: var(--warn); font-size: 12px; white-space: normal; }
.pn-table .pick { background: var(--info-bg); transition: background .3s; }
.pn-table tr.pn-group td { background: var(--neutral-bg); font-weight: 700; color: var(--brand); }
.pn-table tbody tr:not(.pn-group):hover td { background: var(--surface-2); }
.pn-hint { display: block; color: var(--muted); }
.pn-table tbody td:first-child, .pn-table thead th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 150px; }
.pn-table tr.pn-group td:first-child { background: var(--neutral-bg); }
.pn-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.pn-mod { font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; gap: 12px; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); }
.pn-mod p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.pn-ico { font-size: 26px; line-height: 1; transition: transform .25s; }
.pn-mod:hover .pn-ico { transform: scale(1.2) rotate(-6deg); }
.pn-fhead { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.pn-fsteps { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; counter-reset: s; }
.pn-fstep { display: flex; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); transition: all .35s; position: relative; }
.pn-fstep b { display: block; } .pn-fstep span { font-size: 13px; color: var(--text-2); }
.pn-fnum { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff !important; background: var(--muted); font-size: 13px !important; transition: background .3s; }
.pn-fstep.on { border-color: var(--bad); background: var(--bad-bg); transform: translateY(-3px); animation: pnPulse 1.2s infinite; }
.pn-fstep.on .pn-fnum { background: var(--bad); }
.pn-fstep.done { border-color: var(--good); } .pn-fstep.done .pn-fnum { background: var(--good); }
.pn-reqs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.pn-req { animation: pnUp .5s both; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.pn-req b { display: block; color: var(--brand-2); } .pn-req span { font-size: 13px; color: var(--text-2); }
.pn-demo { counter-reset: d; list-style: none; padding: 0; margin: 0; }
.pn-demo li { animation: pnUp .5s both; counter-increment: d; position: relative; padding: 8px 0 8px 44px; border-left: 2px solid var(--border); margin-left: 14px; }
.pn-demo li::before { content: counter(d); position: absolute; left: -15px; top: 6px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-2); color: #fff; font-weight: 800; font-size: 13px; }
.pn-safe { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 9px 13px; margin: 12px 0 0; }
.pn-phead { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; } .pn-phead b, .pn-phead span { display: block; } .pn-phead b { font-size: 18px; color: #1f4e9a; }
.pn-print .card { box-shadow: none; break-inside: avoid; animation: none; } .pn-print .pn-card, .pn-print .pn-mod { break-inside: avoid; animation: none; }
.pn-print .pn-go, .pn-print .pn-fhead .btn { display: none; } .pn-print td.pn-v { animation: none; }
@media print { .pn-print .pn-mods, .pn-print .pn-cards { grid-template-columns: 1fr 1fr; } .pn-print .table-wrap { overflow: visible; } }
@media (prefers-reduced-motion: reduce) {
  .pn3::after, .pn3-btn.danger, .pn-stat::before, .pn-fstep.on { animation: none; }
  .pn-in, .pn-card, .pn-mod, .pn-stat, .pn-req, .pn-demo li, .pn-table td.pn-v, .pn3-cap.pop { animation: none; }
}

/* PO sign-offs: smaller signatures, the stamp beside the purchase signature */
.doc table.po-sign img.sig { max-height: 30px; max-width: 105px; margin: 0 0 2px; }
.doc table.po-sign img.stamp { height: 52px; margin: 0 0 2px; }

/* ---------------------------------------------------------------- the look: menu, top bar, cards and tables */
:root { --bg: #f4f6fb; --border: #e2e7f0; --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 8px rgba(16,24,40,.05); --shadow-up: 0 4px 16px rgba(16,24,40,.10); }
body { -webkit-font-smoothing: antialiased; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* menu */
.sidebar { width: 252px; background: linear-gradient(180deg, #10264a 0%, #0c1d3a 100%); display: flex; flex-direction: column; overflow: hidden; }
.brand { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); flex: none; }
.brand img { border-radius: 9px; }
.nav-find { padding: 12px 12px 6px; flex: none; }
.nav-find input { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 9px; padding: 8px 11px; font-size: 13px; }
.nav-find input::placeholder { color: #a5b6d3; }
.nav-find input:focus { background: rgba(255,255,255,.13); outline: none; border-color: #7fa8ea; }
#nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 16px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
#nav a { padding: 8px 10px; border-left: 0; border-radius: 8px; font-size: 13.5px; line-height: 1.3; margin-bottom: 1px; align-items: center; transition: background .12s, color .12s; }
#nav a:hover { background: rgba(255,255,255,.08); }
#nav a.active { background: #2563c9; color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(37,99,201,.45); }
.nav-group { border-top: 1px solid rgba(255,255,255,.06); }
#nav > a + .nav-group { margin-top: 8px; }
.nav-group .grp { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px; border-radius: 8px; cursor: pointer; color: #dbe5f5; font-size: 13px; font-weight: 600; }
.nav-group .grp:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-group .grp:focus-visible { outline: 2px solid #7fa8ea; outline-offset: -2px; }
.nav-group .grp > span:first-child { flex: 1; }
.nav-group .grp::after { content: ""; flex: none; width: 7px; height: 7px; margin-right: 3px; border-right: 2px solid #8ea4c8; border-bottom: 2px solid #8ea4c8; transform: rotate(-45deg); transition: transform .15s; }
.nav-group .grp .count { background: #e8590c; color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 600; }
.nav-group.open .grp::after { transform: rotate(45deg); }
.nav-group.open .grp .count { display: none; }
.nav-links { display: none; padding: 0 0 8px; }
.nav-group.open .nav-links { display: block; }
.nav-backdrop { display: none; }

/* top bar */
.topbar { padding: 10px 24px; box-shadow: 0 1px 0 var(--border); border-bottom: 0; }
.global-search input { border-radius: 999px; padding: 8px 14px 8px 34px; background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a8699' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E") no-repeat 12px center; }
.user-box { flex: none; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; max-width: 260px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu #user-name { overflow: hidden; text-overflow: ellipsis; }
.user-pop { position: absolute; right: 0; top: calc(100% + 6px); display: grid; gap: 2px; min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-up); z-index: 20; }
.user-pop .btn { border: 0; background: none; justify-content: flex-start; padding: 8px 10px; font-size: 13px; border-radius: 7px; }
.user-pop .btn:hover { background: var(--surface-2); }

/* page */
.view { padding: 24px; }
.page-head { margin-bottom: 18px; }

/* controls */
input, select, textarea { border-radius: 8px; padding: 8px 10px; }
.btn { border-radius: 8px; font-weight: 500; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { box-shadow: 0 1px 2px rgba(37,99,201,.35); }
.btn.primary:hover { background: #1f55ad; border-color: #1f55ad; }
.btn.good:hover { background: #18682f; }
.btn.danger.solid:hover { background: #961d13; }
.btn.small { border-radius: 7px; }

/* cards */
.card { padding: 18px; }
.card.flush { padding: 0; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpi { padding: 16px; transition: box-shadow .15s, transform .15s; }
a.kpi:hover { box-shadow: var(--shadow-up); transform: translateY(-1px); }
.kpi .label { font-weight: 600; color: var(--text-2); }
.kpi .value { font-size: 22px; margin-top: 4px; overflow-wrap: anywhere; line-height: 1.2; }
.kpi .sub { margin-top: 2px; color: var(--muted); }
.tabs { scrollbar-width: thin; }
.tabs button { border-radius: 8px 8px 0 0; transition: color .12s, background .12s; }
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.modal { border-radius: 14px; }

/* tables */
table.data th { font-size: 12px; padding: 10px 12px; color: var(--muted); }
table.data td { padding: 9px 12px; }
table.data td.nowrap { font-weight: 600; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--brand-2) 5%, transparent); }
.badge { padding: 2px 9px; border-radius: 999px; }

/* sign-in */
.login { background: radial-gradient(1000px 600px at 15% 10%, #2a6fd0 0%, transparent 60%), radial-gradient(900px 600px at 95% 95%, #1e8a5c 0%, transparent 55%), #0f2342; }
.login-card { border-radius: 16px; padding: 32px; box-shadow: 0 24px 70px rgba(5,15,35,.45); }
.login-card .btn.primary { justify-content: center; padding: 10px 14px; }

@media (max-width: 900px) {
  .sidebar { width: min(290px, 84vw); left: calc(-1 * min(290px, 84vw) - 10px); }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar.open + .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(10,20,40,.45); }
  #nav a, .nav-group .grp { padding-top: 11px; padding-bottom: 11px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .global-search { min-width: 0; }
  .user-box { gap: 4px; }
  .view { padding: 16px 12px; }
}
@media (max-width: 700px) {
  .user-menu #user-name { display: none; }
  .page-head .actions { margin-left: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Every register reads as cards on a phone; only rows with a details arrow need room for it */
  table.data.cards tr.clickable:not(:has(td.expander)) { padding-left: 12px; }
  table.data.cards tfoot { display: block; }
  table.data.cards td.nowrap { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  a.kpi:hover { transform: none; }
}

/* 🚶 walking through the drawing */
.p3-joy { position: absolute; left: 18px; bottom: 18px; z-index: 4; width: 120px; height: 120px; border-radius: 50%; background: rgba(15, 30, 55, .28); border: 2px solid rgba(255, 255, 255, .7); touch-action: none; display: grid; place-items: center; backdrop-filter: blur(2px); }
.p3-joy span { width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .3); pointer-events: none; }
.p3-walkbar { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 999px; background: rgba(15, 30, 55, .78); color: #fff; font-size: 12px; white-space: nowrap; }
.p3-walkbar .btn { background: #fff; color: #12284d; border: 0; }
.p3-walking canvas { cursor: grab; }
.p3-walking .p3-legend { display: none; }
@media (hover: hover) and (pointer: fine) { .p3-joy { display: none; } }
@media (pointer: coarse) { .p3-walkhint { display: none; } }
/* 🎬 explainer tour of a CAD drawing (plan3d-tour.js): its captions, cards and logo are drawn on .p3-tourov; the stop button */
.p3-tour { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.p3-tourov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.p3-tourstop { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); pointer-events: auto; background: rgba(15, 30, 55, .82); color: #fff; border: 0; }
.p3-filmbtns { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; pointer-events: auto; }
.p3-filmbtns .btn { background: rgba(15, 30, 55, .82); color: #fff; border: 0; }
.p3-filmnote { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); background: rgba(15, 30, 55, .82); color: #fff; padding: 6px 14px; border-radius: 14px; font-size: 13px; pointer-events: none; }
.p3-touring .p3-legend, .p3-touring .p3-joy, .p3-touring .p3-walkbar { display: none; }
.p3-tourbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.p3-tourbtns .muted { flex-basis: 100%; margin: 2px 0 0; font-size: 12px; }
.p3-recording canvas { object-fit: contain; background: #000; }
.p3-warn { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); z-index: 5; width: min(560px, calc(100% - 24px)); display: grid; gap: 6px; justify-items: start; padding: 12px 14px; border-radius: 12px; background: #fff8ec; border: 1px solid #e8a33d; color: #5c3d00; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); font-size: 13px; }
.p3-filmparts { display: grid; gap: 2px; }
.p3-filmpart { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.p3-filmpart select { font-size: 12px; padding: 2px 4px; }

/* 🤖 WIESPL AI: the quick panel on every screen (assistant.js), shared message styles (ai-core.js), the AI page (views/ai.js) */
.ai-fab { position: fixed; right: 20px; bottom: 20px; z-index: 34; width: 56px; height: 56px; border-radius: 50%; border: 0; font-size: 26px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-2), var(--accent)); color: #fff; box-shadow: 0 6px 18px rgba(16,24,40,.25); transition: transform .15s; }
.ai-fab:hover { transform: scale(1.06); }
body.ai-page .ai-fab, body.ai-page .ai-panel { display: none !important; }
.ai-panel { position: fixed; right: 20px; bottom: 88px; z-index: 35; width: min(460px, calc(100vw - 32px)); height: min(660px, calc(100vh - 120px));
  display: none; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgba(16,24,40,.25); overflow: hidden; }
.ai-panel.open { display: flex; }
.ai-panel header { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ai-panel header .grow { flex: 1; }
.ai-state { color: var(--good); } .ai-state.bad { color: var(--bad); }
.ai-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-hello { color: var(--text-2); font-size: 14px; } .ai-hello .btn { margin: 4px 4px 0 0; text-align: left; }
.ai-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.ai-input textarea { flex: 1; resize: none; min-height: 38px; max-height: 120px; }
.ai-mic.on, .ai-panel header .btn.on, .aip-head .btn.on { background: var(--bad-bg); border-color: var(--bad); }

/* one message (panel and page) */
.ai-msg { max-width: 92%; padding: 9px 13px; border-radius: 14px; line-height: 1.5; font-size: 14px; overflow-wrap: anywhere; }
.ai-msg.user { align-self: flex-end; background: var(--brand-2); color: #fff; white-space: pre-wrap; border-bottom-right-radius: 4px; }
.ai-msg.assistant { align-self: flex-start; background: var(--neutral-bg); color: var(--text); border-bottom-left-radius: 4px; }
.ai-msg.err { background: var(--bad-bg); color: var(--bad); }
.ai-msg p { margin: 0 0 6px; } .ai-msg p:last-child { margin-bottom: 0; } .ai-msg .ai-h { font-weight: 700; margin-top: 4px; }
.ai-msg ul, .ai-msg ol { margin: 4px 0 6px; padding-left: 20px; } .ai-msg li { margin: 2px 0; }
.ai-msg code { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.ai-table { overflow-x: auto; margin: 6px 0; }
.ai-msg table { border-collapse: collapse; font-size: 13px; background: var(--surface); }
.ai-msg th, .ai-msg td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.ai-msg th { background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.ai-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 2px; }
.ai-status.hidden { display: none; }
.ai-secs { font-variant-numeric: tabular-nums; opacity: .8; }
.ai-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--brand-2); animation: ai-spin .8s linear infinite; flex: none; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-src { margin-top: 8px; font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.ai-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--brand-2); text-decoration: none; white-space: nowrap; }
a.ai-chip:hover { border-color: var(--brand-2); }
span.ai-chip { color: var(--text-2); }
.ai-foot { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; }
.ai-foot small { margin-left: 4px; }
.ai-mini { border: 0; background: none; color: var(--muted); font-size: 12px; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.ai-mini:hover { background: var(--surface); color: var(--text); }
.ai-settings { display: grid; gap: 10px; } .ai-field { display: grid; gap: 3px; } .ai-info { display: grid; gap: 3px; font-size: 14px; }
.ai-docs ul { margin: 6px 0; padding-left: 18px; }

/* the AI page */
.nav-ai { font-weight: 600; }
.aip { --ai-1: #6d5dfc; --ai-2: #2563c9; --ai-3: #14b8a6; --ai-grad: linear-gradient(135deg, var(--ai-1), var(--ai-2) 55%, var(--ai-3));
  display: grid; grid-template-columns: 280px minmax(0, 1fr); height: calc(100dvh - 120px); min-height: 460px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: 0 10px 40px rgba(16,24,40,.12); }
/* sidebar */
.aip-side { display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; background: var(--surface-2); border-right: 1px solid var(--border); min-height: 0; }
.aip-brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 6px; }
.aip-brand b { font-size: 15px; letter-spacing: .01em; } .aip-brand small { display: block; color: var(--muted); font-size: 11.5px; }
.aip .aip-new { width: 100%; justify-content: center; height: 40px; border: 0; border-radius: 12px; font-weight: 600; color: #fff; background: var(--ai-grad);
  box-shadow: 0 6px 18px rgba(79,70,229,.30); transition: transform .15s, box-shadow .15s; }
.aip .aip-new:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(79,70,229,.38); }
.aip-find { width: 100%; border-radius: 10px; padding: 8px 12px 8px 32px; background: var(--surface) no-repeat 10px 50% / 14px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238592a6' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
.aip-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.aip-day { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 8px 4px; }
.aip-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 13.5px; color: var(--text-2); position: relative; transition: background .12s; }
.aip-item::before { content: '💬'; font-size: 12px; opacity: .55; }
.aip-item:hover { background: var(--neutral-bg); color: var(--text); }
.aip-item.on { background: var(--info-bg); color: var(--text); font-weight: 600; }
.aip-item.on::after { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--ai-grad); }
.aip-item-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aip-x { border: 0; background: none; cursor: pointer; opacity: 0; font-size: 13px; padding: 0 2px; }
.aip-item:hover .aip-x, .aip-item.on .aip-x { opacity: .6; } .aip-x:hover { opacity: 1 !important; }
.aip-empty { color: var(--muted); font-size: 13px; padding: 14px 8px; text-align: center; }
.aip-note { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.45; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
/* the orb: the AI's face */
.aip-orb { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ai-grad); box-shadow: 0 4px 14px rgba(79,70,229,.35), inset 0 -4px 10px rgba(0,0,0,.18); }
.aip-orb::before { content: ''; position: absolute; inset: 22% 26% 46% 22%; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.85), rgba(255,255,255,0) 70%); }
.aip-orb.sm { width: 26px; height: 26px; }
.aip-orb.lg { width: 84px; height: 84px; animation: aip-float 5s ease-in-out infinite; box-shadow: 0 0 0 10px rgba(109,93,252,.08), 0 0 0 22px rgba(37,99,201,.05), 0 18px 50px rgba(79,70,229,.45), inset 0 -10px 24px rgba(0,0,0,.2); }
.aip-orb.lg::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid transparent; border-top-color: rgba(109,93,252,.7); border-right-color: rgba(20,184,166,.6); animation: ai-spin 3s linear infinite; }
.aip-orb.busy { animation: aip-pulse 1.2s ease-in-out infinite; }
@keyframes aip-float { 50% { transform: translateY(-6px); } }
@keyframes aip-pulse { 50% { transform: scale(.88); filter: brightness(1.25); } }
/* main */
.aip-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative;
  background: radial-gradient(900px 380px at 50% -120px, rgba(109,93,252,.12), transparent 70%), radial-gradient(600px 300px at 100% 100%, rgba(20,184,166,.06), transparent 70%), var(--surface); }
.aip-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); background: color-mix(in srgb, var(--surface) 80%, transparent); z-index: 1; }
.aip-head .grow { flex: 1; }
.aip-head .btn.small { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 10px; background: var(--surface); }
.aip-head .btn.small:hover { border-color: var(--ai-1); }
.aip-menu { display: none !important; }
.aip-titles { display: flex; flex-direction: column; min-width: 0; }
.aip-title { margin: 0; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aip-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.aip-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.aip-pill.bad::before { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.aip-log { flex: 1; overflow-y: auto; padding: 24px max(18px, calc((100% - 880px) / 2)) 12px; display: flex; flex-direction: column; gap: 18px; min-height: 0; scroll-behavior: smooth; }
/* messages on the page: the AI's with the orb, the person's in a gradient bubble */
.aip-log .ai-msg { font-size: 15px; max-width: 86%; animation: aip-in .25s ease-out; }
@keyframes aip-in { from { opacity: 0; transform: translateY(6px); } }
.aip-log .ai-msg.user { background: var(--ai-grad); border-radius: 18px 18px 4px 18px; padding: 10px 16px; box-shadow: 0 6px 18px rgba(79,70,229,.22); }
.aip-log .ai-msg.assistant { position: relative; margin-left: 44px; max-width: calc(92% - 44px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px; padding: 12px 16px; box-shadow: 0 2px 10px rgba(16,24,40,.06); }
.aip-log .ai-msg.assistant::before { content: ''; position: absolute; left: -44px; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--ai-grad);
  box-shadow: 0 4px 12px rgba(79,70,229,.30), inset 0 -4px 8px rgba(0,0,0,.18); }
.aip-log .ai-msg.assistant.live::before { animation: aip-pulse 1.2s ease-in-out infinite; }
.aip-log .ai-msg.err { background: var(--bad-bg); border-color: var(--bad); }
.aip-log .ai-table { border: 1px solid var(--border); border-radius: 10px; overflow: auto; margin: 8px 0; }
.aip-log .ai-msg table { width: 100%; font-size: 13.5px; border: 0; }
.aip-log .ai-msg th, .aip-log .ai-msg td { border: 0; border-bottom: 1px solid var(--border); padding: 7px 12px; }
.aip-log .ai-msg th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); }
.aip-log .ai-msg tr:last-child td { border-bottom: 0; }
.aip-log .ai-msg tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.aip-log .ai-msg tbody tr:hover td { background: var(--info-bg); }
.aip-log .ai-msg strong { color: var(--text); }
.aip-log .ai-src { padding-top: 8px; border-top: 1px dashed var(--border); }
.aip-log .ai-chip { background: var(--info-bg); border-color: transparent; font-weight: 500; }
.aip-log .ai-foot { opacity: .75; transition: opacity .15s; } .aip-log .ai-msg:hover .ai-foot { opacity: 1; }
/* "thinking": three bouncing dots */
.aip-log .ai-spin { width: 34px; height: 8px; border: 0; border-radius: 0; animation: none; background:
  radial-gradient(circle 4px, var(--ai-1) 95%, transparent) 0 50% / 10px 8px no-repeat,
  radial-gradient(circle 4px, var(--ai-2) 95%, transparent) 12px 50% / 10px 8px no-repeat,
  radial-gradient(circle 4px, var(--ai-3) 95%, transparent) 24px 50% / 10px 8px no-repeat; animation: aip-dots 1s infinite linear; }
@keyframes aip-dots { 0% { background-position: 0 50%, 12px 50%, 24px 50%; } 16% { background-position: 0 0, 12px 50%, 24px 50%; } 33% { background-position: 0 50%, 12px 0, 24px 50%; } 50% { background-position: 0 50%, 12px 50%, 24px 0; } 66%, 100% { background-position: 0 50%, 12px 50%, 24px 50%; } }
/* composer */
.aip-compose { padding: 10px max(18px, calc((100% - 880px) / 2)) 4px; }
.aip-box { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 8px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface);
  box-shadow: 0 8px 30px rgba(16,24,40,.10); transition: border-color .15s, box-shadow .15s; }
.aip-box:focus-within { border-color: var(--ai-1); box-shadow: 0 0 0 4px rgba(109,93,252,.14), 0 8px 30px rgba(16,24,40,.12); }
.aip-input { flex: 1; resize: none; min-height: 44px; max-height: 200px; font-size: 15px; padding: 11px 8px; border: 0 !important; outline: none; box-shadow: none !important; background: transparent; line-height: 1.4; }
.aip-box .ai-mic { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; border: 0; background: var(--neutral-bg); margin-bottom: 2px; }
.aip-send { width: 44px; height: 44px; padding: 0; justify-content: center; border: 0; border-radius: 14px; color: #fff; font-size: 18px; background: var(--ai-grad);
  box-shadow: 0 6px 16px rgba(79,70,229,.35); transition: transform .12s, opacity .12s; }
.aip-send:hover { transform: scale(1.05); } .aip-send:disabled { opacity: .4; transform: none; box-shadow: none; cursor: default; }
.aip-stop { height: 44px; padding: 0 16px; border-radius: 14px; background: var(--bad-bg); color: var(--bad); border-color: var(--bad); font-weight: 600; }
.aip-fine { text-align: center; font-size: 11px; color: var(--muted); padding: 6px 16px 12px; }
/* welcome */
.aip-welcome { margin: auto 0; display: flex; flex-direction: column; gap: 26px; padding: 14px 0 22px; }
.aip-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.aip-hero .aip-orb { margin-bottom: 14px; }
.aip-hero h1 { font-size: 30px; line-height: 1.2; margin: 0; letter-spacing: -.01em; font-weight: 700; }
.aip-grad { background: var(--ai-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.aip-hero p { margin: 0 auto; max-width: 580px; color: var(--text-2); font-size: 14.5px; }
.aip-feats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.aip-feats span { font-size: 12px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.aip-ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.aip-idea-group { --tone: var(--ai-2); display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.aip-idea-group::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tone); }
.aip-idea-group:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16,24,40,.10); border-color: color-mix(in srgb, var(--tone) 40%, var(--border)); }
.aip-idea-group:nth-child(5n+1) { --tone: #6d5dfc; } .aip-idea-group:nth-child(5n+2) { --tone: #f59e0b; } .aip-idea-group:nth-child(5n+3) { --tone: #14b8a6; }
.aip-idea-group:nth-child(5n+4) { --tone: #ec4899; } .aip-idea-group:nth-child(5n+5) { --tone: #2563c9; }
.aip-gh { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.aip-gi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--tone) 16%, transparent); }
.aip-gh b { font-size: 14px; color: var(--text); }
.aip-idea { display: flex; align-items: center; gap: 8px; text-align: left; border: 0; background: none; color: var(--text-2); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; cursor: pointer; line-height: 1.35; transition: background .12s, color .12s; }
.aip-idea span { flex: 1; }
.aip-idea::after { content: '→'; opacity: 0; transform: translateX(-4px); transition: opacity .12s, transform .12s; color: var(--tone); font-weight: 700; }
.aip-idea:hover { background: color-mix(in srgb, var(--tone) 10%, transparent); color: var(--text); }
.aip-idea:hover::after { opacity: 1; transform: none; }
@media (max-width: 860px) {
  .aip { grid-template-columns: 1fr; height: calc(100dvh - 96px); position: relative; border-radius: 14px; }
  .aip-side { position: absolute; inset: 0 auto 0 0; width: min(300px, 86%); z-index: 3; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 8px 30px rgba(16,24,40,.25); }
  .aip-side.open { transform: none; }
  .aip-menu { display: inline-flex !important; }
  .aip-hero h1 { font-size: 23px; }
  .aip-orb.lg { width: 64px; height: 64px; }
  .aip-log .ai-msg { max-width: 96%; font-size: 14.5px; }
  .aip-log .ai-msg.assistant { margin-left: 0; max-width: 100%; }
  .aip-log .ai-msg.assistant::before { display: none; }
}
@media print { .ai-fab, .ai-panel { display: none !important; } }
/* the order journey: a board of orders by phase, and one order's 41 steps in six columns */
.jr-board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.jr-col { background: var(--surface-2); border: 1px solid var(--border); border-top: 4px solid var(--ph); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.jr-colhead { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.jr-colhead .muted { font-size: 11.5px; }
.jr-no { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ph); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.jr-count { margin-left: auto; font-weight: 700; color: var(--ph); }
.jr-empty { font-size: 12px; margin: 4px 2px; }
.jr-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.jr-card:hover { border-color: var(--brand-2); }
.jr-title { font-weight: 600; font-size: 13.5px; display: flex; gap: 6px; align-items: baseline; justify-content: space-between; }
.jr-refs { font-size: 11.5px; margin-top: 2px; }
.jr-next { font-size: 12px; margin-top: 4px; }
.jr-done { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.jr-bar { height: 6px; background: var(--neutral-bg); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.jr-bar span { display: block; height: 100%; background: var(--good); }
.jr-bar.big { height: 10px; margin: 0 0 6px; }
.jr-late { color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 0 7px; font-size: 11.5px; font-weight: 600; margin-left: 6px; }
.jr-summary { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: center; }
.jr-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.jr-link { display: flex; flex-direction: column; gap: 3px; font-size: 13px; min-width: 0; }
.jr-link a { overflow-wrap: anywhere; }
.jr-link .btn { align-self: flex-start; }
.jr-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-2); margin: 4px 0 10px; }
.jr-legend span { display: inline-flex; align-items: center; gap: 6px; }
.jr-key { width: 14px; height: 10px; border-radius: 3px; border: 1.5px solid var(--border); background: var(--surface); display: inline-block; }
.jr-key.k-gate { background: var(--warn-bg); border-color: var(--warn); }
.jr-key.k-client { border-style: dashed; border-color: var(--muted); }
.jr-key.k-vendor { border-style: dashed; border-color: #7c3aed; }
.jr-key.k-site { background: var(--info-bg); border-color: var(--info); }
.jr-key.k-auto { background: var(--good-bg); border-color: var(--good); }
.jr-phases { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.jr-phase { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.jr-phasehead { display: flex; gap: 8px; align-items: center; background: var(--ph); color: #fff; border-radius: var(--radius); padding: 8px 10px; font-size: 12px; }
.jr-phasehead b { font-size: 14px; }
.jr-phasehead .jr-no { background: rgba(255,255,255,.25); }
.jr-step { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 8px 9px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.jr-step.k-gate { background: var(--warn-bg); border-color: var(--warn); }
.jr-step.k-client { border-style: dashed; border-color: var(--muted); }
.jr-step.k-vendor { border-style: dashed; border-color: #7c3aed; }
.jr-step.k-site { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 45%, transparent); }
.jr-step.st-done, .jr-sub.st-done { opacity: .78; }
.jr-step.st-na, .jr-sub.st-na { opacity: .55; }
.jr-step.is-next { outline: 2.5px solid var(--brand-2); outline-offset: 1px; opacity: 1; }
.jr-steph { display: flex; gap: 6px; align-items: flex-start; }
.jr-steph b, .jr-steph > span:not(.jr-chip):not(.jr-sno) { flex: 1; min-width: 0; }
.jr-sno { flex: none; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--neutral-bg); color: var(--text-2); font-weight: 700; font-size: 11px; display: grid; place-items: center; }
.jr-who { color: var(--text-2); font-size: 11.5px; }
.jr-hint { color: var(--muted); font-size: 11.5px; }
.jr-fact { font-size: 11.5px; color: var(--text-2); }
.jr-chip { flex: none; font-size: 10.5px; font-weight: 700; border-radius: 10px; padding: 1px 7px; white-space: nowrap; }
.jr-chip.ok { color: var(--good); background: var(--good-bg); }
.jr-chip.na { color: var(--muted); background: var(--neutral-bg); }
.jr-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.jr-subs { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.jr-sub { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 6px 7px; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 900px) {
  .jr-board, .jr-phases { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
  .jr-summary, .jr-links { grid-template-columns: minmax(0, 1fr); }
}
.jr-gapnote { font-size: 11.5px; color: var(--warn); margin-top: 3px; }
.jr-chip.gap { color: var(--warn); background: var(--warn-bg); }
.jr-step.is-gap { opacity: .7; border-style: dotted; }
.jr-raci { font-size: 11.5px; border-top: 1px dashed var(--border); padding-top: 4px; margin-top: 2px; display: flex; flex-direction: column; gap: 1px; color: var(--text-2); }
.jr-rk { display: inline-block; min-width: 58px; color: var(--muted); font-weight: 600; }
.jr-role { font-weight: 600; color: var(--text); }
.jr-role.nobody { color: var(--warn); text-decoration: underline dotted; }
.jr-raci-table td { vertical-align: top; font-size: 12.5px; }
.jr-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ph); margin-right: 6px; }

/* order journey: steps as tasks, team view */
.jr-task { font-size: 12px; margin-top: 4px; }
.jr-mine { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent, #2563eb); margin-top: 2px; }
.jr-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 12px; }
.jr-person { margin: 0; }
.jr-phead { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.jr-counts { margin-left: auto; font-size: 12px; }
.jr-ttask { font-size: 13px; padding: 4px 0; border-top: 1px solid var(--line, #e5e7eb); }
.jr-ttask.late a { color: var(--bad); }

/* order journey: approvals of gates */
.jr-approvals { font-size: 12px; margin-top: 4px; }
.jr-ap { padding: 1px 6px; border-radius: 10px; background: var(--chip, #f1f5f9); }
.jr-ap.ok { background: #dcfce7; color: #166534; }
.jr-ap.wait { background: #fef3c7; color: #92400e; }
.jr-ap.no { background: #fee2e2; color: #991b1b; }
.jr-apnote { font-size: 12px; color: #92400e; margin-top: 2px; }

/* order journey: documents of a step */
.jr-docs { font-size: 12px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.jr-docs.missing { color: #b45309; }
.jr-file { background: var(--chip, #f1f5f9); border-radius: 6px; padding: 1px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-x { border: 0; background: none; cursor: pointer; color: var(--muted, #64748b); padding: 0 0 0 4px; }

/* order journey: site plan and crew by day */
.jr-sitehead { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; }
.jr-sitehead h2 { margin: 0; }
.jr-crew { display: flex; gap: 3px; align-items: flex-end; overflow-x: auto; padding: 10px 0 4px; }
.jr-day { display: flex; flex-direction: column; align-items: center; min-width: 26px; font-size: 11px; }
.jr-day .jr-bar2 { width: 18px; background: #0369a1; border-radius: 3px 3px 0 0; }
.jr-day.unknown .jr-bar2 { background: repeating-linear-gradient(45deg, #0369a1, #0369a1 4px, #7dd3fc 4px, #7dd3fc 8px); }
.jr-day i { font-style: normal; color: var(--muted, #64748b); }
.jr-day em { font-style: normal; font-size: 10px; color: #7c3aed; }
.jr-plan { font-size: 12px; margin-top: 4px; }
.jr-crit { color: var(--bad, #dc2626); font-weight: 600; }

/* order journey: dashboard */
.jr-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.jr-kpi { display: flex; flex-direction: column; padding: 12px; border-radius: 10px; background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); color: inherit; text-decoration: none; }
.jr-kpi b { font-size: 26px; }
.jr-kpi span { font-size: 12px; color: var(--muted, #64748b); }
.jr-kpi.bad b { color: var(--bad, #dc2626); }
.jr-kpi.warn b { color: #b45309; }
.jr-kpi.ok b { color: #15803d; }
.jr-phasebars { display: grid; gap: 6px; }
.jr-pb { display: grid; grid-template-columns: minmax(120px, 240px) 1fr 40px; gap: 8px; align-items: center; font-size: 13px; }
.jr-pbtrack { background: var(--chip, #f1f5f9); border-radius: 6px; height: 14px; overflow: hidden; }
.jr-pbtrack span { display: block; height: 100%; }

/* order journey: pilot and role guide */
.jr-pilot { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em; background: #7c3aed; color: #fff; border-radius: 4px; padding: 1px 5px; margin-right: 6px; vertical-align: middle; }
.jr-checks { display: grid; gap: 8px; margin: 10px 0; }
.jr-check { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line, #e5e7eb); }
.jr-check > div { flex: 1; }
.jr-check.ok { background: #f0fdf4; }
.jr-check.ok .jr-tick { color: #15803d; }
.jr-check.todo .jr-tick { color: #b45309; }
.jr-tick { font-size: 18px; font-weight: 700; width: 20px; text-align: center; }
.jr-pilotline { margin-top: 10px; font-size: 14px; }
@media (prefers-color-scheme: dark) { .jr-check.ok { background: transparent; } }
@media print { .sidebar, nav, .page-head .actions, .jr-btns { display: none !important; } }

/* material tracker */
.mt-states { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mt-state { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--chip, #f1f5f9); white-space: nowrap; }
.mt-state.bad { background: #fee2e2; color: #991b1b; }
.mt-state.warn { background: #fef3c7; color: #92400e; }
.mt-state.ok { background: #dbeafe; color: #1e40af; }
.mt-state.done { background: #dcfce7; color: #166534; }
.mt-ready { margin-top: 8px; font-weight: 600; color: #15803d; }
.mt-table input[type=date] { width: 140px; }
.mt-warn { border-left: 4px solid #f59e0b; }

/* TDS check on a PO */
.tds-warn { flex-basis: 100%; font-size: 13px; padding: 6px 10px; border-radius: 8px; background: #fef3c7; color: #92400e; }
.tds-warn .btn { margin-left: 4px; }
.mt-follow { font-size: 11px; color: var(--muted, #64748b); }

/* BOQ components → store items */
.bp-pick { display: flex; gap: 6px; align-items: center; }
.bp-chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.bp-chip { border: 1px solid var(--line, #e5e7eb); background: var(--chip, #f1f5f9); border-radius: 10px; padding: 1px 8px; font-size: 12px; cursor: pointer; }
.bp-chip:hover { border-color: #2563eb; }
.bp-auto { font-size: 11px; color: #15803d; }
.bp-spec { font-size: 12px; max-width: 360px; }
.bp-table td { vertical-align: top; }

/* news */
.nw-list { display: grid; gap: 10px; }
.nw-item { background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 10px 12px; }
.nw-item.lead { border-left: 4px solid #15803d; }
.nw-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; }
.nw-tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: #dbeafe; color: #1e40af; }
.nw-tag.lead { background: #dcfce7; color: #166534; }
.nw-tag.rule { background: #fef3c7; color: #92400e; }
.nw-place { font-weight: 600; }
.nw-title { display: block; font-weight: 600; font-size: 15px; margin: 4px 0; color: inherit; text-decoration: none; }
.nw-title:hover { text-decoration: underline; }
.nw-snip { font-size: 13px; color: var(--muted, #64748b); }
.nw-btns { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* tax invoice print */
.inv-head td { background: #f3f4f6; }
.inv-info th { text-align: left; width: 48%; font-weight: 600; }
.inv-info, .inv-sum { width: 100%; margin: 0; }
.inv-terms { margin: 0; padding-left: 18px; }
.inv-terms li { margin: 1px 0; }

/* role editor: screens & visibility */
.role-screens { border: 1px solid var(--border, #e5e7eb); background: var(--bg, #f8fafc); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.mt-store { margin-top: 8px; padding: 8px 10px; border-radius: 6px; background: #f8fafc; border: 1px solid #e2e8f0; }
.mt-store summary { cursor: pointer; }
