/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --bg-elevated: #161b27;
  --bg-card:     #1c2333;
  --bg-hover:    #222940;
  --border:      #2a3347;
  --border-soft: #1e2840;
  --text:        #e8eaf0;
  --text-muted:  #7a8599;
  --text-dim:    #4d5a72;
  --accent:      #4f7af8;
  --accent-dim:  #1e3a7a;
  --green:       #22c55e;
  --green-dim:   #14532d;
  --yellow:      #eab308;
  --yellow-dim:  #422006;
  --red:         #ef4444;
  --red-dim:     #7f1d1d;
  --radius:      8px;
  --radius-sm:   5px;
  --surface-shadow: 0 10px 28px rgba(0,0,0,.16);
  --surface-shadow-soft: 0 8px 20px rgba(0,0,0,.10);
  --focus-ring: 0 0 0 3px rgba(79,122,248,.16);
  --shadow:      0 2px 8px rgba(0,0,0,.35);
  --shadow-lg:   0 8px 30px rgba(0,0,0,.5);
  --font:        'Inter', system-ui, sans-serif;
  --sidebar-w:   220px;
}

html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text);
       min-height: 100vh; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
::placeholder { color: var(--text-dim); }

/* ── Auth overlay ─────────────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.auth-overlay.hidden { display: none; }
.auth-spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.app-shell.hidden { display: none; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-logo {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
  overflow: hidden;
}
.sidebar-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.sidebar-product { font-weight: 700; font-size: .9rem; color: var(--text); }
.sidebar-label   { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

.sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 500; color: var(--text-muted);
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item svg { flex-shrink: 0; opacity: .8; }
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.nav-badge.hidden { display: none; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border-soft);
}
.sidebar-user {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-user-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sidebar-user-email {
  font-size: .72rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 150px;
}
.role-badge {
  font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 3px; width: fit-content;
}
.role-badge.admin   { background: #2d1f5e; color: #a78bfa; }
.role-badge.manager { background: var(--accent-dim); color: var(--accent); }
.role-badge.rep     { background: var(--border); color: var(--text-muted); }

.signout-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); transition: background .15s, color .15s;
  flex-shrink: 0;
}
.signout-btn:hover { background: var(--bg-hover); color: var(--text); }

.sidebar-confidential {
  margin-top: 10px;
  font-size: .60rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ── Main content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px;
  padding: 22px 28px 0;
  flex-shrink: 0;
}
.page-title { font-size: 1.18rem; font-weight: 700; color: var(--text); line-height: 1.25; letter-spacing: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

.page-content { flex: 1; overflow-y: auto; padding: 18px 28px 30px; }
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Loading state ────────────────────────────────────────────────────────── */
.loading-state {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
}
.loading-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.empty-state {
  text-align: center; padding: 46px 20px; color: var(--text-muted);
  font-size: .85rem;
}
.empty-state p { margin-top: 8px; color: var(--text-dim); font-size: .8rem; }

/* ── KPI grid ─────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(144px, 1fr));
  gap: 12px; margin-bottom: 22px;
}
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 15px 16px;
  min-height: 92px; display: flex; flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--surface-shadow-soft);
}
.kpi-label {
  font-size: .68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .055em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-value { font-size: 1.58rem; font-weight: 750; color: var(--text); margin-top: 8px; line-height: 1.05; }
.kpi-sub   { font-size: .71rem; color: var(--text-dim); margin-top: 6px; }
.kpi-sub .up   { color: var(--green); }
.kpi-sub .down { color: var(--red); }

#pageContent > .kpi-grid:first-of-type {
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
}

/* ── Section header ───────────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px; margin-top: 24px;
}
.section-header:first-child { margin-top: 0; }
.section-title { font-size: .9rem; font-weight: 700; color: var(--text); line-height: 1.3; }

/* ── Data table ───────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--surface-shadow-soft);
}
table { width: 100%; border-collapse: collapse; font-size: .81rem; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  padding: 10px 13px; text-align: left;
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-dim);
  background: rgba(255,255,255,.012);
}
td { padding: 10px 13px; color: var(--text-muted); border-bottom: 1px solid var(--border-soft); line-height: 1.45; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,.025); }
td.text-primary { color: var(--text); font-weight: 500; }

/* ── Badges (status) ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  min-height: 20px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  line-height: 1;
  white-space: nowrap;
}
.badge-open    { background: var(--yellow-dim); color: var(--yellow); }
.badge-closed  { background: var(--green-dim);  color: var(--green); }
.badge-active  { background: var(--green-dim);  color: var(--green); }
.badge-inactive{ background: var(--border);     color: var(--text-dim); }
.badge-admin   { background: #2d1f5e; color: #a78bfa; }
.badge-manager { background: var(--accent-dim); color: var(--accent); }
.badge-rep     { background: var(--border);     color: var(--text-muted); }

/* ── Support cards ────────────────────────────────────────────────────────── */
.support-list { display: flex; flex-direction: column; gap: 10px; }
.support-card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--surface-shadow-soft);
}
.support-card.open { border-left: 3px solid var(--yellow); }
.support-card.closed { border-left: 3px solid var(--border); }
.support-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
}
.support-card-meta { font-size: .73rem; color: var(--text-dim); margin-top: 4px; }
.support-card-body { font-size: .82rem; color: var(--text-muted); line-height: 1.55; }
.support-card-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }

/* ── Chart bar ────────────────────────────────────────────────────────────── */
.chart-wrap {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--surface-shadow-soft);
}
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-fill { width: 100%; background: var(--accent-dim); border-radius: 3px 3px 0 0; min-height: 3px; transition: background .15s; }
.bar-col:hover .bar-fill { background: var(--accent); }
.bar-label { font-size: .65rem; color: var(--text-dim); }

