/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-md);
  font-size: var(--fs-sm); font-weight: 600; border: 1px solid transparent;
  white-space: nowrap; transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:hover { text-decoration: none; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-base); }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-primary { background: var(--brand-500); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--bg-sunken); }
.btn-outline { background: transparent; color: var(--brand-500); border-color: var(--brand-500); }
.btn-outline:hover { background: var(--brand-50); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-sunken); }
.btn-success { background: var(--status-good); color: #fff; }
.btn-success:hover { filter: brightness(0.92); }
.btn-danger { background: var(--status-critical); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-danger-outline { background: transparent; color: var(--status-critical); border-color: #f0c9c9; }
.btn-danger-outline:hover { background: var(--status-critical-bg); }
.btn-teal { background: var(--brand-teal); color: #fff; }
.btn-teal:hover { filter: brightness(0.94); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card__header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.card__header h3 { font-size: var(--fs-md); font-weight: 700; }
.card__header p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card__body { padding: var(--space-5); }
.card__body--flush { padding: 0; }
.card__footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* ==========================================================================
   Stat cards
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
}
.stat-card__top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-card__icon {
  width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card__icon svg { width: 20px; height: 20px; }
.stat-card__label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; margin-top: var(--space-3); }
.stat-card__value { font-size: var(--fs-2xl); font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-card__delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; margin-top: var(--space-3); padding: 2px 8px 2px 6px; border-radius: var(--radius-full); }
.stat-card__delta.up { background: var(--status-good-bg); color: var(--status-good-text); }
.stat-card__delta.down { background: var(--status-critical-bg); color: var(--status-critical-text); }
.stat-card__delta svg { width: 12px; height: 12px; }
.stat-card__compare { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* icon tint variants */
.icon-tint-blue { background: var(--brand-50); color: var(--brand-500); }
.icon-tint-teal { background: var(--brand-teal-50); color: var(--brand-teal); }
.icon-tint-amber { background: var(--status-warning-bg); color: var(--status-warning-text); }
.icon-tint-red { background: var(--status-critical-bg); color: var(--status-critical); }
.icon-tint-green { background: var(--status-good-bg); color: var(--status-good); }
.icon-tint-violet { background: var(--status-violet-bg); color: var(--brand-violet); }
.icon-tint-orange { background: #fdece3; color: var(--status-serious); }
.icon-tint-magenta { background: #fbeaf1; color: #d0568a; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 700; white-space: nowrap; line-height: 1.6;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-good { background: var(--status-good-bg); color: var(--status-good-text); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-serious { background: var(--status-serious-bg); color: var(--status-serious-text); }
.badge-critical { background: var(--status-critical-bg); color: var(--status-critical-text); }
.badge-info { background: var(--status-info-bg); color: var(--status-info-text); }
.badge-neutral { background: var(--status-neutral-bg); color: var(--status-neutral-text); }
.badge-violet { background: var(--status-violet-bg); color: var(--status-violet-text); }
.badge-outline { background: transparent; border: 1px solid var(--border-default); color: var(--text-secondary); }
.badge-lg { padding: 5px 14px; font-size: 12.5px; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; font-size: var(--fs-sm); min-width: 720px; }
.data-table thead th {
  text-align: left; padding: 11px 16px; background: var(--sidebar-bg); color: var(--text-inverse);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--sidebar-bg); white-space: nowrap; position: sticky; top: 0;
}
.data-table thead th:first-child { border-top-left-radius: var(--radius-md); }
.data-table thead th:last-child { border-top-right-radius: var(--radius-md); }
.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--text-primary); }
.data-table tbody tr:hover { background: var(--bg-surface-alt); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .cell-muted { color: var(--text-muted); }
.data-table .cell-strong { font-weight: 600; }
.cell-with-media { display: flex; align-items: center; gap: 10px; }
.cell-media-img { width: 38px; height: 38px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg-sunken); flex-shrink: 0; border: 1px solid var(--border-subtle); }
.cell-media-circle { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--brand-100); flex-shrink: 0; }
.cell-title { font-weight: 600; font-size: 13.5px; }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.row-checkbox-col { width: 36px; }
/* Avatar color cycles by row position — no per-row color parameter needed */
.data-table tbody tr:nth-child(6n+1) .cell-media-circle { background: #eaf2fd; color: #1c5cab; }
.data-table tbody tr:nth-child(6n+2) .cell-media-circle { background: #e6f7f0; color: #0c8a5c; }
.data-table tbody tr:nth-child(6n+3) .cell-media-circle { background: #fdece3; color: #b04a26; }
.data-table tbody tr:nth-child(6n+4) .cell-media-circle { background: #eeecfa; color: #4a3aa7; }
.data-table tbody tr:nth-child(6n+5) .cell-media-circle { background: #fbeaf1; color: #b0356a; }
.data-table tbody tr:nth-child(6n+6) .cell-media-circle { background: #fff6e0; color: #8a5a00; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); flex-wrap: wrap; border-bottom: 1px solid var(--border-subtle); }
.table-toolbar__filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-toolbar__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.form-label .optional { font-weight: 400; color: var(--text-muted); }
.form-hint { font-size: 11.5px; color: var(--text-muted); }
.input, .select, .textarea {
  height: 40px; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--bg-surface); font-size: var(--fs-sm); color: var(--text-primary); width: 100%;
  transition: border-color var(--transition-fast);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--shadow-focus); }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2356606f' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid--full { grid-column: 1 / -1; }
.input-icon-wrap { position: relative; }
.input-icon-wrap .input { padding-left: 36px; }
.input-icon-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--brand-500); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__track { position: absolute; inset: 0; background: var(--border-strong); border-radius: var(--radius-full); transition: background var(--transition-fast); cursor: pointer; }
.switch__track::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--transition-fast); box-shadow: var(--shadow-xs); }
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::before { transform: translateX(18px); }
.field-error { border-color: var(--status-critical) !important; }
.form-error-text { font-size: 11.5px; color: var(--status-critical); }

/* Search / filter pill controls */
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 12px;
  border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface);
  font-size: 13px; color: var(--text-secondary); font-weight: 500;
}
.filter-pill svg { width: 14px; height: 14px; }
.search-box { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); min-width: 220px; }
.search-box input { border: none; outline: none; background: transparent; font-size: 13px; width: 100%; }
.search-box svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border-subtle); overflow-x: auto; }
.tab-btn {
  padding: 12px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); background: none; border: none;
  border-bottom: 2px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.is-active { color: var(--brand-600); border-bottom-color: var(--brand-500); }
