/* ============== RESET & BASE ============== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e6e8ec;
  --border-strong: #d4d7dd;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-soft: #9aa0a8;

  --brand: #4A8EC4;
  --brand-dark: #3a73a3;
  --brand-soft: #e8f1f8;
  --brand-accent: #6db3e8;

  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);

  --font-display: 'Oswald', sans-serif;
  --font-body: 'Oswald', sans-serif;
}

html, body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
input, textarea, select { outline: none; }

.hidden { display: none !important; }

/* ============== BOOT ============== */
.boot {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #f5f6f8 0%, #e8f1f8 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.boot-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  text-align: center;
}

.boot-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: block;
}

.boot-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.boot-sub {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}

.boot-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 3px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== APP SHELL ============== */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* ============== SIDEBAR ============== */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-logo { width: 44px; height: 44px; flex-shrink: 0; }
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: 0.08em; }
.brand-tag { font-size: 11px; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  text-align: left;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 500; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.nav-item.active .nav-dot { opacity: 1; }

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.05em;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.signout-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.signout-btn:hover { background: var(--border); color: var(--danger); }

/* ============== MAIN ============== */
.main { padding: 32px 40px; max-width: 1400px; width: 100%; }

.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.view-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.view-title { font-family: var(--font-display); font-size: 30px; font-weight: 500; letter-spacing: 0.02em; }
.view-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ============== BUTTONS ============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #d63838; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.link-btn { color: var(--brand); font-size: 13px; font-weight: 500; }
.link-btn:hover { color: var(--brand-dark); }

/* ============== CARDS ============== */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 20px; }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
  gap: 12px;
}
.card-head h3 { font-family: var(--font-display); font-size: 18px; font-weight: 500; letter-spacing: 0.03em; }
.sub-head { font-family: var(--font-display); font-size: 15px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }
.help-text { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.help-text code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 12px; }

/* ============== STATS ============== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-accent));
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.stat-value { font-family: var(--font-display); font-size: 36px; font-weight: 500; letter-spacing: 0.02em; line-height: 1; }
.stat-foot { font-size: 12px; color: var(--text-soft); margin-top: 6px; }

/* ============== DASH GRID ============== */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.recent-item:hover { border-color: var(--brand-accent); }
.recent-name { font-weight: 500; }
.recent-meta { font-size: 12px; color: var(--text-muted); }

.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  transition: all 0.15s;
}
.quick-btn:hover { background: var(--brand-soft); border-color: var(--brand-accent); transform: translateX(2px); }
.qa-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand); color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 20px; font-weight: 500;
  flex-shrink: 0;
}
.qa-title { font-weight: 500; font-size: 14px; }
.qa-sub { font-size: 12px; color: var(--text-muted); }

/* ============== FORMS ============== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field select, .field textarea {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(74, 142, 196, 0.12);
}
.field textarea { resize: vertical; min-height: 80px; font-family: inherit; }

.field-row { display: flex; gap: 8px; align-items: center; }
.field-row input { flex: 1; }

.checkbox-field {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.checkbox-field span { font-size: 14px; }

.onboard-form { display: flex; flex-direction: column; gap: 24px; }

.form-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
}
.form-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 8px 0; }

/* ============== TABLES ============== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead {
  background: var(--surface-2);
}
.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--surface-2); }

.empty-row, .empty { text-align: center; color: var(--text-muted); font-size: 14px; padding: 40px 20px; }

.row-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: #fee; color: var(--danger); }

.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge.green { background: #e6f7ef; color: #047857; }
.badge.gray { background: var(--surface-2); color: var(--text-muted); }

.search-input {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  width: 240px;
}
.search-input:focus { border-color: var(--brand); }

/* ============== PRICING ============== */
.pricing-grid { display: grid; gap: 20px; }

.calc-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, var(--brand-soft), #f5f9fc);
  border-radius: var(--radius);
  border: 1px solid var(--brand-accent);
}
.calc-result {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--brand-dark);
  padding: 6px 0;
}

/* ============== CONTACT SHEET ============== */
.contact-page {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 48px;
  max-width: 850px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.contact-header {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--brand-soft);
}
.contact-logo {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  color: white;
  flex-shrink: 0;
}
.contact-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius); }
.contact-co-name { font-family: var(--font-display); font-size: 36px; font-weight: 600; letter-spacing: 0.1em; color: var(--brand-dark); }
.contact-co-sub { color: var(--text-muted); font-size: 14px; letter-spacing: 0.05em; text-transform: uppercase; }

.contact-section-title {
  background: var(--brand-accent);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  margin: 24px 0 12px;
}