/* ── Filter bar ───────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-bar select,
.filter-bar input {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: .8rem; outline: none;
  transition: border-color .15s;
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent); color: #fff;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  transition: opacity .15s, transform .15s, box-shadow .15s;
}
.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-hover); color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-secondary:hover { background: var(--bg-card); }

.btn-outline-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(239,68,68,.35);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  transition: background .15s, border-color .15s;
}
.btn-outline-danger:hover {
  background: var(--red-dim);
  border-color: rgba(239,68,68,.55);
}

.btn-ghost {
  color: var(--text-muted); padding: 5px 10px;
  border-radius: var(--radius-sm); font-size: .78rem;
  transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  background: var(--red-dim); color: var(--red);
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: .78rem; font-weight: 600;
  transition: opacity .15s;
}
.btn-danger:hover { opacity: .8; }

.btn-sm {
  padding: 5px 12px; font-size: .76rem;
}

.btn-primary,
.btn-secondary,
.btn-outline-danger,
.btn-ghost,
.btn-danger,
.arc-btn-danger,
.arc-btn-warning,
.cq-btn,
.btn-retrain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  white-space: nowrap;
}

.btn-primary,
.btn-secondary,
.btn-outline-danger,
.btn-danger,
.arc-btn-danger,
.arc-btn-warning {
  min-height: 34px;
}

.btn-sm,
.btn-ghost,
.cq-btn,
.btn-retrain {
  min-height: 30px;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline-danger:focus-visible,
.btn-ghost:focus-visible,
.btn-danger:focus-visible,
.arc-btn-danger:focus-visible,
.arc-btn-warning:focus-visible,
.cq-btn:focus-visible,
.btn-retrain:focus-visible,
.filter-select:focus,
.form-input:focus,
.form-select:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
  overflow: hidden;
}
.modal-overlay.hidden { display: none; }
.modal-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%; max-width: 440px;
  max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.modal-title { font-size: .95rem; font-weight: 600; color: var(--text); }
.modal-close-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); transition: background .15s, color .15s;
}
.modal-close-btn:hover { background: var(--bg-hover); color: var(--text); }
.modal-body {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.modal-footer {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border-soft);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg-elevated);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

@media (max-height: 720px) {
  .modal-overlay {
    align-items: flex-start;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .modal-panel {
    max-height: calc(100vh - 32px);
  }
}

.arc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 18, .72);
  backdrop-filter: blur(6px);
}
.arc-modal-overlay.hidden { display: none; }
.arc-confirm-modal {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.arc-confirm-header { padding: 18px 20px 10px; }
.arc-confirm-header h3 {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}
.arc-confirm-body {
  padding: 0 20px 18px;
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.55;
}
.arc-confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border-soft);
  background: rgba(255,255,255,.018);
}
.arc-confirm-danger { border-color: rgba(239,68,68,.35); }
.arc-confirm-warning { border-color: rgba(234,179,8,.32); }
.arc-btn-danger,
.arc-btn-warning {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 700;
  transition: opacity .15s, background .15s;
}
.arc-btn-danger { background: var(--red); color: #fff; }
.arc-btn-warning { background: var(--yellow); color: #171717; }
.arc-btn-danger:hover,
.arc-btn-warning:hover { opacity: .86; }

.arc-toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}
.arc-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: .82rem;
  line-height: 1.45;
}
.arc-toast button {
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
}
.arc-toast button:hover { color: var(--text); }
.arc-toast-success { border-color: rgba(34,197,94,.35); }
.arc-toast-error { border-color: rgba(239,68,68,.42); }
.arc-toast-warning { border-color: rgba(234,179,8,.4); }
.arc-toast-info { border-color: rgba(79,122,248,.35); }

/* ── Form elements ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .78rem; font-weight: 500; color: var(--text-muted); }
.form-hint  { font-size: .72rem; font-weight: 400; color: var(--text-dim); }
.form-input, .form-select {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: .82rem; outline: none;
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); }
.form-error {
  font-size: .78rem; color: var(--red);
  padding: 8px 10px; background: var(--red-dim);
  border-radius: var(--radius-sm);
}
.form-error.hidden { display: none; }
.form-select { appearance: none; cursor: pointer; }

.brand-checkboxes { display: flex; flex-direction: column; gap: 6px; }
.brand-checkbox-item {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; color: var(--text-muted); cursor: pointer;
}
.brand-checkbox-item input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }

/* ── Login page ───────────────────────────────────────────────────────────── */
body.login-page {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-shell { width: 100%; max-width: 380px; padding: 20px; }
.login-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 40px 36px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); margin-bottom: 16px;
}
.login-title { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.login-sub   { font-size: .83rem; color: var(--text-muted); margin-top: 4px; margin-bottom: 28px; }
.login-error {
  width: 100%; font-size: .8rem; color: var(--red);
  background: var(--red-dim); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 16px; text-align: center;
}
.login-error.hidden { display: none; }
.login-google-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 11px 16px; font-size: .85rem; font-weight: 600;
  transition: background .15s, border-color .15s;
}
.login-google-btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent); }
.login-google-btn:disabled { opacity: .55; cursor: not-allowed; }
.login-note { font-size: .73rem; color: var(--text-dim); margin-top: 20px; text-align: center; }

/* ── Misc helpers ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-right { text-align: right; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }

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

/* ── Support modal (full-screen view) ────────────────────────────────────── */
.support-modal-panel { max-width: 560px; }
.training-campaign-modal-panel { max-width: 640px; }
.training-campaign-modal-panel .modal-body { gap: 16px; }
.tc-date-required-row {
  display: grid;
  grid-template-columns: minmax(140px, .8fr) 1.2fr;
  gap: 12px;
  align-items: end;
}
.tc-required-check {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text);
}
.tc-assignment-list {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  padding: 6px;
  overflow-y: auto;
}
.tc-brand-list { max-height: 132px; }
.tc-user-list { max-height: min(220px, 32vh); }

