:root {
  /* Aligned with the Echoprice homepage design system:
     ink + warm ivory paper + earthy brand green, Inter + Fraunces. */
  --bg: #f7f5ef;
  --surface: #ffffff;
  --surface-2: #efece1;
  --text: #1a1f17;
  --text-2: #6b6f63;
  --text-3: #9a9b8e;
  --accent: #4d7c0f;
  --accent-light: #eef3df;
  --green: #4d7c0f;
  --green-bg: #eef3df;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --border: rgba(26, 31, 23, 0.10);
  --shadow-sm: 0 1px 2px rgba(26, 31, 23, 0.06);
  --shadow-md: 0 6px 18px -8px rgba(26, 31, 23, 0.18);
  --shadow-lg: 0 24px 48px -24px rgba(26, 31, 23, 0.28);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-height: 80px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --topbar-h: 64px;
}

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

/* Reserve space for the vertical scrollbar so the fixed bottom nav doesn't
   shift horizontally between short and long views (e.g. quotes vs design). */
html { scrollbar-gutter: stable; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── LOADING ───────────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  transition: opacity 0.3s ease;
}

.loader-logo {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text);
}

.loader-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── SKELETON LOADING ───────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-text.long { width: 100%; }

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.skeleton-card {
  height: 80px;
  margin-bottom: 10px;
}

.skeleton-hero {
  height: 140px;
  border-radius: var(--radius-xl);
}

.skeleton-stat {
  height: 70px;
  border-radius: var(--radius-md);
}

/* ── DROPDOWN ─────────────────────────────────────────────────────── */
.dropdown {
  position: relative;
  width: 100%;
}

.dropdown-trigger {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.15s, background 0.15s;
}

.dropdown-trigger:hover {
  border-color: var(--text);
  background: var(--surface);
}

.dropdown-trigger:focus {
  border-color: var(--text);
  background: var(--surface);
}

.dropdown-trigger.is-open {
  border-color: var(--text);
  background: var(--surface);
}

.dropdown-trigger-value {
  flex: 1;
  text-align: left;
}

.dropdown-trigger.placeholder {
  color: var(--text-3);
}

.dropdown-trigger-arrow {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  color: var(--text-3);
}

.dropdown-trigger.is-open .dropdown-trigger-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  animation: dropdownSlideIn 0.2s ease;
}

.dropdown-menu.is-open {
  display: block;
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
  font-size: 0.95rem;
  color: var(--text);
}

@media (max-width: 767px) {
  .dropdown-item {
    padding: 16px;
    font-size: 1rem;
    min-height: 56px;
  }
  .dropdown-trigger {
    padding: 14px 16px;
    font-size: 1rem;
    min-height: 52px;
  }
  .dropdown-search input {
    padding: 14px;
    font-size: 1rem;
  }
}

.dropdown-item:hover {
  background: var(--bg);
}

.dropdown-item.is-selected {
  background: var(--accent-light);
  font-weight: 600;
}

.dropdown-item.is-disabled {
  color: var(--text-3);
  cursor: not-allowed;
}

.dropdown-item.is-disabled:hover {
  background: transparent;
}

.dropdown-item-icon {
  margin-right: 10px;
  font-size: 1.1rem;
}

.dropdown-item-meta {
  font-size: 0.8rem;
  color: var(--text-3);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.dropdown-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.dropdown-search input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
}

.dropdown-search input:focus {
  border-color: var(--text);
}

.dropdown-no-results {
  padding: 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.9rem;
}

