/* ==========================================================================
   NovaPOS — components.css
   Buttons, cards, forms, tables, feedback and navigation components.
   ========================================================================== */

/* --------------------------------------------------------------- buttons */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--touch); padding: 0 var(--s4);
  border: 1px solid var(--btn-bd); border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--fs-md); font-weight: 600; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"], .btn.is-busy { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn svg, .btn [data-icon] { width: 18px; height: 18px; flex: 0 0 18px; }

.btn--primary { --btn-bg: var(--brand-600); --btn-fg: #fff; --btn-bd: var(--brand-700); box-shadow: var(--sh-1); }
.btn--primary:hover { --btn-bg: var(--brand-700); }
.btn--success { --btn-bg: var(--ok); --btn-fg: #fff; --btn-bd: color-mix(in srgb, var(--ok) 80%, #000); }
.btn--success:hover { filter: brightness(.94); background: var(--ok); }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: color-mix(in srgb, var(--danger) 80%, #000); }
.btn--danger:hover { filter: brightness(.94); background: var(--danger); }
.btn--warn { --btn-bg: var(--warn); --btn-fg: #fff; --btn-bd: color-mix(in srgb, var(--warn) 80%, #000); }
.btn--outline { --btn-bg: transparent; --btn-bd: var(--border-strong); }
.btn--outline:hover { --btn-bg: var(--surface-hover); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--text-muted); }
.btn--ghost:hover { --btn-bg: var(--surface-hover); color: var(--text); }
.btn--soft { --btn-bg: var(--brand-50); --btn-fg: var(--brand-700); --btn-bd: var(--brand-100); }
[data-theme="dark"] .btn--soft { --btn-bg: rgba(99, 102, 241, .16); --btn-fg: var(--brand-300); --btn-bd: rgba(99, 102, 241, .3); }
.btn--soft:hover { --btn-bg: var(--brand-100); }

.btn--sm { min-height: 32px; padding: 0 var(--s3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn--sm svg, .btn--sm [data-icon] { width: 15px; height: 15px; flex-basis: 15px; }
.btn--lg { min-height: 52px; padding: 0 var(--s6); font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn--xl { min-height: 60px; padding: 0 var(--s7); font-size: var(--fs-xl); border-radius: var(--r-lg); }
.btn--block { width: 100%; }
.btn--icon { min-width: var(--touch); padding: 0; }
.btn--icon.btn--sm { min-width: 32px; }

.btn.is-busy::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit;
  border: 2px solid currentColor; border-top-color: transparent; opacity: .5;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group .btn.is-active { background: var(--brand-600); border-color: var(--brand-700); color: #fff; z-index: 1; }

.icon-btn {
  display: grid; place-items: center; width: var(--touch); height: 38px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn svg, .icon-btn [data-icon] { width: 20px; height: 20px; }
.icon-btn--sm { width: 30px; height: 30px; }
.icon-btn--sm svg { width: 16px; height: 16px; }
.icon-btn--danger:hover { background: var(--danger-bg); color: var(--danger); }

.bell__count {
  position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-full); background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}
.topbar__bell { position: relative; }

/* ----------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
  min-width: 0;
}
.card--flat { box-shadow: none; }
.card--pad { padding: var(--s5); }
.card__head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border);
}
.card__head h3 { font-size: var(--fs-base); font-weight: 650; }
.card__head .sub { font-size: var(--fs-xs); color: var(--text-subtle); margin: 2px 0 0; }
.card__actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.card__body { padding: var(--s5); }
.card__body--tight { padding: var(--s3); }
.card__body--flush { padding: 0; }
.card__foot {
  padding: var(--s3) var(--s5); border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
}

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }

/* KPI tiles */
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s4) var(--s5);
  box-shadow: var(--sh-1); min-width: 0;
}
.kpi__label {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; color: var(--text-subtle);
}
.kpi__label [data-icon] { width: 16px; height: 16px; opacity: .8; }
.kpi__value { font-size: var(--fs-3xl); font-weight: 750; letter-spacing: -.02em; margin-top: var(--s2); font-variant-numeric: tabular-nums; }
.kpi__value.is-sm { font-size: var(--fs-2xl); }
.kpi__foot { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s2); font-size: var(--fs-xs); color: var(--text-subtle); flex-wrap: wrap; }
.kpi__delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: var(--fs-xs); padding: 2px 7px; border-radius: var(--r-full); }
.kpi__delta--up { background: var(--ok-bg); color: var(--ok); }
.kpi__delta--down { background: var(--danger-bg); color: var(--danger); }
.kpi__delta--flat { background: var(--neutral-bg); color: var(--text-muted); }
.kpi--accent { border-left: 3px solid var(--brand-600); }
.kpi--ok { border-left: 3px solid var(--ok); }
.kpi--warn { border-left: 3px solid var(--warn); }
.kpi--danger { border-left: 3px solid var(--danger); }
.kpi__spark { position: absolute; right: 0; bottom: 0; opacity: .16; pointer-events: none; }

.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px dashed var(--border-soft); font-size: var(--fs-md); }
.stat-row:last-child { border-bottom: 0; }
.stat-row__label { color: var(--text-muted); }
.stat-row__value { font-weight: 650; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-full);
  background: var(--neutral-bg); color: var(--text-muted);
  font-size: 11.5px; font-weight: 650; line-height: 1.6; white-space: nowrap;
  border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; flex-basis: 6px; background: currentColor; }
.badge--ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.badge--warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.badge--danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge--info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge--brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
[data-theme="dark"] .badge--brand { background: rgba(99, 102, 241, .16); color: var(--brand-300); border-color: rgba(99, 102, 241, .28); }
.badge--outline { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.badge--lg { padding: 4px 12px; font-size: var(--fs-sm); }

.chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: 4px 6px 4px 10px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text); font-size: var(--fs-sm); font-weight: 600;
}
.chip button { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; opacity: .65; }
.chip button:hover { background: rgba(0, 0, 0, .1); opacity: 1; }