@media (max-width: 640px) {
  .modal-panel,
  .support-modal-panel,
  .training-campaign-modal-panel {
    max-width: min(92vw, 640px);
  }

  .tc-date-required-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .modal-footer {
    flex-wrap: wrap;
  }
}
.support-msg-block {
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: .82rem; color: var(--text-muted); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.support-reply-area {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 9px 10px; font-size: .82rem; resize: vertical; min-height: 80px;
  outline: none; transition: border-color .15s;
}
.support-reply-area:focus { border-color: var(--accent); }

/* ── Responsive tweaks ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --sidebar-w: 200px; }
  .page-header {
    padding: 14px 16px 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-actions { justify-content: flex-start; }
  .page-content { padding: 14px 16px 20px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-header { align-items: flex-start; flex-direction: column; }
  .flag-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .flag-msg,
  .flag-action {
    grid-column: 1 / -1;
  }
}

/* ── Skeleton loaders ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -700px 0; }
  100% { background-position:  700px 0; }
}
.skel {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 1400px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: var(--radius-sm);
}
.skel-line { height: 11px; }
.skel-card { height: 88px; border-radius: var(--radius); }
.skel-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 24px;
}

/* ── Charts layout ────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 840px) {
  .charts-grid { grid-template-columns: 1fr; }
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 17px 18px;
  box-shadow: var(--surface-shadow-soft);
}
.chart-title {
  font-size: .84rem; font-weight: 700; color: var(--text); margin-bottom: 13px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.chart-sub {
  font-size: .72rem; font-weight: 400; color: var(--text-muted);
}
.canvas-wrap { position: relative; height: 220px; }
.canvas-wrap canvas { position: absolute; inset: 0; }

/* ── KPI grid (5-card) ────────────────────────────────────────────────────── */
/* -- Training table � hide low-priority columns at normal desktop width ------- */
@media (max-width: 1380px) {
  .col-optional { display: none; }
}
.th-action, .td-action { white-space: nowrap; text-align: right; }

/* ── Symptom ranked list ──────────────────────────────────────────────────── */
.sym-list { display: flex; flex-direction: column; gap: 0; }
.sym-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
}
.sym-row:last-child { border-bottom: none; }
.sym-label {
  flex: 0 0 44%; font-size: .78rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sym-bar-wrap { flex: 1; height: 5px; background: var(--border-soft); border-radius: 3px; overflow: hidden; }
.sym-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.sym-count { flex: 0 0 28px; text-align: right; font-size: .78rem; font-weight: 600; color: var(--text); }

/* ── No-data placeholder ──────────────────────────────────────────────────── */
.no-data-msg {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; height: 160px;
  font-size: .82rem; color: var(--text-dim); text-align: center; line-height: 1.6;
}
.no-data-msg span { font-size: .74rem; color: var(--text-dim); opacity: .7; }

/* ── Adoption status (Users table) ────────────────────────────────────────── */
.adoption-active   { font-size: .8rem; font-weight: 600; color: var(--green); }
.adoption-inactive { font-size: .8rem; color: var(--text-dim); }
.adoption-time     { font-size: .7rem; color: var(--text-dim); margin-top: 2px; }

/* ── Filter select (page actions) ─────────────────────────────────────────── */
.filter-select {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: .8rem; outline: none;
  transition: border-color .15s; cursor: pointer;
  font-family: var(--font);
  min-height: 34px;
}
.filter-select:focus { border-color: var(--accent); }

/* ── Empty table cell ─────────────────────────────────────────────────────── */
.empty-cell { text-align: center; padding: 24px; color: var(--text-dim); font-size: .82rem; }

/* ── Owner-protected row ──────────────────────────────────────────────────── */
.owner-row td { opacity: .75; }
.owner-lock {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 600; color: var(--text-dim);
  letter-spacing: .03em;
}
.owner-lock svg { opacity: .7; }

/* Users access-management screen */
.users-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  margin-bottom: 16px;
}
.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.users-search {
  width: min(320px, 100%);
  min-height: 34px;
}
.users-table-wrap { overflow-x: auto; }
.users-table { min-width: 760px; }
.users-table th,
.users-table td { vertical-align: middle; }
.user-cell { min-width: 220px; }
.user-name {
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
}
.user-email {
  color: var(--text-dim);
  font-size: .75rem;
  margin-top: 3px;
}
.user-brand-scope {
  display: inline-block;
  max-width: 240px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-actions { white-space: nowrap; }
.user-actions .btn-sm + .btn-sm { margin-left: 6px; }

@media (max-width: 760px) {
  .users-toolbar {
    align-items: stretch;
    justify-content: flex-start;
  }
  .users-toolbar .filter-select,
  .users-search { width: 100%; }
}

/* ── Leaderboard rank number ──────────────────────────────────────────────── */
.leaderboard-rank {
  flex: 0 0 18px; text-align: center;
  font-size: .7rem; font-weight: 700; color: var(--text-dim);
}
.sym-row:first-child .leaderboard-rank { color: var(--accent); }

/* ── Glance summary card ──────────────────────────────────────────────────── */
.glance-list { display: flex; flex-direction: column; gap: 0; }
.glance-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border-soft);
  font-size: .82rem;
}
.glance-row:last-child { border-bottom: none; }
.glance-label { color: var(--text-muted); }
.glance-value { font-weight: 600; color: var(--text); }
.glance-divider { height: 1px; background: var(--border-soft); margin: 4px 0; }
.fw-600 { font-weight: 600; }
.rep-email { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Actions group (period + export side by side) ─── */
.actions-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn-sm { font-size: .78rem; padding: 5px 12px; }

/* ── Section hint ──────────────────────────────────── */
.section-hint { font-size: .72rem; color: var(--text-dim); margin-left: 8px; }
.page-intro {
  color: var(--text-muted);
  font-size: .84rem;
  margin: -2px 0 16px;
  max-width: 760px;
  line-height: 1.55;
}
.overview-freshness {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  font-size: .72rem;
  color: var(--text-dim);
}
.overview-freshness-warn {
  color: #c9a227;
}
.data-status-ok { color: var(--text-dim); }
.data-status-ok span:nth-child(2) { color: var(--green); }
.data-status-info { color: var(--text-muted); }
.data-status-info span:nth-child(2) { color: var(--accent); }
.data-status-warning { color: #c9a227; }

/* ── Sortable column headers ───────────────────────── */
.sortable:hover { color: var(--text); }
.sort-icon { font-size: .7rem; color: var(--text-dim); margin-left: 2px; }

/* ── Coaching flags panel ──────────────────────────── */
.flags-panel {
  background: rgba(234,179,8,.04);
  border: 1px solid rgba(234,179,8,.18);
  border-radius: var(--radius);
  margin-bottom: 18px;
  padding: 12px 14px;
}
.flags-panel-ok {
  background: rgba(34,197,94,.035);
  border-color: rgba(34,197,94,.16);
}
.flags-panel-compact {
  padding: 10px 14px;
}
.flags-title {
  align-items: center; display: flex; gap: 7px;
  font-size: .8rem; font-weight: 700; color: var(--text); margin-bottom: 10px;
}
.flags-panel-compact .flags-title { margin-bottom: 5px; }
.flags-list { display: flex; flex-direction: column; gap: 6px; }
.flag-item {
  display: grid;
  grid-template-columns: auto minmax(88px, .35fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: .8rem; padding: 5px 0;
  border-bottom: 1px solid rgba(234,179,8,.12);
}
.flag-item:last-child { border-bottom: none; }
.flag-priority,
.flag-count {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(234,179,8,.1);
  color: var(--yellow);
  font-size: .63rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.flag-alert .flag-priority {
  background: rgba(239,68,68,.12);
  color: var(--red);
}
.flag-count {
  margin-left: auto;
  background: rgba(148,163,184,.08);
  color: var(--text-dim);
}
.flag-rep { font-weight: 650; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flag-msg { color: var(--text-muted); }
.flag-action {
  color: var(--accent);
  font-size: .74rem;
  white-space: nowrap;
  font-weight: 650;
}
.flag-empty {
  color: var(--text-muted);
  font-size: .8rem;
}
.flags-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid rgba(234,179,8,.1);
}
.flags-footer a {
  color: var(--accent);
  font-size: .74rem;
  font-weight: 700;
}
.flags-footer a:hover { text-decoration: underline; }
.flag-alert .flag-rep { color: var(--red); }
.flag-alert { border-color: rgba(239,68,68,.15); }

/* ── Live status panel ───────────────────────────────────────────────── */
.live-status-card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
  box-shadow: var(--surface-shadow-soft);
}
.overview-live-card {
  padding: 10px 14px;
  margin-bottom: 16px;
}
.live-title {
  align-items: center; display: flex; gap: 8px;
  font-size: .76rem; font-weight: 700; color: var(--text-muted); margin-bottom: 7px;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #22c55e;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  50% { opacity: .8; box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
.live-body { display: flex; flex-wrap: wrap; gap: 6px; }
.live-rep {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(79,122,248,.06); border: 1px solid rgba(79,122,248,.18);
  border-radius: 4px; padding: 4px 10px; font-size: .8rem;
}
.live-rep-name { color: var(--text); font-weight: 500; }
.live-rep-brand { color: var(--text-muted); font-size: .74rem; }
.live-rep-time  { color: var(--text-dim);  font-size: .72rem; }

.overview-chart-card {
  margin-bottom: 18px;
}
.overview-chart-card .canvas-wrap {
  height: 170px;
}

/* ── Rep link in table ───────────────────────────────────────────────── */
.rep-link { color: var(--text); text-decoration: none; }
.rep-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Rep scorecard page ──────────────────────────────────────────────── */
.rep-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.rep-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(79,122,248,.18); color: #93c5fd;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; flex-shrink: 0;
}
.rep-name     { font-size: 1rem; font-weight: 600; color: var(--text); }
.rep-email-sub { font-size: .78rem; color: var(--text-muted); }

/* ── Team comparison bars ────────────────────────────────────────────── */
.cmp-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; font-size: .8rem;
  border-bottom: 1px solid var(--border-soft);
}
.cmp-row:last-child { border-bottom: none; }
.cmp-label     { width: 80px; flex-shrink: 0; color: var(--text-muted); }
.cmp-bar-wrap  { flex: 1; height: 6px; background: rgba(255,255,255,.06); border-radius: 3px; position: relative; }
.cmp-bar       { height: 100%; border-radius: 3px; transition: width .4s ease; }
.cmp-bar-team  { position: absolute; top: -3px; width: 2px; height: 12px; background: rgba(255,255,255,.4); border-radius: 1px; }
.cmp-val       { width: 38px; text-align: right; font-weight: 600; }
.cmp-team-val  { color: var(--text-dim); font-size: .72rem; }

/* ── Training & Readiness page ───────────────────────────────────────── */
.training-info-banner {
  background: rgba(79,122,248,.06);
  border: 1px solid rgba(79,122,248,.13);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: .79rem; color: var(--text-muted); line-height: 1.52;
  margin-bottom: 16px;
}
.training-info-banner strong { color: var(--text); font-weight: 600; }

.campaign-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  margin-bottom: 10px;
}

.campaign-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.campaign-list {
  display: grid;
  gap: 11px;
}

.campaign-card {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(170px, .7fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--surface-shadow-soft);
}

.campaign-card-archived {
  opacity: .78;
  background: rgba(17,24,39,.74);
  border-color: rgba(148,163,184,.16);
}

.campaign-main {
  min-width: 0;
}

.campaign-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.campaign-title {
  color: var(--text);
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: normal;
  overflow-wrap: anywhere;
}

.campaign-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.campaign-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.campaign-published { background: var(--green-dim); color: var(--green); }
.campaign-draft { background: rgba(79,122,248,.12); color: var(--accent); }
.campaign-archived { background: var(--border); color: var(--text-dim); }
.campaign-required { background: var(--yellow-dim); color: var(--yellow); }

.campaign-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .74rem;
}

