/* VIVEROCK portal: brand tokens sampled from the logo (charcoal #414141, gold #BC9440). Inter is self-hosted. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #414141;
  --ink-deep: #2b2b2c;
  --gold: #bc9440;
  --gold-dark: #9c7a30;
  --gold-soft: #f6efdf;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e6e8ec;
  --muted: #6b7280;
  --ok: #2e9e6b;
  --ok-soft: #e6f5ee;
  --warn: #c98615;
  --warn-soft: #fdf3dc;
  --bad: #c0392b;
  --bad-soft: #fbe9e7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 6px 18px rgba(20, 20, 20, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; color: var(--ink-deep); }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
p { margin: 0 0 1em; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.icon { flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .65rem 1.15rem; border: 1px solid transparent; border-radius: 10px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-deep); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger { background: #fff; border-color: #efc4be; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { min-height: 42px; padding: .4rem .9rem; font-size: .9rem; border-radius: 9px; }
@media (pointer: coarse) { .btn-sm { min-height: 44px; } }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .3rem; font-weight: 600; font-size: .88rem; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=date], .field input[type=number], .field input[type=search], .field textarea, .field select {
  width: 100%; min-height: 46px; padding: .7rem .85rem; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #d5d8de; border-radius: 10px;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.field .hint { margin-top: .3rem; font-size: .8rem; color: var(--muted); }
.row-2 { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
.check { display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.check input[type=checkbox] { width: 22px; height: 22px; flex: none; accent-color: var(--gold-dark); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; } /* spam trap */

