:root {
  color-scheme: light;
  --heading: #24211f;
  --accent-hover: #d9b38f;
  --ink: #2b2520;
  --muted: #65574a;
  --gold: #a48450;
  --border: #e5d5c4;
  --paper: #fbfaf5;
  --sand: #ebcbae;
  --ground: #f6efe3;
  --sand-light: #f3e4d3;
  --pale-gold: #f5e7d4;
  --green: #075943;
  --radius: 16px;
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--ink); line-height: 1.45; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--heading); line-height: 1.14; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #805e32; outline-offset: 3px; }
.wrap { width: min(100% - 64px, 1192px); margin-inline: auto; }
.topbar { background: var(--paper); color: var(--heading); border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 72px; display: flex; justify-content: space-between; align-items: center; }
.brand { width: 112px; height: auto; display: block; filter: brightness(0); }

main { padding: 34px 0 60px; }
.hero { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 88% 10%, #f8e8d3, transparent 67%), var(--sand); color: var(--heading); min-height: 180px; display: flex; align-items: center; border-radius: 20px; padding: 36px 42px; }
.hero-content { position: relative; z-index: 1; }
.hero-content::before { content: ""; display: block; background: var(--gold); width: 40px; height: 3px; border-radius: 20px; margin-bottom: 15px; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.05em; color: var(--heading); font-weight: 750; }
.hero p { color: #4f4034; margin-top: 9px; font-size: 1.0625rem; }
.hero-lines { position: absolute; width: 405px; height: 405px; right: -44px; top: -122px; transform: rotate(-29deg); pointer-events: none; }
.hero-lines i { position: absolute; inset: 23%; border: 1px solid #a484505c; border-radius: 46% 41% 44% 39%; }
.hero-lines i:nth-child(2) { inset: 16%; border-color: #a4845050; }
.hero-lines i:nth-child(3) { inset: 9%; border-color: #a4845042; }
.hero-lines i:nth-child(4) { inset: 2%; border-color: #a4845033; }
.hero-lines i:nth-child(5) { inset: -5%; border-color: #a4845026; }

.workspace { margin-top: 32px; display: grid; grid-template-columns: minmax(0, 1.66fr) minmax(0, 1fr); align-items: start; gap: 25px; }
.editor { min-width: 0; }
.editor-top { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.editor-top h2, .estimate h2 { font-size: 1.375rem; letter-spacing: -.025em; }
.button { min-height: 44px; border: 1px solid transparent; border-radius: 9px; background: var(--paper); color: var(--heading); font-size: .875rem; font-weight: 680; padding: 7px 13px; }
.button-primary { background: var(--sand); color: var(--heading); border-color: var(--gold); border-radius: 999px; }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button-primary:disabled { background: #f0e7dc; color: #65574a; }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { background: #f0e5d9; color: var(--heading); }
.button-quiet span[aria-hidden] { font-size: 1rem; margin-right: 3px; }
.button-secondary { border-color: #cdb69c; }
.button-secondary:hover, .button-add:hover { background: #f0dfcd; }
.button-add { margin-top: 11px; padding-inline: 11px; background: var(--sand-light); }
.button-add span { font-size: 1.1rem; line-height: .75; margin-right: 3px; }

.tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; border: 1px solid var(--border); border-radius: 12px; background: #f0dfcd; padding: 4px; margin-bottom: 17px; }
.tabs button { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 5px 7px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #55463b; font-size: .875rem; font-weight: 660; text-align: center; line-height: 1.2; }
.tabs button:is([aria-selected="true"], [aria-current="true"]) { background: var(--sand); border-color: var(--gold); color: var(--heading); box-shadow: 0 2px 5px #503b2012; }
.tabs button:not([aria-selected="true"], [aria-current="true"]):hover { color: var(--heading); background: #faf3e8; }
.panel { display: grid; gap: 16px; }
.card { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; padding: 23px; }
.card-head { margin-bottom: 18px; }
.card-head h3 { font-size: 1.1875rem; letter-spacing: -.015em; }
.card-head p, .section-note { margin-top: 6px; color: var(--muted); font-size: .9375rem; }
.section-note { margin: 0 2px; }

.row-field { display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: end; gap: 13px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 650; }
.field select { appearance: none; width: 100%; min-height: 46px; display: block; padding: 10px 31px 10px 11px; border: 1px solid #d2bca4; border-radius: 9px; background: linear-gradient(45deg, transparent 50%, var(--heading) 50%) calc(100% - 16px) 52% / 5px 5px no-repeat, linear-gradient(135deg, var(--heading) 50%, transparent 50%) calc(100% - 11px) 52% / 5px 5px no-repeat, var(--paper); color: var(--ink); text-overflow: ellipsis; }
.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; border: 1px solid #d2bca4; border-radius: 9px; min-width: 0; }
.stepper button { background: #f7eee3; border: 0; min-height: 44px; font-size: 1.25rem; font-weight: 600; color: var(--heading); }
.stepper button:first-child { border-radius: 8px 0 0 8px; }
.stepper button:last-child { border-radius: 0 8px 8px 0; }
.stepper button:hover:not(:disabled) { background: #edd8c3; }
.stepper button:disabled { color: #796b5e; background: #f9f4ec; }
.stepper input { min-width: 0; width: 100%; padding: 0 1px; border: 0; text-align: center; border-inline: 1px solid var(--border); background: var(--paper); color: var(--heading); font-weight: 650; font-variant-numeric: tabular-nums; }
.stepper input:focus-visible { z-index: 1; outline-offset: -3px; }
.product-details { min-width: 0; margin-top: 9px; color: var(--muted); font-size: .875rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.product-details strong { color: var(--heading); }
.warranty { border-left: 1px solid #d8c4ad; padding-left: 10px; }
.inclusion { margin-top: 18px; display: flex; gap: 9px; align-items: start; padding: 11px 13px; border-radius: 9px; background: var(--pale-gold); color: #553e0f; font-size: .875rem; }
.check { font-weight: 800; }
.addons { margin-top: 15px; padding-top: 8px; border-top: 1px solid var(--border); }
.addons summary { min-height: 40px; padding: 9px 2px; color: var(--heading); cursor: pointer; font-weight: 640; font-size: .9375rem; }
.add-on-fields { display: grid; gap: 8px; }
.addon { display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: end; gap: 12px; padding: 6px 0; }
.addon > div:first-child { align-self: center; }
.addon strong { font-size: .9375rem; }
.addon p { margin-top: 2px; color: var(--muted); font-size: .875rem; }

.compare-grid, .comparison-prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.compare-grid { border: 1px solid var(--border); border-bottom: 0; border-radius: 11px 11px 0 0; overflow: clip; }
.compare-option { background: #fcf7ee; padding: 13px; min-width: 0; display: flex; flex-direction: column; align-items: start; }
.compare-option .field { width: 100%; }
.compare-option > strong { color: var(--heading); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: 46px; }
.compare-option > strong span { font-size: .875rem; color: var(--muted); }
.compare-option .compare-label { margin-bottom: 6px; font-size: .875rem; color: var(--ink); font-weight: 650; }
.compare-option p { margin: 6px 0 9px; color: var(--muted); font-size: .875rem; }
.compare-option button { margin-top: auto; }
.compare-option :focus-visible { outline-offset: -3px; }
.comparison-prices { border: 1px solid var(--border); border-radius: 0 0 11px 11px; overflow: clip; }
.comparison-prices div { background: var(--sand-light); padding: 9px 13px; min-width: 0; }
.comparison-prices span { display: block; color: var(--muted); font-size: .875rem; margin-bottom: 1px; }
.comparison-prices strong { color: var(--heading); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.service + .service { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.service-foot { display: flex; justify-content: space-between; gap: 5px; align-items: baseline; }
.service-foot button { padding-inline: 7px; }
.deal { background: #edf6f0; color: var(--green); border-radius: 4px; font-weight: 660; padding: 0 4px; white-space: nowrap; }
.arch-options { display: grid; gap: 12px; margin-top: 12px; }
.arch-options .product-details { margin: -7px 0 0; }

.estimate { position: sticky; top: 20px; min-width: 0; padding: 23px; background: var(--paper); border: 1px solid #e3cfba; border-radius: var(--radius); box-shadow: 0 8px 28px #503b200a; scroll-margin-top: 12px; }
.estimate-head { display: flex; align-items: center; gap: 12px; }
.receipt-icon { display: grid; place-items: center; position: relative; inline-size: 39px; block-size: 39px; border-radius: 10px; background: var(--sand-light); color: var(--heading); }
.receipt-icon::before { content: ""; width: 14px; height: 18px; border: 1.5px solid currentColor; border-radius: 2px; }
.receipt-icon::after { content: ""; position: absolute; width: 6px; top: 17px; height: 4px; border-block: 1px solid currentColor; }
.empty-quote { text-align: center; margin: 18px 0; padding: 26px 13px 24px; background: #fbF7f0; border: 1px dashed #d9c7b2; border-radius: 12px; color: var(--heading); }
.sheet { display: grid; align-content: center; gap: 5px; width: 30px; height: 36px; border: 1.5px solid #a48450; border-radius: 4px; margin: 0 auto 10px; }
.sheet i { display: block; width: 15px; height: 1px; background: #a48450; margin: 0 auto; }
.empty-quote p { max-width: 250px; margin: 5px auto 0; font-size: .875rem; color: var(--muted); }
.quote-lines { margin: 16px 0 12px; padding: 0; list-style: none; max-height: 48vh; overflow-y: auto; overscroll-behavior-y: contain; }
.quote-lines li { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.quote-lines li:last-child { border-bottom: 0; }
.quote-lines li > div > span { display: block; margin-top: 3px; color: var(--muted); font-size: .8125rem; }
.line-total { color: var(--heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.included-text { color: var(--green); }
.estimate-total { background: var(--sand); color: var(--heading); border-radius: 11px; padding: 14px; }
.estimate-total > div { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; }
.estimate-total > div > span { color: #382e25; font-size: .9375rem; font-weight: 650; }
.estimate-total strong { font-size: clamp(1.25rem, 2.5vw, 1.6rem); letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.estimate-total small { font-size: .75rem; letter-spacing: .04em; color: #694b29; }
.estimate-total p { margin-top: 5px; color: #694b29; font-size: .8125rem; }
.estimate > .button { width: 100%; margin-top: 12px; }
.copy-status { margin-top: 10px; font-size: .875rem; color: var(--muted); }
.copy-status textarea { width: 100%; margin-top: 5px; border: 1px solid var(--border); border-radius: 5px; }
.mobile-total { display: none; }

@media (max-width: 880px) {
  .wrap { width: calc(100% - 36px); }
  .workspace { gap: 15px; }
  .card, .estimate { padding: 17px; }
  .quote-lines li { grid-template-columns: minmax(0, 1fr); gap: 3px; }
}

@media (max-width: 730px) {
  main { padding: 20px 0 calc(94px + env(safe-area-inset-bottom)); }
  .topbar-inner { min-height: 62px; }
  .brand { width: 94px; }
  .hero { min-height: 143px; padding: 23px; border-radius: 15px; }
  .hero-lines { opacity: .56; right: -165px; }
  .hero-content::before { margin-bottom: 10px; }
  .hero p { font-size: .9375rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); margin-top: 19px; gap: 17px; }
  .estimate { position: static; }
  .quote-lines { max-height: unset; }
  .quote-lines li { grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; }
  .mobile-total { position: fixed; display: flex; justify-content: space-between; align-items: center; gap: 10px; z-index: 2; bottom: 0; left: 0; right: 0; padding: 9px 18px calc(9px + env(safe-area-inset-bottom)); min-height: 60px; color: var(--heading); background: var(--sand); box-shadow: 0 -3px 20px #503b2025; text-decoration: none; }
  .mobile-total span { font-size: .875rem; font-weight: 650; }
  .mobile-total small { display: block; font-size: .8125rem; color: #694b29; text-decoration: underline; font-weight: 600; }
  .mobile-total strong { font-size: 1rem; font-variant-numeric: tabular-nums; text-align: right; }
  .mobile-total:focus-visible { outline-offset: -4px; outline-color: var(--gold); }
}

@media (max-width: 465px) {
  .wrap { width: calc(100% - 26px); }
  .hero { min-height: 145px; padding: 20px; }
  .hero h1 { font-size: 2rem; }
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tab-care, [data-continue-tab="care"] { grid-column: 1 / -1; }
  .card, .estimate { padding: 15px; }
  .row-field { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .quantity-field { width: 127px; }
  .compare-option, .comparison-prices div { padding-inline: 9px; }
  .compare-option .button { padding-inline: 7px; }
  .compare-option select { font-size: .875rem; }
}

#download-quote { margin-top: 8px; }
#download-quote:disabled { color: var(--muted); background: #fbf5ec; border-color: var(--border); }

.implant-reference { container-type: inline-size; }
.table-scroll-hint { color: var(--muted); font-size: .875rem; margin-bottom: 7px; }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 9px; }
.data-table { width: 100%; border-spacing: 0; color: var(--ink); font-size: .875rem; text-align: left; }
.data-table th, .data-table td { padding: 10px; vertical-align: top; border-bottom: 1px solid var(--border); }
.data-table tr:last-child td, .data-table tbody tr:last-child th { border-bottom: 0; }
.data-table thead th { color: var(--heading); background: var(--sand-light); }
.data-table thead th span { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }
.data-table tbody th { font-weight: 650; }
.data-table tr:nth-child(even) { background: #faf5ed; }
.implant-table { min-width: 986px; table-layout: fixed; }
.implant-table th, .implant-table td { border-right: 1px solid var(--border); }
.implant-table :is(th, td):last-child { border-right: 0; }
.implant-table th:first-child { position: sticky; left: 0; width: 108px; background: #f0e5d8; }

.implant-sources { margin-top: 9px; }
.implant-sources summary { min-height: 32px; cursor: pointer; color: var(--heading); font-weight: 650; }
.implant-sources ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px 12px; padding-left: 18px; margin: 5px 0 0; font-size: .875rem; }
.care-table td, .care-table thead th:last-child { text-align: right; }
.care-table td { color: var(--heading); white-space: nowrap; }
.care-table td span { display: block; color: var(--muted); font-size: .8125rem; }

@container (min-width: 988px) {
  .table-scroll-hint { display: none; }
}
@media (max-width: 465px) {
  .implant-table th:first-child { width: 89px; }
}

.quote-image-dialog { width: min(720px, calc(100% - 24px)); max-height: 90dvh; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--ink); }
.quote-image-dialog::backdrop { background: #38291e85; }
.quote-image-header, .quote-image-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.quote-image-header { justify-content: space-between; margin-bottom: 12px; }
.quote-image-header h2 { font-size: 1.25rem; }
.quote-image-actions a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
#quote-image-result p { margin: 10px 0; color: var(--muted); font-size: .875rem; }
.quote-image-preview img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; }

.data-table .care-group th { background: var(--sand-light); color: var(--heading); }

#treatment-tabs { scroll-margin-top: 14px; }
.continue-treatment { margin-top: 18px; }
.continue-treatment h3 { margin-bottom: 9px; font-size: 1rem; }
.continue-treatment .tabs { margin-bottom: 0; }
.care-note { display: block; margin-top: 3px; color: var(--muted); font-size: .8125rem; font-weight: 400; }

.language-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--sand-light); }
.language-switch button { min-height: 44px; border: 1px solid transparent; border-radius: 999px; background: transparent; padding: 4px 11px; color: var(--heading); font-size: .875rem; font-weight: 650; white-space: nowrap; }
.language-switch button:hover { background: var(--paper); }
.language-switch button[aria-pressed="true"] { background: var(--sand); border-color: var(--gold); }
