/* UrusFirma: navy and gold look from the prototype. No inline styles anywhere (strict CSP). */
:root {
  --st-consultation: #2a78d6; --st-quoted: #eda100; --st-negotiation: #6250d6; --st-won: #008300; --st-lost: #e34948;
  --navy: #0F1E3D; --navy-2: #1A2C55; --navy-3: #24396B;
  --gold: #B8954A; --gold-2: #D4B26A; --gold-soft: #F4ECDB; --gold-dark: #8a6d33;
  --ivory: #F7F5F0; --white: #fff; --ink: #1C2333; --muted: #626a7c; --line: #E4E0D6;
  --green: #2E7D5B; --red: #B0413E; --amber: #A8720F; --blue: #3A6EA5; --purple: #6b3fa0;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --r: 10px; --shadow: 0 2px 10px rgba(15, 30, 61, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0 }
[hidden] { display: none !important }
body { font-family: var(--sans); color: var(--ink); background: var(--ivory); font-size: 14px; line-height: 1.5 }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600 }
a { color: var(--gold-dark) }
button { font-family: inherit; cursor: pointer }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; width: 100%; background: #fff; color: var(--ink) }
input[type=checkbox] { width: auto; padding: 0; accent-color: var(--gold) }
input[readonly] { background: var(--ivory); color: var(--muted) }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-2); border-color: var(--gold) }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px }
label { font-size: 12px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 4px }
.muted { color: var(--muted) }
.small { font-size: 12px }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 8px; padding: 10px 18px; font-weight: 600; font-size: 14px; transition: .15s; text-decoration: none; white-space: nowrap }
.btn-gold { background: var(--gold); color: #fff } .btn-gold:hover { background: #a3833f }
.btn-navy { background: var(--navy); color: #fff } .btn-navy:hover { background: var(--navy-3) }
.btn-danger { background: var(--red); color: #fff } .btn-danger:hover { background: #962f2c }
.btn-success { background: var(--green); color: #fff } .btn-success:hover { background: #246549 }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink) } .btn-ghost:hover { border-color: var(--gold) }
.btn-ghost-light { background: transparent; border: 1px solid rgba(255, 255, 255, .4); color: #fff }
.btn-sm { padding: 6px 12px; font-size: 12px }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px }
.btn-block { width: 100% }
.btn:disabled { opacity: .6; cursor: wait }

/* Language toggle */
.lang { display: inline-flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 20px; overflow: hidden }
.lang button { background: transparent; border: none; color: inherit; padding: 5px 12px; font-size: 12px; font-weight: 700 }
.lang button.on { background: var(--gold); color: #fff }
.lang.dark { border-color: var(--line) }

/* Landing page: both languages in the HTML, one shown */
html[lang=ms] .en, html:not([lang=ms]) .ms { display: none }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 6%; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20 }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 22px; font-weight: 700; color: #fff; text-decoration: none }
.logo-mark { width: 38px; height: 38px; border-radius: 9px; display: block; flex: none; box-shadow: 0 0 0 1.5px rgba(212, 178, 106, .55) }
.logo-text span { color: var(--gold-2) }
.nav-links { display: flex; gap: 22px; align-items: center }
.nav-links > a:not(.btn) { color: #d9dce5; text-decoration: none; font-size: 14px }
.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%); color: #fff; padding: 90px 6% 110px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 50px; align-items: center }
.hero h1 { font-size: 44px; line-height: 1.15; margin-bottom: 18px } .hero h1 em { color: var(--gold-2); font-style: normal }
.hero p { color: #c8cede; font-size: 17px; margin-bottom: 28px; max-width: 520px }
.hero-badge { display: inline-block; border: 1px solid var(--gold); color: var(--gold-2); padding: 4px 12px; border-radius: 20px; font-size: 12px; margin-bottom: 18px }
.hero-card { background: #fff; color: var(--ink); border-radius: 14px; padding: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35) }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px }
.mini-kpis div { background: var(--ivory); border-radius: 8px; padding: 10px } .mini-kpis b { display: block; font-size: 17px; font-family: var(--serif) }
.mini-kpis small { color: var(--muted); font-size: 11px }
.mini-bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding: 8px; background: var(--ivory); border-radius: 8px }
.mini-bars i { flex: 1; background: var(--navy-2); border-radius: 4px 4px 0 0 } .mini-bars i:nth-child(even) { background: var(--gold) }
.mini-bars .b1 { height: 40% } .mini-bars .b2 { height: 55% } .mini-bars .b3 { height: 48% } .mini-bars .b4 { height: 70% } .mini-bars .b5 { height: 62% } .mini-bars .b6 { height: 88% }
.section { padding: 70px 6% } .section-title { text-align: center; margin-bottom: 40px }
.section-title h2 { font-size: 30px; margin-bottom: 8px; color: var(--navy) } .section-title p { color: var(--muted) }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 22px }
.feature h3 { font-size: 16px; margin-bottom: 6px; color: var(--navy) } .feature p { color: var(--muted); font-size: 13px }
.pricing-wrap { background: #fff }
.price-card { max-width: 420px; margin: 0 auto; border: 2px solid var(--gold); border-radius: 16px; padding: 34px; text-align: center }
.price { font-family: var(--serif); font-size: 52px; color: var(--navy); font-weight: 700 } .price small { font-size: 16px; color: var(--muted); font-family: var(--sans) }
.price-note { color: var(--green); font-weight: 600; margin-bottom: 18px }
.footer { background: var(--navy); color: #9aa3b8; padding: 30px 6%; display: flex; justify-content: space-between; font-size: 13px }
.footer a { color: #cfd5e3 }
.prose { max-width: 760px; margin: 40px auto; padding: 0 20px 60px; background: transparent }
.prose h1 { color: var(--navy); font-size: 30px; margin-bottom: 12px } .prose h2 { color: var(--navy); font-size: 19px; margin: 22px 0 8px }
.prose p, .prose li { margin-bottom: 8px } .prose ul { padding-left: 22px }
.draft-note { background: var(--gold-soft); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 6px }

/* Test banner on staging / local */
.test-banner { position: fixed; left: 12px; bottom: 12px; z-index: 150; background: var(--purple); color: #fff; font-weight: 700; font-size: 11px; letter-spacing: .5px; padding: 5px 12px; border-radius: 14px; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); pointer-events: none }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr }
.auth-side { background: linear-gradient(160deg, var(--navy), var(--navy-3)); color: #fff; padding: 50px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px }
.auth-side blockquote { font-family: var(--serif); font-size: 24px; line-height: 1.4; border-left: 3px solid var(--gold); padding-left: 18px }
.auth-note { color: #c8cede }
.auth-form { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; position: relative }
.auth-top { position: absolute; top: 20px; right: 20px }
.auth-box { width: 100%; max-width: 380px } .auth-box h2 { font-size: 28px; color: var(--navy); margin-bottom: 6px }
.auth-box .sub { color: var(--muted); margin-bottom: 24px }
.auth-links { margin-top: 18px } .auth-links p { margin-bottom: 8px }
.link { color: var(--gold-dark); font-weight: 600 }

/* Form fields */
.field { margin-bottom: 14px; min-width: 0 }
.form-grid .field { margin-bottom: 0 }
.field .hint { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px }
.field-error { color: var(--red); font-size: 12px; min-height: 0 }
.field-error:empty { display: none }
.invalid { border-color: var(--red) !important; background: #fff8f7 }
.form-error { color: var(--red); font-weight: 600; grid-column: 1 / -1 }
.form-error:empty { display: none }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); font-weight: 500 }
.label-action { float: right; margin-top: -4px }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px } .full { grid-column: 1 / -1 }
.form-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; flex-wrap: wrap }
.sp { flex: 1 }

/* App shell */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh }
.side { background: var(--navy); color: #cfd5e3; padding: 20px 14px 64px; position: sticky; top: 0; height: 100vh; overflow-y: auto }
.side-top { display: flex; align-items: flex-start; gap: 6px; margin: 0 2px 18px }
.side-brand { flex: 1; min-width: 0 }
.side-firm { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none }
.firm-mark { width: 38px; height: 38px; border-radius: 9px; background: var(--gold); color: #fff; display: grid; place-items: center; font-family: var(--serif);
  font-weight: 700; font-size: 14px; flex: none; overflow: hidden }
.firm-name { font-family: var(--serif); font-weight: 700; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere }
.powered { font-family: var(--serif); font-size: 11.5px; font-weight: 700; color: #9aa3b8; margin: 6px 0 0 48px; letter-spacing: .2px }
.powered span { color: var(--gold-2) }
.side-toggle { background: none; border: none; color: #9aa3b8; padding: 6px; border-radius: 6px; flex: none; line-height: 0 }
.side-toggle:hover { background: var(--navy-2); color: #fff }
/* Collapsed: an icon rail. Labels, group titles and the wordmark hide; every page icon stays reachable. */
.app { transition: grid-template-columns .15s }
.app.side-collapsed { grid-template-columns: 64px 1fr }
.app.side-collapsed .side { padding: 16px 8px 64px }
.app.side-collapsed .side-top { flex-direction: column; align-items: center; gap: 10px }
.app.side-collapsed .firm-name, .app.side-collapsed .powered, .app.side-collapsed .side-group-btn, .app.side-collapsed .nav-label { display: none }
.app.side-collapsed .side-items[hidden] { display: block !important }
.app.side-collapsed .side a { justify-content: center; padding: 10px 0 }
.app.side-collapsed .side-toggle .nav-icon { transform: scaleX(-1) }
.app.side-collapsed .side-group { margin-bottom: 0; border-top: 1px solid rgba(255,255,255,.08); padding-top: 4px }

.side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #cfd5e3; text-decoration: none; font-size: 13.5px; margin-bottom: 2px }
.side a:hover { background: var(--navy-2) } .side a.on { background: var(--gold); color: #fff; font-weight: 600 }
.side-group { margin-bottom: 6px }
.side-group-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; color: #7d88a3;
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; padding: 10px 10px 6px; text-align: left; border-radius: 6px }
.side-group-btn:hover { color: #cfd5e3 }
.side-group-btn .chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; flex: none }
.side-group-btn[aria-expanded=false] .chev { transform: rotate(-90deg) }
.nav-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: .9 }
.side a.on .nav-icon { opacity: 1 }
.main { min-width: 0 }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 26px; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 10; flex-wrap: wrap }
.topbar h1 { font-size: 20px; color: var(--navy) }
.top-right { display: flex; align-items: center; gap: 14px }
.who { display: flex; flex-direction: column; line-height: 1.2; text-align: right } .who small { color: var(--muted); font-size: 11px }
.mobile-nav { display: none }
.content { padding: 24px 26px; max-width: 1400px }
.page-title { color: var(--navy); font-size: 20px; margin-bottom: 14px }
.loading-box { color: var(--muted); padding: 30px 0 }
.error-box { border-left: 4px solid var(--red) } .error-box p { margin-bottom: 10px }

/* Cards / tables */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 18px }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px } .card-h h3, .card > h3 { font-size: 16px; color: var(--navy); margin-bottom: 10px }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; align-items: start }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap } .toolbar input[type=search] { max-width: 280px } .toolbar select { width: auto }
.table-wrap { overflow-x: auto; padding: 0 }
table { width: 100%; border-collapse: collapse }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); background: #FBFAF7 }
td { padding: 11px 10px; border-bottom: 1px solid #F0EDE6; font-size: 13.5px; vertical-align: top }
tr.clickable { cursor: pointer } tr.clickable:hover td { background: #FCFBF8 }
td.empty { text-align: center; padding: 30px }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; white-space: nowrap }
.p-green { background: #E3F2EA; color: var(--green) } .p-red { background: #F7E3E2; color: var(--red) }
.p-amber { background: #FBF0DA; color: var(--amber) } .p-blue { background: #E2ECF6; color: var(--blue) } .p-grey { background: #ECECEC; color: #555 }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 18px }
.meta div { background: var(--ivory); padding: 10px; border-radius: 8px; overflow-wrap: anywhere; white-space: pre-line } .meta small { color: var(--muted); font-size: 11px; display: block }
.meta .full { grid-column: 1 / -1 }

/* KPIs and charts */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
table.sr-only { display: block } .chart-fig { position: relative }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; border-top: 3px solid var(--gold); min-width: 0 }
.kpi[role=link] { cursor: pointer } .kpi[role=link]:hover { border-color: var(--gold) }
.kpi small { color: var(--muted); font-size: 12px; font-weight: 600; display: block }
.kpi b { display: block; font-family: var(--serif); font-size: 21px; color: var(--navy); margin: 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.kpi-sub { font-size: 12px; color: var(--muted) } .kpi-sub.up { color: var(--green); font-weight: 600 } .kpi-sub.down { color: var(--red); font-weight: 600 }
.kpi-warn { border-top-color: var(--red) } .kpi-warn b { color: var(--red) }
.todo { display: block; padding: 12px 16px } .todo a { color: var(--gold-dark); font-weight: 600 }
.chart-fig { margin: 0 }
.vchart { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 18px; border-bottom: 1px solid var(--line) }
.vbar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; position: relative }
.vbar { width: 100%; max-width: 34px; background: var(--navy-3); border-radius: 4px 4px 0 0 }
.vbar.cur { background: var(--gold) } .vbar:hover, .vbar:focus { background: var(--navy); outline: none } .vbar.cur:hover, .vbar.cur:focus { background: var(--gold-dark) }
.vbar-val { font-size: 10px; color: var(--muted); white-space: nowrap; margin-bottom: 2px; min-height: 13px }
.vbar-col:last-child .vbar-val { align-self: flex-end }
.vchart-labels { display: flex; gap: 6px; padding-top: 4px } .vchart-labels span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); min-width: 0; overflow: hidden }
.hbars { margin-bottom: 6px }
.table-scroll { overflow-x: auto; margin: 0 -2px }
.card > h3, .card-h h3 { margin-bottom: 0 } .card > h3 { margin-bottom: 12px } .card-h { margin-bottom: 14px }
.card > small.muted { display: block; margin-top: 10px }
.wf-chart { width: 100%; height: auto; display: block }
.wf-chart .axis { stroke: #b9b4a8 } .wf-chart .grid { stroke: var(--line); stroke-dasharray: 2 4 }
.wf-chart .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums }
.wf-chart .wf-link { stroke: #9aa0ac; stroke-dasharray: 3 3 } .wf-chart .wf-zero { stroke: #9aa0ac; stroke-width: 2 }
.wf-consultation { fill: var(--st-consultation) } .wf-quoted { fill: var(--st-quoted) } .wf-negotiation { fill: var(--st-negotiation) }
.wf-won { fill: var(--st-won) } .wf-lost { fill: var(--st-lost) } .wf-total { fill: var(--navy) }
.wf-chart .wf-bar:focus { outline: none } .wf-chart .wf-bar:focus rect, .wf-chart .wf-bar:hover rect { opacity: .82 }
.wf-chart .lbl { font-size: 12px; fill: var(--muted) } .wf-chart .lbl-total { font-weight: 700; fill: var(--navy) }
.wf-chart .val { font-size: 12.5px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums } .wf-chart .val-total { fill: var(--navy); font-size: 13.5px }
.card-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap } .month-select { width: auto; padding: 5px 10px; font-size: 13px }
.empty-chart { padding: 40px 0; text-align: center }
.legend-inline { display: flex; gap: 14px; font-size: 12px; color: var(--muted) } .legend-inline span { display: inline-flex; align-items: center; gap: 6px }
.legend-inline .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px }
.rk-new-bg { background: var(--navy-3) } .rk-won-bg { background: var(--gold) }
.ranking { list-style: none } .ranking li { display: grid; grid-template-columns: 34px minmax(120px, 1.2fr) minmax(160px, 2fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line) }
.ranking li:last-child { border-bottom: none }
.rk-pos { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--ivory); color: var(--navy) }
.rk-1 { background: var(--gold); color: #fff } .rk-2 { background: #c9ced8; color: var(--navy) } .rk-3 { background: #d9b48c; color: #fff }
.rk-who { display: flex; flex-direction: column; min-width: 0 } .rk-who b { overflow-wrap: anywhere }
.rk-bars { display: flex; flex-direction: column; gap: 6px } .rk-line { display: flex; align-items: center; gap: 8px }
.rk-track { flex: 1; height: 8px; background: var(--ivory); border-radius: 4px; overflow: hidden } .rk-fill { display: block; height: 100%; border-radius: 4px }
.rk-new { background: var(--navy-3) } .rk-won { background: var(--gold) } .rk-num { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 52px }
.rk-stats { display: flex; gap: 18px } .rk-stats span { display: flex; flex-direction: column; text-align: right } .rk-stats small { font-size: 11px; color: var(--muted) }
.added-by { margin-top: 6px; font-size: 11px !important; color: #8a8f9c !important; border-top: 1px dashed var(--line); padding-top: 5px }
.added-by-line { font-size: 12px }
.cf-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start }
.kpi-good b { color: var(--green) }
table.mini td { padding: 8px 6px; font-size: 13px } table.mini th { padding: 7px 6px }
.cost-form { display: grid; grid-template-columns: 130px minmax(0, 1fr) 110px; gap: 8px; margin-bottom: 8px } .cost-form .form-error { grid-column: 1 / -1 }
.cost-total { font-family: var(--serif); color: var(--navy); font-size: 16px } .cost-empty { margin-top: 10px }
.log-form.inline-form { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px } .log-form.inline-form .form-error { grid-column: 1 / -1 }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; align-items: start }
.dash-col { min-width: 0 } .dash-col > .card { margin-bottom: 18px }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none }
.seg button { background: #fff; border: none; padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--muted) }
.seg button + button { border-left: 1px solid var(--line) } .seg button.on { background: var(--navy); color: #fff }
.ytd-chart { width: 100%; height: auto; display: block }
.ytd-chart .axis { stroke: var(--line); stroke-width: 1 } .ytd-chart .ytd-area { fill: var(--gold-soft) }
.ytd-chart .ytd-line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round }
.ytd-chart .dot { fill: var(--gold); stroke: #fff; stroke-width: 2 } .ytd-chart .hit { fill: transparent }
.ytd-chart .ytd-pt:hover .dot, .ytd-chart .ytd-pt:focus .dot { fill: var(--navy) } .ytd-chart .ytd-pt:focus { outline: none }
.ytd-chart .lbl { font-size: 11px; fill: var(--muted) } .ytd-chart .val { font-size: 12px; font-weight: 700; fill: var(--navy) }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px }
.donut { width: 160px; height: 160px; flex: none }
.donut .slice { fill: none; stroke-width: 30 } .donut .slice:focus { outline: none; stroke-width: 34 }
.donut-total { font-family: var(--serif); font-size: 20px; font-weight: 700; fill: var(--navy) } .donut-sub { font-size: 11px; fill: var(--muted) }
.slice-1 { stroke: #2a78d6 } .slice-2 { stroke: #eb6834 } .slice-3 { stroke: #1baf7a } .slice-4 { stroke: #eda100 } .slice-5 { stroke: #e87ba4 } .slice-6 { stroke: #008300 }
.slice-bg-1 { background: #2a78d6 } .slice-bg-2 { background: #eb6834 } .slice-bg-3 { background: #1baf7a } .slice-bg-4 { background: #eda100 } .slice-bg-5 { background: #e87ba4 } .slice-bg-6 { background: #008300 }
.legend { list-style: none; flex: 1; min-width: 150px } .legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none } .legend .legend-name { flex: 1; min-width: 0; overflow-wrap: anywhere } .legend b { font-variant-numeric: tabular-nums }
.next-list, .todo-list { list-style: none } .next-list li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer }
.next-list li b { white-space: nowrap; color: var(--navy) } .todo-list li { padding: 5px 0 } .todo-list a { color: var(--gold-dark); font-weight: 600 }
.hbar { margin-bottom: 12px } .hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px } .hbar-top b { font-variant-numeric: tabular-nums; white-space: nowrap }
.hbar-track { height: 8px; background: var(--ivory); border-radius: 4px; overflow: hidden } .hbar-fill { height: 100%; background: var(--gold); border-radius: 4px }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px }
.col { background: #EFECE4; border-radius: var(--r); padding: 10px; min-height: 420px }
.col.over { outline: 2px dashed var(--gold) }
.col-h { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; padding: 4px 6px 10px; color: var(--navy) }
.col-h small { color: var(--muted); font-weight: 600 }
.k-card { background: #fff; border-radius: 8px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow); cursor: grab; border-left: 3px solid var(--gold) }
.k-card:active { cursor: grabbing } .k-card.drag { opacity: .4 }
.k-card.stage-consultation { border-left-color: var(--st-consultation) } .k-card.stage-quoted { border-left-color: var(--st-quoted) }
.k-card.stage-negotiation { border-left-color: var(--st-negotiation) } .k-card.stage-won { border-left-color: var(--st-won) } .k-card.stage-lost { border-left-color: var(--st-lost) }
.col-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px }
.dot-consultation { background: var(--st-consultation) } .dot-quoted { background: var(--st-quoted) } .dot-negotiation { background: var(--st-negotiation) }
.dot-won { background: var(--st-won) } .dot-lost { background: var(--st-lost) }
.form-section { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--gold-dark); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 4px }
.won-box p { margin-bottom: 8px }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px }
.choice { border: 2px solid var(--line); border-radius: 12px; background: #fff; padding: 20px 16px; text-align: left; display: flex; flex-direction: column; gap: 6px }
.choice:hover, .choice:focus-visible { border-color: var(--gold) } .choice b { font-size: 15px; color: var(--navy) } .choice small { color: var(--muted) }
.choice .nav-icon { width: 26px; height: 26px; color: var(--gold-dark) }
.k-card b { display: block; font-size: 13.5px; margin-bottom: 3px; overflow-wrap: anywhere } .k-card small { color: var(--muted); display: block; overflow-wrap: anywhere }
.k-card .v { font-family: var(--serif); font-weight: 700; color: var(--navy) }
.deal-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px }
.opp-quotes td { padding: 8px }