.campaign-description {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: .74rem;
  line-height: 1.45;
}

.campaign-progress {
  min-width: 0;
}

.campaign-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: .78rem;
  margin-bottom: 8px;
}

.campaign-progress-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(148,163,184,.15);
  overflow: hidden;
}

.campaign-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.campaign-overdue,
.campaign-complete,
.campaign-muted {
  white-space: nowrap;
  font-size: .7rem;
  font-weight: 700;
}

.campaign-overdue { color: var(--red); }
.campaign-complete { color: var(--green); }
.campaign-muted { color: var(--text-dim); }

.campaign-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.campaign-empty-card {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
  text-align: center;
}

.campaign-empty-card h4 {
  color: var(--text);
  font-size: .95rem;
  margin-bottom: 6px;
}

.campaign-empty-card p {
  color: var(--text-muted);
  font-size: .8rem;
  margin-bottom: 14px;
}

@media (max-width: 980px) {
  .campaign-section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .campaign-header-actions {
    justify-content: flex-start;
  }

  .campaign-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .campaign-actions {
    justify-content: flex-start;
  }
}

.readiness-badge {
  display: inline-flex; align-items: center;
  min-height: 20px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
  line-height: 1;
}
.readiness-ready    { background: var(--green-dim); color: var(--green); }
.readiness-needs    { background: var(--red-dim);   color: var(--red); }
.readiness-forced   { background: var(--yellow-dim); color: var(--yellow); }
.readiness-outdated { background: var(--yellow-dim); color: var(--yellow); }
.readiness-low      { background: var(--border); color: var(--text-muted); }

.readiness-score-wrap {
  display: flex; align-items: center; gap: 8px;
}
.readiness-bar-track {
  flex: 1; max-width: 88px; height: 6px;
  background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden;
}
.readiness-bar-fill {
  height: 100%; border-radius: 3px; min-width: 2px;
  transition: width .3s ease;
}
.readiness-score-num {
  font-size: .76rem; font-weight: 700; color: var(--text); min-width: 22px; text-align: right;
}

.btn-retrain {
  background: var(--yellow-dim); color: var(--yellow);
  border: 1px solid rgba(234,179,8,.3);
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-size: .74rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: opacity .15s; white-space: nowrap;
}
.btn-retrain:hover:not(:disabled) { opacity: .78; }
.btn-retrain:disabled { opacity: .45; cursor: not-allowed; }

