/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.card-body {
  padding: 20px;
}

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10,14,26,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.nav-left { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.nav-left-top { display: flex; align-items: center; gap: 8px; }
.nav-logo { height: 22px; width: auto; flex-shrink: 0; }
.nav-sep { color: var(--border); font-size: 1rem; }
.nav-label { color: var(--text-muted); font-size: 0.9rem; font-weight: 300; line-height: 1.3; }
.nav-client-name { display: block; font-size: 0.75rem; color: var(--text-dim); font-weight: 400; }
.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
  padding: 6px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-sans);
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-tab.active { background: rgba(0,102,255,0.12); color: var(--primary); border-color: rgba(0,102,255,0.3); }
.nav-tab .badge-count {
  display: inline-block;
  background: var(--yellow);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
}
.nav-user {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.nav-profile {
  position: relative;
}
.nav-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary, #4f8ef7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}
.nav-avatar:hover {
  opacity: 0.85;
}
.nav-profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg, #1e1e2f);
  border: 1px solid var(--border, #2a2a3e);
  border-radius: 8px;
  min-width: 180px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  z-index: 200;
  overflow: hidden;
}
.nav-profile-dropdown.open {
  display: block;
}
.nav-profile-info {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border, #2a2a3e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-profile-logout {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-profile-logout:hover {
  background: rgba(255,255,255,0.06);
}
.nav-cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.nav-cart-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-cart-btn.active { color: var(--primary); background: rgba(0,102,255,0.12); border-color: rgba(0,102,255,0.3); }
.nav-cart-icon { width: 18px; height: 18px; }
.nav-cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--yellow);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}
/* ── API Status Badge ── */
.api-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: filter 0.15s ease, border-color 0.15s ease;
}
.api-status:hover {
  filter: brightness(1.15);
  border-color: rgba(255,255,255,0.12);
}

/* ── System Health Modal ── */
.sh-modal-open { overflow: hidden; }
.sh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  animation: sh-fade-in 0.15s ease;
}
.sh-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  z-index: 210;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sh-slide-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sh-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes sh-slide-in {
  from { opacity: 0; transform: translate(-50%, -48%); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.sh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.sh-title {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.sh-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.sh-close:hover { color: var(--text); }

.sh-body {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
}
.sh-loading {
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 0;
  text-align: center;
}

.sh-overall {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.sh-overall-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid;
  background: rgba(255,255,255,0.02);
}

.sh-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border-dim);
  border-radius: 8px;
  overflow: hidden;
}
.sh-row {
  background: var(--bg-deep);
  padding: 12px 14px;
}
.sh-row-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.sh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.sh-row-text {
  flex: 1;
  min-width: 0;
}
.sh-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.sh-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.sh-latency {
  color: var(--text-dim);
  font-weight: 400;
}
.sh-details {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.sh-detail-item { white-space: nowrap; }
.sh-detail-key { color: var(--text-dim); }
.sh-detail-val { color: var(--text-muted); }
.sh-error {
  margin-top: 6px;
  font-size: 11px;
  color: var(--red);
  word-break: break-word;
}
.sh-error--block {
  padding: 16px;
  background: rgba(255,51,102,0.08);
  border: 1px solid rgba(255,51,102,0.25);
  border-radius: 8px;
  text-align: center;
}

.sh-footer-meta {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.sh-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.sh-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
}
.sh-btn-secondary {
  border-color: var(--border);
  color: var(--text-muted);
}
.sh-btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text);
}
.sh-btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sh-btn-primary {
  background: var(--primary);
  color: #fff;
}
.sh-btn-primary:hover { background: var(--primary-hover); }
.api-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.api-status--live {
  background: rgba(5,150,105,0.15);
  color: #34D399;
}
.api-status--live .api-dot { background: #34D399; }
.api-status--error {
  background: rgba(245,158,11,0.15);
  color: #FBBF24;
}
.api-status--error .api-dot { background: #FBBF24; }
.api-status--mock {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}
.api-status--mock .api-dot { background: var(--text-muted); }

/* ── Stats Row ── */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.stat-value.green { color: var(--green); }
.stat-value.accent { color: var(--accent); }
.stat-value.warning { color: var(--yellow); }
.stat-sub.warning { color: var(--yellow); font-weight: 600; }
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 17px; font-weight: 600; }
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 16px rgba(0,102,255,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,102,255,0.4);
}
.btn-outline { background: none; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { color: var(--text); border-color: var(--text-muted); }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Subscription Cards ── */
/* ── Subscription Groups ── */
.sub-group {
  margin-bottom: 16px;
}
.sub-group:last-child {
  margin-bottom: 32px;
}
.sub-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--bg-card), rgba(99, 102, 241, 0.08));
  border: 1px solid var(--primary);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.sub-group-header:hover {
  background: linear-gradient(135deg, var(--bg-card), rgba(99, 102, 241, 0.14));
  border-color: var(--accent);
}
.sub-group-toggle {
  color: var(--primary);
  font-size: 14px;
  width: 14px;
  flex-shrink: 0;
}
.sub-group-name {
  color: var(--accent);
  font-size: 16px;
}
.sub-group-summary {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13px;
  margin-left: auto;
}