.contact-table { width: 100%; border-collapse: collapse; }
.contact-table th, .contact-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.contact-table th {
  background: var(--surface-2);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
}
.contact-table td { text-align: center; }

.offerings-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.offering-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
}
.offering-item:nth-child(2n) { border-right: none; }
.offering-item:last-child, .offering-item:nth-last-child(2):nth-child(odd) { border-bottom: none; }

/* ============== ADMIN ============== */
.admin-fields-list { display: flex; flex-direction: column; gap: 8px; }
.admin-field-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin-field-row.locked { opacity: 0.85; }
.admin-field-handle {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft);
  font-size: 14px;
}
.admin-field-label { font-weight: 500; font-size: 14px; }
.admin-field-type { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.admin-field-section {
  font-size: 11px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ============== MODAL ============== */
.modal-root {
  position: fixed; inset: 0;
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; margin-bottom: 20px; letter-spacing: 0.03em; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ============== TOAST ============== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: var(--text);
  color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  z-index: 600;
  animation: toastIn 0.25s ease;
  max-width: 360px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ============== RESPONSIVE ============== */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .nav-item { flex: 1 1 calc(50% - 4px); }
  .main { padding: 20px; }
  .calc-controls { grid-template-columns: 1fr; }
  .offerings-list { grid-template-columns: 1fr; }
  .offering-item { border-right: none !important; }
}

/* ============== PRINT ============== */
@media print {
  .sidebar, .view-header, body > *:not(#app), .app > .sidebar { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; }
  .view:not(#view-contact) { display: none !important; }
  .contact-page { box-shadow: none; border: none; padding: 0; }
}

/* ============== AUTO-CALC RATE FIELD ============== */
.auto-rate-field { position: relative; }
.auto-rate-display {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px dashed var(--brand-accent);
  background: var(--brand-soft);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--brand-dark);
  letter-spacing: 0.02em;
}
.auto-rate-field > span::after {
  content: 'auto';
  margin-left: 8px;
  font-size: 9px;
  padding: 2px 7px;
  background: var(--brand);
  color: white;
  border-radius: 999px;
  letter-spacing: 0.1em;
  vertical-align: middle;
}

/* ============== COMPLIANCE DETAILS ============== */
.compliance-details-wrap {
  background: #fff8e6;
  border: 1px solid #f5d684;
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 4px;
}
.compliance-details-wrap > span { color: #946700; }
.compliance-details-wrap textarea {
  background: white;
  border-color: #f5d684;
}

/* ============== PARTS MARKUP FIELD ============== */
.parts-markup-field { gap: 12px; }

.parts-markup-toggle {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  border: 1px solid var(--border);
  width: fit-content;
}
.radio-pill {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.radio-pill span {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  transition: all 0.15s;
}
.radio-pill input:checked + span {
  background: var(--brand);
  color: white;
}

.parts-markup-percent {
  max-width: 280px;
}

/* ============== TIER TABLE ============== */
.tier-table-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
}
.tier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 700px;
}
.tier-table th, .tier-table td {
  padding: 10px 8px;
  text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tier-table th:last-child, .tier-table td:last-child { border-right: none; }
.tier-table thead th {
  background: var(--surface-2);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.tier-table .bucket-head {
  background: linear-gradient(180deg, var(--brand-soft), #f5f9fc);
  color: var(--brand-dark);
}

.tier-label-cell {
  background: var(--surface-2);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: left;
  padding-left: 14px;
  min-width: 110px;
}

.tier-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.tier-radio-label input { accent-color: var(--brand); width: 16px; height: 16px; }
.tier-radio-label span { font-size: 13px; }

/* Heatmap colors based on the screenshot */
.tier-cell.tier-4 { background: #c5e8c5; }
.tier-cell.tier-3 { background: #d8edc0; }
.tier-cell.tier-2 { background: #f3eab6; }
.tier-cell.tier-1 { background: #f7d9a8; }
.tier-cell.tier-4:nth-child(n+6) { background: #f6e0a5; }
.tier-cell.tier-3:nth-child(n+6) { background: #f4cea0; }
.tier-cell.tier-2:nth-child(n+6) { background: #f2bd9a; }
.tier-cell.tier-1:nth-child(n+6) { background: #efa68d; }
.tier-cell.tier-4:nth-child(n+8) { background: #ec9b87; }
.tier-cell.tier-3:nth-child(n+8) { background: #e88c7c; }
.tier-cell.tier-2:nth-child(n+8) { background: #e58273; }
.tier-cell.tier-1:nth-child(n+8) { background: #e3756a; }

.tier-row.selected {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}
.tier-row:hover .tier-label-cell {
  background: var(--brand-soft);
}

.tier-table-edit .tier-input {
  width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.7);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}
.tier-table-edit .tier-input:focus {
  border-color: var(--brand);
  background: white;
}

/* ============== MISC CHARGES FIELD ============== */
.misc-charges-field .misc-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.misc-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 140px 2fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.misc-row:has(.misc-applicable:checked) {
  background: #eef6fb;
  border-color: var(--brand-accent);
}
.misc-row-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.misc-row-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}
.misc-row-name {
  font-weight: 500;
  font-size: 14px;
}
.misc-row-amount {
  display: flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0 0 10px;
}
.misc-row-prefix {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
}
.misc-amount-input {
  border: none !important;
  padding: 8px 10px !important;
  background: transparent !important;
  width: 100%;
  font-size: 14px;
  outline: none !important;
  box-shadow: none !important;
}
.misc-row-reason {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .misc-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ============== WIZARD ============== */
.wizard {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}

.wizard-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 12px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  transition: all 0.15s;
  border: 1px solid transparent;
}
.wizard-step:hover { background: var(--surface-2); color: var(--text); }
.wizard-step.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 500;
  border-color: var(--brand-accent);
}
.wizard-step.done {
  color: var(--success);
}
.wizard-step.done .wizard-step-num {
  background: var(--success);
  color: white;
}

.wizard-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.wizard-step.active .wizard-step-num {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.wizard-step-label { font-size: 13px; }

.wizard-body {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
}
.wizard-body #onboard-form {
  padding: 28px;
}
.wizard-body .form-section {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 24px;
}
.wizard-body .form-section:last-child {
  margin-bottom: 0;
}

.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  gap: 16px;
}

.wizard-progress {
  display: flex;
  gap: 6px;
}
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.2s;
}
.progress-dot.filled {
  background: var(--brand);
  transform: scale(1.1);
}

.btn-success {
  background: var(--success) !important;
}
.btn-success:hover {
  background: #0e9971 !important;
}

@media (max-width: 880px) {
  .wizard { grid-template-columns: 1fr; }
  .wizard-steps {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
  }
  .wizard-step { flex-shrink: 0; }
}

/* ============== REVIEW STEP ============== */
.review-section {
  margin-bottom: 20px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}
.review-section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-dark);
  margin-bottom: 10px;
}
.review-table {
  width: 100%;
  border-collapse: collapse;
}
.review-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.review-table tr:last-child td { border-bottom: none; }
.review-label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 40%;
  padding-right: 16px !important;
}
.review-value {
  font-weight: 500;
  font-size: 14px;
}

/* ============== ADMIN SUB-NAV ============== */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.admin-subnav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 12px;
  position: sticky;
  top: 24px;
}

.admin-subnav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-muted);
  text-align: left;
  transition: all 0.15s;
}
.admin-subnav-item:hover { background: var(--surface-2); color: var(--text); }
.admin-subnav-item.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 500;
}

.admin-tab { display: none; }
.admin-tab.active { display: block; animation: fadeIn 0.2s ease; }

@media (max-width: 880px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-subnav { position: static; flex-direction: row; overflow-x: auto; }
  .admin-subnav-item { flex-shrink: 0; }
}

/* ============== CENTERED CONTACT SHEET ============== */
.contact-header-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--brand-soft);
}

.logo-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg);
  transition: all 0.15s;
  position: relative;
}
.logo-upload-zone.drag-over {
  background: var(--brand-soft);
  outline: 2px dashed var(--brand);
  outline-offset: 4px;
}

.logo-display {
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
  border: none;
}
.logo-display img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.logo-display svg {
  width: 200px;
  height: 200px;
}

.logo-upload-btn, .logo-remove-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  transition: all 0.15s;
}
.logo-upload-btn {
  background: var(--brand);
  color: white;
}
.logo-upload-btn:hover { background: var(--brand-dark); }
.logo-remove-btn {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.logo-remove-btn:hover {
  background: #fee;
  color: var(--danger);
  border-color: var(--danger);
}

.contact-co-name-centered {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--brand-dark);
  text-align: center;
  margin: 0;
}

.contact-subtitle {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

@media print {
  .logo-upload-btn, .logo-remove-btn { display: none; }
  .logo-upload-zone { padding: 0; }
}

/* ============== MODAL WIDE ============== */
.modal.wide {
  max-width: 760px;
}

/* ============== PORTAL NAME / COMPLIANCE DETAILS shared style ============== */
.portal-name-wrap {
  background: #fff8e6;
  border: 1px solid #f5d684;
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 4px;
}
.portal-name-wrap > span { color: #946700; }
.portal-name-wrap input { background: white; border-color: #f5d684; }
