:root {
  --navy: #0b2545;
  --navy-dark: #071a33;
  --teal: #1f9e8b;
  --sand: #e7dfcf;
  --sand-light: #f5f1e8;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --green: #15803d;
  --gray: #888888;
  --card-radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--sand-light);
  color: var(--ink);
}

header {
  background: var(--navy);
  color: white;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

header .wordmark {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header .wordmark span {
  color: var(--teal);
}

header .tagline {
  font-size: 0.85rem;
  color: var(--sand);
  margin-top: 2px;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.betabar {
  background: var(--sand);
  color: var(--navy-dark);
  border-radius: var(--card-radius);
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.recent-floors {
  margin-bottom: 16px;
}

.recent-floors-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.recent-floors-header h3 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--navy);
}

.clear-recent {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.recent-floors-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.recent-floor-item {
  flex: 0 0 auto;
  width: 84px;
  text-align: center;
}

.recent-floor-item img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
}

.recent-floor-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 4px;
}

.recent-floor-sub {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.2;
}

.auth-box {
  background: white;
  border-radius: var(--card-radius);
  padding: 24px;
  max-width: 360px;
  margin: 40px auto 0;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.08);
}

.auth-box h2 {
  margin: 0 0 6px;
  color: var(--navy);
}

.auth-box form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.auth-input {
  padding: 10px 14px;
  border: 1.5px solid var(--sand);
  border-radius: 999px;
  font-size: 0.95rem;
}

.auth-input:focus {
  outline: none;
  border-color: var(--teal);
}

.auth-box .pill-button {
  border: none;
}

.auth-error {
  margin-bottom: 0;
}

.upload-box {
  background: white;
  border: 2px dashed var(--teal);
  border-radius: var(--card-radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.upload-box input[type="file"] {
  display: none;
}

.pill-button {
  display: inline-block;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pill-button:hover {
  background: var(--navy-dark);
}

.pill-button.secondary {
  background: white;
  color: var(--navy);
  border: 1.5px solid var(--navy);
}

.filters {
  margin-bottom: 20px;
}

.filter-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 10px 0 6px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  background: white;
  color: var(--navy);
  border: 1.5px solid var(--sand);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--teal);
}

.filter-pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

#fileStatus {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

#loadingState {
  display: none;
  text-align: center;
  padding: 24px;
  color: var(--navy);
  font-weight: 600;
}

.result-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.08);
}

.result-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.result-card .brand {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal);
  font-weight: 700;
}

.result-card .product-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 2px 0 4px;
}

.result-card .confidence {
  font-weight: 700;
  font-size: 1.05rem;
}

.result-card .meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.compare-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.compare-row .thumb-wrap {
  text-align: center;
}

.compare-row img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
}

.compare-row .thumb-label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 2px;
}

.confirm-button {
  display: block;
  width: 100%;
  margin-top: 14px;
  background: white;
  color: var(--navy);
  border: 1.5px solid var(--navy);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.confirm-button:hover:not(:disabled) {
  background: var(--navy);
  color: white;
}

.confirm-button:disabled {
  cursor: default;
}

.result-card.confirmed {
  border: 1.5px solid var(--green);
  box-shadow: 0 1px 3px rgba(21, 128, 61, 0.15);
}

.result-card.confirmed .confirm-button {
  background: var(--green);
  border-color: var(--green);
  color: white;
  opacity: 1;
}

.result-card.dimmed {
  opacity: 0.5;
}

.result-card.dimmed .confirm-button {
  background: var(--sand-light);
  color: var(--muted);
  border-color: #e5e5e5;
}

.materials-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e5e5;
}

.share-button {
  display: block;
  width: 100%;
  background: var(--sand-light);
  color: var(--navy);
  border: 1.5px solid var(--sand);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.share-button:hover {
  background: var(--sand);
}

.materials-section h4 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--navy);
}

.materials-section + .materials-section {
  margin-top: 14px;
}

.materials-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.materials-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}

