/* =============================================================================
   CRM stylesheet — staff-facing internal app
   Different visual feel from customer site: denser, utilitarian, but on-brand.
   ============================================================================= */

:root {
  --c-primary:     #0072BC;
  --c-primary-dk:  #005a96;
  --c-accent:      #C8102E;
  --c-accent-dk:   #a30c25;
  --c-yellow:      #ffcc00;
  --c-navy:        #0a1628;

  --c-text:        #0a1628;
  --c-text-muted:  #4a5568;
  --c-text-light:  #6b7280;
  --c-text-lighter:#9ca3af;

  --c-bg:          #f7f9fc;
  --c-card:        #ffffff;
  --c-border:      #d1d9e6;
  --c-border-soft: #e5ebf3;

  --container-max: 1280px;
  --radius:        6px;
  --radius-lg:     8px;

  --font-stack: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.05);
  --shadow:    0 2px 8px rgba(10, 22, 40, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-stack);
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.num { text-align: right; }

/* =============================================================================
   Auth screen (login)
   ============================================================================= */
body.crm-auth {
  background: linear-gradient(135deg, var(--c-navy) 0%, #1a2740 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.crm-login-page { width: 100%; max-width: 420px; }
.crm-login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}
.crm-login-brand {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 28px;
  justify-content: center;
}
.crm-brand-mark {
  font-size: 26px;
  font-weight: 700;
  color: var(--c-primary);
  letter-spacing: -0.02em;
}
.crm-brand-text {
  font-size: 26px;
  font-weight: 600;
  color: var(--c-navy);
  letter-spacing: 0.04em;
}
.crm-login-card h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-align: center;
  margin-bottom: 24px;
}
.crm-form { display: flex; flex-direction: column; gap: 14px; }
.crm-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--c-text); }
.crm-form input {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--c-text);
}
.crm-form input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(0, 114, 188, 0.15);
}
.crm-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border: 0;
  text-align: center;
  transition: background 0.15s;
}
.crm-btn--primary { background: var(--c-primary); color: #fff; }
.crm-btn--primary:hover { background: var(--c-primary-dk); }
.crm-btn--ghost { background: #fff; color: var(--c-primary); border: 1px solid var(--c-primary); }
.crm-login-meta {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--c-border-soft);
  font-size: 11px;
  color: var(--c-text-light);
  text-align: center;
}

.crm-alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.crm-alert--error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* =============================================================================
   Shell (logged in)
   ============================================================================= */
body.crm-shell { padding-bottom: 60px; }

.crm-topbar {
  background: var(--c-navy);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.crm-topbar .crm-brand {
  display: flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
}
.crm-topbar .crm-brand-mark { color: var(--c-primary); font-size: 18px; }
.crm-topbar .crm-brand-text { color: #fff; font-size: 18px; }
.crm-tabs {
  display: flex;
  align-items: stretch;
  flex: 1;
  height: 100%;
}
.crm-tab {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #ccd4dd;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  height: 100%;
}
.crm-tab:hover { color: #fff; text-decoration: none; }
.crm-tab.is-active { color: var(--c-yellow); border-bottom-color: var(--c-yellow); }

.crm-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
}
.crm-user-name { color: #fff; font-weight: 600; }
.crm-user-role {
  color: var(--c-yellow);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(255, 204, 0, 0.15);
  padding: 2px 8px;
  border-radius: 99px;
}
.crm-logout {
  color: #ccd4dd;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
}
.crm-logout:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: none; }

.crm-footer {
  max-width: var(--container-max);
  margin: 40px auto 0;
  padding: 16px 24px;
  font-size: 11px;
  color: var(--c-text-light);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--c-border-soft);
}

/* =============================================================================
   Dashboard
   ============================================================================= */
.crm-dash {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px 24px 40px;
}
.crm-dash-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}
.crm-dash-head h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-navy);
}
.crm-dash-greet { color: var(--c-text-muted); font-size: 13px; }

.crm-kpis {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.crm-kpi {
  background: var(--c-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none !important;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.crm-kpi:hover {
  border-color: var(--c-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.crm-kpi-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}
.crm-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
}
.crm-kpi--revenue {
  background: linear-gradient(135deg, rgba(0, 114, 188, 0.06), #fff);
}
.crm-kpi--revenue .crm-kpi-num { color: var(--c-accent); }

@media (max-width: 1100px) { .crm-kpis { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 600px)  { .crm-kpis { grid-template-columns: repeat(2, 1fr); } }

.crm-section {
  background: var(--c-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.crm-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.crm-section-head h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.crm-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-primary);
}

.crm-search-form {
  display: flex;
  gap: 10px;
}
.crm-search-form input {
  flex: 1;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
}
.crm-search-form input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(0, 114, 188, 0.15);
}

.crm-empty {
  text-align: center;
  padding: 24px;
  color: var(--c-text-muted);
  font-size: 13px;
}
.crm-empty-hint { font-size: 12px; color: var(--c-text-light); margin-top: 8px; }

.crm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.crm-table th, .crm-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border-soft);
}
.crm-table th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-light);
}
.crm-table tr:last-child td { border-bottom: 0; }
.crm-table tr:hover { background: rgba(0, 114, 188, 0.03); }

