:root {
  --background: #f2f0ea;
  --surface: #ffffff;
  --surface-soft: #f7f5f0;
  --ink: #3f3c38;
  --ink-soft: #514d48;
  --muted: #7d756c;
  --taupe: #6f665b;
  --gold: #a78955;
  --gold-soft: #ede5d7;
  --border: #e2ddd3;
  --positive: #54725f;
  --positive-soft: #e7efe9;
  --negative: #965b50;
  --negative-soft: #f3e7e4;
  --shadow: 0 18px 50px rgba(63, 60, 56, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(167, 137, 85, 0.08), transparent 26rem),
    var(--background);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.site-header {
  width: min(1320px, calc(100% - 48px));
  min-height: 94px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(111, 102, 91, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  width: 52px;
  height: 52px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 7px 20px rgba(63, 60, 56, 0.1);
}

.brand-logo img {
  width: 58px;
  height: 58px;
  object-fit: cover;
}

.brand strong {
  display: block;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 21px;
  letter-spacing: 0.045em;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.read-only {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--taupe);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.read-only span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 4px var(--positive-soft);
}

.header-actions { display: flex; align-items: center; gap: 18px; }

.settings-button {
  position: relative;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--taupe);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(63, 60, 56, 0.06);
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.commercial-link {
  min-height: 42px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--gold);
  background: rgba(237, 229, 215, .72);
  border: 1px solid rgba(167, 137, 85, .25);
  border-radius: 999px;
  box-shadow: 0 7px 20px rgba(63, 60, 56, 0.06);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.commercial-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.commercial-link:hover,
.commercial-link.active { color: var(--surface); background: var(--gold); border-color: var(--gold); transform: translateY(-1px); }
.commercial-link:focus-visible { outline: 3px solid rgba(167, 137, 85, 0.28); outline-offset: 3px; }
.header-back-link { min-height: 42px; padding: 0 4px; display: inline-flex; align-items: center; gap: 7px; color: var(--taupe); font-size: 10px; font-weight: 800; text-decoration: none; text-transform: uppercase; }
.header-back-link:hover { color: var(--gold); }
.header-back-link:focus-visible { outline: 3px solid rgba(167, 137, 85, .22); outline-offset: 3px; border-radius: 6px; }
.settings-button:hover { color: var(--gold); background: var(--surface); border-color: rgba(167, 137, 85, 0.55); transform: rotate(18deg); }
.settings-button:focus-visible { outline: 3px solid rgba(167, 137, 85, 0.28); outline-offset: 3px; }
.settings-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }

.logout-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, .64);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: 0 7px 20px rgba(63, 60, 56, .06);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease, background 160ms ease;
}
.logout-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.logout-button:hover { color: var(--negative); background: var(--surface); border-color: rgba(150, 91, 80, .45); transform: translateX(2px); }
.logout-button:focus-visible { outline: 3px solid rgba(150, 91, 80, .2); outline-offset: 3px; }
.logout-button:disabled { cursor: wait; opacity: .55; }

.settings-indicator {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--background);
  border-radius: 50%;
  background: var(--gold);
}

.settings-button.source-ok .settings-indicator { background: var(--positive); }
.settings-button.source-error .settings-indicator { background: var(--negative); }
body.settings-open { overflow: hidden; }

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  background: rgba(49, 46, 42, 0.38);
  backdrop-filter: blur(4px);
}

.settings-overlay[hidden] { display: none; }

.settings-dialog {
  width: min(540px, 100%);
  height: 100%;
  padding: 34px;
  overflow-y: auto;
  color: var(--ink);
  background: var(--surface);
  box-shadow: -24px 0 70px rgba(49, 46, 42, 0.18);
}

.settings-dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.settings-dialog-header h2 { margin: 0; font-size: 30px; }