.materials-checklist input[type="checkbox"] {
  accent-color: var(--teal);
  width: 16px;
  height: 16px;
}

.transition-strips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.transition-strips li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.transition-strips .strip-type {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.transition-strips .strip-coordinates {
  font-size: 0.75rem;
  color: var(--muted);
}

.tip-card {
  background: #fdf6e3;
  border: 1px solid #eadfb4;
  border-radius: var(--card-radius);
  padding: 16px;
  margin-bottom: 12px;
}

.tip-card h3 {
  margin-top: 0;
}

/* ── Admin dashboard ────────────────────────────────── */

.admin-dashboard h2 {
  margin: 0 0 20px;
  color: var(--navy);
}

.admin-dashboard h3 {
  margin: 20px 0 8px;
  font-size: 0.9rem;
  color: var(--navy);
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.admin-stat {
  background: white;
  border-radius: var(--card-radius);
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.08);
}

.admin-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--teal);
}

.admin-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 4px;
}

.admin-breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-breakdown li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.9rem;
  background: white;
  border-radius: var(--card-radius);
  margin-bottom: 4px;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.08);
}

.admin-breakdown li span:last-child {
  font-weight: 700;
  color: var(--teal);
}

/* ── Match meta (timing + catalog scale) ───────────── */

.match-meta {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.meta-speed {
  background: #e0f5f0;
  color: #0d7d6c;
}

.meta-catalog {
  background: var(--sand);
  color: var(--navy);
}

/* ── Room Preview Slider ───────────────────────────── */

.preview-button {
  background: none;
  border: 1.5px solid var(--sand);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--navy);
  align-self: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.preview-button:hover {
  border-color: var(--teal);
  background: #e0f5f0;
}

.room-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 37, 69, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.room-preview-overlay[hidden] {
  display: none;
}

.room-preview-inner {
  background: white;
  border-radius: var(--card-radius);
  padding: 20px;
  max-width: 500px;
  width: 100%;
  position: relative;
}

.room-preview-inner h3 {
  margin: 0 0 12px;
  color: var(--navy);
}

.room-preview-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.room-preview-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
}

.preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-product {
  clip-path: inset(0 0 0 50%);
}

.preview-range {
  position: absolute;
  bottom: 12px;
  left: 10%;
  width: 80%;
  z-index: 2;
  accent-color: var(--teal);
}

.preview-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 8px;
}

/* ── Cross-sell ────────────────────────────────────── */

.cross-sell-section {
  margin-top: 24px;
}

.cross-sell-heading {
  font-size: 0.95rem;
  color: var(--navy);
  margin: 0 0 12px;
}

.cross-sell-grid {
  display: grid;
  gap: 12px;
}

.cross-sell-card {
  display: flex;
  gap: 12px;
  background: white;
  border-radius: var(--card-radius);
  padding: 12px;
  box-shadow: 0 1px 3px rgba(11, 37, 69, 0.08);
  border-left: 3px solid var(--teal);
}

.cross-sell-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.cross-sell-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cross-sell-brand {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal);
  font-weight: 700;
}

.cross-sell-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.cross-sell-cat {
  font-size: 0.78rem;
  color: var(--muted);
}

.cross-sell-sku {
  font-size: 0.75rem;
  color: var(--navy);
  font-weight: 600;
  font-family: monospace;
}

.cross-sell-link {
  font-size: 0.78rem;
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

.cross-sell-link:hover {
  text-decoration: underline;
}

/* ── Dealer Mode ───────────────────────────────────── */

.dealer-sku {
  font-size: 0.82rem;
  color: var(--navy);
  font-family: monospace;
  margin-bottom: 6px;
  padding: 4px 10px;
  background: #f0f4f8;
  border-radius: 6px;
  display: inline-block;
}

.dealer-order-button {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 8px;
  background: var(--teal);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.dealer-order-button:hover {
  background: #178a79;
}

.result-card.dealer-mode {
  border-left: 3px solid var(--teal);
}