/* ----------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: var(--s2); }
.field__label .req { color: var(--danger); }
.field__hint { font-size: var(--fs-xs); color: var(--text-subtle); }
.field__error { font-size: var(--fs-xs); color: var(--danger); font-weight: 600; display: flex; gap: 5px; align-items: flex-start; }
.field.is-invalid .input, .field.is-invalid .select, .field.is-invalid .textarea { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185, 28, 28, .12); }
.field--inline { flex-direction: row; align-items: center; gap: var(--s3); }
.field--inline .field__label { flex: 0 0 auto; }

.input, .select, .textarea {
  width: 100%; min-height: var(--touch); padding: var(--s2) var(--s3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-md); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-subtle); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-600); box-shadow: var(--focus-ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--text-subtle); cursor: not-allowed; }
.input--num { text-align: right; font-variant-numeric: tabular-nums; }
.input--money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.input--sm { min-height: 34px; padding: 4px var(--s2); font-size: var(--fs-sm); }
.input--lg { min-height: 52px; font-size: var(--fs-lg); }
.textarea { min-height: 88px; resize: vertical; line-height: 1.5; }

.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%235c6479' d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 20px;
}

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0; margin-left: -1px; }
.input-group .input:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.input-group .input:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-group__addon {
  display: grid; place-items: center; padding: 0 var(--s3);
  border: 1px solid var(--border-strong); background: var(--surface-3);
  color: var(--text-muted); font-size: var(--fs-sm); font-weight: 650; white-space: nowrap;
}
.input-group__addon:first-child { border-radius: var(--r-md) 0 0 var(--r-md); border-right: 0; }
.input-group__addon + .input { border-radius: 0 var(--r-md) var(--r-md) 0; }

.search-field { position: relative; display: flex; align-items: center; }
.search-field > [data-icon], .search-field > svg {
  position: absolute; left: 11px; width: 18px; height: 18px; color: var(--text-subtle); pointer-events: none;
}
.search-field .input { padding-left: 36px; }
.search-field__clear { position: absolute; right: 6px; }
.search-field__kbd { position: absolute; right: 10px; }

.kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--text-subtle);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
}

.checkbox, .radio { display: inline-flex; align-items: flex-start; gap: var(--s2); cursor: pointer; min-height: 24px; font-size: var(--fs-md); }
.checkbox input, .radio input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand-600); cursor: pointer; flex: 0 0 18px; }
.checkbox--row { padding: var(--s2) var(--s3); border-radius: var(--r-md); width: 100%; }
.checkbox--row:hover { background: var(--surface-hover); }

.switch { display: inline-flex; align-items: center; gap: var(--s3); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  position: relative; width: 44px; height: 26px; border-radius: var(--r-full);
  background: var(--border-strong); transition: background var(--t-med); flex: 0 0 44px;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: var(--sh-1); transition: transform var(--t-med);
}
.switch input:checked + .switch__track { background: var(--brand-600); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus-ring); }
.switch input:disabled + .switch__track { opacity: .5; cursor: not-allowed; }
.switch__text { font-size: var(--fs-md); }
.switch__text .hint { display: block; font-size: var(--fs-xs); color: var(--text-subtle); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-md); border: 1px solid var(--border); }
.segmented button {
  min-height: 32px; padding: 0 var(--s3); border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }

.fieldset { border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s4) var(--s5) var(--s5); margin: 0; background: var(--surface); }
.fieldset legend { padding: 0 var(--s2); font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); }
.form-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-grid--wide { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid .span-2 { grid-column: span 1; } }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow: auto; max-width: 100%; border-radius: var(--r-lg); }
.table { font-size: var(--fs-md); }
.table th, .table td { padding: var(--s3) var(--s4); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border-soft); }
.table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-muted);
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table thead th.sortable { cursor: pointer; user-select: none; }
.table thead th.sortable:hover { color: var(--text); background: var(--surface-3); }
.table thead th .sort-mark { display: inline-block; margin-left: 5px; opacity: .45; }
.table thead th.is-sorted .sort-mark { opacity: 1; color: var(--brand-600); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.is-selected { background: var(--brand-50); }
[data-theme="dark"] .table tbody tr.is-selected { background: rgba(99, 102, 241, .14); }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.center, .table th.center { text-align: center; }
.table .cell-main { font-weight: 600; }
.table .cell-sub { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: 2px; }
.table .cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table--compact th, .table--compact td { padding: var(--s2) var(--s3); }
.table--zebra tbody tr:nth-child(even) { background: var(--surface-2); }
.table--zebra tbody tr:hover { background: var(--surface-hover); }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border); }
.table .row-total td { background: var(--surface-2); font-weight: 700; }

.table-toolbar {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); background: var(--surface);
}
.table-toolbar__spacer { flex: 1 1 auto; }

.pagination { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.pagination__info { font-size: var(--fs-sm); color: var(--text-muted); margin-right: auto; }
.pagination__pages { display: flex; gap: 3px; }
.pagination__page {
  min-width: 34px; height: 34px; padding: 0 var(--s2);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
}
.pagination__page:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.pagination__page.is-active { background: var(--brand-600); border-color: var(--brand-700); color: #fff; }
.pagination__page:disabled { opacity: .4; cursor: not-allowed; }
.pagination__ellipsis { display: grid; place-items: center; min-width: 24px; color: var(--text-subtle); }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 42px; padding: 0 var(--s4); border: 0; border-radius: var(--r-md) var(--r-md) 0 0;
  background: transparent; color: var(--text-muted); font-size: var(--fs-md); font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.tab:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
.tab.is-active { color: var(--brand-600); }
.tab.is-active::after { content: ""; position: absolute; left: var(--s2); right: var(--s2); bottom: -1px; height: 2px; background: var(--brand-600); border-radius: 2px 2px 0 0; }
.tab__count { padding: 1px 7px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-muted); font-size: 11px; font-weight: 700; }
.tab.is-active .tab__count { background: var(--brand-100); color: var(--brand-700); }
[data-theme="dark"] .tab.is-active .tab__count { background: rgba(99,102,241,.25); color: var(--brand-200); }
.tab-panel { padding-top: var(--s5); }

/* ------------------------------------------------------------ alerts/notes */
.alert {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s3) var(--s4); border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: var(--fs-md); color: var(--text);
}
.alert > [data-icon], .alert > svg { width: 19px; height: 19px; flex: 0 0 19px; margin-top: 1px; }
.alert__body { min-width: 0; flex: 1 1 auto; }
.alert__title { font-weight: 700; margin-bottom: 2px; }
.alert__actions { display: flex; gap: var(--s2); margin-top: var(--s3); flex-wrap: wrap; }
.alert--info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.alert--ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.alert--warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.alert--danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert--brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-800); }
[data-theme="dark"] .alert--brand { background: rgba(99,102,241,.14); border-color: rgba(99,102,241,.3); color: var(--brand-200); }

