:root {
  color-scheme: light;
  --ink: #201e1b;
  --muted: #625e58;
  --line: #e8e3da;
  --surface: #fff;
  --canvas: #f7f5f0;
  --orange: #a83812;
  --bright: #ff743b;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #b64c21; outline-offset: 3px; }
.masthead { background: #211f1d; color: #fff; border-bottom: 3px solid var(--bright); }
.masthead-inner, main { width: min(1140px, calc(100% - 64px)); margin: auto; }
.masthead-inner { display: flex; align-items: center; gap: 12px; min-height: 75px; }
.brand-mark { display: grid; grid-auto-flow: column; place-content: center; height: 39px; width: 43px; border-radius: 8px; background: var(--bright); color: #211f1d; font-weight: 900; font-size: 23px; letter-spacing: -.09em; padding-right: 2px; }
.brand-mark span { color: #3b2015; }
.brand { font-weight: 850; letter-spacing: .065em; font-size: 14px; line-height: 1.25; }
.brand span { display: block; color: #dbd3cb; font: 700 9px/1.4 ui-monospace, monospace; letter-spacing: .18em; margin-top: 3px; }
.workspace-label { margin-left: auto; color: #e9e1d9; display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.workspace-label i { background: var(--bright); width: 7px; height: 7px; border-radius: 50%; }
.logout { border: 1px solid #7e7268; border-radius: 8px; background: transparent; color: #fff; padding: 6px 10px; font-size: .83rem; }
.logout:hover { background: #443a31; }
.login-main { max-width: 460px; }
.login-card { padding: 25px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.login-card h1 { font-size: clamp(2rem, 7vw, 2.8rem); margin: 4px 0 9px; }
.login-card p:not(.eyebrow, .form-error) { color: var(--muted); }
.login-card form { display: grid; gap: 12px; margin-top: 20px; }
.login-card label { font-weight: 700; }
.login-card input { display: block; margin-top: 4px; font-weight: 400; }
.login-card .form-error { margin: 0; }
main { padding: 50px 0 32px; }
.view-nav { display: flex; gap: 8px; margin-bottom: 22px; }
.view-nav a { padding: 7px 11px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 750; }
.view-nav a[aria-current="page"] { color: var(--orange); background: #fff0e5; }
.user-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.user-row .user-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.reference-link { color: var(--orange); font-weight: 700; width: fit-content; }
.photos { min-width: 0; margin: 0; padding: 8px 12px 12px; border: 1px solid var(--line); border-radius: 9px; }
.photos legend { padding: 0 5px; font-weight: 750; }
.photo-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 8px; }
.photo-actions button:disabled { opacity: .55; cursor: default; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-grid figure { margin: 0; min-width: 0; }
.photo-preview { width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #faf8f5; }
.photo-preview img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
#photo-full { display: block; max-width: 100%; max-height: 76dvh; margin: 0 auto; object-fit: contain; }
.quote-empty { color: var(--muted); padding: 22px; }
.quote-row { grid-template-columns: minmax(155px, 2fr) repeat(3, minmax(0, 1fr)); }
.quote-share { margin-top: 5px; }
.share-body { display: grid; gap: 9px; }
.share-body label { display: block; font-weight: 700; }
.share-body input { margin-top: 4px; font-weight: 400; }
.quote-action { display: inline-flex; align-items: center; text-decoration: none; }
.quote-document { background: #f5f0e9; }
.public-quote { width: min(780px, calc(100% - 32px)); max-width: none; padding: 25px 0 36px; }
.quote-toolbar { display: flex; gap: 10px 16px; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.quote-toolbar > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 15px; }
.quote-toolbar span { color: var(--muted); font-size: .84rem; }
.quote-toolbar a { color: var(--orange); font-weight: 700; text-decoration: none; }
.quote-toolbar button:disabled { opacity: .55; }
.quote-paper { --paper-pad: clamp(19px, 5vw, 44px); background: #fffdfa; border: 1px solid #e8dfd4; border-radius: 18px; overflow: hidden; box-shadow: 0 12px 35px #30201012; }
.quote-cover { padding: var(--paper-pad); color: #fff8ee; background: #27221d; border-top: 5px solid #f47a43; }
.quote-brand { display: flex; gap: 10px; align-items: center; letter-spacing: .12em; font-size: .86rem; font-weight: 850; }
.quote-brand-mark { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 8px; background: #f47a43; color: #241b13; font-size: 17px; letter-spacing: -.05em; }
.quote-brand small { display: block; color: #e6d5c6; font-size: .68rem; letter-spacing: .16em; }
.quote-cover-copy { margin-top: clamp(22px, 6vw, 42px); }
.quote-cover .eyebrow { color: #ffae83; }
.quote-cover h1, .quote-unavailable h1 { margin: 6px 0 12px; font-size: clamp(1.7rem, 7vw, 3rem); line-height: 1.06; letter-spacing: -.045em; overflow-wrap: anywhere; }
.quote-folio { color: #e6d5c6; font-size: .88rem; }
.quote-folio strong { color: #fff8ee; font-variant-numeric: tabular-nums; margin-left: 4px; }
.quote-unavailable, .quote-content { padding: var(--paper-pad); }
.quote-price { display: grid; gap: 3px; padding: 15px 19px; border: 1px solid #edc5ae; border-left: 4px solid #b7441c; border-radius: 10px; background: #fff0e5; }
.quote-price span { color: #603c29; font-weight: 700; }
.quote-price strong { color: #63280f; font-size: clamp(1.65rem, 7vw, 2.5rem); line-height: 1.08; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.quote-price small { color: #685247; }
.quote-section { margin-top: 23px; }
.quote-section h2 { margin-bottom: 8px; font-size: 1.13rem; letter-spacing: -.02em; }
.public-quote-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 9px; margin: 0; }
.public-quote-details > div { padding: 10px 12px; border: 1px solid #eadfd4; border-radius: 8px; }
.public-quote-details dt { color: var(--muted); font-size: .82rem; }
.public-quote-details dd { margin: 3px 0 0; font-weight: 750; overflow-wrap: anywhere; }
.quote-description p { white-space: pre-wrap; overflow-wrap: anywhere; }
.public-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; }
.public-gallery figure { min-width: 0; margin: 0; }
.public-gallery a { display: block; border: 1px solid #eadfd4; border-radius: 8px; overflow: hidden; }
.public-gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--canvas); }
.public-gallery figcaption { color: var(--muted); font-size: .77rem; padding-top: 3px; }
.quote-footer { margin-top: 24px; border-top: 1px solid #eadfd4; font-size: .75rem; letter-spacing: .07em; }
.row-actions { display: flex; flex-direction: column; gap: 5px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.eyebrow { color: var(--orange); font: 800 .75rem/1.5 ui-monospace, monospace; letter-spacing: .13em; }
h1 { font-size: clamp(2.7rem, 6vw, 4rem); line-height: 1.07; letter-spacing: -.07em; margin: 5px 0 8px; }
.intro p, .panel-top p, .empty p { color: var(--muted); }
.primary, .secondary, .text-button, .close { font-weight: 700; border-radius: 8px; border: 1px solid transparent; }
.primary, .secondary { padding: 9px 15px; min-height: 43px; }
.primary { background: #a83812; color: white; }
.primary:hover { background: #842809; }
.primary span { font-size: 1.3em; margin-right: 3px; line-height: 1; }
.secondary { background: var(--surface); border-color: #d9d1c6; color: var(--ink); }
.secondary:hover { background: #f4eee6; }
.text-button { color: var(--muted); background: transparent; padding: 5px 7px; }
.text-button:hover { color: var(--orange); background: #f1e8df; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 25px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 15px 17px; min-width: 0; }
.stat span { font-weight: 750; font-size: .9rem; }
.stat strong { display: block; font-size: clamp(1.45rem, 2.6vw, 2rem); letter-spacing: -.045em; line-height: 1.25; margin: 3px 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.stat small { display: block; color: var(--muted); }
.money-stat { background: #fff0e5; border-color: #f1d5c3; }
.money-stat strong { color: #8c2b0d; }
.order-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 19px 22px; border-bottom: 1px solid var(--line); }
h2 { font-size: 1.25rem; letter-spacing: -.025em; }
.panel-top p { font-size: .86rem; }
.search-tools { display: flex; gap: 9px; }
input, select, textarea { min-width: 0; width: 100%; border: 1px solid #d8d0c5; background: white; color: var(--ink); border-radius: 8px; padding: 9px 10px; }
.search-tools input { width: clamp(175px, 24vw, 260px); }
.search-tools select { width: auto; }
.report-tools { padding: 13px 22px; border-bottom: 1px solid var(--line); background: #fcfaf7; }
.period-tools, .export-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.period-tools label { flex: 1 1 150px; max-width: 240px; font-size: .83rem; font-weight: 700; }
.period-tools input, .period-tools select { display: block; margin-top: 3px; font-weight: 400; }
.period-summary { color: var(--muted); margin-top: 7px; font-size: .83rem; }
.advanced { margin-top: 9px; }
.advanced summary { cursor: pointer; width: fit-content; color: var(--orange); font-size: .85rem; font-weight: 750; }
.advanced .period-tools { margin-top: 8px; }
.export-actions { margin-top: 9px; justify-content: end; align-items: center; }
.export-actions button:disabled { opacity: .55; cursor: default; }
#print-report { display: none; }
.empty { min-height: 290px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 30px 15px; text-align: center; background: radial-gradient(ellipse at top, #fff9f2, white 70%); }
.empty svg { width: 48px; height: 48px; color: var(--orange); margin-bottom: 5px; }
.empty .secondary { margin-top: 8px; }
.order-row { display: grid; grid-template-columns: minmax(160px, 2fr) minmax(140px, 1.35fr) minmax(110px, 1fr) minmax(95px, .8fr) auto; align-items: center; gap: 15px; padding: 15px 22px; border-top: 1px solid var(--line); }
.order-row:first-child { border-top: 0; }
.order-row strong, .order-row small { display: block; overflow-wrap: anywhere; }
.order-row small { color: var(--muted); }
.order-row .code { font: 750 .72rem/1.5 ui-monospace, monospace; color: var(--orange); }
.order-row .late { color: #a02724; font-weight: 700; }
.order-row .status { font-size: .83rem; font-weight: 700; padding: 7px; }
.status[data-status="printing"] { background: #fff0df; border-color: #efc9a6; color: #762e0b; }
.status[data-status="to_collect"] { background: #fff2d7; color: #704400; }
.status[data-status="ready"] { background: #eaf4e9; border-color: #bdd8bd; color: #22522c; }
.status[data-status="delivered"], .status[data-status="cancelled"] { background: #f2f0ec; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 15px; color: var(--muted); font-size: .81rem; }
footer div { display: flex; flex-wrap: wrap; gap: 4px; }
dialog { width: min(630px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: 16px; padding: 0; color: var(--ink); box-shadow: 0 24px 100px #28201848; }
dialog::backdrop { background: #211d19a0; }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 28px); }
.dialog-head, .dialog-actions { padding: 15px 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head { border-bottom: 1px solid var(--line); }
.close { background: transparent; font-size: 1.5rem; line-height: 1; padding: 8px 10px; color: var(--muted); }
.close:hover { background: var(--canvas); }
.form-body { padding: 18px 22px; overflow-y: auto; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 15px; }
.fields label { display: block; font-size: .88rem; font-weight: 700; }
.fields label > span { color: var(--orange); }
.fields small { color: var(--muted); font-weight: 400; }
.fields input, .fields select, .fields textarea { display: block; margin-top: 4px; font-weight: 400; }
.fields textarea { resize: vertical; }
.installment-plan { min-width: 0; margin: 0; padding: 8px 12px 12px; border: 1px solid var(--line); border-radius: 9px; }
.installment-plan legend { padding: 0 5px; font-weight: 750; }
.fields .installment-toggle { display: flex; align-items: center; gap: 8px; }
.fields .installment-toggle input { width: 17px; height: 17px; margin: 0; }
.installment-count { max-width: 150px; margin-top: 10px; }
.installment-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 9px; }
.installment-row > strong { font-size: .83rem; }
@media (max-width: 390px) {
  .installment-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .installment-row > strong { grid-column: 1 / -1; }
}
.wide { grid-column: 1 / -1; }
.dialog-actions { border-top: 1px solid var(--line); }
.save-actions { display: flex; gap: 7px; margin-left: auto; }
#share-dialog .save-actions { flex-wrap: wrap; justify-content: end; }
.danger, .form-error { color: #a02724; }
.form-error { margin-top: 10px; }
.toast:not(:empty) { position: fixed; z-index: 1; bottom: 15px; right: 15px; max-width: min(440px, calc(100% - 30px)); border-radius: 9px; padding: 11px 15px; color: white; background: #292521; box-shadow: 0 4px 20px #28201838; }
@media (max-width: 850px) {
  .masthead-inner, main { width: calc(100% - 36px); }
  .order-row { grid-template-columns: minmax(140px, 1.4fr) minmax(110px, 1fr) minmax(95px, .9fr) auto; gap: 10px; }
  .order-row .amount { grid-column: 3; grid-row: 2; }
  .order-row .row-actions { grid-column: 4; grid-row: 1 / span 2; }
}
@media (max-width: 650px) {
  .masthead-inner:has(.logout:not([hidden])) .workspace-label { display: none; }
  .logout { margin-left: auto; }
  main { padding-top: 30px; }
  .intro { align-items: start; flex-direction: column; gap: 13px; margin-bottom: 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .stat { padding: 10px 11px; }
  .panel-top { flex-direction: column; align-items: stretch; padding: 14px; }
  .report-tools { padding: 12px 14px; }
  .period-tools label { max-width: none; }
  .export-actions { justify-content: start; }
  .search-tools input, .search-tools select { width: 50%; }
  .order-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 13px 14px; }
  .order-row .amount { grid-area: auto; }
  .order-row .row-actions { grid-area: auto; grid-column: 2; justify-self: end; flex-direction: row; flex-wrap: wrap; justify-content: end; }
  footer { flex-direction: column; align-items: start; }
  .quote-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@page { size: A4 landscape; margin: 12mm; }
@page quote-sheet { size: A4 portrait; margin: 13mm; }
@media print {
  body:has(#print-report:not(:empty)) > :not(#print-report) { display: none !important; }
  #print-report:not(:empty) { display: block; font-size: 9pt; color: #111; }
  #print-report h1 { font-size: 19pt; letter-spacing: 0; }
  #print-report p { margin: 0 0 12px; }
  #print-report table { width: 100%; border-collapse: collapse; }
  #print-report thead { display: table-header-group; }
  #print-report tr { break-inside: avoid; }
  #print-report th, #print-report td { padding: 5px 7px; border: 1px solid #aaa; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
  #print-report td div { white-space: pre-wrap; }
  #print-report td:nth-child(3) { width: 32%; }
  .quote-document { page: quote-sheet; background: white; }
  .quote-toolbar { display: none !important; }
  .public-quote { width: 100%; padding: 0; }
  .quote-paper { --paper-pad: 7mm; border: 0; border-radius: 0; box-shadow: none; overflow: visible; background: white; }
  .quote-cover, .quote-price, .quote-brand-mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .quote-cover { border-radius: 3mm; break-inside: avoid; }
  .quote-cover-copy { margin-top: 5mm; }
  .quote-cover h1 { font-size: 28pt; }
  .quote-content { padding: 6mm 0 0; }
  .quote-price, .public-quote-details > div, .public-gallery figure, .quote-footer { break-inside: avoid; }
  .quote-section h2 { break-after: avoid; }
  .quote-section { margin-top: 5mm; }
  .quote-footer { margin-top: 3mm; padding-top: 2mm; }
  .public-gallery { display: block; font-size: 0; }
  .public-gallery figure { display: inline-block; width: 32%; margin: 0 1.33% 3mm 0; vertical-align: top; }
  .public-gallery img { max-height: 38mm; }
  .public-gallery figcaption { font-size: 8pt; }
}
@media (max-width: 360px) {
  .workspace-label { display: none; }
  .fields { grid-template-columns: 1fr; }
  .search-tools { flex-direction: column; }
  .search-tools input, .search-tools select { width: 100%; }
}
