:root {
  color-scheme: light;
  --navy: #0c263e;
  --ink: #102b43;
  --muted: #526c83;
  --blue: #176fca;
  --blue-dark: #125cac;
  --sky: #63b9fa;
  --line: #dbe5ef;
  --paper: #f2f6fb;
  --surface: #fff;
  --pale: #edf5fd;
  --rail-width: 230px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 "Segoe UI", Arial, sans-serif;
}
a { color: var(--blue-dark); font-weight: 600; text-underline-offset: .2em; }
a:hover { color: var(--blue); }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 3vw, 2.5rem);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
}
h2 { margin-bottom: 16px; font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
.brand {
  display: inline-block;
  color: inherit;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.065em;
  text-decoration: none;
}
.brand span { color: var(--sky); }
a.brand:hover { color: inherit; }

aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-width);
  padding: 36px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 30px;
  overflow: auto;
  background: linear-gradient(165deg, #133d63 0%, var(--navy) 48%, #071a2c 100%);
  color: #edf6ff;
}
aside > .brand { align-self: flex-start; margin-left: 11px; }
nav { display: grid; gap: 4px; }
nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 9px;
  color: #d8e9f7;
  font-size: .9375rem;
  text-decoration: none;
}
nav a:hover { background: #1b4268; color: #fff; }
nav a[aria-current="page"] {
  background: #1b4e7b;
  box-shadow: inset 3px 0 0 var(--sky);
  color: #fff;
}
.account {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid #ffffff28;
  color: #c5d9eb;
  overflow-wrap: anywhere;
  font-size: .875rem;
}
.account form { margin-top: 8px; }
.account button {
  padding: 5px 0;
  background: transparent;
  border-color: transparent;
  color: #edf6ff;
}
.account button:hover { color: var(--sky); }

main { max-width: 1700px; margin-inline: auto; padding: 40px clamp(20px, 4vw, 66px); }
aside + main { margin-left: var(--rail-width); }
header { margin: 8px 0 28px; }
.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 10px 13px;
  border-bottom: 3px solid transparent;
  border-radius: 7px 7px 0 0;
  color: var(--muted);
  font-size: .9375rem;
  text-decoration: none;
}
.tabs a:hover { background: #e8f2fc; color: var(--blue-dark); }
.tabs a[aria-current="page"] {
  border-color: var(--blue);
  background: #e6f1fc;
  color: #104f8c;
}

section, .table {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
section { margin-bottom: 18px; padding: 22px 24px; }
.table { overflow: auto; }
.table + section { margin-top: 18px; }
table { width: 100%; min-width: 420px; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
th {
  background: #f7faff;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 600;
}
td { font-size: .9375rem; }
tbody tr:hover { background: #f5f9ff; }
tbody tr:last-child td { border-bottom: 0; }
.billing-groups { display: grid; gap: 12px; }
.billing-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.billing-group > summary {
  padding: 12px 16px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 650;
}
.billing-group > summary::marker { color: var(--blue); }
.billing-group-total { margin-left: 12px; color: var(--muted); font-size: .875rem; font-weight: 500; }
.billing-group > .table { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 13px 13px; }
.billing-level { display: grid; gap: 2px; min-width: 130px; }
.billing-level-2 { margin-left: 12px; padding-left: 11px; border-left: 2px solid #c6def5; }
.billing-level small { color: var(--muted); font-size: .875rem; }
.billing-group td > small { display: block; margin-top: 4px; font-size: .875rem; }
.billing-warning { color: #913921; font-weight: 600; }
.billing-line-detail { margin-top: 6px; }
.billing-line-detail > summary { cursor: pointer; color: var(--blue-dark); font-size: .875rem; }
.billing-catalogue-note { margin: 12px 0 0; color: var(--muted); font-size: .875rem; }
.client-directory { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.client-entry { padding: 14px 18px; }
.client-entry + .client-entry { border-top: 1px solid var(--line); }
.client-directory-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.client-directory-main small { color: var(--muted); }
.client-entry details { margin-top: 5px; }
.client-entry summary { color: var(--blue-dark); cursor: pointer; font-size: .875rem; }
.client-entry ul { border-left: 2px solid #c6def5; list-style: none; margin: 6px 0 0 12px; padding-left: 14px; }
.client-entry li { padding: 3px 0; }
.client-profile { display: grid; gap: 14px; width: 100%; }
.client-profile fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0; }
.client-profile legend { font-weight: 650; padding-inline: 6px; }
.client-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,210px),1fr)); gap: 10px; align-items: start; }
.client-fields textarea { width: 100%; min-height: 64px; }
.rule-propagation { flex-basis: 100%; }
.rule-propagation input { width: auto; margin-right: 5px; }
.rule-propagation small { color: var(--muted); font-weight: 400; }
form label:has(select[name="rate"]) { max-width: 100%; }
.task-overview { margin-bottom: 16px; }
.task-overview td > small { display: block; margin-top: 4px; color: var(--muted); font-size: .875rem; }
.task-state { font-weight: 650; }
.task-ok { color: #087765; }
.task-running { color: var(--blue-dark); }
.task-failed { color: #913921; }
button:disabled { cursor: default; opacity: .6; }

form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
label { min-width: 0; display: grid; gap: 5px; font-size: .875rem; font-weight: 600; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  min-width: 0;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #c4d5e6;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
}
textarea { min-height: 86px; width: min(62vw, 650px); }
button {
  padding: 9px 15px;
  cursor: pointer;
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: .875rem;
  font-weight: 650;
}
button:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
td button {
  padding: 6px 10px;
  background: #fff;
  border-color: #bfd4e8;
  color: var(--blue-dark);
}
td button:hover { background: var(--pale); border-color: #96bce0; }
.toolbar, .pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 16px 0;
}
.pager { justify-content: flex-end; font-size: .875rem; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.cards section { padding: 17px 19px; }
.cards strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(1.25rem, 2.25vw, 2rem);
  letter-spacing: -.035em;
  font-weight: 500;
}
.cards section div, .empty { color: var(--muted); }
.cards section:last-child { background: var(--navy); border-color: var(--navy); color: #fff; }
.cards section:last-child div { color: #c5d9eb; }
.empty { margin: 0; padding: 24px 14px; text-align: center; }
.summary, .error { padding: 12px 16px; border: 1px solid #c9ddef; border-radius: 10px; background: var(--pale); }
.error { background: #fff2eb; border-color: #efc2ad; color: #913921; }
.terms { white-space: pre-wrap; }

.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-banner {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: linear-gradient(165deg, #133d63 0%, var(--navy) 48%, #071a2c 100%);
  color: #edf6ff;
}
.login-banner .brand { font-size: clamp(3.5rem, 8vw, 7rem); }
.login main { width: min(100%, 470px); align-self: center; margin-inline: auto; }
.login form { display: grid; gap: 18px; }
.login form button { justify-self: start; }
.print { background: white; }
.print main { max-width: 900px; }
.print .brand { margin-bottom: 20px; }
.print .brand span { color: var(--blue); }

@media (max-width: 1050px) {
  :root { --rail-width: 195px; }
  aside { padding-inline: 17px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  aside { position: static; width: 100%; padding: 20px; gap: 14px; }
  aside > .brand { margin-left: 0; font-size: 1.8rem; }
  nav { display: flex; flex-wrap: wrap; gap: 3px; }
  nav a { padding: 6px 9px; }
  .account { padding-left: 0; }
  aside + main { margin-left: 0; }
  main { padding: 23px 16px; }
  header { margin: 3px 0 21px; }
  .tabs { gap: 2px; }
  .tabs a { padding-inline: 8px; }
  section { padding: 16px; }
  .cards { gap: 8px; }
  .cards section { margin-bottom: 8px; padding: 12px; }
  .login { display: block; }
  .login-banner { min-height: 155px; }
  .login-banner .brand { font-size: 3.5rem; }
}
@media print {
  #print { display: none; }
  .print main { padding: 0; }
  .print .table { border: 0; overflow: visible; }
  .print table { min-width: 0; }
  .print .quote-annex { break-before: page; }
  .print thead { display: table-header-group; }
  .print tr { break-inside: avoid; }
  tbody tr:hover { background: transparent; }
}

.lgt-print main { font-family: Calibri, 'Segoe UI', sans-serif; color: #253445; max-width: 210mm; }
.lgt-cover, .lgt-sheet { margin-bottom: 24px; padding: 12mm; }
.lgt-cover { position: relative; min-height: 245mm; border-left: 5mm solid #405065; }
.lgt-date { display: inline-block; padding: 8px 22px; background: #478ccb; color: #fff; margin-left: -12mm; }
.lgt-cover-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-top: 32mm; text-align: right; }
.lgt-cover h1 { margin: 0; font-size: 30pt; font-weight: 400; }
.lgt-cover-title img, .lgt-header img { width: 39mm; height: auto; }
.lgt-cover-title p, .lgt-cover-brand, .lgt-sheet h2, .lgt-sheet h3 { color: #2f6caa; }
.lgt-cover-brand { position: absolute; bottom: 12mm; right: 12mm; }
.lgt-sheet { display: flex; flex-direction: column; min-height: 245mm; }
.lgt-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10mm; }
.lgt-header::after { content: ''; flex: 1; border-top: 2px solid #478ccb; }
.lgt-sheet h2 { font-size: 20pt; font-weight: 400; margin: 0 0 6mm; }
.lgt-sheet h3 { font-size: 13pt; margin: 0 0 3mm; }
.lgt-sheet .table { margin-bottom: 8mm; }
.lgt-sheet thead th { background: #dce6f5; }
.lgt-sheet .lgt-footer { display: block; width: 100%; margin-top: auto; padding-top: 10mm; }
.lgt-toc { padding-left: 20px; }
.lgt-toc li { padding: 8px 0; border-bottom: 1px solid #dce6f5; }
@media print {
  .lgt-print { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .lgt-print main { max-width: none; }
  .lgt-cover, .lgt-sheet { margin: 0; padding: 7mm 9mm; min-height: 245mm; }
  .lgt-date { margin-left: -9mm; }
  .lgt-sheet { break-before: page; display: block; }
  .lgt-sheet .lgt-footer { margin-top: 8mm; width: 100%; break-inside: avoid; }
}

.simple-print main { max-width: 210mm; color: #253445; font-size: 11pt; }
.simple-doc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; border-bottom: 2px solid #478ccb; padding-bottom: 6mm; margin-bottom: 8mm; }
.simple-doc-header img { width: 43mm; height: auto; }
.simple-doc-header > div { text-align: right; }
.simple-doc-header h1 { margin: 0; color: #183654; font-size: 27pt; line-height: 1.1; }
.simple-doc-reference { margin: 2mm 0 3mm; font-weight: 700; color: #2f6caa; }
.simple-doc-header dl { margin: 0; font-size: 10pt; }
.simple-doc-header dl > div { display: flex; justify-content: flex-end; gap: 3mm; }
.simple-doc-header dt { color: #45586b; }
.simple-doc-header dd { margin: 0; font-variant-numeric: tabular-nums; }
.simple-doc-client { background: #f2f6fa; border-left: 3px solid #478ccb; padding: 4mm 5mm; margin-bottom: 8mm; overflow-wrap: anywhere; }
.simple-doc-client h2, .simple-doc-terms h2 { font-size: 11pt; margin: 0 0 2mm; color: #24496e; }
.simple-print table { min-width: 0; font-size: 10pt; }
.simple-print th { background: #e5edf6; color: #183654; }
.simple-print th:not(:first-child), .simple-print td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.simple-print td:first-child { width: 45%; overflow-wrap: anywhere; }
.simple-print td, .simple-print th { padding: 2.5mm 3mm; }
.simple-doc-total { display: flex; gap: 10mm; justify-content: space-between; width: fit-content; min-width: 62mm; margin: 5mm 0 0 auto; padding: 3mm 4mm; color: #183654; background: #e5edf6; border-top: 2px solid #478ccb; }
.simple-doc-total strong { font-variant-numeric: tabular-nums; }
.simple-doc-terms, .simple-doc-footer { margin-top: 8mm; }
.simple-doc-footer img { display: block; width: 100%; height: auto; }
.simple-print .quote-annex { margin: 10mm 0; }
.simple-print #print { margin-top: 5mm; }
@media print {
  .simple-print { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .simple-doc-header, .simple-doc-client, .simple-doc-total, .simple-doc-footer { break-inside: avoid; }
}

.client-quote-preview { display: block; width: 100%; height: 65vh; border: 1px solid #d8e0e8; margin-top: 12px; }

.quote-response { display: block; }
.quote-response .quote-cgv { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.quote-response .quote-cgv input { width: auto; min-height: 0; margin: 0; }
.quote-response-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1rem; }
.quote-response-actions button:disabled { opacity: .55; cursor: not-allowed; }

.client-quote-toolbar { margin-bottom: 1rem; }
.client-quote-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(280px,1fr); gap: 1rem; align-items: start; max-width: 1250px; }
.client-quote-layout > section { margin: 0; min-width: 0; }
.client-quote-layout .client-quote-preview { margin-top: 0; height: 70vh; }
.quote-response > #quote-accept { width: 100%; }
.quote-response > .quote-response-actions { display: grid; border-top: 1px solid #d4dfeb; padding-top: 1rem; }
.quote-response > .quote-response-actions button, #quote-cancel { background: white; color: #164c82; border: 1px solid #b6c9de; }
#quote-comment-panel { margin-top: 1rem; }
@media (max-width: 740px) {
  .client-quote-layout { grid-template-columns: minmax(0,1fr); }
  .client-quote-layout > section:last-child { order: -1; }
}