.settings-close {
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.settings-close:hover { color: var(--ink); border-color: var(--gold); }
.settings-close:focus-visible { outline: 3px solid rgba(167, 137, 85, 0.28); outline-offset: 2px; }
.settings-description { margin: 22px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }

.settings-current {
  position: relative;
  margin-top: 20px;
  padding: 16px 16px 16px 42px;
  display: grid;
  gap: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.settings-current::before { content: ''; position: absolute; top: 20px; left: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px var(--gold-soft); }
.settings-current.accessible::before { background: var(--positive); box-shadow: 0 0 0 5px var(--positive-soft); }
.settings-current.unavailable::before { background: var(--negative); box-shadow: 0 0 0 5px var(--negative-soft); }
.settings-current span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.settings-current strong { color: var(--ink); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.settings-current small { color: var(--muted); font-size: 9px; line-height: 1.45; }

.settings-form { margin-top: 25px; display: grid; gap: 11px; }
.settings-form label { color: var(--ink); font-size: 11px; font-weight: 800; }
.settings-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
}

.settings-form input:focus { outline: 3px solid rgba(167, 137, 85, 0.2); border-color: var(--gold); }
.settings-form input:disabled { opacity: .65; }
.settings-examples { display: flex; flex-wrap: wrap; gap: 7px; }
.settings-examples span { padding: 5px 7px; color: var(--muted); background: var(--surface-soft); border-radius: 7px; font-size: 8px; }
.settings-examples code { color: var(--taupe); font-size: inherit; }
.settings-note { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.settings-feedback { padding: 13px 14px; display: grid; gap: 4px; border-radius: 11px; }
.settings-feedback.success { color: var(--positive); background: var(--positive-soft); }
.settings-feedback.error { color: var(--negative); background: var(--negative-soft); }
.settings-feedback.warning { color: var(--taupe); background: var(--gold-soft); }
.settings-feedback strong { font-size: 11px; }
.settings-feedback span { font-size: 9px; line-height: 1.45; }

.settings-actions { margin-top: 8px; display: flex; justify-content: flex-end; gap: 9px; }
.settings-actions button {
  min-height: 43px;
  padding: 0 16px;
  color: var(--surface);
  background: var(--taupe);
  border: 1px solid var(--taupe);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.settings-actions button:hover { background: var(--ink); border-color: var(--ink); }
.settings-actions button:focus-visible { outline: 3px solid rgba(167, 137, 85, 0.28); outline-offset: 2px; }
.settings-actions button:disabled { opacity: .55; cursor: wait; }
.settings-actions .settings-secondary { color: var(--taupe); background: transparent; border-color: var(--border); }
.settings-actions .settings-secondary:hover { color: var(--ink); background: var(--surface-soft); border-color: var(--gold); }

.password-settings { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--border); }
.password-settings h3 { margin: 5px 0 8px; font-family: Georgia, 'Times New Roman', serif; font-size: 24px; font-weight: 500; }
.password-settings > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.password-settings code { color: var(--taupe); }
.password-form { margin-top: 18px; }
.password-form input { font-family: Arial, Helvetica, sans-serif; font-size: 14px; letter-spacing: .04em; }

/* Connexion à l'espace MDH - SUIVI */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 34px; overflow-x: hidden; }
.login-page::before,
.login-page::after { content: ''; position: fixed; z-index: -1; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.login-page::before { top: -18vw; right: -10vw; width: 52vw; height: 52vw; background: rgba(167, 137, 85, .09); }
.login-page::after { bottom: -22vw; left: -14vw; width: 52vw; height: 52vw; background: rgba(84, 114, 95, .08); }
.login-shell { width: min(1080px, 100%); min-height: 650px; display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(390px, .84fr); overflow: hidden; background: var(--surface); border: 1px solid rgba(226, 221, 211, .95); border-radius: 30px; box-shadow: 0 28px 90px rgba(63, 60, 56, .14); }
.login-identity { min-width: 0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; color: #f9f7f2; background: linear-gradient(145deg, #4e4a45 0%, #363431 100%); }
.login-identity::before { content: ''; position: absolute; right: -80px; bottom: -120px; width: 390px; height: 390px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 50%; box-shadow: 0 0 0 46px rgba(255, 255, 255, .025), 0 0 0 94px rgba(255, 255, 255, .02); }
.login-brand { width: fit-content; position: relative; z-index: 1; color: #fff; }
.login-brand .brand-logo { background: rgba(255, 255, 255, .94); }
.login-brand small { color: rgba(255, 255, 255, .62); }
.login-identity > div { max-width: 520px; position: relative; z-index: 1; }
.login-identity .eyebrow { color: #d8c39f; }
.login-identity h1 { margin: 12px 0 20px; color: #fff; font-size: clamp(48px, 5.2vw, 72px); line-height: .98; }
.login-identity > div > p:last-child { max-width: 480px; margin: 0; color: rgba(255, 255, 255, .7); font-size: 15px; line-height: 1.75; }
.login-read-only { margin: 0; display: inline-flex; align-items: center; gap: 10px; position: relative; z-index: 1; color: rgba(255, 255, 255, .68); font-size: 10px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.login-read-only span { width: 8px; height: 8px; border-radius: 50%; background: #8eb59a; box-shadow: 0 0 0 5px rgba(142, 181, 154, .13); }
.login-card { padding: 62px 54px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.login-card::before { content: ''; position: absolute; top: 0; right: 44px; width: 78px; height: 5px; background: var(--gold); border-radius: 0 0 5px 5px; }
.login-card-mark { width: 58px; height: 58px; margin-bottom: 30px; display: grid; place-items: center; color: var(--gold); background: var(--gold-soft); border-radius: 18px; }
.login-card-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.login-card h2 { margin: 5px 0 7px; font-family: Georgia, 'Times New Roman', serif; font-size: 46px; font-weight: 500; }
.login-intro { margin: 0 0 30px; color: var(--muted); font-size: 13px; }
.login-form { display: grid; gap: 10px; }
.login-form label { margin-top: 7px; color: var(--taupe); font-size: 10px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.login-form > input,
.password-input input { width: 100%; min-height: 54px; padding: 0 16px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; outline: 0; font-size: 14px; }
.login-form > input:focus,
.password-input input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(167, 137, 85, .13); }
.password-input { position: relative; }
.password-input input { padding-right: 54px; }
.password-input button { position: absolute; top: 50%; right: 8px; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; color: var(--muted); background: transparent; border: 0; border-radius: 9px; cursor: pointer; transform: translateY(-50%); }
.password-input button:hover { color: var(--gold); background: var(--gold-soft); }
.password-input button:focus-visible { outline: 2px solid rgba(167, 137, 85, .25); }
.password-input svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.login-feedback { margin-top: 5px; padding: 12px 13px; color: var(--negative); background: var(--negative-soft); border-radius: 10px; font-size: 11px; line-height: 1.45; }
.login-submit { min-height: 54px; margin-top: 12px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; color: #fff; background: var(--ink); border: 0; border-radius: 12px; cursor: pointer; font-size: 11px; font-weight: 800; letter-spacing: .025em; text-transform: uppercase; }
.login-submit:hover { background: var(--gold); }
.login-submit:focus-visible { outline: 3px solid rgba(167, 137, 85, .25); outline-offset: 3px; }
.login-submit:disabled { cursor: wait; opacity: .65; }
.login-help { margin: 22px 0 0; padding-top: 18px; color: var(--muted); border-top: 1px solid var(--border); font-size: 10px; line-height: 1.55; }

.commercial-dialog { width: min(1120px, 100%); }

.commercial-form {
  margin-top: 24px;
  padding: 16px;
  display: flex;
  align-items: end;
  gap: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 15px;
}

.commercial-date-fields { min-width: 0; flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.commercial-form label { display: grid; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.commercial-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
}
.commercial-form input:focus { outline: 3px solid rgba(167, 137, 85, .18); border-color: var(--gold); }
.commercial-form > button {
  min-height: 44px;
  padding: 0 16px;
  color: var(--surface);
  background: var(--ink);
  border: 0;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.commercial-form > button:hover { background: var(--taupe); }
.commercial-form > button:disabled { opacity: .6; cursor: wait; }

.commercial-results { margin-top: 22px; }
.commercial-overview { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); gap: 12px; }
.commercial-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.commercial-stats article { min-width: 0; padding: 17px; display: grid; align-content: center; gap: 7px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 13px; }
.commercial-stats article.won { background: var(--positive-soft); border-color: rgba(84, 114, 95, .2); }
.commercial-stats article.amendment { background: var(--gold-soft); border-color: rgba(167, 137, 85, .25); }
.commercial-stats span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.commercial-stats strong { color: var(--ink); font-family: Georgia, 'Times New Roman', serif; font-size: 29px; font-weight: 400; }
.commercial-stats .won strong { color: var(--positive); }
.commercial-stats .amendment strong { color: var(--taupe); }
.commercial-stats small { min-height: 24px; color: var(--muted); font-size: 9px; line-height: 1.35; }

.commercial-chart-card { padding: 16px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 13px; }
.commercial-chart-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.commercial-chart-heading span { color: var(--gold); font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.commercial-chart-heading h2,
.commercial-chart-heading h3 { margin: 3px 0 0; font-size: 18px; }
.commercial-chart-heading > small { color: var(--muted); font-size: 8px; white-space: nowrap; }
.commercial-chart-content { margin-top: 13px; display: grid; grid-template-columns: 118px minmax(0, 1fr); align-items: center; gap: 14px; }
.commercial-pie {
  --pie-other-end: 0%;
  --pie-won-end: 0%;
  width: 118px;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  background: conic-gradient(
    #c9c0b2 0 var(--pie-other-end),
    var(--positive) var(--pie-other-end) var(--pie-won-end),
    var(--gold) var(--pie-won-end) 100%
  );
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(63, 60, 56, .06);
}
.commercial-pie.empty { background: var(--border); }
.commercial-pie::before { content: ''; position: absolute; inset: 20px; background: var(--surface-soft); border-radius: 50%; }
.commercial-pie > div { position: relative; z-index: 1; display: grid; justify-items: center; }
.commercial-pie strong { font-family: Georgia, 'Times New Roman', serif; font-size: 24px; font-weight: 400; line-height: 1; }
.commercial-pie span { margin-top: 3px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.commercial-chart-legend { margin: 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.commercial-chart-legend li { min-width: 0; position: relative; padding-left: 13px; display: grid; gap: 2px; }
.commercial-chart-legend li::before { content: ''; position: absolute; top: 3px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: #c9c0b2; }
.commercial-chart-legend li.won::before { background: var(--positive); }
.commercial-chart-legend li.amendment::before { background: var(--gold); }
.commercial-chart-legend span { overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.commercial-chart-legend strong { font-size: 10px; }
.commercial-chart-card > p { margin: 12px 0 0; padding-top: 10px; color: var(--muted); border-top: 1px solid var(--border); font-size: 8px; line-height: 1.4; }

.commercial-list-heading { margin-top: 24px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.commercial-list-heading h2,
.commercial-list-heading h3 { margin: 0; font-size: 22px; }
.commercial-list-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.commercial-list-heading > span { color: var(--muted); font-size: 10px; font-weight: 800; }
.commercial-table-wrap { max-height: 360px; min-height: 180px; margin-top: 12px; overflow-x: hidden; overflow-y: auto; border: 1px solid var(--border); border-radius: 13px; }
.commercial-table { width: 100%; table-layout: fixed; }
.commercial-table col.date { width: 12%; }
.commercial-table col.type { width: 10%; }
.commercial-table col.affair { width: 28%; }
.commercial-table col.client { width: 30%; }
.commercial-table col.status { width: 20%; }
.commercial-table thead { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.commercial-table th { padding-top: 13px; }
.commercial-table td { padding-top: 12px; padding-bottom: 12px; font-size: 11px; vertical-align: middle; }
.commercial-table td:first-child { white-space: nowrap; }
.commercial-table .commercial-affair strong { margin-bottom: 3px; font-size: 12px; }
.commercial-table .commercial-affair small,
.commercial-table .commercial-client small { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commercial-type { display: inline-flex; padding: 4px 7px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 999px; font-size: 8px; font-weight: 800; white-space: nowrap; }
.commercial-type.amendment { color: var(--taupe); background: var(--gold-soft); border-color: rgba(167, 137, 85, .22); }
.commercial-status { display: inline-flex; padding: 5px 8px; color: var(--taupe); background: var(--gold-soft); border-radius: 999px; font-size: 8px; font-weight: 800; white-space: nowrap; }
.commercial-status.won { color: var(--positive); background: var(--positive-soft); }
.commercial-status.amendment { color: var(--taupe); background: var(--gold-soft); }
.commercial-row-amendment { background: rgba(237, 229, 215, .28); }
.commercial-source { margin: 10px 0 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
.commercial-empty td { padding: 34px 18px; color: var(--muted); text-align: center; }

main.commercial-page { width: min(1480px, calc(100% - 48px)); padding-top: 48px; }
.commercial-page-hero { max-width: 940px; margin-bottom: 34px; }
.commercial-page-hero h1 { margin: 8px 0 14px; font-size: clamp(44px, 5vw, 70px); line-height: .98; }
.commercial-page-hero > p:last-child { max-width: 820px; margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.65; }
.commercial-page-panel { padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.commercial-page-panel .commercial-form { margin-top: 0; }
.commercial-page-panel .commercial-form { padding: 20px; gap: 16px; }
.commercial-page-panel .commercial-form label { font-size: 10px; }
.commercial-page-panel .commercial-form input { min-height: 52px; padding: 0 16px; font-size: 14px; }
.commercial-page-panel .commercial-form > button { min-height: 52px; padding: 0 22px; font-size: 11px; }
.commercial-page-panel .commercial-results { margin-top: 34px; }
.commercial-page-panel .commercial-overview { grid-template-columns: minmax(0, 1.45fr) minmax(390px, .55fr); gap: 18px; }
.commercial-page-panel .commercial-stats { gap: 14px; }
.commercial-page-panel .commercial-stats article { min-height: 218px; padding: 26px; gap: 10px; border-radius: 18px; }
.commercial-page-panel .commercial-stats span { font-size: 10px; }
.commercial-page-panel .commercial-stats strong { font-size: 44px; }
.commercial-page-panel .commercial-stats small { min-height: 30px; font-size: 11px; line-height: 1.45; }
.commercial-page-panel .commercial-chart-card { padding: 22px; border-radius: 18px; }
.commercial-page-panel .commercial-chart-heading span { font-size: 9px; }
.commercial-page-panel .commercial-chart-heading h2 { font-size: 24px; }
.commercial-page-panel .commercial-chart-heading > small { font-size: 9px; }
.commercial-page-panel .commercial-chart-content { margin-top: 18px; grid-template-columns: 156px minmax(0, 1fr); gap: 20px; }
.commercial-page-panel .commercial-pie { width: 156px; }
.commercial-page-panel .commercial-pie::before { inset: 26px; }
.commercial-page-panel .commercial-pie strong { font-size: 34px; }
.commercial-page-panel .commercial-pie span { font-size: 9px; }
.commercial-page-panel .commercial-chart-legend { gap: 12px; }
.commercial-page-panel .commercial-chart-legend li { padding-left: 16px; gap: 4px; }
.commercial-page-panel .commercial-chart-legend li::before { top: 4px; width: 9px; height: 9px; }
.commercial-page-panel .commercial-chart-legend span { font-size: 10px; }
.commercial-page-panel .commercial-chart-legend strong { font-size: 13px; }
.commercial-page-panel .commercial-chart-card > p { margin-top: 16px; padding-top: 14px; font-size: 9px; }
.commercial-page-panel .commercial-list-heading { margin-top: 34px; }
.commercial-page-panel .commercial-list-heading h2 { font-size: 28px; }
.commercial-page-panel .commercial-list-heading p,
.commercial-page-panel .commercial-list-heading > span { font-size: 11px; }
.commercial-page-panel .commercial-table-wrap { max-height: none; min-height: 0; margin-top: 16px; overflow: visible; border-radius: 16px; }
.commercial-page-panel .commercial-table th { padding-top: 16px; padding-bottom: 16px; font-size: 10px; }
.commercial-page-panel .commercial-table td { padding-top: 16px; padding-bottom: 16px; font-size: 13px; }
.commercial-page-panel .commercial-table .commercial-affair strong { font-size: 14px; }
.commercial-page-panel .commercial-table .commercial-affair small,
.commercial-page-panel .commercial-table .commercial-client small { margin-top: 4px; max-width: none; font-size: 11px; }
.commercial-page-panel .commercial-type,
.commercial-page-panel .commercial-status { padding: 6px 10px; font-size: 9px; }
.commercial-page-panel .commercial-source { margin-top: 14px; font-size: 9px; }
.commercial-page-feedback { margin-top: 18px; }

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 68px 0 72px;
}

.search-panel {
  max-width: 880px;
  margin: 0 auto 42px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

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

h1, h2, h3 {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
}

h1 {
  max-width: 730px;
  margin: 0 auto 14px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.intro {
  max-width: 690px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.65;
}

.search-form {
  max-width: 710px;
  margin: 32px auto 0;
  padding: 24px;
  text-align: left;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 221, 211, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-form label {
  display: block;
  margin-bottom: 9px;
  color: var(--taupe);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-row { display: flex; gap: 10px; }

.search-field {
  position: relative;
  min-width: 0;
  flex: 1;
}

.search-row input {
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0 17px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: none;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-row input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(167, 137, 85, 0.13);
}

.search-row button {
  height: 54px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  transition: background 160ms ease, transform 160ms ease;
}

.search-row button:hover { background: var(--taupe); transform: translateY(-1px); }
.search-row button:disabled { cursor: wait; opacity: 0.7; transform: none; }

.search-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  max-height: 390px;
  overflow-y: auto;
  padding: 7px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: 0 22px 55px rgba(63, 60, 56, 0.16);
}

.search-suggestions[hidden] { display: none; }

.suggestion-option {
  width: 100%;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
}

.suggestion-option:hover, .suggestion-option.active { background: var(--surface-soft); }
.suggestion-option > span { min-width: 0; }
.suggestion-option strong { display: block; font-size: 13px; letter-spacing: 0.035em; }
.suggestion-option small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-option em {
  flex: none;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.suggestion-option em.won { color: var(--positive); background: var(--positive-soft); }
.suggestion-empty { margin: 0; padding: 13px; color: var(--muted); font-size: 12px; text-align: center; }

.field-hint {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.status-card {
  max-width: 880px;
  margin: 0 auto 32px;
  padding: 22px 24px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
}

.status-card.loading { color: var(--taupe); background: var(--gold-soft); }
.status-card.error { color: var(--negative); background: var(--negative-soft); }
.status-card.warning { color: var(--ink); background: var(--surface); border: 1px solid var(--border); }
.status-card strong { display: block; margin-bottom: 4px; font-size: 16px; }

.affair-heading {
  margin-bottom: 22px;
  padding: 0 2px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.affair-heading h2 {
  margin: 0 0 7px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
}

.affair-heading p { margin: 0; color: var(--muted); font-size: 14px; }

.affair-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.pdf-export {
  min-height: 38px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  background: var(--ink);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
}

.pdf-export:hover { background: var(--taupe); transform: translateY(-1px); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 12px;
  color: var(--positive);
  background: var(--positive-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.unconfirmed { color: var(--negative); background: var(--negative-soft); }
.badge.analysis-status.warning { color: var(--taupe); background: var(--gold-soft); }
.badge.analysis-status.estimated { color: var(--taupe); background: var(--gold-soft); }

.calculation-estimate-notice {
  display: flex;
  gap: 12px 18px;
  align-items: baseline;
  margin: 18px 0;
  padding: 13px 16px;
  border: 1px solid rgba(154, 113, 55, .28);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  color: var(--ink);
  background: var(--gold-soft);
}

.calculation-estimate-notice strong {
  flex: 0 0 auto;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.calculation-estimate-notice span {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .calculation-estimate-notice {
    display: block;
  }

  .calculation-estimate-notice span {
    display: block;
    margin-top: 6px;
  }
}
.badge.analysis-status.blocked { color: var(--negative); background: var(--negative-soft); }
.badge.analysis-status.not_applicable { color: var(--muted); background: var(--surface-soft); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.result-navigation {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin: 0 0 14px;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 221, 211, 0.9);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(63, 60, 56, 0.07);
  backdrop-filter: blur(10px);
}

.result-navigation a {
  min-width: 0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--taupe);
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .025em;
  text-decoration: none;
  white-space: nowrap;
}

.result-navigation a:hover,
.result-navigation a:focus-visible { color: var(--ink); background: var(--surface-soft); outline: none; }
.result-navigation a span { color: var(--gold); font-size: 9px; }

#progress-panel,
#invoice-panel,
#history-panel,
#audit-panel { scroll-margin-top: 76px; }

.metric-card {
  min-height: 188px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid rgba(226, 221, 211, 0.85);
  border-radius: 18px;
  box-shadow: 0 9px 30px rgba(63, 60, 56, 0.05);
}

.metric-card .metric-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.metric-card .metric-value {
  margin: 17px 0 4px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(27px, 3vw, 34px);
  line-height: 1;
}

.metric-card .metric-context {
  margin-top: 7px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.metric-card .metric-context.ahead { color: var(--positive); }
.metric-card .metric-context.behind { color: var(--negative); }
.metric-card .metric-context.aligned { color: var(--taupe); }

.metric-card .metric-meta {
  margin-top: auto;
  min-height: 62px;
  padding-top: 16px;
  box-sizing: border-box;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.55;
}

.metric-card .metric-meta strong { color: var(--ink-soft); }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(310px, 0.78fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 26px;
  background: var(--surface);
  border: 1px solid rgba(226, 221, 211, 0.85);
  border-radius: var(--radius);
  box-shadow: 0 9px 30px rgba(63, 60, 56, 0.045);
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.panel h2 { margin: 0; font-size: 25px; line-height: 1.2; }
.panel h3 { margin-bottom: 8px; font-size: 20px; }

.section-disclosure > summary,
.analysis-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  cursor: pointer;
  list-style: none;
}

.section-disclosure > summary::-webkit-details-marker,
.analysis-disclosure > summary::-webkit-details-marker { display: none; }
.section-disclosure > summary:focus-visible,
.analysis-disclosure > summary:focus-visible { outline: 3px solid rgba(167, 137, 85, .22); outline-offset: 6px; border-radius: 8px; }

.disclosure-title { min-width: 0; display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 5px 12px; }
.disclosure-title .eyebrow { grid-column: 1 / -1; margin-bottom: 1px; }
.disclosure-title > strong { color: var(--ink); font-family: Georgia, 'Times New Roman', serif; font-size: 22px; font-weight: 400; }
.disclosure-title > small { color: var(--muted); font-size: 10px; }

.disclosure-action {
  flex: none;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--taupe);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.disclosure-action > span:last-child { font-size: 15px; line-height: .7; transition: transform 160ms ease; }
details[open] > summary .disclosure-action > span:last-child { transform: rotate(180deg); }
.disclosure-body { margin-top: 23px; padding-top: 23px; border-top: 1px solid var(--border); }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  padding: 0 12px 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 15px 12px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
}

td strong { display: block; color: var(--ink); margin-bottom: 4px; }
td small { color: var(--muted); line-height: 1.4; }
.number { text-align: right; white-space: nowrap; }
.reduction-row td { background: var(--negative-soft); }
.reduction-row .number { color: var(--negative); font-weight: 800; }
.reduction-mark {
  display: inline-flex;
  margin: 0 0 5px;
  padding: 3px 7px;
  color: var(--negative);
  background: #fff8f6;
  border: 1px solid rgba(150, 91, 80, 0.24);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
tfoot td { color: var(--ink); background: var(--surface-soft); border-bottom: 0; font-weight: 800; }
tfoot td:first-child { border-radius: 10px 0 0 10px; }
tfoot td:last-child { border-radius: 0 10px 10px 0; }

.validation-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--positive);
  font-size: 11px;
  font-weight: 700;
}

.validation-mark::before { content: '✓'; }

.labour-value small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
}

.not-applicable { color: var(--muted); font-size: 10px; font-style: italic; white-space: nowrap; }

.defaulted-hours {
  display: inline-grid;
  gap: 3px;
  justify-items: end;
}

.defaulted-hours small {
  color: var(--taupe);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.invoice-disclosure > summary { display: grid; grid-template-columns: minmax(190px, 1fr) auto auto; }
.invoice-disclosure .disclosure-title { display: grid; grid-template-columns: auto auto; justify-content: start; }
.disclosure-metrics { display: grid; grid-template-columns: repeat(2, minmax(110px, auto)); gap: 22px; }
.disclosure-metrics > span { display: grid; gap: 4px; text-align: right; }
.disclosure-metrics small { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.disclosure-metrics strong { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.invoice-disclosure-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, .65fr); gap: 28px; align-items: start; }
.invoice-disclosure-body .percentage-box { margin-top: 0; }

.invoice-ref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.invoice-ref strong { font-family: Georgia, 'Times New Roman', serif; font-size: 22px; }
.invoice-ref time { color: var(--muted); font-size: 12px; }
.invoice-validation {
  margin-left: auto;
  padding: 5px 8px;
  color: var(--positive);
  background: var(--positive-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.invoice-validation.reconstructed,
.invoice-validation.estimated { color: var(--taupe); background: var(--gold-soft); }
.invoice-validation.blocked { color: var(--negative); background: var(--negative-soft); }

.invoice-lines { display: grid; gap: 12px; }

.invoice-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 12px;
}

.invoice-line strong { color: var(--ink); font-size: 14px; text-align: right; }
.invoice-line span small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.invoice-line.total { margin-top: 3px; padding-top: 13px; border-top: 1px solid var(--border); }
.invoice-line.total strong { color: var(--gold); font-size: 19px; }

.invoice-documentary-controls {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.invoice-documentary-controls > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  list-style: none;
}

.invoice-documentary-controls > summary::-webkit-details-marker { display: none; }
.invoice-documentary-controls > summary::after { content: '+'; color: var(--gold); font-size: 16px; }
.invoice-documentary-controls[open] > summary::after { content: '−'; }
.invoice-documentary-controls > summary small { color: var(--muted); font-size: 9px; font-weight: 500; }
.invoice-documentary-controls .documentary { margin-top: 14px; padding: 14px; background: var(--surface-soft); border-radius: 10px; }

.percentage-box {
  margin-top: 22px;
  padding: 17px;
  background: var(--surface-soft);
  border-radius: 14px;
}

.percentage-box span { display: block; color: var(--muted); font-size: 11px; }
.percentage-box strong { display: block; margin-top: 5px; font-family: Georgia, 'Times New Roman', serif; font-size: 28px; }
.percentage-box small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.4; }

.progress-panel {
  display: block;
}

.progress-section-heading h2 { margin-top: 0; }

.progress-layout {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.4fr);
  gap: 36px;
  align-items: start;
}

.verdict {
  padding: 24px;
  border-radius: 17px;
  background: var(--surface-soft);
}

.verdict.ahead { background: var(--positive-soft); color: var(--positive); }
.verdict.behind { background: var(--negative-soft); color: var(--negative); }
.verdict.aligned { background: var(--gold-soft); color: var(--taupe); }

.verdict-label { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.verdict strong { display: block; margin-top: 9px; font-family: Georgia, 'Times New Roman', serif; font-size: 31px; font-weight: 400; }
.verdict p { margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }

.progress-copy > p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.bar-group { margin-top: 0; }
.bar-row + .bar-row { margin-top: 17px; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; color: var(--ink-soft); font-size: 12px; }
.bar-label strong { color: var(--ink); }
.bar-track { height: 9px; overflow: hidden; background: var(--border); border-radius: 999px; }
.bar-fill { height: 100%; min-width: 0; border-radius: inherit; background: var(--gold); transition: width 500ms ease; }
.bar-row.hours .bar-fill { background: var(--taupe); }

.calculation-formulas {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.calculation-card {
  min-width: 0;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.calculation-card.ahead { border-left: 4px solid var(--positive); }
.calculation-card.behind { border-left: 4px solid var(--negative); }
.calculation-card.aligned { border-left: 4px solid var(--gold); }

.calculation-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 12px;
}

.calculation-heading > span {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  color: var(--surface);
  background: var(--taupe);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.calculation-rule,
.calculation-values { margin: 11px 0 0; line-height: 1.45; }
.calculation-rule { color: var(--muted); font-size: 10px; }
.calculation-values { color: var(--ink-soft); font-size: 11px; font-weight: 700; }

.calculation-result {
  margin-top: 13px;
  padding-top: 11px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.calculation-result span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.calculation-result strong { color: var(--ink); font-family: Georgia, 'Times New Roman', serif; font-size: 18px; }
.calculation-card.ahead .calculation-result strong { color: var(--positive); }
.calculation-card.behind .calculation-result strong { color: var(--negative); }
.calculation-card.aligned .calculation-result strong { color: var(--taupe); }

.calculation-detail {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 9px;
  color: var(--muted);
  font-size: 9px;
}

.calculation-detail strong { color: var(--ink); }

.history-panel { margin-top: 14px; overflow: hidden; }
.history-heading { align-items: center; }
.section-intro { max-width: 650px; margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.history-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.history-legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.history-legend span::before { content: ''; width: 20px; height: 3px; border-radius: 999px; }
.history-legend .billing::before { background: var(--gold); }
.history-legend .hours::before { background: var(--taupe); }
.history-legend .labour::before { background: var(--positive); }

.history-chart-scroll {
  margin: 0 -8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--border) transparent;
}

.history-chart-scroll:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.history-chart { display: block; width: 100%; height: auto; }
.history-area { fill: var(--gold-soft); opacity: 0.55; }
.history-grid-line line { stroke: var(--border); stroke-width: 1; }
.history-grid-line text { fill: var(--muted); font-size: 10px; }
.history-guide { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.65; }
.history-line { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.history-line.billing { stroke: var(--gold); }
.history-line.hours { stroke: var(--taupe); }
.history-line.labour { stroke: var(--positive); stroke-dasharray: 8 6; }
.history-dot { stroke: var(--surface); stroke-width: 3; }
.history-dot.billing { fill: var(--gold); }
.history-dot.hours { fill: var(--taupe); }
.history-dot.labour { fill: var(--positive); }
.history-dot.billing.unverified { fill: var(--surface); stroke: var(--gold); stroke-width: 2; stroke-dasharray: 2 2; }
.history-estimated { fill: var(--taupe); font-size: 7px; font-weight: 800; letter-spacing: .04em; }
.history-marker.latest .history-dot { stroke-width: 4; }
.history-date { fill: var(--ink); font-size: 11px; font-weight: 800; }
.history-reference { fill: var(--muted); font-size: 9px; }

.history-situations {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.history-situation {
  min-width: 0;
  padding: 15px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.history-situation.latest { border-color: rgba(167, 137, 85, 0.65); box-shadow: inset 0 3px 0 var(--gold); }
.history-situation-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.history-situation-heading span { display: block; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.history-situation-heading strong { display: block; margin-top: 4px; color: var(--ink); font-size: 13px; }
.history-situation-heading time { color: var(--muted); font-size: 10px; white-space: nowrap; }

.history-situation-values {
  margin-top: 13px;
  padding-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid var(--border);
}

.history-situation-values span,
.history-situation-values small { display: block; color: var(--muted); font-size: 9px; }
.history-situation-values strong { display: block; margin: 3px 0; color: var(--ink); font-family: Georgia, 'Times New Roman', serif; font-size: 18px; }
.history-situation.ahead .history-situation-values strong:first-of-type { color: var(--positive); }
.history-situation.behind .history-situation-values strong:first-of-type { color: var(--negative); }

.invoice-panel { margin-top: 14px; }

.empty-comparison {
  margin-top: 20px;
  padding: 22px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: 15px;
}

.empty-comparison p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.result-banner {
  margin-top: 22px;
  padding: 22px 24px;
  background: var(--surface-soft);
  border-left: 5px solid var(--gold);
  border-radius: 16px;
}

.result-banner.ahead { background: var(--positive-soft); border-left-color: var(--positive); }
.result-banner.behind { background: var(--negative-soft); border-left-color: var(--negative); }

.result-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.result-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.result-heading strong {
  display: block;
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 25px;
  font-weight: 400;
}

.result-reference { color: var(--muted); font-size: 11px; text-align: right; }

.result-values {
  margin-top: 19px;
  padding-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border-top: 1px solid rgba(134, 126, 116, 0.18);
}

.result-values div { min-width: 0; }
.result-values span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.result-values strong { display: block; margin-top: 6px; color: var(--ink); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(24px, 3vw, 34px); font-weight: 400; }
.result-banner.ahead .result-values strong { color: var(--positive); }
.result-banner.behind .result-values strong { color: var(--negative); }

.analysis-overview {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 12px;
}

.analysis-overview > section {
  min-width: 0;
  margin: 0;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.analysis-overview-heading { margin-bottom: 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.analysis-overview-heading span { color: var(--ink); font-size: 11px; font-weight: 800; }
.analysis-overview-heading small { color: var(--muted); font-size: 9px; text-align: right; }
.analysis-benchmarks dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.analysis-benchmarks dl div { padding: 9px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); }
.analysis-benchmarks dl div:nth-child(-n + 2) { border-top: 0; padding-top: 0; }
.analysis-benchmarks dt { color: var(--muted); font-size: 9px; }
.analysis-benchmarks dd { margin: 0; color: var(--ink); font-size: 11px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

.analysis-disclosure {
  margin-top: 14px;
  padding: 16px 18px;
  background: rgba(247, 245, 240, .68);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.analysis-disclosure > summary > span:first-child { min-width: 0; display: grid; gap: 4px; }
.analysis-disclosure > summary strong { color: var(--ink); font-size: 12px; }
.analysis-disclosure > summary small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.analysis-disclosure-body { margin-top: 16px; padding-top: 1px; border-top: 1px solid var(--border); }

.progress-facts {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.progress-fact {
  min-width: 0;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.progress-fact > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.progress-fact > strong { display: block; margin-top: 10px; color: var(--ink); font-family: Georgia, 'Times New Roman', serif; font-size: 26px; font-weight: 400; }
.progress-fact dl { margin: 15px 0 0; padding-top: 12px; display: grid; gap: 8px; border-top: 1px solid var(--border); }
.progress-fact dl div { display: flex; justify-content: space-between; gap: 12px; }
.progress-fact dt { color: var(--muted); font-size: 10px; }
.progress-fact dd { margin: 0; color: var(--ink); font-size: 11px; font-weight: 800; text-align: right; }

.progress-comparison {
  margin-top: 22px;
  padding: 18px;
  background: var(--surface-soft);
  border-radius: 14px;
}

.financial-breakdown {
  margin-top: 18px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(237, 229, 215, 0.65), rgba(247, 245, 240, 0.9));
  border: 1px solid rgba(167, 137, 85, 0.28);
  border-radius: 16px;
}

.financial-breakdown-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.financial-breakdown-heading span {
  display: block;
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.financial-breakdown-heading strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  font-weight: 400;
}

.financial-breakdown-heading small {
  max-width: 430px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: right;
}

.financial-breakdown-grid {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.financial-breakdown-grid > div {
  min-width: 0;
  padding: 13px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.financial-breakdown-grid span {
  display: block;
  min-height: 24px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.35;
}

.financial-breakdown-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  font-weight: 400;
}

.financial-breakdown-grid small {
  display: block;
  min-height: 25px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

.financial-breakdown-grid .financial-breakdown-result {
  background: var(--gold-soft);
  border-color: rgba(167, 137, 85, 0.45);
}

.financial-breakdown-result strong { color: var(--taupe); }

.financial-breakdown-result.ahead strong { color: var(--positive); }
.financial-breakdown-result.behind strong { color: var(--negative); }

.financial-share {
  margin-top: 17px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.financial-share > div:not(.financial-share-bar) { display: grid; gap: 4px; }
.financial-share > div:nth-child(2) { text-align: right; }
.financial-share span { color: var(--muted); font-size: 9px; font-weight: 700; }
.financial-share strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }

.financial-share-bar {
  grid-column: 1 / -1;
  height: 9px;
  display: flex;
  overflow: hidden;
  background: var(--border);
  border-radius: 999px;
}

.financial-share-bar span:first-child { background: var(--gold); }
.financial-share-bar span:last-child { background: var(--taupe); }

.financial-flow > div { position: relative; }
.financial-flow > div:not(:nth-child(3n))::after {
  content: '›';
  position: absolute;
  top: 50%;
  right: -8px;
  z-index: 2;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  color: var(--gold);
  background: var(--surface-soft);
  border-radius: 50%;
  transform: translateY(-50%);
}

.financial-breakdown-proof {
  margin-top: 12px;
  padding-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  border-top: 1px solid rgba(167, 137, 85, 0.28);
}

.financial-breakdown-proof > div { display: grid; gap: 4px; min-width: 0; }
.financial-breakdown-proof span { color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.financial-breakdown-proof strong { color: var(--ink); font-size: 10px; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.financial-breakdown-proof small { color: var(--muted); font-size: 9px; }

.calculation-formulas.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calculation-formulas.three-columns .calculation-card { display: flex; flex-direction: column; }
.calculation-formulas.three-columns .calculation-result { margin-top: auto; }

.today-strip {
  margin-top: 18px;
  padding-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  border-top: 1px solid var(--border);
}

.today-strip div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.today-strip span { color: var(--muted); font-size: 10px; }
.today-strip strong { color: var(--ink); font-size: 13px; text-align: right; }

.history-diagnostic {
  margin-top: 13px;
  padding: 11px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.history-diagnostic span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.history-diagnostic strong { color: var(--ink); font-size: 12px; text-align: right; white-space: nowrap; }
.history-situation.ahead .history-diagnostic strong { color: var(--positive); }
.history-situation.behind .history-diagnostic strong { color: var(--negative); }

.impact-history {
  margin-top: 8px;
  padding: 17px 18px;
  background: var(--surface-soft);
  border-radius: 14px;
}

.impact-history-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.impact-history-heading strong { color: var(--ink); font-size: 12px; }
.impact-history-heading span { color: var(--muted); font-size: 9px; }

.impact-row {
  width: 100%;
  padding: 5px 0;
  display: grid;
  grid-template-columns: minmax(105px, 0.7fr) minmax(180px, 2fr) minmax(90px, 0.65fr);
  align-items: center;
  gap: 12px;
  min-height: 32px;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.impact-row + .impact-row { border-top: 1px solid var(--border); }
.impact-row:hover { background: rgba(167, 137, 85, 0.06); }
.impact-row:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.impact-label { display: flex; gap: 7px; align-items: baseline; }
.impact-label strong { color: var(--ink); font-size: 10px; }
.impact-label span { color: var(--muted); font-size: 9px; }
.impact-track { position: relative; height: 8px; background: linear-gradient(to right, transparent 49.7%, var(--border) 49.7%, var(--border) 50.3%, transparent 50.3%); }
.impact-track span { position: absolute; top: 0; height: 8px; border-radius: 999px; }
.impact-row.positive .impact-track span { left: 50%; background: var(--positive); }
.impact-row.negative .impact-track span { right: 50%; background: var(--negative); }
.impact-value { color: var(--ink); font-size: 11px; text-align: right; }
.impact-row.positive .impact-value { color: var(--positive); }
.impact-row.negative .impact-value { color: var(--negative); }

.history-marker.situation-trigger { cursor: pointer; }
.history-marker.situation-trigger:focus { outline: none; }
.history-marker.situation-trigger:hover .history-dot,
.history-marker.situation-trigger:focus .history-dot,
.history-marker.situation-trigger[aria-expanded='true'] .history-dot { stroke: var(--gold); stroke-width: 5; }

.history-study-heading {
  margin-top: 26px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.history-study-heading h3 { margin: 3px 0 0; font-family: Georgia, 'Times New Roman', serif; font-size: 24px; font-weight: 400; }
.history-study-heading > span { color: var(--muted); font-size: 10px; }

.history-situations {
  margin-top: 13px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
}

.history-situation,
.history-situation.latest {
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.history-situation.selected { background: rgba(167, 137, 85, 0.055); }
.history-situation-summary {
  padding: 16px 10px;
  display: grid;
  grid-template-columns: minmax(145px, 1.2fr) repeat(4, minmax(100px, .8fr));
  gap: 14px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.history-situation-summary::-webkit-details-marker { display: none; }
.history-situation-summary:hover { background: rgba(167, 137, 85, 0.045); }
.history-situation-summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.history-situation-summary > span { min-width: 0; display: grid; gap: 3px; }
.history-situation-summary small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.history-situation-summary strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.history-situation-summary > span:last-child { text-align: right; }
.history-situation.ahead .history-situation-summary > span:nth-last-child(-n + 2) strong { color: var(--positive); }
.history-situation.behind .history-situation-summary > span:nth-last-child(-n + 2) strong { color: var(--negative); }

.history-situation-identity > span { color: var(--gold); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.history-situation-identity strong { font-family: Georgia, 'Times New Roman', serif; font-size: 16px; font-weight: 400; }
.history-situation-identity time { color: var(--muted); font-size: 9px; }

.situation-study { padding: 4px 10px 22px; }
.situation-study-heading { padding: 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--border); }
.situation-study-heading > div { display: grid; gap: 4px; }
.situation-study-heading span { color: var(--muted); font-size: 9px; }
.situation-study-heading strong { color: var(--ink); font-size: 11px; }

.situation-study-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.situation-study-section { min-width: 0; padding: 16px; background: var(--surface-soft); border-radius: 13px; }
.situation-study-section h3 { margin: 0 0 12px; color: var(--ink); font-family: Georgia, 'Times New Roman', serif; font-size: 17px; font-weight: 400; }

.situation-data-list { margin: 0; display: grid; }
.situation-data-list > div { padding: 8px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 14px; border-top: 1px solid var(--border); }
.situation-data-list > div:first-child { border-top: 0; }
.situation-data-list dt { color: var(--muted); font-size: 10px; }
.situation-data-list dd { margin: 0; color: var(--ink); font-size: 11px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.situation-data-list dd small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 400; }
.history-situation.ahead .situation-result dd { color: var(--positive); }
.history-situation.behind .situation-result dd { color: var(--negative); }

.situation-formula { margin: 12px 0 0; padding-top: 10px; color: var(--muted); border-top: 1px solid var(--border); font-size: 9px; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.situation-scope-row,
.situation-scope-total { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, auto) minmax(70px, auto); gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.situation-scope-row:first-of-type { border-top: 0; }
.situation-scope-row > span { display: grid; gap: 3px; }
.situation-scope-row strong,
.situation-scope-total strong { color: var(--ink); font-size: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.situation-scope-row > span strong { text-align: left; }
.situation-scope-row small { color: var(--muted); font-size: 8px; }
.situation-scope-row.reduction strong { color: var(--negative); }
.situation-scope-row.reconciliation { margin: 4px 0; padding: 9px; background: var(--gold-soft); border-radius: 9px; }
.situation-scope-row.reconciliation strong { color: var(--taupe); }
.situation-scope-total { margin-top: 4px; border-top-color: rgba(167, 137, 85, .45); }
.situation-scope-total span { color: var(--gold); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.situation-empty { margin: 8px 0; color: var(--muted); font-size: 10px; }

.situation-sources { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.situation-sources span { padding: 6px 8px; color: var(--taupe); background: var(--gold-soft); border-radius: 999px; font-size: 8px; font-weight: 800; }
.situation-disclaimer { margin: 11px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }

.metric-value,
.result-values strong,
.progress-fact > strong,
.today-strip strong,
.financial-breakdown-grid strong { font-variant-numeric: tabular-nums; }

.audit-panel { margin-top: 14px; }
.audit-disclosure-body > .audit-section:first-child { margin-top: 0; }
.audit-count { color: var(--muted); font-size: 11px; font-weight: 800; }
.audit-section + .audit-section { margin-top: 26px; }
.audit-section-heading { margin-bottom: 13px; }
.audit-section-heading h3 { margin: 0; }
.audit-section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.audit-table td { vertical-align: middle; }
.scope-cell small, .financial-reference small { display: block; margin-top: 4px; }

.scope-mark {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scope-mark.included { color: var(--positive); background: var(--positive-soft); }
.scope-mark.excluded { color: var(--negative); background: var(--negative-soft); }
.scope-mark.neutral { color: var(--taupe); background: var(--gold-soft); }
.financial-reference strong { margin: 0; }

.audit-columns {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.audit-columns .audit-section {
  min-width: 0;
  margin: 0;
  padding: 18px;
  background: var(--surface-soft);
  border-radius: 14px;
}

.audit-data-list { margin: 0; display: grid; }
.audit-data-list div { padding: 10px 0; display: flex; justify-content: space-between; gap: 14px; border-top: 1px solid var(--border); }
.audit-data-list div:first-child { border-top: 0; }
.audit-data-list dt { color: var(--muted); font-size: 11px; }
.audit-data-list dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 800; text-align: right; }
.audit-data-list dd.ahead { color: var(--positive); }
.audit-data-list dd.behind { color: var(--negative); }

.control-list {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
}

.control-list li {
  min-width: 0;
  padding: 13px 14px 13px 37px;
  position: relative;
  background: var(--surface-soft);
  border-radius: 12px;
}

.control-list li::before {
  position: absolute;
  top: 13px;
  left: 14px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}

.control-list .control-ok::before { content: '✓'; color: var(--positive); background: var(--positive-soft); }
.control-list .control-info::before { content: 'i'; color: var(--taupe); background: var(--gold-soft); }
.control-list .control-warning::before { content: '!'; color: var(--negative); background: var(--negative-soft); }
.control-list strong { display: block; color: var(--ink); font-size: 11px; }
.control-list span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }

.empty-state { color: var(--muted); font-size: 13px; line-height: 1.6; }
.snapshot { margin: 14px 4px 0; color: var(--muted); font-size: 11px; text-align: right; }

@media (max-width: 1200px) {
  .commercial-page-panel .commercial-overview { grid-template-columns: 1fr; }
  .commercial-page-panel .commercial-chart-content { grid-template-columns: 170px minmax(0, 1fr); }
  .commercial-page-panel .commercial-pie { width: 170px; }
}

@media (max-width: 980px) {
  .commercial-overview { grid-template-columns: 1fr; }
  .commercial-chart-content { grid-template-columns: 118px 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .analysis-overview { grid-template-columns: 1fr; }
  .progress-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-fact:last-child { grid-column: 1 / -1; }
  .financial-breakdown-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calculation-formulas.three-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calculation-formulas.three-columns .calculation-card:last-child { grid-column: 1 / -1; }
  .history-situations { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-header, main { width: min(100% - 28px, 1180px); }
  main.commercial-page { width: min(100% - 28px, 1180px); padding-top: 36px; }
  .site-header { min-height: 80px; }
  .read-only { display: none; }
  .commercial-link { min-height: 39px; padding: 0 11px; font-size: 9px; }
  .header-back-link { min-height: 39px; font-size: 9px; }
  .commercial-dialog { padding-left: 22px; padding-right: 22px; }
  .commercial-page-panel { padding: 18px; }
  main { padding-top: 45px; }
  .search-panel { margin-bottom: 30px; }
  .search-form { padding: 16px; }
  .search-row { flex-direction: column; }
  .search-field { width: 100%; }
  .search-row button { justify-content: space-between; }
  .affair-heading { align-items: start; flex-direction: column; gap: 13px; }
  .affair-actions { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .result-navigation { top: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #progress-panel, #invoice-panel, #history-panel, #audit-panel { scroll-margin-top: 112px; }
  .invoice-disclosure > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .invoice-disclosure .disclosure-metrics { grid-column: 1 / -1; grid-row: 2; margin-top: 12px; justify-content: start; }
  .invoice-disclosure .disclosure-metrics > span { text-align: left; }
  .invoice-disclosure-body { grid-template-columns: 1fr; }
  .section-disclosure > summary, .analysis-disclosure > summary { align-items: start; gap: 14px; }
  .disclosure-title { grid-template-columns: 1fr; }
  .disclosure-title .eyebrow { grid-column: 1; }
  .progress-layout { grid-template-columns: 1fr; gap: 24px; }
  .result-heading { flex-direction: column; }
  .result-reference { text-align: left; }
  .result-values { grid-template-columns: 1fr; gap: 12px; }
  .progress-facts, .calculation-formulas.three-columns { grid-template-columns: 1fr; }
  .progress-fact:last-child, .calculation-formulas.three-columns .calculation-card:last-child { grid-column: auto; }
  .financial-breakdown-heading { align-items: start; flex-direction: column; gap: 8px; }
  .financial-breakdown-heading small { max-width: none; text-align: left; }
  .financial-breakdown-grid { grid-template-columns: 1fr; }
  .financial-breakdown-grid span, .financial-breakdown-grid small { min-height: 0; }
  .financial-flow > div::after { display: none; }
  .financial-breakdown-proof { grid-template-columns: 1fr; gap: 10px; }
  .financial-share { grid-template-columns: 1fr; }
  .financial-share > div:nth-child(2) { text-align: left; }
  .financial-share-bar { grid-column: 1; }
  .today-strip, .audit-columns, .control-list { grid-template-columns: 1fr; }
  .history-heading { align-items: start; flex-direction: column; }
  .history-legend { flex-wrap: wrap; }
  .impact-row { grid-template-columns: minmax(92px, 0.7fr) minmax(130px, 1.5fr) minmax(86px, 0.7fr); }
  .history-study-heading { align-items: start; flex-direction: column; gap: 7px; }
  .history-situation-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-situation-identity { grid-column: 1 / -1; }
  .history-situation-summary > span:last-child { text-align: left; }
  .situation-study-grid { grid-template-columns: 1fr; }
  .commercial-table-wrap { max-height: none; overflow: visible; border: 0; border-radius: 0; }
  .commercial-table, .commercial-table tbody { display: block; }
  .commercial-table colgroup, .commercial-table thead { display: none; }
  .commercial-table tr { margin-bottom: 10px; padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 13px; }
  .commercial-table tr.commercial-row-won { background: rgba(231, 239, 233, .5); }
  .commercial-table tr.commercial-row-amendment { background: rgba(237, 229, 215, .55); }
  .commercial-table td { min-width: 0; padding: 0; display: grid; align-content: start; gap: 5px; border: 0; }
  .commercial-table td::before { content: attr(data-label); color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  .commercial-table td:nth-child(3),
  .commercial-table td:nth-child(4),
  .commercial-table td:nth-child(5) { grid-column: 1 / -1; }
  .commercial-table .commercial-affair small,
  .commercial-table .commercial-client small { max-width: none; white-space: normal; }
  .commercial-empty td { grid-column: 1 / -1; }
  .commercial-empty td::before { display: none; }
  .commercial-page-panel .commercial-table-wrap { overflow: visible; border: 0; border-radius: 0; }
  .commercial-page-panel .commercial-table tr { padding: 18px; gap: 14px 20px; }
  .commercial-page-panel .commercial-table td { padding: 0; font-size: 12px; }
  .commercial-page-panel .commercial-table td::before { font-size: 9px; }
}

@media (max-width: 520px) {
  .site-header { padding: 14px 0; flex-wrap: wrap; }
  .brand small { display: none; }
  .brand-logo { width: 45px; height: 45px; }
  .header-actions { width: 100%; justify-content: flex-end; gap: 8px; }
  .settings-button { width: 39px; height: 39px; }
  .settings-dialog { padding: 24px 20px; }
  .settings-dialog-header h2 { font-size: 26px; }
  .settings-actions { flex-direction: column-reverse; }
  .settings-actions button { width: 100%; }
  .commercial-form { align-items: stretch; flex-direction: column; }
  .commercial-form > button { width: 100%; }
  .commercial-page-panel .commercial-form { padding: 14px; }
  .commercial-stats { grid-template-columns: 1fr; }
  .commercial-stats article { grid-template-columns: 1fr auto; align-items: center; }
  .commercial-stats article small { grid-column: 1 / -1; min-height: 0; }
  .commercial-chart-content { grid-template-columns: 106px minmax(0, 1fr); gap: 12px; }
  .commercial-pie { width: 106px; }
  .commercial-page-panel .commercial-stats article { min-height: 0; padding: 20px; }
  .commercial-page-panel .commercial-stats strong { font-size: 38px; }
  .commercial-page-panel .commercial-stats small { min-height: 0; }
  .commercial-page-panel .commercial-chart-card { padding: 18px; }
  .commercial-page-panel .commercial-chart-heading h2 { font-size: 21px; }
  .commercial-page-panel .commercial-chart-content { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; }
  .commercial-page-panel .commercial-pie { width: 112px; }
  .commercial-page-panel .commercial-pie::before { inset: 20px; }
  .commercial-page-panel .commercial-pie strong { font-size: 27px; }
  .commercial-page-panel .commercial-chart-legend span { font-size: 9px; }
  .commercial-page-panel .commercial-chart-legend strong { font-size: 11px; }
  .commercial-page-panel .commercial-list-heading h2 { font-size: 24px; }
  .commercial-page-hero h1 { font-size: 39px; }
  .commercial-page-panel { padding: 14px; }
  .commercial-list-heading { align-items: start; flex-direction: column; gap: 6px; }
  h1 { font-size: 37px; }
  .summary-grid { grid-template-columns: 1fr; }
  .result-navigation a { padding: 9px 6px; font-size: 9px; }
  .metric-card { min-height: 138px; padding: 18px; }
  .metric-card .metric-value { margin-top: 12px; }
  .metric-card .metric-meta { min-height: 0; margin-top: 12px; padding-top: 12px; }
  .panel { padding: 20px 16px; }
  .analysis-benchmarks dl { grid-template-columns: 1fr; }
  .analysis-benchmarks dl div:nth-child(2) { padding-top: 9px; border-top: 1px solid var(--border); }
  .analysis-overview-heading { align-items: start; flex-direction: column; gap: 4px; }
  .analysis-overview-heading small { text-align: left; }
  .disclosure-action > span:first-child { display: none; }
  .disclosure-action { padding: 8px; }
  .invoice-disclosure .disclosure-metrics { grid-template-columns: 1fr 1fr; gap: 12px; }
  .calculation-formulas { grid-template-columns: 1fr; }
  .history-legend { width: 100%; justify-content: space-between; gap: 10px; }
  .history-situations { grid-template-columns: 1fr; }
  .history-diagnostic { grid-template-columns: 1fr repeat(3, auto); }
  .history-situation-summary { grid-template-columns: 1fr; gap: 9px; padding: 14px 6px; }
  .history-situation-summary > span { padding-top: 8px; border-top: 1px solid var(--border); }
  .history-situation-summary > span:first-child { padding-top: 0; border-top: 0; }
  .situation-study { padding-left: 0; padding-right: 0; }
  .situation-study-heading { padding-left: 4px; padding-right: 4px; }
  .situation-scope-row, .situation-scope-total { grid-template-columns: 1fr; gap: 5px; }
  .situation-scope-row strong, .situation-scope-total strong { text-align: left; }
  .impact-history { padding: 13px; }
  .impact-history-heading { align-items: start; flex-direction: column; gap: 4px; }
  .impact-row { grid-template-columns: 82px minmax(105px, 1fr); gap: 8px; padding: 7px 0; }
  .impact-value { grid-column: 2; }
  .audit-columns .audit-section { padding: 15px; }
  th, td { padding-left: 8px; padding-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Recherche transversale dans les postes chiffrés */
.search-link { color: var(--positive); background: rgba(231, 239, 233, .76); border-color: rgba(84, 114, 95, .24); }
.search-link:hover,
.search-link.active { color: var(--surface); background: var(--positive); border-color: var(--positive); }

main.lookup-page { width: min(1480px, calc(100% - 48px)); padding-top: 48px; }
.lookup-hero { margin-bottom: 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(350px, 470px); align-items: end; gap: 38px; }
.lookup-hero h1 { max-width: 900px; margin: 8px 0 14px; font-size: clamp(44px, 5vw, 70px); line-height: .98; }
.lookup-hero > div > p:last-child { max-width: 820px; margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.65; }

.lookup-index-status { min-width: 0; padding: 16px 16px 16px 18px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; background: rgba(255, 255, 255, .68); border: 1px solid var(--border); border-radius: 16px; }
.lookup-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px rgba(125, 117, 108, .11); }
.lookup-index-status.ready .lookup-status-dot { background: var(--positive); box-shadow: 0 0 0 5px var(--positive-soft); }
.lookup-index-status.refreshing .lookup-status-dot { background: var(--gold); box-shadow: 0 0 0 5px var(--gold-soft); animation: lookup-pulse 1.4s ease-in-out infinite; }
.lookup-index-status.error .lookup-status-dot { background: var(--negative); box-shadow: 0 0 0 5px var(--negative-soft); }
.lookup-index-status.warning .lookup-status-dot { background: var(--gold); box-shadow: 0 0 0 5px var(--gold-soft); }
.lookup-index-status strong { display: block; color: var(--ink); font-size: 12px; }
.lookup-index-status small { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.lookup-index-status button { min-height: 36px; padding: 0 13px; color: var(--taupe); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.lookup-index-status button:hover { color: var(--gold); border-color: rgba(167, 137, 85, .55); }
.lookup-index-status button:disabled { cursor: wait; opacity: .55; }

.lookup-panel { padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.lookup-form { padding: 20px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 16px; }
.lookup-form > label { display: block; margin-bottom: 9px; color: var(--taupe); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.lookup-search-row { display: flex; gap: 12px; }
.lookup-input-wrap { min-width: 0; flex: 1; position: relative; }
.lookup-input-wrap svg { position: absolute; top: 50%; left: 17px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform: translateY(-50%); pointer-events: none; }
.lookup-input-wrap input { width: 100%; min-height: 54px; padding: 0 18px 0 49px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; outline: 0; font-size: 15px; }
.lookup-input-wrap input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(167, 137, 85, .12); }
.lookup-search-row > button { min-width: 162px; min-height: 54px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--surface); background: var(--ink); border: 0; border-radius: 12px; cursor: pointer; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.lookup-search-row > button:hover { background: var(--gold); }
.lookup-search-row > button:disabled { cursor: wait; opacity: .65; }
.lookup-form > p { margin: 10px 2px 0; color: var(--muted); font-size: 10px; }
.lookup-feedback { margin-top: 18px; padding: 13px 15px; color: var(--taupe); background: var(--gold-soft); border-radius: 12px; font-size: 12px; }
.lookup-feedback.erreur { color: var(--negative); background: var(--negative-soft); }
.lookup-feedback.succes { color: var(--positive); background: var(--positive-soft); }

.lookup-results { margin-top: 34px; }
.lookup-results-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.lookup-results-heading h2 { margin: 5px 0 0; font-family: Georgia, 'Times New Roman', serif; font-size: 29px; font-weight: 500; }
.lookup-results-tools { display: flex; align-items: end; gap: 12px; }
.lookup-results-tools > span { min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; color: var(--taupe); background: var(--gold-soft); border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.lookup-results-tools label { display: grid; gap: 5px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.lookup-results-tools select { min-width: 176px; min-height: 38px; padding: 0 34px 0 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 10px; font-weight: 700; text-transform: none; }
.lookup-results-tools select:hover { border-color: var(--gold); }
.lookup-results-tools select:focus { outline: 3px solid rgba(167, 137, 85, .16); border-color: var(--gold); }
.lookup-table-wrap { margin-top: 16px; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; }
.lookup-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.lookup-table col.affair { width: 15%; }
.lookup-table col.line { width: 11%; }
.lookup-table col.text { width: auto; }
.lookup-table col.unit { width: 7%; }
.lookup-table col.quantity { width: 10%; }
.lookup-table col.tariff { width: 12%; }
.lookup-table th { padding: 15px 14px; color: var(--muted); background: var(--surface-soft); border-bottom: 1px solid var(--border); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.lookup-table th:nth-last-child(-n+2) { text-align: right; }
.lookup-table td { padding: 16px 14px; vertical-align: top; border-bottom: 1px solid var(--border); color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.lookup-table tbody tr:last-child td { border-bottom: 0; }
.lookup-table tbody tr:hover { background: rgba(247, 245, 240, .7); }
.lookup-affair { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: 12px; font-weight: 800; text-decoration: none; }
.lookup-affair:hover { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.lookup-line { color: var(--taupe); font-variant-numeric: tabular-nums; }
.lookup-text { display: block; white-space: normal; }
.lookup-number { text-align: right; font-variant-numeric: tabular-nums; }
.lookup-number.unverified { color: var(--muted); font-size: 10px; font-style: italic; }
.lookup-reliability { width: fit-content; margin-top: 8px; padding: 4px 7px; display: block; color: var(--taupe); background: var(--gold-soft); border-radius: 999px; font-size: 8px; font-weight: 800; line-height: 1; text-transform: uppercase; }
.lookup-reliability.verified { color: var(--positive); background: var(--positive-soft); }
.lookup-reliability.reference { color: var(--muted); background: var(--surface-soft); border: 1px solid var(--border); }
.lookup-empty td { padding: 38px 20px; color: var(--muted); text-align: center; }
.lookup-pagination { margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 16px; }
.lookup-pagination[hidden] { display: none; }
.lookup-pagination button { min-height: 38px; padding: 0 13px; color: var(--taupe); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.lookup-pagination button:hover:not(:disabled) { color: var(--gold); border-color: var(--gold); }
.lookup-pagination button:disabled { cursor: default; opacity: .38; }
.lookup-pagination span { color: var(--muted); font-size: 10px; font-weight: 700; }
.lookup-reliability-note { margin: 24px 0 0; padding-top: 16px; color: var(--muted); border-top: 1px solid var(--border); font-size: 9px; line-height: 1.55; }

@keyframes lookup-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .38; }
}

@media (max-width: 1080px) {
  .site-header .read-only { display: none; }
  .header-actions { gap: 10px; }
  .lookup-hero { grid-template-columns: 1fr; align-items: start; gap: 22px; }
  .lookup-index-status { max-width: 620px; }
  .lookup-table col.affair { width: 18%; }
  .lookup-table col.line { width: 13%; }
  .lookup-table col.unit { width: 8%; }
  .lookup-table col.quantity { width: 11%; }
  .lookup-table col.tariff { width: 14%; }
}

@media (max-width: 900px) {
  .site-header { padding: 14px 0; flex-wrap: wrap; }
  .header-actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 720px) {
  main.lookup-page { width: min(100% - 28px, 1180px); padding-top: 36px; }
  .lookup-hero h1 { font-size: 39px; }
  .lookup-index-status { grid-template-columns: auto minmax(0, 1fr); }
  .lookup-index-status button { grid-column: 2; width: fit-content; }
  .lookup-panel { padding: 18px; }
  .lookup-form { padding: 14px; }
  .lookup-search-row { flex-direction: column; }
  .lookup-search-row > button { width: 100%; }
  .lookup-results-heading { align-items: start; flex-direction: column; gap: 11px; }
  .lookup-results-tools { width: 100%; align-items: stretch; flex-direction: column; }
  .lookup-results-tools > span { width: fit-content; }
  .lookup-results-tools select { width: 100%; }
  .lookup-table-wrap { overflow: visible; border: 0; }
  .lookup-table, .lookup-table tbody { display: block; }
  .lookup-table colgroup, .lookup-table thead { display: none; }
  .lookup-table tr { margin-bottom: 11px; padding: 17px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px 18px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 14px; }
  .lookup-table td { min-width: 0; padding: 0; display: grid; align-content: start; gap: 5px; border: 0; text-align: left; }
  .lookup-table td::before { content: attr(data-label); color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  .lookup-table td:first-child,
  .lookup-table td:nth-child(3) { grid-column: 1 / -1; }
  .lookup-table .lookup-number { text-align: left; }
  .lookup-empty { display: block !important; }
  .lookup-empty td { display: block; }
  .lookup-empty td::before { display: none; }
}

@media (max-width: 520px) {
  .commercial-link-label { display: none; }
  .commercial-link { width: 39px; min-height: 39px; padding: 0; justify-content: center; }
  .lookup-table tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lookup-table td:nth-child(4) { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .login-page { padding: 20px; }
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-identity { min-height: 310px; padding: 32px; }
  .login-identity > div { margin: 56px 0 36px; }
  .login-identity h1 { max-width: 620px; font-size: clamp(39px, 8vw, 58px); }
  .login-card { padding: 44px 38px 48px; }
}

@media (max-width: 520px) {
  .logout-button { width: 39px; height: 39px; }
  .login-page { padding: 0; display: block; }
  .login-shell { min-height: 100vh; border: 0; border-radius: 0; }
  .login-identity { min-height: 272px; padding: 24px; }
  .login-identity > div { margin: 42px 0 25px; }
  .login-identity h1 { margin-bottom: 13px; font-size: 39px; }
  .login-identity > div > p:last-child { font-size: 12px; line-height: 1.6; }
  .login-read-only { font-size: 8px; }
  .login-card { padding: 40px 24px 48px; }
  .login-card-mark { width: 50px; height: 50px; margin-bottom: 23px; }
  .login-card h2 { font-size: 39px; }
}
