/* ============================================================
   Chatti Vonage Console
   Branded to Chatti: deep purple-led palette with the signature
   gradient (#3D3486 → #6D539C → #5268AB), white surfaces, and
   the Nunito rounded geometric typeface that echoes the Chatti
   wordmark. Friendly, fluid, confident.
   ============================================================ */

:root {
  /* surfaces — clean white base, very subtle warm purple tints */
  --bg:           #fafaff;
  --bg-warm:      #f4f3fb;
  --surface:      #ffffff;
  --surface-2:    #f6f5fc;
  --surface-3:    #ecebf5;

  /* ink — deep neutrals with a faint cool cast to harmonise with purple */
  --ink:          #1c1a2e;
  --ink-2:        #3a374f;
  --ink-3:        #6c6883;
  --ink-mute:     #9c98ad;

  /* line */
  --line:         #e3e1ee;
  --line-2:       #cdcbe0;
  --line-soft:    #eeedf6;

  /* accents — Chatti brand purples */
  --accent:       #6D539C;          /* primary purple — the Chatti chatti */
  --accent-deep:  #3D3486;          /* deep purple — gradient start */
  --accent-blue:  #5268AB;          /* indigo blue — gradient end */
  --accent-ink:   #2a2363;          /* darkest, for high-contrast text on accent-soft */
  --accent-soft:  #efebf8;          /* lightest tint for hover/badges */
  --accent-line:  #c8bfe1;
  --gradient:     linear-gradient(135deg, #3D3486 0%, #6D539C 50%, #5268AB 100%);

  /* status colours — tuned to coexist with the purple palette */
  --good:         #2f7a52;
  --good-soft:    #d9efe2;
  --warn:         #a06a16;
  --warn-soft:    #fae9c5;
  --bad:          #b8423a;
  --bad-soft:     #f4dcd9;

  /* type — Nunito is the closest free Google font to the Chatti wordmark
     (rounded geometric sans). Single family throughout, varying weight
     and size for hierarchy. Mono kept for data tables. */
  --serif: 'Nunito', 'Avenir Next Rounded', 'Avenir Next', system-ui, sans-serif;
  --sans:  'Nunito', 'Avenir Next', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --mono:  'JetBrains Mono', 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 0 var(--line);
  --shadow:    0 1px 3px rgba(40, 30, 80, 0.06), 0 0 0 1px var(--line);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 0% -10%, rgba(109, 83, 156, 0.06), transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(82, 104, 171, 0.05), transparent 35%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font: inherit; cursor: pointer; }
code, pre { font-family: var(--mono); }
input, textarea, select { font: inherit; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(40, 30, 80, 0.03);
}
.topbar-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.brand-link:hover { opacity: 0.8; }
.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}
.brand-divider {
  width: 1px; height: 18px; background: var(--line-2);
  align-self: center;
  margin: 0 2px;
}
.brand-sub {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.topbar-meta {
  display: flex; gap: 28px;
}
.meta-item { display: flex; flex-direction: column; align-items: flex-end; }
.meta-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 700;
}
.meta-value {
  font-family: var(--mono); font-size: 13px;
  color: var(--ink); font-weight: 500;
}

@media (max-width: 800px) {
  .brand-divider, .brand-sub { display: none; }
  .topbar-meta { display: none; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 28px 60px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(420px, 1fr);
  gap: 28px;
  align-items: start;
}
.layout[hidden], .layout-usage[hidden], .layout-quality[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-list { min-height: 600px; }
.panel-detail {
  position: sticky; top: 78px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* ============================================================
   PANEL HEAD (filters + title)
   ============================================================ */
.panel-head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.panel-title-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px;
  gap: 16px;
}
.panel-title-actions {
  display: flex; align-items: center; gap: 8px;
}

/* Bulk run progress strip */
.bulk-strip {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--surface-2) 100%);
  font-size: 13px;
  display: flex; flex-direction: column; gap: 10px;
}
.bulk-strip.complete {
  background: var(--good-soft);
}
.bulk-strip.failed {
  background: var(--bad-soft);
}
.bulk-strip-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.bulk-strip-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.bulk-strip-title em {
  font-style: italic; font-weight: 400;
  color: var(--ink-3);
  margin-left: 8px;
}
.bulk-strip-stats {
  display: flex; gap: 18px;
  font-size: 12px;
  color: var(--ink-2);
}
.bulk-strip-stats span {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.bulk-strip-stats strong {
  color: var(--ink);
  font-weight: 600;
}
.bulk-progress {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.bulk-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}
.bulk-strip.complete .bulk-progress-fill { background: var(--good); }
.bulk-strip-current {
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--mono);
}
.bulk-strip-current strong { color: var(--ink); font-weight: 500; }
.panel-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.015em;
  margin: 0;
}
.panel-title em {
  font-style: italic; font-weight: 400;
  color: var(--ink-3);
  font-size: 0.85em;
}
.filters {
  display: flex; gap: 12px; align-items: center;
  flex-wrap: wrap;
}
.search {
  flex: 1; min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  transition: border-color 0.15s;
}
.search:focus { outline: none; border-color: var(--accent); }
.search::placeholder { color: var(--ink-mute); }

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px;
}
.seg-btn {
  background: transparent;
  border: 0;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  border-radius: 4px;
  transition: all 0.12s;
  text-align: center;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 0 0 1px var(--line);
}