.sub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}
.sub-group .sub-grid {
  margin-bottom: 0;
}
.sub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.15s;
}
.sub-card.compact {
  padding: 14px 16px;
}
.sub-card:hover { border-color: var(--primary); box-shadow: 0 4px 24px rgba(0,102,255,0.08); }
.sub-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}
.sub-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.sub-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.status-active { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.status-pending { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.status-suspended { background: rgba(248, 81, 73, 0.15); color: var(--red); }

.sub-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.sub-meta .badge-group { margin-left: 0; }

.sub-details {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.sub-detail-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sub-detail-value {
  font-size: 14px;
  font-weight: 600;
  margin-top: 1px;
  font-family: var(--font-mono);
}

.sub-renewal {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-ics {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s;
}
.btn-ics:hover {
  color: var(--accent);
}
.sub-usage { margin-bottom: 10px; }
.usage-bar-bg {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.usage-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.usage-bar.low { background: var(--green); }
.usage-bar.mid { background: var(--accent); }
.usage-bar.high { background: var(--red); }
.usage-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Multi-CSP indicator */
.multi-csp-icon {
  cursor: help;
  color: var(--accent);
  font-size: 12px;
  margin-left: 2px;
  position: relative;
  display: inline-block;
}
.multi-csp-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: -8px;
  background: #1a1f2e;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 400;
  width: 280px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  line-height: 1.5;
}
.multi-csp-icon:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 4px;
  border: 5px solid transparent;
  border-top-color: #1a1f2e;
  z-index: 1001;
  pointer-events: none;
}

.sub-actions { display: flex; gap: 8px; }
.sub-actions .btn { padding: 5px 12px; font-size: 11px; }

/* ── Filter Bar ── */
.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.filter-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.filter-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.filter-group { display: flex; gap: 2px; }
.filter-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.filter-btn:first-child { border-radius: 6px 0 0 6px; }
.filter-btn:last-child { border-radius: 0 6px 6px 0; }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.filter-btn.disabled, .filter-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.filter-search {
  flex: 1;
  min-width: 200px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
}
.filter-search::placeholder { color: var(--text-muted); }
.filter-search:focus { border-color: var(--primary); }

.sub-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.sort-select {
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  min-width: 170px;
}
.sort-select:focus { border-color: var(--primary); }

/* ── Product Table ── */
.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.product-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
}
.product-table th.right { text-align: right; }
.product-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.product-table td.right { text-align: right; font-family: var(--font-mono); }
.product-table tr:hover td { background: var(--bg-card-hover); }
.product-table .sku-title { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.product-table .sku { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Tooltips ── */
.product-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tooltip-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  font-family: Georgia, serif;
  font-style: italic;
  cursor: help;
  flex-shrink: 0;
  transition: all 0.25s;
  line-height: 1;
}
.tooltip-trigger:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}
.tooltip-content {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 260px;
  max-width: 340px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  font-weight: 400;
  font-style: normal;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(37, 99, 235, 0.1);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.tooltip-content::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--bg-card);
  border-left: 1px solid var(--primary);
  border-bottom: 1px solid var(--primary);
}
.tooltip-trigger:hover .tooltip-content {
  visibility: visible;
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}
.tooltip-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover { background: var(--bg-card-hover); color: var(--text); }
.qty-val {
  width: 36px;
  height: 28px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.btn-add {
  padding: 5px 12px;
  font-size: 12px;
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.btn-add:hover { background: var(--primary); color: white; }

/* ── Cart ── */
.cart-items {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 20px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-name { font-weight: 600; font-size: 14px; }
.cart-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cart-change {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 6px;
}
.cart-change.add { background: rgba(63, 185, 80, 0.1); color: var(--green); }
.cart-change.remove { background: rgba(248, 81, 73, 0.1); color: var(--red); }
.cart-cost {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  font-family: var(--font-mono);
}
.cart-cost span { display: block; font-size: 11px; color: var(--text-muted); font-weight: 400; }
.cart-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}
.cart-remove:hover { color: var(--red); }

.cart-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cart-total-label { font-size: 14px; color: var(--text-muted); }
.cart-total-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}
.cart-total-value span { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.cart-notes {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  resize: vertical;
  min-height: 60px;
  margin-bottom: 16px;
}
.cart-notes::placeholder { color: var(--text-muted); }
.cart-submit { width: 100%; padding: 12px; font-size: 14px; }

/* ── Requests Table ── */
.req-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.req-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.req-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.req-table tr:hover td { background: var(--bg-card-hover); }
.req-table tr:last-child td { border-bottom: none; }
.req-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
}
.req-completed { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.req-pending { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }
.req-rejected { background: rgba(248, 81, 73, 0.15); color: var(--red); }
.req-approved { background: rgba(0, 102, 255, 0.15); color: var(--primary); }
.req-executing { background: rgba(0, 217, 255, 0.15); color: var(--accent); }
.req-cancelled { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }

/* ── Approval Action Buttons ── */
.req-actions { display: flex; gap: 6px; align-items: center; }
.btn-approve {
  padding: 4px 12px;
  font-size: 11px;
  background: rgba(63, 185, 80, 0.15);
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.btn-approve:hover { background: var(--green); color: #000; }
.btn-approve:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-reject {
  padding: 4px 12px;
  font-size: 11px;
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.btn-reject:hover { background: var(--red); color: #fff; }
.btn-cancel-request {
  padding: 4px 12px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.btn-cancel-request:hover { background: rgba(248, 81, 73, 0.15); border-color: var(--red); color: var(--red); }
.btn-cancel-request:disabled { opacity: 0.5; cursor: not-allowed; }
.req-decided-by { font-size: 11px; color: var(--text-muted); }

/* ── Reject Reason Form ── */
.reject-form { display: flex; gap: 6px; align-items: center; }
.reject-input {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-width: 140px;
}
.btn-reject-confirm {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--red);
  border: 1px solid var(--red);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-sans);
}
.btn-reject-cancel {
  padding: 4px 10px;
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
}

/* ── Request Detail Rows (legacy) ── */
.req-detail-row td { background: var(--bg-deep, var(--bg)); padding-top: 0 !important; }
.req-detail {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 16px 12px !important;
  border-bottom: 1px solid var(--border);
}
.req-detail-error { color: #e74c3c; }
.req-detail-success { color: #27ae60; }

/* ── Term & Billing Badges ── */
.term-badge, .billing-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  vertical-align: middle;
}
.term-badge {
  background: rgba(0, 102, 255, 0.12);
  color: var(--primary);
  border: 1px solid rgba(0, 217, 255, 0.15);
}
.billing-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.trial-badge {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.25);
}
.badge-group {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── SKU Stamp ── */
.sku-stamp {
  display: inline-block;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  user-select: all;
  margin-top: 2px;
}

/* ── Form field styles ── */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--text);
}
.field-label .hint {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 10px;
}
.input, textarea.input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, textarea.input:focus {
  border-color: var(--primary);
}
.input::placeholder, textarea.input::placeholder {
  color: var(--text-dim);
}
.settings-section-title {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ms-item:hover { background: rgba(255,255,255,0.08); }
.price-original {
  text-decoration: line-through;
  color: var(--text-dim);
  font-size: 0.85em;
  font-weight: 400;
}
.discount-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--green, #10b981);
  background: rgba(16, 185, 129, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
}
/* ── Expandable Card Rows (Queue + History) ── */
.expand-row {
  cursor: pointer;
  transition: background 0.15s;
}
.expand-row:hover td { background: var(--bg-card-hover); }
.expand-row.expanded {
  border-left: 3px solid var(--primary);
}
.expand-row.expanded td:first-child { padding-left: 13px; }
.expand-row .chevron {
  display: inline-block;
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  font-weight: 700;
}
.expand-row.expanded .chevron {
  transform: rotate(90deg);
  color: var(--primary);
}
.expand-detail-row td {
  background: var(--bg-deep, var(--bg)) !important;
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
}
.expand-detail {
  padding: 16px 20px 20px;
}
.expand-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 32px;
  margin-bottom: 16px;
}
.expand-field {}
.expand-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.expand-value {
  font-size: 13px;
  color: var(--text);
}
.expand-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.expand-actions .reject-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Admin Tabs ── */
.admin-tabs { display: flex; gap: 2px; margin-bottom: 20px; }

/* ── Client Table ── */
.client-row-disabled td { opacity: 0.45; }
.client-row-disabled td:first-child { opacity: 1; }
.client-unified-view { animation: fadeInUp 0.15s ease both; }
.unified-top-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.client-tab-bar { display: flex; gap: 4px; }
.client-tab-content { animation: fadeInUp 0.1s ease both; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.pending-enrollment .pending-icon { font-size: 40px; margin-bottom: 16px; }
.mono-sm { font-family: var(--font-mono); font-size: 11px; }
.btn.btn-sm { padding: 4px 12px; font-size: 11px; }

/* ── Client Edit Form ── */
.client-edit-form {
  margin-top: 0;
  padding-top: 0;
}
.edit-field { margin-bottom: 12px; }
.edit-field .filter-label { margin-bottom: 4px; display: block; }
.edit-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  box-sizing: border-box;
}
.edit-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ── Toggle Switch ── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-input:checked + .toggle-slider {
  background: var(--green);
}
.toggle-input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #000;
}
.toggle-input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Disabled Client Row ── */
.client-row-disabled .toggle-switch { opacity: 1; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;  /* above every overlay/modal (demo sign-in modal is 1000) */
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  max-width: 360px;
}
.toast.success { border-color: var(--green); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 255, 136, 0.25); }
.toast.error { border-color: var(--red); background: #2a0f1c; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 51, 102, 0.35); }
.toast.warning { border-color: var(--yellow); }
.toast.info { border-color: var(--accent); }

/* ── Loading ── */
.loading-spinner {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Access Denied ── */
.access-denied {
  text-align: center;
  padding: 80px 28px;
  color: var(--text-muted);
}
.access-denied h2 {
  font-size: 20px;
  color: var(--text);
  margin-bottom: 8px;
}
.access-denied p {
  font-size: 14px;
}

/* ── Coming Soon Placeholder ── */
.coming-soon {
  text-align: center;
  padding: 80px 28px;
  color: var(--text-dim);
}
.coming-soon h2 {
  font-size: 20px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ── Prospect demo: landing page ── */
.landing { max-width: 1040px; margin: 0 auto; padding: 24px 28px 48px; }
.landing-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0 32px; flex-wrap: wrap; }
.landing-logo { height: 26px; width: auto; }
.landing-top-actions { display: flex; gap: 10px; }
.landing-hero { text-align: center; padding: 40px 0 36px; }
.landing-eyebrow { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; font-weight: 600; }
.landing-hero h1 { font-size: clamp(28px, 4.2vw, 44px); line-height: 1.15; font-weight: 700; max-width: 820px; margin: 0 auto 18px; }
.landing-sub { font-size: 16px; color: var(--text-muted); max-width: 680px; margin: 0 auto 28px; line-height: 1.6; }
.landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.landing-hint { font-size: 12px; color: var(--text-dim); margin-top: 18px; }
.landing-hint a, .landing-footer a, .login-hint a { color: var(--accent); }
.landing-props { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 24px 0; }
.landing-prop { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.landing-prop-icon { font-size: 22px; margin-bottom: 10px; }
.landing-prop h3 { font-size: 16px; margin-bottom: 8px; }
.landing-prop p { font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.landing-why { background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 36px; margin: 32px 0; }
.landing-why h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.2; margin-bottom: 14px; max-width: 760px; }
.landing-why-lead { font-size: 15px; color: var(--text-muted); line-height: 1.65; max-width: 780px; margin-bottom: 28px; }
.landing-why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px 28px; }
.landing-why-item h3 { font-size: 15px; margin-bottom: 6px; color: var(--text); }
.landing-why-item p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.landing-why-cta { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.landing-why-cta p { font-size: 14px; color: var(--text); max-width: 620px; margin: 0; }
.landing-footer { text-align: center; font-size: 12px; color: var(--text-dim); padding-top: 24px; }

.demo-modal-overlay { position: fixed; inset: 0; background: rgba(6, 9, 20, 0.78); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.demo-modal-overlay[hidden] { display: none; }  /* the class's display:flex must not override the hidden attribute */
.demo-modal-card { text-align: left; }
.demo-modal-card h2 { text-align: center; }
.demo-form { display: flex; flex-direction: column; gap: 10px; }
.demo-form .input { width: 100%; }
.demo-code-input { text-align: center; font-family: var(--font-mono); font-size: 24px; letter-spacing: 8px; }

/* ── Prospect demo: setup + bar ── */
.demo-bar { background: linear-gradient(90deg, rgba(0, 217, 255, 0.14), rgba(0, 102, 255, 0.10)); border-bottom: 1px solid rgba(0, 217, 255, 0.3); }
/* The bar inherits the impersonation bar's orange; secondary text must stay legible on it */
.demo-bar .demo-bar-meta { color: rgba(0, 0, 0, 0.72); font-weight: 500; }
.demo-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.demo-choice { border: 1px solid var(--border); }
.demo-choice.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.demo-choice-icon { font-size: 26px; margin-bottom: 8px; }
.demo-choice-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.demo-choice h3 { font-size: 16px; margin-bottom: 8px; }
.demo-choice p { font-size: 13px; color: var(--text-muted); line-height: 1.55; margin-bottom: 14px; }
.demo-section { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; background: var(--bg-deep); }
.demo-section-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.demo-step { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.demo-section-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.demo-shot-grid { display: grid; grid-template-columns: minmax(280px, 1.1fr) minmax(260px, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 820px) { .demo-shot-grid { grid-template-columns: 1fr; } }
.demo-howto { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-muted); line-height: 1.6; display: flex; flex-direction: column; gap: 8px; }
.demo-howto a, .demo-section-head a { color: var(--accent); }
.demo-sample-shot { margin: 14px 0 0; cursor: zoom-in; }
.demo-sample-frame { position: relative; display: inline-block; max-width: 460px; width: 100%; }
.demo-sample-frame img { display: block; width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.demo-sample-shot figcaption { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.demo-lightbox { position: fixed; inset: 0; z-index: 2500; background: rgba(6, 9, 20, 0.88); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.demo-lightbox-inner { max-width: min(1400px, 96vw); width: 100%; text-align: center; cursor: default; }
.demo-lightbox-inner .demo-sample-frame { max-width: 100%; }
.demo-lightbox-inner .demo-sample-frame img { max-height: 80vh; width: auto; max-width: 100%; margin: 0 auto; }
.demo-lightbox-inner p { color: var(--text); font-size: 14px; margin: 14px 0 10px; }
.demo-howto kbd, .demo-upload-text kbd { font-family: var(--font-mono); font-size: 11px; background: var(--bg-card); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--text); }
.demo-upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; background: var(--bg-card); transition: border-color .15s, background .15s, box-shadow .15s; }
.demo-upload.over, .demo-upload.pulse { border-color: var(--accent); background: rgba(0, 217, 255, 0.06); box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.18); }
.demo-upload-big { flex-direction: column; justify-content: center; text-align: center; gap: 10px; padding: 22px 16px; min-height: 190px; border-width: 2px; }
.demo-upload-icon { font-size: 30px; line-height: 1; }
.demo-upload-text { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.demo-upload-big .demo-upload-text strong { color: var(--text); font-size: 14px; }
.sku-search-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; margin-top: 4px; max-height: 320px; overflow-y: auto; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4); }
.sku-result { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 10px 14px; background: none; border: 0; border-bottom: 1px solid var(--border-dim); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.sku-result:hover { background: var(--bg-card-hover); }
.sku-result:last-child { border-bottom: 0; }

/* ── Login Page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 40px 20px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.login-logo {
  height: 32px;
  width: auto;
  margin: 0 auto 16px;
  display: block;
  color: #fff;
}
.login-brand {
  font-weight: 300;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.login-card h2 {
  font-size: 20px;
  color: var(--text);
  margin-bottom: 12px;
  font-weight: 600;
}
.login-card > p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 28px;
}
.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
}
.login-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 20px;
  opacity: 0.7;
}

/* ── Add Client Form ── */
.add-client-form {
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: 16px;
  animation: fadeInUp 0.2s ease both;
}
.add-client-form-inner {
  padding: 18px 20px;
}
.add-client-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.add-client-field {
  flex: 1;
  min-width: 140px;
}
.add-client-field .filter-label {
  display: block;
  margin-bottom: 4px;
}
.slug-preview {
  font-size: 12px;
  padding: 6px 0 0;
}
.slug-preview code {
  background: rgba(0,102,255,0.1);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── SKU Discount Overrides ── */
.sku-overrides-section {
  margin-top: 8px;
}
.sku-overrides-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
}
.sku-override-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  gap: 8px;
}
.sku-override-row:last-child { border-bottom: none; }
.sku-override-row.sku-override-active {
  background: rgba(0,102,255,0.06);
}
.sku-override-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sku-override-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.sku-override-input-wrap .text-muted { font-size: 12px; }
.sku-override-remove {
  padding: 2px 6px !important;
  font-size: 11px !important;
  line-height: 1 !important;
}

/* Custom discount badge on subscription cards */
.badge-custom-discount {
  display: inline-block;
  background: rgba(0,102,255,0.15);
  color: var(--primary);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ── Delete Client Button ── */
.btn-delete-client {
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
}
.btn-delete-client:hover {
  color: var(--red) !important;
  border-color: var(--red) !important;
  background: rgba(248, 81, 73, 0.1) !important;
}

/* ── SKU Count Badge (detail view) ── */
.sku-count-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0,102,255,0.12);
  color: var(--primary);
  border: 1px solid rgba(0,102,255,0.2);
}

/* ── Category Badges ── */
.cat-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.cat-badge--commercial { background: rgba(0,102,255,0.12); color: var(--primary); }
.cat-badge--education { background: rgba(139,92,246,0.15); color: #A78BFA; }
.cat-badge--nonprofit { background: rgba(63,185,80,0.15); color: var(--green); }
.cat-badge--government { background: rgba(210,153,34,0.15); color: var(--yellow); }
.cat-badge--suppress { background: rgba(248,81,73,0.15); color: #f85149; }
.cat-badge--boost { background: rgba(210,153,34,0.15); color: var(--yellow); }
.cat-badge--custom { background: rgba(88,166,255,0.15); color: #58a6ff; }

.badge-green {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(63,185,80,0.15);
  color: var(--green);
}
.badge-muted {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
}

/* ── AI Insight Cards ── */
.insights-section {
  margin-bottom: 28px;
}
.insights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.insights-header .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.insights-badge {
  display: inline-block;
  background: rgba(0,217,255,0.12);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.insight-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 24px rgba(0,102,255,0.08);
}
.insight-card.insight-warning { border-left-color: var(--yellow); }
.insight-card.insight-critical { border-left-color: var(--red); }
.insight-card.insight-info { border-left-color: var(--accent); }

.insight-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-mono);
}
.insight-warning .insight-icon { background: rgba(210,153,34,0.15); color: var(--yellow); }
.insight-critical .insight-icon { background: rgba(255,51,102,0.15); color: var(--red); }
.insight-info .insight-icon { background: rgba(0,217,255,0.15); color: var(--accent); }

.insight-body { flex: 1; min-width: 0; }
.insight-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.insight-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.insight-savings {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  font-family: var(--font-mono);
}
.insight-extra-cost {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
}

.insight-features {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.insight-features-label {
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.insight-features--lost .insight-features-label { color: var(--yellow); }
.insight-features--gained .insight-features-label { color: var(--green); }
.insight-features ul {
  margin: 0;
  padding: 0 0 0 16px;
  line-height: 1.6;
}
.insight-features-more {
  list-style: none;
  margin-left: -16px;
  margin-top: 4px;
  font-style: italic;
  color: var(--text-dim);
  font-size: 11px;
}

.insight-compare-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
}
.insight-compare-link:hover {
  text-decoration: underline;
}

.insight-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
  opacity: 0;
}
.insight-card:hover .insight-dismiss { opacity: 1; }
.insight-dismiss:hover { color: var(--text); }
.insights-grid--dashboard .insight-dismiss { opacity: 0.6; }
.insights-grid--dashboard .insight-card:hover .insight-dismiss { opacity: 1; }

.insights-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.insights-view-all {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}
.insights-view-all:hover { text-decoration: underline; }

.insights-disclaimer {
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(210,153,34,0.06);
  border: 1px solid rgba(210,153,34,0.15);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Insights summary cards ─────────────────────────────────── */
.insights-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.insights-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.insights-summary-card:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.insights-summary-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.insights-summary-count {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.insights-summary-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.insights-summary-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.insights-summary--alerts .insights-summary-count { color: #d29922; }
.insights-summary--savings .insights-summary-count { color: #3fb950; }
.insights-summary--opportunities .insights-summary-count { color: #58a6ff; }

/* ── Insights filter bar ────────────────────────────────────── */
.insights-filters {
  margin-bottom: 12px;
}

/* ── Dismissed section ──────────────────────────────────────── */
.insights-dismissed-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.insights-dismissed-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.insights-dismissed-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.insights-dismissed-toggle:hover {
  color: var(--text);
}

.insights-clear-all {
  font-size: 11px;
  padding: 3px 10px;
}

.insights-grid--dismissed {
  opacity: 0.45;
}
.insights-grid--dismissed .insight-card {
  border-color: var(--border);
}
.insights-grid--dismissed .insight-dismiss {
  display: none;
}

/* ── Email digest toggle ────────────────────────────────────── */
.insights-email-toggle {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-input {
  display: none;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-input:checked + .toggle-switch {
  background: var(--primary);
}
.toggle-input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

/* ── Email category checkboxes ─────────────────────────────── */
.insights-email-categories {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  padding-left: 46px;
}
.insights-email-categories.hidden {
  display: none;
}
.email-cat-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.email-cat-input {
  accent-color: var(--primary);
}

@media (max-width: 600px) {
  .insights-summary-cards {
    grid-template-columns: 1fr;
  }
}

/* ── Impersonation Banner ──────────────────────────────────── */
.impersonate-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 24px;
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #000;
  font-size: 13px;
  font-weight: 600;
  z-index: 99;
}
.impersonate-icon {
  font-size: 16px;
}
.btn-impersonate-exit {
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 6px;
  background: rgba(255,255,255,0.25);
  color: #000;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.btn-impersonate-exit:hover {
  background: rgba(255,255,255,0.5);
}

/* View As Client button on Clients page */
.btn-impersonate {
  background: linear-gradient(135deg, #d97706, #f59e0b) !important;
  color: #000 !important;
  border: none !important;
  font-weight: 700;
}
.btn-impersonate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245,158,11,0.35);
}

/* ── AI Chat Panel ──────────────────────────────────────────── */

/* Overlay */
.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 140;
}
.chat-overlay.open {
  display: block;
}

/* Drawer */
.chat-drawer {
  position: fixed;
  bottom: 0;
  right: 0;
  height: 50vh;
  width: 420px;
  max-width: 100vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: 12px 0 0 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}
.chat-drawer.open {
  transform: translateX(0);
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.chat-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.chat-header-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
}
.chat-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.chat-close-btn svg {
  width: 18px;
  height: 18px;
}

/* Context bar (impersonation) */
.chat-context-bar {
  padding: 8px 20px;
  background: rgba(0, 102, 255, 0.08);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.chat-context-label strong {
  color: var(--accent);
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual messages */
.chat-msg {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
}
.chat-msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg-assistant {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg-error {
  border-color: #ef4444;
  color: #ef4444;
}

/* Markdown inside assistant messages */
.chat-msg-assistant strong { color: var(--accent); }
.chat-msg-assistant code.chat-code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.chat-msg-assistant pre.chat-pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.chat-msg-assistant ul.chat-list {
  margin: 6px 0;
  padding-left: 18px;
}
.chat-msg-assistant ul.chat-list li {
  margin-bottom: 4px;
}

/* Typing indicator */
.chat-msg-typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Welcome screen */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  flex: 1;
}
.chat-welcome-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  margin-bottom: 16px;
}
.chat-welcome h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.chat-welcome p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
  margin-bottom: 20px;
}
.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 280px;
}
.chat-suggestion {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.chat-suggestion:hover {
  border-color: var(--primary);
  color: var(--text);
}

/* Input bar */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-sans);
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s;
}
.chat-input:focus {
  border-color: var(--primary);
}
.chat-input::placeholder {
  color: var(--text-muted);
}
.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.chat-send-btn:hover:not(:disabled) {
  filter: brightness(1.15);
}
.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

/* Header chat button */
.nav-chat-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.nav-chat-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.nav-chat-btn.active {
  color: var(--accent);
  background: rgba(0, 217, 255, 0.08);
  border-color: rgba(0, 217, 255, 0.2);
}
.nav-chat-icon {
  width: 18px;
  height: 18px;
}

/* Pulse animation for unseen chat */
.nav-chat-btn.chat-unseen {
  color: var(--accent);
  animation: chat-pulse 2s ease-in-out infinite;
}
.nav-chat-btn.chat-unseen::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}
@keyframes chat-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 217, 255, 0); }
  50% { box-shadow: 0 0 0 6px rgba(0, 217, 255, 0.25); }
}

/* Mobile responsive */
@media (max-width: 600px) {
  .chat-drawer {
    width: 100vw;
  }
}

/* ── Audit Log ── */

.audit-action-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.audit-approve_request { background: var(--green-bg, rgba(16,185,129,0.12)); color: var(--green, #10b981); }
.audit-reject_request { background: var(--red-bg, rgba(239,68,68,0.12)); color: var(--red, #ef4444); }
.audit-create_client { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-delete_client { background: var(--red-bg, rgba(239,68,68,0.12)); color: var(--red, #ef4444); }
.audit-enable_client { background: var(--green-bg, rgba(16,185,129,0.12)); color: var(--green, #10b981); }
.audit-disable_client { background: var(--amber-bg, rgba(245,158,11,0.12)); color: var(--amber, #f59e0b); }
.audit-update_client { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-upsert_user { background: var(--purple-bg, rgba(139,92,246,0.12)); color: var(--purple, #8b5cf6); }
.audit-delete_user { background: var(--red-bg, rgba(239,68,68,0.12)); color: var(--red, #ef4444); }
.audit-update_msp_rules { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-generate_invoice, .audit-generate_all_invoices { background: var(--green-bg, rgba(16,185,129,0.12)); color: var(--green, #10b981); }
.audit-update_invoice { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-delete_invoice { background: var(--red-bg, rgba(239,68,68,0.12)); color: var(--red, #ef4444); }
.audit-update_billing_config { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-qbo_sync_invoice, .audit-qbo_batch_sync, .audit-qbo_sync_payments { background: var(--purple-bg, rgba(139,92,246,0.12)); color: var(--purple, #8b5cf6); }
.audit-qbo_void_invoice { background: var(--red-bg, rgba(239,68,68,0.12)); color: var(--red, #ef4444); }
.audit-qbo_disconnect { background: var(--amber-bg, rgba(245,158,11,0.12)); color: var(--amber, #f59e0b); }
.audit-qbo_map_customer, .audit-qbo_auto_map { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-qbo_create_customer { background: var(--green-bg, rgba(16,185,129,0.12)); color: var(--green, #10b981); }
.audit-send_insight_digest { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-qbo_webhook_received { background: var(--purple-bg, rgba(139,92,246,0.12)); color: var(--purple, #8b5cf6); }
.audit-qbo_webhook_void { background: var(--red-bg, rgba(239,68,68,0.12)); color: var(--red, #ef4444); }
.audit-seed_price_locks { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.audit-submit_request { background: var(--green-bg, rgba(16,185,129,0.12)); color: var(--green, #10b981); }
.audit-cancel_request { background: var(--amber-bg, rgba(245,158,11,0.12)); color: var(--amber, #f59e0b); }
.audit-provision_request { background: var(--purple-bg, rgba(139,92,246,0.12)); color: var(--purple, #8b5cf6); }
.audit-provision_completed { background: var(--green-bg, rgba(16,185,129,0.12)); color: var(--green, #10b981); }
.audit-provision_failed { background: var(--red-bg, rgba(239,68,68,0.12)); color: var(--red, #ef4444); }
.audit-import_price_sheet { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── MSP Dashboard ── */

.msp-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.msp-stat-card {
  background: var(--card-bg, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
}

.msp-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 6px;
}

.msp-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text, #f1f5f9);
  line-height: 1.1;
}

.msp-stat-value.green { color: var(--green, #10b981); }
.msp-stat-value.amber { color: var(--amber, #f59e0b); }
.msp-stat-value.red { color: var(--red, #ef4444); }
.msp-stat-value.blue { color: var(--blue, #3b82f6); }

/* Price lock indicators on subscription cards */
.price-locked-badge, .price-drift-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
}
.price-locked-badge { color: var(--green, #10b981); }
.price-drift-badge { color: var(--amber, #f59e0b); }

.msp-section {
  margin-bottom: 28px;
}

.msp-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text, #f1f5f9);
}

.msp-client-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
}

.msp-client-row:last-child {
  border-bottom: none;
}

.msp-client-name {
  font-weight: 500;
  font-size: 13px;
}

.msp-client-value {
  font-weight: 600;
  font-size: 13px;
  color: var(--text, #f1f5f9);
}

.msp-client-detail {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
}

.msp-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
  font-size: 13px;
}

.msp-alert-item:last-child {
  border-bottom: none;
}

.msp-alert-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.msp-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-muted, #94a3b8);
  font-size: 13px;
}

/* Expandable request rows */
.msp-expand-row {
  cursor: pointer;
  transition: background 0.15s;
}
.msp-expand-row:hover {
  background: var(--bg-card-hover, rgba(255,255,255,0.03));
}
.msp-expand-row .chevron {
  display: inline-block;
  font-size: 16px;
  color: var(--text-muted, #94a3b8);
  transition: transform 0.2s;
}
.msp-expand-row.expanded .chevron {
  transform: rotate(90deg);
}
.msp-expand-row.expanded {
  background: var(--bg-card-hover, rgba(255,255,255,0.03));
}
.msp-expand-detail {
  padding: 12px 14px 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
  background: var(--bg-deep, rgba(0,0,0,0.15));
}

.msp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .msp-two-col {
    grid-template-columns: 1fr;
  }
}

/* ── iframe-optimized mode (CloudRadial embedding) ── */

/* Lock page to iframe viewport — only #app-main scrolls */
:root.iframe-mode,
:root.iframe-mode body {
  height: 100vh;
  overflow: hidden;
}

:root.iframe-mode body {
  display: flex;
  flex-direction: column;
}

:root.iframe-mode #app-main {
  flex: 1;
  overflow-y: auto;
}

:root.iframe-mode .nav.nav-iframe {
  justify-content: space-between;
  padding: 6px 12px;
  flex-shrink: 0;
}
:root.iframe-mode .nav.nav-iframe .nav-left { display: none; }
:root.iframe-mode #impersonate-banner { display: none; }

:root.iframe-mode .main {
  padding: 12px;
  max-width: 100%;
}

:root.iframe-mode .stats {
  gap: 10px;
  margin-bottom: 12px;
}

:root.iframe-mode .stat-card {
  padding: 12px 14px;
}

:root.iframe-mode .stat-label {
  font-size: 11px;
  margin-bottom: 4px;
}

:root.iframe-mode .stat-value {
  font-size: 22px;
}

:root.iframe-mode .stat-sub {
  font-size: 11px;
}

:root.iframe-mode .section-header {
  margin-bottom: 10px;
}

:root.iframe-mode .section-title {
  font-size: 15px;
}

:root.iframe-mode .sub-grid {
  gap: 8px;
  margin-bottom: 16px;
}

:root.iframe-mode .sub-card {
  padding: 14px 16px;
}

:root.iframe-mode .insights-section {
  margin-bottom: 16px;
}

:root.iframe-mode .insights-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

:root.iframe-mode .req-table th {
  padding: 8px 12px;
}

:root.iframe-mode .req-table td {
  padding: 10px 12px;
}

/* Compact AI Advisor panel in iframe mode */
:root.iframe-mode .chat-drawer {
  width: 340px;
}

:root.iframe-mode .chat-header {
  padding: 10px 14px;
}

:root.iframe-mode .chat-header-title {
  font-size: 13px;
  gap: 8px;
}

:root.iframe-mode .chat-messages {
  padding: 12px;
  gap: 8px;
}

:root.iframe-mode .chat-msg {
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.45;
}

:root.iframe-mode .chat-welcome {
  padding: 20px 14px;
}

:root.iframe-mode .chat-welcome h3 {
  font-size: 14px;
}

:root.iframe-mode .chat-welcome p {
  font-size: 12px;
  margin-bottom: 14px;
}

:root.iframe-mode .chat-suggestion {
  padding: 8px 12px;
  font-size: 11px;
}

:root.iframe-mode .chat-input-bar {
  padding: 8px 12px;
  gap: 6px;
}

:root.iframe-mode .chat-input {
  padding: 8px 12px;
  font-size: 12px;
}

:root.iframe-mode .chat-send-btn {
  width: 32px;
  height: 32px;
}

:root.iframe-mode .chat-msg-assistant ul.chat-list {
  margin: 4px 0;
  padding-left: 16px;
}

:root.iframe-mode .chat-msg-assistant ul.chat-list li {
  margin-bottom: 2px;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 768px)
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Nav — compact layout */
  .nav { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .nav-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: 100%;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab { padding: 5px 12px; font-size: 11px; }
  .nav-user { gap: 8px; }

  /* Main container */
  .main { padding: 16px; }

  /* Stats row — 3 columns */
  .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }

  /* Subscription cards — 2 columns */
  .sub-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .sub-card { padding: 16px 18px; }
  .sub-card.compact { padding: 12px 14px; }

  /* Tables — smaller text */
  .req-table { font-size: 12px; }
  .req-table th { padding: 10px 12px; font-size: 10px; }
  .req-table td { padding: 10px 12px; }
  .product-table { font-size: 12px; }
  .product-table th { padding: 8px 10px; font-size: 10px; }
  .product-table td { padding: 10px; }

  /* Cart — 2-row layout */
  .cart-item {
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 12px 16px;
  }
  .cart-summary { padding: 16px; }

  /* Chat drawer — full width */
  .chat-drawer { width: 100vw; }

  /* Section headers */
  .section-title { font-size: 15px; }
  .section-header { margin-bottom: 12px; }

  /* Filters — tighter */
  .filter-row { gap: 12px; }
  .filter-search { min-width: 140px; }

  /* MSP Dashboard — compact stats */
  .msp-stat-card { padding: 12px 14px; }

  /* Expand detail grids */
  .expand-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 480px)
   ══════════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* Nav — ultra compact */
  .nav { padding: 8px 12px; }
  .nav-sep, .nav-label { display: none; }
  .nav-client-name { display: none; }
  .nav-logo { height: 18px; }
  .nav-user { gap: 6px; }
  .nav-cart-btn { width: 32px; height: 32px; }
  .nav-avatar { width: 28px; height: 28px; font-size: 10px; }
  .api-status { display: none; }

  /* Main container */
  .main { padding: 12px; }

  /* Stats row — 2 columns */
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat-card { padding: 10px 12px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; margin-bottom: 4px; }
  .stat-sub { font-size: 10px; }

  /* Subscription cards — single column */
  .sub-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 16px;
  }
  .sub-card { padding: 14px 16px; }
  .sub-card.compact { padding: 10px 12px; }
  .sub-name { font-size: 12px; }
  .sub-details { grid-template-columns: 1fr 1fr; gap: 6px; }
  .sub-detail-value { font-size: 13px; }
  .sub-group:last-child { margin-bottom: 16px; }

  /* Tables — minimal */
  .req-table { font-size: 11px; }
  .req-table th { padding: 8px 10px; }
  .req-table td { padding: 8px 10px; }
  .product-table { font-size: 11px; }
  .product-table th { padding: 6px 8px; }
  .product-table td { padding: 8px; }

  /* Cart — stacked */
  .cart-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 14px;
  }
  .cart-item-name { font-size: 13px; }
  .cart-cost { text-align: left; }
  .cart-total-value { font-size: 18px; }
  .cart-summary { padding: 14px; }

  /* Section headers */
  .section-title { font-size: 14px; }
  .section-header { margin-bottom: 10px; }

  /* Filters — stack */
  .filter-row { gap: 8px; }
  .filter-search { min-width: 100%; }
  .filter-btn { padding: 5px 10px; font-size: 11px; }
  .sub-toolbar { flex-wrap: wrap; }
  .sort-select { min-width: 100%; }

  /* Buttons */
  .btn { padding: 7px 14px; font-size: 12px; }

  /* MSP Dashboard */
  .msp-stat-card { padding: 10px 12px; }
  .msp-section-title { font-size: 13px; }
  .msp-client-row { padding: 10px 12px; }
  .msp-client-name { font-size: 12px; }
  .msp-client-detail { font-size: 10px; }
  .msp-client-value { font-size: 13px; }
  .msp-alert-item { padding: 10px 12px; }

  /* Insights */
  .insights-grid {
    grid-template-columns: 1fr;
  }

  /* Requests expand details */
  .msp-expand-detail { padding: 10px 12px 14px; }

  /* Access denied / loading */
  .access-denied { padding: 24px 16px; }
  .access-denied h2 { font-size: 18px; }
}

/* ── Custom SKUs view ── */
.custom-skus-view { padding: 24px; }
.page-header { margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); margin: 0; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }

.csk-section { margin-bottom: 20px; padding: 20px; }
.csk-section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 16px; gap: 16px; flex-wrap: wrap;
}
.csk-section-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.csk-section-sub { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }
.csk-section-actions { display: flex; align-items: center; gap: 12px; }
.csk-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.csk-select {
  background: var(--bg-deep); border: 1px solid var(--border);
  color: var(--text); padding: 6px 10px; border-radius: 6px; font-size: 13px;
  min-width: 220px;
}

.csk-table-wrap { overflow-x: auto; }
.csk-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.csk-table th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.csk-table td {
  padding: 12px; border-bottom: 1px solid var(--border-dim);
  color: var(--text); vertical-align: top;
}
.csk-table tr:hover td { background: var(--bg-card-hover); }
.csk-table .csk-num { text-align: right; }
.csk-table .csk-empty {
  text-align: center; color: var(--text-muted);
  padding: 32px 12px; font-style: italic;
}

.csk-name { font-weight: 600; color: var(--text); }
.csk-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.csk-row-actions { white-space: nowrap; }
.csk-row-actions .btn-link { margin-right: 8px; }

.csk-badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.csk-badge-active { background: rgba(0,255,136,0.12); color: var(--green); }
.csk-badge-muted { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* SKU code chip */
.csk-code {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Live price/margin hint under the subscription form */
.csk-price-hint {
  align-self: end;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 8px;
}

/* CSV import diff modal */
.csk-diff { padding: 4px 2px 8px; }
.csk-diff-count { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }
.csk-diff-summary { margin: 0 0 12px; padding-left: 18px; }
.csk-diff-summary li { font-size: 14px; margin: 2px 0; }
.csk-diff-errors {
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.25);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
}
.csk-diff-errors ul { margin: 6px 0 0; padding-left: 18px; }
.csk-diff-errors li { margin: 2px 0; color: var(--red, #ff6b6b); }

/* Subscriptions summary stats bar */
.csk-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 4px 0 14px;
}
.csk-stat {
  display: flex;
  flex-direction: column;
  min-width: 120px;
  padding: 10px 14px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.csk-stat-num { font-size: 20px; font-weight: 700; color: var(--text, #fff); line-height: 1.2; }
.csk-stat-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-top: 2px; }

/* Subscriptions filter toolbar */
.csk-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.csk-search {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 8px;
  background: var(--bg-secondary, rgba(255,255,255,0.03));
  color: var(--text, #fff);
  font-size: 13px;
}
.csk-toolbar .csk-select { min-width: 130px; }

/* Sortable table headers */
.csk-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.csk-sortable:hover { color: var(--primary, #6366F1); }

/* Pager */
.csk-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.csk-pager-info { font-size: 12px; color: var(--text-muted); }
.csk-pager-btns { display: flex; align-items: center; gap: 8px; }
.csk-pager-page { font-size: 12px; color: var(--text-muted); }

/* Seat adjuster — clarify that the stepper is the NEW total, show the change */
.seat-adjuster { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.seat-adjuster-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.seat-adjuster-current { font-weight: 400; opacity: 0.8; }
.seat-adjuster-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  min-height: 20px;
}
.seat-adjuster-arrow { color: var(--text-muted); }
.seat-adjuster-arrow strong { color: var(--text, #fff); }
.seat-adjuster-delta, .seat-adjuster-cost { font-weight: 700; }
.seat-adjuster-delta.up, .seat-adjuster-cost.up { color: var(--green, #10b981); }
.seat-adjuster-delta.down, .seat-adjuster-cost.down { color: var(--red, #ef4444); }
.seat-adjuster-nochange { color: var(--text-muted); font-style: italic; }
.seat-adjuster-actions { display: flex; gap: 8px; }

.btn-link {
  background: transparent; border: none; color: var(--primary);
  font-size: 12px; cursor: pointer; padding: 0; font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

/* Modal */
.csk-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px); z-index: 200;
}
.csk-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 480px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  z-index: 210; display: flex; flex-direction: column; overflow: hidden;
}
.csk-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.csk-modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.csk-modal-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.csk-modal-close:hover { color: var(--text); }

.csk-form { padding: 16px 20px; overflow-y: auto; }
.csk-form label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 12px;
}
.csk-form input, .csk-form select, .csk-form textarea {
  display: block; width: 100%; margin-top: 4px;
  background: var(--bg-deep); border: 1px solid var(--border);
  color: var(--text); padding: 8px 10px; border-radius: 6px;
  font-size: 13px; font-family: inherit;
}
.csk-form input:focus, .csk-form select:focus, .csk-form textarea:focus {
  outline: none; border-color: var(--primary);
}
.csk-form input:disabled { color: var(--text-muted); cursor: not-allowed; }
.csk-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.csk-form-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border);
}
