/* styles.css -- Zoho-Quote-v2 Design System
 * Version: 20260605-v0.2
 * See docs/DESIGN.md for the full design rationale and token reference.
 * No CDN fonts or framework CSS. Vanilla only.
 */

/* ==========================================================================
 * 1. CSS custom properties (design tokens)
 * ========================================================================== */

:root {
  /* Backgrounds and surfaces -- LIGHT THEME (was dark instrument panel) */
  --bg-app:        #f5f6f8;
  --bg-surface:    #ffffff;
  --bg-card:       #ffffff;
  --bg-row-alt:    #f7f9fb;
  --bg-row-hover:  #eef4fa;
  --bg-subtotal:   #eef1f5;
  --bg-input:      #ffffff;
  --bg-input-edit: #fff8e1;
  --bg-panel:      #ffffff;
  --bg-panel-card: #f5f6f8;

  --border-strong: #c3ccd6;
  --border-soft:   #e4e8ed;
  --border-dark:   #d4dae1;

  --text-primary:   #1d2733;
  --text-secondary: #4a5a6a;
  --text-muted:     #8696a5;
  --text-link:      #0b63b8;

  /* Token names kept; these now mean DARK text on LIGHT surfaces */
  --text-on-dark:        #1d2733;
  --text-on-dark-muted:  #5a6b7b;

  --accent:        #d65a0a;
  --accent-hover:  #b94c06;
  --accent-soft:   #fdecdf;

  --health-green:      #1a7d44;  --health-green-bg:   #e3f5ea;
  --health-yellow:     #9a7008;  --health-yellow-bg:  #fbf3d9;
  --health-red:        #b5362a;  --health-red-bg:     #fbe4e1;

  --ok:       #1a7d44;
  --warn:     #9a7008;
  --error:    #b5362a;
  --error-bg: #fbe4e1;

  --seg-surface:        #2667a8;
  --seg-pumps:          #d65a0a;
  --seg-sealsandmotors: #7a3a96;
  --seg-sensor:         #11806a;
  --seg-consumables:    #5a6b7b;
  --seg-service:        #b58a14;

  --stage-draft-bg:    #5a6b7b;  --stage-draft-fg:    #ffffff;
  --stage-design-bg:   #2667a8;  --stage-design-fg:   #ffffff;
  --stage-pending-bg:  #9a7008;  --stage-pending-fg:  #ffffff;
  --stage-review-bg:   #7a3a96;  --stage-review-fg:   #ffffff;
  --stage-approved-bg: #1a7d44;  --stage-approved-fg: #ffffff;

  --fs-xs:   0.6875rem;
  --fs-sm:   0.75rem;
  --fs-base: 0.8125rem;
  --fs-md:   0.9375rem;
  --fs-lg:   1.0625rem;
  --fs-xl:   1.375rem;

  --sp-1: 2px; --sp-2: 4px; --sp-3: 8px; --sp-4: 12px;
  --sp-5: 16px; --sp-6: 24px; --sp-7: 32px;

  --radius-sm: 3px;
  --radius-md: 6px;

  --shadow-panel: -8px 0 24px rgba(29, 39, 51, 0.18);
}

/* ==========================================================================
 * 2. Widget-scoped reset and base
 * ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-app);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* Tabular-nums utility for numeric cells */
.qt-num {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
 * 3. Toolbar (.qt-toolbar)
 * Dark sticky bar. Left cluster: logo, quote name, stage badge, discount,
 * corrosion toggle. Right cluster: action buttons.
 * ========================================================================== */

.qt-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-dark);
  min-height: 48px;
}

.qt-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  min-width: 0;
}

.qt-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Quote name in toolbar */
.qt-toolbar .qt-quote-name {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-on-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* Status strip -- inline, directly under the toolbar */
.qt-status {
  display: none;
  padding: var(--sp-2) var(--sp-5);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-bottom: 1px solid transparent;
}

.qt-status.is-ok {
  display: block;
  background: var(--health-green-bg);
  color: var(--ok);
  border-color: var(--ok);
}

.qt-status.is-warn {
  display: block;
  background: var(--health-yellow-bg);
  color: var(--warn);
  border-color: var(--warn);
}

.qt-status.is-error {
  display: block;
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error);
}

