/* ─── reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --green:      #16a34a;
  --red:        #dc2626;
  --amber:      #d97706;
  --snow:       #3b82f6;
  --rural:      #ea580c;
  --won:        #ca8a04;
  --bg:         #f9fafb;
  --card-bg:    #ffffff;
  --border:     #e5e7eb;
  --text:       #111827;
  --muted:      #6b7280;
  --input-h:    36px;
  --radius:     6px;
  --shadow:     0 1px 3px rgba(0,0,0,.1);
}

html { font-size: 14px; }
body { font-family: 'Open Sans', sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── layout ───────────────────────────────────────────────────────────────── */
.qt-body { min-height: 100vh; }

.qt-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.qt-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

.qt-layout__cards { display: flex; flex-direction: column; gap: 12px; }

.qt-layout__pricing {
  position: sticky;
  top: 72px;
}

/* ─── header ───────────────────────────────────────────────────────────────── */
.qt-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.qt-logo img { height: 48px; display: block; }

.qt-header__center { flex: 1; }

.qt-search-form { display: flex; align-items: center; gap: 8px; }
.qt-search-form__label { font-weight: 600; white-space: nowrap; }
.qt-search-form__input {
  height: var(--input-h);
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  width: 140px;
}
.qt-search-form__input--xs { width: 60px; }

.qt-header__right { display: flex; align-items: center; gap: 10px; }
.qt-header__title { font-weight: 700; font-size: 16px; }