/* Quotation form */
.opp-ref { background: var(--gold-soft); padding: 8px 12px; border-radius: 8px; overflow-wrap: anywhere }
.qhead, .qrow { display: grid; grid-template-columns: minmax(0, 3fr) minmax(110px, 1fr) auto; gap: 8px; align-items: center }
.qhead { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; margin-bottom: 4px }
.qrow { margin-bottom: 6px } .qrow .field-error { grid-column: 1 / -1 }
.qrow .q-fee { text-align: right; font-variant-numeric: tabular-nums }
.q-total-row { display: flex; justify-content: flex-end; align-items: baseline; gap: 16px; margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--navy) }
.q-total-row span { font-weight: 700; color: var(--navy) }
.q-total { font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--navy) } .q-total.warn { color: var(--amber) }
.preview-wrap .doc-frame, .doc-frame { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 30px; overflow-x: auto }
.quote-ref { font-family: var(--serif); font-weight: 700; color: var(--navy); font-size: 16px }
.timeline { border-left: 2px solid var(--gold-soft); padding-left: 16px; margin-left: 4px }
.timeline div { position: relative; margin-bottom: 12px; font-size: 13px }
.timeline div::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50% ; background: var(--gold) }
.timeline small { color: var(--muted); display: block }

/* Matters */
td.soon { color: var(--amber); font-weight: 700 }
.matter-tag { margin-top: 6px; color: var(--navy) !important; font-weight: 600 }
.matter-title { color: var(--navy); font-size: 19px; margin-bottom: 12px; overflow-wrap: anywhere }
.log-form .field { margin-bottom: 8px }
.log-list { margin-top: 16px; height: 380px; overflow-y: auto; padding-right: 6px }
.log-list .log-entry { padding: 2px 36px 2px 0; position: relative }
.log-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }
.log-remove-toggle.active { background: #fdecec; border-color: #e34948; color: #b42318 }
/* × per note: hidden until "Remove notes" is on */
.log-del { display: none; position: absolute; right: 2px; top: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid #f1b5b4;
  background: #fff; color: #b42318; font-size: 17px; line-height: 1; cursor: pointer; padding: 0 }
.log-del:hover, .log-del:focus-visible { background: #e34948; border-color: #e34948; color: #fff }
.removing .log-del { display: grid; place-items: center }
.removing .log-entry { background: #fffaf9 }
@media (max-width: 760px) { .log-list { height: 300px } }
.modal-max { max-width: min(1200px, 96vw); height: 92vh; display: flex; flex-direction: column } .modal-max .modal-b { flex: 1; overflow: hidden; display: flex; flex-direction: column }
.log-max { display: flex; flex-direction: column; height: 100%; min-height: 0 } .log-max-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 10px } .log-max-tools input { max-width: 360px }
.log-max-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; flex: 1; min-height: 0 }
.log-max-body > div:first-child { min-height: 0; display: flex; flex-direction: column }
.log-list-max { height: auto; flex: 1; overflow-y: auto; margin-top: 0 } .log-max-form { border-left: 1px solid var(--line); padding-left: 18px }
.log-max-form .log-form.inline-form { grid-template-columns: 1fr }
.log-text { white-space: pre-wrap; overflow-wrap: anywhere }
.parts-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center } .parts-row select { width: auto }

/* Invoices */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line) }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px }
.tabs a.on { color: var(--navy); border-bottom-color: var(--gold) }
.q-totals .q-total-row.sub { border-top: none; margin-top: 2px; padding-top: 0; font-size: 13px }
.q-totals .q-total-row.sub span { font-weight: 600; color: var(--muted) }
.money-sum { display: flex; justify-content: space-between; border-top: 2px solid var(--navy); margin-top: 10px; padding-top: 8px; color: var(--navy) }
.form-grid.inner { gap: 14px }
.numbering td { vertical-align: middle } .numbering input { max-width: 90px } .numbering select { width: auto }