/* ==========================================================================
 * 4. Stage badge (.qt-stage-badge)
 * Pill, xs, 700, uppercase. Five exact picklist strings.
 * Lock glyph on PENDING FINAL APPROVAL and QUOTE APPROVED.
 * ========================================================================== */

.qt-stage-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-3);
  border-radius: 99px;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  /* default / fallback */
  background: var(--stage-draft-bg);
  color: var(--stage-draft-fg);
}

.qt-stage-badge[data-stage="DRAFT"] {
  background: var(--stage-draft-bg);
  color: var(--stage-draft-fg);
}

.qt-stage-badge[data-stage="DESIGN APPROVED"] {
  background: var(--stage-design-bg);
  color: var(--stage-design-fg);
}

.qt-stage-badge[data-stage="PENDING FINAL APPROVAL"]::after,
.qt-stage-badge[data-stage="QUOTE APPROVED"]::after {
  content: " \1F512"; /* lock glyph */
  font-style: normal;
}

.qt-stage-badge[data-stage="PENDING FINAL APPROVAL"] {
  background: var(--stage-pending-bg);
  color: var(--stage-pending-fg);
}

.qt-stage-badge[data-stage="IN REVIEW"] {
  background: var(--stage-review-bg);
  color: var(--stage-review-fg);
}

.qt-stage-badge[data-stage="QUOTE APPROVED"] {
  background: var(--stage-approved-bg);
  color: var(--stage-approved-fg);
}

/* ==========================================================================
 * 5. Buttons (.qt-btn)
 * --primary: accent fill
 * --ghost: outlined on dark
 * --danger: error fill
 * disabled: 50% opacity, not-allowed
 * ========================================================================== */

.qt-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 120ms, border-color 120ms, color 120ms, opacity 120ms;
  user-select: none;
}

.qt-btn--primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.qt-btn--primary:hover:not([disabled]) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.qt-btn--ghost {
  background: transparent;
  color: var(--text-on-dark);
  border-color: var(--border-dark);
}

.qt-btn--ghost:hover:not([disabled]) {
  background: #eef1f5;
  border-color: var(--border-strong);
}

.qt-btn--danger {
  background: var(--error);
  color: #ffffff;
  border-color: var(--error);
}

.qt-btn--danger:hover:not([disabled]) {
  background: #a93226;
  border-color: #a93226;
}

.qt-btn[disabled],
.qt-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
 * 6. Line-item table (.qt-table)
 * Light card, segment groups with collapsible rows.
 * Header sticky under toolbar. Zebra + hover.
 * ========================================================================== */

.qt-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Frozen first column (segment) -- Excel-style, opt-in via .qt-table--freeze */
.qt-table--freeze thead th:first-child,
.qt-table--freeze tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 6;
  background: var(--bg-card);
  box-shadow: 1px 0 0 var(--border-strong);
}
.qt-table--freeze thead th:first-child {
  z-index: 12;
  background: var(--bg-surface);
}

.qt-table td.col-num,
.qt-table th.col-num { min-width: 72px; }

.qt-table {
  width: 100%;
  background: var(--bg-card);
  border-collapse: collapse;
  font-size: var(--fs-sm);
  table-layout: auto;
}

/* Sticky header row */
.qt-table thead th {
  position: sticky;
  top: 48px; /* approx toolbar height; adjusted per-page with JS if needed */
  z-index: 10;
  background: var(--bg-surface);
  color: var(--text-on-dark-muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}

/* Data cells */
.qt-table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text-primary);
}

/* Zebra striping */
.qt-table tbody tr:nth-child(even) td {
  background: var(--bg-row-alt);
}

/* Row hover */
.qt-table tbody tr:hover td {
  background: var(--bg-row-hover);
}

/* Last row in a segment (visual separator) */
.qt-table tr.qt-row--last td {
  border-bottom: 2px solid var(--border-strong);
}

/* Segment label cells */
.qt-seg-label {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  border-left: 4px solid var(--border-strong);
  padding-left: var(--sp-3);
  background: var(--bg-subtotal);
  cursor: pointer;
  user-select: none;
}