.tab-btn .count { background: var(--bg-sunken); color: var(--text-secondary); font-size: 11px; padding: 1px 7px; border-radius: var(--radius-full); }
.tab-btn.is-active .count { background: var(--brand-50); color: var(--brand-600); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.pill-tabs { display: inline-flex; background: var(--bg-sunken); padding: 4px; border-radius: var(--radius-md); gap: 2px; }
.pill-tab { padding: 7px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.pill-tab.is-active { background: var(--bg-surface); color: var(--brand-600); box-shadow: var(--shadow-xs); }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 100;
  align-items: center; justify-content: center; padding: var(--space-4); backdrop-filter: blur(2px);
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--bg-surface); border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: modal-in .18s ease;
}
.modal--lg { max-width: 820px; }
.modal--xl { max-width: 1080px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; padding: var(--space-5); border-bottom: 1px solid var(--border-subtle); gap: var(--space-3); }
.modal__title { font-size: var(--fs-lg); font-weight: 700; }
.modal__desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.modal__close { width: 32px; height: 32px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.modal__close:hover { background: var(--bg-sunken); }
.modal__body { padding: var(--space-5); overflow-y: auto; }
.modal__footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.modal__footer.spread { justify-content: space-between; }

/* ==========================================================================
   CSS-only tabs (radio-driven, zero JS). Markup:
   <div class="ctabs">
     <input class="ctab-radio" type="radio" name="grp" id="grp-a" checked>
     <input class="ctab-radio" type="radio" name="grp" id="grp-b">
     <div class="tabs ctab-bar"><label class="tab-btn" for="grp-a">A</label><label class="tab-btn" for="grp-b">B</label></div>
     <div class="ctab-panels"><div class="tab-panel">…</div><div class="tab-panel">…</div></div>
   </div>
   Radio N shows panel N and highlights label N. Child combinators (>) let tab
   groups nest (e.g. role tabs inside the Administration tabs).
   Bar labels may be .tab-btn, .pill-tab, .settings-nav__item or .pick-card.
   ========================================================================== */
.ctabs { position: relative; }
.ctab-radio { position: absolute; top: 0; left: 0; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.ctab-panels > .tab-panel { display: none; }
.ctab-bar > label { cursor: pointer; user-select: none; }
.ctab-radio:nth-of-type(1):checked ~ .ctab-panels > .tab-panel:nth-of-type(1),
.ctab-radio:nth-of-type(2):checked ~ .ctab-panels > .tab-panel:nth-of-type(2),
.ctab-radio:nth-of-type(3):checked ~ .ctab-panels > .tab-panel:nth-of-type(3),
.ctab-radio:nth-of-type(4):checked ~ .ctab-panels > .tab-panel:nth-of-type(4),
.ctab-radio:nth-of-type(5):checked ~ .ctab-panels > .tab-panel:nth-of-type(5),
.ctab-radio:nth-of-type(6):checked ~ .ctab-panels > .tab-panel:nth-of-type(6),
.ctab-radio:nth-of-type(7):checked ~ .ctab-panels > .tab-panel:nth-of-type(7),
.ctab-radio:nth-of-type(8):checked ~ .ctab-panels > .tab-panel:nth-of-type(8),
.ctab-radio:nth-of-type(9):checked ~ .ctab-panels > .tab-panel:nth-of-type(9),
.ctab-radio:nth-of-type(10):checked ~ .ctab-panels > .tab-panel:nth-of-type(10),
.ctab-radio:nth-of-type(11):checked ~ .ctab-panels > .tab-panel:nth-of-type(11),
.ctab-radio:nth-of-type(12):checked ~ .ctab-panels > .tab-panel:nth-of-type(12),
.ctab-radio:nth-of-type(13):checked ~ .ctab-panels > .tab-panel:nth-of-type(13),
.ctab-radio:nth-of-type(14):checked ~ .ctab-panels > .tab-panel:nth-of-type(14),
.ctab-radio:nth-of-type(15):checked ~ .ctab-panels > .tab-panel:nth-of-type(15),
.ctab-radio:nth-of-type(16):checked ~ .ctab-panels > .tab-panel:nth-of-type(16)
{ display: block; }
.ctab-radio:nth-of-type(1):checked ~ .ctab-bar > .tab-btn:nth-of-type(1),
.ctab-radio:nth-of-type(2):checked ~ .ctab-bar > .tab-btn:nth-of-type(2),
.ctab-radio:nth-of-type(3):checked ~ .ctab-bar > .tab-btn:nth-of-type(3),
.ctab-radio:nth-of-type(4):checked ~ .ctab-bar > .tab-btn:nth-of-type(4),
.ctab-radio:nth-of-type(5):checked ~ .ctab-bar > .tab-btn:nth-of-type(5),
.ctab-radio:nth-of-type(6):checked ~ .ctab-bar > .tab-btn:nth-of-type(6),
.ctab-radio:nth-of-type(7):checked ~ .ctab-bar > .tab-btn:nth-of-type(7),
.ctab-radio:nth-of-type(8):checked ~ .ctab-bar > .tab-btn:nth-of-type(8),
.ctab-radio:nth-of-type(9):checked ~ .ctab-bar > .tab-btn:nth-of-type(9),
.ctab-radio:nth-of-type(10):checked ~ .ctab-bar > .tab-btn:nth-of-type(10),
.ctab-radio:nth-of-type(11):checked ~ .ctab-bar > .tab-btn:nth-of-type(11),
.ctab-radio:nth-of-type(12):checked ~ .ctab-bar > .tab-btn:nth-of-type(12),
.ctab-radio:nth-of-type(13):checked ~ .ctab-bar > .tab-btn:nth-of-type(13),
.ctab-radio:nth-of-type(14):checked ~ .ctab-bar > .tab-btn:nth-of-type(14),
.ctab-radio:nth-of-type(15):checked ~ .ctab-bar > .tab-btn:nth-of-type(15),
.ctab-radio:nth-of-type(16):checked ~ .ctab-bar > .tab-btn:nth-of-type(16)
{ color: var(--brand-600); border-bottom-color: var(--brand-500); }
.ctab-radio:nth-of-type(1):checked ~ .ctab-bar > .tab-btn:nth-of-type(1) .count,
.ctab-radio:nth-of-type(2):checked ~ .ctab-bar > .tab-btn:nth-of-type(2) .count,
.ctab-radio:nth-of-type(3):checked ~ .ctab-bar > .tab-btn:nth-of-type(3) .count,
.ctab-radio:nth-of-type(4):checked ~ .ctab-bar > .tab-btn:nth-of-type(4) .count,
.ctab-radio:nth-of-type(5):checked ~ .ctab-bar > .tab-btn:nth-of-type(5) .count,
.ctab-radio:nth-of-type(6):checked ~ .ctab-bar > .tab-btn:nth-of-type(6) .count,
.ctab-radio:nth-of-type(7):checked ~ .ctab-bar > .tab-btn:nth-of-type(7) .count,
.ctab-radio:nth-of-type(8):checked ~ .ctab-bar > .tab-btn:nth-of-type(8) .count,
.ctab-radio:nth-of-type(9):checked ~ .ctab-bar > .tab-btn:nth-of-type(9) .count,
.ctab-radio:nth-of-type(10):checked ~ .ctab-bar > .tab-btn:nth-of-type(10) .count,
.ctab-radio:nth-of-type(11):checked ~ .ctab-bar > .tab-btn:nth-of-type(11) .count,
.ctab-radio:nth-of-type(12):checked ~ .ctab-bar > .tab-btn:nth-of-type(12) .count,
.ctab-radio:nth-of-type(13):checked ~ .ctab-bar > .tab-btn:nth-of-type(13) .count,
.ctab-radio:nth-of-type(14):checked ~ .ctab-bar > .tab-btn:nth-of-type(14) .count,
.ctab-radio:nth-of-type(15):checked ~ .ctab-bar > .tab-btn:nth-of-type(15) .count,
.ctab-radio:nth-of-type(16):checked ~ .ctab-bar > .tab-btn:nth-of-type(16) .count
{ background: var(--brand-50); color: var(--brand-600); }
.ctab-radio:nth-of-type(1):checked ~ .ctab-bar > .pill-tab:nth-of-type(1),
.ctab-radio:nth-of-type(2):checked ~ .ctab-bar > .pill-tab:nth-of-type(2),
.ctab-radio:nth-of-type(3):checked ~ .ctab-bar > .pill-tab:nth-of-type(3),
.ctab-radio:nth-of-type(4):checked ~ .ctab-bar > .pill-tab:nth-of-type(4),
.ctab-radio:nth-of-type(5):checked ~ .ctab-bar > .pill-tab:nth-of-type(5),
.ctab-radio:nth-of-type(6):checked ~ .ctab-bar > .pill-tab:nth-of-type(6),
.ctab-radio:nth-of-type(7):checked ~ .ctab-bar > .pill-tab:nth-of-type(7),
.ctab-radio:nth-of-type(8):checked ~ .ctab-bar > .pill-tab:nth-of-type(8),
.ctab-radio:nth-of-type(9):checked ~ .ctab-bar > .pill-tab:nth-of-type(9),
.ctab-radio:nth-of-type(10):checked ~ .ctab-bar > .pill-tab:nth-of-type(10),
.ctab-radio:nth-of-type(11):checked ~ .ctab-bar > .pill-tab:nth-of-type(11),
.ctab-radio:nth-of-type(12):checked ~ .ctab-bar > .pill-tab:nth-of-type(12),
.ctab-radio:nth-of-type(13):checked ~ .ctab-bar > .pill-tab:nth-of-type(13),
.ctab-radio:nth-of-type(14):checked ~ .ctab-bar > .pill-tab:nth-of-type(14),
.ctab-radio:nth-of-type(15):checked ~ .ctab-bar > .pill-tab:nth-of-type(15),
.ctab-radio:nth-of-type(16):checked ~ .ctab-bar > .pill-tab:nth-of-type(16)
{ background: var(--bg-surface); color: var(--brand-600); box-shadow: var(--shadow-xs); }
.ctab-radio:nth-of-type(1):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(1),
.ctab-radio:nth-of-type(2):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(2),
.ctab-radio:nth-of-type(3):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(3),
.ctab-radio:nth-of-type(4):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(4),
.ctab-radio:nth-of-type(5):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(5),
.ctab-radio:nth-of-type(6):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(6),
.ctab-radio:nth-of-type(7):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(7),
.ctab-radio:nth-of-type(8):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(8),
.ctab-radio:nth-of-type(9):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(9),
.ctab-radio:nth-of-type(10):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(10),
.ctab-radio:nth-of-type(11):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(11),
.ctab-radio:nth-of-type(12):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(12),
.ctab-radio:nth-of-type(13):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(13),
.ctab-radio:nth-of-type(14):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(14),
.ctab-radio:nth-of-type(15):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(15),
.ctab-radio:nth-of-type(16):checked ~ .ctab-bar > .settings-nav__item:nth-of-type(16)
{ background: var(--brand-50); color: var(--brand-600); }
.ctab-radio:nth-of-type(1):checked ~ .ctab-bar > .pick-card:nth-of-type(1),
.ctab-radio:nth-of-type(2):checked ~ .ctab-bar > .pick-card:nth-of-type(2),
.ctab-radio:nth-of-type(3):checked ~ .ctab-bar > .pick-card:nth-of-type(3),
.ctab-radio:nth-of-type(4):checked ~ .ctab-bar > .pick-card:nth-of-type(4),
.ctab-radio:nth-of-type(5):checked ~ .ctab-bar > .pick-card:nth-of-type(5),
.ctab-radio:nth-of-type(6):checked ~ .ctab-bar > .pick-card:nth-of-type(6),
.ctab-radio:nth-of-type(7):checked ~ .ctab-bar > .pick-card:nth-of-type(7),
.ctab-radio:nth-of-type(8):checked ~ .ctab-bar > .pick-card:nth-of-type(8),
.ctab-radio:nth-of-type(9):checked ~ .ctab-bar > .pick-card:nth-of-type(9),
.ctab-radio:nth-of-type(10):checked ~ .ctab-bar > .pick-card:nth-of-type(10),
.ctab-radio:nth-of-type(11):checked ~ .ctab-bar > .pick-card:nth-of-type(11),
.ctab-radio:nth-of-type(12):checked ~ .ctab-bar > .pick-card:nth-of-type(12),
.ctab-radio:nth-of-type(13):checked ~ .ctab-bar > .pick-card:nth-of-type(13),
.ctab-radio:nth-of-type(14):checked ~ .ctab-bar > .pick-card:nth-of-type(14),
.ctab-radio:nth-of-type(15):checked ~ .ctab-bar > .pick-card:nth-of-type(15),
.ctab-radio:nth-of-type(16):checked ~ .ctab-bar > .pick-card:nth-of-type(16)
{ border-color: var(--brand-500); background: var(--brand-50); }
.ctab-radio:nth-of-type(1):focus-visible ~ .ctab-bar > label:nth-of-type(1),
.ctab-radio:nth-of-type(2):focus-visible ~ .ctab-bar > label:nth-of-type(2),
.ctab-radio:nth-of-type(3):focus-visible ~ .ctab-bar > label:nth-of-type(3),
.ctab-radio:nth-of-type(4):focus-visible ~ .ctab-bar > label:nth-of-type(4),
.ctab-radio:nth-of-type(5):focus-visible ~ .ctab-bar > label:nth-of-type(5),
.ctab-radio:nth-of-type(6):focus-visible ~ .ctab-bar > label:nth-of-type(6),
.ctab-radio:nth-of-type(7):focus-visible ~ .ctab-bar > label:nth-of-type(7),
.ctab-radio:nth-of-type(8):focus-visible ~ .ctab-bar > label:nth-of-type(8),
.ctab-radio:nth-of-type(9):focus-visible ~ .ctab-bar > label:nth-of-type(9),
.ctab-radio:nth-of-type(10):focus-visible ~ .ctab-bar > label:nth-of-type(10),
.ctab-radio:nth-of-type(11):focus-visible ~ .ctab-bar > label:nth-of-type(11),
.ctab-radio:nth-of-type(12):focus-visible ~ .ctab-bar > label:nth-of-type(12),
.ctab-radio:nth-of-type(13):focus-visible ~ .ctab-bar > label:nth-of-type(13),
.ctab-radio:nth-of-type(14):focus-visible ~ .ctab-bar > label:nth-of-type(14),
.ctab-radio:nth-of-type(15):focus-visible ~ .ctab-bar > label:nth-of-type(15),
.ctab-radio:nth-of-type(16):focus-visible ~ .ctab-bar > label:nth-of-type(16)
{ box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

/* ==========================================================================
   Row icon actions (direct action buttons, no dropdown)
   ========================================================================== */
.row-actions { display: inline-flex; align-items: center; gap: 6px; }
.ricon {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  border: none; flex-shrink: 0; transition: filter var(--transition-fast), transform var(--transition-fast);
}
.ricon:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ricon svg { width: 15px; height: 15px; }
.ricon--view { background: #20242f; color: #fff; }
.ricon--edit { background: #d6a52a; color: #fff; }
.ricon--print { background: #f3ead9; color: #8a7550; }
.ricon--delete { background: #e35152; color: #fff; }
.ricon--approve { background: var(--status-good); color: #fff; }
.ricon--reject { background: #e35152; color: #fff; }

.drawer-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); z-index: 110; backdrop-filter: blur(2px);
}
.drawer-overlay.is-open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(820px, 96vw);
  background: var(--bg-surface); box-shadow: var(--shadow-lg); z-index: 111;
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--transition-base);
}
.drawer-overlay.is-open .drawer { transform: translateX(0); }
.drawer__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.drawer__title { font-size: var(--fs-xl); font-weight: 700; }
.drawer__desc { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.drawer__close { width: 34px; height: 34px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.drawer__close:hover { background: var(--bg-sunken); }
.drawer__body { padding: var(--space-6); overflow-y: auto; flex: 1; }
.drawer__footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; flex-shrink: 0; }
.drawer__footer.spread { justify-content: space-between; }
@media (max-width: 640px) { .drawer { width: 100vw; } }

/* ==========================================================================
   Dropdown
   ========================================================================== */
.dropdown { position: relative; }
.dropdown__menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 220px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); z-index: 60; padding: 6px; overflow: hidden;
}
.dropdown__menu.align-left { right: auto; left: 0; }
.dropdown.is-open .dropdown__menu { display: block; }
.dropdown__item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; font-size: 13px; color: var(--text-primary); width: 100%; text-align: left; background: none; border: none; }
.dropdown__item:hover { background: var(--bg-sunken); text-decoration: none; }
.dropdown__item svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.dropdown__item.danger { color: var(--status-critical); }
.dropdown__item.danger svg { color: var(--status-critical); }
.dropdown__divider { height: 1px; background: var(--border-subtle); margin: 6px 4px; }
.dropdown__label { padding: 8px 10px 4px; font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* Notification panel */
.notif-panel { width: 380px; max-height: 480px; display: flex; flex-direction: column; padding: 0; }
.notif-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.notif-panel__list { overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.notif-item:hover { background: var(--bg-surface-alt); }
.notif-item__icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-item__icon svg { width: 16px; height: 16px; }
.notif-item__title { font-size: 13px; font-weight: 600; }
.notif-item__desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.notif-item__time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.notif-item.unread { background: var(--brand-50); }

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); flex-wrap: wrap; gap: var(--space-3); }
.pagination__info { font-size: 12.5px; color: var(--text-muted); }
.pagination__pages { display: flex; align-items: center; gap: 4px; }
.page-btn { width: 32px; height: 32px; border-radius: var(--radius-md); font-size: 12.5px; font-weight: 600; color: var(--text-secondary); border: 1px solid transparent; display: flex; align-items: center; justify-content: center; }
.page-btn:hover { background: var(--bg-sunken); }
.page-btn.is-active { background: var(--brand-500); color: #fff; }
.page-btn.nav { border-color: var(--border-default); }

/* ==========================================================================
   Empty / loading / error / toast
   ========================================================================== */
.state-block { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: var(--space-10) var(--space-6); color: var(--text-muted); }
.state-block__icon { width: 56px; height: 56px; border-radius: 50%; background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-4); color: var(--text-muted); }
.state-block__icon svg { width: 26px; height: 26px; }
.state-block__title { font-size: var(--fs-md); font-weight: 700; color: var(--text-primary); }
.state-block__desc { font-size: 13px; margin-top: 4px; max-width: 360px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border-subtle); border-top-color: var(--brand-500); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--bg-sunken) 25%, #e9edf2 37%, var(--bg-sunken) 63%); background-size: 400% 100%; animation: skeleton 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: 340px; }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 14px; animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast__icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast__icon svg { width: 15px; height: 15px; }
.toast--success .toast__icon { background: var(--status-good-bg); color: var(--status-good); }
.toast--error .toast__icon { background: var(--status-critical-bg); color: var(--status-critical); }
.toast--warning .toast__icon { background: var(--status-warning-bg); color: var(--status-warning-text); }
.toast--info .toast__icon { background: var(--status-info-bg); color: var(--status-info); }
.toast__title { font-size: 13px; font-weight: 700; }
.toast__desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.toast__close { margin-left: auto; color: var(--text-muted); flex-shrink: 0; }

/* ==========================================================================
   Timeline / Stepper
   ========================================================================== */
.timeline { position: relative; }
.timeline-item { position: relative; padding-left: 32px; padding-bottom: 26px; }
.timeline-item::before { content: ""; position: absolute; left: 9px; top: 22px; bottom: 0; width: 2px; background: var(--border-default); }
.timeline-item:last-child::before { display: none; }
.timeline-item.is-done::before { background: var(--brand-300); }
.timeline-dot { position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--bg-sunken); border: 2px solid var(--border-default); display: flex; align-items: center; justify-content: center; }
.timeline-item.is-done .timeline-dot { background: var(--brand-500); border-color: var(--brand-500); }
.timeline-item.is-done .timeline-dot svg { width: 11px; height: 11px; color: #fff; }
.timeline-item.is-current .timeline-dot { border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--brand-50); }
.timeline-item.is-current .timeline-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-500); }
.timeline-title { font-size: 13.5px; font-weight: 700; }
.timeline-time { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.timeline-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }

.stepper { display: flex; align-items: center; }
.stepper-step { display: flex; align-items: center; gap: 10px; }
.stepper-step__circle { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-sunken); border: 2px solid var(--border-default); display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.stepper-step.is-done .stepper-step__circle { background: var(--status-good); border-color: var(--status-good); color: #fff; }
.stepper-step.is-active .stepper-step__circle { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }
.stepper-step__label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.stepper-step.is-active .stepper-step__label, .stepper-step.is-done .stepper-step__label { color: var(--text-primary); }
.stepper-line { flex: 1; height: 2px; background: var(--border-default); margin: 0 8px; min-width: 24px; }
.stepper-line.is-done { background: var(--status-good); }

/* ==========================================================================
   File upload
   ========================================================================== */
.upload-zone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: var(--space-10);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-2);
  background: var(--bg-surface-alt); transition: border-color var(--transition-fast), background var(--transition-fast);
}
.upload-zone.is-dragover { border-color: var(--brand-500); background: var(--brand-50); }
.upload-zone__icon { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-50); color: var(--brand-500); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-2); }
.upload-zone__icon svg { width: 24px; height: 24px; }

/* ==========================================================================
   Document / KYC cards
   ========================================================================== */
.doc-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-surface); }
.doc-card__preview { height: 140px; background: var(--bg-sunken); display: flex; align-items: center; justify-content: center; color: var(--text-muted); position: relative; }
.doc-card__preview svg { width: 32px; height: 32px; }
.doc-card__body { padding: 12px 14px; }
.doc-card__name { font-size: 13px; font-weight: 700; }
.doc-card__meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.doc-card__footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border-subtle); }