.crm-tier-pill {
  display: inline-block;
  background: var(--c-border-soft);
  color: var(--c-text);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =============================================================================
   Filter bar (companies/contacts)
   ============================================================================= */
.crm-filter-bar {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--c-text-light);
}
.crm-filter-bar a {
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--c-border);
  background: #fff;
  color: var(--c-text);
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s;
}
.crm-filter-bar a:hover { border-color: var(--c-primary); color: var(--c-primary); }
.crm-filter-bar a.is-active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.muted { color: var(--c-text-lighter); }
.muted-note { font-size: 11px; color: var(--c-text-light); margin-top: 2px; }

/* =============================================================================
   MIRROR PAGE — wired version (mirrors crm/docs/mirror-preview.html design
   with real data from ecom_users + ecom_orders + crm_notes + ecom_audit_log)
   ============================================================================= */
.mirror-banner {
  background: linear-gradient(90deg, var(--c-yellow) 0%, #ffd84d 100%);
  color: var(--c-navy);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid #d4a900;
}
.mirror-banner-left strong { font-weight: 700; }
.mirror-banner-actions { display: flex; gap: 8px; }
.banner-link {
  color: var(--c-navy);
  text-decoration: underline;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 3px;
}
.banner-link:hover { background: rgba(0,0,0,0.08); text-decoration: none; }

.mirror-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}
.customer-view {
  background: var(--c-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.contact-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--c-border-soft);
}
.contact-name { font-size: 22px; font-weight: 700; color: var(--c-navy); margin-bottom: 4px; }
.contact-meta { font-size: 13px; color: var(--c-text-muted); margin-bottom: 2px; }
.contact-meta a { color: var(--c-text); }
.contact-tier {
  background: linear-gradient(135deg, #C0C0C0, #fff);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  text-align: right;
  min-width: 200px;
}
.contact-tier-name { font-size: 16px; font-weight: 700; color: var(--c-navy); }
.contact-tier-meta { font-size: 11px; color: var(--c-text-light); margin-top: 2px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.kpi-num { font-size: 24px; font-weight: 700; color: var(--c-primary); line-height: 1; margin-bottom: 4px; }
.kpi-label { font-size: 10px; font-weight: 700; color: var(--c-text-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.kpi--spend { background: linear-gradient(135deg, rgba(0,114,188,0.06), #fff); border-color: var(--c-primary); }
.kpi--spend .kpi-num { color: var(--c-accent); font-size: 20px; }
.kpi--cart-active {
  background: linear-gradient(135deg, #fff7ed, #fff);
  border-color: #ea580c;
}
.kpi--cart-active .kpi-num { color: #ea580c; }
.kpi--cart-active .kpi-label { color: #9a3412; }
.kpi--clickable {
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  color: inherit;
  display: block;
}
.kpi--clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.10);
  border-color: var(--c-primary);
}
.kpi--cart-active.kpi--clickable:hover { box-shadow: 0 4px 12px rgba(234, 88, 12, 0.18); border-color: #ea580c; }
.kpi--spend.kpi--clickable:hover       { box-shadow: 0 4px 12px rgba(0, 114, 188, 0.18); }

/* Status filter pills (used on the orders table to drill in from a KPI tile). */
.orders-filter { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--c-border-soft);
  background: #fff;
  color: var(--c-text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.filter-pill:hover { border-color: var(--c-primary); color: var(--c-primary); }
.filter-pill.is-active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

/* Order origin badge — distinguishes converted-quote orders from direct web orders. */
.origin-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.origin-badge--quote { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.origin-badge--web   { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

.section { margin-bottom: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { font-size: 13px; font-weight: 700; color: var(--c-navy); text-transform: uppercase; letter-spacing: 0.06em; }
.section-link { font-size: 12px; font-weight: 600; color: var(--c-primary); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--c-border-soft); }
table.data th { font-size: 10px; text-transform: uppercase; color: var(--c-text-light); letter-spacing: 0.06em; font-weight: 700; background: var(--c-bg); }
table.data td.num, table.data th.num { text-align: right; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover { background: rgba(0, 114, 188, 0.03); }

.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill--pending { background: #fef3c7; color: #92400e; }
.status-pill--processing { background: #dbeafe; color: #1e40af; }
.status-pill--shipped { background: #c7e9d3; color: #14532d; }
.status-pill--delivered { background: #dcfce7; color: #166534; }
.status-pill--canceled { background: #fee2e2; color: #991b1b; }

.admin-panel {
  background: var(--c-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-head h2 { font-size: 13px; font-weight: 700; color: var(--c-navy); text-transform: uppercase; letter-spacing: 0.06em; }
.panel-head-meta { font-size: 11px; color: var(--c-text-light); }

.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.qa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  background: #fff;
  color: var(--c-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.qa-btn:hover { border-color: var(--c-primary); color: var(--c-primary); background: rgba(0, 114, 188, 0.04); text-decoration: none; }
.qa-btn--primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.qa-btn--primary:hover { background: var(--c-primary-dk); border-color: var(--c-primary-dk); color: #fff; }

.note-box {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.note-box textarea {
  width: 100%;
  border: 0;
  background: transparent;
  resize: vertical;
  min-height: 48px;
  font-family: inherit;
  font-size: 13px;
  color: var(--c-text);
  outline: none;
}
.note-box-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--c-border-soft);
}
.note-type {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: inherit;
  color: var(--c-text);
}
.note-save {
  background: var(--c-accent);
  color: #fff;
  border: 0;
  border-radius: 3px;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.feed { display: flex; flex-direction: column; gap: 0; }
.feed-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border-soft);
}
.feed-item:last-child { border-bottom: 0; }
.feed-bullet { width: 6px; height: 6px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.feed-bullet--note { background: var(--c-yellow); }
.feed-bullet--system { background: var(--c-text-lighter); }
.feed-bullet--customer { background: var(--c-primary); }
.feed-bullet--staff { background: var(--c-accent); }
.feed-body { flex: 1; min-width: 0; }
.feed-meta { font-size: 11px; color: var(--c-text-light); margin-bottom: 2px; }
.feed-meta strong { color: var(--c-text); font-weight: 600; }
.feed-text { font-size: 12px; color: var(--c-text); line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }

@media (max-width: 1100px) {
  .mirror-grid { grid-template-columns: 1fr; }
  .admin-panel { position: static; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi--spend { grid-column: span 3; }
}
.crm-mirror {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
.crm-mirror-customer-view {
  background: var(--c-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.crm-mirror-admin {
  background: var(--c-card);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 80px;
}
.crm-mirror-banner {
  background: var(--c-yellow);
  color: var(--c-navy);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}
@media (max-width: 1100px) {
  .crm-mirror { grid-template-columns: 1fr; }
  .crm-mirror-admin { position: static; }
}

/* =============================================================================
   Config-spec list (under line items on order detail / opportunity / contact)
   ========================================================================== */
.config-spec-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 12px;
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: #475569;
}
.config-spec-list dt {
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  padding-top: 1px;
}
.config-spec-list dd {
  margin: 0;
  color: #1a1a2e;
  font-weight: 500;
}

/* =============================================================================
   QUOTE BUILDER — /quote/new (CSR creates a quote on customer's behalf)
   Lives inside .customer-view (left col of .mirror-grid) so it picks up the
   white-card chrome. Right col is the shared admin panel include.
   ============================================================================= */

/* Account + contact header (owner direction: account name + contact info
   must appear at the top of Quote Details). */
.qb-customer-head {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 20px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--c-border-soft);
}
.qb-customer-block { min-width: 0; }
.qb-customer-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-light);
  margin-bottom: 4px;
}
.qb-customer-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-navy);
  margin-bottom: 3px;
}
.qb-customer-name--muted { color: var(--c-text-light); font-style: italic; }
.qb-customer-name a { color: var(--c-navy); }
.qb-customer-name a:hover { color: var(--c-primary); }
.qb-customer-meta { font-size: 12px; color: var(--c-text-muted); line-height: 1.4; }
.qb-customer-meta a { color: var(--c-text); }
.qb-customer-tier {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-navy);
  background: linear-gradient(135deg, #C0C0C0, #fff);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 4px 10px;
  margin-bottom: 4px;
}

.qb-section {
  margin-bottom: 22px;
}
.qb-section + .qb-section {
  padding-top: 18px;
  border-top: 1px solid var(--c-border-soft);
}
.qb-section--footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.qb-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}
.qb-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.qb-section-head .qb-section-title { margin-bottom: 0; }

.qb-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}
.qb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.qb-field--lg .qb-input { font-size: 16px; padding: 10px 12px; font-weight: 600; }

.qb-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.qb-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--c-text-light);
  text-transform: none;
  letter-spacing: 0;
}
.qb-hint code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--c-navy);
}
.qb-input {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--c-text);
  background: #fff;
  width: 100%;
}
.qb-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(0, 114, 188, 0.12);
}
.qb-input--mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 600; }
.qb-input.num { text-align: right; }

.qb-empty {
  padding: 14px;
  background: #fafbfd;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--c-text-muted);
}

/* Inline label-row with a side action button (e.g. "+ Add new address") */
.qb-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.qb-link-btn {
  background: none;
  border: 0;
  color: var(--c-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}
.qb-link-btn:hover { text-decoration: underline; }

.qb-row--two { grid-template-columns: 1fr 1fr; }

/* Inline add-address form (Google Places autocomplete) */
.qb-addr-add {
  margin-top: 14px;
  padding: 16px;
  background: #fafbfd;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
}
.qb-addr-add-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}
.qb-addr-add-head strong {
  font-size: 13px;
  color: var(--c-navy);
}
.qb-addr-add-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 0.6fr;
  gap: 10px;
  margin-bottom: 12px;
}
.qb-addr-add-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* --- Address picker (radio cards) --- */
.qb-addr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.qb-addr-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.qb-addr-card:hover { border-color: var(--c-primary); }
.qb-addr-card input[type="radio"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--c-primary); }
.qb-addr-card:has(input:checked) {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(0, 114, 188, 0.10);
  background: rgba(0, 114, 188, 0.03);
}
.qb-addr-body { flex: 1; min-width: 0; }
.qb-addr-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.qb-addr-default {
  display: inline-block;
  font-size: 9px;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 700;
}
.qb-addr-line { font-size: 12px; color: var(--c-text); line-height: 1.4; }

/* --- Line items table --- */
.qb-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.qb-items th, .qb-items td {
  text-align: left;
  padding: 6px 8px;
  vertical-align: middle;
  border-bottom: 1px solid var(--c-border-soft);
}
.qb-items th {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--c-text-light);
  letter-spacing: 0.05em;
  font-weight: 700;
  background: var(--c-bg);
}
.qb-items td.num, .qb-items th.num { text-align: right; }
.qb-items .qb-input { padding: 6px 8px; font-size: 12px; }
.qb-items tr:last-child td { border-bottom: 0; }

.qb-pn-cell {
  display: flex;
  align-items: stretch;
  gap: 4px;
  position: relative;
}
.qb-pn-cell .qb-input { flex: 1; }

/* PN smart-lookup dropdown — appears beneath the PN input as user types.
   Source is the ecom_products table (live catalog from 123edistribution.com).
   No "123-" prefix required; matches against pn substring + title.
   Width overflows the PN column so titles + thumbnails are readable; the
   anchor is the .qb-pn-cell so it slides under whichever input is active. */
.qb-pn-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  width: 520px;            /* wider than the PN column — overflows to the right */
  max-width: 90vw;
  background: #fff;
  border: 1px solid var(--c-primary);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 320px;
  overflow-y: auto;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(10, 22, 40, 0.18);
}
.qb-pn-suggest-item {
  display: grid;
  grid-template-columns: 48px 110px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border-soft);
}
.qb-pn-suggest-thumb {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafbfd;
  border: 1px solid var(--c-border-soft);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.qb-pn-suggest-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.qb-pn-suggest-item:last-child { border-bottom: 0; }
.qb-pn-suggest-item:hover,
.qb-pn-suggest-item.is-active { background: rgba(0, 114, 188, 0.08); }
.qb-pn-suggest-pn {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-weight: 700;
  color: var(--c-navy);
}
.qb-pn-suggest-title {
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qb-pn-suggest-price {
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}
.qb-pn-suggest-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--c-text-light);
  font-style: italic;
}

.qb-pn-lookup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: #fafbfd;
  color: var(--c-primary);
  font-size: 13px;
  text-decoration: none;
}
.qb-pn-lookup:hover { background: var(--c-primary); color: #fff; text-decoration: none; }

.qb-tier-select {
  font-size: 11px;
  padding: 5px 6px;
}

.qb-subtotal {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--c-navy);
}

.qb-remove {
  background: transparent;
  border: 0;
  color: var(--c-text-lighter);
  font-size: 18px;
  line-height: 1;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.qb-remove:hover { background: #fef2f2; color: var(--c-accent); }

/* Per-line note row — sub-row beneath each item for free-text per-line
   info (installation notes, alt PN considered, pricing rationale). */
.qb-row-note > td { border-bottom: 1px solid var(--c-border-soft); padding-top: 0; padding-bottom: 8px; }
.qb-line-note {
  background: #fafbfd !important;
  font-size: 12px !important;
  font-style: italic;
  color: var(--c-text-muted);
}
.qb-line-note::placeholder { color: var(--c-text-lighter); }
.qb-line-note:focus { background: #fff !important; font-style: normal; color: var(--c-text); }

/* =============================================================================
   COMPANY PAGE TABS (/company?id=N)
   ============================================================================= */
.company-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--c-border-soft);
  margin: 22px 0 24px;
}
.company-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  text-decoration: none;
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  transition: color 0.12s, background 0.12s;
}
.company-tab:hover { color: var(--c-primary); text-decoration: none; background: #fff; }
.company-tab.is-active {
  color: var(--c-primary);
  background: #fff;
  box-shadow: inset 0 3px 0 var(--c-primary);
}
.company-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: var(--c-bg);
  color: var(--c-text-muted);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
}
.company-tab.is-active .company-tab-count {
  background: var(--c-primary);
  color: #fff;
}
.company-tab-panel { display: none; }
.company-tab-panel.is-active { display: block; }

.company-addr-card {
  padding: 12px 14px;
  background: #fafbfd;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
}

/* Business-search confirmation hint shown beneath the company-name input
   after a Google Places "establishment" pick fills the form. */
.qb-places-status {
  margin-top: 6px;
  padding: 6px 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  font-size: 11px;
  color: #166534;
  font-weight: 600;
}

/* Suggested-contacts box on the company Contacts tab — domain-matched
   ecom_users that aren't yet linked. CSR ticks rows + clicks Sync. */
.suggest-box {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), #fff);
  border: 1px solid #c4b5fd;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.suggest-box-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.suggest-box-head strong {
  font-size: 14px;
  color: var(--c-navy);
}
.suggest-box-sub {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.suggest-table {
  margin-bottom: 12px;
  background: #fff;
}
.suggest-table th, .suggest-table td { padding: 8px 12px; }
.suggest-table input[type="checkbox"] { accent-color: var(--c-primary); }
.suggest-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.suggest-actions .qb-hint {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
}
.suggest-actions code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
}

/* =============================================================================
   DASHBOARD ADMIN PANEL (right rail on /index)
   Same shell as the customer/company admin panels — keeps the right-rail
   consistent across every page (owner direction 2026-04-27).
   ============================================================================= */
.crm-dash-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) {
  .crm-dash-grid { grid-template-columns: 1fr; }
}

#qb-add-line {
  margin-top: 12px;
}