.qt-seg-label::before {
  content: "\25BC"; /* down chevron */
  font-size: 0.6em;
  margin-right: var(--sp-2);
  transition: transform 200ms;
}

.qt-seg-label.is-collapsed::before {
  transform: rotate(-90deg);
}

/* Collapsed: member rows hidden, subtotal stays */
.qt-seg-label.is-collapsed ~ tr:not(.qt-seg-subtotal) {
  display: none;
}

/* Per-segment left-border + tint on segment label cell */
.qt-seg-label[data-seg="Surface"] {
  border-left-color: var(--seg-surface);
  background: color-mix(in srgb, var(--seg-surface) 6%, var(--bg-subtotal));
}

.qt-seg-label[data-seg="Pumps"] {
  border-left-color: var(--seg-pumps);
  background: color-mix(in srgb, var(--seg-pumps) 6%, var(--bg-subtotal));
}

.qt-seg-label[data-seg="SealsAndMotors"] {
  border-left-color: var(--seg-sealsandmotors);
  background: color-mix(in srgb, var(--seg-sealsandmotors) 6%, var(--bg-subtotal));
}

.qt-seg-label[data-seg="Sensor"] {
  border-left-color: var(--seg-sensor);
  background: color-mix(in srgb, var(--seg-sensor) 6%, var(--bg-subtotal));
}

.qt-seg-label[data-seg="Consumables"] {
  border-left-color: var(--seg-consumables);
  background: color-mix(in srgb, var(--seg-consumables) 6%, var(--bg-subtotal));
}

.qt-seg-label[data-seg="Service"] {
  border-left-color: var(--seg-service);
  background: color-mix(in srgb, var(--seg-service) 6%, var(--bg-subtotal));
}

/* ==========================================================================
 * 7. Inline-editable cells (.qt-cell-edit / .qt-cell-select / .qt-cell-ro)
 * ========================================================================== */

.qt-cell-edit {
  cursor: text;
  min-width: 48px;
}

.qt-cell-edit.is-editing {
  padding: 0;
}

.qt-cell-edit.is-editing input {
  width: 100%;
  background: var(--bg-input-edit);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-2);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(232, 101, 15, 0.25);
}

/* Numeric cells right-aligned */
.qt-cell-edit input[type="number"],
.qt-cell-edit.qt-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Vanilla searchable dropdown */
.qt-cell-select {
  position: relative;
}

.qt-cell-select select {
  width: 100%;
  background: var(--bg-input-edit);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-2);
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

/* Read-only cells */
.qt-cell-ro {
  color: var(--text-secondary);
  cursor: default;
  font-variant-numeric: tabular-nums;
}

/* All editable cells become read-only when stage is locked */
.qt-stage-locked .qt-cell-edit,
.qt-stage-locked .qt-cell-select select {
  cursor: default;
  pointer-events: none;
  background: transparent;
}

/* ==========================================================================
 * 8. Summary table (.qt-summary)
 * Rows: Surface Equipment / Downhole Equipment / Consumables /
 *       Service Price List / Total
 * Columns: Install / Rental / Pull
 * ========================================================================== */

.qt-summary {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-subtotal);
  font-size: var(--fs-sm);
}

.qt-summary th,
.qt-summary td {
  padding: var(--sp-2) var(--sp-3);
  text-align: right;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
}

.qt-summary th:first-child,
.qt-summary td:first-child {
  text-align: left;
  font-size: var(--fs-md);
  font-weight: 500;
}

.qt-summary th {
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-strong);
}

/* Total row */
.qt-summary-total td {
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
  border-bottom: none;
}

/* Sticky bottom in Quotes Edit */
.qt-summary--sticky {
  position: sticky;
  bottom: 0;
  z-index: 10;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
 * 9. Slide-in panel (.qt-panel) and scrim (.qt-scrim)
 * NOT a modal. Fixed right edge. 180ms transform slide.
 * ========================================================================== */

.qt-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
}

.qt-scrim.is-open {
  display: block;
}

.qt-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  width: min(420px, 92%);
  background: var(--bg-panel);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 180ms ease;
  border-left: 1px solid var(--border-dark);
}