/* ==========================================================================
   Misc
   ========================================================================== */
.divider { height: 1px; background: var(--border-subtle); border: none; margin: var(--space-5) 0; }
.progress-track { height: 8px; border-radius: var(--radius-full); background: var(--bg-sunken); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-full); background: var(--brand-500); }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.info-item__label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.info-item__value { font-size: 13.5px; font-weight: 600; margin-top: 4px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-bottom: var(--space-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-md); background: var(--bg-sunken); font-size: 12.5px; font-weight: 500; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.rating { display: inline-flex; align-items: center; gap: 4px; color: var(--status-warning); font-weight: 700; font-size: 13px; }
.rating svg { width: 14px; height: 14px; }
.quick-action-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: var(--space-4); border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); background: var(--bg-surface); transition: box-shadow var(--transition-fast), transform var(--transition-fast); text-align: left; width: 100%; }
.quick-action-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.quick-action-card__icon { width: 38px; height: 38px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.quick-action-card__icon svg { width: 18px; height: 18px; }
.quick-action-card__label { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.quick-action-card__desc { font-size: 11.5px; color: var(--text-muted); }

/* Grid helpers for dashboards */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.grid-6-6 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

@media (max-width: 1300px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-6-6 { grid-template-columns: 1fr; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stat-grid, .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   No-JS interaction layer
   ========================================================================== */
a.btn, a.ricon, a.modal__close, a.drawer__close, a.toast__close, a.page-btn { text-decoration: none; cursor: pointer; }
a.btn:hover, a.ricon:hover { text-decoration: none; }
a.btn-primary, a.btn-danger, a.btn-success, a.btn-teal { color: #fff; }
a.btn-secondary { color: var(--text-primary); }
a.btn-danger-outline { color: var(--status-critical); }
a.modal__close, a.drawer__close { color: var(--text-muted); }
.u-mb-5 { margin-bottom: var(--space-5); }
.u-items-start { align-items: flex-start; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.prod-thumb { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 800; }

/* Modals & drawers open when their id is the URL #fragment (<a href="#id">),
   and close with <a href="#close">. The backdrop is a full-size close link. */
.modal-overlay:target { display: flex; }
.drawer-overlay:target { display: block; }
.drawer-overlay:target .drawer { transform: none; animation: drawer-in var(--transition-base); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.modal-overlay__bg { position: absolute; inset: 0; cursor: default; }
.modal-overlay > .modal { position: relative; z-index: 1; }
body:has(.modal-overlay:target, .drawer-overlay:target) { overflow: hidden; }

/* Confirmation dialog */
.modal--confirm { max-width: 420px; }
.confirm-body { text-align: center; padding: 34px 28px 20px; }
.confirm-icon { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; }
.confirm-title { font-size: 16px; font-weight: 700; }
.confirm-desc { font-size: 13px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; }

/* Toasts: shown while targeted, then fade out on their own */
.toast-target { display: none; position: fixed; top: 20px; right: 20px; z-index: 200; width: 340px; max-width: calc(100vw - 32px); }
.toast-target:target { display: flex; animation: toast-in .25s ease, toast-out .4s ease 4.2s forwards; }
@keyframes toast-out { to { opacity: 0; visibility: hidden; transform: translateX(20px); } }

/* Dropdowns open while focus is inside (click the trigger; click away to close) */
.dropdown:focus-within > .dropdown__menu { display: block; }
.dropdown [data-dropdown-trigger] { cursor: pointer; }

/* Selectable cards built from hidden radios */
.pick-card { display: block; }
label.partner-pick:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); }
label.partner-pick:has(input:focus-visible) { box-shadow: var(--shadow-focus); }

/* Expandable table rows (checkbox in the first cell) */
.expand-toggle { display: inline-flex; cursor: pointer; color: var(--text-muted); transition: transform var(--transition-fast); }
tr.expand-row { display: none; }
tr:has(.expand-input:checked) + tr.expand-row { display: table-row; }
tr:has(.expand-input:checked) .expand-toggle { transform: rotate(90deg); color: var(--brand-500); }
tr:has(.expand-input:focus-visible) .expand-toggle { box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

/* Print: with a modal/drawer open (e.g. an order invoice), print only that panel */
.print-hint { cursor: default; }
@media print {
  body:has(.modal-overlay:target, .drawer-overlay:target) .app-shell { display: none; }
  .modal-overlay:target, .drawer-overlay:target { position: static; display: block; background: none; backdrop-filter: none; padding: 0; }
  .modal-overlay:target .modal, .drawer-overlay:target .drawer { position: static; box-shadow: none; max-height: none; max-width: none; width: auto; transform: none; }
  .modal-overlay:target .modal__footer, .modal-overlay:target .modal__close,
  .drawer-overlay:target .drawer__footer, .drawer-overlay:target .drawer__close, .modal-overlay__bg { display: none; }
}

/* ==========================================================================
   CSS charts (no canvas / no JS)
   Categorical order: --series-1 … --series-8 (validated palette)
   ========================================================================== */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --chart-grid: #eef0f4; --chart-axis: #8993a3;
}
.chart { position: relative; height: 260px; display: flex; flex-direction: column; }
.chart__plot { position: relative; flex: 1; display: flex; align-items: stretch; gap: 6px; padding-left: 44px; border-bottom: 1px solid var(--border-default); }
.chart__grid { position: absolute; inset: 0 0 0 44px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart__grid span { position: relative; border-top: 1px solid var(--chart-grid); height: 0; }
.chart__grid span::before { content: attr(data-v); position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--chart-axis); white-space: nowrap; }
.chart__col { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.chart__bar { width: min(30px, 70%); background: var(--bar, var(--series-1)); border-radius: 4px 4px 0 0; transition: filter var(--transition-fast); }
.chart__col:hover .chart__bar { filter: brightness(0.9); }
.chart__x { display: flex; gap: 6px; padding-left: 44px; margin-top: 6px; }
.chart__x span { flex: 1; text-align: center; font-size: 11px; color: var(--chart-axis); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart__tip {
  position: absolute; bottom: calc(var(--h, 0%) + 8px); left: 50%; transform: translateX(-50%); z-index: 5;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 8px; box-shadow: var(--shadow-md);
  padding: 6px 10px; font-size: 12px; white-space: nowrap; color: var(--text-secondary); pointer-events: none; opacity: 0; transition: opacity var(--transition-fast);
}
.chart__tip strong { display: block; color: var(--text-primary); font-size: 12px; }
.chart__col:hover .chart__tip { opacity: 1; }
/* Line / area variant: an inline SVG draws the path; the columns are hover targets */
.chart__svg { position: absolute; inset: 0 0 0 44px; width: calc(100% - 44px); height: 100%; overflow: visible; }
.chart__col--hit { cursor: crosshair; }
.chart__col--hit::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px dashed var(--border-strong); opacity: 0; }
.chart__col--hit:hover::after { opacity: 1; }
.chart__dot { position: absolute; bottom: var(--h); left: 50%; width: 10px; height: 10px; margin: 0 0 -5px -5px; border-radius: 50%; background: var(--series-1); border: 2px solid var(--bg-surface); opacity: 0; z-index: 2; }
.chart__col--hit:hover .chart__dot { opacity: 1; }
/* Horizontal bars */
.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; align-items: center; gap: 12px; font-size: 12.5px; }
.hbar__label { color: var(--text-secondary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__track { display: flex; align-items: center; gap: 8px; }
.hbar__fill { height: 14px; border-radius: 0 4px 4px 0; background: var(--bar, var(--series-2)); min-width: 2px; }
.hbar__value { font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Donut */
.donut-wrap { display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap; justify-content: center; }
.donut { position: relative; width: 190px; height: 190px; border-radius: 50%; flex-shrink: 0; }
.donut::after { content: ""; position: absolute; inset: 28px; border-radius: 50%; background: var(--bg-surface); }
.donut__center { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut__value { font-size: 21px; font-weight: 700; }
.donut__label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.legend { display: flex; flex-direction: column; gap: 8px; min-width: 180px; flex: 1; }
.legend__item { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.legend__swatch { width: 10px; height: 10px; border-radius: 50%; }
.legend__value { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.legend__pct { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
@media (max-width: 560px) { .chart__plot, .chart__x { padding-left: 36px; } .chart__grid, .chart__svg { left: 36px; } }