.callout { padding: var(--s4); border-left: 3px solid var(--brand-600); background: var(--surface-2); border-radius: 0 var(--r-md) var(--r-md) 0; }

/* --------------------------------------------------------------- toasts */
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 90; display: flex; flex-direction: column; gap: var(--s2); max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: var(--s3);
  padding: var(--s3) var(--s4); border-radius: var(--r-md);
  background: var(--sidebar-bg); color: #fff; box-shadow: var(--sh-3);
  border-left: 3px solid var(--brand-500); pointer-events: auto;
  animation: toastIn var(--t-med) both; font-size: var(--fs-md);
}
.toast.is-leaving { animation: toastOut var(--t-fast) both; }
.toast__icon { flex: 0 0 20px; margin-top: 1px; }
.toast__icon svg, .toast__icon [data-icon] { width: 20px; height: 20px; }
.toast__body { flex: 1 1 auto; min-width: 0; }
.toast__title { font-weight: 650; }
.toast__msg { opacity: .82; font-size: var(--fs-sm); margin-top: 2px; word-break: break-word; }
.toast__close { border: 0; background: transparent; color: inherit; opacity: .6; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.toast__close:hover { opacity: 1; }
.toast--ok { border-left-color: #22c55e; }
.toast--warn { border-left-color: #f59e0b; }
.toast--danger { border-left-color: #ef4444; }
.toast--info { border-left-color: #38bdf8; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
@media (max-width: 640px) { .toasts { left: var(--s3); right: var(--s3); bottom: var(--s3); max-width: none; } }

/* ---------------------------------------------------------- modal/drawer */
.modal-root, .drawer-root { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.modal-root.is-open, .drawer-root.is-open { pointer-events: auto; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(8, 11, 24, .58);
  backdrop-filter: blur(3px); animation: fadeIn var(--t-med) both;
}
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--sh-4);
  animation: modalIn var(--t-med) both; overflow: hidden;
}
.modal--sm { width: min(430px, calc(100vw - 24px)); }
.modal--lg { width: min(900px, calc(100vw - 24px)); }
.modal--xl { width: min(1180px, calc(100vw - 24px)); }
.modal__head { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.modal__head h3 { font-size: var(--fs-lg); }
.modal__head .sub { font-size: var(--fs-sm); color: var(--text-subtle); margin-top: 3px; }
.modal__close { margin-left: auto; }
.modal__body { padding: var(--s5); overflow-y: auto; flex: 1 1 auto; }
.modal__foot { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; padding: var(--s4) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); }
.modal__foot .btn { min-width: 108px; }
.modal__foot--between { justify-content: space-between; }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer-backdrop { position: absolute; inset: 0; background: rgba(8, 11, 24, .5); animation: fadeIn var(--t-med) both; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  display: flex; flex-direction: column; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--sh-4);
  animation: drawerIn var(--t-med) both;
}
.drawer--left { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--border); animation-name: drawerInLeft; }
.drawer__head { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border); }
.drawer__body { padding: var(--s5); overflow-y: auto; flex: 1 1 auto; }
.drawer__foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: var(--s2); justify-content: flex-end; }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawerInLeft { from { transform: translateX(-100%); } to { transform: none; } }
@media (max-width: 640px) {
  .modal { width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; top: 0; left: 0; transform: none; animation-name: modalInMobile; }
  @keyframes modalInMobile { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* ------------------------------------------------------ states & feedback */
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--r-sm); }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  animation: shimmer 1.4s infinite;
}
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--text { height: 12px; margin-bottom: 8px; }
.skeleton--title { height: 20px; width: 40%; margin-bottom: 12px; }
.skeleton--row { height: 46px; margin-bottom: 6px; border-radius: var(--r-md); }
.skeleton--tile { height: 108px; border-radius: var(--r-lg); }
.skeleton--circle { width: 40px; height: 40px; border-radius: 50%; }