.tr-dim     { font-size: .78rem; color: var(--text-muted); }
.tr-sub-email { font-size: .71rem; color: var(--text-dim); margin-top: 2px; }

.training-rep-table {
  min-width: 0;
}

.training-rep-table th,
.training-rep-table td {
  vertical-align: middle;
}

.training-rep-table .td-action {
  width: 130px;
}

/* ── Overview table: process score mini-bar ───────────────────────── */
.ps-cell { display: flex; align-items: center; gap: 6px; }
.ps-bar-track { flex: 1; max-width: 64px; height: 5px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; }
.ps-bar-fill  { height: 100%; border-radius: 3px; min-width: 2px; }
.ps-num       { font-size: .76rem; font-weight: 700; min-width: 22px; }

/* ── Process Adherence Scorecard card ─────────────────────────────── */
.sc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: var(--surface-shadow-soft);
}
.sc-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.sc-title { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.sc-sub   { font-size: .75rem; color: var(--text-dim); line-height: 1.5; max-width: 520px; }

/* Circular score ring */
.sc-score-wrap { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.sc-ring { width: 72px; height: 72px; transform: rotate(-90deg); }
.sc-ring-track { fill: none; stroke: var(--border); stroke-width: 3.5; }
.sc-ring-fill  { fill: none; stroke-width: 3.5; stroke-linecap: round;
                 transition: stroke-dasharray .4s ease; }
.sc-score-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.sc-score-num   { font-size: 1.25rem; font-weight: 800; line-height: 1; }
.sc-score-label { font-size: .58rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

/* Scorecard metrics */
.sc-metrics { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sc-metric-row {
  display: grid;
  grid-template-columns: 140px 1fr 44px auto;
  align-items: center; gap: 10px; font-size: .8rem;
}
.sc-metric-label  { color: var(--text-muted); white-space: nowrap; }
.sc-metric-bar-wrap { height: 5px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; }
.sc-metric-bar    { height: 100%; border-radius: 3px; min-width: 2px; transition: width .3s ease; }
.sc-metric-val    { font-weight: 700; text-align: right; font-size: .8rem; }
.sc-goal-chip     { font-size: .7rem; font-weight: 600; white-space: nowrap; padding: 1px 6px; background: rgba(255,255,255,.05); border-radius: 3px; }
.sc-metric-note   { font-size: .68rem; color: var(--text-dim); white-space: nowrap; display: none; }
@media (min-width: 900px) { .sc-metric-note { display: inline; } }

/* Footer stat row */
.sc-footer-row { display: flex; gap: 0; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.sc-stat { flex: 1; text-align: center; border-right: 1px solid var(--border-soft); padding: 0 8px; }
.sc-stat:last-child { border-right: none; }
.sc-stat-val { display: block; font-size: 1.1rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sc-stat-lbl { display: block; font-size: .67rem; color: var(--text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; }

/* ── 7-day sparkline ──────────────────────────────────────────────── */
.spark-row { display: flex; align-items: flex-end; gap: 6px; height: 52px; padding: 8px 0 4px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.spark-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 3px; transition: background .15s; }
.spark-day { font-size: .62rem; color: var(--text-dim); }

/* ── Recent Activity Timeline ────────────────────────────────────── */
.tl-card { padding: 14px 18px; }
.tl-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border-soft);
  font-size: .8rem;
}
.tl-row:last-child { border-bottom: none; }
.tl-icon   { width: 16px; text-align: center; font-size: .9rem; flex-shrink: 0; }
.tl-label  { flex: 1; color: var(--text-muted); }
.tl-detail { color: var(--text-dim); font-size: .74rem; margin-left: 4px; }
.tl-time   { color: var(--text-dim); font-size: .72rem; white-space: nowrap; flex-shrink: 0; }

/* ── Coaching Queue page ──────────────────────────────────────────── */
.coaching-info-banner {
  background: rgba(168,139,250,.06);
  border: 1px solid rgba(168,139,250,.17);
  border-radius: var(--radius);
  padding: 12px 15px;
  font-size: .8rem; color: var(--text-muted); line-height: 1.58;
  margin-bottom: 18px;
}
.coaching-info-banner strong { color: var(--text); font-weight: 600; }

/* Priority badges */
.cq-priority-badge {
  display: inline-flex; align-items: center;
  min-height: 20px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .67rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap;
  line-height: 1;
}
.cq-pri-high { background: var(--red-dim);    color: var(--red);    }
.cq-pri-med  { background: var(--yellow-dim); color: var(--yellow); }
.cq-pri-low  { background: var(--border);     color: var(--text-muted); }

/* Status badges */
.cq-status-badge {
  display: inline-flex; align-items: center;
  min-height: 20px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  line-height: 1;
  white-space: nowrap;
}
.cq-status-open      { background: rgba(79,122,248,.12); color: var(--accent); }
.cq-status-actioned  { background: var(--green-dim);     color: var(--green);  }
.cq-status-dismissed { background: var(--border);        color: var(--text-dim); }

/* Issue and note cells */
.cq-issue-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.cq-note        { font-size: .74rem; color: var(--text-dim); margin-top: 5px; }
.cq-suggestion  { font-size: .76rem; color: var(--text-dim); max-width: 280px; line-height: 1.45; }
.cq-repeat-badge {
  display: inline-flex;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(148,163,184,.1);
  color: var(--text-muted);
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.cq-start-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(79,122,248,.055);
  border: 1px solid rgba(79,122,248,.16);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .79rem;
}
.cq-start-strip strong { color: var(--text); font-weight: 700; }
.cq-start-breakdown {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.cq-start-breakdown span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(148,163,184,.08);
  color: var(--text-muted);
  font-size: .71rem;
  white-space: nowrap;
}

.cq-card-list {
  display: grid;
  gap: 9px;
}
.cq-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--surface-shadow-soft);
}
.cq-card-high { border-left-color: var(--red); }
.cq-card-medium { border-left-color: var(--yellow); }
.cq-card-low { border-left-color: rgba(79,122,248,.55); }
.cq-card-done { opacity: .72; }
.cq-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.cq-card-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}
.cq-card-rep {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}
.cq-card-rep .rep-link {
  font-size: .88rem;
  font-weight: 750;
}
.cq-card-rep span {
  color: var(--text-dim);
  font-size: .72rem;
}
.cq-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .82fr);
  gap: 12px;
}
.cq-card-block {
  min-width: 0;
}
.cq-card-label {
  display: block;
  color: var(--text-dim);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.cq-card-block p {
  color: var(--text-muted);
  font-size: .79rem;
  line-height: 1.42;
  margin: 0;
}
.cq-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.cq-actioned-meta {
  color: var(--text-dim);
  font-size: .74rem;
}

/* Action buttons strip */
.cq-action-btns {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.cq-btn {
  font-size: .74rem; font-weight: 650; font-family: var(--font);
  padding: 5px 10px; border-radius: var(--radius-sm);
  cursor: pointer; border: 1px solid transparent;
  transition: opacity .15s, background .15s, border-color .15s; white-space: nowrap;
}
.cq-btn-primary { background: var(--accent); color: #fff; border-color: rgba(79,122,248,.55); }
.cq-btn-note    { background: var(--accent-dim); color: var(--accent); border-color: rgba(79,122,248,.3); }
.cq-btn-retrain { background: var(--yellow-dim); color: var(--yellow); border-color: rgba(234,179,8,.3); }
.cq-btn-primary.cq-btn-retrain { background: var(--yellow); color: #171717; border-color: rgba(234,179,8,.75); }
.cq-btn-done    { background: var(--green-dim);  color: var(--green);  border-color: rgba(34,197,94,.3); }
.cq-btn-dismiss { background: transparent;       color: var(--text-dim); border-color: var(--border); }
.cq-btn:hover { opacity: .8; }
.cq-btn:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 900px) {
  .cq-start-strip,
  .cq-card-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .cq-start-breakdown,
  .cq-action-btns,
  .cq-card-footer {
    justify-content: flex-start;
  }

  .cq-card-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Script reference usage bars ────────────────────────────────────── */
.script-usage  { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.su-row        { display: flex; align-items: center; gap: 8px; font-size: .8rem; }
.su-label      { width: 70px; color: var(--text-muted); text-transform: capitalize; }
.su-bar-wrap   { flex: 1; height: 6px; background: rgba(255,255,255,.06); border-radius: 3px; }
.su-bar        { height: 100%; background: #4f7af8; border-radius: 3px; transition: width .4s ease; }
.su-val        { width: 28px; text-align: right; color: var(--text-muted); }

/* ── Manager annotations ─────────────────────────────────────────────── */
.annotations-panel { margin-bottom: 24px; }
.annotation-item {
  padding: 10px 0; border-bottom: 1px solid var(--border-soft);
}
.annotation-item:last-child { border-bottom: none; }
.annotation-meta { font-size: .72rem; color: var(--text-dim); margin-bottom: 4px; }
.annotation-text { font-size: .83rem; color: var(--text); line-height: 1.5; }
.annotation-form {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.annotation-status { font-size: .78rem; color: var(--green); }
.annotation-privacy-notice { font-size: .72rem; color: var(--text-dim); margin: 0; line-height: 1.4; }

/* ── Goal progress bars in rep table ────────────────────────────────── */
.goal-cell { display: flex; align-items: center; gap: 5px; min-width: 90px; }
.goal-bar-wrap { flex: 1; height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; min-width: 30px; }
.goal-bar { height: 100%; border-radius: 2px; transition: width .3s ease; }
.goal-target { font-size: .7rem; color: var(--text-dim); white-space: nowrap; }

/* ── Salesforce Comparison page ──────────────────────────────────────── */
.sf-banner {
  background: rgba(79,122,248,.055);
  border: 1px solid rgba(79,122,248,.18);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: .8rem; color: var(--text-muted); line-height: 1.55;
  margin-bottom: 16px;
}
.sf-banner strong { color: var(--text); font-weight: 600; }

.sf-note {
  margin: -12px 0 22px;
  color: var(--text-dim);
  font-size: .76rem;
  line-height: 1.45;
}

.sf-upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 18px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--surface-shadow-soft);
}
.sf-upload-card.hidden { display: none !important; }
.sf-upload-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sf-import-status { font-size: .75rem; color: var(--text-dim); }

.sf-upload-format { font-size: .76rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.sf-format-code {
  display: block; background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 4px; padding: 5px 10px; margin: 3px 0;
  font-family: 'Courier New', monospace; font-size: .75rem; color: var(--accent);
}
.sf-upload-row  { display: flex; gap: 10px; align-items: center; }
.sf-file-input  {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: .79rem; font-family: var(--font); padding: 6px 8px; cursor: pointer;
}
.sf-file-input::file-selector-button {
  background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 10px;
  font-family: var(--font); font-size: .77rem; cursor: pointer; margin-right: 8px;
}

.sf-feedback        { font-size: .79rem; padding: 8px 12px; border-radius: var(--radius-sm); }
.sf-feedback.hidden { display: none; }
.sf-feedback-success{ background: var(--green-dim);  color: var(--green);  }
.sf-feedback-error  { background: var(--red-dim);    color: var(--red);    }
.sf-feedback-warn   { background: var(--yellow-dim); color: var(--yellow); }

/* ARC Usage Tier badges */
.sf-tier-badge {
  display: inline-flex; align-items: center;
  min-height: 20px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
  line-height: 1;
}
.sf-tier-high { background: var(--green-dim);  color: var(--green);      }
.sf-tier-med  { background: var(--yellow-dim); color: var(--yellow);     }
.sf-tier-low  { background: var(--red-dim);    color: var(--red);        }
.sf-tier-none { background: var(--border);     color: var(--text-dim);   }

.sf-impact-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.sf-impact-grid .chart-card {
  border-left: 3px solid rgba(79,122,248,.45);
}
.sf-impact-grid .chart-title {
  margin-bottom: 10px;
}

/* ── Brand Scripts page ───────────────────────────────────────────────── */
.modal-panel-wide { max-width: 860px !important; }
.modal-panel-cf   { max-width: 560px !important; }

/* ── Callflow table (Scripts → Brand view) ───────────────────────────── */
.sv-cf-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-top: 16px;
}
.sv-cf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}
.sv-cf-table th {
  padding: 9px 14px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.sv-cf-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  color: var(--text);
}
.sv-cf-table tbody tr:last-child td { border-bottom: none; }
.sv-cf-table tbody tr:hover { background: var(--bg-hover); }
.sv-cf-key code {
  font-size: .78rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: ui-monospace, 'Cascadia Code', monospace;
}
.sv-cf-updated { color: var(--text-muted); font-size: .8rem; }
.sv-cf-count   { text-align: center; color: var(--text-muted); }
.sv-cf-actions { white-space: nowrap; }
.sv-cf-actions > * + * { margin-left: 5px; }
.sv-cf-btn-warn   { color: var(--yellow) !important; border-color: rgba(234,179,8,.35) !important; }
.sv-cf-btn-danger { color: var(--red) !important; border-color: rgba(239,68,68,.35) !important; }

.script-info-banner {
  margin-bottom: 16px;
  padding: 10px 13px;
  border: 1px solid rgba(79,122,248,.12);
  border-radius: var(--radius);
  background: rgba(79,122,248,.04);
  color: var(--text-muted);
  font-size: .79rem;
  line-height: 1.5;
}

.sv-brand-list { display: flex; flex-direction: column; gap: 12px; }
.sv-brand-card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--surface-shadow-soft);
}
.sv-brand-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elevated);
}
.sv-brand-title-wrap {
  min-width: 0;
}
.sv-brand-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sv-brand-name { font-size: .9rem; font-weight: 750; color: var(--text); }
.sv-brand-meta {
  display: block;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: .72rem;
}