/* --- Totals + actions --- */
.qb-totals { min-width: 240px; }
.qb-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-navy);
  margin-bottom: 6px;
}
.qb-total-value {
  font-variant-numeric: tabular-nums;
  color: var(--c-accent);
  font-size: 18px;
}

.qb-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.qb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--c-border);
  background: #fff;
  color: var(--c-text);
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.qb-btn:hover { border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; }
.qb-btn--ghost { background: #fff; }
.qb-btn--secondary {
  background: #fff;
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.qb-btn--secondary:hover { background: rgba(0, 114, 188, 0.06); }
.qb-btn--primary {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}
.qb-btn--primary:hover { background: var(--c-primary-dk); color: #fff; }
.qb-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.qb-btn:disabled:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.qb-btn--ghost:disabled:hover, .qb-btn--secondary:disabled:hover { background: #fff; color: var(--c-primary); }

@media (max-width: 720px) {
  .qb-row { grid-template-columns: 1fr; }
  .qb-section--footer { flex-direction: column; align-items: stretch; }
  .qb-items th:nth-child(2), .qb-items td:nth-child(2) { display: none; } /* hide title col on narrow */
}

/* =============================================================================
   COMPACT-CARD TEMPLATE — ported from customer-portal auth-and-account.css.
   Same class names as the customer side so styling stays unified across the
   CRM (staff) and ecom (customer) surfaces. Used on the company detail page
   first; will spread to other CRM pages incrementally.
   ============================================================================= */

.profile-flash {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.profile-flash--ok  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.profile-flash--err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* Slim horizontal status strip (alternative to a full section block) */
.profile-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--c-text-muted);
  flex-wrap: wrap;
}
.profile-strip-meta { white-space: nowrap; }
.profile-strip-meta strong { color: var(--c-navy); }

/* Two-col grid for paired sections (collapses on narrow viewports) */
.profile-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 768px) {
  .profile-grid { grid-template-columns: 1fr; }
}

/* Compact card — used for each compartmentalized block */
.profile-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.profile-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-wrap: wrap;
  gap: 8px;
}
/* Nested h2 in card-head should match the compact card-head text style
   (the existing CRM .data tables and other places put h2 inside the head). */
.profile-card-head h2 {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-navy);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}
.profile-card-head .section-link { font-size: 11px; }

