/* Screen-only refinements. Exported documents and financial rules are unchanged. */
@media screen {
  :root { --header-height: 76px; }
  html { scroll-padding-top: calc(var(--header-height) + 16px); }
  body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  :where(button, a, input, select, textarea, summary):focus-visible {
    outline: 3px solid #087eac;
    outline-offset: 3px;
  }
  :where(.page, .workspace, .panel, .quote, .data-panel, .proposal-card) { min-width: 0; }
  .page-heading h1 { font-size: clamp(30px, 3.6vw, 48px); line-height: 1.12; overflow-wrap: anywhere; }
  .page-heading p { font-size: 15px; line-height: 1.55; }
  .sidebar { overflow-y: auto; overscroll-behavior: contain; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .sidebar nav { flex-shrink: 0; }
  .sidebar-info { flex-shrink: 0; padding-top: 18px; }
  .sidebar-info a { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; }
  .nav-item { min-height: 48px; font-size: 12px; line-height: 1.4; }
  .nav-item span { flex-shrink: 0; }
  .topbar { gap: 12px; background: #fff; }
  .topbar > div:not(#manager-notifications) { min-width: 0; }
  .topbar strong { overflow-wrap: anywhere; }
  .page :is(input, select, textarea):not([type=checkbox]):not([type=radio]),
  .workspace :is(input, select, textarea):not([type=checkbox]):not([type=radio]),
  .role-preview-select select { font-size: 16px; }
  .button { white-space: normal; line-height: 1.35; }
  .product-main h3 { overflow-wrap: anywhere; }
  .product-price strong, .payment-values b, .totals b { font-variant-numeric: tabular-nums; }
  .product-price strong { white-space: nowrap; }
  .catalog-tools { top: var(--header-height); }
  .products, .quote, .project-item { scroll-margin-top: calc(var(--header-height) + 16px); }
  .report-period-controls label, .report-month { font-size: 12px; letter-spacing: .04em; }
  .report-period-controls :is(input, select), .report-month input { font-size: 16px; }
  .user-row .text-button { min-height: 44px; font-size: 12px; padding: 8px 10px; }
  .user-row span, .user-row small { font-size: 12px; line-height: 1.5; }
  .permission-row { padding: 16px; }
  .permission-options { gap: 8px 18px; }
  .permission-choice { padding: 4px 0; }
  .project-item p, .proposal-card p { line-height: 1.55; }
  input[type=file] { max-width: 100%; text-overflow: ellipsis; }
  .history-search input { font-size: 16px; }
}

@media screen and (min-width: 621px) {
  label { font-size: 12px; line-height: 1.45; }
  input, select, textarea { font-size: 16px; }
  .customer-fields input, .customer-fields select,
  .field-grid.compact input, .field-grid.compact select, .extra-grid input { min-height: 48px; font-size: 16px; }
  .mode-tabs button, .category-row button, .table-tabs button { font-size: 12px; min-height: 46px; }
  .product-main p { font-size: 14px; line-height: 1.5; }
  .product-main small { font-size: 11px; }
  .product-price strong { font-size: 17px; }
  .product-price span { font-size: 12px; }
  .quote-client span, .quote-lines strong, .quote-lines b, .totals > div { font-size: 13px; }
  .quote-lines small, .payment-default-note, .notes { font-size: 12px; line-height: 1.6; }
  .payment-title, .payment-box label, .extra-grid label { font-size: 12px; }
  .payment-title span, .payment-values span { font-size: 11px; }
  .payment-values b { font-size: 16px; }
  .actions .button { min-height: 48px; font-size: 13px; }
  .quantity { grid-template-columns: repeat(3, 44px); width: 132px; margin-right: 12px; }
  .quantity button, .quantity input { width: 44px; min-width: 0; height: 48px; font-size: 18px; }
  .quantity input { font-size: 16px; }
}

@media screen and (min-width: 1367px) {
  .product-row { grid-template-columns: 96px minmax(0, 1fr) 144px 144px; }
}

@media screen and (min-width: 621px) and (max-width: 1180px) {
  .product-row { grid-template-columns: 104px minmax(0, 1fr) 140px 144px; }
}

@media screen and (min-width: 1181px) and (max-width: 1366px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(370px, 390px); gap: 20px; padding: 20px; }
  .product-row { grid-template-columns: 136px minmax(0, 1fr); grid-template-areas: 'image detail' 'price quantity'; }
  .product-image { grid-area: image; }
  .product-main { grid-area: detail; }
  .product-price { grid-area: price; padding: 12px 8px; }
  .product-price strong { font-size: 15px; }
  .quantity { grid-area: quantity; justify-self: end; margin: 8px 12px 12px; }
}

@media screen and (max-width: 1366px) {
  .sidebar { inset-block-start: var(--header-height); width: min(310px, 88vw); }
  .sidebar-backdrop { inset-block-start: var(--header-height); }
  .mobile-menu { font-size: 12px; min-width: 64px; }
}

@media screen and (max-width: 1180px) {
  .main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .mobile-summary { min-height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-summary span, .mobile-summary em { font-size: 11px; line-height: 1.35; }
  .mobile-summary b { font-size: 18px; }
  .quote { overflow: visible; }
}

@media screen and (max-width: 760px) {
  .customer-fields { grid-template-columns: minmax(0, 1fr); }
  .customer-fields label:first-child { grid-column: auto; }
  .two-columns { grid-template-columns: minmax(0, 1fr); }
  .user-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row > div, .user-row > select { grid-column: 1 / -1; }
}

@media screen and (max-width: 620px) {
  .builder-hero { display: grid; gap: 16px; padding: 22px; min-height: 0; border-radius: 18px; }
  .builder-hero h1 { margin: 10px 0; font-size: clamp(26px, 7vw, 32px); line-height: 1.14; }
  .builder-hero p { font-size: 14px; line-height: 1.5; }
  .hero-details { padding: 14px 16px; min-width: 0; }
  .hero-details strong { font-size: 18px; }
  .panel { padding: 18px 16px; border-radius: 16px; }
  .panel-title h2 { font-size: 20px; line-height: 1.25; }
  label { font-size: 12px; line-height: 1.45; }
  .customer-fields input, .customer-fields select, .user-create input, .user-create select,
  .user-filters input, .user-filters select, .project-item input, .project-item select {
    min-height: 50px; font-size: 16px;
  }
  .mode-tabs button, .category-row button, .table-tabs button { font-size: 12px; min-height: 46px; }
  .product-main p { font-size: 14px; }
  .product-price strong { font-size: 18px; }
  .product-price span { font-size: 12px; }
  .mobile-summary { gap: 8px; padding-inline: max(12px, env(safe-area-inset-left)); grid-template-columns: auto minmax(0, 1fr) auto; }
  .mobile-summary span { font-size: 10px; }
  .mobile-summary em { font-size: 10px; white-space: normal; max-width: 132px; }
  .mobile-summary b { font-size: 16px; overflow-wrap: anywhere; }
  .topbar { padding-inline: 12px; gap: 10px; }
  .topbar strong { max-width: 160px; font-size: 14px; }
  .topbar span { font-size: 9px; }
  .permission-options { display: grid; grid-template-columns: minmax(0, 1fr); }
  .permission-row { padding: 12px; }
  .proposal-actions .button { flex: 1 1 140px; }
  .notes { font-size: 12px; line-height: 1.6; }
  .mobile-select-dialog { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .login-form input { font-size: 16px; min-height: 52px; }
  .login-form { padding: 32px 22px; }
  .login-intro { padding: 26px 24px 22px; }
  .login-copy h1 { font-size: 34px; line-height: 1.08; margin-top: 12px; }
  .login-copy > p { font-size: 14px; line-height: 1.5; }
  .brand-proof { margin-top: 18px; }
}

@media screen and (max-height: 540px) and (max-width: 1366px) {
  .sidebar { padding-top: 12px; }
  .sidebar .brand { padding-bottom: 14px; }
  .sidebar-info { margin-top: 18px; }
}

@media screen and (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .sidebar, .sidebar-backdrop { transition: none; }
}
