[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
button, input, textarea, select { touch-action: manipulation; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #7288dc;
  outline-offset: 3px;
}
.login-screen {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(32px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  background: #071d78;
  color: white;
}
.login-panel { width: 100%; max-width: 340px; }
.login-logo { display: block; width: 68px; height: auto; margin-bottom: 42px; }
.login-panel h1 { font-size: 32px; line-height: 1.12; letter-spacing: -.025em; margin: 0 0 16px; }
.login-intro { font-size: 16px; color: #e1e6ff; margin: 0 0 32px; }
.login-panel label { display: block; font-size: 14px; margin-bottom: 10px; }
#accessPin {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 12px 20px;
  border: 2px solid #c7d1ff;
  border-radius: 6px;
  background: #fff;
  color: #111;
  font-size: 26px;
  text-align: center;
  letter-spacing: .5em;
}
#accessPin[aria-invalid="true"] { border-color: #ffbcb5; }
.pin-error { min-height: 22px; font-size: 14px; color: #ffdad6; margin: 10px 0 16px; }
.login-submit { width: 100%; min-height: 52px; border: 0; border-radius: 6px; background: #fff; color: #071d78; font-size: 16px; font-weight: 700; }
.login-submit:hover { background: #e6ebff; }
.login-caption { margin: 40px 0 0; color: #d7dfff; font-size: 12px; letter-spacing: .08em; }
.no-script { background: #fff; padding: 20px; margin: 0; }
.topbar { height: auto; min-height: 76px; gap: 18px; padding-block: 12px; }
.topbar .brand { flex: 1; min-width: 0; }
.logout-button { order: 3; }
.btn, .remove-group, .remove-item, .history-delete, .add-group, .add-item { min-height: 44px; }
.remove-group, .remove-item, .history-delete { min-width: 44px; }
.editor-item { grid-template-columns: minmax(0,1fr) 84px 44px; }
.item-desc { resize: vertical; line-height: 1.35; }
.item-price { align-self: start; min-height: 44px; }
.mobile-views { display: none; }
.field select { width: 100%; min-height: 44px; }
.paper-wrap { container-type: inline-size; width: 100%; max-width: 760px; margin: 0 auto; padding: 0; overflow: visible; }
.paper { width: 100%; min-width: 0; min-height: 129.412cqw; aspect-ratio: auto; padding: 0; }
.paper-header { height: 22.75cqw; flex-shrink: 0; margin: 0; padding: 0 6.3cqw; gap: 5cqw; }
.quote-logo { width: 7.4cqw; }
.quote-title { min-width: 0; gap: 1cqw; font-size: 3.15cqw; }
.quote-title > span:last-child { overflow-wrap: anywhere; }
.quote-rule { flex-shrink: 1; width: 21.7cqw; height: .66cqw; }
.paper-body { display: flex; flex-direction: column; padding: 11.7cqw 8.5cqw 2.7cqw; }
.paper h2 { font-size: 3.3cqw; margin: 0 0 6cqw; }
.meta-row { font-size: 1.6cqw; margin: -3.8cqw 0 4cqw; gap: 2cqw; }
.meta-client { min-width: 0; overflow-wrap: anywhere; }
.section-bar { font-size: 4cqw; padding: 1.2cqw 2.9cqw; margin-bottom: 4cqw; }
.quote-group { margin-bottom: 4.5cqw; }
.quote-group-title { font-size: 3.3cqw; gap: 2cqw; margin-bottom: 3cqw; overflow-wrap: anywhere; }
.triangle { border-left-width: 1.45cqw; border-right-width: 1.45cqw; border-bottom-width: 2.63cqw; }
.quote-line { grid-template-columns: 1.8cqw minmax(0,1fr) auto; gap: 1.3cqw; font-size: 2.1cqw; margin: 0 .5cqw 0 3.65cqw; }
.quote-line > span:nth-child(2) { overflow-wrap: anywhere; }
.quote-amount { min-width: 9cqw; }
#quoteGroups { margin-bottom: 4cqw; }
.quote-total { border-top-width: .92cqw; padding: 1.7cqw 2.5cqw 0 0; gap: 1cqw; }
.total-label { font-size: 3.15cqw; }
.total-value { font-size: 5cqw; }
.paper-footer { padding-top: 18cqw; font-size: 1.85cqw; }
.paper-footer strong { margin-bottom: .65cqw; }
.empty-note { font-size: 1.7cqw; }
@media screen and (max-width: 1000px) {
  main { grid-template-columns: minmax(280px, 340px) minmax(0,1fr); padding: 20px; gap: 20px; }
  .topbar { padding-inline: 20px; gap: 10px; }
  .brand { letter-spacing: .06em; }
  .top-actions { gap: 8px; }
}
@media screen and (max-width: 760px) {
  .topbar { padding: max(12px, env(safe-area-inset-top)) 16px 12px; display: grid; grid-template-columns: 1fr auto; gap: 12px; }
  .brand { font-size: 12px; gap: 10px; }
  .brand-logo { width: 32px; }
  .logout-button { order: initial; font-size: 12px; padding-inline: 12px; }
  .top-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
  .top-actions .btn-quiet { display: block; }
  .mobile-views { display: flex; position: sticky; top: 0; z-index: 1; padding: 8px 16px; gap: 8px; background: #f2f3f5; border-bottom: 1px solid var(--line); }
  .mobile-views button { flex: 1; min-height: 44px; border: 0; border-radius: 5px; background: transparent; font-weight: 700; color: #424242; font-size: 15px; }
  .mobile-views button[aria-pressed="true"] { background: #fff; color: #071d78; }
  main { display: block; padding: 16px 12px max(24px, env(safe-area-inset-bottom)); }
  main[data-view="edit"] .stage, main[data-view="preview"] .editor { display: none; }
  .editor { width: 100%; padding: 18px 14px; position: static; max-height: none; overflow: visible; }
  .field input, .field select, .item-desc, .item-price, .group-name, .history-search { width: 100%; min-height: 48px; font-size: 16px; }
  .field, .pair > * { min-width: 0; }
  .field label { font-size: 14px; }
  .editor-item { grid-template-columns: minmax(0,1fr) 44px; gap: 8px; margin-bottom: 16px; }
  .item-desc { grid-column: 1 / -1; min-height: 76px; }
  .item-price { min-width: 0; }
  .remove-item { align-self: start; }
  .add-item, .add-group { font-size: 14px; }
  .history-open { min-height: 44px; }
  .history-open strong { font-size: 14px; }
  .history-open small, .help { font-size: 12px; }
  .stage { width: 100%; }
  .stage-head { font-size: 12px; gap: 10px; }
  .paper-wrap { width: 100%; margin: 0 auto; padding: 0; }
  .paper { min-width: 0; }
}
@media print {
  .login-screen, .mobile-views, .no-script { display: none !important; }
  #portalApp:not([hidden]) .stage { display: block !important; }
  .paper-wrap { width: 8.5in; max-width: none; margin: 0; padding: 0; }
  .paper { width: 100%; min-height: 11in; height: auto; }
  .paper-header { height: 22.75cqw; }
  .paper-body { padding-top: 11.7cqw; }
  .paper-footer { padding-top: 18cqw; }
  .quote-line, .quote-total, .paper-footer { break-inside: avoid; }
  .quote-group-title { break-after: avoid; }
}

.pdf-status { margin: 12px 20px 0; font-size: 14px; }
.pdf-status:empty { display: none; }
.btn:disabled { cursor: wait; opacity: .7; }