/* ---------- Alerts ---------- */
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; border: 1px solid; }
.alert-ok { background: var(--ok-soft); border-color: #bfe3d0; color: #1f6e4a; }
.alert-bad { background: var(--bad-soft); border-color: #efc4be; color: #8e2a20; }
.alert-warn { background: var(--warn-soft); border-color: #f0dba5; color: #7a5410; }
.alert ul { margin: 0; padding-left: 1.1rem; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-brand { display: none; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 2rem 1.6rem; }
.auth-logo { display: block; width: 210px; max-width: 70%; margin: 0 auto 1.4rem; }
.auth-card h1 { text-align: center; font-size: 1.35rem; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.4rem; }
.auth-links { text-align: center; margin-top: 1.2rem; font-size: .9rem; }
.auth-links a + a { margin-left: .9rem; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; display: flex; flex-direction: column;
  background: var(--ink-deep); color: #e8e8e8; transform: translateX(-100%); transition: transform .2s;
}
.sidebar.open { transform: none; }
.side-head { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-head img { width: 38px; height: 38px; filter: brightness(0) invert(1); opacity: .92; }
.side-head .name { font-weight: 800; letter-spacing: .14em; font-size: .95rem; color: #fff; }
.side-head .name span { color: var(--gold); }
.nav { padding: .8rem; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: .75rem; min-height: 46px; padding: .7rem .85rem; margin-bottom: .2rem; border-radius: 10px; color: #cfcfcf; font-weight: 500; text-decoration: none; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(188, 148, 64, .18); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side-foot { padding: .8rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-foot a { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: 10px; color: #cfcfcf; text-decoration: none; }
.side-foot a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 30; }
.scrim.open { display: block; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; background: rgba(244, 245, 247, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.burger { border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 46px; height: 46px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.user-chip { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-dark); display: grid; place-items: center; font-weight: 700; }
.user-chip .who { display: none; line-height: 1.2; }
.user-chip .who b { display: block; font-size: .88rem; }
.user-chip .who span { font-size: .75rem; color: var(--muted); }
.content { padding: 1.1rem; max-width: 1180px; }

/* ---------- Cards / stats / tables ---------- */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem; }
.card h2 { margin-bottom: .8rem; }
.stat { display: flex; align-items: center; gap: .9rem; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-dark); }
.stat .num { font-size: 1.7rem; font-weight: 750; line-height: 1; color: var(--ink-deep); }
.stat .lbl { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.empty { text-align: center; padding: 1.6rem 1rem; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .8rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.actions form { margin: 0; }
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 650; }
.badge-ok { background: var(--ok-soft); color: #1f6e4a; }
.badge-warn { background: var(--warn-soft); color: #7a5410; }
.badge-bad { background: var(--bad-soft); color: #8e2a20; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.list li:last-child { border-bottom: 0; }

@media (min-width: 640px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .user-chip .who { display: block; }
  .content { padding: 1.5rem; }
}
@media (min-width: 1024px) {
  .auth { grid-template-columns: 1.05fr 1fr; }
  .auth-brand {
    display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; color: #fff;
    background: linear-gradient(160deg, var(--ink-deep) 0%, var(--ink) 100%); position: relative; overflow: hidden;
  }
  .auth-brand::after { content: ""; position: absolute; right: -90px; bottom: -90px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(188, 148, 64, .35), transparent 70%); }
  .auth-brand img { width: 74px; filter: brightness(0) invert(1); }
  .auth-brand h2 { color: #fff; font-size: 2rem; font-weight: 750; max-width: 14ch; line-height: 1.15; }
  .auth-brand h2 span { color: var(--gold); }
  .auth-brand p { color: #c8c8c8; max-width: 34ch; }
  .sidebar { transform: none; }
  .scrim, .scrim.open { display: none; }
  .main { margin-left: 260px; }
  .burger { display: none; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-main { grid-template-columns: 2fr 1fr; }
  .content { padding: 1.8rem 2rem; max-width: 1480px; }
}
@media (min-width: 1441px) { .content { max-width: 1680px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= Phase 3: request form ================= */
body.public { background: var(--bg); }
.pub-bar { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.1rem; background: #fff; border-bottom: 1px solid var(--line); }
.pub-logo { height: 40px; width: auto; display: block; }
.pub-main { padding: 1.2rem 1rem 3rem; }
.req { max-width: 760px; margin: 0 auto; }
.req-head { margin-bottom: 1rem; }
.req-head h1 { margin-bottom: .3rem; }

.stepper { display: flex; gap: .4rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .5rem .2rem; border-radius: 10px; color: var(--muted); font-size: .78rem; }
.stepper li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e9ebef; color: var(--muted); }
.stepper li.done span { background: var(--ok); color: #fff; }
.stepper li.done { cursor: pointer; }
.stepper li.on span { background: var(--gold); color: #fff; }
.stepper li.on { color: var(--ink-deep); }
.stepper li b { font-weight: 600; }

.js-on .step { display: none; }
.js-on .step.is-active { display: block; }
.step { margin-bottom: 1rem; }
.step-nav { display: flex; justify-content: space-between; gap: .8rem; margin-top: 1.2rem; }

.choices { display: grid; gap: .6rem; grid-template-columns: 1fr; }
.choice { display: flex; position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; width: 100%; padding: .8rem .9rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .15s, background .15s; }
.choice span b { display: block; }
.choice span small { color: var(--muted); font-size: .8rem; }
.choice input:checked + span { border-color: var(--gold); background: var(--gold-soft); }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.field-error { color: var(--bad); font-size: .82rem; margin-top: .3rem; min-height: 0; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad); }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center; padding: 1.6rem 1rem; border: 2px dashed #cfd3da; border-radius: 14px; background: #fff; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--gold); background: var(--gold-soft); }
.files { list-style: none; margin: .8rem 0 0; padding: 0; }
.files li { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.files .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.summary { margin: 0 0 1rem; }
.summary div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; text-align: right; }
.estimate { display: flex; flex-direction: column; gap: .25rem; padding: 1rem; margin-bottom: 1.2rem; border-radius: 12px; background: var(--gold-soft); border: 1px solid #ead9ad; }
.estimate strong { font-size: 1.3rem; color: var(--ink-deep); }

.tabs { display: flex; gap: .4rem; margin: .4rem 0 1rem; padding: .3rem; background: #eef0f3; border-radius: 12px; }
.tab { flex: 1; padding: .6rem; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { background: #fff; color: var(--ink-deep); box-shadow: var(--shadow); }
.panel[hidden] { display: none; }

.kv { display: grid; grid-template-columns: 1fr; gap: .1rem 1.5rem; margin: 0; }
.kv div { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.kv dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv dd { margin: .1rem 0 0; font-weight: 600; }
.prose { white-space: pre-wrap; }
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar input, .filter-bar select { padding: .55rem .75rem; border: 1px solid #d5d8de; border-radius: 10px; font: inherit; background: #fff; }
.rates input[type=text] { width: 100%; min-width: 90px; padding: .5rem .6rem; border: 1px solid #d5d8de; border-radius: 8px; font: inherit; }
.next-box { padding: 1rem; border-radius: 12px; background: var(--gold-soft); border: 1px solid #ead9ad; }
@media (min-width: 640px) {
  .choices { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr 1fr; }
  .pub-main { padding-top: 2rem; }
}

/* ====================================================================
   Responsive system (mobile first). Breakpoints:
   480 phones | 640-768 tablets | 1024 laptops (sidebar) | 1441 large desktops
   ==================================================================== */
.badge-mute { background: #eceef1; color: #565c66; }
code { background: #f0f1f4; padding: .1rem .4rem; border-radius: 6px; font-size: .85em; overflow-wrap: anywhere; }
h3 { font-size: 1rem; margin: 0 0 .7rem; color: var(--ink-deep); }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.page-head, .actions { min-width: 0; }
details.newclient summary { cursor: pointer; color: var(--gold-dark); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.copyrow { display: flex; gap: .5rem; margin-top: .5rem; }
.copyrow input { flex: 1; min-width: 0; min-height: 46px; padding: .6rem .7rem; border: 1px solid #d5d8de; border-radius: 10px; font: inherit; font-size: .9rem; background: #fff; }
.newlink { padding: 1rem; margin-bottom: 1rem; border-radius: 12px; background: var(--gold-soft); border: 1px solid #ead9ad; }

/* ---- tables become cards on small screens ---- */
.rtable { width: 100%; border-collapse: collapse; }
.grid-3 { }
@media (max-width: 719px) {
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable thead { position: absolute; left: -9999px; top: 0; }
  .rtable tr { border: 1px solid var(--line); border-radius: 12px; padding: .35rem .95rem; margin-bottom: .75rem; background: #fff; box-shadow: 0 1px 2px rgba(20,20,20,.03); }
  .rtable td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem 0; border: 0; border-bottom: 1px dashed var(--line); text-align: right; min-width: 0; }
  .rtable td:last-child { border-bottom: 0; }
  .rtable td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; text-align: left; }
  .rtable td.cell-title { display: block; text-align: left; padding: .7rem 0 .55rem; }
  .rtable td.cell-title::before, .rtable td[data-label=""]::before { display: none; }
  .rtable td.cell-actions { justify-content: flex-start; }
  .rtable td.cell-actions::before { display: none; }
  .rtable td .ov-mini { width: 120px; }
  .card:has(> .rtable), .card:has(> .table-wrap > .rtable) { background: transparent; box-shadow: none; padding: 0; }
  .table-wrap:has(> .rtable) { overflow: visible; }
}

/* ---- pagination ---- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.pager .pages { display: flex; gap: .35rem; flex-wrap: wrap; }
.pager a, .pager span.cur { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 .8rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; }
.pager span.cur { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager a:hover { border-color: var(--gold); }

/* ---- loading feedback ---- */
.topline { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--gold); z-index: 100; transition: width .3s; pointer-events: none; }
html.is-loading .topline { width: 82%; transition: width 8s cubic-bezier(.1, .8, .2, 1); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-ghost.is-loading::after, .btn-danger.is-loading::after { border-color: rgba(0,0,0,.2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- hero ---- */
.sec { margin-bottom: 1.8rem; scroll-margin-top: 72px; }
.sec-title { font-size: 1.2rem; margin: 0 0 .8rem; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; min-width: 0; }
.panel > h2 { font-size: 1.05rem; }
.ov-hero { display: grid; gap: .6rem 1.4rem; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "ring" "info"; align-items: center; padding: 1.3rem 1.1rem; border-radius: 18px; color: #fff; background: linear-gradient(150deg, var(--ink-deep) 0%, var(--ink) 100%); position: relative; overflow: hidden; }
.ov-hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, rgba(188,148,64,.30), transparent 70%); pointer-events: none; }
.ov-head { grid-area: head; position: relative; z-index: 1; min-width: 0; }
.ov-head h1 { color: #fff; font-size: 1.5rem; margin: .5rem 0 .25rem; overflow-wrap: anywhere; }
.ov-badge { display: inline-block; padding: .25rem .75rem; border-radius: 999px; background: rgba(188,148,64,.25); color: #f3dba3; font-size: .8rem; font-weight: 650; }
.ov-tagline { color: #d6d6d6; margin: 0; }
.ov-ring { grid-area: ring; position: relative; width: min(210px, 62vw); aspect-ratio: 1; justify-self: center; z-index: 1; }
.ov-ring svg { width: 100%; height: 100%; display: block; }
.ov-ring-bar { animation: ovring 1.1s ease-out both; }
@keyframes ovring { from { stroke-dashoffset: var(--ring-from); } }
.ov-ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ov-ring-label b { font-size: 2.6rem; line-height: 1; }
.ov-ring-label span { font-size: .8rem; color: #cfcfcf; margin-top: .3rem; }
.ov-info { grid-area: info; position: relative; z-index: 1; min-width: 0; }
.ov-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; margin: 0 0 .6rem; }
.ov-meta dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #b4b7bc; }
.ov-meta dd { margin: .1rem 0 0; font-weight: 600; overflow-wrap: anywhere; }
.ov-track { display: inline-block; margin-top: .4rem; padding: .3rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.ov-track.ok { background: rgba(46,158,107,.22); color: #8fe3b9; }
.ov-track.late { background: rgba(201,134,21,.25); color: #f7cf86; }

/* ---- key figures ---- */
.kpis { display: grid; gap: .7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 1rem 0; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .95rem 1rem; display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.kpi span { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kpi b { font-size: 1.15rem; color: var(--ink-deep); overflow-wrap: anywhere; line-height: 1.25; }
.kpi small { color: var(--muted); font-size: .82rem; }
.kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
.kpis-fin .kpi b { font-size: clamp(.98rem, 4.3vw, 1.25rem); }

/* ---- layouts for panels ---- */
.split { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); }

/* ---- chart ---- */
.chart { margin: 0; }
.chart-body { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: .4rem; }
.chart-y { position: relative; font-size: .78rem; color: var(--muted); }
.chart-y span { position: absolute; right: 0; transform: translateY(-50%); }
.chart-plot { position: relative; aspect-ratio: 16 / 10; margin-right: 1.6rem; }
.chart-plot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid line { stroke: #e6e8ec; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .area { fill: rgba(188,148,64,.14); }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .planned { fill: none; stroke: #9aa0aa; stroke-width: 2; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
.chart .dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: 3px solid #fff; transform: translate(-50%, -50%); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.chart .tip { position: absolute; transform: translate(-50%, -190%); background: var(--ink-deep); color: #fff; font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.chart-x { display: flex; justify-content: space-between; margin: .4rem 1.6rem 0 3rem; font-size: .8rem; color: var(--muted); }
.chart-legend { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: .7rem; font-size: .85rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: .45rem; }
.chart-legend .k { width: 22px; height: 0; border-top: 3px solid var(--gold); display: inline-block; }
.chart-legend .k.plan { border-top: 2px dashed #9aa0aa; }

/* ---- stages ---- */
.stages { list-style: none; margin: 0; padding: 0; }
.stages li { position: relative; display: flex; gap: .9rem; padding: 0 0 1.2rem; }
.stages li:last-child { padding-bottom: 0; }
.stages li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: -2px; width: 2px; background: #e3e5e9; }
.stages li:last-child::before { display: none; }
.stages i { flex: none; width: 16px; height: 16px; margin-top: 4px; border-radius: 50%; background: #d4d7dd; position: relative; z-index: 1; }
.stages b { display: block; line-height: 1.3; }
.stages span { font-size: .85rem; color: var(--muted); }
.stages li.completed i { background: var(--ok); }
.stages li.in_progress i { background: var(--gold); box-shadow: 0 0 0 5px rgba(188,148,64,.25); }
.stages li.delayed i { background: var(--bad); }

/* ---- programme of work ---- */
.pow-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.pow-head h3 { margin: 0; }
.pow-pct { font-size: 1.6rem; font-weight: 750; color: var(--gold-dark); }
.bar, .mini { height: 10px; border-radius: 999px; background: #eceef1; overflow: hidden; }
.mini { height: 6px; }
.bar i, .mini i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }
.tasks summary { cursor: pointer; min-height: 46px; display: flex; align-items: center; color: var(--gold-dark); font-weight: 650; }
.task-list { list-style: none; margin: .2rem 0 0; padding: 0; column-width: 290px; column-gap: 2rem; }
.task-list li { display: flex; align-items: flex-start; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.task-list li.done { color: var(--muted); }
.task-list .tick { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 1.5px solid #cfd3da; display: grid; place-items: center; font-size: .8rem; color: #fff; margin-top: 1px; }
.task-list li.done .tick { background: var(--ok); border-color: var(--ok); }

/* ---- activities ---- */
.acts { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.acts li { border: 1px solid var(--line); border-radius: 12px; padding: .85rem .95rem; }
.acts-top { display: flex; justify-content: space-between; gap: .8rem; align-items: baseline; margin-bottom: .55rem; }
.acts-top b { overflow-wrap: anywhere; }
.acts-top span { white-space: nowrap; flex: none; }
.acts-meta { margin-top: .35rem; }

/* ---- finance visuals ---- */
.donut-wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.donut { position: relative; width: 132px; height: 132px; flex: none; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut .bg { fill: none; stroke: #eceef1; stroke-width: 4; }
.donut .fg { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; }
.donut-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-label b { font-size: 1.5rem; line-height: 1; color: var(--ink-deep); }
.donut-label span { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 190px; }
.legend li { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.legend li:last-child { border-bottom: 0; }
.legend span { flex: 1; color: var(--muted); }
.legend b { color: var(--ink-deep); overflow-wrap: anywhere; text-align: right; }
.legend .k { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.legend .k.paid { background: var(--gold); }
.legend .k.act { background: var(--ink); }
.legend .k.due { background: #d9dce2; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .95rem; }
.bars li { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr) 3rem; gap: .7rem; align-items: center; }
.bars .bar-name { overflow-wrap: anywhere; }
.bars b { min-width: 2.8rem; text-align: right; }

/* ---- empty states, report card, team, gallery ---- */
.empty-card { display: flex; align-items: center; gap: .9rem; padding: 1rem; border-radius: 12px; background: #f8f9fb; color: var(--muted); }
.empty-card .icon { width: 28px; height: 28px; flex: none; color: var(--gold-dark); }
.cta { display: flex; gap: 1rem; align-items: flex-start; background: linear-gradient(160deg, #fffaf0, #fff); border: 1px solid #f0e2bd; }
.cta-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-dark); flex: none; }
.cta-ico .icon { width: 26px; height: 26px; }
.team { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.person { display: flex; flex-direction: column; gap: .2rem; padding: .9rem; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.person a { display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; overflow-wrap: anywhere; }
.person a .icon { width: 16px; height: 16px; }
.gallery { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #eceef1; }

/* ====================== client page shell ====================== */
body.cl { background: var(--bg); padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
.cl-side { display: none; }
.cl-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .7rem; min-height: 58px; padding: env(safe-area-inset-top, 0px) .9rem 0; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.cl-top .mark { width: 34px; height: 34px; flex: none; }
.cl-top .who { flex: 1; min-width: 0; line-height: 1.2; }
.cl-top .who b { display: block; letter-spacing: .12em; font-size: .85rem; }
.cl-top .who span { display: block; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-top .who b em { font-style: normal; color: var(--gold-dark); }
.icon-btn { width: 46px; height: 46px; flex: none; border: 1px solid var(--line); background: #fff; border-radius: 12px; display: grid; place-items: center; color: var(--ink); cursor: pointer; }
.cl-content { padding: 1rem .95rem 1.2rem; max-width: 1340px; margin: 0 auto; }
.cl-hello { margin: 0 0 .8rem; color: var(--muted); }
.cl-note { text-align: center; color: var(--muted); font-size: .85rem; margin: 1.5rem 0 .5rem; }
.cl-foot { text-align: center; color: var(--muted); font-size: .8rem; padding: .5rem 1rem 1.5rem; }
.cl-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: rgba(255,255,255,.97); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.cl-bottom a { flex: 1; min-width: 0; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .75rem; font-weight: 600; color: var(--muted); text-decoration: none; position: relative; }
.cl-bottom a .icon { width: 24px; height: 24px; }
.cl-bottom a.active { color: var(--gold-dark); }
.cl-bottom a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }
.print-head { display: none; }

@media (min-width: 480px) {
  .cl-content { padding: 1.2rem 1.2rem 1.4rem; }
  .ov-head h1 { font-size: 1.7rem; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 640px) {
  .kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis-fin { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .kpis-fin > .kpi:last-child:nth-child(odd) { grid-column: auto; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .chart-plot { aspect-ratio: 2 / 1; }
}
@media (min-width: 768px) {
  .cl-content { padding: 1.5rem 1.6rem 1.6rem; }
  .ov-hero { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head ring" "info ring"; padding: 1.8rem; }
  .ov-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  body.cl { padding-bottom: 0; padding-left: 270px; }
  .cl-top, .cl-bottom { display: none; }
  .cl-side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 270px; background: #fff; border-right: 1px solid var(--line); padding: 1.4rem 1.1rem; overflow-y: auto; z-index: 20; }
  .cl-brand img { width: 190px; display: block; }
  .cl-proj { margin: 1.4rem 0 1rem; padding: .9rem 1rem; background: var(--gold-soft); border-radius: 12px; }
  .cl-proj small { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-dark); font-weight: 700; }
  .cl-proj b { display: block; line-height: 1.3; margin: .15rem 0; overflow-wrap: anywhere; }
  .cl-proj span { font-size: .85rem; color: var(--muted); }
  .cl-nav { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
  .cl-nav a { display: flex; align-items: center; gap: .8rem; min-height: 48px; padding: 0 .9rem; border-radius: 12px; color: var(--ink); font-weight: 600; text-decoration: none; }
  .cl-nav a .icon { color: var(--muted); }
  .cl-nav a:hover { background: #f3f4f7; }
  .cl-nav a.active { background: var(--gold-soft); color: var(--gold-dark); box-shadow: inset 3px 0 0 var(--gold); }
  .cl-nav a.active .icon { color: var(--gold-dark); }
  .cl-side-foot { padding-top: 1rem; border-top: 1px solid var(--line); }
  .cl-side-foot p { margin: .9rem 0 .2rem; font-size: .88rem; color: var(--muted); }
  .cl-content { padding: 2rem 2.4rem 1.6rem; }
  .sec { scroll-margin-top: 20px; margin-bottom: 2.2rem; }
  .sec-title { font-size: 1.3rem; }
  .ov-hero { padding: 2.2rem 2.4rem; gap: .8rem 2.5rem; }
  .ov-head h1 { font-size: 2rem; }
  .ov-ring { width: 230px; }
  .split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .split-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .split-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 1.4rem; }
  .kpi { padding: 1.1rem 1.2rem; }
  .kpi b { font-size: 1.3rem; }
  .chart-plot { aspect-ratio: 2.2 / 1; }
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
}
@media (min-width: 1280px) {
  .split-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1441px) {
  .cl-content { max-width: 1480px; padding: 2.4rem 3rem 2rem; }
  .gallery { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---- download report: a clean one-column page ---- */
@media print {
  @page { margin: 14mm; }
  body, body.cl { background: #fff !important; padding: 0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cl-side, .cl-top, .cl-bottom, .btn, .icon-btn, .topline, .cl-note, #photos .empty-card, .cl-foot, .sidebar, .topbar, .scrim, .pub-bar { display: none !important; }
  .main { margin: 0 !important; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--gold); padding-bottom: .6rem; margin-bottom: 1rem; }
  .print-head img { height: 40px; }
  .cl-content, .content { padding: 0 !important; max-width: none !important; }
  .panel, .kpi, .ov-hero, .acts li, .person { box-shadow: none !important; border: 1px solid #ddd; }
  .panel { break-inside: auto; }
  .kpi, .ov-hero, .acts li, .person, .stages li, .task-list li, .donut-wrap { break-inside: avoid; }
  .split > .panel { break-inside: avoid; }
  .sec-title, h3 { break-after: avoid; }
  .sec { break-inside: auto; margin-bottom: 1rem; }
  .split, .split-3, .split-wide { grid-template-columns: 1fr 1fr !important; }
  .kpis-4 { grid-template-columns: repeat(4, 1fr) !important; }
  .task-list { column-count: 2 !important; }
  .ov-ring-bar { animation: none; }
  a { color: inherit; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .ov-ring-bar { animation: none; } }

/* ---- multi-column forms on laptops and desktops ---- */
.form-grid { display: flex; flex-direction: column; gap: 1rem; }
.form-col { display: contents; }
.f-client { order: 1; } .f-project { order: 2; } .f-money { order: 3; } .f-rep { order: 4; }
.form-grid .card { margin: 0; }
.form-actions { margin-top: 1rem; position: sticky; bottom: 0; z-index: 5; padding: .8rem 0 calc(.8rem + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, rgba(244,245,247,0)); }
@media (min-width: 1024px) {
  .form-grid { flex-direction: row; align-items: flex-start; gap: 1.2rem; }
  .form-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
  .form-main { flex: 2 1 0; }
  .form-side { flex: 1 1 0; }
  .form-actions { position: static; background: none; padding: 0; }
}
@media print { .sec.is-empty, .cta .btn { display: none !important; } }

/* every form control is comfortable to tap */
select, .rates select { min-height: 46px; padding: .5rem .7rem; font: inherit; color: var(--ink); background: #fff; border: 1px solid #d5d8de; border-radius: 10px; max-width: 100%; }
input[type=date] { min-height: 46px; }
.filter-bar input, .filter-bar select { min-height: 46px; }
.rates input[type=text] { min-height: 46px; }

@media (max-width: 719px) {
  .rtable td.is-empty { display: none; }
  .rtable td .mini { width: 150px; }
  .rtable td[data-label="Progress"] > div { display: flex; align-items: center; gap: .6rem; }
  .rtable td[data-label="Progress"] .mini { flex: 1; margin: 0; }
}

/* compact summary tiles: two across on phones, three on tablets and up */
.stats { display: grid; gap: .7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats .stat { flex-direction: column; align-items: flex-start; gap: .55rem; padding: 1rem; }
.stats .stat .ico { width: 38px; height: 38px; }
.stats .stat .num { font-size: 1.6rem; }
@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
  .stats .stat { flex-direction: row; align-items: center; gap: .9rem; padding: 1.2rem; }
  .stats .stat .ico { width: 44px; height: 44px; }
  .stats .stat .num { font-size: 1.7rem; }
}

/* ================= Phase 5: project workspace ================= */
.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.ws-title { min-width: 0; }
.ws-title h2 { font-size: 1.35rem; margin: .15rem 0 .2rem; overflow-wrap: anywhere; }
.ws-pct { flex: none; text-align: center; background: var(--ink-deep); color: #fff; border-radius: 16px; padding: .6rem 1rem; min-width: 92px; }
.ws-pct b { display: block; font-size: 1.7rem; line-height: 1.1; color: #f3dba3; }
.ws-pct span { font-size: .78rem; color: #cfcfcf; }
.ws-status { padding: 0 1.1rem; margin-bottom: 1rem; }
.ws-status > summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; font-weight: 650; color: var(--gold-dark); }
.ws-status[open] { padding-bottom: 1rem; }
.ws-add { padding: 0 1.1rem; margin-bottom: 1rem; }
.ws-add > summary { margin: 1rem 0; list-style: none; }
.ws-add > summary::-webkit-details-marker, .ws-edit > summary::-webkit-details-marker, .ws-status > summary::-webkit-details-marker { display: none; }
.ws-add[open] > summary { margin-bottom: .8rem; }
.ws-add[open] { padding-bottom: 1.1rem; }
.ws-form .ws-fields { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); }
.ws-form .field.wide { grid-column: 1 / -1; }
.ws-edit > summary { list-style: none; cursor: pointer; }

.ws-tasks, .ws-items { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.ws-task, .ws-item { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: .7rem .8rem; min-width: 0; }
.ws-item-actions { display: contents; }
.ws-item-main { flex: 1 1 220px; min-width: 0; }
.ws-item-title { font-weight: 650; overflow-wrap: anywhere; }
.ws-item-meta { margin-top: .2rem; overflow-wrap: anywhere; }
.ws-item .mini { margin-top: .5rem; }
.t-title { flex: 1 1 96px; min-width: 0; overflow-wrap: anywhere; font-weight: 550; }
.ws-task.done .t-title { color: var(--muted); text-decoration: line-through; }
.ws-task.saving { opacity: .65; }
.ws-task form, .ws-item-actions form { margin: 0; }
.tick-btn { width: 46px; height: 46px; border-radius: 12px; border: 2px solid #cfd3da; background: #fff; color: transparent; font-size: 1.3rem; font-weight: 700; cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.ws-task.done .tick-btn { background: var(--ok); border-color: var(--ok); color: #fff; }
.tick-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.icon-sq { width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; font-size: .8rem; }
.icon-sq:disabled { opacity: .35; cursor: default; }
.ws-edit[open] { flex: 1 0 100%; order: 10; }
.ws-edit-body { margin-top: .8rem; padding-top: .9rem; border-top: 1px dashed var(--line); display: grid; gap: .8rem; }
.ws-prog { margin-bottom: 1rem; }
@media (min-width: 640px) {
  .ws-form .ws-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-title h2 { font-size: 1.6rem; }
}
@media (min-width: 1024px) {
  .ws-form .ws-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ws-tasks, .ws-items { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
@media (min-width: 1441px) { .ws-tasks, .ws-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ws-move { display: flex; gap: .5rem; flex-wrap: wrap; }
.ws-move form { margin: 0; }

/* ---- workspace section tabs: icon tiles, easy to see and tap ---- */
.ws-tabs { margin-bottom: 1.2rem; }
.ws-tabs-main { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.ws-tabs-more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: .5rem; }
.ws-tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 72px; padding: .5rem .25rem; border-radius: 14px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); font-weight: 650; font-size: .86rem; line-height: 1.15; text-align: center; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.ws-tab .icon { width: 26px; height: 26px; color: var(--gold-dark); }
.ws-tab:hover { border-color: var(--gold); text-decoration: none; }
.ws-tab:active { transform: translateY(1px); }
.ws-tab.active { background: var(--ink-deep); border-color: var(--ink-deep); color: #fff; box-shadow: 0 4px 14px rgba(43, 43, 44, .28); }
.ws-tab.active .icon { color: #f3dba3; }
.ws-tab .count { position: absolute; top: 6px; right: 8px; min-width: 22px; height: 22px; padding: 0 .35rem; border-radius: 11px; background: var(--bad); color: #fff; font-size: .75rem; display: grid; place-items: center; }
.ws-more-toggle { width: 100%; margin-top: .5rem; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: .55rem; border-radius: 12px; border: 1.5px dashed #cfd3da; background: rgba(255,255,255,.6); color: var(--gold-dark); font: inherit; font-weight: 650; cursor: pointer; }
.ws-more-toggle .icon { width: 20px; height: 20px; }
.ws-more:not(.is-open) > .ws-tabs-more { display: none; }
@media (min-width: 768px) {
  /* one tidy, wrapping row of equal pills */
  .ws-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
  .ws-tabs-main, .ws-more, .ws-more > .ws-tabs-more { display: contents !important; }
  .ws-more-toggle { display: none; }
  .ws-tab { flex: 0 0 auto; flex-direction: row; gap: .5rem; min-height: 44px; padding: 0 1rem; border-radius: 999px; border-color: transparent; background: #f4f3ef; box-shadow: none; font-size: .92rem; white-space: nowrap; }
  .ws-tab:hover { background: #fff; border-color: var(--gold); }
  .ws-tab .icon { width: 20px; height: 20px; }
  .ws-tab.active { background: var(--ink-deep); border-color: var(--ink-deep); }
  .ws-tab .count { position: static; margin-left: .15rem; }
}

/* ================= Phase 6: photos, documents, messages, bell ================= */
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .icon { width: 34px; height: 34px; color: var(--gold-dark); }
.dropzone:focus-within { border-color: var(--gold); background: var(--gold-soft); }
.previews { list-style: none; margin: .8rem 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.previews li { position: relative; display: flex; flex-direction: column; gap: .2rem; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #eceef1; }
.previews .rm { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.progress { height: 10px; border-radius: 999px; background: #eceef1; overflow: hidden; margin-top: .6rem; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); transition: width .2s; }

.ws-photos { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.ws-photo { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: .6rem; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.ws-photo > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #eceef1; display: block; }
.ws-photo-meta { display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; overflow-wrap: anywhere; }
.ws-photo-meta > div { flex: 1 0 100%; }
.ws-photo .ws-edit[open] { flex: none; order: 0; }

/* client / overview gallery */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { min-height: 44px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: .45rem; }
.chip span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.chip.active { background: var(--ink-deep); border-color: var(--ink-deep); color: #fff; }
.chip.active span { color: #f3dba3; }
.gallery { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.gal-item { margin: 0; min-width: 0; }
.gal-item[hidden] { display: none; }
.gal-link { display: block; border-radius: 12px; overflow: hidden; }
.gal-link img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #eceef1; transition: transform .25s; }
.gal-link:hover img { transform: scale(1.03); }
.gal-item figcaption { margin-top: .3rem; font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
@media (min-width: 768px) { .gallery { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; } }

/* full-screen photo viewer */
html.lb-open { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 300; background: rgba(14, 14, 15, .95); display: flex; align-items: center; justify-content: center; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.lb[hidden] { display: none; }
.lb-stage { margin: 0; max-width: 100vw; display: flex; flex-direction: column; align-items: center; gap: .7rem; padding: 0 .5rem; }
.lb-stage img { max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 6px; background: #1d1d1e; min-width: 40px; min-height: 40px; }
.lb.loading .lb-stage img { opacity: .4; }
.lb-stage figcaption { color: #dedede; font-size: .9rem; text-align: center; padding: 0 3.6rem; }
.lb-btn { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover, .lb-btn:focus-visible { background: rgba(255,255,255,.28); outline: none; }
.lb-close { top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; }
.lb-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 6px; top: 50%; transform: translateY(-50%); }

/* documents */
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; align-items: center; gap: .8rem; padding: .75rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.docs li:last-child { border-bottom: 0; }
.doc-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-dark); flex: none; }
.doc-main { flex: 1 1 180px; min-width: 0; }
.doc-main b { display: block; overflow-wrap: anywhere; }
.doc-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* messages */
.chat { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .7rem; max-height: 440px; overflow-y: auto; }
.bubble { max-width: 90%; padding: .7rem .95rem; border-radius: 16px; min-width: 0; }
.bubble.mine { align-self: flex-end; background: var(--gold-soft); border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: #f1f3f6; border-bottom-left-radius: 4px; }
.bubble.internal { align-self: stretch; max-width: 100%; background: #fff8e1; border: 1px dashed #e6c76b; }
.bubble-name { font-size: .8rem; font-weight: 650; color: var(--muted); margin-bottom: .2rem; }
.bubble-name span { font-weight: 500; margin-left: .35rem; }
.bubble-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-form textarea { min-height: 96px; }

/* bell and notifications */
.bell { position: relative; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--ink); text-decoration: none; flex: none; }
.bell:hover { background: #eceef1; text-decoration: none; }
.bell b { position: absolute; top: 3px; right: 1px; min-width: 20px; height: 20px; padding: 0 .3rem; border-radius: 10px; background: var(--bad); color: #fff; font-size: .72rem; display: grid; place-items: center; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes form { margin: 0; }
.note-btn { width: 100%; display: flex; align-items: flex-start; gap: .8rem; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: .9rem .3rem; min-height: 58px; font: inherit; color: inherit; cursor: pointer; }
.note-btn:hover { background: #fafbfc; }
.notes li:last-child .note-btn { border-bottom: 0; }
.note-btn .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: .45rem; background: transparent; flex: none; }
.notes li.unread .dot { background: var(--gold); }
.notes li.unread b { color: var(--ink-deep); }
.note-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; overflow-wrap: anywhere; }
.note-time { flex: none; white-space: nowrap; }
@media print { .lb, .chips, .bell { display: none !important; } .gallery { grid-template-columns: repeat(4, 1fr) !important; } }

/* photos carry width/height attributes (so the page does not jump while they load); let the 4:3 frame decide the height */
.gal-link img, .ws-photo > img { height: auto; }

/* ---------- Phase 7: quotations and invoices ---------- */
.badge-info { background: #e3edf8; color: #1d4f86; }
.badge-muted { background: #ececec; color: #555; }
.quote-public { max-width: 920px; margin: 0 auto; }
.q-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-top: 1rem; }
.q-summary > div { background: var(--gold-soft); border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.q-summary .big { font-size: 1.25rem; color: var(--ink-deep); }
.quote-lines textarea { width: 100%; min-height: 3.2rem; resize: vertical; }
.quote-lines input[type=text] { width: 100%; }
.quote-lines .sec-input { margin-top: .35rem; font-size: .82rem; }
.quote-lines td { vertical-align: top; }
.quote-lines tr.is-removed { opacity: .35; }
.quote-lines .qty, .quote-lines .rate { text-align: right; }
.quote-lines .amt { text-align: right; white-space: nowrap; font-weight: 600; }
.sec-row td { background: var(--gold-soft); }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid #eee; }
.totals dt { font-weight: 500; }
.totals dd { margin: 0; font-weight: 650; text-align: right; }
.totals .grand { font-size: 1.1rem; border-bottom: 0; background: var(--gold-soft); padding: .55rem .6rem; border-radius: 10px; margin-top: .3rem; }
.totals input[type=text] { width: 7.5rem; text-align: right; }
.totals input.mini { width: 3.6rem; }
.copy-row { display: flex; gap: .5rem; margin-top: .5rem; }
.copy-row input { flex: 1; min-width: 0; }
.callout { border-left: 4px solid var(--gold); margin-bottom: 1rem; }
.sticky-actions { position: sticky; bottom: 0; display: flex; gap: .6rem; flex-wrap: wrap; padding: .8rem 0; background: linear-gradient(to top, var(--bg, #fff) 70%, transparent); z-index: 5; }
@media (max-width: 640px) {
    .quote-lines td { display: block; }
    .totals input[type=text] { width: 6rem; }
    .sticky-actions .btn { flex: 1 1 100%; }
}
@media print { .sticky-actions, .actions { display: none !important; } }
.quote-lines input[type=text], .quote-lines textarea, .totals input[type=text], .quote-public input[type=text], .copy-row input { font: inherit; font-size: .92rem; padding: .5rem .6rem; border: 1px solid #d9d9d9; border-radius: 8px; background: #fff; color: var(--ink-deep, #333); box-sizing: border-box; }
.quote-lines textarea { font-family: inherit; line-height: 1.35; }
.quote-lines input:focus, .quote-lines textarea:focus, .totals input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.quote-lines input[type=checkbox] { width: 1.2rem; height: 1.2rem; }
.sec-row td, .sec-row td b { text-align: left !important; }
.sec-row td::before { content: none !important; }
dl.totals { display: block; }
.actions .badge, .page-head .badge { white-space: nowrap; align-self: center; line-height: 1.3; }
form#quote-form { padding-bottom: 5rem; }

.nav-badge{margin-left:auto;background:var(--gold,#BC9440);color:#fff;border-radius:999px;font-size:.72rem;font-weight:700;padding:.05rem .5rem;line-height:1.4}
.tpl-vars code{display:inline-block;margin:.15rem .25rem .15rem 0;padding:.1rem .45rem;background:#f1efe9;border-radius:4px;font-size:.8rem;cursor:pointer}
.tpl-preview{width:100%;min-height:420px;border:1px solid #ddd;border-radius:6px;background:#fff}
.settings-group{margin-top:1rem}
.settings-group h2{margin-bottom:.25rem}

.chart{width:100%;height:auto;display:block}
.chart .grid{stroke:#e6e3da;stroke-width:1}
.chart .axis{fill:#6b6f76;font-size:11px;font-family:inherit}
.chart .col{fill:#BC9440}
.chart g:hover .col{fill:#414141}
.chart-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr))}
.chart-table summary{cursor:pointer;color:#6b6f76;font-size:.85rem;margin-top:.5rem}
.stat .num.money{font-size:1.5rem}
.hbars{list-style:none;margin:0;padding:0;display:grid;gap:.6rem}
.hbars li{display:grid;grid-template-columns:minmax(7rem,35%) 1fr 4.2rem;gap:.6rem;align-items:center}
.hb-t{height:12px;background:#f1efe9;border-radius:6px;overflow:hidden;display:block}
.hb-f{display:block;height:100%;background:#BC9440;border-radius:0 6px 6px 0}
.hb-v{text-align:right;font-weight:600;font-variant-numeric:tabular-nums}
@media (max-width:480px){.hbars li{grid-template-columns:1fr 3.6rem;grid-template-areas:"l v" "t t"}.hb-l{grid-area:l}.hb-v{grid-area:v}.hb-t{grid-area:t}}

/* ================= Phase 11: programme on the overview ================= */
.t-meta{display:flex;flex-wrap:wrap;gap:.2rem .7rem;color:var(--muted);font-size:.78rem;font-weight:500;margin-top:.15rem}
.t-meta .badge{font-size:.7rem}
.pg-gap{margin:.6rem 0 0;display:flex;flex-wrap:wrap;gap:.3rem .7rem;align-items:center;color:var(--muted)}
.pg-now{margin:.2rem 0 .7rem;color:var(--ink)}
.pg-group{margin:1rem 0 .3rem;font-size:.82rem;text-transform:uppercase;letter-spacing:.06em;color:var(--gold-dark)}
.pg-time{position:relative;margin-top:.2rem}
.pg-row{display:grid;grid-template-columns:150px minmax(0,1fr);align-items:center;min-height:42px;border-bottom:1px solid #f1f0eb}
.pg-label{padding-right:.5rem;min-width:0}
.pg-label b{display:block;font-size:.84rem;color:var(--ink-deep);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pg-label small{display:block;font-size:.72rem;color:var(--muted)}
.pg-label.now b{color:var(--gold-dark)}
.pg-track{position:relative;height:30px}
.pg-months{min-height:22px;border-bottom:0}.pg-months .pg-track{height:20px}
.pg-months span{position:absolute;top:2px;font-size:.68rem;color:var(--muted);border-left:1px solid #e4e2dc;padding-left:4px;height:16px;white-space:nowrap}
.pg-bar{position:absolute;top:4px;height:22px;border-radius:7px;background:#e7dcc0;overflow:hidden}
.pg-bar i{position:absolute;left:0;top:0;bottom:0;background:var(--gold)}
.pg-bar span{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:.7rem;font-weight:700;color:var(--ink-deep);text-shadow:0 0 3px #fff,0 0 3px #fff}
.pg-bar.done span{color:#fff;text-shadow:0 0 3px rgba(0,0,0,.55)}
.pg-bar.done i{background:var(--ok)}.pg-bar.late{background:#efc9c0}.pg-bar.late i{background:var(--bad)}
.pg-lane{position:absolute;left:150px;right:0;top:0;bottom:0;pointer-events:none}
.pg-today{position:absolute;top:0;bottom:0;width:2px;background:var(--bad)}
.pg-today b{position:absolute;top:-1px;left:-17px;background:var(--bad);color:#fff;font-size:.62rem;padding:1px 6px;border-radius:6px}
.pg-att{list-style:none;margin:0;padding:0}
.pg-att li{border-bottom:1px solid #eeede8}.pg-att li:last-child{border-bottom:0}
.pg-att a{display:flex;gap:.7rem;align-items:flex-start;padding:.65rem .1rem;color:inherit;text-decoration:none}
.pg-att a:hover{background:#fbf8ef}
.pg-att small{display:block;color:var(--muted)}
.pg-ic{flex:0 0 30px;height:30px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:.85rem;background:#eceae4;color:var(--muted)}
.pg-ic.bad{background:#f8e3de;color:var(--bad)}
.ws-tpl h3{margin-top:0}
@media(max-width:600px){.pg-row{grid-template-columns:118px minmax(0,1fr)}.pg-lane{left:118px}.pg-label small{display:none}.pg-label b{white-space:normal;font-size:.76rem;line-height:1.15}}
.pg-cta{display:flex;flex-wrap:wrap;gap:1rem;align-items:center;justify-content:space-between;border:1.5px dashed var(--gold);background:var(--gold-soft,#faf5e6)}
.pg-cta h3{margin:0 0 .2rem}.pg-cta p{margin:0;max-width:60ch}

/* programme PDF links on the overview */
.pg-pdf { font-weight: 600; margin-right: .6rem; white-space: nowrap; }

/* programme PDF buttons and Gantt header */
.pg-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: .2rem 0 1.1rem; }
.pg-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: .55rem 1.1rem; border-radius: 999px; font-weight: 650; font-size: .95rem; text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s; }
.pg-btn svg { width: 18px; height: 18px; flex: none; }
.pg-btn-main { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #fff; box-shadow: 0 4px 14px rgba(188,148,64,.38); }
.pg-btn-main:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(188,148,64,.5); color: #fff; }
.pg-btn-alt { background: #fff; color: var(--gold-dark); border: 1.5px solid var(--gold); }
.pg-btn-alt:hover { background: rgba(188,148,64,.1); transform: translateY(-1px); }
.pg-btn:focus-visible { outline: 3px solid rgba(188,148,64,.45); outline-offset: 2px; }
.pg-gh { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; margin: .4rem 0 .6rem; padding-top: .9rem; border-top: 1px solid var(--line, #e7e3da); }
.pg-gh h4 { margin: 0; font-size: 1.05rem; }
@media (max-width: 520px) { .pg-btn { flex: 1 1 100%; justify-content: center; } }

/* choose activities, library, materials by stage */
.ws-choose { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; border-left: 4px solid var(--gold); }
.ws-choose h3 { margin: 0 0 .2rem; }
.choose-top { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 2rem; margin: .8rem 0; }
.choose-presets { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.choose-phase { border: 1px solid var(--line, #e7e3da); margin: 0 0 1rem; }
.choose-phase-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.choose-phase-head h3 { margin: 0; }
.choose-all { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; cursor: pointer; }
.choose-list { list-style: none; margin: 0; padding: 0; }
.choose-list li { border-top: 1px solid var(--line, #eee9de); }
.choose-list label { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; padding: .65rem .3rem; cursor: pointer; min-height: 44px; }
.choose-list label:hover { background: rgba(188,148,64,.07); }
.choose-list input[type=checkbox], .choose-all input { width: 20px; height: 20px; accent-color: var(--gold-dark, #9a7430); flex: none; }
.choose-title { font-weight: 600; flex: 1 1 260px; }
.choose-meta { flex: 1 1 200px; }
.choose-tags { display: inline-flex; gap: .25rem; }
.ktag { font-style: normal; font-size: .68rem; font-weight: 700; display: inline-block; min-width: 1.35rem; text-align: center; border-radius: 4px; padding: .05rem .3rem; margin-left: .25rem; color: #fff; }
.ktag-R { background: #5a7d9a; } .ktag-C { background: #7a5c9e; } .ktag-V { background: #b0763a; }
.choose-bar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; background: #fff; border-top: 2px solid var(--gold); box-shadow: 0 -6px 18px rgba(0,0,0,.08); border-radius: 12px 12px 0 0; }
.mat-stage-h { margin: 0 0 .4rem; }

/* expenses by category / stage */
.exp-break { margin-bottom: 1rem; }
.exp-stages { list-style: none; margin: 0; padding: 0; }
.exp-stages li { padding: .55rem 0; border-top: 1px solid var(--line, #eee9de); }
.exp-stages li:first-child { border-top: 0; }
.exp-stage-head { display: flex; justify-content: space-between; gap: 1rem; }
.exp-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem; margin-bottom: 1rem; }
.exp-filter .field { margin: 0; min-width: 180px; }
.exp-total { margin-left: auto; }
.exp-receipts { margin: .8rem 0; padding: .7rem; background: rgba(188,148,64,.07); border-radius: 10px; }
.exp-receipt { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .3rem 0; }
.exp-receipt-add { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .4rem; }
.exp-card { margin-top: 1rem; }
.exp-break .bars li, .exp-card .bars li { grid-template-columns: 6.6rem minmax(0, 1fr) auto; }
.exp-break .bars li b, .exp-card .bars li b { white-space: nowrap; text-align: right; }

/* cost chart: donut + colour-coded legend */
.cost-chart { display: flex; flex-wrap: wrap; align-items: center; gap: 1.4rem 2rem; }
.cost-donut { width: 190px; height: 190px; flex: none; transform: rotate(0deg); }
.cost-donut circle { transition: opacity .15s; }
.cost-donut circle:hover { opacity: .8; }
.cost-donut-n { font-size: 7px; font-weight: 700; fill: #2b2b2b; }
.cost-donut-l { font-size: 2.6px; fill: #6b7280; }
.cost-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 340px; display: grid; gap: .7rem; min-width: 0; }
.cost-legend li { display: grid; grid-template-columns: 14px max-content minmax(60px, 1fr) max-content; align-items: center; gap: .6rem; }
.cost-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; flex: none; }
.cost-name { font-weight: 600; white-space: nowrap; }
.cost-bar { height: 8px; border-radius: 99px; background: #eceae4; overflow: hidden; }
.cost-bar i { display: block; height: 100%; border-radius: 99px; }
.cost-amt { white-space: nowrap; text-align: right; }
.cost-pc { color: #6b7280; font-size: .85rem; text-align: right; }
.cat-badge { background: color-mix(in srgb, var(--cat) 16%, #fff); color: color-mix(in srgb, var(--cat) 80%, #000); border: 1px solid color-mix(in srgb, var(--cat) 45%, #fff); }
.cat-dotline { display: inline-flex; align-items: center; gap: .3rem; margin-right: .5rem; }
@media (max-width: 560px) { .cost-chart { justify-content: center; } .cost-legend li { grid-template-columns: 14px 1fr max-content; } .cost-bar { display: none; } }

.cost-seg { font-size: 3.1px; font-weight: 700; fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.4); stroke-width: .5px; pointer-events: none; }
.cost-seg-out { fill: #374151; stroke: none; font-size: 2.9px; }
.cost-donut { width: 250px; height: 250px; max-width: 100%; }

/* site stock */
.stock-table tr.stock-low td { background: rgba(224,168,0,.09); }
.stock-table tr.stock-negative td { background: rgba(200,60,60,.08); }
.stock-new { margin: .4rem 0 .8rem; }
.stock-new summary { cursor: pointer; color: var(--gold-dark, #9a7430); font-weight: 600; }
.mv-delivered { background: #e3f1ea; color: #1f6b46; }
.mv-used { background: #e4edf4; color: #25506b; }
.mv-wasted { background: #f6e4e4; color: #8a2f2f; }
.low-stock-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.low-stock-list li { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 1px solid var(--line, #eee9de); padding-top: .55rem; }
.low-stock-list li:first-child { border-top: 0; padding-top: 0; }
.badge-danger { background: #f6dede; color: #8a2f2f; }

/* phase 15: expenses budget bar, stock use-vs-plan, section spacing */
.bud-panel { padding: .9rem 1.1rem; }
.bud-line { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; font-weight: 600; }
.bud-bar { height: 12px; border-radius: 999px; background: #eceef1; overflow: hidden; }
.bud-bar i { display: block; height: 100%; border-radius: 999px; background: #3E8E6B; }
.bud-bar.bud-near i { background: #C98A1B; }
.bud-bar.bud-over i { background: #C0392B; }
b.bud-ok { color: #2f7a58; } b.bud-near { color: #a9710f; } b.bud-over { color: #b0332a; }
.kpi-note b { color: #8a8f98; font-weight: 600; }
.use-plan { display: grid; grid-template-columns: minmax(3rem, 1fr) 2.6rem; gap: .5rem; align-items: center; min-width: 7rem; }
.use-plan b { text-align: right; font-size: .85rem; }
.mini.mini-over i { background: #C0392B; }
.stock-card > h3 { margin-top: 0; }
@media (max-width: 720px) { .use-plan { min-width: 0; grid-template-columns: 6rem 3rem; justify-content: end; } }

/* phase 16: contract and variations */
.var-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.var-table tr.var-total td { border-top: 2px solid var(--gold, #BC9440); }
@media (max-width: 720px) { .var-table td.num { text-align: left; } }
@media (max-width: 720px) { .var-table td[data-label="Item"] { display: block; text-align: left; } .var-table td[data-label="Item"]::before { display: none; } }

/* phase 17: workforce */
.wf-days { display: flex; gap: .4rem; align-items: stretch; flex-wrap: wrap; margin: 0 0 .9rem; }
.wf-days > a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 3.1rem; padding: .45rem .5rem; border-radius: 10px; background: #fff; border: 1px solid #e1e3e7; color: inherit; text-decoration: none; font-weight: 600; font-size: .85rem; }
.wf-days > a small { font-weight: 500; color: #8a8f98; }
.wf-days > a.on { background: #2b2b2c; border-color: #2b2b2c; color: #fff; } .wf-days > a.on small { color: #d6d9de; }
.wf-pick { display: flex; gap: .4rem; align-items: center; margin-left: auto; } .wf-pick input { padding: .4rem .5rem; border: 1px solid #d6d9de; border-radius: 8px; }
.wf-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.wf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .9rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid #eef0f2; }
.wf-row:last-child { border-bottom: 0; }
.wf-name { display: flex; gap: .7rem; align-items: center; cursor: pointer; }
.wf-name input[type=checkbox] { width: 1.5rem; height: 1.5rem; accent-color: #BC9440; flex: none; }
.wf-name span { display: grid; } .wf-name small { color: #8a8f98; }
.wf-half { display: flex; gap: .35rem; align-items: center; font-size: .85rem; white-space: nowrap; } .wf-half input { accent-color: #BC9440; }
.wf-ot { display: flex; gap: .35rem; align-items: center; font-size: .85rem; white-space: nowrap; } .wf-ot input { width: 4.2rem; padding: .35rem .4rem; border: 1px solid #d6d9de; border-radius: 8px; }
.wf-weekhead { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; } .wf-weekhead h3 { margin: 0; }
.wf-total td { border-top: 2px solid #BC9440; }
.tag-admin { display: inline-block; font-size: .65rem; background: #2b2b2c; color: #fff; border-radius: 6px; padding: 2px 7px; margin-left: .4rem; font-weight: 600; vertical-align: middle; }
.wf-chart { width: 100%; height: auto; display: block; }
.wf-bars li { grid-template-columns: 9.2rem minmax(0, 1fr) 2rem; }
@media (max-width: 720px) { .wf-row { grid-template-columns: 1fr 1fr; } .wf-name { grid-column: 1 / -1; } .wf-days > a { min-width: 2.6rem; } .wf-pick { margin-left: 0; width: 100%; } }

/* phase 18: clearer Gantt axis */
.pg-months { min-height: 42px; }
.pg-months .pg-track { height: 38px; }
.pg-months span { border-left: 0; padding-left: 0; height: auto; }
.pg-months .pg-mo { top: 0; font-size: .78rem; font-weight: 650; color: var(--ink-deep, #2b2b2c); }
.pg-months .pg-wk { top: 20px; font-size: .68rem; color: var(--muted); transform: translateX(-50%); }
.pg-grid { position: absolute; top: 40px; bottom: 0; width: 1px; background: #eceae4; }
.pg-today { z-index: 1; }
@media (max-width: 600px) { .pg-months .pg-mo { font-size: .7rem; } .pg-months .pg-mo:nth-child(even) { display: none; } }
.kpis-one { grid-template-columns: minmax(0, 320px); }
.pg-bar { z-index: 1; }
.pg-grid { z-index: 0; }
.pg-today { z-index: 3; }
.pg-today b { top: 21px; left: -17px; }
.pg-months .pg-wk.pg-wk-l { transform: none; }

/* phase 19: client expenses row */
.exp-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.exp-row .panel { margin: 0; }
.exp-spent { display: flex; flex-direction: column; gap: .35rem; }
.exp-spent-label { font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; color: #6b7078; }
.exp-spent-value { font-size: 1.7rem; line-height: 1.15; color: var(--ink-deep, #2b2b2c); }
.exp-trend { width: 100%; height: 96px; display: block; margin-top: auto; }
.exp-trend-dates { display: flex; justify-content: space-between; font-size: .7rem; color: #8a8f98; }
.exp-spent small { margin-top: .2rem; }
.exp-row .cost-legend { min-width: 0; }
@media (max-width: 860px) { .exp-row { grid-template-columns: 1fr; } }

/* phase 20: helmets */
.helmet { flex: none; vertical-align: -4px; }
.wf-name .helmet { margin-right: -.2rem; }
.wf-bars .bar-name { display: inline-flex; align-items: center; gap: .35rem; }
.wf-key { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin: .8rem 0 0; font-size: .78rem; color: var(--muted, #6b7078); }
.wf-key span { display: inline-flex; align-items: center; gap: .3rem; }
.wf-key b { color: var(--ink-deep, #2b2b2c); }

.exp-spent-head { display: flex; justify-content: space-between; align-items: flex-end; gap: .8rem; flex-wrap: wrap; margin-bottom: .4rem; }
.exp-spent-head > div { display: grid; gap: .15rem; }
.exp-trend { height: auto; margin-top: .2rem; }
.exp-trend-dates { display: none; }