/* Tight form layout inside profile cards */
.profile-form { display: flex; flex-direction: column; gap: 8px; }
.profile-form > label,
.profile-form-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--c-text);
}
.profile-form > label > span,
.profile-form-field > span {
  font-weight: 600;
  font-size: 11px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.profile-form > label > span small,
.profile-form-field > span small {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--c-text-light);
}
.profile-form input,
.profile-form select,
.profile-form textarea,
.profile-form-field input,
.profile-form-field select,
.profile-form-field textarea {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--c-text);
  background: #fff;
}
.profile-form input:focus,
.profile-form select:focus,
.profile-form textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(0, 114, 188, 0.15);
}
.profile-form input:disabled { background: var(--c-bg); color: var(--c-text-light); }
.profile-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.profile-form-row--3 { grid-template-columns: 1fr 1fr 1fr; }
.profile-form-row--addr { grid-template-columns: 2fr 1fr 1fr 0.7fr; }
@media (max-width: 600px) {
  .profile-form-row, .profile-form-row--3, .profile-form-row--addr { grid-template-columns: 1fr; }
}

.profile-btn {
  align-self: flex-start;
  background: var(--c-primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 7px 18px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
  letter-spacing: 0.02em;
}
.profile-btn:hover { background: var(--c-primary-dk); }
.profile-btn--accent { background: var(--c-accent); }
.profile-btn--accent:hover { background: var(--c-accent-dk); }
.profile-btn--ghost {
  background: #fff;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border);
}
.profile-btn--ghost:hover { background: var(--c-bg); color: var(--c-primary); border-color: var(--c-primary); }

/* Compact dl for stat blocks */
.profile-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 12px;
}
.profile-meta dt {
  color: var(--c-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  padding-top: 2px;
}
.profile-meta dd { margin: 0; color: var(--c-text); }

.profile-empty {
  margin: 0;
  font-size: 12px;
  color: var(--c-text-muted);
  font-style: italic;
}

/* Footer card variant — totals on left, actions on right */
.profile-card--footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.profile-card--footer .qb-totals { min-width: 220px; }
.profile-card--footer .qb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Address-card pickers — used on the quote builder for Bill to / Ship to.
   Owner direction (2026-04-27): instead of a dropdown that reads
   "billing 123Solar — address...", show a real card with the formatted
   address and a compact picker beneath to switch. */
.addr-cards-row { gap: 14px; }
.addr-card-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.addr-card-label {
  font-weight: 600;
  font-size: 11px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.addr-card-label small {
  text-transform: none;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--c-text-light);
}
.addr-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-text);
  min-height: 90px;
}
.addr-card-body { font-size: 13px; line-height: 1.5; }
.addr-card-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.addr-card-name {
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.addr-card-name strong { color: var(--c-navy); font-weight: 700; }
.addr-card-tag {
  font-size: 10px;
  font-weight: 700;
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.addr-card-line { color: var(--c-text); }
.addr-card-empty {
  color: var(--c-text-muted);
  font-style: italic;
  font-size: 12px;
  padding: 6px 0;
}
.addr-card-pick {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  color: var(--c-text);
  background: #fff;
  width: 100%;
}
.addr-card-pick:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(0, 114, 188, 0.15);
}
.addr-card-edit {
  font-size: 11px;
  color: var(--c-primary);
  font-weight: 600;
}

/* Freight estimate card on the quote builder.
   Shows currently-selected freight (if any), a Calculate / Re-quote button,
   and rate options as clickable radio rows. */
.qb-freight-selected {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.qb-freight-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-navy);
  font-variant-numeric: tabular-nums;
}
.qb-freight-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.qb-freight-hint {
  font-size: 11px;
  color: var(--c-text-light);
}
.qb-freight-rates {
  margin-top: 10px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.qb-freight-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border-soft);
  font-size: 12px;
}
.qb-freight-row:last-child { border-bottom: 0; }
.qb-freight-row:hover { background: rgba(0, 114, 188, 0.04); }
.qb-freight-row input[type="radio"] {
  accent-color: var(--c-primary);
  margin: 0;
}
.qb-freight-row-name {
  font-weight: 600;
  color: var(--c-navy);
}
.qb-freight-row-transit {
  color: var(--c-text-light);
  font-size: 11px;
}
.qb-freight-row-cost {
  font-weight: 700;
  color: var(--c-navy);
  font-variant-numeric: tabular-nums;
  min-width: 70px;
  text-align: right;
}