/* ── APP SHELL ─────────────────────────────────────────────────────── */
.portal-app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── SIDEBAR (Desktop) ─────────────────────────────────────────────── */
.sidebar {
  display: none;
  width: 260px;
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-direction: column;
  z-index: 200;
  padding: 0;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-family: var(--font-serif);
  display: flex; align-items: center; gap: 10px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.sidebar-nav-link .nav-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.sidebar-nav-link.is-active {
  color: var(--text);
  background: var(--accent-light);
  font-weight: 600;
}

.sidebar-nav-link.is-active .nav-icon {
  background: var(--text);
  color: white;
}

.sidebar-nav-link.is-active .nav-icon svg { stroke: white; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-user:hover { background: var(--surface-2); }

/* ── MAIN CONTENT ──────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── TOPBAR (frosted pill, centred Echoprice wordmark) ────────────────── */
.topbar {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(26, 31, 23, 0.08);
  border-radius: 100px;
  box-shadow: 0 6px 20px -10px rgba(26, 31, 23, 0.18), 0 1px 2px rgba(26, 31, 23, 0.04);
  height: 56px;
  padding: 0 28px;
}

.topbar-brand {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}
.topbar-home-link {
  text-decoration: none;
  display: flex;
  align-items: center;
}

@media (min-width: 768px) {
  .topbar {
    top: 16px;
    left: calc(260px + ((100vw - 260px) / 2));
    right: auto;
    transform: translateX(-50%);
    min-width: 320px;
  }
}

/* ── AVATAR ────────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  background: var(--text);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  font-family: var(--font);
}

/* ── PORTAL SHELL ──────────────────────────────────────────────────── */
.portal-shell {
  flex: 1;
  padding: calc(56px + 28px) 20px calc(var(--nav-height) + var(--safe-bottom) + 16px);
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

/* ── VIEW STACK ────────────────────────────────────────────────────── */
.view-stack { display: flex; flex-direction: column; gap: 16px; }

/* ── SECTION HEADING ───────────────────────────────────────────────── */
.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* ── CARDS ─────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.card-body { padding: 16px; }
.card-body + .card-body { border-top: 1px solid var(--border); }

/* ── HERO STAT CARD ────────────────────────────────────────────────── */
.hero-card {
  background: var(--text);
  color: white;
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: none;
}

.hero-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 6px;
}

.hero-card-value {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-family: var(--font);
}

.hero-card-sub {
  margin-top: 8px;
  font-size: 0.8rem;
  opacity: 0.55;
}

.hero-card .btn-pill-white {
  margin-top: 20px;
  width: 100%;
  padding: 14px;
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 100px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.hero-card .btn-pill-white:active { background: rgba(255,255,255,0.22); }

/* ── QUICK STATS ROW ───────────────────────────────────────────────── */
.quick-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.stat-pill {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-pill-value {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-pill-label {
  font-size: 0.68rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 3px;
}

/* ── QUOTE CARDS ───────────────────────────────────────────────────── */
.quote-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 14px;
  cursor: pointer;
  transition: background 0.12s;
  background: var(--surface);
}

.quote-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.quote-item:active { background: var(--bg); }

.quote-item-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.quote-item-body { flex: 1; min-width: 0; }

.quote-item-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-item-meta {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 2px;
  font-family: var(--font-mono);
}

.quote-item-right {
  text-align: right;
  flex-shrink: 0;
}

.quote-item-amount {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ── EXPANDED QUOTE DETAIL ─────────────────────────────────────────── */
.quote-detail {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 16px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.87rem;
}

.detail-row:not(:last-child) { border-bottom: 1px solid var(--border); }

.detail-row .label { color: var(--text-2); }
.detail-row .value { font-weight: 600; font-family: var(--font-mono); font-size: 0.83rem; }

.detail-actions {
  display: flex;
  gap: 10px;
  padding-top: 14px;
}

.detail-actions .btn {
  flex: 0 0 auto;
}

/* ── QUOTE STATUS ACTION PILLS ─────────────────────────────────────── */
.detail-status-actions {
  display: flex;
  gap: 8px;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}

.btn-status-action {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 100px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  background: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.5;
}

.btn-status-action:active { transform: scale(0.96); }
.btn-status-action:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-status-won  { border-color: #16a34a; color: #16a34a; }
.btn-status-won:hover:not(:disabled)  { background: #f0fdf4; border-color: #15803d; color: #15803d; }

.btn-status-lost { border-color: #c0392b; color: #c0392b; }
.btn-status-lost:hover:not(:disabled) { background: #fef2f2; border-color: #a93226; color: #a93226; }

.btn-status-pending { border-color: var(--border); color: var(--text-3); }
.btn-status-pending:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); color: var(--text); }

/* ── BUTTONS ──────────────────────────────────────���────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 100px;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--text);
  color: white;
  flex: 1;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  flex: 1;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1.5px solid var(--border);
  flex: 1;
}

.btn-danger {
  background: transparent;
  color: #c0392b;
  border: 1.5px solid #c0392b;
}
.btn-danger:hover:not(:disabled) {
  background: #c0392b;
  color: white;
}
.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Form field styles are consolidated in the slide-over panel section below. */

/* ── TRADE CARD ────────────────────────────────────────────────────── */
.trade-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.trade-card:last-child { border-bottom: none; }

.trade-icon {
  width: 44px; height: 44px;
  background: var(--surface-2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.trade-body { flex: 1; }
.trade-name { font-weight: 600; font-size: 0.95rem; }
.trade-meta { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }

.trade-right { text-align: right; }
.trade-rate { font-weight: 700; font-size: 0.92rem; font-family: var(--font-mono); }
.trade-label { font-size: 0.7rem; color: var(--text-3); margin-top: 2px; }

/* ── CLIENT CARD ────────────────────────────────────────────────────── */
.client-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  cursor: pointer;
}

.client-item:not(:last-child) { border-bottom: 1px solid var(--border); }

.client-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  background: var(--accent-light);
  color: var(--accent);
}

/* ── BILLING ───────────────────────────────────────────────────────── */
.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--surface);
}

/* ── TEMPLATE GRID ─────────────────────────────────────────────────── */
.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.template-option {
  padding: 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--surface);
}

.template-option.is-active {
  border-color: var(--text);
  background: var(--accent-light);
}

.template-option-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.template-option-desc {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── DESIGN EDITOR ───────────────────────────────────────────────────── */
.design-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.color-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.color-swatch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; }

.hex-value {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-2);
  text-transform: uppercase;
  min-width: 56px;
  text-align: right;
}

.logo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  position: relative;
}

.logo-upload-area:hover {
  border-color: var(--text);
}

.logo-upload-area.has-logo {
  border-style: solid;
  border-color: var(--green);
}

.logo-preview {
  max-width: 120px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 6px;
}

.logo-upload-hint {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 6px;
}

/* Compact logo card (smaller "Your business logo" section) */
.logo-card {
  padding: 14px;
}

.logo-card-head {
  margin-bottom: 10px;
}

.logo-card-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.logo-upload-area--compact {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-upload-area--compact .logo-preview {
  max-width: 100%;
  max-height: 100%;
}

.logo-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.logo-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.logo-card-sub {
  font-size: 0.72rem;
  color: var(--text-3);
}

.logo-ai-btn {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--text);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.logo-ai-btn:hover { transform: translateY(-1px); }
.logo-ai-btn:active { transform: scale(0.97); }

.logo-ai-btn.is-cooldown,
.logo-ai-btn.is-loading {
  background: var(--text-3);
  cursor: not-allowed;
  opacity: 0.7;
}

.logo-ai-btn.is-cooldown:hover,
.logo-ai-btn.is-loading:hover { transform: none; }

.logo-ai-status {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 4px;
  min-height: 0;
}

.logo-ai-status.is-error { color: var(--red); }
.logo-ai-status.is-ok    { color: var(--green); }

.logo-upload-error {
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 4px;
}

.font-select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.design-preview {
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius-md);
  text-align: center;
}

.design-preview-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.design-preview-sample {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
}

/* ── EMPTY STATE ───────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  width: 64px; height: 64px;
  background: var(--surface-2);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.empty-sub {
  font-size: 0.87rem;
  color: var(--text-3);
  max-width: 240px;
  line-height: 1.5;
}

/* ── CHEVRON ───────────────────────────────────────────────────────── */
.chevron {
  color: var(--text-3);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.chevron.open { transform: rotate(90deg); }

/* ── INFO ROW ──────────────────────────────────────────────────────── */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  cursor: pointer;
  transition: background 0.12s;
}

.info-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.info-row:active { background: var(--bg); }

.info-row-left { display: flex; align-items: center; gap: 12px; }

.info-row-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}

.info-row-label { font-size: 0.92rem; font-weight: 500; }
.info-row-sub { font-size: 0.75rem; color: var(--text-3); margin-top: 1px; }

/* ── BOTTOM NAV (frosted pill + separate FAB) ────────────────────────── */
.bottom-nav-wrap {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.bottom-nav-wrap > * { pointer-events: auto; }

.bottom-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 60px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(26, 31, 23, 0.08);
  border-radius: 100px;
  box-shadow: 0 8px 24px -12px rgba(26, 31, 23, 0.22), 0 1px 2px rgba(26, 31, 23, 0.04);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 48px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  color: var(--text-3);
  transition: color 0.15s ease, transform 0.15s ease;
  padding: 0;
  border-radius: 100px;
}

.bottom-nav-item:active { transform: scale(0.94); }

.bottom-nav-item.is-active {
  color: var(--text);
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  transition: transform 0.15s ease;
}

.bottom-nav-item.is-active svg { transform: translateY(-1px); }

.bottom-nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Separate circular FAB on the right */
.bottom-nav-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 10px 24px -8px rgba(26, 31, 23, 0.4), 0 2px 4px rgba(26, 31, 23, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bottom-nav-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -8px rgba(26, 31, 23, 0.45), 0 2px 4px rgba(26, 31, 23, 0.1);
}

.bottom-nav-fab:active {
  transform: scale(0.94);
  box-shadow: 0 4px 12px -4px rgba(26, 31, 23, 0.35);
}

/* ── CREATE QUOTE CHOICE MODAL ───────────────────────────────────────── */
.create-choice-card {
  max-width: 440px;
  padding: 22px 22px 18px;
}

.create-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.create-choice-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.create-choice-row:hover {
  border-color: var(--text);
  background: var(--bg);
}

.create-choice-row:active { transform: scale(0.99); }

.create-choice-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.create-choice-icon-wa {
  background: rgba(37, 211, 102, 0.12);
  color: #128C7E;
}

.create-choice-body { flex: 1; min-width: 0; }

.create-choice-title {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  margin-bottom: 2px;
}

.create-choice-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  line-height: 1.4;
}