/* Lock period & view buttons to fixed widths so the toolbar doesn't
   shift when you click between them. The widest labels set the size. */
.seg-period .seg-btn { min-width: 56px; }
.seg-view   .seg-btn { min-width: 76px; }
.seg-country .seg-btn { min-width: 44px; }

/* ============================================================
   ACCOUNT TABLE
   ============================================================ */
.list-wrap { padding: 0; }
.account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.account-table thead th {
  font-family: var(--sans);
  text-align: left;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 14px 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
.account-table thead th[data-num] { text-align: right; }
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--ink); }
.th-sort.sort-asc::after  { content: ' ↑'; color: var(--accent); }
.th-sort.sort-desc::after { content: ' ↓'; color: var(--accent); }

.account-table tbody tr {
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.08s;
  cursor: pointer;
}
.account-table tbody tr:hover { background: var(--surface-2); }
.account-table tbody tr.selected {
  background: var(--accent-soft);
}
.account-table tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.account-table td {
  padding: 12px 16px;
  vertical-align: middle;
}
.account-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.cell-customer { display: flex; flex-direction: column; gap: 2px; }
.cell-customer-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.cell-customer-name.unset {
  font-family: var(--sans);
  font-weight: 400;
  font-style: italic;
  color: var(--ink-mute);
  font-size: 13px;
}
.cell-customer-tags {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  border-radius: 3px;
  letter-spacing: 0.02em;
}

.cell-name { color: var(--ink-2); font-weight: 500; }
.cell-apikey {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0;
  white-space: nowrap;
}
.cell-apikey .apikey-text { display: inline-block; }
.cell-apikey .apikey-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 2px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink-mute);
  cursor: pointer;
  vertical-align: middle;
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}
tr:hover .cell-apikey .apikey-copy { opacity: 1; }
.cell-apikey .apikey-copy:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--brand-primary, #6d539c);
}
.cell-apikey .apikey-copy:active {
  background: var(--brand-primary, #6d539c);
  color: #fff;
}

.cell-balance {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink);
}

.cell-senders {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.cell-senders.zero { color: var(--ink-mute); font-weight: 400; }

.cell-when {
  font-size: 12px; color: var(--ink-3);
}
.cell-when .pulse {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  animation: pulse 1.4s infinite;
  vertical-align: middle;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.badge {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 6px;
}
.badge-suspended { background: var(--bad-soft); color: var(--bad); }
.badge-primary   { background: var(--accent-soft); color: var(--accent-ink); }

/* ============================================================
   DETAIL PANEL
   ============================================================ */
.detail-empty {
  text-align: center;
  padding: 80px 32px;
  color: var(--ink-3);
}
.empty-mark {
  font-size: 48px;
  color: var(--accent);
  font-family: var(--serif);
  margin-bottom: 16px;
  opacity: 0.4;
}
.detail-empty h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  margin: 0 0 8px;
  color: var(--ink);
}
.detail-empty p { margin: 0; font-size: 13px; }

.detail-head {
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.detail-eyebrow {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
  margin-bottom: 6px;
}
.detail-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 12px;
}
.detail-key {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 24px;
}
.detail-key code {
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface-3);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.btn-copy {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.12s;
}
.btn-copy:hover { color: var(--accent); border-color: var(--accent-line); }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 8px;
}
.stat {
  display: flex; flex-direction: column; gap: 4px;
}
.stat-num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}
.stat-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 500;
}