.spinner { width: 20px; height: 20px; border: 2px solid var(--border-strong); border-top-color: var(--brand-600); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner--lg { width: 34px; height: 34px; border-width: 3px; }
.spinner--light { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }

.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s3); padding: var(--s8) var(--s5); text-align: center; color: var(--text-muted);
}
.state__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--surface-3); color: var(--text-subtle); }
.state__icon svg, .state__icon [data-icon] { width: 26px; height: 26px; }
.state__title { font-size: var(--fs-lg); font-weight: 650; color: var(--text); }
.state__msg { max-width: 460px; font-size: var(--fs-md); }
.state__actions { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; margin-top: var(--s2); }
.state--danger .state__icon { background: var(--danger-bg); color: var(--danger); }
.state--ok .state__icon { background: var(--ok-bg); color: var(--ok); }

.loading-row { display: flex; align-items: center; justify-content: center; gap: var(--s3); padding: var(--s6); color: var(--text-muted); font-size: var(--fs-sm); }

.progress { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress__bar { height: 100%; border-radius: var(--r-full); background: var(--brand-600); transition: width var(--t-med); }
.progress--ok .progress__bar { background: var(--ok); }
.progress--warn .progress__bar { background: var(--warn); }
.progress--danger .progress__bar { background: var(--danger); }

/* --------------------------------------------------------------- misc UI */
.divider { height: 1px; background: var(--border); margin: var(--s4) 0; }
.divider--dashed { background: none; border-top: 1px dashed var(--border-strong); }

.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border-soft); }
.list__item:last-child { border-bottom: 0; }
.list__item:hover { background: var(--surface-hover); }
.list__main { flex: 1 1 auto; min-width: 0; }
.list__title { font-weight: 600; font-size: var(--fs-md); }
.list__sub { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: 2px; }
.list__aside { flex: 0 0 auto; text-align: right; }