.create-choice-arrow {
  color: var(--text-3);
  flex-shrink: 0;
}

/* ── PROFILE HEADER ────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 16px;
  background: var(--surface);
}

.profile-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--text);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.profile-biz {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── DANGER ZONE ───────────────────────────────────────────────────── */
.danger-label { color: #C0392B; }

/* ── RESPONSIVE VISIBILITY UTILITIES ───────────────────────────────────
   IMPORTANT: These utilities only TOGGLE visibility. They never set an
   explicit `display` value, so elements like `.bottom-nav` (flex) and
   `.topbar-action` (inline-flex) keep their semantic layout when shown.
   ─────────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
}

@media (min-width: 768px) {
  .mobile-only { display: none !important; }

  .sidebar { display: flex; }

  .main-content { margin-left: 260px; }

  .portal-shell {
    padding: 96px 32px 40px;
    max-width: 760px;
  }
}

/* ── ANIMATIONS ────────────────────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-down {
  animation: slideDown 0.22s ease;
  overflow: hidden;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 400px; }
}

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease;
  transition: all 0.3s ease;
}

.toast.toast-exit {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-success .toast-icon { background: var(--green-bg); color: var(--green); }
.toast-error .toast-icon { background: var(--red-bg); color: var(--red); }
.toast-info .toast-icon { background: var(--accent-light); color: var(--accent); }

.toast-content { flex: 1; }
.toast-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.toast-message {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-top: 2px;
}

.toast-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}
.toast-close:hover { background: var(--surface-2); color: var(--text); }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

@media (max-width: 767px) {
  .toast-container {
    top: 16px;
    right: 16px;
    left: 16px;
    bottom: auto;
  }
  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* ── SLIDE-OVER PANEL ──────────────────────────────────────────────── */
.slide-over-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.slide-over-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.slide-over-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 640px;
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  z-index: 501;
}
.slide-over-backdrop.is-open .slide-over-panel {
  transform: translateX(0);
}

.slide-over-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.slide-over-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.slide-over-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: all 0.15s;
}
.slide-over-close:hover {
  background: var(--bg);
  color: var(--text);
}

.slide-over-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.slide-over-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.slide-over-footer .btn {
  padding: 11px 18px;
  font-size: 0.9rem;
  white-space: nowrap;
  flex-shrink: 0;
}

#quote-slide-cancel {
  margin-right: auto;
}

#quote-slide-submit {
  min-width: 148px;
}

/* Ghost button variant (Cancel) */
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-3);
}

/* Success panel — swaps in over the form body after PDF generation */
.quote-success-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 32px;
  text-align: center;
  gap: 12px;
  overflow-y: auto;
}

.success-check-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.success-heading {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.success-quote-number {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.success-sub {
  font-size: 0.875rem;
  color: var(--text-2);
  margin: 0;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin-top: 12px;
}

.success-actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 20px;
  font-size: 0.9rem;
  text-decoration: none;
}

#success-done-btn {
  margin-top: 4px;
}