/* ============================================================
   DETAIL SECTIONS
   ============================================================ */
.detail-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line-soft);
}
.detail-section:last-child { border-bottom: 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
  gap: 12px;
}
.section-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.005em;
  margin: 0;
}
.section-sub {
  font-style: italic; font-weight: 400;
  font-size: 12px;
  color: var(--ink-mute);
  margin-left: 6px;
  font-family: var(--serif);
}
.section-actions { display: flex; gap: 8px; }

/* form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field-full { grid-column: 1 / -1; }
.field-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field-label .muted { color: var(--ink-mute); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }
.input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink);
  font-family: var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input { resize: vertical; min-height: 56px; font-family: var(--sans); }
.form-actions {
  grid-column: 1 / -1;
  display: flex; justify-content: flex-end; align-items: center;
  gap: 12px;
}
.form-status {
  font-size: 12px; color: var(--ink-mute);
  font-style: italic;
  transition: opacity 0.2s;
}
.form-status.success { color: var(--good); }
.form-status.error   { color: var(--bad); }

/* prose blurb above forms */
.section-blurb {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-3);
  margin: -4px 0 14px;
  line-height: 1.5;
  max-width: 60ch;
}
.section-blurb em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink-2);
}

/* input with right-side toggle (for password-style fields) */
.input-with-action {
  position: relative;
  display: flex; align-items: stretch;
}
.input-with-action .input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  padding-right: 56px;
}
.btn-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 8px;
  border-radius: 3px;
}
.btn-toggle:hover { color: var(--accent); background: var(--accent-soft); }