.timeline { position: relative; padding-left: var(--s6); }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding-bottom: var(--s4); }
.timeline__item::before {
  content: ""; position: absolute; left: calc(-1 * var(--s6) + 3px); top: 5px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand-600); border: 2px solid var(--surface);
}
.timeline__item--ok::before { background: var(--ok); }
.timeline__item--warn::before { background: var(--warn); }
.timeline__item--danger::before { background: var(--danger); }
.timeline__title { font-weight: 600; font-size: var(--fs-md); }
.timeline__meta { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: 2px; }

.def-list { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: var(--s2) var(--s4); font-size: var(--fs-md); }
.def-list dt { color: var(--text-muted); }
.def-list dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
@media (max-width: 520px) {
  .def-list { grid-template-columns: 1fr; gap: 0; }
  .def-list dt { margin-top: var(--s2); }
  .def-list dd { text-align: left; }
}

.empty-inline { padding: var(--s5); text-align: center; color: var(--text-subtle); font-size: var(--fs-sm); }

.toolbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.toolbar__group { display: flex; align-items: center; gap: var(--s2); }
.toolbar__spacer { flex: 1 1 auto; }
.toolbar .search-field { min-width: 220px; flex: 1 1 260px; max-width: 420px; }
@media (max-width: 640px) { .toolbar .search-field { max-width: none; } }

.filter-panel { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); padding: var(--s4); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); }