.qt-panel.is-open {
  transform: translateX(0);
}

.qt-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-dark);
  flex-shrink: 0;
}

.qt-panel-head h2 {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-on-dark);
}

.qt-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
  color: var(--text-on-dark);
}

.qt-panel-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border-dark);
  flex-shrink: 0;
}

/* ==========================================================================
 * 10. Margin-health cell (.qt-margin-pct)
 * [data-health="green|yellow|red"] sets bg/fg.
 * n/a state: muted hyphen, no health background.
 * ========================================================================== */

.qt-margin-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
}

.qt-margin-pct[data-health="green"] {
  background: var(--health-green-bg);
  color: var(--health-green);
}

.qt-margin-pct[data-health="yellow"] {
  background: var(--health-yellow-bg);
  color: var(--health-yellow);
}

.qt-margin-pct[data-health="red"] {
  background: var(--health-red-bg);
  color: var(--health-red);
}

.qt-margin-pct[data-health="na"] {
  background: transparent;
  color: var(--text-muted);
  font-weight: 400;
}

/* ==========================================================================
 * 11. Internal Use Only badge (.qt-internal-badge)
 * Margins only. Subtle top-right chip, thin error left border.
 * ========================================================================== */

.qt-internal-badge {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-4);
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-3);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--error);
  background: var(--bg-card);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  user-select: none;
}

/* ==========================================================================
 * 12. Loader (.qt-loader)
 * Centered overlay. Logo above indeterminate bar + status text.
 * ========================================================================== */

.qt-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(245, 246, 248, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--sp-5);
}

.qt-loader.is-active {
  display: flex;
}

/* Indeterminate progress bar */
.qt-loader-bar {
  width: 220px;
  height: 4px;
  background: var(--border-dark);
  border-radius: 2px;
  overflow: hidden;
}

.qt-loader-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 40%;
  background: var(--accent);
  border-radius: 2px;
  animation: qt-slide 1.2s ease-in-out infinite;
}

@keyframes qt-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

.qt-loader-text {
  font-size: var(--fs-sm);
  color: var(--text-on-dark-muted);
  text-align: center;
}

/* ==========================================================================
 * 13. Tag chips (.qt-tag-co / .qt-tag-fixed / .qt-tag-threshold)
 * ========================================================================== */

.qt-tag-co,
.qt-tag-fixed,
.qt-tag-threshold {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.qt-tag-co {
  background: rgba(45, 125, 210, 0.15);
  color: var(--seg-surface);
}

.qt-tag-fixed {
  background: rgba(142, 68, 173, 0.15);
  color: var(--seg-sealsandmotors);
}

.qt-tag-threshold {
  background: rgba(212, 160, 23, 0.15);
  color: var(--seg-service);
}

/* ==========================================================================
 * 14. Print document layout
 * ========================================================================== */

/* Print wrapper -- white document centered */
.qt-print-doc {
  background: #ffffff;
  color: #14202b;
  font-size: var(--fs-sm);
  max-width: 900px;
  margin: 0 auto;
  padding: var(--sp-6);
}

/* Print document header band */
.qt-print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: var(--sp-5);
  border-bottom: 2px solid #80a1bd;
  margin-bottom: var(--sp-5);
}

.qt-print-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: #14202b;
}

.qt-print-header-left strong {
  font-weight: 700;
  font-size: var(--fs-md);
}

/* Print section table */
.qt-print-section {
  margin-bottom: var(--sp-5);
  page-break-inside: avoid;
}

.qt-print-section h3 {
  font-size: var(--fs-base);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--sp-2) var(--sp-3);
  background: #dde6ef;
  color: #14202b;
  margin-bottom: 0;
}

.qt-print-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.qt-print-section table th {
  background: #dde6ef;
  color: #14202b;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  padding: var(--sp-2) var(--sp-3);
  text-align: right;
  border-bottom: 1px solid #80a1bd;
}

.qt-print-section table th:first-child,
.qt-print-section table th:nth-child(2),
.qt-print-section table th:nth-child(3),
.qt-print-section table th:nth-child(4),
.qt-print-section table th:nth-child(5) {
  text-align: left;
}

