:root {
  --brand: #234591;
  --brand-600: #1c3a7a;
  --azure: #009ee0;
  --azure-ink: #0075a8;
  --azure-tint: #e6f6fd;
  --red: #e2001a;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #252c3d;
  --ink-strong: #141f30;
  --muted: #5c6472;
  --line: #e7ecf0;
  --line-strong: #d4dbe1;
  --ok: #1f9d55;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 6px 20px rgba(16, 32, 48, .06);
  --font: "Source Sans Pro", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --maxw: 760px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
.hidden { display: none !important; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.hdr { background: #fff; }
.hdr-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 15px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brandmark { display: inline-flex; }
.brandmark img { display: block; height: 30px; }
.spacer { flex: 1; }
.hdr-right { display: flex; align-items: center; gap: 14px; }
.hdr-meta { text-align: right; line-height: 1.3; }
.hdr-meta .label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.ver { color: var(--muted); font-size: 11px; opacity: .75; }
.lang {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
}
.lang-btn {
  appearance: none;
  border: 0;
  padding: 5px 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  line-height: 1;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn[aria-pressed="true"] { color: #fff; background: var(--brand); }
.accent-rule { height: 3px; background: var(--red); }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 22px 30px;
  flex: 1;
}
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.state {
  max-width: 520px;
  margin: 48px auto;
  padding: 42px 32px;
  text-align: center;
}
.state h2 { margin: 14px 0 6px; color: var(--ink-strong); font-size: 24px; line-height: 1.2; }
.state p { margin: 0; color: var(--muted); }
.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border: 3px solid #dfe7ea;
  border-top-color: var(--azure);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.state-icon {
  width: 38px;
  height: 38px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--azure);
  font-size: 20px;
  font-weight: 700;
}
.error-icon { background: var(--danger); }
.landing-steps {
  max-width: 380px;
  margin: 20px auto 0;
  padding-left: 20px;
  color: var(--muted);
  text-align: left;
  font-size: 14px;
  line-height: 1.55;
}
.landing-steps li + li { margin-top: 6px; }
.landing-note { margin-top: 18px !important; font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  padding: 24px 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.eyebrow {
  margin: 0 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--azure-ink);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.eyebrow::before {
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--red);
  content: "";
}
.hero h2 {
  margin: 2px 0 3px;
  color: var(--ink-strong);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.15;
}
.summary { max-width: 580px; margin: 10px 0 0; white-space: pre-line; }
.status {
  padding: 9px 15px;
  border: 1px solid #cdebd9;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #16794a;
  background: #e9f6ef;
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status.is-scheduled { color: #1f5fa6; background: #e7f1fb; border-color: #c7ddf3; }
.status.is-inprogress { color: #96620a; background: #fff4e3; border-color: #f2ddba; }
.status.is-canceled { color: #b3281f; background: #fdeceb; border-color: #f3cdca; }
.status.is-neutral { color: #5b6b7b; background: #eef1f5; border-color: #dde3ea; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.grid .card { padding: 22px 26px; }
.grid .facts, .grid .bookings, .grid .wide, .grid .totals, .grid #checklistsCard, .grid #signatureCard { grid-column: 1 / -1; }
h3 { margin: 0 0 18px; color: var(--ink-strong); font-size: 16px; }
/* Collapsible card (native <details>): the header row toggles, collapsed by default. */
.card-toggle { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; user-select: none; }
.card-toggle::-webkit-details-marker { display: none; }
.card-toggle::before { content: "\25B8"; color: var(--muted); font-size: 13px; transition: transform .15s; }
details[open] > .card-toggle::before { transform: rotate(90deg); }
.card-toggle h3 { margin: 0; }
details[open] > .card-toggle { margin-bottom: 18px; }
.card-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.card-count:empty { display: none; }
dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 22px; margin: 0; }
.facts dl { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.facts dl .span2 { grid-column: span 2; }
.acct-link {
  appearance: none; background: none; border: 0; padding: 0; font: inherit; color: var(--brand);
  font-weight: 600; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-style: dotted;
  text-underline-offset: 3px;
}

/* Account card dialog */
.acct-dialog {
  width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px;
  background: var(--panel); color: var(--ink); box-shadow: 0 24px 60px rgba(16, 32, 64, .28);
}
.acct-dialog::backdrop { background: rgba(16, 32, 64, .45); }
.acct-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.acct-head h3 { margin: 4px 0 0; font-size: 18px; }
.acct-close {
  appearance: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 32px; height: 32px;
  font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; flex: 0 0 auto;
}
.acct-close:hover { color: var(--ink-strong); border-color: var(--ink-strong); }
.acct-facts { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 16px 22px 22px; margin: 0; }
.acct-facts a { color: var(--brand); }
dl div { min-width: 0; }
dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink-strong);
  font-size: 15px;
}
/* Financial line tables (services, materials). */
.price-list { overflow-x: auto; }
.price-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.price-table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); padding: 0 10px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.price-table td { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.price-table tr:last-child td { border-bottom: 0; }
.price-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-table th:last-child, .price-table td:last-child { padding-right: 0; }
.price-table .art { color: var(--ink-strong); font-weight: 600; overflow-wrap: anywhere; }
.price-table .meta { margin-top: 2px; font-size: 12px; color: var(--muted); }
.price-table .disc { color: #16794a; font-size: 13px; }
.price-table .disc-amount { font-size: 12px; color: var(--muted); }
.price-table .total { color: var(--ink-strong); font-weight: 700; }
.price-table tr.not-invoiced td { color: var(--muted); }
.price-table tr.not-invoiced .art { color: var(--muted); }
.price-table tr.not-invoiced .total { text-decoration: line-through; font-weight: 600; color: var(--muted); }
.price-table .line-tag { margin-top: 6px; }
.line-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.line-tag.notinv { background: #fff4e3; color: #96620a; }

/* Totals (excl. VAT) - reconciles with the invoice. */
.total-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.total-tile { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); min-width: 0; }
.total-tile dt { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.total-tile dd { margin: 6px 0 0; font-size: 20px; font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.total-tile.discount dd { color: #16794a; }
.total-tile.grand { background: var(--brand); border-color: var(--brand); }
.total-tile.grand dt { color: rgba(255, 255, 255, .78); }
.total-tile.grand dd { color: #fff; font-size: 22px; font-weight: 800; }
.totals-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; margin-top: 12px; }
.totals-foot span { font-size: 13px; color: var(--muted); }
.vat-note { margin: 0 0 0 auto; text-align: right; font-size: 12.5px; color: var(--muted); }
.empty { margin: 0; color: var(--muted); font-style: italic; }
.booking-list { display: grid; gap: 8px; }
.booking {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.booking:last-child { border-bottom: 0; }
.booking-time { color: var(--ink-strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.booking-tech { flex: 1 1 auto; color: var(--ink); font-size: 13px; }
.booking-tech:empty { display: none; }
.booking-status {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}
.notice {
  margin-top: 18px;
  padding: 20px 24px;
  border-left: 4px solid var(--azure);
}
.notice strong { color: var(--ink-strong); }
.notice-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 3px; }
.notice p { margin: 0; color: var(--muted); }
.mail-btn {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 10px 18px; border-radius: 10px; background: var(--brand); color: #fff;
  font-weight: 700; font-size: 14px; text-decoration: none;
}
.mail-btn:hover { filter: brightness(1.08); }
.mail-btn.hidden { display: none; }

.foot { margin-top: 8px; border-top: 1px solid var(--line); background: #fff; }
.foot-in { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 22px 22px 34px; }
.foot-logo { display: block; height: 26px; margin-bottom: 12px; opacity: .95; }
.foot p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.foot .legal { margin-bottom: 6px; max-width: 62ch; }

@media (max-width: 660px) {
  .hdr-in { gap: 10px; padding: 12px 16px; }
  .brandmark img { height: 26px; }
  .hdr-right { gap: 9px; }
  .hdr-meta .label { display: none; }
  .lang-btn { padding: 5px 9px; }
  .wrap { padding: 20px 14px 24px; }
  .state { margin: 24px auto; padding: 34px 22px; }
  .hero { display: block; padding: 22px; }
  .status { margin-top: 16px; }
  .grid { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .grid .facts, .grid .bookings { grid-column: auto; }
  .grid .card { padding: 20px 22px; }
  .booking { align-items: flex-start; flex-direction: column; gap: 5px; }
  dl { grid-template-columns: 1fr; gap: 14px; }
  .facts dl { grid-template-columns: 1fr 1fr; }
  .facts dl .span2 { grid-column: 1 / -1; }
  .price-table thead { display: none; }
  .price-table, .price-table tbody, .price-table tr, .price-table td { display: block; width: 100%; }
  .price-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .price-table tr:last-child { border-bottom: 0; }
  .price-table td { border: 0; padding: 2px 0; }
  .price-table td.num { display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .price-table td.num::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; }
  .price-table td.disc { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 8px; }
  .price-table td.disc::before { margin-right: auto; }
  .total-tiles { grid-template-columns: 1fr 1fr; }
  .totals-foot { flex-direction: column; gap: 6px; }
  .vat-note { margin: 0; text-align: left; }
  .notice { margin-top: 14px; }
  .notice-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .foot-in { padding: 20px 16px 28px; }
}

@media print {
  .hdr-right, .accent-rule, .foot { display: none; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

.signature-image { display: block; width: 100%; max-width: 300px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
@media print { .mail-btn { display: none; } }


.checklist-list { display: grid; gap: 14px; }
.checklist { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.checklist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.checklist-name { font-weight: 700; }
.checklist-status { font-size: 12px; font-weight: 700; color: var(--muted); }
.checklist-status.done { color: #1e7a46; }
.checklist-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.checklist-row:first-of-type { border-top: none; }
.checklist-q { color: var(--muted); }
.checklist-a { font-weight: 600; text-align: right; }

.checklist-task { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.checklist-summary { list-style: none; cursor: pointer; padding: 11px 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; user-select: none; }
.checklist-summary::-webkit-details-marker { display: none; }
.checklist-summary::before { content: "\25B8"; color: var(--muted); font-size: 12px; transition: transform .15s; }
.checklist-task[open] > .checklist-summary::before { transform: rotate(90deg); }
.checklist-asset { display: flex; align-items: center; gap: 8px; margin: 0 14px 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
a.checklist-asset:hover { border-color: var(--brand); }
.checklist-asset .ca-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.checklist-asset .ca-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.checklist-asset .ca-name { color: var(--brand); }
.checklist-asset .ca-chev { color: var(--muted); font-size: 16px; }
.checklist-tech { display: flex; align-items: center; gap: 8px; margin: 0 14px 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.checklist-tech .ca-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.checklist-tech .ca-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: var(--ink-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checklist-body { padding: 2px 14px 14px; display: grid; gap: 12px; }
.checklist-body .checklist { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