/* Freight carrier tabs — one tab per active rating carrier (FedEx / USPS).
   Tab shows the carrier's cheapest rate as a "from $x" hint so the CSR can
   compare carriers without switching. Panels are display-toggled only; the
   picked radio keeps its state when its tab is hidden. */
.qb-freight-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg, #f7f8fa);
}
.qb-freight-tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 8px 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-light);
  cursor: pointer;
}
.qb-freight-tab:hover { color: var(--c-navy); }
.qb-freight-tab.active {
  color: var(--c-navy);
  border-bottom-color: var(--c-primary);
  background: #fff;
}
.qb-freight-tab-from {
  font-weight: 500;
  font-size: 11px;
  color: var(--c-text-light);
  margin-left: 4px;
}
.qb-freight-panel .qb-freight-row:last-child { border-bottom: 0; }

/* Cart drill-down on the contact mirror — hidden by default; only renders
   when the URL target is #cart (set by clicking the "In Cart" KPI tile).
   Owner direction (2026-04-27): cart contents shouldn't auto-show; CSR
   has to click the tile to drill in. The tile's existing href="#cart"
   is the trigger, so this is pure-CSS — no JS toggle needed.
   ✕ button in the head links to #none (any non-#cart hash) to hide. */
.cart-drilldown { display: none; }
.cart-drilldown:target { display: block; }
.cart-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 8px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--c-text-light);
  text-decoration: none;
  background: transparent;
  border: 0;
}
.cart-close:hover {
  color: var(--c-accent);
  background: rgba(200, 16, 46, 0.08);
  text-decoration: none;
}

