:root {
  color-scheme: light;
  --ink: #291c20;
  --muted: #65565a;
  --accent: #76263e;
  --line: #e7d9d2;
  --paper: #fffdfb;
  --warm: #f7eee9;
  --selection: #faf3f4;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 "Inter", system-ui, sans-serif; }
main { max-width: 1440px; margin: 0 auto; padding: clamp(18px, 3vw, 44px); }
.brand { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); color: var(--accent); }
.brand img { width: 99px; height: 58px; object-fit: contain; }
.brand p { font-size: 13px; color: var(--muted); margin: 1px 0 0; }
.estimate-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, 34%); gap: clamp(20px, 3vw, 40px); align-items: start; margin-top: 26px; }
.estimate-content { min-width: 0; }
.estimate-heading { margin: 3px 0 23px; }
h1 { margin: 0 0 9px; color: var(--accent); font-size: clamp(29px, 4.1vw, 56px); line-height: 1.12; letter-spacing: -.035em; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 3px 14px; color: var(--muted); font-size: 14px; }
.meta span { overflow-wrap: anywhere; }
.intro { margin: 12px 0 0; }
.totals {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: clamp(19px, 2.8vw, 34px);
  background: var(--warm);
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.totals h2 { margin: 0 0 3px; color: var(--accent); font-size: clamp(18px, 2vw, 25px); line-height: 1.2; }
.totals > div { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; }
.totals span { color: var(--muted); }
.totals b { text-align: right; font-size: 17px; overflow-wrap: anywhere; }
.totals .total { padding-top: 12px; border-top: 1px solid #cdb4ab; }
.total span, .total b { color: var(--accent); font-weight: 750; font-size: clamp(22px, 2.5vw, 34px); line-height: 1.15; }
.totals .per-child b { font-size: 17px; }
.summary-note { margin: 0; font-size: 13px; color: var(--muted); }
.approve-button { width: 100%; margin-top: 4px; }
.approval-status { margin: 4px 0 0; border-top: 1px solid #cdb4ab; padding-top: 10px; color: var(--accent); font-weight: 700; }

.offers { width: 100%; border-collapse: collapse; }
.offers td { padding: 12px 5px; vertical-align: top; }
.offers .category th { padding: 8px 12px; background: var(--warm); color: var(--accent); border-radius: 6px; text-align: left; font-size: 16px; }
.category-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.offers .category-select { min-height: 36px; padding: 5px 10px; background: transparent; color: var(--accent); font-size: 13px; }
.offer:not(:last-child) { border-bottom: 1px solid var(--line); }
.offer.selected { background: var(--selection); }
.offers .category:not(:first-child), .offers tbody + tbody .category { border-top: 10px solid var(--paper); }
.choice { width: 32px; padding-left: 11px !important; }
.service { min-width: 0; }
.service-name { font-size: 17px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.description { max-width: 66ch; margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.service-link { display: inline-block; margin-top: 4px; font-size: 13px; }
.offers .unit-price { padding-right: 11px; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.unit-price strong { font-size: 16px; font-weight: 400; }
.quantity { display: block; color: var(--muted); font-size: 13px; }
.choice > span { font-size: 11px; color: var(--muted); }
.choice-control { display: inline-flex; align-items: center; min-height: 35px; margin: -7px 0; cursor: pointer; }
.choice-control input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
a { color: var(--accent); text-underline-offset: 3px; }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 15px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-weight: 650; text-decoration: none; text-align: center; cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); border-color: #cbb6ae; }
button:disabled, input:disabled { opacity: .6; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #a36b47; outline-offset: 3px; }
.customer-comment { margin-top: 24px; display: flex; gap: 10px; align-items: flex-start; }
.customer-comment textarea { font: inherit; flex: 1; width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #c9b8be; border-radius: 8px; resize: vertical; }
#action-status { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
#action-status:empty { margin: 0; }
.error, #action-status.error { color: var(--accent); background: var(--selection); padding: 12px; border-radius: 8px; }
.empty { padding: 12px 0; }

@media screen and (max-width: 760px) {
  main { padding: 14px max(14px, env(safe-area-inset-right)) 24px max(14px, env(safe-area-inset-left)); }
  .brand img { width: 72px; height: 45px; }
  .estimate-layout { grid-template-columns: minmax(0, 1fr); margin-top: 17px; gap: 16px; }
  .estimate-content { display: contents; }
  .estimate-heading { order: -3; margin: 0; }
  .offers { order: -2; table-layout: fixed; }
  .totals { order: -1; position: static; }
  .offers .choice { width: 45px; padding-left: 6px !important; }
  .offers .unit-price { width: 28%; padding-right: 4px; }
  .choice-control { min-height: 44px; }
  .description, .quantity { font-size: 13px; }
  .unit-price strong { font-size: 14px; }
  .customer-comment { flex-direction: column; margin-top: 0; }
  #action-status { margin-top: 0; }
}

@page { size: A4 landscape; margin: 10mm; }
@media print {
  body { background: #fff; font-size: 11px; }
  main { padding: 0; max-width: none; }
  .estimate-layout { display: block; }
  .totals { position: static; margin: 10px 0; padding: 8px 12px; }
  .offers td { padding: 5px 8px; }
  .category { break-after: avoid; }
  .offer, .totals { break-inside: avoid; }
  .offers .category th, .offer.selected { print-color-adjust: exact; }
  .service-name, .unit-price strong { font-size: 11px; }
  .description, .quantity, .service-link { font-size: 10px; }
  #action-status, .customer-comment, .intro, .approve-button, .category-select { display: none; }
  .brand img { width: 76px; height: 42px; }
  h1 { font-size: 23px; }
  .total span, .total b { font-size: 18px; }
}
