:root {
  --charcoal: #1a1a1a;
  --charcoal-2: #262421;
  --gold: #c8a061;
  --gold-soft: #e0c28e;
  --sand: #a89d8c;
  --paper: #f3efe6;
  --card: #fffdf8;
  --navy: #0d1b2a;
  --ink: #24211d;
  --muted: #716b62;
  --line: #ded5c6;
  --green: #335e4d;
  --shadow: 0 20px 54px rgba(31, 26, 20, .09);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
button, input, select { font: inherit; }
button, select, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.topbar {
  height: 78px;
  padding: 0 max(24px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(200, 160, 97, .32);
  background: rgba(26, 26, 26, .96);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; color: #f7f2e9; text-decoration: none; }
.brand img { width: 46px; height: 46px; border-radius: 11px; object-fit: cover; box-shadow: 0 5px 18px rgba(0,0,0,.28); }
.brand strong { display: block; font: 500 18px/1.05 Georgia, "Times New Roman", serif; letter-spacing: .09em; text-transform: uppercase; }
.brand small { display: block; color: var(--gold-soft); font-size: 9px; margin-top: 5px; letter-spacing: .16em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.status { display: inline-flex; align-items: center; gap: 7px; color: #d7cfbf; font-size: 11px; }
.status i { width: 7px; height: 7px; background: #67a67e; border-radius: 50%; box-shadow: 0 0 0 3px rgba(103,166,126,.14); }
.status.offline i { background: var(--gold); box-shadow: 0 0 0 3px rgba(200,160,97,.15); }
.topbar .ghost { border-color: rgba(224,194,142,.45); color: #f7f2e9; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 80px; }
.intro {
  min-height: 310px;
  margin-bottom: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 42%, rgba(200,160,97,.1), transparent 34%),
    linear-gradient(145deg, #171717, #21201e 58%, #141414);
  box-shadow: 0 24px 65px rgba(26,26,26,.18);
  position: relative;
}
.intro::before, .intro::after { content: ""; position: absolute; width: 170px; height: 1px; top: 50%; background: linear-gradient(90deg, transparent, rgba(200,160,97,.5)); }
.intro::before { right: calc(50% + 170px); }
.intro::after { left: calc(50% + 170px); transform: rotate(180deg); }
.intro-brand { padding: 30px; display: grid; place-items: center; position: relative; }
.intro-brand img { width: 168px; height: 168px; display: block; border-radius: 28px; object-fit: cover; }
.intro-brand strong { margin-top: 12px; color: #f7f1e7; font: 500 clamp(25px, 3vw, 37px)/1 Georgia, "Times New Roman", serif; letter-spacing: .16em; text-transform: uppercase; text-align: center; }
.eyebrow { color: var(--gold); font-size: 10px; font-weight: 750; letter-spacing: .17em; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: start; gap: 28px; }
.form-column { display: grid; gap: 20px; }
.panel, .recent { background: var(--card); border: 1px solid rgba(56, 47, 35, .1); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 28px; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 25px; }
.section-heading.compact { margin-bottom: 18px; }
.step { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--gold); border-radius: 50%; color: #9a7139; font: 600 12px Georgia, serif; }
.section-heading h2 { margin: 0; font: 500 25px/1.1 Georgia, serif; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.field-grid { display: grid; gap: 16px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.print-options { margin-top: 16px; }
.field { display: grid; gap: 8px; }
.field.full { margin-bottom: 16px; }
.field > span, .field > label { color: #535048; font-size: 12px; font-weight: 650; }
.field > span small, .field > label small { color: #99948b; font-weight: 400; }
input, select {
  width: 100%;
  height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { border-color: #a77f43; box-shadow: 0 0 0 3px rgba(200,160,97,.15); }
.input-unit { position: relative; }
.input-unit input { padding-right: 46px; }
.input-unit b { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: #928d84; font-size: 12px; }
.frame-field { position: relative; }
.frame-lookup { position: relative; }
.frame-lookup input { padding-right: 44px; text-transform: uppercase; font-weight: 700; letter-spacing: .025em; }
.frame-lookup::after {
  content: "⌕";
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-54%);
  color: #9a7139;
  font: 22px/1 Georgia, serif;
  pointer-events: none;
}
.frame-suggestions {
  position: absolute;
  z-index: 15;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  max-height: 310px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid #d2c7b6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(40, 32, 23, .16);
}
.frame-suggestion {
  width: 100%;
  min-height: 49px;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.frame-suggestion:hover, .frame-suggestion.active { background: #f6efe3; }
.frame-suggestion b { font-size: 12px; }
.frame-suggestion span { grid-column: 1; color: var(--muted); font-size: 9px; }
.frame-suggestion strong { grid-column: 2; grid-row: 1 / 3; align-self: center; color: #8a642f; font: 600 12px Georgia, serif; }
.frame-match { min-height: 17px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.frame-match.ok { color: var(--green); }
.frame-match.error { color: #9a4037; font-weight: 650; }
.frame-field.invalid input { border-color: #a84b40; box-shadow: 0 0 0 3px rgba(168,75,64,.11); }

.choices { border: 0; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choices legend { width: 100%; margin-bottom: 9px; color: #535048; font-size: 12px; font-weight: 650; }
.choice { cursor: pointer; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice > span { min-height: 98px; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; align-content: center; column-gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: .2s; }
.choice i { width: 30px; height: 30px; grid-row: 1 / 3; display: grid; place-items: center; align-self: center; border: 1px solid #ccb88e; color: #9a7139; font: normal 600 12px Georgia, serif; }
.choice b { font-size: 12px; align-self: end; }
.choice small { color: var(--muted); font-size: 10px; line-height: 1.25; }
.choice input:checked + span { border-color: var(--gold); background: #faf5eb; box-shadow: inset 0 0 0 1px var(--gold); }
.choice input:focus-visible + span { outline: 3px solid rgba(200,160,97,.2); }
.extras { margin-top: 18px; border-top: 1px solid #ebe5d9; }
.extras summary { list-style: none; cursor: pointer; padding-top: 18px; display: flex; justify-content: space-between; font-size: 12px; font-weight: 650; }
.extras summary::-webkit-details-marker { display: none; }
.extras summary span { color: var(--muted); font-weight: 400; }
.check-list { padding: 14px 0 2px; display: grid; grid-template-columns: 1fr 1fr; gap: 11px; color: #535048; font-size: 12px; }
.check-list label { display: flex; align-items: center; gap: 8px; }
.check-list input, .client-toggle input { width: 17px; height: 17px; accent-color: var(--gold); }

.commercial { background: #eee6d9; }
.coefficient { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.coefficient > span b, .coefficient > span small { display: block; }
.coefficient > span b { font-size: 13px; }
.coefficient > span small { color: var(--muted); margin-top: 3px; font-size: 11px; }
.coefficient-control { height: 46px; display: grid; grid-template-columns: 40px 70px 40px; border: 1px solid #c9c0b1; border-radius: 12px; overflow: hidden; background: white; }
.coefficient-control button { border: 0; background: transparent; color: #8b6632; font-size: 20px; }
.coefficient-control input { height: 44px; padding: 0; border: 0; border-left: 1px solid #e1dacf; border-right: 1px solid #e1dacf; border-radius: 0; text-align: center; font-weight: 700; -moz-appearance: textfield; }
.coefficient-control input::-webkit-inner-spin-button { display: none; }

.result-column { position: sticky; top: 98px; display: grid; gap: 20px; }
.result-card { padding: 28px; border: 1px solid rgba(200,160,97,.28); border-radius: 26px; background: var(--charcoal); color: #f8f4eb; box-shadow: 0 24px 60px rgba(26,26,26,.25); overflow: hidden; position: relative; }
.result-card::before { content: ""; position: absolute; width: 230px; height: 230px; border: 1px solid rgba(200,160,97,.12); transform: rotate(45deg); top: -165px; right: -70px; }
.result-top { display: flex; align-items: center; justify-content: space-between; position: relative; }
.eyebrow.light { color: var(--gold-soft); }
.client-toggle { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #d6cfc4; cursor: pointer; }
.client-toggle input { position: absolute; opacity: 0; }
.client-toggle span { width: 29px; height: 17px; padding: 2px; border-radius: 9px; background: rgba(255,255,255,.18); transition: .2s; }
.client-toggle span::after { content: ""; display: block; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: .2s; }
.client-toggle input:checked + span { background: var(--gold); }
.client-toggle input:checked + span::after { transform: translateX(12px); }
.price-block { padding: 33px 0 27px; border-bottom: 1px solid rgba(255,255,255,.14); }
.price-block small { color: #beb7ac; font-size: 12px; }
.price-block strong { display: block; margin-top: 5px; color: #fffaf1; font: 400 clamp(38px, 4vw, 52px)/1 Georgia, serif; letter-spacing: -.04em; }
.quote-validation { margin: 0; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.14); color: #f0c69a; font-size: 11px; line-height: 1.45; }
.result-specs { padding: 20px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border-bottom: 1px solid rgba(255,255,255,.14); }
.result-specs span, .cost-summary span { display: block; color: #a8a096; font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.result-specs b { display: block; margin-top: 4px; font-size: 11px; line-height: 1.25; }
.cost-summary { padding: 17px 0; display: flex; justify-content: space-between; }
.cost-summary > div:last-child { text-align: right; }
.cost-summary b { display: block; margin-top: 4px; font-size: 13px; }
.breakdown { border-top: 1px solid rgba(255,255,255,.14); }
.breakdown summary { padding: 15px 0; list-style: none; cursor: pointer; display: flex; justify-content: space-between; color: #d5cec2; font-size: 11px; }
.breakdown summary::-webkit-details-marker { display: none; }
#breakdownList { padding-bottom: 10px; }
.cost-line { padding: 6px 0; display: flex; justify-content: space-between; gap: 20px; color: #bcb4a8; font-size: 10px; }
.cost-line.total { margin-top: 6px; padding-top: 11px; border-top: 1px dashed rgba(255,255,255,.2); color: white; font-weight: 700; }
.share-heading { margin-top: 16px; display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.share-heading span { color: var(--gold-soft); font-size: 9px; font-weight: 750; letter-spacing: .12em; }
.share-heading small { color: #999186; font-size: 8px; }
.channel-actions { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.channel { min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 13px; color: #fff; font-size: 12px; font-weight: 750; }
.channel b { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 8px; letter-spacing: .04em; }
.whatsapp { background: #1f9d5a; }
.telegram { background: #267eae; }
.result-actions { display: grid; grid-template-columns: 1.25fr .75fr; gap: 9px; margin-top: 9px; }
.primary, .secondary, .ghost { min-height: 47px; padding: 0 15px; border-radius: 12px; font-weight: 750; }
.primary { border: 0; background: var(--gold); color: #201b14; }
.primary:hover { background: #d7b477; }
.primary:disabled, .secondary:disabled, .channel:disabled, .utility-actions button:disabled {
  cursor: not-allowed;
  opacity: .42;
}
.secondary { border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.04); color: white; }
.ghost { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.ghost.small { min-height: 34px; padding: 0 12px; font-size: 10px; }
.utility-actions { margin-top: 13px; display: flex; justify-content: center; gap: 18px; }
.utility-actions button { padding: 4px 0; border: 0; background: transparent; color: #c8c0b4; font-size: 9px; text-decoration: underline; text-underline-offset: 3px; }

.recent { padding: 20px; }
.recent-head { display: flex; justify-content: space-between; align-items: center; }
.recent h2 { margin: 0; font: 500 18px Georgia, serif; }
.recent-head button { border: 0; background: transparent; color: var(--muted); font-size: 10px; }
.history-list { margin-top: 13px; display: grid; gap: 8px; }
.empty { color: var(--muted); font-size: 11px; text-align: center; padding: 14px 0; }
.history-item { width: 100%; padding: 11px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; border: 1px solid #e3ddd2; border-radius: 12px; background: #fff; text-align: left; }
.history-item b { font-size: 11px; }
.history-item strong { grid-column: 2; grid-row: 1 / 3; align-self: center; color: #8a642f; font: 600 14px Georgia, serif; }
.history-item small { color: var(--muted); font-size: 9px; }

.result-card.client-view .seller-only { display: none !important; }
.client-mode .seller-only { display: none !important; }
.result-card.client-view .price-block { padding: 50px 0; border-bottom: 0; text-align: center; }
.result-card.client-view .result-specs { border-top: 1px solid rgba(255,255,255,.14); }

.prices-dialog { width: min(760px, calc(100% - 24px)); max-height: min(88vh, 900px); padding: 0; border: 0; border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.35); }
.prices-dialog::backdrop { background: rgba(12,12,11,.66); backdrop-filter: blur(4px); }
.dialog-shell { padding: 26px; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.dialog-header h2 { margin: 7px 0 0; font: 500 30px Georgia, serif; }
.dialog-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); font-size: 24px; line-height: 1; }
.dialog-note { margin: 14px 0 22px; padding: 13px 15px; border-radius: 12px; background: #f3eee4; color: var(--muted); font-size: 11px; line-height: 1.55; }
.price-editor { display: grid; gap: 21px; }
.price-group { padding-top: 18px; border-top: 1px solid var(--line); }
.price-group:first-child { padding-top: 0; border-top: 0; }
.price-group h3 { margin: 0 0 12px; font: 600 16px Georgia, serif; }
.price-group-head { margin-bottom: 12px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.price-group-head h3 { margin: 0; }
.catalog-meta { color: var(--muted); font-size: 9px; text-align: right; }
.catalog-search { margin-bottom: 10px; }
.catalog-search input { height: 43px; text-transform: uppercase; }
.catalog-results-meta { margin: 0 0 11px; color: var(--muted); font-size: 9px; }
.catalog-price-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.catalog-empty { margin: 0; padding: 18px; border-radius: 12px; background: #f5f0e7; color: var(--muted); font-size: 11px; text-align: center; }
.price-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.price-field { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 10px; }
.price-field span { font-size: 11px; line-height: 1.35; }
.price-field .input-unit input { height: 42px; padding-left: 28px; text-align: right; }
.price-field .input-unit::before { content: "R$"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #8e877d; font-size: 10px; z-index: 1; }
.price-field .input-unit b { right: 8px; font-size: 9px; }
.price-field .input-unit input { padding-right: 38px; }
.technical-field .input-unit::before { content: ""; }
.technical-field .input-unit input { padding-left: 13px; }
.backup-actions { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.backup-actions .ghost { display: grid; place-items: center; min-height: 44px; font-size: 11px; }
.file-button { cursor: pointer; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dialog-footer { margin-top: 20px; padding-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--line); }
.dialog-footer .primary { min-width: 190px; }
.danger-link { border: 0; background: transparent; color: #8a4439; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.install-dialog { width: min(560px, calc(100% - 24px)); }
.install-steps { padding: 4px 2px 8px; }
.install-steps h3 { margin: 0 0 12px; font: 600 18px Georgia, serif; }
.install-steps ol { margin: 0; padding-left: 23px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.install-steps li + li { margin-top: 8px; }
.install-browser-note { margin: 15px 0 0; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.install-footer { justify-content: flex-end; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 16px); max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: #20201e; color: white; box-shadow: var(--shadow); font-size: 12px; text-align: center; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 930px) {
  .shell { width: min(720px, calc(100% - 30px)); padding-top: 28px; }
  .workspace { grid-template-columns: 1fr; }
  .result-column { position: static; grid-row: 1; }
  .form-column { grid-row: 2; }
}

@media (max-width: 600px) {
  .topbar { height: 68px; padding: 0 12px; }
  .brand img { width: 42px; height: 42px; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 7px; }
  .status { display: none; }
  .topbar .ghost.small { min-height: 34px; padding: 0 9px; font-size: 8px; }
  .shell { width: calc(100% - 20px); padding: 18px 0 64px; }
  .intro { margin-bottom: 18px; border-radius: 20px; }
  .intro { min-height: 250px; }
  .intro::before { right: calc(50% + 112px); }
  .intro::after { left: calc(50% + 112px); }
  .intro-brand img { width: 130px; height: 130px; border-radius: 23px; }
  .intro-brand strong { max-width: 280px; font-size: 21px; letter-spacing: .13em; }
  .panel { padding: 21px 18px; border-radius: 18px; }
  .section-heading h2 { font-size: 22px; }
  .field-grid.two { grid-template-columns: 1fr; }
  .dimensions { grid-template-columns: 1fr 1fr !important; }
  .choices { grid-template-columns: 1fr; }
  .choice > span { min-height: 68px; }
  .check-list { grid-template-columns: 1fr; }
  .coefficient { align-items: end; }
  .result-card { padding: 23px 20px; border-radius: 20px; }
  .price-block strong { font-size: 44px; }
  .result-specs { grid-template-columns: 1fr 1fr; }
  .result-specs > div:last-child { grid-column: 1 / -1; }
  .share-heading { align-items: start; flex-direction: column; gap: 3px; }
  .result-actions { grid-template-columns: 1fr; }
  .price-grid { grid-template-columns: 1fr; }
  .catalog-price-results { grid-template-columns: 1fr; }
  .price-group-head { align-items: start; flex-direction: column; gap: 4px; }
  .catalog-meta { text-align: left; }
  .price-field { grid-template-columns: 1fr 120px; }
  .backup-actions { grid-template-columns: 1fr; }
  .dialog-shell { padding: 22px 17px; }
  .dialog-footer { align-items: stretch; flex-direction: column-reverse; }
  .dialog-footer .primary { width: 100%; }
  .install-footer { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
