:root { font: 16px/1.5 system-ui, sans-serif; color: #292c2b; background: #fbfbf8; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-block; border: 1px solid #94783f; border-radius: 1.4rem;
  padding: .5rem 1rem; background: #fff; color: #4a3920; cursor: pointer; text-decoration: none;
}
button:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 2px solid #674795; outline-offset: 3px; }
.primary { color: white; background: #723456; border-color: #723456; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(12rem, 17%) minmax(0, 1fr); }
.sidebar { background: #fff; border-right: 1px solid #e9e5dd; padding: 1.5rem; }
.brand { font-size: 1.55rem; font-weight: 750; color: #723456; }
.brand small { display: block; }
.sidebar nav { display: grid; gap: .6rem; margin-top: 2rem; }
.sidebar button { text-align: left; border-color: transparent; }
.sidebar button[aria-current] { background: #eae0cd; }
.app-main { padding: 1.25rem clamp(1rem, 4vw, 4rem) 3rem; }
.topbar { text-align: right; color: #5d564b; }
h1 { font-size: clamp(1.65rem, 4vw, 2.6rem); line-height: 1.2; margin: 1.75rem 0; }
h2 { font-size: 1.3rem; }
.catalog { background: #eceeed; padding: 1rem; border-radius: .8rem; margin-bottom: 2rem; }
.catalog h2 { margin-top: 0; }
.products { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.products button { display: flex; align-items: center; gap: .75rem; min-height: 5rem; border-radius: .65rem; border-color: #e2dfd8; text-align: left; }
.pleats { flex: 0 0 2rem; height: 2.4rem; border: 2px solid #806942; background: repeating-linear-gradient(90deg, #d4c5a9 0 2px, white 2px 5px); }
.muted, small { color: #5c605c; }
.table-wrap { overflow-x: auto; margin: .75rem 0 1.25rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .65rem; border-bottom: 1px solid #e2dfd8; }
thead { background: #eceeed; }
tfoot { background: #eae0cd; font-weight: 650; }
td small { display: block; }
td.dealer { background: #e0eddf; }
.row-actions button { margin: .15rem; font-size: .8rem; padding: .25rem .5rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
dialog { width: min(46rem, calc(100% - 2rem)); max-height: 90dvh; border: 0; border-radius: .8rem; padding: 1.25rem; color: inherit; }
dialog::backdrop { background: #242832aa; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-label { background: #eceeed; padding: .6rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; }
label { display: grid; gap: .25rem; margin-bottom: .75rem; }
input, select, textarea { min-width: 0; width: 100%; padding: .45rem; border: 1px solid #b6b8b3; border-radius: .35rem; background: #fafafa; }
[role=alert] { color: #962042; }
.proposal { max-width: 60rem; margin: auto; padding: 2rem; }
.proposal-logo { display: block; max-width: min(14rem, 100%); max-height: 6rem; object-fit: contain; }
.dealer-settings { max-width: 22rem; }
.profile-form { max-width: 48rem; }
.profile-form fieldset { border: 1px solid #e2dfd8; border-radius: .8rem; padding: 1rem; margin-bottom: 1.25rem; }
.profile-form legend { font-weight: 650; padding: 0 .4rem; }
.profile-form .proposal-logo { margin-bottom: 1rem; }
.profile-form small { display: block; margin-bottom: .75rem; }
.proposal-contact p { margin: .25rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.price-dialog { width: min(28rem, calc(100% - 2rem)); }
.share-dialog { width: min(36rem, calc(100% - 2rem)); }
.share-dialog small { display: block; margin-top: .75rem; }
.checkbox { display: flex; align-items: center; align-self: end; gap: .45rem; }
.checkbox input { width: auto; }
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid #e9e5dd; padding: .75rem 1rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; margin-top: .5rem; }
  .topbar { text-align: left; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  .fields { grid-template-columns: 1fr; }
  .products button { gap: .45rem; padding: .55rem; }
}
@media print {
  :root { background: white; }
  .proposal { max-width: none; padding: 0; }
  .print-button { display: none; }
  tr { break-inside: avoid; }
  .proposal th, .proposal td { padding: 5px; font-size: 10pt; overflow-wrap: anywhere; }
  .proposal table { table-layout: fixed; }
  .proposal th:first-child { width: 52%; }
}
.auth-bar { display: flex; gap: 16px; align-items: center; justify-content: flex-end; padding: 12px 24px; }
.auth-error { padding: 12px 24px; color: #a32121; }
.auth-mode-switch { display: block; margin-top: 16px; max-width: 100%; white-space: normal; }
.opening-editor { margin: 1rem 0; padding: 1rem; border: 1px solid #c5ced1; border-radius: 12px; background: #f7faf9; }
.opening-editor h3 { margin-top: 0; }
.opening-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0; }
.opening-controls button[aria-pressed="true"] { background: #263f47; color: white; border-color: #263f47; }
.opening-controls button:disabled { opacity: .45; cursor: not-allowed; }
.opening-drawing { margin: .7rem 0; max-width: 560px; min-width: 0; color: #17232c; }
.opening-drawing figcaption { font-size: .85rem; line-height: 1.4; margin-bottom: .4rem; }
.opening-drawing svg { display: block; width: 100%; }
.opening-drawing small { font-size: .75rem; }
.opening-motion { max-width: 280px; margin: auto; }
@media print {
  .opening-drawing { break-inside: avoid; color: black; }
  .opening-drawing figcaption, .opening-drawing small { font-size: 8pt; }
  .opening-drawing svg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Partner cabinet: owner reference screenshots, scoped screen presentation. */
@media screen {
  :root { font-family: Arial, sans-serif; color: #555; background: #fff; }
  .app-shell { grid-template-columns: 260px minmax(0, 1fr); }
  .sidebar { border: 0; padding: 22px 0; }
  .brand { padding: 0 32px 28px; color: #77365e; font-size: 30px; letter-spacing: -.8px; }
  .brand small { color: #96917e; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
  .sidebar nav { gap: 8px; }
  .sidebar nav button { padding: 14px 32px; border-radius: 0 30px 30px 0; margin-right: 35px; color: #555; }
  .sidebar button[aria-current] { background: #bfa77b; color: #fff; font-weight: 600; }
  .app-main { padding: 12px 40px 60px; }
  .topbar { font-size: 13px; color: #888; padding-bottom: 15px; }
  h1 { font-weight: 500; letter-spacing: -.8px; margin: 28px 0 38px; }
  h2 { font-weight: 500; }
  button, .button { border-color: #bfa77b; color: #857756; padding: 9px 22px; }
  button:hover:not(:disabled), .button:hover { background: #f4f1eb; }
  button.primary { background: #79385f; border-color: #79385f; color: white; }
  button.primary:hover:not(:disabled) { background: #64304f; }
  .catalog { background: #eff0f2; border: 1px solid #edeef0; padding: 22px; margin: 28px 0 48px; border-radius: 12px; }
  .catalog h2 { font-size: 19px; }
  .products { gap: 18px; }
  .products button { position: relative; overflow: hidden; min-height: 145px; padding: 22px 16px; background: #f7f7f8; border: 1px solid white; color: #666; }
  .products button > span:last-child { position: relative; max-width: 53%; z-index: 1; }
  .product-sketch { position: absolute; right: 12px; bottom: -18px; width: 76px; height: 137px; border: 6px solid #c4c6c5; border-top: 9px solid #9fa3a2; transform: skewY(9deg); box-shadow: 6px 3px 0 #e0e1e0; background: repeating-linear-gradient(90deg,#ddd 0 3px,#999 4px,#eee 6px); }
  .product-sketch-FRAME, .product-sketch-DOOR { background: repeating-linear-gradient(0deg,#e2e4e3 0 2px,#bdc2bf 3px); }
  .product-sketch-FRAME:after { content: ''; position: absolute; top: 48%; width: 100%; height: 5px; background: #afb3b0; }
  .product-sketch-DOOR { transform: perspective(170px) rotateY(-24deg); }
  .product-sketch-ROLL { background: linear-gradient(#aaa 0 45%,#f7f7f8 45%); }
  thead { background: #f0f1f3; border-bottom: 2px solid #b09b73; }
  th { font-weight: 500; }
  th, td { border-bottom-color: #e1e3e7; padding: 14px 12px; }
  td.dealer { background: #d6f8d0; }
  tfoot { background: #e3dac6; font-weight: 500; }
  .row-actions { min-width: 130px; }
  dialog { border-radius: 5px; padding: 32px 40px; }
  dialog::backdrop { background: #34383fcc; }
  .dialog-heading h2 { font-size: 27px; margin: 12px 0 28px; }
  .section-label { background: #daddE2; padding: 16px 20px; }
  input, select, textarea { background: #f0f1f3; border: 1px solid #e9eaed; padding: 9px 12px; }
  .fields { gap: 10px 22px; }
  .auth-bar { min-height: 56px; border-bottom: 1px solid #f4f4f4; }
  @media (max-width: 1000px) { .app-shell { grid-template-columns: 210px minmax(0,1fr); } .app-main { padding: 12px 22px 40px; } .products { grid-template-columns: repeat(2,minmax(0,1fr)); } }
  @media (max-width: 760px) { .app-shell { display: block; } .sidebar { padding: 16px; border-bottom: 1px solid #eee; } .brand { padding: 0; } .sidebar nav { margin-top: 16px; gap: 4px; } .sidebar nav button { margin: 0; border-radius: 24px; padding: 8px 12px; } .app-main { padding: 16px; } h1 { font-size: 28px; margin: 20px 0; } .catalog { padding: 14px; } .products { gap: 10px; } .products button { min-height: 120px; padding: 10px; } dialog { padding: 20px; } }
}

@media screen and (max-width: 760px) {
  button, .button, input, select { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  button, .button { touch-action: manipulation; }
  .app-main, .sidebar, .fields > *, .actions > * { min-width: 0; }
  .auth-bar { flex-wrap: wrap; padding: 10px 16px; overflow-wrap: anywhere; }
  .sidebar nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .sidebar nav button { text-align: center; }
  .fields { grid-template-columns: 1fr; }
  .actions { gap: 10px; }
  .actions > button, .actions > .button, .actions > label { flex: 1 1 100%; text-align: center; }
  .actions > label { text-align: left; }
  .proposal { padding: 20px 16px; }
  .line-items { overflow: visible; }
  .line-items table, .line-items tbody, .line-items tfoot { display: block; width: 100%; }
  .line-items thead { display: none; }
  .line-items tr { display: block; border: 1px solid #e2e3e7; border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
  .line-items td, .line-items th { display: block; width: 100%; padding: 10px 12px; overflow-wrap: anywhere; }
  .line-items td[data-label]::before { content: attr(data-label); display: block; color: #696969; font-size: 13px; margin-bottom: 3px; }
  .line-items .row-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .line-items .row-actions button { margin: 0; font-size: 14px; }
  .line-items td:empty { display: none; }
  .line-items tfoot { background: transparent; }
  .line-items tfoot tr { background: #e3dac6; }
  dialog { width: calc(100% - 16px); max-height: calc(100dvh - 24px); padding: 20px 16px; }
  .dialog-heading { align-items: flex-start; }
  .dialog-heading h2 { font-size: 23px; overflow-wrap: anywhere; }
  .dialog-heading > button { flex: 0 0 44px; padding: 8px; }
  .opening-editor { padding: 10px; }
  .opening-controls > button { flex: 1 1 42%; padding: 8px; }
  .profile-form fieldset { min-width: 0; padding: 12px; }
  .topbar { overflow-wrap: anywhere; }
  .share-dialog .actions { display: grid; grid-template-columns: 1fr; }
}

.products button:has(.product-animation) { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
.products .product-animation { display: block; width: 100%; height: 140px; object-fit: contain; background: #fff; border-radius: 8px; }
.products button:has(.product-animation) > span:last-child { max-width: 100%; text-align: center; }
@media (max-width: 760px) { .products .product-animation { height: 116px; } }

/* Keep authentication actions separated at every viewport width. */
.auth-entry .profile-form { display: grid; gap: 12px; max-width: 32rem; }
.auth-entry .profile-form > button { justify-self: start; max-width: 100%; white-space: normal; }
.auth-entry .auth-mode-switch { margin: 20px 0 0; max-width: min(100%, 32rem); white-space: normal; overflow-wrap: anywhere; }