/* Billing */
.sub-banner { padding: 9px 26px; font-size: 13px; font-weight: 600; background: var(--gold-soft); color: #6d531d } .sub-banner a { color: var(--navy) }
.sub-grace { background: #FBF0DA; color: var(--amber) } .sub-expired { background: #F7E3E2; color: var(--red) }
.phone-box { max-width: 360px; margin-bottom: 14px }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 10px }
.plan { border: 2px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start }
.plan:last-child { border-color: var(--gold) } .plan-price { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--navy) }
.plan small.up { color: var(--green); font-weight: 600 }

/* Payroll */
.pr-estimate { background: #FBF0DA; border-color: #f0dcae; color: #7a5a12; font-weight: 600 }
.pr-note { margin-top: 6px }
.rates th { text-align: left; white-space: nowrap; font-size: 12px; color: var(--ink); text-transform: none; letter-spacing: 0 } .rates td { white-space: nowrap }
.rate-input { width: 90px !important; display: inline-block; text-align: right }
.plain-list { list-style: none } .plain-list li { padding: 4px 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere }

/* Settings */
.settings { max-width: 900px }
/* Settings: services (click a row to edit) */
.svc-list { margin: 6px 0 12px }
.svc-block { border-bottom: 1px solid var(--line); padding: 8px 0 }
.svc-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 7px 10px; cursor: pointer; font: inherit; color: var(--ink) }
.svc-item:hover, .svc-item:focus-visible { background: var(--ivory) }
.svc-main .svc-name { font-weight: 700; font-size: 15px }
.svc-sub { padding-left: 28px; font-size: 14px }
.svc-code { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--navy); background: #e8eef8; border-radius: 999px; padding: 2px 8px }
.svc-code.none { color: var(--muted); background: none; font-weight: 400; letter-spacing: 0; padding: 0 }
.svc-edit { margin-left: auto; color: var(--muted); opacity: 0; font-size: 14px }
.svc-item:hover .svc-edit, .svc-item:focus-visible .svc-edit { opacity: 1 }
.svc-item.off .svc-name { color: var(--muted); text-decoration: line-through }
.svc-add { background: none; border: 0; color: var(--gold-dark); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 10px 4px 28px }
.svc-add:hover { text-decoration: underline }
@media (hover: none) { .svc-edit { opacity: 1 } }
.subs { list-style: none; padding-left: 18px; margin-top: 4px } .subs li { padding: 3px 0; font-size: 13px }
.example { display: block; font-family: var(--serif); font-weight: 700; color: var(--navy); padding: 9px 0 }
.temp-pw code { display: inline-block; font-size: 22px; letter-spacing: 1px; background: var(--ivory); border: 1px dashed var(--gold); padding: 8px 14px; border-radius: 8px; margin: 10px 0; user-select: all }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 30, 61, .55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 600px; max-height: 92vh; overflow-y: auto } .modal-wide { max-width: 820px }
.modal-h { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px }
.modal-h h3 { color: var(--navy); overflow-wrap: anywhere } .modal-b { padding: 20px 22px } .modal-b h3 { color: var(--navy); font-size: 15px; margin: 6px 0 8px }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap }
.x { background: none; border: none; font-size: 24px; color: var(--muted); line-height: 1 }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 8px; border-left: 4px solid var(--gold); z-index: 200; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: calc(100vw - 48px) }
.toast-error { border-left-color: var(--red) }

