/* Keep the standalone shell at the device text scale, including after rotation. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@supports (-webkit-touch-callout: none) {
  @media (pointer: coarse) {
    input:not([type="checkbox"]):not([type="radio"]), select, textarea {
      font-size: 16px !important;
    }
    button, a { touch-action: manipulation; }
  }
}

#quotePage {
  --quote-ink: #17191d;
  --quote-muted: #62666e;
  --quote-border: #e7e3dc;
  --quote-gold: #c8a06a;
  --quote-gutter: clamp(12px, 3vw, 24px);
  padding: 0 0 env(safe-area-inset-bottom);
  background: #f5f4f0;
}
.quote-workspace-header {
  background: var(--quote-ink);
  color: white;
  padding-top: env(safe-area-inset-top);
}
.quote-header-inner, .quote-shell {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: max(var(--quote-gutter), env(safe-area-inset-left))
                  max(var(--quote-gutter), env(safe-area-inset-right));
}
.quote-header-inner { min-height: 58px; display: flex; align-items: center; gap: 12px; }
.quote-header-inner h1 { margin: 0; font-size: clamp(15px, 4vw, 20px); line-height: 1.3; }
.quote-header-inner h1 span { letter-spacing: .07em; }
.quote-header-inner .quote-back-button {
  border: 1px solid #4b4d52;
  background: transparent;
  color: #eee;
  border-radius: 9px;
  padding: 8px 10px;
  flex: none;
  min-height: 40px;
}
.quote-shell { display: grid; gap: 16px; padding-block: 16px 24px; min-width: 0; }
.quote-project, .quote-settlement {
  background: #fff;
  border: 1px solid var(--quote-border);
  border-radius: 15px;
}
.quote-project {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
}
.quote-project-info { flex: 1; min-width: 0; }
.quote-project h2 { margin: 0 0 5px; color: #805f35; font-size: 12px; }
#customerTitle { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
#customerSub { margin-top: 4px; font-size: 12px; color: var(--quote-muted); overflow-wrap: anywhere; }
#customerSub:empty { display: none; }
.quote-project-actions, .quote-tools, .quote-dock-actions { display: flex; gap: 6px; }
.quote-project-actions { flex: none; }
.quote-tools, .quote-dock-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quote-project-actions button, .quote-tools button, .quote-dock-actions button {
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid var(--quote-border);
  border-radius: 9px;
  background: #fff;
  color: var(--quote-ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}
.quote-project-actions button:first-child { background: #f5f1eb; border-color: transparent; }
.quote-tools { gap: 0; background: #ebe8e1; padding: 3px; border-radius: 10px; }
.quote-tools button { border: 0; background: transparent; min-height: 39px; }
.quote-tools button + button { border-left: 1px solid #dcd8cf; border-radius: 0; }
.quote-items > header, .quote-settlement > header { margin-bottom: 10px; }
.quote-items h2, .quote-settlement h2 { margin: 0; font-size: 18px; font-weight: 650; }
#quotePage .card-list { padding: 0; }
#quotePage .quote-card {
  scroll-margin-top: 14px;
  border: 1px solid var(--quote-border) !important;
  box-shadow: none !important;
  border-radius: 12px !important;
  padding: 14px;
  margin-bottom: 8px !important;
}
#quotePage .card-header { padding: 0 0 8px; margin: 0 0 12px; min-height: 38px; }
#quotePage .collapsed .card-header { padding: 0; margin: 0; border: 0 !important; }
#quotePage .card-title { font-size: 15px; }
#quotePage .card-summary { font-size: 11px; color: var(--quote-muted); }
#quotePage .card-actions button { min-height: 36px; padding: 5px 7px; border: 0; background: transparent; font-size: 12px; }
#quotePage .card-toggle { color: var(--quote-ink); }
#quotePage .card-del { color: #87433b; border-color: var(--quote-border); }
#quotePage .card-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; }
#quotePage .collapsed .card-body { display: none; }
#quotePage .form-row { margin: 0; min-width: 0; }
#quotePage .form-row:first-child, #quotePage .form-row:nth-child(4), #quotePage .calc-grid { grid-column: 1 / -1; }
#quotePage .form-label { color: var(--quote-muted); margin-bottom: 4px; font-size: 12px; }
#quotePage :is(.form-select, .form-input, .form-textarea) {
  min-height: 44px;
  padding: 9px 10px;
  color: var(--quote-ink);
  font-size: 16px;
}
#quotePage .form-select {
  appearance: auto;
  -webkit-appearance: menulist;
}
#quotePage .form-textarea { display: block; min-height: 48px; }
#quotePage .calc-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding-top: 9px;
  border-top: 1px solid var(--quote-border);
}
#quotePage .calc-item .label { color: var(--quote-muted); }
#quotePage .calc-item .value { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#quotePage .calc-grid { grid-template-columns: repeat(3,minmax(0,1fr)) minmax(max-content,1.2fr); }
#quotePage #emptyState { padding: 20px 8px; color: var(--quote-muted); font-size: 13px; }
#quoteAddPositionButton {
  width: 100%;
  min-height: 44px;
  border: 1px dashed #bda787;
  border-radius: 10px;
  background: #f9f6f0;
  color: #70532e;
  font-size: 14px;
  font-weight: 650;
}
.quote-settlement { padding: 15px; }
.quote-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  margin-bottom: 12px;
}
.quote-metrics > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 8px;
  border-top: 1px solid var(--quote-border);
  padding: 9px 0;
}
.quote-metrics span { color: var(--quote-muted); font-size: 12px; }
.quote-metrics strong { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 60px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #191a1c;
  color: #fff;
  font-size: 13px;
}
.quote-total strong { color: #e1be8d; font-size: clamp(19px, 5.8vw, 27px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-dock-actions { margin-top: 9px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.quote-dock-actions button { min-height: 44px; }
#quoteConfirmOrderBtn { background: var(--quote-gold); border-color: var(--quote-gold); }
#quoteConfirmOrderBtn small { display: block; font-size: 10px; overflow-wrap: anywhere; }
#quoteConfirmOrderBtn small:empty { display: none; }
#quotePage :is(button, input, select, textarea):focus-visible { outline: 2px solid #a27742; outline-offset: 2px; }
@media (min-width: 840px) {
  .quote-dock-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #quotePage .card-body { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, .6fr); }
  #quotePage .form-row:first-child { grid-column: auto; }
  .quote-metrics { column-gap: 32px; }
}
@media print {
  .quote-workspace-header, .quote-dock-actions, .quote-tools, .quote-project-actions { display: none !important; }
}