.pill-scroll { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: var(--s1); scrollbar-width: none; }
.pill-scroll::-webkit-scrollbar { display: none; }
.pill {
  flex: 0 0 auto; min-height: 34px; padding: 0 var(--s4);
  border: 1px solid var(--border); border-radius: var(--r-full); background: var(--surface);
  color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all var(--t-fast);
}
.pill:hover { border-color: var(--brand-400); color: var(--text); }
.pill.is-active { background: var(--brand-600); border-color: var(--brand-700); color: #fff; }

.chart { width: 100%; overflow: visible; }
.chart text { font-family: var(--font); font-size: 10.5px; fill: var(--text-subtle); }
.chart .grid-line { stroke: var(--border-soft); stroke-width: 1; }
.chart .axis-line { stroke: var(--border-strong); stroke-width: 1; }
.chart .series-line { fill: none; stroke: var(--brand-600); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { fill: url(#areaGrad); }
.chart .series-dot { fill: var(--brand-600); stroke: var(--surface); stroke-width: 2; }
.chart .bar { fill: var(--brand-500); rx: 3; }
.chart .bar-2 { fill: var(--accent-500); }
.chart .bar:hover, .chart .series-dot:hover { filter: brightness(1.12); }
.chart-tooltip {
  position: fixed; z-index: 95; pointer-events: none; padding: 6px 9px;
  background: var(--sidebar-bg); color: #fff; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 600; box-shadow: var(--sh-2); white-space: nowrap;
  transform: translate(-50%, -130%); opacity: 0; transition: opacity var(--t-fast);
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-muted); }
.chart-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend__swatch { width: 10px; height: 10px; border-radius: 3px; }

.receipt-paper {
  background: #fff; color: #111; font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
  padding: var(--s5); border-radius: var(--r-md); border: 1px solid var(--border);
  max-width: 380px; margin: 0 auto; white-space: pre-wrap; word-break: break-word;
}
.receipt-html { background: #fff; color: #111; padding: var(--s4); border-radius: var(--r-md); overflow: auto; max-height: 60dvh; }
.receipt-html img { max-width: 100%; }

.qr-placeholder { display: grid; place-items: center; width: 140px; height: 140px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); color: var(--text-subtle); font-size: var(--fs-xs); text-align: center; padding: var(--s2); }

.code-block {
  font-family: var(--font-mono); font-size: var(--fs-sm); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s3) var(--s4);
  overflow-x: auto; white-space: pre; color: var(--text);
}

.recovery-codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s2); }
.recovery-codes code {
  display: block; padding: var(--s2) var(--s3); text-align: center;
  font-family: var(--font-mono); font-size: var(--fs-md); font-weight: 600; letter-spacing: .04em;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--r-sm);
}

.tag-cloud { display: flex; gap: var(--s2); flex-wrap: wrap; }

.permission-matrix { width: 100%; font-size: var(--fs-sm); }
.permission-matrix th, .permission-matrix td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border-soft); text-align: center; }
.permission-matrix th:first-child, .permission-matrix td:first-child { text-align: left; font-weight: 600; }
.permission-matrix thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }

.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.12); flex: 0 0 12px; }

.thumb {
  width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover;
  background: var(--surface-3); border: 1px solid var(--border); flex: 0 0 40px;
  display: grid; place-items: center; color: var(--text-subtle); font-size: var(--fs-xs); font-weight: 700;
}
.thumb--lg { width: 88px; height: 88px; flex-basis: 88px; border-radius: var(--r-md); }

/* ------------------------------------------------- refunds & shared extras */
.refund-line {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s3); border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); transition: border-color var(--t-fast), background var(--t-fast);
}
.refund-line.is-selected { border-color: var(--brand-500); background: var(--brand-50); }
[data-theme="dark"] .refund-line.is-selected { background: rgba(99, 102, 241, .14); }

.radio-cards { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.radio-card {
  display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3);
  border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer;
  background: var(--surface); font-size: var(--fs-sm);
}
.radio-card:has(input:checked) { border-color: var(--brand-500); background: var(--brand-50); }
[data-theme="dark"] .radio-card:has(input:checked) { background: rgba(99, 102, 241, .14); }
.radio-card input { margin-top: 2px; }
.radio-card span { display: flex; flex-direction: column; gap: 2px; }

.totals { display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s2); border-top: 1px dashed var(--border); }
.totals__grand { border-top: 1px solid var(--border); margin-top: var(--s1); padding-top: var(--s2); }
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger); }
.warn-text { color: var(--warn); }
/* `.center` is used both for centred text and for centred flex content. */
.center { display: flex; align-items: center; justify-content: center; text-align: center; }
.cell-actions { display: flex; gap: var(--s1); justify-content: flex-end; }

/* ==========================================================================
   Report picker, role matrix, notification centre, settings, shortcuts.
   ========================================================================== */