/* ============================================================================
   LEFT SIDEBAR NAV — follows the HUB local design (collapsible icon rail).
   Replaces the old .crm-topbar horizontal bar (markup now in header.php).
   Fixed rail; content shifts right via body.crm-shell padding-left.
   ============================================================================ */
body.crm-shell { padding-left: 220px; transition: padding-left .18s ease; }
body.crm-shell.crm-side-collapsed { padding-left: 56px; }

.crm-side {
  position: fixed; left: 0; top: 0; bottom: 0; width: 220px; z-index: 100;
  background: #fff; border-right: 1px solid var(--c-border-soft);
  display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto;
  transition: width .18s ease;
}
body.crm-side-collapsed .crm-side { width: 56px; }

.crm-side-brand {
  display: flex; align-items: baseline; gap: 3px; flex: 0 0 auto;
  height: 56px; padding: 0 16px; white-space: nowrap; overflow: hidden;
  border-bottom: 1px solid var(--c-border-soft); text-decoration: none;
}
.crm-side-mark { font-size: 21px; font-weight: 700; color: var(--c-primary); letter-spacing: -.02em; }
.crm-side-text { font-size: 21px; font-weight: 600; color: var(--c-navy); letter-spacing: .01em; }
body.crm-side-collapsed .crm-side-text { display: none; }