.sv-source-badge {
  display: inline-flex; align-items: center;
  min-height: 20px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .68rem; font-weight: 600; letter-spacing: .03em; white-space: nowrap;
  line-height: 1;
}
.sv-source-fs     { background: rgba(34,197,94,.12); color: var(--green); }
.sv-source-static { background: var(--border);       color: var(--text-dim); }

.sv-version-list { display: flex; flex-direction: column; }
.sv-version-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--border-soft);
  font-size: .8rem;
}
.sv-version-row:last-child { border-bottom: none; }
.sv-row-static  { opacity: .75; }

.sv-status-badge {
  display: inline-flex; align-items: center; flex-shrink: 0;
  min-height: 20px;
  padding: 2px 8px; border-radius: 999px; margin-top: 1px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  line-height: 1;
}
.sv-status-active   { background: var(--green-dim);  color: var(--green);  }
.sv-status-draft    { background: var(--accent-dim); color: var(--accent); }
.sv-status-archived { background: var(--border);     color: var(--text-dim); }
.sv-status-static   { background: var(--border);     color: var(--text-dim); }

.sv-version-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sv-version-label { font-size: .82rem; color: var(--text); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-version-meta  { font-size: .72rem; color: var(--text-dim); }
.sv-changelog     { font-style: italic; }
.sv-version-actions { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; }

.sv-history {
  border-top: 1px solid var(--border-soft);
}

.sv-history summary {
  cursor: pointer;
  padding: 8px 14px;
  color: var(--text-dim);
  font-size: .74rem;
  font-weight: 650;
  list-style: none;
}

.sv-history summary::-webkit-details-marker { display: none; }
.sv-history summary:hover { color: var(--text-muted); background: rgba(255,255,255,.018); }
.sv-history summary::before {
  content: '+';
  display: inline-block;
  width: 14px;
  color: var(--accent);
}
.sv-history[open] summary::before { content: '-'; }
.sv-history-list .sv-version-row {
  background: rgba(0,0,0,.08);
}

.sv-editor-textarea {
  width: 100%; resize: vertical;
  font-family: 'Courier New', 'Consolas', monospace; font-size: .77rem;
  line-height: 1.6; min-height: 300px;
}

@media (max-width: 760px) {
  .sv-brand-header,
  .sv-version-row {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .sv-brand-header {
    flex-direction: column;
  }

  .sv-version-actions {
    justify-content: flex-start;
  }
}

/* ── Brand x Rep matrix ──────────────────────────────────────────────── */
.matrix-table-wrap { overflow-x: auto; }
.matrix-table { border-collapse: collapse; min-width: 100%; }
.matrix-rep-head, .matrix-head {
  padding: 8px 12px; font-size: .72rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap; background: var(--elevated);
}
.matrix-rep-cell { padding: 10px 14px; white-space: nowrap; }
.matrix-cell { padding: 8px 10px; text-align: center; min-width: 80px; border: 1px solid var(--border-soft); }
.matrix-rate { font-size: .85rem; font-weight: 600; }
.matrix-q    { font-size: .68rem; color: var(--text-dim); margin-top: 2px; }
.matrix-empty  { color: var(--text-dim); background: transparent; }
.matrix-neutral { background: rgba(79,122,248,.06); color: #93c5fd; }
.matrix-hot    { background: rgba(34,197,94,.10); color: #22c55e; }
.matrix-warm   { background: rgba(234,179,8,.08);  color: #eab308; }
.matrix-cold   { background: rgba(239,68,68,.08);  color: #ef4444; }

/* ── Usage adoption dashboard ───────────────────────────────────────────── */
.usage-filter-select {
  max-width: 220px;
}

.usage-insight-card {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  margin: -2px 0 16px;
  background: rgba(79,122,248,.045);
  border: 1px solid rgba(79,122,248,.14);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .8rem;
}

.usage-insight-empty {
  color: var(--text-muted);
  background: rgba(148,163,184,.045);
  border-color: rgba(148,163,184,.14);
}

.usage-insight-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(148,163,184,.08);
  color: var(--text-muted);
  white-space: nowrap;
}

.usage-insight-chip strong {
  color: var(--text);
  font-weight: 700;
  margin-right: 4px;
}

.usage-user-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--surface-shadow-soft);
}

.usage-user-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.usage-user-name {
  color: var(--text);
  font-size: .92rem;
  font-weight: 750;
  line-height: 1.3;
}

.usage-user-sub {
  color: var(--text-dim);
  font-size: .73rem;
  margin-top: 2px;
}

.usage-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(148,163,184,.08);
  font-size: .72rem;
  font-weight: 750;
  white-space: nowrap;
}

.usage-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.usage-summary-grid div {
  min-width: 0;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.04);
}

.usage-summary-grid span {
  display: block;
  color: var(--text-dim);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usage-summary-grid strong {
  display: block;
  color: var(--text);
  font-size: .88rem;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usage-chart-card {
  margin-bottom: 20px;
}

.usage-chart-card .canvas-wrap {
  height: 190px;
}

.usage-upsell-header {
  margin-top: 4px;
  margin-bottom: 10px;
}

.usage-upsell-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.usage-upsell-panel {
  display: grid;
  grid-template-columns: minmax(240px, .75fr) minmax(0, 1.35fr);
  gap: 14px;
  margin-bottom: 22px;
}

.usage-upsell-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}

.usage-upsell-card-title {
  color: var(--text);
  font-size: .83rem;
  font-weight: 750;
  margin-bottom: 12px;
}

.upsell-bar-row {
  display: grid;
  grid-template-columns: minmax(104px, 1fr) minmax(72px, 1.2fr) 32px;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(148,163,184,.08);
}

.upsell-bar-row:last-child {
  border-bottom: 0;
}

.upsell-bar-label {
  color: var(--text-muted);
  font-size: .78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upsell-bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148,163,184,.13);
  overflow: hidden;
}

.upsell-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #22c55e);
}

