:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #182747;
  background: #f2f5fb;
  font-synthesis: none;
  --blue: #0758b9;
  --blue-dark: #00499e;
  --line: #e4eaf3;
  --muted: #52627b;
}

* { box-sizing: border-box; }
body { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #438cef; outline-offset: 3px; }
[hidden] { display: none !important; }

.sidebar { display: flex; flex-direction: column; gap: 42px; min-height: 100vh; background: #fff; border-right: 1px solid var(--line); padding: 26px 15px 20px; position: sticky; top: 0; height: 100vh; }
.brand, .sidebar-footer { display: flex; align-items: center; gap: 11px; color: #132546; text-decoration: none; font-weight: 750; }
.brand { padding: 0 4px; font-size: 19px; }
.brand img { border-radius: 10px; }
.brand small, .sidebar small { display: block; margin-top: 3px; font-weight: 500; font-size: 12px; color: var(--muted); }
.sidebar nav { display: grid; gap: 7px; }
.nav-link { border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 650; }
.nav-link:hover, .nav-link[aria-current="page"] { background: #e7efff; color: #064bac; }
.sidebar-footer { margin-top: auto; padding: 13px 3px 0; border-top: 1px solid var(--line); font-size: 13px; }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; background: #e5eeff; color: #054caa; border-radius: 50%; flex: none; }

.workspace { min-width: 0; }
.topbar { background: rgba(255,255,255,.98); min-height: 70px; border-bottom: 1px solid var(--line); padding: 12px clamp(18px, 3vw, 42px); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.topbar span { font-size: 14px; color: var(--muted); }
main { max-width: 1550px; margin: auto; padding: 28px clamp(16px, 3vw, 42px) 92px; }
.intro { margin-bottom: 22px; }
.estimate-reuse-actions { margin-bottom: 12px; }
.crm-details .order-reject-details { padding: 9px 10px; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 8px; }
.order-reject-details strong { overflow-wrap: anywhere; }
.order-reject-details .button { display: block; margin-top: 5px; min-height: 28px; padding: 2px 7px; }
.reminder-actions .button { min-height: 30px; padding: 2px 7px; }
.calendar-event-actions { text-align: right; }
.calendar-event-actions .reminder-actions { margin-top: 5px; justify-content: end; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.preset-template-card { display: flex; flex-direction: column; gap: 12px; padding: 15px; }
.preset-template-card > div:nth-child(2) { margin-top: auto; }
.preset-template-card h2 { margin: 3px 0 4px; }
.preset-template-card p, .preset-template-card small { margin: 0; color: var(--muted); font-size: 13px; }
.preset-template-card strong { color: var(--blue); }
.template-preview-table { min-width: 545px; }
.template-preview-table td { padding: 8px; }
.template-preview-table td small { display: block; color: var(--muted); }
.template-preview-table .template-preview-section th { color: var(--blue); }
.template-preview-total { text-align: right; margin-top: 12px; }
.template-preview-dialog .crm-form-actions { position: sticky; bottom: 0; margin: 0; padding-block: 10px; background: #fff; border-top: 1px solid var(--line); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(27px, 3vw, 38px); font-weight: 760; letter-spacing: -.035em; line-height: 1.12; }
h2 { font-size: 19px; font-weight: 730; letter-spacing: -.012em; }
.intro p, .panel-heading p { margin-top: 6px; color: var(--muted); font-size: 14px; }
.back { display: inline-block; color: var(--blue); text-decoration: none; font-size: 14px; margin-bottom: 9px; }
.back:hover { text-decoration: underline; }

.button { display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid transparent; padding: 10px 14px; min-height: 41px; text-decoration: none; font-weight: 650; white-space: nowrap; font-size: 14px; }
.primary { color: #fff; background: var(--blue); }
.primary:hover { background: var(--blue-dark); }
.secondary, .quiet { color: var(--blue); background: #edf4ff; border-color: #dce9fe; }
.secondary:hover, .quiet:hover { background: #dceaff; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 3px 8px #18325408; min-width: 0; }
.panel-heading { display: flex; align-items: center; gap: 13px; padding: 18px 20px; }
.section-symbol { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 10px; color: var(--blue); background: #e5efff; font-size: 21px; }
.stages { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 0 20px 18px; }
.stage { min-width: 0; padding: 11px; background: #f7f9fc; border: 1px solid #e9eef5; border-radius: 10px; color: #334563; text-align: left; text-decoration: none; }
.stage strong { display: block; font-size: 22px; font-weight: 750; color: #16305c; }
.stage span { display: block; font-size: 13px; padding-top: 3px; }
.stage:hover, .stage[aria-pressed="true"] { border-color: #75a5eb; background: #e7f0ff; }
.estimates { margin-top: 18px; }
.list-heading { justify-content: space-between; }
.list-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.import-content { display: grid; gap: 10px; padding: 0 20px 18px; }
.import-content p { font-size: 14px; color: var(--muted); }
.import-content p:empty { display: none; }
.import-file { display: grid; gap: 6px; justify-items: start; font-size: 14px; }
.import-file input { max-width: 100%; }
.import-actions { display: flex; flex-wrap: wrap; align-items: center; padding-top: 16px; border-top: 1px solid var(--line); }
.crm-panel + .crm-panel, .crm-order-grid + .crm-panel { margin-top: 18px; }
.crm-content { padding: 0 20px 18px; color: var(--muted); font-size: 14px; }
.crm-details, .crm-items { margin: 0; padding: 0 20px 12px; }
.crm-details div, .crm-items li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.crm-details dd { margin: 0; text-align: right; }
.crm-details dt, .crm-items small, .crm-details small { color: var(--muted); font-size: 14px; }
.crm-items small, .crm-details small { display: block; margin-top: 4px; }
.crm-order-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 18px; }
.crm-order-grid > .crm-panel { margin: 0; }
.crm-estimate-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.crm-card-actions, .crm-form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.crm-form { max-width: 760px; }
.crm-form .crm-form-fields { padding-top: 20px; }
.crm-form .crm-wide { grid-column: 1 / -1; }
.crm-form textarea { width: 100%; resize: vertical; font: inherit; color: inherit; background: #fbfcff; border: 1px solid #dce4f0; border-radius: 7px; padding: 8px; }
.crm-form-actions { padding: 0 20px; }
.form-error { color: #ad253b; font-size: 14px; }
.form-error:empty { display: none; }
.crm-content > .button { margin-top: 12px; }
.catalog-filters { flex-wrap: wrap; }
.catalog-filters > label:not(.search) { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.catalog-more { margin: 14px 20px; }
.catalog-star { min-width: 39px; }
.catalog-dialog { width: min(900px, 95vw); max-height: 80vh; border: 1px solid var(--line); border-radius: 14px; padding: 0; color: inherit; }
.catalog-dialog::backdrop { background: #17294580; }
.pdf-action { margin-bottom: 8px; }
.branding-content { padding: 0 20px 18px; }
.branding-description, .branding-card p { color: var(--muted); font-size: 14px; }
.branding-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; margin-top: 14px; }
.branding-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.branding-card h3 { margin: 0 0 4px; font-size: 16px; }
.branding-image { display: grid; place-items: center; height: 102px; margin: 12px 0; color: var(--muted); background: #f2f5fb; border-radius: 7px; font-size: 14px; }
.branding-thumbnail { width: 100%; height: 90px; object-fit: contain; }
.branding-file { display: grid; gap: 5px; font-size: 14px; }
.branding-file input { width: 100%; }
.branding-remove { margin-top: 8px; }
.branding-status { margin-top: 8px; color: var(--muted); font-size: 14px; }
.branding-status:empty { display: none; }
.palette-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 12px; border: 0; }
.palette-choice { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.palette-choice input { accent-color: var(--pdf-accent); margin: 0; }
.palette-swatch { border-radius: 50%; width: 13px; height: 13px; background: var(--pdf-accent); }
.palette-preview { display: flex; justify-content: space-between; gap: 8px; max-width: 365px; padding: 9px 12px; color: var(--pdf-accent); background: var(--pdf-header); border-bottom: 2px solid var(--pdf-accent); }
.estimate-signatures { margin-top: 0; }
.signature-example { display: grid; align-items: center; height: 72px; margin: 8px 0; padding: 8px; border-radius: 7px; background: #f2f5fb; color: var(--muted); font-size: 14px; }
.signature-thumbnail { width: 100%; height: 56px; object-fit: contain; object-position: left center; }
.signature-actions { flex-wrap: wrap; }
.signature-dialog { width: min(640px, 95vw); border: 1px solid var(--line); border-radius: 14px; padding: 0; color: inherit; }
.signature-dialog::backdrop { background: #17294580; }
.signature-dialog canvas { display: block; width: 100%; height: auto; margin: 12px 0; border: 1px solid #8ea3be; border-radius: 8px; touch-action: none; cursor: crosshair; }
.profile-actions { margin-top: 10px; }
.document-tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; width: fit-content; background: #e8eef9; border-radius: 9px; }
.document-tabs a { border-radius: 6px; padding: 8px 18px; color: #345071; text-decoration: none; font-weight: 650; }
.document-tabs a[aria-current="page"] { color: #064bac; background: #fff; }
.contract-clauses { padding: 12px 14px; border: 1px solid #dce5f0; border-radius: 8px; }
.contract-clauses summary { color: #345071; font-weight: 650; cursor: pointer; }
.contract-clauses p { margin: 10px 0; color: #495b76; }
.contract-clauses label { margin: 12px 0; }
.contract-clauses textarea { resize: vertical; }
.contract-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.finance-receipt { display: block; max-width: min(300px, 100%); max-height: 350px; object-fit: contain; }
.finance-entry-actions { display: grid; justify-items: end; gap: 5px; }
.report-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 14px; margin: 0; padding: 0 20px 18px; }
.report-metrics dt { color: var(--muted); }
.report-metrics dd { margin: 4px 0 0; font-size: 20px; font-weight: 750; }
.report-text-content { width: 100%; padding: 10px; resize: vertical; font: inherit; color: inherit; }
#report-period button:disabled { opacity: .55; cursor: default; }
.object-profit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(285px, 100%), 1fr)); gap: 10px; padding: 0 20px 18px; }
.object-profit-block { padding: 13px 14px; background: #f4f7fc; border: 1px solid var(--line); border-radius: 9px; }
.object-profit-headline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.object-profit-headline h3 { margin: 0; font-size: 15px; }
.object-profit-headline strong { color: var(--blue); font-size: 21px; }
.object-profit-headline .profit-negative { color: #ad253b; }
.object-profit-metrics { margin: 9px 0 0; font-size: 13px; }
.object-profit-metrics div { display: flex; gap: 8px; justify-content: space-between; padding: 4px 0; }
.object-profit-metrics dt, .object-profit-block p, .object-profit-empty { color: var(--muted); }
.object-profit-metrics dd { margin: 0; text-align: right; }
.object-profit-block p { margin: 7px 0 0; font-size: 12px; }
.object-profit-empty { grid-column: 1 / -1; margin: 0; font-size: 13px; }
.report-table td, .report-table th { text-align: left; }
.report-table .report-subrow { padding-left: 26px; font-weight: 400; }
.report-table textarea { display: block; width: min(260px, 100%); margin-top: 5px; }
.report-bar { display: block; height: 4px; margin-top: 4px; border-radius: 4px; background: #327cd1; }
.room-list { display: grid; gap: 10px; padding: 0 20px 18px; }
.room-card { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.room-card .list-heading, .room-form .list-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.room-card h3, .room-form h3 { margin: 0; font-size: 15px; }
.room-card p, .room-link-state { color: var(--muted); }
.room-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 7px; padding: 10px; margin: 10px 0; background: #eff5fd; border-radius: 8px; }
.room-metrics dt { font-size: 12px; color: var(--muted); }
.room-metrics dd { margin: 3px 0 0; font-weight: 750; }
.room-dialog { width: min(850px, 95vw); max-height: 90vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; padding: 0; color: inherit; }
.room-dialog::backdrop { background: #17294580; }
.room-dialog > .panel-heading { position: sticky; z-index: 1; top: 0; background: white; }
.room-dialog .crm-form { max-width: none; }
.calc-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.calc-tabs button[aria-pressed="true"] { color: var(--blue); background: #e9f1fc; border-color: #a5c6ef; }
.calc-results { display: grid; gap: 4px; margin-top: 12px; }
.calc-results small { display: block; color: var(--muted); }
.calc-catalog-choice { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 4px 26px; font-size: 13px; color: var(--muted); }
.calc-catalog-choice .button { min-height: 26px; padding: 2px 7px; }
#record-purchase:disabled { opacity: .55; cursor: default; }
.catalog-package-fields, .purchase-cost-fields { padding: 0; }
.purchase-cost-fields { margin: 16px 20px 0; max-width: 550px; }
.catalog-resource { display: grid; grid-template-columns: minmax(0, 2fr) minmax(75px, 0.6fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 10px 0; }
.catalog-resource strong { align-self: center; }
.price-import { max-width: 1060px; }
.price-import button:disabled { opacity: .55; cursor: default; }
.price-import .price-header-check { display: flex; align-items: center; gap: 8px; }
.price-import .price-header-check input { width: auto; min-height: 0; }
.price-mapping.fields { padding: 0; grid-template-columns: repeat(auto-fit, minmax(min(205px, 100%), 1fr)); }
.price-errors { max-height: 210px; overflow: auto; }
#price-status { margin: 0; color: var(--muted); }
.price-hint { margin: 0; color: var(--muted); }
#price-preview details { margin-top: 12px; }
.purchase-table td small { display: block; color: var(--muted); }
@media (max-width: 680px) {
  .catalog-resource { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; }
  .catalog-resource strong { grid-column: 1 / -1; }
}
.room-dialog .calc-results label { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; }
.room-dialog .calc-results input { width: auto; min-height: 0; }
.measure-room { display: flex; align-items: center; gap: 8px; max-width: 420px; }
.measure-questions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 8px; margin-top: 12px; }
.measure-questions > div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.room-dialog .measure-questions label { display: grid; grid-template-columns: 1fr 78px; align-items: center; gap: 6px; }
.measure-questions small { display: block; color: var(--muted); }
.room-form-body { padding: 0 20px 18px; }
.room-opening { display: grid; grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); align-items: end; gap: 8px; margin: 8px 0; }
.room-opening label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.room-opening input, .room-opening select { width: 100%; }
.room-transfer { display: block; padding: 3px 0; border: 0; background: none; color: var(--blue); text-align: left; font-size: 12px; }
.room-link-state { font-size: 11px; }
#room-quantity-changes { padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.account-layout { display: grid; align-items: start; gap: 16px; max-width: 760px; }
.account-panel { overflow: hidden; border-color: #dce5f2; border-radius: 18px; box-shadow: 0 9px 24px #182f5310; }
.account-panel:has(#workspace-login) { max-width: 620px; width: 100%; }
.account-content { padding: clamp(18px, 4vw, 34px); display: grid; gap: 22px; font-size: 14px; }
.account-heading { display: grid; gap: 7px; }
.account-heading h2 { font-size: 24px; line-height: 1.2; }
.account-heading p, .account-content > p, .account-section p { color: var(--muted); line-height: 1.5; }
.account-form, .account-session, .account-section { display: grid; gap: 14px; }
.account-form-row { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: end; gap: 12px; }
.account-form-row label { display: grid; gap: 7px; min-width: 0; color: #334769; font-size: 13px; font-weight: 650; }
.account-form-row :is(input, .button) { min-height: 44px; }
.account-form-row input { width: 100%; padding: 8px 12px; border-radius: 9px; font-weight: 400; }
.account-form-row .button { padding-inline: 16px; }
.account-code-row { max-width: 320px; }
.account-code-row input { font-variant-numeric: tabular-nums; letter-spacing: .12em; }
.account-status { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.account-status:empty, .account-section .contract-buttons:empty { display: none; }
.account-identity { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.account-identity .avatar { width: 42px; height: 42px; }
.account-email { flex: 1 1 180px; display: grid; gap: 3px; min-width: 0; }
.account-email span { color: var(--muted); font-size: 12px; }
.account-email strong { color: #132546; font-size: 15px; overflow-wrap: anywhere; }
.account-badge { padding: 5px 10px; border-radius: 999px; background: #eaf2ff; color: #164887; font-size: 12px; font-weight: 650; }
.account-badge-pro { background: #e6f6ef; color: #176248; }
.account-section { padding: 16px; border: 1px solid #e5edf8; border-radius: 13px; background: #f7faff; min-width: 0; }
.account-pro-help { background: #fbfcff; border-color: #dce6f5; }
.account-pro-help h2 { font-size: 18px; margin: 0; color: #132546; }
.account-support-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid #d7e4f8; border-radius: 9px; background: #fff; }
.account-support-box span { color: var(--muted); font-size: 13px; }
.account-support-email { font-size: 14px; font-weight: 700; color: var(--blue); background: #eef4ff; padding: 3px 8px; border-radius: 6px; user-select: all; overflow-wrap: anywhere; }
.account-exit { justify-self: start; padding-inline: 10px; background: transparent; color: var(--muted); }
.account-exit:hover { background: #edf4ff; color: var(--blue); }
.account-sync-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.account-sync-summary > div { display: grid; grid-template-columns: auto auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.account-sync-summary dt { color: var(--muted); font-size: 13px; }
.account-sync-summary dd { margin: 0; font-weight: 750; font-variant-numeric: tabular-nums; }
.account-layout .button { white-space: normal; text-align: center; }
.account-layout .import-file input { width: 100%; }
@media (max-width: 520px) {
  .account-form-row { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .account-form-row .button { justify-self: start; }
  .account-code-row { max-width: 240px; }
}
.sync-conflict { padding: 14px; border: 1px solid #dce5f0; border-radius: 8px; }
.sync-compared { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin: 12px 0; }
.sync-compared > div { padding: 12px; background: #f2f5fb; border-radius: 6px; overflow-wrap: anywhere; }
.sync-compared h3 { margin: 0 0 8px; }
.sync-fields { display: grid; grid-template-columns: auto 1fr; gap: 3px 9px; }
.sync-fields dd { margin: 0; }
.estimates + .crm-panel, .crm-panel + #web-backup-panel, #backup-preview + #web-backup-panel { margin-top: 18px; }
.crm-form-fields > h2 { padding-top: 4px; }
.fields .estimate-checkbox { display: flex; align-items: center; gap: 8px; }
.estimate-checkbox input { accent-color: var(--blue); }
.estimate-options .crm-wide { grid-column: 1 / -1; }
.estimate-options textarea { width: 100%; resize: vertical; font: inherit; color: inherit; background: #fbfcff; border: 1px solid #dce4f0; border-radius: 7px; padding: 8px; }
.payment-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin: 0; padding: 12px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; }
.payment-fields legend { padding: 0 4px; font-weight: 650; }
.calendar-tools { justify-content: space-between; flex-wrap: wrap; }
.calendar-tools label, .list-heading > label:not(.search) { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.calendar-tools [aria-pressed="true"] { background: #dceaff; border-color: #75a5eb; }
.calendar-day h2 { margin: 4px 20px 10px; font-size: 16px; }
.calendar-day time { white-space: nowrap; }
.search { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: #f8fafd; padding: 0 10px; color: var(--muted); }
.search span { font-size: 21px; }
.search input { width: clamp(130px, 18vw, 230px); background: transparent; border: 0; min-height: 38px; }
.table-wrap { overflow-x: auto; border-radius: 0 0 15px 15px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #eff4fb; color: #3f536f; text-align: left; font-size: 12px; white-space: nowrap; }
th, td { padding: 12px 17px; border-top: 1px solid var(--line); }
.records { min-width: 490px; }
.records td { padding-top: 16px; padding-bottom: 16px; }
.records tr:hover td { background: #f9fbff; }
.estimate-link { color: var(--blue); text-decoration: none; font-weight: 700; }
.estimate-link:hover { text-decoration: underline; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag { padding: 5px 9px; border-radius: 6px; font-weight: 650; font-size: 12px; white-space: nowrap; }
.tag.blue { background: #e4eeff; color: #064388; }
.tag.green { background: #e3f5ea; color: #0b683f; }
.tag.amber { background: #fff2d7; color: #80540a; }
.tag.red { background: #fde7e7; color: #a62234; }
.empty { text-align: center; color: var(--muted); }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 265px; gap: 16px; align-items: start; }
.editor-main { display: grid; gap: 16px; min-width: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 0 20px 19px; }
.fields label, .adjustments label { display: grid; gap: 6px; color: #495b76; font-size: 13px; }
input, select { border: 1px solid #dce4f0; background: #fbfcff; border-radius: 7px; padding: 8px; color: #172945; min-width: 0; }
.positions { min-width: 600px; }
.positions td, .positions th { padding: 8px 6px; }
.positions td:first-child, .positions th:first-child { padding-left: 13px; width: 30%; }
.positions input, .positions select { width: 100%; }
.positions td:nth-child(2) { width: 108px; }
.positions td:nth-child(3) { width: 65px; }
.positions td:nth-child(4) { width: 92px; }
.positions td:nth-child(5) { width: 93px; }
.estimate-section-target { padding: 0 14px 12px; }
.estimate-section-target label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.estimate-section-target select { min-width: 145px; max-width: 100%; }
.positions .estimate-section-heading th { background: #eef3fc; padding: 5px 10px 5px 13px; white-space: normal; }
.estimate-section-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 3px 8px; }
.estimate-section-bar small { display: block; font-weight: 500; color: var(--muted); }
.estimate-section-bar button { min-height: 30px; padding: 2px 7px; }
.estimate-section-bar button:disabled, .estimate-row-actions button:disabled { opacity: .35; cursor: default; }
.estimate-row-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: end; }
.section-row-arrow { border: 0; background: none; color: var(--blue); min-width: 23px; min-height: 28px; }
.act-photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 10px; padding: 0 14px 14px; }
.act-photo-gallery > .empty { grid-column: 1 / -1; }
.act-photo-card { min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.act-photo-open { display: block; width: 100%; padding: 0; border: 0; background: #edf2fa; }
.act-photo-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.act-photo-caption { padding: 7px 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
.act-photo-caption small { display: block; color: var(--muted); }
.act-photo-card .list-actions { padding: 0 5px 5px; }
.act-photo-full { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; object-fit: contain; }
#act-photo-state:empty { display: none; }
.positions .estimate-row-section { margin-top: 4px; min-height: 26px; padding: 1px 4px; font-size: 12px; color: var(--muted); }
.delete { font-size: 20px; border: 0; background: transparent; color: #ad253b; width: 31px; height: 34px; border-radius: 6px; }
.delete:hover { background: #fce7ed; }
.totals { position: sticky; top: 16px; padding: 17px; }
.totals dl { margin: 14px 0; display: grid; gap: 10px; }
.totals dl div { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.totals dd { margin: 0; font-weight: 650; color: #162c4b; }
.grand-total { background: #e7f0ff; color: #06458f; border-radius: 9px; padding: 12px; display: grid; gap: 3px; }
.grand-total span { font-size: 13px; }
.grand-total strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.adjustments { display: grid; gap: 9px; margin: 13px 0; }
.save { width: 100%; }
#notice { position: fixed; right: 22px; bottom: 76px; padding: 13px 16px; border-radius: 9px; background: #18335f; color: white; box-shadow: 0 8px 26px #14294433; z-index: 25; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { overflow: hidden; overscroll-behavior: contain; }
body:has(dialog[open]) .smetych-root { opacity: 0; pointer-events: none; }

.smetych-root { position: fixed; right: 20px; bottom: 18px; z-index: 20; font-size: 14px; }
.smetych-launcher { display: inline-flex; align-items: center; gap: 9px; padding: 11px 18px; min-height: 46px; border-radius: 999px; border: 1px solid #04499c; background: var(--blue); color: #fff; font-weight: 700; box-shadow: 0 8px 24px #0758b940; position: relative; }
.smetych-launcher:hover { background: var(--blue-dark); }
.smetych-launcher-icon { font-size: 16px; line-height: 1; }
.smetych-draft-dot { width: 9px; height: 9px; border-radius: 50%; background: #ffcf5c; border: 2px solid var(--blue); }
.smetych-panel { width: min(415px, calc(100vw - 28px)); height: min(590px, calc(var(--smetych-vv-height, 100dvh) - 36px)); display: flex; flex-direction: column; background: #fff; border: 1px solid #d4dfef; border-radius: 16px; box-shadow: 0 16px 42px #13284c2e; overflow: hidden; }
.smetych-panel.smetych-panel-fullscreen { position: fixed; inset: 12px; width: auto; height: auto; max-width: none; border-radius: 16px; }
.smetych-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 15px; background: #f5f9ff; border-bottom: 1px solid var(--line); }
.smetych-title-wrap { display: grid; gap: 2px; min-width: 0; }
.smetych-title-wrap h2 { font-size: 16px; color: #12294d; }
.smetych-quota { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.smetych-quota-ok { color: #166534; }
.smetych-quota-limit { color: #ad253b; }
.smetych-header-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.smetych-icon-btn { min-height: 33px; padding: 4px 10px; font-size: 13px; }
.smetych-messages { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #f9fbff; }
.smetych-welcome { padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 9px; }
.smetych-welcome p { color: var(--muted); line-height: 1.45; font-size: 13.5px; }
.smetych-starters { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.smetych-starter { white-space: normal; text-align: left; min-height: 35px; padding: 6px 10px; font-size: 12.5px; }
.smetych-msg { padding: 10px 12px; border-radius: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.smetych-msg-user { align-self: flex-end; max-width: 88%; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.smetych-msg-assistant { align-self: flex-start; max-width: 96%; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; display: grid; gap: 8px; }
.smetych-norm-badge { padding: 6px 8px; border-radius: 7px; background: #fff7e0; border: 1px solid #f4d38a; color: #7a4f08; font-size: 12px; font-weight: 600; }
.smetych-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.smetych-finding { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: #f6f9fe; font-size: 13px; display: grid; gap: 4px; }
.smetych-finding-warning { background: #fff6f6; border-color: #f6c9cf; }
.smetych-finding-ok { background: #effaf4; border-color: #bfe6cf; }
.smetych-finding-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.smetych-finding-head span { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.smetych-proposal-box { padding: 9px 10px; border-radius: 9px; border: 1px solid #d5e4fb; background: #f5f9ff; display: grid; gap: 6px; font-size: 12.5px; }
.smetych-proposal-box strong { color: #0f366d; font-size: 13px; }
.smetych-proposal-warn { padding: 5px 8px; border-radius: 7px; background: #fff7e0; border: 1px solid #f4d38a; color: #7a4f08; font-size: 12px; font-weight: 600; }
.smetych-proposal-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.smetych-proposal-rows li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 6px; border-radius: 6px; background: #fff; border: 1px solid #e2eaf6; font-size: 12px; }
.smetych-proposal-rows li.is-unknown { border-color: #f4d38a; background: #fffdf5; }
.smetych-proposal-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.smetych-proposal-actions .button { min-height: 33px; padding: 5px 10px; font-size: 12.5px; }
.smetych-preview-target { padding: 10px 12px; border-radius: 9px; border: 1px solid #d5e4fb; background: #f5f9ff; display: grid; gap: 6px; margin-bottom: 10px; }
.smetych-preview-unknown { color: #9a5b08; font-weight: 600; }
.smetych-thinking { color: var(--muted); font-size: 13px; padding: 4px 2px; }
.smetych-staged { padding: 10px 14px; background: #eef5ff; border-top: 1px solid #d5e4fb; }
.smetych-staged-card { display: grid; gap: 8px; }
.smetych-staged-card strong { display: block; font-size: 13px; color: #0f366d; }
.smetych-staged-card small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.smetych-staged-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.smetych-staged-actions .button { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.smetych-photo-stage { display: grid; gap: 8px; }
.smetych-photo-stage-top { display: flex; gap: 10px; align-items: flex-start; }
.smetych-photo-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 9px; border: 1px solid #b8cef1; background: #fff; flex: none; }
.smetych-photo-stage-meta { display: grid; gap: 5px; flex: 1; min-width: 0; }
.smetych-photo-stage-meta strong { display: block; font-size: 13px; color: #0f366d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smetych-photo-stage-meta small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.smetych-photo-kind { width: 100%; font: inherit; font-size: 12.5px; padding: 5px 8px; border-radius: 7px; border: 1px solid #b8cef1; background: #fff; color: #12294d; }
.smetych-photo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.smetych-photo-row { display: grid; gap: 5px; padding: 7px 8px; border-radius: 8px; border: 1px solid #d7e4f8; background: #fff; font-size: 12px; }
.smetych-photo-row.is-ambiguous { border-color: #eab308; background: #fffbeb; }
.smetych-photo-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.smetych-photo-check { display: flex; align-items: flex-start; gap: 7px; cursor: pointer; font-weight: 600; color: #12294d; flex: 1; min-width: 0; }
.smetych-photo-check input { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.smetych-photo-fragment { color: var(--muted); font-size: 11.5px; }
.smetych-photo-ambiguous-note { color: #9a5b08; font-size: 11.5px; font-weight: 600; }
.smetych-photo-row-edit { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.smetych-photo-qty { width: 88px; font: inherit; font-size: 12.5px; padding: 4px 7px; border: 1px solid #b8cef1; border-radius: 6px; background: #fff; }
.smetych-photo-row.is-ambiguous .smetych-photo-qty { border-color: #d97706; background: #fffdf5; }
.smetych-photo-unit { color: var(--muted); font-size: 12px; }
.smetych-photo-price { margin-left: auto; font-weight: 600; color: #0f366d; font-variant-numeric: tabular-nums; }
.smetych-media-actions { display: flex; align-items: center; gap: 6px; }
.smetych-photo-btn, .smetych-voice-btn { min-height: 37px; padding: 6px 10px; font-size: 12.5px; white-space: nowrap; }
.smetych-voice-btn.is-recording { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }
.smetych-voice-stage { display: grid; gap: 7px; }
.smetych-voice-head { display: flex; align-items: center; gap: 7px; }
.smetych-voice-dot { width: 9px; height: 9px; border-radius: 50%; background: #dc2626; flex: none; }
.smetych-voice-warn { margin: 0; padding: 5px 8px; border-radius: 6px; background: #fffbeb; border: 1px solid #f59e0b; color: #92400e; font-size: 12px; font-weight: 600; }
.smetych-voice-note { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.smetych-voice-transcript { width: 100%; font: inherit; font-size: 13px; color: #12294d; background: #fff; border: 1px solid #86b3ee; border-radius: 8px; padding: 7px 9px; resize: vertical; min-height: 62px; }
.smetych-error { padding: 9px 14px; background: #fff1f2; border-top: 1px solid #fecdd3; color: #9f1239; font-size: 13px; display: grid; gap: 7px; }
.smetych-error-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.smetych-error-actions .button { min-height: 32px; padding: 4px 10px; font-size: 12.5px; }
.smetych-composer { padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; display: grid; gap: 8px; }
.smetych-composer textarea { width: 100%; resize: none; font: inherit; color: inherit; background: #fbfcff; border: 1px solid #ccd8ea; border-radius: 9px; padding: 8px 10px; min-height: 54px; max-height: 130px; }
.smetych-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.smetych-hint { color: var(--muted); font-size: 11.5px; }
.smetych-composer-bar .button { min-height: 37px; padding: 7px 14px; }

@media (max-width: 700px) {
  .smetych-root { right: 12px; bottom: 12px; left: auto; }
  .smetych-root:has(.smetych-panel:not([hidden])) { left: 0; right: 0; bottom: 0; }
  .smetych-panel { width: 100%; height: min(76dvh, calc(var(--smetych-vv-height, 100dvh) - 8px)); border-radius: 16px 16px 0 0; }
  .smetych-panel.smetych-panel-fullscreen { inset: 0; height: var(--smetych-vv-height, 100dvh); border-radius: 0; }
  .smetych-hint { display: none; }
  .smetych-composer-bar { justify-content: end; }
}

.help-overview { margin-bottom: 18px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 18px; }
.help-toc .button { white-space: normal; text-align: left; }
.help-articles { display: grid; gap: 18px; }
.help-card-active { border-color: #75a5eb; box-shadow: 0 4px 14px #0758b91a; }
.help-card-body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.9fr); gap: 18px; align-items: start; padding: 0 20px 16px; }
.help-card-body:not(:has(.help-figure)) { grid-template-columns: minmax(0, 1fr); }
.help-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 14px; line-height: 1.48; }
.help-figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f8fafd; }
.help-figure img { display: block; width: 100%; max-height: 240px; object-fit: contain; background: #fff; }
.help-figure figcaption { padding: 8px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.help-links { padding: 14px 20px 18px; border-top: 1px solid var(--line); }

@media (max-width: 1120px) {
  body { grid-template-columns: 185px minmax(0, 1fr); }
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .totals { position: static; }
  .adjustments { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .help-card-body { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  body { display: block; }
  .sidebar { position: static; height: auto; min-height: 0; padding: 10px 14px; gap: 13px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar-footer { display: none; }
  .topbar { min-height: 54px; padding: 8px 14px; }
  .topbar span { font-size: 12px; }
  main { padding-top: 20px; }
  .stages { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 12px 12px; }
  .stage { padding: 7px; }
  .stage span { font-size: 11px; overflow-wrap: anywhere; }
  .panel-heading { padding: 13px; }
  .list-heading { flex-wrap: wrap; }
  .fields { padding: 0 13px 13px; }
  .adjustments { grid-template-columns: 1fr; }
  .help-toc, .help-card-body, .help-links { padding-inline: 13px; }
}