.crm-side-toggle {
  flex: 0 0 auto; height: 34px; border: none; background: transparent; cursor: pointer;
  color: var(--c-text-light); font: inherit; font-size: 12px;
  display: flex; align-items: center; padding: 0;
  border-bottom: 1px solid var(--c-border-soft);
}
.crm-side-toggle:hover { color: var(--c-primary); background: var(--c-bg); }
.crm-side-toggle .ico { width: 56px; flex: 0 0 56px; text-align: center; font-size: 16px; }
body.crm-side-collapsed .crm-side-toggle .lbl { display: none; }

.crm-nav-item, .crm-nav-dept {
  display: flex; align-items: center; height: 40px; width: 100%;
  color: var(--c-text-muted); font: inherit; font-size: 13px; font-weight: 500;
  background: transparent; border: 0; border-left: 3px solid transparent;
  padding: 0; text-align: left; cursor: pointer; text-decoration: none;
}
.crm-nav-item:hover, .crm-nav-dept:hover { color: var(--c-primary); background: var(--c-bg); }
.crm-nav-item.active { color: var(--c-primary); border-left-color: var(--c-primary); background: #eaf3fb; font-weight: 600; }
.crm-nav-ico { width: 56px; flex: 0 0 56px; text-align: center; font-size: 16px; }
.crm-nav-lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.crm-side-collapsed .crm-nav-lbl { display: none; }
.crm-nav-car { width: 22px; text-align: center; color: var(--c-text-lighter); font-size: 10px; transition: transform .18s ease; }
body.crm-side-collapsed .crm-nav-car { display: none; }
.crm-nav-sec.open .crm-nav-car { transform: rotate(90deg); }

.crm-nav-kids {
  display: none; flex-direction: column; background: var(--c-bg);
  border-top: 1px solid var(--c-border-soft); border-bottom: 1px solid var(--c-border-soft);
}
.crm-nav-sec.open .crm-nav-kids { display: flex; }
body.crm-side-collapsed .crm-nav-kids { display: none !important; }
.crm-nav-child {
  display: flex; align-items: center; height: 34px; width: 100%;
  padding-left: 56px; color: var(--c-text-muted); font-size: 12.5px;
  text-decoration: none; white-space: nowrap;
}
.crm-nav-child:hover, .crm-nav-child.active { color: var(--c-primary); background: #eaf3fb; }
.crm-nav-child.active { font-weight: 600; }

.crm-nav-spacer { flex: 1 1 auto; }
.crm-side-foot { flex: 0 0 auto; border-top: 1px solid var(--c-border-soft); padding: 4px 0; }
.crm-side-signout:hover { color: #C8102E; background: #fbeaec; }


/* Admin-side freight/handling split (owner 2026-07-07) — display-only line
   under the blended cost; customer checkout stays blended. */
.qb-freight-row-split { display:block; font-size:10.5px; font-weight:500; color:#8a94a2; white-space:nowrap; }

/* ── Activity feed v2: click-to-expand rows (2026-07-14) ───────────────────── */
.feed-empty { font-size: 12px; color: var(--c-text-light); padding: 8px 2px; line-height: 1.45; }
.feed-row { border-bottom: 1px solid var(--c-border-soft); }
.feed-row:last-child { border-bottom: 0; }
.feed-row > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 2px;
  font-size: 12px;
  color: var(--c-text);
}
.feed-row > summary::-webkit-details-marker { display: none; }
.feed-row > summary:hover { background: #fafcff; }
.feed-row > summary .feed-bullet { margin-top: 0; }
.feed-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row[open] .feed-sum { white-space: normal; font-weight: 600; }
.feed-when { flex-shrink: 0; font-size: 11px; color: var(--c-text-light); }
.feed-row--muted > summary { opacity: 0.5; }
.feed-detail { padding: 2px 2px 12px 16px; }
.feed-detail-meta { font-size: 11px; color: var(--c-text-light); margin-bottom: 6px; }
.feed-detail-meta strong { color: var(--c-text); font-weight: 600; }
.feed-detail-body { font-size: 12px; color: var(--c-text); line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }
.feed-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 12px; }
.feed-kv dt { color: var(--c-text-light); }
.feed-kv dd { margin: 0; color: var(--c-text); overflow-wrap: anywhere; }
.feed-link { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--c-primary); text-decoration: none; }
.feed-link:hover { text-decoration: underline; }

/* =============================================================================
   Mobile nav (owner 2026-08-08, phase 2) — ≤767px: fixed top bar carries the
   ☰ + brand (nothing floats over page content); the left rail is an
   off-canvas drawer; gutters tightened; wide tables side-scroll in place.
   Desktop (≥768px) untouched.
   ========================================================================== */
.crm-mobile-bar { display: none; }
.crm-side-burger { display: none; }
.crm-side-backdrop { display: none; }
@media (max-width: 767px) {
  body.crm-shell, body.crm-shell.crm-side-collapsed { padding-left: 0; padding-top: 48px; }

  .crm-mobile-bar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; height: 48px; z-index: 950;
    background: #fff; border-bottom: 1px solid var(--c-border-soft);
    padding: 0 12px;
  }
  .crm-mobile-brand { font-size: 17px; font-weight: 700; color: var(--c-navy); text-decoration: none; letter-spacing: .01em; }
  .crm-mobile-brand b { color: var(--c-primary); }
  .crm-side-burger {
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--c-border-soft);
    background: #fff; color: var(--c-navy); font-size: 19px; cursor: pointer;
  }

  .crm-side, body.crm-side-collapsed .crm-side {
    width: 272px; transform: translateX(-105%);
    transition: transform .2s ease; box-shadow: none; z-index: 990;
  }
  body.crm-side-open .crm-side { transform: translateX(0); box-shadow: 0 0 40px rgba(15,23,42,.35); }
  .crm-side-toggle { display: none; }                /* desktop collapse: n/a */
  body.crm-side-open .crm-side-backdrop {
    display: block; position: fixed; inset: 0; z-index: 980;
    background: rgba(15,23,42,.45);
  }

  /* Declutter: tight gutters, readable type, tables scroll sideways in place
     instead of crushing columns or stretching the page. */
  body.crm-shell main { padding-left: 12px; padding-right: 12px; padding-top: 14px; padding-bottom: 44px; }
  .crm-dash-grid { padding: 14px 12px 40px; }
  body.crm-shell main h1 { font-size: 20px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .crm-flash { margin: 10px 12px; }
}