@media (max-width: 900px) {
  .hero, .auth, .grid-2, .dash-grid, .cf-grid, .log-max-body { grid-template-columns: 1fr }
  .log-max-form { border-left: none; padding-left: 0 } .features { grid-template-columns: 1fr 1fr }
  .hero { padding: 50px 16px 60px } .hero h1 { font-size: 32px } .section { padding: 50px 16px } .nav { padding: 14px 16px }
  .nav-links > a:not(.btn) { display: none }
  .app, .app.side-collapsed { grid-template-columns: 1fr } .side { display: none } .auth-side { display: none }
  .topbar { padding: 10px 16px } .content { padding: 16px }
  .mobile-nav { display: flex; gap: 4px; width: 100%; overflow-x: auto; order: 3 }
  .mobile-nav a { padding: 6px 10px; border-radius: 16px; text-decoration: none; color: var(--ink); font-size: 13px; white-space: nowrap; border: 1px solid var(--line) }
  .mobile-nav a.on { background: var(--gold); color: #fff; border-color: var(--gold) } .mobile-nav .nav-icon { display: none }
  .who { display: none } .hide-mobile { display: none }
  .doc-frame { padding: 14px }
}
@media (max-width: 560px) {
  .form-grid, .features, .meta, .choice-grid, .cost-form, .log-form.inline-form { grid-template-columns: 1fr }
  .qhead { display: none } .qrow { grid-template-columns: minmax(0, 1fr) 96px auto }
  .ranking li { grid-template-columns: 34px 1fr; } .rk-bars, .rk-stats { grid-column: 2 } .rk-stats { justify-content: flex-start } .rk-stats span { text-align: left }
  .kanban { grid-template-columns: repeat(5, 84vw); scroll-snap-type: x mandatory } .col { scroll-snap-align: start; min-height: 300px }
  /* Wide tables scroll sideways inside their card instead of squeezing columns. */
  .table-wrap > table, .card.table-wrap table { min-width: 620px } .table-wrap { -webkit-overflow-scrolling: touch }
  .toolbar > select, .toolbar > input[type=search] { flex: 1 1 140px; max-width: none }
  .ps-cols { grid-template-columns: 1fr }
  .footer { flex-direction: column; gap: 8px }
}

/* Settings: payment QR */
.qr-box { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 4px }
.qr-preview { width: 120px; height: 120px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px }
.qr-empty { width: 120px; height: 120px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 8px }
.qr-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: 320px }
/* Discount row in quotation/invoice forms */
.discount-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr); gap: 10px }
.k-card .k-desc { display: block; font-size: 13px; color: var(--ink); margin-top: 2px; overflow-wrap: anywhere }