/* vertical pickers (reports list, roles list, settings sections) */
.report-list { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s3); }
.report-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--text); text-align: left; cursor: pointer;
  font: inherit; line-height: 1.3;
}
.report-item:hover { background: var(--surface-2); border-color: var(--border); }
.report-item.is-active { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-800); }
[data-theme="dark"] .report-item.is-active { background: rgba(99,102,241,.16); border-color: rgba(99,102,241,.35); color: var(--brand-200); }
.report-item__title { font-weight: 600; min-width: 0; }
.report-item__name { font-size: var(--fs-xs); color: var(--text-subtle); white-space: nowrap; }
.report-item.is-active .report-item__name { color: inherit; opacity: .8; }

/* ==========================================================================
   Reports dashboard — hero, search, module chips, card grid, workspace.
   ========================================================================== */
.reports-hero { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); }
.reports-hero__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.reports-hero__title { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.reports-hero__title h2 { margin: 0; }
.reports-hero__icon { width: 46px; height: 46px; flex: 0 0 46px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; }
.reports-hero__formats { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.reports-search { position: relative; display: flex; align-items: center; }
.reports-search__icon { position: absolute; left: 12px; display: flex; color: var(--text-subtle); pointer-events: none; }
.reports-search .input { width: 100%; height: 44px; padding: 0 40px 0 38px; font-size: var(--fs-base); border-radius: var(--r-md); }
.reports-search__clear { position: absolute; right: 6px; display: flex; }
.reports-chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.mchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px;
  border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 650;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.mchip:hover { border-color: var(--brand-500); }
.mchip.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.mchip__icon { display: flex; opacity: .85; }
.mchip__count { font-size: var(--fs-xs); font-weight: 700; opacity: .7; }
.report-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.report-grid__empty { grid-column: 1 / -1; }
.report-card {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s4);
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface);
  cursor: pointer; text-align: left; font: inherit; color: var(--text); position: relative;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.report-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(16, 24, 40, .10); border-color: var(--brand-500); }
.report-card:focus-visible { box-shadow: var(--focus-ring); }
.report-card__icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; }
.report-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.report-card__title { font-weight: 650; line-height: 1.25; }
.report-card__name { font-size: var(--fs-xs); color: var(--text-subtle); }
.report-card__filters { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.report-card__go { display: flex; color: var(--text-subtle); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s, color .15s; flex: 0 0 auto; }
.report-card:hover .report-card__go { opacity: 1; transform: none; color: var(--brand-500); }
.fchip {
  font-size: 10.5px; padding: 2px 8px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-subtle); font-weight: 650; white-space: nowrap; line-height: 1.5;
}
/* 2FA enrolment QR — always on white for reliable scanning, even in dark mode */
.qr-enrol {
  display: flex; justify-content: center; width: fit-content; max-width: 100%;
  margin: var(--s3) auto var(--s2); padding: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-md);
}
.qr-enrol svg { width: 176px; height: 176px; display: block; }