.qt-print-section table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid #e8edf2;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.qt-print-section table td:first-child,
.qt-print-section table td:nth-child(2),
.qt-print-section table td:nth-child(3),
.qt-print-section table td:nth-child(4),
.qt-print-section table td:nth-child(5) {
  text-align: left;
}

/* Section subtotal row */
.qt-print-subtotal td {
  font-weight: 600;
  background: #dde6ef;
  border-top: 1px solid #80a1bd;
  border-bottom: none;
}

/* Grand total block */
.qt-print-grandtotal {
  margin-top: var(--sp-5);
  padding: var(--sp-4) var(--sp-5);
  border-top: 3px solid #80a1bd;
  border-bottom: 3px solid #80a1bd;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--sp-6);
  page-break-inside: avoid;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.qt-print-grandtotal .qt-print-total-label {
  font-size: var(--fs-md);
  font-weight: 700;
  color: #14202b;
}

.qt-print-grandtotal .qt-print-total-value {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: #14202b;
  font-variant-numeric: tabular-nums;
}

/* Terms and conditions block */
.qt-print-terms {
  margin-top: var(--sp-6);
  page-break-inside: avoid;
  font-size: var(--fs-sm);
  color: #14202b;
}

/* Confidential footer */
.qt-print-confidential {
  margin-top: var(--sp-5);
  text-align: center;
  font-size: var(--fs-xs);
  color: #8696a5;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Screen-only controls for print widget */
.qt-tabstrip,
.qt-view-toggle,
.qt-print-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Tab strip */
.qt-tabstrip {
  border-bottom: 2px solid var(--border-soft);
  margin-bottom: var(--sp-4);
}

.qt-tabstrip button {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: var(--sp-3) var(--sp-5);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 120ms, border-color 120ms;
}

.qt-tabstrip button.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.qt-tabstrip button:hover:not(.is-active) {
  color: var(--text-primary);
}

/* T&C page images -- shown only in print */
.qt-tc-pages {
  display: none; /* hidden on screen, revealed by @media print below */
}

.qt-tc-page {
  width: 100%;
  page-break-before: always;
}

.qt-tc-page img {
  width: 100%;
  height: auto;
  display: block;
}

/* ==========================================================================
 * 15. Responsive rules
 * ========================================================================== */

/* 680px: toolbar right cluster wraps below left cluster */
@media (max-width: 680px) {
  .qt-toolbar {
    flex-wrap: wrap;
  }

  .qt-toolbar-right {
    width: 100%;
    justify-content: flex-end;
    padding-top: var(--sp-2);
  }
}

/* 720px: table scrolls horizontally; first column sticky */
@media (max-width: 720px) {
  .qt-table-scroll {
    overflow-x: auto;
  }

  .qt-table th:first-child,
  .qt-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
  }

  .qt-table thead th:first-child {
    background: var(--bg-surface);
    z-index: 12;
  }
}

/* ==========================================================================
 * 16. Print media query
 * ========================================================================== */

@page {
  size: letter portrait;
  margin: 0.5in;
}

@media print {
  /* Hide all screen chrome */
  .qt-toolbar,
  .qt-status,
  .qt-tabstrip,
  .qt-view-toggle,
  .qt-print-btn,
  .qt-scrim,
  .qt-panel,
  .qt-loader,
  .qt-internal-badge {
    display: none !important;
  }

  /* White background, dark text */
  html,
  body {
    background: #ffffff;
    color: #14202b;
  }

  .qt-print-doc {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  /* Avoid page breaks inside key blocks */
  .qt-print-header,
  .qt-print-section,
  .qt-print-grandtotal,
  .qt-print-terms {
    page-break-inside: avoid;
  }

  /* T&C images: each on its own page, hidden on screen */
  .qt-tc-pages {
    display: block;
  }

  .qt-tc-page {
    page-break-before: always;
    display: block;
  }

  /* Exact color rendering for logo, section bands, grand-total rule */
  .qt-print-header img,
  .qt-print-section h3,
  .qt-print-section table th,
  .qt-print-subtotal td,
  .qt-print-grandtotal {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