/* Payroll: statutory rate cards */
.rate-cards { display: grid; gap: 16px; margin-bottom: 16px }
.rate-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch }
.rate-card { margin: 0 }
.rate-card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px }
.rate-card-h h3 { margin: 0 }
.rate-toggle { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; background: var(--ivory); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer }
.rate-toggle input { width: 16px; height: 16px; margin: 0 }
.rate-grid { width: 100%; border-collapse: collapse }
.rate-grid th, .rate-grid td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: middle }
.rate-grid thead th { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: normal; line-height: 1.3 }
.rate-grid tbody th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; white-space: normal }
.rate-grid td.num, .rate-grid th.num { text-align: right; width: 110px }
.rate-grid .rate-input { width: 84px; text-align: right }
.rate-nil { color: var(--muted); display: inline-block; width: 84px; text-align: right; padding-right: 10px }
.rate-extra { margin-top: 12px }
.rate-field { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 4px 12px; font-size: 13px; font-weight: 600 }
.rate-field small { grid-column: 1 / -1; font-weight: 400 }
.rate-rm { display: inline-flex; align-items: center; gap: 6px; color: var(--muted) } .rate-rm .rate-input { width: 110px; text-align: right }
.rate-off-note { display: none; margin: 8px 0 0 }
.rate-card.off .rate-body { opacity: .4; pointer-events: none }
.rate-card.off .rate-off-note { display: block }
.rate-save .form-actions { margin-top: 4px }
@media (max-width: 900px) { .rate-col { grid-template-columns: 1fr } }
@media (max-width: 560px) { .rate-grid td.num, .rate-grid th.num { width: auto } .rate-grid .rate-input, .rate-nil { width: 64px } }
.list-add { display: grid; grid-template-columns: minmax(0, 420px) auto; gap: 10px; align-items: end } .list-add .form-error { grid-column: 1 / -1 } .list-add .field { margin: 0 }
.firm-mark.firm-logo { background: #fff; padding: 3px; overflow: hidden } .firm-mark.firm-logo img { width: 100%; height: 100%; object-fit: contain; display: block }
.logo-preview { max-width: 200px; max-height: 100px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px } .logo-empty { width: 100px; height: 64px; font-family: var(--serif); font-weight: 700; color: var(--navy); font-size: 18px }
small.block { display: block; margin: 4px 0 0 24px }
table.numbering tr.changed td { background: var(--gold-soft) }

/* Dashboard: AI monthly report */
.ai-card { margin-bottom: 16px; border-left: 4px solid var(--gold) }
.ai-card .card-h h3 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap }
.ai-badge { font-family: var(--sans, inherit); font-size: 11px; font-weight: 800; letter-spacing: .06em; color: #fff; background: var(--navy); border-radius: 6px; padding: 2px 7px }
.ai-month { width: auto; max-width: 200px }
.ai-headline { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--navy); margin: 4px 0 6px }
.ai-summary { margin: 0 0 10px; line-height: 1.55 }
.ai-more { margin-top: 4px }
.ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px }
.ai-box { border-radius: 10px; padding: 12px 16px; border: 1px solid; border-left-width: 4px }
.ai-box h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em }
.ai-good { background: #ecf8f1; border-color: #bfe5cf; border-left-color: #1baf7a } .ai-good h4 { color: #0b6b45 }
.ai-watch { background: #fdf5e6; border-color: #f2dcae; border-left-color: #eda100 } .ai-watch h4 { color: #8a5a00 }
.ai-act { background: #edf3fc; border-color: #c9daf3; border-left-color: #2a78d6; margin-bottom: 12px } .ai-act h4 { color: #1d4f91 }
.ai-note { background: #f3f3f1; border-color: #e2e1dc; border-left-color: #9a9a95; color: var(--muted); font-size: 13px } .ai-note p { margin: 0 }
.ai-list { margin: 0; padding-left: 18px; line-height: 1.5; color: var(--ink) } .ai-list li { margin-bottom: 4px }
.ai-good .ai-list li::marker { color: #1baf7a } .ai-watch .ai-list li::marker { color: #c27c00 }
.ai-actions { margin: 0; padding-left: 20px; line-height: 1.5; color: var(--ink) } .ai-actions li { margin-bottom: 8px } .ai-actions li:last-child { margin-bottom: 0 } .ai-actions b { display: block }
.ai-actions li::marker { color: #2a78d6; font-weight: 700 }
.ai-disclaimer { margin-top: 12px }
@media (max-width: 760px) { .ai-cols { grid-template-columns: 1fr } }
table.numbering .next-input { width: 80px }

/* Settings: import */
.imp-card .card-h h3 { display: flex; align-items: center; gap: 10px }
.imp-step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-family: inherit }
.imp-btns { display: flex; gap: 8px; flex-wrap: wrap }
.imp-cols { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px } .imp-cols code { font-size: 12px; background: var(--ivory); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px }
.imp-cols code.req { border-color: var(--gold); font-weight: 700 }
.imp-result { margin-top: 10px; display: grid; gap: 10px; justify-items: start }
.imp-counts { display: flex; gap: 6px; flex-wrap: wrap }
.imp-table { width: 100%; max-height: 260px; overflow: auto }
tr.imp-error td { color: #b42318 } tr.imp-duplicate td { color: var(--muted) }