/* Form Sections */
.form-section {
  margin-bottom: 28px;
}
.form-section:last-of-type {
  margin-bottom: 0;
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.field-label .required {
  color: var(--red);
  margin-left: 2px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--text);
  background: var(--surface);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

/* Line Items Table */
.line-items-header {
  display: grid;
  grid-template-columns: 1fr 100px 120px 44px;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.line-items-body {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.line-item-row {
  display: grid;
  grid-template-columns: 1fr 100px 120px 44px;
  gap: 12px;
  padding: 12px;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.line-item-row:last-child {
  border-bottom: none;
}

/* On desktop the label wrapper is invisible to the grid — children participate directly */
.line-field-wrap {
  display: contents;
}
.line-field-lbl {
  display: none;
}

.line-item-row input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
}
.line-item-row input:focus {
  border-color: var(--text);
  background: var(--surface);
}
.input-error {
  border-color: #e53935 !important;
  background: #fff5f5 !important;
}

.line-item-row input[type="number"] {
  font-family: var(--font-mono);
  text-align: right;
}

.line-item-row .item-total {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: right;
  padding-right: 8px;
}

.btn-remove-item {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-remove-item:hover {
  background: var(--red-bg);
  color: var(--red);
}

.btn-add-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-add-item:hover {
  border-color: var(--text);
  color: var(--text);
  background: var(--surface-2);
}

/* Totals Section */
.totals-section {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 8px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
}
.total-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}
.total-row:last-child {
  padding-top: 12px;
  margin-top: 4px;
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.total-label {
  color: var(--text-2);
  font-weight: 500;
}

.total-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}

.total-row.grand-total .total-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.total-row.grand-total .total-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.tax-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tax-input-wrapper input {
  width: 70px;
  padding: 6px 10px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.tax-input-wrapper input:focus {
  border-color: var(--text);
}

.tax-input-wrapper span {
  color: var(--text-3);
  font-size: 0.85rem;
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .slide-over-panel {
    max-width: none;
  }

  .slide-over-header,
  .slide-over-body,
  .slide-over-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .slide-over-footer {
    gap: 8px;
    flex-wrap: wrap;
  }

  /* Primary CTA: full-width top row on mobile */
  #quote-slide-submit {
    order: 1;
    width: 100%;
    flex: none;
    min-width: 0;
  }

  /* Save Draft + Cancel: share a row below the CTA */
  #quote-slide-save-draft {
    order: 2;
    flex: 1;
  }

  #quote-slide-cancel {
    order: 2;
    flex: 1;
    margin-right: 0;
  }

  /* Delete draft: full-width bottom row (only shown in draft mode) */
  #quote-slide-delete-draft {
    order: 3;
    width: 100%;
    flex: none;
  }

  .success-actions {
    max-width: none;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .line-items-header {
    display: none;
  }

  .line-item-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    background: var(--surface);
  }
  .line-item-row:last-child {
    border-bottom: 1px solid var(--border);
  }

  .line-item-row::before {
    content: attr(data-row-num);
    grid-column: 1 / -1;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
    display: block;
  }

  .line-item-row .line-description {
    grid-column: 1 / -1;
    padding: 12px;
    font-size: 1rem;
  }

  /* On mobile, show the field wrappers as labeled columns */
  .line-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .line-field-lbl {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .line-field-wrap input[type="number"] {
    padding: 12px;
    font-size: 1rem;
    width: 100%;
  }

  .btn-remove-item {
    grid-column: 1 / -1;
    justify-self: end;
    width: 44px;
    height: 44px;
  }

  .btn-add-item {
    width: 100%;
    padding: 14px;
    justify-content: center;
  }

  .totals-section {
    padding: 16px;
  }
}

/* ── MODAL ───────────────────────────────────────────���─────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto;
  padding: 24px;
}

@media (max-width: 767px) {
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .modal-card {
    max-width: none;
    max-height: 85vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 20px 16px;
  }
  .modal-header {
    padding: 0 0 16px 0;
  }
  .modal-title {
    font-size: 1.25rem;
  }
  .modal-close {
    width: 40px;
    height: 40px;
  }
  .modal-actions {
    gap: 12px;
  }
  .modal-actions .btn {
    padding: 14px;
    font-size: 1rem;
  }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; line-height: 1;
}
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.trade-actions {
  display: flex; gap: 8px; align-items: center;
}
.btn-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface-2); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: all 0.15s;
}
.btn-icon:hover { background: var(--accent-light); color: var(--text); }
.btn-icon.danger:hover { background: var(--red-bg); color: var(--red); }

/* ── TRADE MODAL (revamped) ──────────────────────────────────────────── */
.trade-modal-card {
  max-width: 520px;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.modal-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
}

.trade-modal-card .modal-header {
  padding: 22px 24px 16px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.trade-modal-card .modal-title {
  font-family: var(--font-serif, var(--font));
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.trade-modal-body {
  padding: 8px 24px 4px;
  overflow-y: auto;
  flex: 1;
}

.trade-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.trade-section:last-child { border-bottom: none; }

.trade-section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.trade-section-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
  font-family: var(--font);
}

.trade-section-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.trade-section-sub {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 2px;
}

.optional-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.field-help {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 6px;
  line-height: 1.45;
}

/* Icon picker */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}
@media (max-width: 520px) {
  .icon-picker { grid-template-columns: repeat(7, 1fr); }
}
.icon-chip {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: 10px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  padding: 0;
}
.icon-chip:hover { background: var(--accent-light); }
.icon-chip.is-active {
  background: var(--surface);
  border-color: var(--text);
  transform: scale(1.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Rate-type segmented chips */
.rate-segment {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
}
.rate-chip {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.rate-chip:hover { border-color: var(--text-3); }
.rate-chip.is-active {
  border-color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--text);
}
.rate-chip-icon {
  font-size: 1.05rem;
  margin-bottom: 2px;
}
.rate-chip-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}
.rate-chip-sub {
  font-size: 0.72rem;
  color: var(--text-3);
}

/* Rate input with currency prefix + suffix */
.rate-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.rate-input-wrap:focus-within {
  border-color: var(--text);
  background: var(--surface);
}
.rate-input-prefix,
.rate-input-suffix {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-3);
  font-size: 0.92rem;
  padding: 0 12px;
  white-space: nowrap;
}
.rate-input-prefix {
  border-right: 1px solid var(--border);
  color: var(--text);
}
.rate-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 13px 8px;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Toggle row */
.trade-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  margin-top: 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}
.trade-toggle-info { min-width: 0; }
.trade-toggle-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
}
.trade-toggle-sub {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.switch-track {
  display: block;
  width: 44px; height: 26px;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.18s ease;
  cursor: pointer;
}
.switch-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.18s ease;
}
.switch input:checked + .switch-track { background: var(--text); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Collapsible call-out field */
.collapsible.is-open {
  margin-top: 12px;
  animation: trade-collapse-in 0.18s ease;
}
@keyframes trade-collapse-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.trade-modal-footer {
  padding: 16px 24px 20px;
  margin-top: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  bottom: 0;
}
.trade-modal-footer .btn { flex: 1; padding: 13px; font-weight: 600; }

@media (max-width: 767px) {
  .trade-modal-card .modal-header { padding: 18px 18px 14px; }
  .trade-modal-body { padding: 4px 18px; }
  .trade-modal-footer { padding: 14px 18px 18px; }
}

/* ── PDF TEMPLATE PICKER (revamped) ─────────────────────────────────── */
.template-hero {
  display: flex;
  gap: 16px;
  align-items: stretch;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.template-hero-thumb {
  flex-shrink: 0;
  width: 104px;
}
.template-hero-thumb .tpl-thumb { aspect-ratio: 0.74; height: auto; }
.template-hero-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.template-hero-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.template-hero-name {
  font-family: var(--font-serif, var(--font));
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.template-hero-tagline {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 600;
  margin-top: 2px;
}
.template-hero-desc {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.5;
  margin-top: 6px;
}
@media (max-width: 480px) {
  .template-hero { flex-direction: column; }
  .template-hero-thumb { width: 100%; max-width: 160px; }
}

.template-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 640px) {
  .template-grid-3 { grid-template-columns: 1fr; gap: 12px; }
}

.template-option-rich {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.template-option-rich:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 6px 20px rgba(0,0,0,0.08));
}
.template-option-rich.is-active {
  border-color: var(--text);
  box-shadow: 0 0 0 4px var(--accent-light);
}

.template-badge {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--text);
  padding: 4px 7px;
  border-radius: 999px;
}

.template-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.template-option-rich .template-option-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.template-option-rich .template-option-desc {
  font-size: 0.74rem;
  color: var(--text-3);
}

.template-option-check {
  position: absolute;
  top: 10px; left: 10px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 2;
}
.template-option-rich.is-active .template-option-check {
  opacity: 1;
  transform: scale(1);
}

/* ── TEMPLATE THUMBNAILS ─────────────────────────────────────────────── */
.tpl-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 0.74; /* portrait */
  border-radius: 6px;
  overflow: hidden;
  font-size: 8px;
}

/* Mono Noir */
.tpl-mono {
  background: #ffffff;
  border: 1px solid #1a1a1a;
  padding: 14% 12%;
  display: flex;
  flex-direction: column;
  gap: 8%;
  font-family: Georgia, serif;
}
.tpl-mono-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tpl-mono-mark {
  display: block;
  width: 22%; height: 8px;
  background: #1a1a1a;
}
.tpl-mono-num {
  display: block;
  width: 28%; height: 6px;
  background: #1a1a1a;
  opacity: 0.4;
}
.tpl-mono-rule {
  height: 1px;
  background: #1a1a1a;
}
.tpl-mono-line {
  height: 4px;
  background: #1a1a1a;
  opacity: 0.7;
}
.tpl-mono-line.w70 { width: 70%; }
.tpl-mono-line.w90 { width: 90%; }
.tpl-mono-line.w50 { width: 50%; }
.tpl-mono-total {
  height: 14px;
  background: #1a1a1a;
  width: 50%;
  align-self: flex-end;
  margin-top: auto;
}