/* sender meta */
.sender-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.meta-mini {
  display: flex; flex-direction: column; gap: 2px;
}
.meta-mini span {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.meta-mini em {
  font-family: var(--sans);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

/* sender type breakdown */
.sender-types {
  display: flex; gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.type-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.type-chip strong {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin-right: 4px;
}
.type-chip.alphanumeric  { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); }
.type-chip.shortcode     { background: var(--good-soft);   color: var(--good); border-color: #b9d4ae; }
.type-chip.longcode      { background: var(--surface-3); }
.type-chip.numeric_short { background: var(--bad-soft);    color: var(--bad); border-color: #d3a39d; }

/* sender table */
.sender-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* Allow horizontal scroll if columns can't all fit at narrow widths.
     overflow-y: auto for vertical scroll within max-height. */
  overflow-x: auto;
  overflow-y: auto;
  max-height: 480px;
}
.sender-table {
  width: 100%;
  min-width: 600px;  /* prevents the table from squishing too narrow before scroll kicks in */
  border-collapse: collapse;
  font-size: 13px;
}
.sender-table thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 500; color: var(--ink-mute);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.sender-table thead th[data-num] { text-align: right; }
.sender-table tbody tr { border-bottom: 1px solid var(--line-soft); }
.sender-table tbody tr:last-child { border-bottom: 0; }
.sender-table tbody tr:hover { background: var(--surface-2); }
.sender-table td { padding: 10px 12px; vertical-align: middle; white-space: nowrap; }
.sender-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
/* Tighten the date columns so they don't dominate horizontal space */
.sender-table td.date-cell { font-size: 12px; color: var(--ink-mute); }
.sender-id-cell {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink);
  font-size: 13px;
}
.type-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.type-tag.alphanumeric  { background: var(--accent-soft); color: var(--accent-ink); }
.type-tag.shortcode     { background: var(--good-soft);   color: var(--good); }
.type-tag.longcode      { background: var(--surface-3);   color: var(--ink-2); }
.type-tag.numeric_short { background: var(--bad-soft);    color: var(--bad); }
.type-tag.unknown       { background: var(--surface-3);   color: var(--ink-mute); }

.country-cell {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

.date-cell {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  white-space: nowrap;
}

/* ============================================================
   JOB BANNER
   ============================================================ */
.job-banner {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line);
}
.job-banner.running  { background: var(--warn-soft); border-color: #d8c084; color: var(--warn); }
.job-banner.failed   { background: var(--bad-soft);  border-color: #d3a39d; color: var(--bad); }
.job-banner.success  { background: var(--good-soft); border-color: #aac4a0; color: var(--good); }
.job-banner .spin {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  border: 1px solid transparent;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary {
  background: var(--accent);
  color: #fffaf0;
  border-color: var(--accent-ink);
  box-shadow: 0 1px 0 var(--accent-ink), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover  { background: var(--accent-ink); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 0 0 var(--accent-ink); }
.btn-primary:disabled {
  background: var(--surface-3); color: var(--ink-mute);
  border-color: var(--line); box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface-2); }

.icon-rot { display: inline-block; transition: transform 0.4s ease; }
.btn-ghost:hover .icon-rot { transform: rotate(180deg); }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-mute);
  font-style: italic;
  font-family: var(--serif);
  font-size: 14px;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 100;
  animation: toast-in 0.2s ease;
}
.toast.error { background: var(--bad); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }

/* ============================================================
   USAGE PAGE
   ============================================================ */

/* Top nav */
.topnav {
  display: flex;
  gap: 4px;
  margin-left: 24px;
}
.topnav-link {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  background: none;
  border: 1px solid transparent;
  color: var(--ink-3);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.topnav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}
.topnav-link.active {
  color: #fff;
  background: var(--gradient);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(61, 52, 134, 0.2);
}

/* Layout */
.layout-usage {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 32px 96px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Usage header */
.usage-head { padding: 0; }
.usage-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.usage-title {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.05;
}
.usage-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}
.usage-range {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  display: inline-block;
}
.usage-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* KPI cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

/* Chart card */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.chart-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--ink-3);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.dot-msg { background: var(--accent); }
.dot-fail { background: var(--bad); }
.chart-body { width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .ax-x, .chart-svg .ax-y {
  font-family: var(--mono);
  font-size: 10px;
  fill: var(--ink-3);
}
.chart-svg .ax-x { text-anchor: middle; }
.chart-svg .ax-y { text-anchor: end; }
.chart-svg .bar { transition: opacity 0.15s; }
.chart-svg .bar-msg { fill: var(--accent); }
.chart-svg .bar-fail { fill: var(--bad); }
.chart-svg .bar:hover { opacity: 0.75; cursor: pointer; }
.chart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-3);
  font-style: italic;
}

/* Cards (top customers, top countries, etc.) */
.view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-head h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.card-sub {
  font-size: 11px;
  color: var(--ink-3);
  font-style: italic;
}
.card-actions { display: flex; gap: 10px; align-items: center; }
.card-body { padding: 12px 18px 16px; }

/* Rank rows (top customers / countries on fleet view) */
.rank-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background 0.1s;
}
.rank-row:last-child { border-bottom: none; }
.rank-row:hover { background: var(--surface-2); }
.rank-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}
.rank-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.rank-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* Usage data tables */
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.usage-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.usage-table th.num { text-align: right; }
.usage-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
}
.usage-table td.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.usage-table td.muted { color: var(--ink-3); }
.usage-table td.small { font-size: 12px; }
.usage-table tr.usage-row { cursor: pointer; }
.usage-table tr.usage-row:hover { background: var(--surface-2); }
.usage-table code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .view-grid { grid-template-columns: 1fr; }
  .usage-controls { width: 100%; }
}

/* ============================================================
   QUALITY PAGE
   ============================================================ */