/* module tints (light + dark) */
.tint-indigo  { background: #eef2ff; color: #4f46e5; }
.tint-amber   { background: #fffbeb; color: #b45309; }
.tint-emerald { background: #ecfdf5; color: #047857; }
.tint-sky     { background: #f0f9ff; color: #0369a1; }
.tint-violet  { background: #f5f3ff; color: #6d28d9; }
.tint-slate   { background: #f1f5f9; color: #475569; }
[data-theme="dark"] .tint-indigo  { background: rgba(99, 102, 241, .16); color: #a5b4fc; }
[data-theme="dark"] .tint-amber   { background: rgba(245, 158, 11, .14); color: #fcd34d; }
[data-theme="dark"] .tint-emerald { background: rgba(16, 185, 129, .14); color: #6ee7b7; }
[data-theme="dark"] .tint-sky     { background: rgba(14, 165, 233, .14); color: #7dd3fc; }
[data-theme="dark"] .tint-violet  { background: rgba(139, 92, 246, .16); color: #c4b5fd; }
[data-theme="dark"] .tint-slate   { background: rgba(148, 163, 184, .14); color: #cbd5e1; }
/* workspace toolbar */
.report-toolbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.report-toolbar__icon { width: 42px; height: 42px; flex: 0 0 42px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; }
.report-toolbar__text { min-width: 0; flex: 1; }
.report-toolbar__text h2 { margin: 0; }
/* redesigned filter panel */
.filter-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.filter-head .h5 { margin: 0; display: flex; align-items: center; }
.range-pills { display: inline-flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px; gap: 2px; flex-wrap: wrap; }
.rpill {
  border: 0; background: transparent; padding: 5px 12px; border-radius: var(--r-full);
  font: inherit; font-size: var(--fs-xs); font-weight: 650; color: var(--text-subtle);
  cursor: pointer; white-space: nowrap; transition: background .15s, color .15s;
}
.rpill:hover { color: var(--text); }
.rpill.is-active { background: var(--surface); color: var(--brand-600); box-shadow: 0 1px 4px rgba(16, 24, 40, .14); cursor: default; }
[data-theme="dark"] .rpill.is-active { background: #26314f; color: var(--brand-200); }
.filter-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
.filter-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s4); flex-wrap: wrap; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-width: 0; flex: 1; }
.achip {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 650;
  padding: 4px 5px 4px 11px; border-radius: var(--r-full);
  background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-800);
}
.achip button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  display: flex; padding: 3px; border-radius: var(--r-full); opacity: .65;
}
.achip button:hover { opacity: 1; background: rgba(15, 23, 42, .08); }
[data-theme="dark"] .achip { background: rgba(99, 102, 241, .16); border-color: rgba(99, 102, 241, .35); color: var(--brand-200); }
[data-theme="dark"] .achip button:hover { background: rgba(255, 255, 255, .10); }
@media (max-width: 720px) {
  .reports-hero { padding: var(--s4); }
  .filter-head { flex-direction: column; align-items: stretch; }
  .range-pills { overflow-x: auto; flex-wrap: nowrap; }
  .report-card__go { opacity: 1; transform: none; }
}

/* two-column admin layouts (roles, settings) */
.roles-layout { display: grid; gap: var(--s4); grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .roles-layout { grid-template-columns: 1fr; } }
.roles-list { position: sticky; top: calc(var(--header-h, 60px) + var(--s4)); }
.roles-detail { min-width: 0; }

/* permission matrix */
.perm-grid { display: grid; gap: 6px 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.perm { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: var(--r-sm); }
.perm:hover { background: var(--surface-2); }
.perm input { margin-top: 2px; accent-color: var(--brand-600); width: 16px; height: 16px; flex: 0 0 16px; }
.perm__text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.perm__text code { opacity: .65; }

/* notification centre */
.notif-list { display: flex; flex-direction: column; }
.notif { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); align-items: flex-start; }
.notif:last-child { border-bottom: 0; }
.notif--unread { background: var(--brand-50); }
[data-theme="dark"] .notif--unread { background: rgba(99,102,241,.10); }
.notif__icon { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; background: var(--surface-2); color: var(--text-subtle); }
.notif__icon--warning { background: var(--warn-bg); color: var(--warn); }
.notif__icon--critical { background: var(--danger-bg); color: var(--danger); }
.notif__icon--info { background: var(--info-bg); color: var(--info); }
.notif__body { min-width: 0; flex: 1 1 auto; }
.notif__head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.notif__head .notif__when { margin-left: auto; }
.notif__actions { display: flex; gap: 4px; flex: 0 0 auto; }

/* settings save bar + profile */
.settings-bar { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border); }
.profile-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.rule { border: 0; border-top: 1px solid var(--border); margin: var(--s3) 0; }
.ml1 { margin-left: var(--s1); } .ml2 { margin-left: var(--s2); }

/* keyboard shortcuts */
.kbd-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.kbd-table { display: flex; flex-direction: column; gap: 8px; }
.kbd-row { display: flex; align-items: center; gap: var(--s3); }
.kbd-row__keys { display: inline-flex; gap: 4px; flex: 0 0 110px; flex-wrap: wrap; }
.kbd-row__what { color: var(--text-subtle); font-size: var(--fs-sm); }
.kbd, .kbd-block {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; padding: 3px 7px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; background: var(--surface-2); font-family: var(--font-mono, monospace);
  font-size: 11px; color: var(--text);
}
.kbd-block { padding: 8px 6px; text-align: center; letter-spacing: 1px; }

/* small marks */
.store-mark { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-700, var(--brand-600)); flex: 0 0 30px; }
[data-theme="dark"] .store-mark { background: rgba(99,102,241,.16); color: var(--brand-200); }