/* Forest Emerald */
.tpl-forest {
  background: #ffffff;
  display: flex;
  flex-direction: column;
}
.tpl-forest-hero {
  position: relative;
  height: 38%;
  background: linear-gradient(135deg, #14532d 0%, #166534 60%, #15803d 100%);
  display: flex;
  align-items: center;
  padding: 0 14%;
  overflow: hidden;
}
.tpl-forest-orb {
  position: absolute;
  top: -30%; right: -20%;
  width: 70%; aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 60%);
}
.tpl-forest-mark {
  display: block;
  width: 38%; height: 8px;
  background: #ffffff;
  border-radius: 2px;
}
.tpl-forest-badge {
  position: absolute;
  bottom: -14px; right: 12%;
  width: 28px; height: 28px;
  background: #ffffff;
  border: 2px solid #14532d;
  /* hexagonal-ish quote badge */
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.tpl-forest-rows {
  padding: 22% 14% 8%;
  display: flex;
  flex-direction: column;
  gap: 10%;
  flex: 1;
}
.tpl-forest-row {
  display: block;
  height: 4px;
  background: #14532d;
  border-radius: 2px;
  opacity: 0.85;
}
.tpl-forest-row.w80 { width: 80%; }
.tpl-forest-row.w60 { width: 60%; }
.tpl-forest-row.w70 { width: 70%; }
.tpl-forest-total {
  margin: 0 14% 14%;
  padding: 8px 10px;
  background: #14532d;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tpl-forest-total span {
  display: block;
  height: 4px;
  background: #ffffff;
  border-radius: 1px;
}
.tpl-forest-total span:first-child { width: 30%; }
.tpl-forest-total .tpl-forest-total-num { width: 36%; height: 6px; }

/* Solar Flare */
.tpl-solar {
  position: relative;
  background: #ffffff;
  padding: 14% 12%;
  display: flex;
  flex-direction: column;
  gap: 9%;
  font-family: 'Helvetica Neue', sans-serif;
}
.tpl-solar-corner {
  position: absolute;
  width: 22px; height: 22px;
  border: 2.5px solid #facc15;
}
.tpl-solar-corner.tl {
  top: 8px; left: 8px;
  border-right: none;
  border-bottom: none;
}
.tpl-solar-corner.br {
  bottom: 8px; right: 8px;
  border-left: none;
  border-top: none;
}
.tpl-solar-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tpl-solar-block {
  display: block;
  width: 20px; height: 20px;
  background: #facc15;
}
.tpl-solar-tag {
  display: block;
  flex: 1;
  height: 5px;
  background: #1a1a1a;
}
.tpl-solar-line {
  height: 4px;
  background: #1a1a1a;
}
.tpl-solar-line.w80 { width: 80%; }
.tpl-solar-line.w60 { width: 60%; }
.tpl-solar-line.w70 { width: 70%; }
.tpl-solar-total {
  margin-top: auto;
  height: 16px;
  background: #facc15;
  border-bottom: 3px solid #1a1a1a;
  width: 100%;
}

/* Preview CTA in design tab */
.design-preview-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}
.design-preview-cta-thumb {
  flex-shrink: 0;
  width: 84px;
}
.design-preview-cta-text {
  min-width: 0;
}
.design-preview-cta-title {
  font-family: var(--font-serif, var(--font));
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.design-preview-cta-desc {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.55;
  margin-top: 4px;
}
.design-preview-cta-desc strong {
  color: var(--text);
  font-weight: 600;
}

/* ── DESIGN SYSTEM ENHANCEMENTS ───────────────────────────────────────── */
body {
  background: linear-gradient(135deg, var(--bg) 0%, #f0ede4 100%);
}

/* Apply Fraunces serif font to display elements */
.view-title,
.hero-card-value,
.total-row.grand-total .total-value,
.quote-item-amount,
.trade-rate,
.stat-pill-value {
  font-family: var(--font-serif);
}

/* Backdrop blur for topbar */
.topbar {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
}

/* JetBrains Mono for numeric meta fields */
.quote-item-meta,
.trade-meta,
.stat-pill-label,
.detail-row .value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ── VIEW INTRO HEADER ─────────────────────────────────────────────────── */
.view-intro {
  margin-bottom: 20px;
}

.view-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 4px;
}

.view-lead {
  font-size: 0.9rem;
  color: var(--text-2);
  margin-bottom: 12px;
}

.view-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--accent-light);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

/* ── SEARCH TOOLBAR ───────────────────────────────────────────────────── */
.search-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.search-toolbar .dropdown-container {
  flex-shrink: 0;
}

/* ── PDF PREVIEW FRAME ─────────────────────────────────────────────────── */
.design-preview-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 16px;
}

.design-preview-frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.design-preview-frame-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}

.design-preview-frame-body {
  padding: 24px;
  background: #fff;
  min-height: 200px;
}

/* PDF Preview Mockup */
.pdf-preview-mockup {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
}

.pdf-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e5e5e5;
}

.pdf-preview-logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.pdf-preview-quote-number {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-2);
}

.pdf-preview-line-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid #f0f0f0;
}

.pdf-preview-line-item:last-child {
  border-bottom: none;
}

.pdf-preview-total {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid #e5e5e5;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ── BILLING USAGE ROW ───────────────────────────────────────────────── */
.usage-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 16px;
}

.usage-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.usage-metric {
  text-align: center;
}

.usage-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-serif);
  color: var(--text);
  margin-bottom: 4px;
}

.usage-metric-label {
  font-size: 0.75rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.usage-bar-container {
  margin-top: 12px;
}

.usage-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 6px;
}

.usage-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.usage-period {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 8px;
}

/* ── MOBILE RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 767px) {
  .view-title {
    font-size: 1.5rem;
  }

  .search-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input-wrapper {
    min-width: auto;
  }

  .search-toolbar .dropdown-container {
    width: 100%;
  }

  .usage-metrics {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .usage-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }

  .usage-metric-value {
    font-size: 1.25rem;
  }

  .design-preview-frame-body {
    padding: 16px;
  }

  .pdf-preview-mockup {
    padding: 16px;
  }
}

/* ── QUOTES TOOLBAR (search + funnel) ────────────────────────────────── */
.quotes-toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.quotes-toolbar .search-input-wrapper {
  flex: 1;
  min-width: 0;
}

.filter-icon-btn {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.filter-icon-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.filter-icon-btn:active { transform: scale(0.95); }

.filter-icon-btn.is-active {
  border-color: var(--text);
  color: var(--text);
  background: var(--surface-2);
}

.filter-icon-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #4d7c0f);
  border: 2px solid var(--surface);
}

.filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(280px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.04);
  padding: 6px;
  animation: filter-popover-in 0.12s ease-out;
}

@keyframes filter-popover-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.filter-popover[hidden] { display: none; }

.filter-popover-section { padding: 6px 4px 4px; }

.filter-popover-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 6px 10px 4px;
}

.filter-popover-list {
  display: flex;
  flex-direction: column;
}

.filter-popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  text-align: left;
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s ease;
}

.filter-popover-item:hover { background: var(--surface-2); }

.filter-popover-item.is-active {
  background: var(--surface-2);
  font-weight: 600;
}