.layout-quality {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 32px 96px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quality-explainer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}
.quality-explainer .legend-item { gap: 6px; }
.dot-red    { background: #b8423a; }
.dot-amber  { background: #c47b1f; }
.dot-green  { background: #487850; }

/* Scorecard grid */
.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.empty-card {
  grid-column: 1/-1;
  padding: 28px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink-3);
  text-align: center;
  font-size: 14px;
}
.empty-card code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 12px;
}
.score-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.score-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(40,30,20,0.08);
}
.score-red    { border-left-color: #b8423a; background: #fcf6f2; }
.score-amber  { border-left-color: #c47b1f; background: #fcf8ee; }
.score-green  { border-left-color: #487850; }
.score-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.score-network { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.score-mcc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.score-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.country-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.score-rate {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.score-rate-sub {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.score-rows {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.score-label { color: var(--ink-3); }
.score-value {
  font-family: var(--mono);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.score-value.bad  { color: #b8423a; font-weight: 600; }
.score-value.good { color: #487850; font-weight: 600; }

/* Drill chart */
.drill-chart {
  background: var(--surface);
  padding-top: 8px;
}
.drill-chart .chart-svg .line {
  fill: none;
  stroke-width: 2;
}
.drill-chart .chart-svg .line-rate { stroke: var(--accent); stroke-width: 2.5; }
.drill-chart .chart-svg .line-lat  { stroke: var(--accent-blue); stroke-dasharray: 4 3; }
.drill-chart .chart-svg .dot-rate { fill: var(--accent); }
.drill-chart .chart-svg .ax-y.ax-right { text-anchor: start; }
.drill-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-3);
}
.dot-rate-sw {
  display: inline-block; width: 14px; height: 2px;
  background: var(--accent); vertical-align: middle;
}
.dot-lat-sw {
  display: inline-block; width: 14px; height: 2px;
  background: var(--accent-blue);
  vertical-align: middle;
  background-image: linear-gradient(to right, var(--accent-blue) 60%, transparent 0%);
  background-size: 4px 2px;
  background-repeat: repeat-x;
}
.drill-section-title {
  margin: 24px 0 10px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.drill-close {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
  background: none;
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.drill-close:hover {
  color: var(--ink);
  background: var(--surface-2);
}

/* Search input on quality page */
#quality-search {
  font-family: var(--sans);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  width: 280px;
  background: var(--surface);
}
#quality-search:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 700px) {
  .scorecard-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PRODUCT TABS — inside the customer detail panel
   ============================================================ */
.prod-tabs {
  display: flex;
  gap: 4px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.prod-tab {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: none;
  border: 0;
  color: var(--ink-3);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.prod-tab:hover { color: var(--ink); background: var(--surface-2); }
.prod-tab.active {
  color: var(--accent-ink);
  background: var(--accent-soft);
}
.prod-tab-count {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.prod-tab-count:empty { display: none; }

/* Overview tab: 4 product cards */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}
.overview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  border-left: 3px solid var(--accent-line);
}
.overview-sms     { border-left-color: var(--accent); }
.overview-numbers { border-left-color: var(--accent-blue); }
.overview-voice   { border-left-color: var(--ink-mute); }
.overview-verify  { border-left-color: var(--ink-mute); }
.oc-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.oc-value {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.oc-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
}

/* Numbers tab */
.numbers-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.num-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.num-summary-label {
  color: var(--ink-3);
  text-transform: uppercase;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-right: 6px;
  min-width: 76px;
}
.num-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ink-2);
}
.num-chip strong { color: var(--ink); font-weight: 700; }
.num-chip-feature {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-ink);
}
.num-chip-feature strong { color: var(--accent-ink); }
.num-type {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}
.feat-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 3px;
}
.numbers-table-wrap {
  max-height: 480px;
  overflow-y: auto;
}
.empty-card-inline {
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
}
.empty-card-inline code {
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-ink);
}

/* Row number column in ledger */
.th-rownum, .cell-rownum {
  width: 36px;
  text-align: right;
  padding-right: 12px !important;
  font-family: var(--mono);
  color: var(--ink-mute);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.th-rownum {
  font-weight: 700;
  letter-spacing: 0.05em;
}
/* Selected row keeps its number visible */
tr.selected .cell-rownum { color: var(--accent); }

/* Dimmed name placeholder */
.muted-name {
  color: var(--ink-mute);
  font-style: italic;
}

/* ─────────────────────────────────────────────────────────────────
   Login page
   ───────────────────────────────────────────────────────────────── */

body.login-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(109, 83, 156, 0.4), transparent 50%),
    radial-gradient(circle at 90% 90%, rgba(82, 104, 171, 0.3), transparent 50%),
    linear-gradient(135deg, #2a2540, #1f1c30);
  font-family: 'Nunito', system-ui, sans-serif;
  color: #f3f1f8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-shell {
  width: 100%;
  max-width: 440px;
}

.login-card {
  background: rgba(255, 255, 255, 0.97);
  color: #2a2540;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  padding: 36px 32px;
  position: relative;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  height: 38px;
  width: auto;
  display: inline-block;
}

.login-sub {
  font-size: 13px;
  color: #6f6986;
  letter-spacing: 0.04em;
  margin-top: 6px;
  text-transform: uppercase;
  font-weight: 600;
}

.login-step {
  display: block;
}

/* The HTML `hidden` attribute should hide an element. But if `.login-step`
   sets `display: block` above, that overrides `hidden`. This rule restores
   the expected behaviour: hidden steps are not displayed. */
.login-step[hidden] {
  display: none !important;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  color: #2a2540;
}

.login-help {
  font-size: 14px;
  line-height: 1.5;
  color: #5d5775;
  margin: 0 0 20px;
}

.login-field {
  display: block;
  margin-bottom: 16px;
}

.login-field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a4566;
  margin-bottom: 6px;
}

.login-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid #d8d2e3;
  border-radius: 8px;
  background: #fff;
  color: #2a2540;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-field input:focus {
  outline: none;
  border-color: #6d539c;
  box-shadow: 0 0 0 3px rgba(109, 83, 156, 0.15);
}

.login-btn {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #3D3486, #6D539C, #5268AB);
  color: #fff;
  cursor: pointer;
  margin-top: 6px;
  transition: filter 0.15s, transform 0.05s;
}

.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fde7eb;
  border: 1px solid #f5a8b6;
  color: #8d2436;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.login-link {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  color: #6d539c;
  font-size: 13px;
  font-family: inherit;
  margin-top: 14px;
  cursor: pointer;
  text-align: center;
}

.login-link:hover { text-decoration: underline; }

.login-qr {
  text-align: center;
  margin: 8px 0 16px;
}

.login-qr img {
  width: 200px;
  height: 200px;
  border: 6px solid #fff;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.login-secret-fallback {
  font-size: 13px;
  margin-bottom: 16px;
}

.login-secret-fallback summary {
  cursor: pointer;
  color: #6d539c;
  text-align: center;
  padding: 4px;
}

.login-secret-text {
  margin-top: 10px;
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  background: #f5f3f9;
  border: 1px solid #e2dceb;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.login-foot {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: #8a849e;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─────────────────────────────────────────────────────────────────
   Authenticated header — user info + logout
   ───────────────────────────────────────────────────────────────── */

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-mute, #6f6986);
}

.user-bar-name {
  font-weight: 600;
  color: var(--ink, #2a2540);
}

.user-bar-role {
  background: rgba(109, 83, 156, 0.12);
  color: #6d539c;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-bar-role.role-admin { background: #fde7eb; color: #8d2436; }
.user-bar-role.role-power { background: rgba(109, 83, 156, 0.15); color: #6d539c; }
.user-bar-role.role-viewer { background: #e8f0fb; color: #3559a8; }
.user-bar-role.role-customer { background: #e8f5ee; color: #2a6e44; }

.user-bar-logout {
  background: none;
  border: 1px solid #d8d2e3;
  color: var(--ink, #2a2540);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.user-bar-logout:hover { background: #f5f3f9; }

/* ─────────────────────────────────────────────────────────────────
   Users management page (admin only)
   ───────────────────────────────────────────────────────────────── */

.users-grid {
  display: grid;
  gap: 12px;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid #e8e4f0;
  border-radius: 8px;
}

.user-row.disabled { opacity: 0.5; }

.user-row-id {
  display: flex;
  flex-direction: column;
}

.user-row-email {
  font-weight: 600;
  color: var(--ink, #2a2540);
}

.user-row-name {
  font-size: 12px;
  color: var(--ink-mute, #6f6986);
}

.user-row-meta {
  font-size: 12px;
  color: var(--ink-mute, #6f6986);
}

.user-row-actions {
  display: flex;
  gap: 6px;
}

.btn-mini {
  background: none;
  border: 1px solid #d8d2e3;
  border-radius: 5px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
}

.btn-mini.danger { color: #8d2436; border-color: #f5a8b6; }
.btn-mini.danger:hover { background: #fde7eb; }
.btn-mini:hover { background: #f5f3f9; }

.invite-link-display {
  margin-top: 12px;
  padding: 14px;
  background: #f5f3f9;
  border: 1px dashed #b3a4d3;
  border-radius: 6px;
  font-size: 13px;
  word-break: break-all;
}

.invite-link-display code {
  display: block;
  margin-top: 8px;
  padding: 8px;
  background: #fff;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Audit log table */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-table th, .audit-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eee9f3;
}

.audit-table th {
  background: #f5f3f9;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6f6986;
}

.audit-action {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #6d539c;
}

.audit-action.fail { color: #8d2436; }