.upsell-bar-row strong {
  color: var(--text);
  font-size: .78rem;
  text-align: right;
}

.usage-upsell-table {
  margin: 0;
  max-height: 320px;
  overflow: auto;
}

.usage-upsell-empty {
  padding: 16px 0;
}

@media (max-width: 900px) {
  .usage-upsell-panel {
    grid-template-columns: 1fr;
  }

  .usage-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .usage-filter-select {
    max-width: none;
    width: 100%;
  }

  .usage-user-heading {
    flex-direction: column;
  }

  .usage-summary-grid {
    grid-template-columns: 1fr;
  }

  .usage-insight-chip {
    white-space: normal;
  }
}

/* ── Brand Admin + Scripts cards ─────────────────────────────────────────── */
.brand-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.brand-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.brand-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.brand-card-name   { font-size: 1rem; font-weight: 700; color: var(--text); }
.brand-card-id     { font-size: .72rem; color: var(--text-dim); margin-top: 3px; font-family: monospace; }
.brand-card-badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.brand-card-stats  {
  display: flex; gap: 24px; align-items: flex-start;
  padding: 12px 0; margin: 12px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.brand-stat        { text-align: center; }
.brand-stat-value  { font-size: 1.15rem; font-weight: 700; color: var(--text); line-height: 1; }
.brand-stat-sub    { font-size: .82rem; font-weight: 500; color: var(--text-muted); }
.brand-stat-hint   { font-size: .62rem; font-weight: 400; color: var(--text-dim); }
.brand-stat-label  { font-size: .66rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 3px; }
.brand-stat-reps   { min-width: 72px; }
.brand-card-footer { display: flex; justify-content: space-between; align-items: center; }
.brand-card-cta    { font-size: .8rem; color: var(--accent); font-weight: 500; }

/* ── Brand detail sections ───────────────────────────────────────────────── */
.detail-section    { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.detail-dl         { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: .83rem; }
.detail-dl dt      { color: var(--text-muted); font-weight: 500; }
.detail-dl dd      { color: var(--text); margin: 0; }
.section-count     { font-size: .75rem; color: var(--text-muted); font-weight: 400; margin-left: 8px; }

/* ── Limit banner (Brand Admin header) ──────────────────────────────────── */
.limit-banner {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 10px 16px;
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius); margin-bottom: 0; margin-top: 12px;
  font-size: .82rem;
}
.limit-banner-items { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.limit-item    { display: flex; align-items: center; gap: 6px; }
.limit-label   { color: var(--text-muted); font-size: .78rem; }
.limit-value   { font-weight: 700; color: var(--text); font-size: .82rem; }
.limit-item-warn .limit-value { color: var(--yellow); }
.limit-manage-btn { margin-left: auto; flex-shrink: 0; }

/* ── Brand modal enterprise layout ──────────────────────────────────────── */
.bm-body { padding: 0 !important; gap: 0 !important; }
.bm-body form { display: flex; flex-direction: column; }
.bm-section {
  padding: 20px 28px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.bm-section-last { border-bottom: none; padding-bottom: 20px; }
.bm-section-title {
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: 14px;
}
.bm-section-optional {
  font-size: .72rem; font-weight: 400; color: var(--text-dim);
  text-transform: none; letter-spacing: 0; margin-left: 4px;
}
.bm-subtitle   { font-size: .78rem; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.bm-required   { color: var(--accent); font-size: .78rem; }
.bm-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin-bottom: 4px;
}
@media (max-width: 560px) { .bm-grid-2 { grid-template-columns: 1fr; } }
.bm-textarea {
  resize: vertical; min-height: 108px;
  font-family: var(--font-mono, ui-monospace, 'Cascadia Code', monospace);
  font-size: .82rem; line-height: 1.5;
}
.form-input-readonly {
  background: var(--bg-hover) !important; cursor: not-allowed; opacity: .65;
}
.bm-hint-block { display: block; margin-top: 4px; }
.bm-warning-hint { color: var(--yellow) !important; margin-top: 6px; }
#bcError { margin: 0 28px 12px; }

/* ── Health cards (Monitoring page) ─────────────────────────────────────── */
.health-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 4px;
}
.health-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.health-card-warn { border-color: rgba(234,179,8,.4); background: rgba(234,179,8,.04); }
.health-card-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.health-card-value { font-size: 1.15rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.health-card-sub   { font-size: .72rem; color: var(--text-dim); margin-top: 3px; }
.health-num        { font-size: 1.3rem; }
.health-badge      { font-size: .82rem; font-weight: 700; }
.health-ok   { color: var(--green); }
.health-warn { color: var(--yellow); }
.badge-warning { background: var(--yellow-dim); color: var(--yellow); padding: 2px 7px; border-radius: 4px; font-size: .76rem; font-weight: 600; }
.badge-ok      { background: var(--border); color: var(--text-muted); padding: 2px 7px; border-radius: 4px; font-size: .76rem; }

/* ── Brand validation panel ──────────────────────────────────────────────── */
.brand-validation-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.bv-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elevated);
}
.bv-title   { font-size: .88rem; font-weight: 600; color: var(--text); flex: 1; }
.bv-score   { font-size: .78rem; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.bv-status  { flex-shrink: 0; }
.bv-close   { margin-left: 6px; }
.bv-checks  { padding: 8px 0; }
.bv-check-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 16px;
  font-size: .82rem;
  border-bottom: 1px solid var(--border-soft);
}
.bv-check-row:last-child { border-bottom: none; }
.bv-icon   { flex-shrink: 0; width: 14px; font-weight: 700; }
.bv-label  { flex: 1; color: var(--text); }
.bv-message { color: var(--text-muted); font-size: .78rem; margin-left: 4px; }
.bv-pass .bv-icon { color: var(--green); }
.bv-fail .bv-icon { color: var(--red); }
.bv-warn .bv-icon { color: var(--yellow); }
.bv-info .bv-icon { color: var(--accent); }
.bv-errors-section { padding: 8px 16px 12px; border-top: 1px solid var(--border-soft); }
.bv-errors-title   { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--red); margin-bottom: 6px; }
.bv-error-row      { font-size: .82rem; color: var(--red); padding: 2px 0; }
.bv-loading        { padding: 20px; text-align: center; }