.filter-popover-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.filter-popover-footer {
  padding: 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.filter-popover-reset {
  width: 100%;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.1s ease;
}

.filter-popover-reset:hover { background: var(--surface-2); color: var(--text); }

/* ── DESIGN: SIMPLIFIED STYLE PICKER ──────────────────────────────────── */
.design-view .style-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.style-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.style-card:hover {
  border-color: var(--text-2);
}

.style-card.is-active {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.style-swatch {
  flex: 0 0 auto;
  width: 56px;
  height: 70px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
  padding: 8px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 4px 10px rgba(26,31,23,0.08);
}

.style-swatch-bar {
  display: block;
  width: 100%;
  height: 10px;
  border-radius: 2px;
}

.style-swatch-line {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #e7e7e2;
}

.style-swatch-line.short { width: 60%; }

.style-swatch-block {
  display: block;
  margin-top: auto;
  width: 100%;
  height: 12px;
  border-radius: 3px;
}

/* Variant: Studio Noir (default — pure black & white) */
.style-swatch--mono { background: #ffffff; }
.style-swatch--mono .style-swatch-bar   { background: #0a0a0a; }
.style-swatch--mono .style-swatch-block { background: #0a0a0a; }
.style-swatch--mono .style-swatch-line  { background: #d9d9d4; }

/* Variant: Manhattan Gold (deep navy + warm gold accent) */
.style-swatch--forest { background: #f8f5ee; }
.style-swatch--forest .style-swatch-bar   { background: #0f1d3a; }
.style-swatch--forest .style-swatch-block { background: #c9a24a; }
.style-swatch--forest .style-swatch-line  { background: #d6cfb8; }

/* Variant: Voltage Lime (jet black + electric lime) */
.style-swatch--solar { background: #0a0a0a; }
.style-swatch--solar .style-swatch-bar   { background: #c6ff3a; }
.style-swatch--solar .style-swatch-block { background: #c6ff3a; }
.style-swatch--solar .style-swatch-line  { background: #2a2a2a; }

.style-card-meta {
  flex: 1;
  min-width: 0;
}

.style-card-name {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.style-card-tag {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-top: 2px;
}

.style-card-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.style-card.is-active .style-card-check {
  opacity: 1;
  transform: scale(1);
}

.logo-upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

/* ── PAYMENT PAGE / BILLING (mobile-first) ────────────────────────────── */
.pay-view { gap: 16px; }

.pay-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
}
.pay-alert svg { flex: 0 0 auto; margin-top: 2px; }
.pay-alert-title { font-weight: 600; font-size: 0.92rem; }
.pay-alert-sub { font-size: 0.82rem; opacity: 0.85; margin-top: 2px; }

.pay-balance {
  background: var(--text);
  color: var(--surface);
  padding: 18px 20px 20px;
  border-radius: 16px;
}
.pay-balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}
.pay-balance-plan {
  background: rgba(255,255,255,0.12);
  color: var(--surface);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}
.pay-balance-value {
  font-size: 2.4rem;
  font-weight: 700;
  margin-top: 6px;
  line-height: 1;
}
.pay-balance-sub {
  font-size: 0.85rem;
  margin-top: 6px;
  opacity: 0.8;
}

.pay-bundles {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 4px;
}

.pay-bundles-wrap {
  position: relative;
}

.pay-bundle {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 16px;
  row-gap: 4px;
  align-items: center;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--font);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.pay-bundle:hover {
  border-color: var(--text-2);
  transform: translateY(-1px);
}

.pay-bundle.is-featured {
  background: linear-gradient(160deg, #14532d 0%, #1f6b3d 100%);
  color: #ffffff;
  border: 2px solid #14532d;
  box-shadow: 0 12px 28px rgba(20, 83, 45, 0.22);
}
.pay-bundle.is-featured:hover { transform: translateY(-2px); border-color: #0f3d1e; }

.pay-bundle-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(26,31,23,0.18);
}
.pay-bundle.is-featured .pay-bundle-badge {
  background: #facc15;
  color: #1a1a1a;
}

.pay-bundle-head {
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 72px;
}
.pay-bundle.is-featured .pay-bundle-head {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}
.pay-bundle-quotes {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}
.pay-bundle-quotes-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3px;
  opacity: 0.7;
}

.pay-bundle-price {
  grid-column: 2;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.pay-bundle-currency {
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0.7;
  margin-right: 2px;
}
.pay-bundle-per {
  grid-column: 2;
  font-size: 0.8rem;
  opacity: 0.75;
}
.pay-bundle-tagline {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  margin-top: 6px;
  opacity: 0.85;
}
.pay-bundle-cta {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 11px 14px;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.pay-bundle.is-featured .pay-bundle-cta {
  background: #ffffff;
  color: #14532d;
}

.pay-trust {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: 12px;
}
.pay-trust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-2);
}
.pay-trust-row svg { flex: 0 0 auto; color: #14532d; }

.pay-usage { display: flex; flex-direction: column; gap: 8px; }
.pay-usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pay-usage-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}
.pay-usage-value { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.pay-usage-label { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; }

@media (min-width: 720px) {
  .pay-bundles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: stretch;
    overflow-x: visible;
    scroll-snap-type: none;
  }
  .pay-bundle {
    min-width: unset;
    scroll-snap-align: unset;
    flex-shrink: unset;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    text-align: center;
    padding: 22px 18px 18px;
  }
  .pay-bundle-head {
    grid-row: auto;
    grid-column: 1;
    align-self: center;
    justify-self: center;
    margin-bottom: 6px;
  }
  .pay-bundle-price,
  .pay-bundle-per,
  .pay-bundle-tagline,
  .pay-bundle-cta { grid-column: 1; }
  .pay-bundle-cta { justify-content: center; }
  .pay-bundles-wrap::after { display: none; }
}

/* ── PORTAL IMPROVEMENTS ─────────────────────────────────────────── */

/* Hero card action pill row (two side-by-side pills inside a hero-card) */
.hero-card-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.hero-pill {
  flex: 1;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  font-family: var(--font);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-pill:hover { background: rgba(255, 255, 255, 0.2); }
.hero-pill:active { transform: scale(0.98); }
.hero-pill[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Status badge shown next to the amount on each quote row */
.q-status-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  font-family: var(--font);
  line-height: 1.4;
}

.q-status-badge.badge-won     { background: #dcfce7; color: #15803d; }
.q-status-badge.badge-sent    { background: #dbeafe; color: #1d4ed8; }
.q-status-badge.badge-pending { background: var(--amber-bg); color: var(--amber); }
.q-status-badge.badge-lost    { background: var(--red-bg);   color: var(--red);   }

/* Invoice payment status badges */
.q-status-badge.badge-paid    { background: #dcfce7; color: #15803d; }
.q-status-badge.badge-unpaid  { background: #fef3c7; color: #b45309; }
.q-status-badge.badge-overdue { background: var(--red-bg);   color: var(--red);   }
.q-status-badge.badge-failed  { background: var(--red-bg);   color: var(--red);   }

/* ── REALISTIC QUOTE-DOC TEMPLATE THUMB ─────────────────────────────── */
.tpl-doc {
  position: relative;
  width: 100%;
  aspect-ratio: 0.74;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  font-size: 7px;
  line-height: 1.25;
  padding: 9% 9% 8%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  color: #1a1a1a;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.tpl-doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7%;
}
.tpl-doc-brand {
  display: flex; align-items: center; gap: 5px;
}
.tpl-doc-logo {
  width: 14px; height: 14px;
  border-radius: 3px;
  background: #1a1a1a;
  flex-shrink: 0;
}
.tpl-doc-biz {
  font-weight: 700;
  font-size: 8px;
  letter-spacing: 0.02em;
}
.tpl-doc-tag {
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 2px 5px;
  background: #1a1a1a;
  color: #ffffff;
  border-radius: 2px;
}
.tpl-doc-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6%;
  gap: 8px;
}
.tpl-doc-meta-col { flex: 1; min-width: 0; }
.tpl-doc-meta-label {
  font-size: 5.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b6b6b;
  margin-bottom: 1px;
}
.tpl-doc-meta-value {
  font-weight: 600;
  font-size: 7px;
}
.tpl-doc-billto {
  margin-bottom: 7%;
}
.tpl-doc-billto-label {
  font-size: 5.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b6b6b;
  margin-bottom: 1px;
}
.tpl-doc-billto-name {
  font-weight: 600;
  font-size: 7px;
}
.tpl-doc-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: auto;
  padding-bottom: 6%;
}
.tpl-doc-thead,
.tpl-doc-tr {
  display: flex;
  justify-content: space-between;
  font-size: 6.5px;
}
.tpl-doc-thead {
  font-size: 5.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b6b6b;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(0,0,0,0.15);
  margin-bottom: 2px;
}
.tpl-doc-tr {
  padding: 2px 0;
  border-bottom: 1px dotted rgba(0,0,0,0.08);
}
.tpl-doc-tr span:first-child { color: #2a2a2a; }
.tpl-doc-tr span:last-child  { font-weight: 600; }
.tpl-doc-totals {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tpl-doc-subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 6.5px;
  color: #6b6b6b;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0,0,0,0.15);
}
.tpl-doc-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  font-weight: 800;
  padding: 4px 6px;
  margin-top: 3px;
  background: #1a1a1a;
  color: #ffffff;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

/* Variant: Mono Noir (B&W serif, restrained) */
.tpl-doc-mono { font-family: Georgia, 'Times New Roman', serif; }
.tpl-doc-mono .tpl-doc-tag { background: #1a1a1a; }
.tpl-doc-mono .tpl-doc-logo { border-radius: 0; }
.tpl-doc-mono .tpl-doc-total { background: #1a1a1a; }

/* Variant: Manhattan Gold (deep navy + warm gold) */
.tpl-doc-forest .tpl-doc-logo { background: #0f1d3a; }
.tpl-doc-forest .tpl-doc-tag {
  background: #0f1d3a;
  color: #c9a24a;
}
.tpl-doc-forest .tpl-doc-total {
  background: #0f1d3a;
  color: #c9a24a;
}
.tpl-doc-forest .tpl-doc-thead { color: #0f1d3a; }
.tpl-doc-forest .tpl-doc-tr span:last-child { color: #0f1d3a; }

/* Variant: Voltage Lime (jet black + electric lime) */
.tpl-doc-solar { background: #ffffff; }
.tpl-doc-solar .tpl-doc-logo { background: #c6ff3a; }
.tpl-doc-solar .tpl-doc-tag {
  background: #0a0a0a;
  color: #c6ff3a;
}
.tpl-doc-solar .tpl-doc-total {
  background: #c6ff3a;
  color: #0a0a0a;
  border-bottom: 2px solid #0a0a0a;
}
.tpl-doc-solar .tpl-doc-thead { color: #0a0a0a; }

/* ── PROFILE AVATAR (with edit / camera badge) ─────────────────────── */
.profile-avatar-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.profile-avatar-btn {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: var(--text);
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.profile-avatar-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.profile-avatar-btn:active { transform: translateY(0); }
.profile-avatar-btn:focus-visible {
  outline: 2px solid var(--brand, #1A9E5F);
  outline-offset: 3px;
}
.profile-avatar-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #f4f4f4;
}
.profile-avatar-initial {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.profile-avatar-edit {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--brand, #1A9E5F);
  color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface, #ffffff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.profile-avatar-hint {
  font-size: 0.7rem;
  color: var(--text-3);
  white-space: nowrap;
}

/* ── TRADE-TYPE DROPDOWN + EMPTY RATE-SEGMENT HINT ──────────────────── */
.rate-segment-empty {
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-3);
  background: var(--surface-2, #f6f6f6);
  border: 1px dashed var(--border, #e5e5e5);
  border-radius: 10px;
}

/* ── OPTIONAL EXTRAS LIST ──────────────────────────────────────────── */
.trade-extras-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trade-extra-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2, #f6f6f6);
  border: 1px solid var(--border, #ececec);
  border-radius: 10px;
}
.trade-extra-row.trade-extra-check {
  cursor: pointer;
}
.trade-extra-row.trade-extra-check input[type="checkbox"] {
  width: 18px; height: 18px;
  flex-shrink: 0;
  accent-color: var(--brand, #1A9E5F);
  cursor: pointer;
}
.trade-extra-row.trade-extra-check span {
  font-size: 0.88rem;
  color: var(--text);
}
.trade-extra-label {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
}
.trade-extra-row input[type="number"] {
  width: 90px;
  padding: 8px 10px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--surface, #ffffff);
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.trade-extra-row input[type="number"]:focus {
  outline: none;
  border-color: var(--brand, #1A9E5F);
  box-shadow: 0 0 0 2px rgba(26,158,95,0.12);
}

/* ── ACTIVE TRADES: "Set your rate" pill, primary tag, limit hint ──── */
.trade-set-rate-pill {
  display: inline-block;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 999px;
  background: #FFF7E5;
  color: #B07C00;
  border: 1px solid #F2D38C;
  white-space: nowrap;
}
.trade-tag-primary {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(26,158,95,0.12);
  color: var(--brand, #1A9E5F);
  vertical-align: middle;
}
.trade-limit-hint {
  margin-top: 14px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-3);
  padding: 10px 16px;
}

/* ── PILL OPTIONS (questionnaire multi/single-select) ───────────────── */
.pill-options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill-option {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.pill-option:hover { border-color: var(--text-3); }
.pill-option.is-active {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

/* ── TRADE CARD DETAILS (charges + materials) ──────────────────────── */
.trade-card--detailed {
  display: block;
  padding: 16px;
}
.trade-card--detailed .trade-card-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
}
.trade-card--detailed .trade-body { min-width: 0; }
.trade-card-details {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trade-detail-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}
.trade-detail-label {
  flex-shrink: 0;
  min-width: 90px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding-top: 5px;
}
.trade-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.trade-detail-tag {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Design tab: logo inside the preview thumb ─────────────────────── */
.tpl-doc-logo--img {
  background: transparent;
  overflow: hidden;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}
.tpl-doc-logo--img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Design tab: auto-save status hint ─────────────────────────────── */
.design-autosave-hint {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-3);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  min-height: 1em;
}
.design-autosave-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Design tab: live PDF preview iframe ───────────────────────────── */
.design-preview-card {
  margin-top: 16px;
  padding: 18px;
}
.design-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.design-preview-sub {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.4;
  max-width: 460px;
}
.design-preview-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-2, #f5f5f5);
  border: 1px solid var(--border-1, #e2e2e2);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}
.design-preview-refresh:hover {
  background: var(--bg-3, #ececec);
  color: var(--text-1);
}
.design-preview-refresh:active {
  transform: translateY(1px);
}
.design-preview-frame-wrap {
  position: relative;
  width: 100%;
  /* A4 aspect ratio (210 × 297) — keeps the on-screen frame proportional
     to the printed PDF the user will eventually download. */
  aspect-ratio: 210 / 297;
  background: #f5f5f5;
  border: 1px solid var(--border-1, #e2e2e2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.design-preview-iframe {
  /* Render the iframe at the PDF template's logical A4 size (210mm @
     96dpi ≈ 794×1123 CSS px) and then scale it down to fit the column
     with transform:scale(). Without this the iframe content overflows
     the narrow design column and the user sees a zoomed-in fragment. */
  position: absolute;
  top: 0;
  left: 0;
  width: 794px;
  height: 1123px;
  border: 0;
  display: block;
  background: #ffffff;
  transform-origin: top left;
  transform: scale(var(--preview-scale, 1));
  /* Avoid the brief mis-scaled flash before the JS observer measures. */
  visibility: var(--preview-vis, hidden);
}
.design-preview-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(245, 245, 245, 0.92);
  backdrop-filter: blur(2px);
  z-index: 2;
  pointer-events: none;
}
.design-preview-loader[hidden] {
  display: none;
}
.design-preview-loader-text {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 4px;
}
.design-preview-loader-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  animation: dpd 1.1s ease-in-out infinite;
  opacity: 0.4;
  display: inline-block;
}
.design-preview-loader-dot:nth-child(1) { animation-delay: 0s; }
.design-preview-loader-dot:nth-child(2) { animation-delay: 0.18s; }
.design-preview-loader-dot:nth-child(3) { animation-delay: 0.36s; }
.design-preview-loader {
  flex-direction: row;
}
.design-preview-loader-text {
  position: absolute;
  bottom: 36%;
  left: 0;
  right: 0;
  text-align: center;
}
@keyframes dpd {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}
.design-preview-error {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff3f3;
  border: 1px solid #f3c4c4;
  border-radius: 8px;
  color: #9a2222;
  font-size: 0.82rem;
  line-height: 1.4;
}
.design-preview-foot {
  margin-top: 10px;
  font-size: 0.74rem;
  color: var(--text-3);
  line-height: 1.45;
}
@media (max-width: 640px) {
  .design-preview-card {
    padding: 14px;
  }
  .design-preview-head {
    flex-direction: column;
    align-items: stretch;
  }
  .design-preview-refresh {
    align-self: flex-end;
  }
}

/* ── Quotes hero: long horizontal "Top up" CTA ─────────────────────── */
.hero-topup-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  color: #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.hero-topup-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.34);
}
.hero-topup-btn:active { transform: scale(0.995); }
.hero-topup-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  color: #ffffff;
}
.hero-topup-text {
  flex: 1 1 auto;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.hero-topup-meta {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.85;
  white-space: nowrap;
}

/* ── LOGO OPTIONS DIALOG ─────────────────────────────────────────── */
.logo-options-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 18, 22, 0.55);
  backdrop-filter: blur(6px);
  animation: logoOptFade 160ms ease-out;
}
@keyframes logoOptFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.logo-options-card {
  background: var(--surface, #ffffff);
  border-radius: 20px;
  width: 100%;
  max-width: 360px;
  padding: 24px 22px 20px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: logoOptPop 180ms cubic-bezier(.2,.9,.3,1.2);
}
@keyframes logoOptPop {
  from { transform: translateY(8px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
.logo-options-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text, #1a1f17);
  margin-bottom: 6px;
}
.logo-options-sub {
  font-size: 0.85rem;
  color: var(--text-3, #6b7280);
  margin-bottom: 18px;
  line-height: 1.4;
}
.logo-options-preview {
  width: 130px;
  height: 130px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background: var(--surface-2, #f5f5f3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
}
.logo-options-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #ffffff;
}
.logo-options-initial {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-3, #6b7280);
}
.logo-options-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.logo-options-btn {
  width: 100%;
  padding: 12px 18px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.logo-options-btn.primary {
  background: var(--text, #1a1f17);
  color: #ffffff;
}
.logo-options-btn.secondary {
  background: var(--surface-2, #f5f5f3);
  color: var(--text, #1a1f17);
}
.logo-options-btn:hover { transform: translateY(-1px); }
.logo-options-btn:active { transform: translateY(0); opacity: 0.9; }
.logo-options-btn:focus-visible {
  outline: 2px solid var(--text, #1a1f17);
  outline-offset: 2px;
}

/* ── FIX #3: Quote draft banner ───────────────────────────────────── */
#quote-draft-banner {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  margin: 12px 16px 0;
}

/* ── FIX #4: Logo payment modal CSS classes ───────────────────────── */
.logo-modal-card { max-width: 400px; }

.logo-modal-body {
  padding: 0 20px 8px;
}
.logo-modal-description {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 16px;
}
.logo-modal-price-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.logo-modal-price-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.logo-modal-price-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
.logo-modal-price-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.logo-modal-credit-notice {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 16px;
}
.logo-modal-actions {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.logo-modal-actions .btn { width: 100%; }

/* ── FIX #9: Payment methods row ─────────────────────────────────── */
.pay-methods {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.pay-methods-label {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}
.pay-methods-logos {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pay-method-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ── FIX #12: FAB tooltip on first visit ─────────────────────────── */
.bottom-nav-fab {
  position: relative;
}
.bottom-nav-fab.is-hinted::after {
  content: 'New quote';
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--font);
  font-weight: 500;
}
.bottom-nav-fab.is-hinted::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
  pointer-events: none;
}

/* ── FIX #1 & #6: Billing confirm modal & empty state CTA ─────────── */
.billing-confirm-card { max-width: 420px; }
.billing-confirm-body { padding: 0 20px 8px; }
.billing-confirm-actions {
  padding: 12px 20px 20px;
  display: flex;
  gap: 10px;
}

.empty-state-cta {
  margin-top: 16px;
}

/* ── FIX #6: Empty state SVG icons ───────────────────────────────── */
.empty-state-icon {
  width: 52px;
  height: 52px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: var(--text-3);
}

/* ── SHARE QUOTE MODAL ────────────────────────────────────────────── */
.share-modal-card {
  max-width: 440px;
  width: 100%;
}

.share-modal-body {
  padding: 0 20px 4px;
}

.share-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  color: var(--text-2);
  font-size: 0.875rem;
}

.share-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: share-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes share-spin { to { transform: rotate(360deg); } }

.share-modal-desc {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 16px;
}

.share-url-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.share-url-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-mono), monospace;
  background: var(--surface-2);
  color: var(--text);
  cursor: text;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-url-input:focus { outline: 2px solid var(--accent); }

.share-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.share-copy-btn.is-copied {
  background: var(--accent-light);
  color: var(--accent);
  border-color: transparent;
}

.share-actions-row {
  margin-bottom: 20px;
}

.share-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.share-whatsapp-btn:hover { opacity: 0.88; }

.share-qr-section {
  text-align: center;
  padding: 16px 0 8px;
  border-top: 1px solid var(--border);
}

.share-qr-label {
  font-size: 0.78rem;
  color: var(--text-3);
  margin-bottom: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.share-qr-img {
  width: 160px;
  height: 160px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  margin: 0 auto;
  background: #fff;
}

.share-expiry-note {
  font-size: 0.78rem;
  color: var(--text-3);
  text-align: center;
  padding: 10px 0 4px;
}

.share-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  color: var(--red);
  font-size: 0.875rem;
}

.share-modal-footer {
  padding: 12px 20px 20px;
}

/* Share button in quote detail */
.btn-share-quote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 480px) {
  .share-modal-card { max-width: 100%; }
  .share-url-row { flex-direction: column; }
  .share-copy-btn { justify-content: center; }
}