/* ─── banners ──────────────────────────────────────────────────────────────── */
.qt-banner-stack { padding: 8px 16px; display: flex; flex-direction: column; gap: 6px; }
.qt-banner {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}
.qt-banner--warning { background: #fef3c7; border: 1px solid #fbbf24; color: #92400e; }
.qt-banner--danger  { background: #fee2e2; border: 1px solid #f87171; color: #991b1b; }
.qt-banner--info    { background: #dbeafe; border: 1px solid #93c5fd; color: #1e40af; }

/* ─── card ─────────────────────────────────────────────────────────────────── */
.qt-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.qt-card--error .qt-card__title { background: #fef2f2; color: var(--red); }

.qt-card__title {
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  background: #f3f4f6;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.qt-title-actions { font-size: 12px; font-weight: 400; }
.qt-title-actions a { margin-left: 6px; }

.qt-card__body { padding: 12px 14px; }

/* ─── rows / grid ──────────────────────────────────────────────────────────── */
.qt-row { display: grid; gap: 12px; margin-bottom: 12px; }
.qt-row--3col { grid-template-columns: repeat(3, 1fr); }
.qt-row--2col { grid-template-columns: repeat(2, 1fr); }
.qt-row--metrics { align-items: end; }
.qt-row:last-child { margin-bottom: 0; }

/* ─── fields ───────────────────────────────────────────────────────────────── */
.qt-field { display: flex; flex-direction: column; gap: 4px; }
.qt-field--full { grid-column: 1 / -1; }

.qt-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.qt-label--inline { display: inline-flex; }
.qt-label-note { font-weight: 400; color: var(--muted); }

.qt-input, .qt-select {
  height: var(--input-h);
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  width: 100%;
}
.qt-input:focus, .qt-select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.qt-input--sm  { width: 70px; }
.qt-input--xs  { width: 44px; }
.qt-input--date { font-family: monospace; }
.qt-input--address { width: 100%; }
.qt-input--error { border-color: var(--red); background: #fef2f2; }

.qt-select--grow { flex: 1; width: auto; }
.qt-select--lg   { width: 100%; }
.qt-select--xs   { width: 70px; height: 28px; font-size: 12px; }
.qt-select--sm   { width: 100px; }

.qt-input-readonly {
  height: var(--input-h);
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  background: transparent;
  color: var(--text);
  width: 80px;
}

.qt-input-metric {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  width: 90px;
  color: var(--text);
}

.qt-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.qt-input-group--wide { display: flex; align-items: center; gap: 6px; }
.qt-input-group--equipment { flex-wrap: nowrap; }
.qt-input-group__prefix,
.qt-input-group__suffix,
.qt-input-group__sep {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── checkbox / radio ─────────────────────────────────────────────────────── */
.qt-checkbox-label,
.qt-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

/* ─── badges / tags ────────────────────────────────────────────────────────── */
.qt-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.qt-badge--snow    { background: #dbeafe; color: var(--snow); border: 1px solid #bfdbfe; }
.qt-badge--rural   { background: #fff7ed; color: var(--rural); border: 1px solid #fed7aa; }
.qt-badge--danger  { background: #fee2e2; color: var(--red); border: 1px solid #fca5a5; }
.qt-badge--won     { background: #fef9c3; color: var(--won); border: 1px solid #fde047; }
.qt-badge--warning { background: #fef3c7; color: var(--amber); border: 1px solid #fde68a; }

.qt-tag {
  display: inline-block;
  padding: 1px 6px;
  background: #ede9fe;
  color: #5b21b6;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.qt-metric {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}
.qt-metric--won  { background: #fef9c3; color: var(--won); font-weight: 700; border: 1px solid #fde047; }
.qt-metric--info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

.qt-metric-item { display: flex; flex-direction: column; gap: 2px; }
.qt-metric-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.qt-metric-value { font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: baseline; gap: 2px; }
.qt-metric-sm { font-size: 13px; margin-top: 4px; }

/* ─── links ────────────────────────────────────────────────────────────────── */
.qt-link { color: var(--blue); }
.qt-link--subtle { color: var(--muted); font-size: 12px; }

/* ─── design card ──────────────────────────────────────────────────────────── */
.qt-design-img-wrap { margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.qt-design-img { width: 100%; display: block; object-fit: contain; max-height: 280px; background: #f3f4f6; }

.qt-design-arrays { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.qt-array-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #0369a1;
}

.qt-bom-toggle { display: flex; gap: 12px; margin: 8px 0 4px; font-size: 12px; }
.qt-bom { font-size: 12px; background: #f9fafb; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; margin-top: 4px; }
.qt-bom__row { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid var(--border); }
.qt-bom__row:last-child { border-bottom: none; }

/* ─── equipment card ───────────────────────────────────────────────────────── */
.qt-rsd-option { font-size: 12px; margin-left: 8px; }
.qt-combiner-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; margin-top: 6px; padding: 6px 8px; background: #f0f9ff; border-radius: var(--radius); }

/* ─── pricing panel ────────────────────────────────────────────────────────── */
.qt-pricing {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.qt-pricing__title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.qt-pricing__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.qt-pricing__label { color: var(--muted); }
.qt-pricing__value { font-weight: 600; }

.qt-pricing__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 10px;
}
.qt-pricing__total-label { font-size: 15px; font-weight: 700; }
.qt-pricing__total-value { font-size: 20px; font-weight: 700; color: var(--blue); }

.qt-input-metric--total { font-size: 20px; color: var(--blue); width: 110px; }
.qt-input-metric--margin { font-size: 12px; color: var(--muted); width: 55px; }

.qt-pricing__actions { display: flex; flex-direction: column; gap: 8px; }
.qt-pricing__footer  { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); text-align: center; }

/* ─── buttons ──────────────────────────────────────────────────────────────── */
.qt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  height: var(--input-h);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.qt-btn:disabled { opacity: .45; cursor: not-allowed; }
.qt-btn--primary   { background: #57a957; color: #fff; border-color: #4d9b4d; }
.qt-btn--primary:hover:not(:disabled) { background: #4d9b4d; }
.qt-btn--secondary { background: #fff; color: var(--blue); border-color: var(--blue); }
.qt-btn--secondary:hover:not(:disabled) { background: #eff6ff; }
.qt-btn--ghost     { background: transparent; color: var(--muted); border-color: var(--border); font-weight: 400; }
.qt-btn--sm  { height: 28px; padding: 0 10px; font-size: 12px; }
.qt-btn--lg  { width: 100%; height: 40px; font-size: 14px; }
.qt-btn-group { display: flex; gap: 8px; }

/* ─── filter bar ───────────────────────────────────────────────────────────── */
.qt-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 14px; background: #f3f4f6; border-bottom: 1px solid var(--border); }

/* ─── table ────────────────────────────────────────────────────────────────── */
.qt-table-wrap { overflow-x: auto; }
.qt-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.qt-table th, .qt-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.qt-table th { background: #f3f4f6; font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.qt-table tr:hover td { background: #f9fafb; }
.qt-row--won td { background: #fef9c3 !important; }

.qt-empty-state { color: var(--muted); text-align: center; padding: 20px 0; }

/* ─── footer ───────────────────────────────────────────────────────────────── */
.qt-footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 16px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* ─── responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .qt-layout { grid-template-columns: 1fr; }
  .qt-layout__pricing { position: static; }
}

@media (max-width: 768px) {
  .qt-row--3col { grid-template-columns: 1fr 1fr; }
  .qt-header { flex-wrap: wrap; }
  .qt-header__center { order: 3; flex: 100%; }
}

@media (max-width: 480px) {
  .qt-row--3col,
  .qt-row--2col { grid-template-columns: 1fr; }
  .qt-field--full { grid-column: auto; }
}
