/*
 * Naitive Accounting — application theme.
 * Loaded from every rendered page via views/layout.php.
 */

:root {
  --n-primary: #1c3d6b;
  --n-primary-600: #163254;
  --n-primary-50: #e8eef7;
  --n-accent: #17b897;
  --n-accent-50: #e6f6f2;
  --n-danger: #dc3545;
  --n-bg: #f4f6fb;
  --n-surface: #ffffff;
  --n-text: #1d2433;
  --n-muted: #6c7a93;
  --n-border: #e3e7ef;
  --n-sidebar-bg: #0f1a2e;
  --n-sidebar-active: #17b897;
  --n-sidebar-hover: rgba(255, 255, 255, 0.08);
}

html, body { height: 100%; }

/* Compact type scale for the signed-in app (Bootstrap rem + inherited text). */
html:has(body.has-shell) {
  font-size: 13px;
}

body {
  font-family: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  background: var(--n-bg);
  color: var(--n-text);
}

body.has-shell,
body.has-shell .app-shell {
  font-size: 0.9375rem; /* ~12.2px relative to 13px root — keeps forms/tables dense */
  line-height: 1.45;
}

body.has-shell .form-control,
body.has-shell .form-select,
body.has-shell .btn,
body.has-shell .dropdown-menu,
body.has-shell .nav-link,
body.has-shell .table {
  font-size: inherit;
}

/* ---------- App shell ---------- */

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

html.sidebar-collapsed .app-shell {
  grid-template-columns: 76px 1fr;
}

@media (max-width: 767.98px) {
  .app-shell,
  html.sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  /* Phone: hide desktop sidebar; use offcanvas instead */
  .app-shell > .sidebar { display: none !important; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .app-shell { grid-template-columns: 76px 1fr; }
  html.sidebar-collapsed .app-shell { grid-template-columns: 76px 1fr; }
  /* Tablet: force icon rail so nav still fits */
  .sidebar .brand-text,
  .sidebar .nav-section,
  .sidebar .nav-label,
  .sidebar-footer .user-meta {
    display: none;
  }
  .sidebar .nav-link {
    justify-content: center;
    padding: 0.7rem 0.5rem;
    gap: 0;
  }
  .sidebar-user { justify-content: center; }
  .sidebar { padding: 1rem 0.5rem; }
}

.sidebar {
  background: var(--n-sidebar-bg);
  color: #e9ecef;
  padding: 1.25rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: padding 0.2s ease;
}

.sidebar-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand-row {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.25rem 0.35rem;
  text-decoration: none;
  flex: 1;
  min-width: 0;
  border-bottom: 0;
  margin-bottom: 0;
}

.sidebar .brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar .brand .brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--n-accent), #0a9b7e);
  display: grid; place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 4px 10px rgba(23, 184, 151, 0.35);
  flex-shrink: 0;
}

.sidebar-collapse-btn {
  color: #cbd3e1 !important;
  border: 0;
  background: transparent;
  padding: 0.35rem 0.45rem;
  margin-top: 0.15rem;
}
.sidebar-collapse-btn:hover { color: #fff !important; background: var(--n-sidebar-hover); }

.sidebar .nav-section {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a8aab;
  padding: 0.55rem 0.65rem 0.25rem;
  white-space: nowrap;
}

.sidebar .nav-link {
  color: #cbd3e1;
  padding: 0.4rem 0.65rem;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: nowrap;
}
.sidebar .nav-link i { font-size: 0.9rem; width: 1.05rem; text-align: center; flex-shrink: 0; }
.sidebar .nav-link:hover { background: var(--n-sidebar-hover); color: #ffffff; }
.sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(23, 184, 151, 0.25), rgba(23, 184, 151, 0));
  color: #ffffff;
}

.sidebar-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 0.65rem 0.5rem 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  color: #9aa6bf;
}
.sidebar-footer-nav {
  margin-bottom: 0.55rem;
}
.sidebar-footer-nav .nav-link {
  font-size: 0.74rem;
}

.sidebar-footer .user-meta { line-height: 1.2; min-width: 0; }
.sidebar-footer .user-meta strong { color: #ffffff; display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e2a46;
  color: #e9ecef;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

/* Collapsed rail */
html.sidebar-collapsed .sidebar {
  padding: 1rem 0.5rem;
}
html.sidebar-collapsed .sidebar-brand-row {
  justify-content: center;
  flex-direction: column;
  align-items: center;
}
html.sidebar-collapsed .sidebar .brand {
  justify-content: center;
  padding: 0.25rem;
}
html.sidebar-collapsed .sidebar .brand-text,
html.sidebar-collapsed .sidebar .nav-section,
html.sidebar-collapsed .sidebar .nav-label,
html.sidebar-collapsed .sidebar-footer .user-meta {
  display: none;
}
html.sidebar-collapsed .sidebar-collapse-btn {
  margin: 0.35rem 0 0;
}
html.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
  padding: 0.7rem 0.5rem;
  gap: 0;
}
html.sidebar-collapsed .sidebar-footer {
  padding: 0.65rem 0.35rem;
  text-align: center;
}
html.sidebar-collapsed .sidebar-user {
  justify-content: center;
  margin-bottom: 0.5rem !important;
}
html.sidebar-collapsed .sidebar-logout .btn {
  padding-left: 0.4rem;
  padding-right: 0.4rem;
}
html.sidebar-collapsed .sidebar-collapse-btn #sidebarCollapseIcon {
  transform: rotate(180deg);
}

/* ---------- Main content ---------- */

.main-col { display: flex; flex-direction: column; min-width: 0; }

.impersonation-banner {
  background: linear-gradient(90deg, #b45309, #c2410c);
  color: #fff;
  padding: 0.55rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.impersonation-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  font-size: 0.9rem;
}
.impersonation-banner .btn-light {
  font-weight: 600;
}
body.is-impersonating .topbar {
  top: 2.65rem;
}
body.is-trial:not(.is-impersonating) .topbar {
  top: 2.65rem;
}
body.is-impersonating.is-trial .topbar {
  top: 5.3rem;
}

.trial-banner {
  background: linear-gradient(90deg, #0f766e, #0d9488);
  color: #fff;
  padding: 0.55rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 29;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
body.is-impersonating .trial-banner {
  top: 2.65rem;
}
.trial-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  font-size: 0.9rem;
}
.trial-banner .btn-light {
  font-weight: 600;
}

.topbar {
  background: var(--n-surface);
  border-bottom: 1px solid var(--n-border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .page-title { font-weight: 600; font-size: 1rem; margin: 0; }
.topbar .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--n-border);
  background: var(--n-surface);
  color: var(--n-text);
  white-space: nowrap;
}
.credit-pill:hover {
  border-color: var(--n-accent, #17b897);
  color: var(--n-text);
}
.credit-pill.is-low {
  background: #fff3cd;
  border-color: #ffc107;
  color: #664d03;
}
html.theme-dark .credit-pill.is-low {
  background: rgba(255, 193, 7, 0.18);
  border-color: #ffc107;
  color: #ffc107;
}

.page-body { padding: 1.5rem; }

/* ---------- Cards & stats ---------- */

.card {
  border: 1px solid var(--n-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04);
  background: var(--n-surface);
  color: var(--n-text);
}

.card-header { background: transparent; border-bottom: 1px solid var(--n-border); font-weight: 600; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-label { color: var(--n-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; margin-top: 0.35rem; color: var(--n-text); }
.stat-card .stat-icon {
  position: absolute; right: 1rem; top: 1rem;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.2rem;
  color: var(--n-primary);
  background: var(--n-primary-50);
}
.stat-card.accent .stat-icon { color: var(--n-accent); background: var(--n-accent-50); }
.stat-card.warning .stat-icon { color: #c77700; background: #fff4e1; }
.stat-card.danger .stat-icon { color: var(--n-danger); background: #fde8ea; }

/* ---------- Buttons ---------- */

.btn-primary {
  background-color: var(--n-primary);
  border-color: var(--n-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--n-primary-600);
  border-color: var(--n-primary-600);
}
.btn-outline-primary {
  color: var(--n-primary);
  border-color: var(--n-primary);
}
.btn-outline-primary:hover {
  background-color: var(--n-primary);
  border-color: var(--n-primary);
}
.btn-accent {
  background-color: var(--n-accent);
  border-color: var(--n-accent);
  color: #fff;
}
.btn-accent:hover { background-color: #0f9e83; border-color: #0f9e83; color: #fff; }

/* ---------- Tables ---------- */

.table { --bs-table-striped-bg: color-mix(in srgb, var(--n-bg) 80%, var(--n-surface)); --bs-table-bg: transparent; --bs-table-color: var(--n-text); --bs-table-hover-bg: color-mix(in srgb, var(--n-primary) 8%, transparent); --bs-table-border-color: var(--n-border); }
.table thead th { color: var(--n-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table .action-col { white-space: nowrap; }

/* ---------- Uploads / drop zones ---------- */

.dropzone {
  border: 2px dashed var(--n-border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  background: var(--n-bg);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-dragover {
  border-color: var(--n-accent);
  background: var(--n-accent-50);
}
.dropzone .dz-icon { font-size: 2.25rem; color: var(--n-accent); }
.dropzone input[type="file"] { display: none; }
.dropzone .dz-filename { font-weight: 600; margin-top: 0.5rem; }

/* ---------- Loader overlay ---------- */

.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 46, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1050;
}
.loader-overlay.show { display: flex; }

.loader-box {
  background: var(--n-surface);
  color: var(--n-text);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  min-width: 260px;
  max-width: min(420px, 92vw);
}
.loader-spinner-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 0.85rem;
}
.loader-box .loader-spinner {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 4px solid var(--n-primary-50);
  border-top-color: var(--n-accent);
  animation: n-spin 0.8s linear infinite;
}
.loader-box .loader-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--n-text);
}
.loader-box .loader-text { font-weight: 600; color: var(--n-text); }
.loader-box .loader-sub { font-size: 0.85rem; color: var(--n-muted); margin-top: 0.25rem; }
.loader-box .loader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}
.loader-box .loader-actions[hidden] { display: none !important; }
.loader-box .loader-actions .btn { font-size: 0.85rem; }

@keyframes n-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- Inline button spinner ---------- */

.btn[disabled] .inline-spinner { display: inline-block; }
.inline-spinner {
  display: none;
  width: 14px; height: 14px; margin-right: 0.4rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  vertical-align: -2px;
  animation: n-spin 0.8s linear infinite;
}

/* ---------- Auth pages ---------- */

.auth-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--n-primary) 0%, #0b1a36 100%);
  padding: 1.5rem;
}
.auth-wrapper--photo {
  position: relative;
  background-color: #0b1a36;
  background-image:
    linear-gradient(135deg, rgba(15, 26, 46, 0.82) 0%, rgba(11, 26, 54, 0.72) 45%, rgba(23, 184, 151, 0.28) 100%),
    var(--auth-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
@media (max-width: 768px) {
  .auth-wrapper--photo {
    background-attachment: scroll;
  }
}
.auth-wrapper--photo .auth-card {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(2px);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--n-surface);
  color: var(--n-text);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.auth-card .auth-head {
  padding: 1.5rem 1.5rem 1rem;
  text-align: center;
}
.auth-card .auth-head .brand-mark {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--n-accent), #0a9b7e);
  display: grid; place-items: center;
  color: #fff; font-weight: 800;
  font-size: 1.5rem;
  margin: 0 auto 0.75rem;
  box-shadow: 0 6px 16px rgba(23, 184, 151, 0.35);
}
.auth-card .auth-body { padding: 0 1.5rem 1.75rem; }

/* ---------- Form switches (capability toggles, etc.) ---------- */

.form-check.form-switch {
  padding-left: 3rem;
  min-height: 3.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.form-check.form-switch:hover { background: var(--n-primary-50); }

.form-check.form-switch .form-check-input {
  width: 2.4rem;
  height: 1.35rem;
  margin-left: -3rem;
  margin-top: 0.15rem;
  background-color: #d7dce7;
  border-color: #c7ccd9;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, background-position 0.2s ease;
}
.form-check.form-switch .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(23, 184, 151, 0.2);
  border-color: #c7ccd9;
}
.form-check.form-switch .form-check-input:checked {
  background-color: var(--n-accent);
  border-color: var(--n-accent);
}
.form-check.form-switch .form-check-input:checked:focus {
  box-shadow: 0 0 0 0.2rem rgba(23, 184, 151, 0.25);
}
.form-check.form-switch .form-check-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.form-check.form-switch .form-check-label {
  cursor: pointer;
  user-select: none;
}
.form-check.form-switch .form-check-input:disabled + .form-check-label {
  cursor: not-allowed;
}

/* ---------- Badges ---------- */

.role-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.role-badge.admin { background: var(--n-accent-50); color: #0a9b7e; }
.role-badge.user { background: var(--n-primary-50); color: var(--n-primary); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 0.4rem; }
.status-dot.on { background: #28a745; }
.status-dot.off { background: #adb5bd; }

/* ---------- Convert steps ---------- */

.convert-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.convert-steps li {
  position: relative;
  display: flex;
  gap: 0.85rem;
  padding: 0 0 1rem 0;
}
.convert-steps li:last-child { padding-bottom: 0; }
.convert-steps li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 2rem;
  bottom: 0.1rem;
  width: 2px;
  background: linear-gradient(to bottom, var(--n-primary-50), transparent);
}
.convert-steps .step-num {
  flex: 0 0 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--n-primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(28, 61, 107, 0.25);
  position: relative;
  z-index: 1;
}
.convert-steps .step-body { flex: 1; min-width: 0; }
.convert-steps .step-title {
  font-weight: 600;
  color: var(--n-primary-600);
  margin-bottom: 0.15rem;
}
.convert-steps .step-desc {
  color: var(--n-muted);
  font-size: 0.875rem;
  line-height: 1.45;
}
.convert-steps .step-desc a { color: var(--n-accent); text-decoration: none; }
.convert-steps .step-desc a:hover { text-decoration: underline; }

/* ---------- Report export card ---------- */

.report-export-card .form-label.small { letter-spacing: .4px; font-weight: 600; }
.report-export-card .btn i { vertical-align: -1px; }

/* ---------- Pagination ---------- */

.pagination { --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(23, 184, 151, 0.2); }
.pagination .page-link {
  color: var(--n-primary);
  border-color: var(--n-border);
  padding: 0.35rem 0.7rem;
}
.pagination .page-link:hover { background: var(--n-primary-50); color: var(--n-primary-600); }
.pagination .page-item.active .page-link {
  background: var(--n-primary);
  border-color: var(--n-primary);
  color: #fff;
}
.pagination .page-item.disabled .page-link {
  color: var(--n-muted);
  background: #f6f8fb;
}

/* ---------- Charts / bars ---------- */

.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 0.5rem; }
.bar-chart .bar {
  flex: 1;
  background: linear-gradient(180deg, var(--n-accent), var(--n-primary));
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: filter 0.15s ease;
  cursor: default;
}
.bar-chart .bar:hover { filter: brightness(1.1); }
.bar-chart .bar.empty { background: #e7ebf3; }
.bar-chart-labels { display: flex; justify-content: space-between; margin-top: 0.4rem; font-size: 0.7rem; color: var(--n-muted); }

/* ---------- Preview table for viewed CSV ---------- */

.csv-preview {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--n-border);
  border-radius: 10px;
}
.csv-preview table { margin: 0; font-size: 0.85rem; }
.csv-preview thead th {
  position: sticky; top: 0; z-index: 2;
  background: color-mix(in srgb, var(--n-bg) 70%, var(--n-surface)); color: var(--n-text);
}

/* ---------- Utility ---------- */

.js-swal-flash {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.truncate { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.muted-sm { color: var(--n-muted); font-size: 0.85rem; }

.auth-hint-box {
  background: var(--n-bg);
  border: 1px solid var(--n-border);
}

/* ---------- Theme toggle ---------- */

.theme-toggle .theme-icon-light { display: none; }
.theme-toggle .theme-icon-dark { display: inline-block; }
html.theme-dark .theme-toggle .theme-icon-dark { display: none; }
html.theme-dark .theme-toggle .theme-icon-light { display: inline-block; }

.theme-toggle-floating {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: var(--n-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.theme-toggle-floating:hover {
  background: #fff;
  color: var(--n-primary-600);
}
html.theme-dark .theme-toggle-floating {
  background: rgba(26, 34, 52, 0.92);
  border-color: var(--n-border);
  color: #f0f3f8;
}
html.theme-dark .theme-toggle-floating:hover {
  background: #222b40;
  color: #fff;
}

/* ---------- Dark mode tokens ---------- */

html.theme-dark,
[data-bs-theme="dark"] {
  color-scheme: dark;
  --n-primary: #6fa0e0;
  --n-primary-600: #8bb4e8;
  --n-primary-50: rgba(111, 160, 224, 0.16);
  --n-accent: #2dd4b0;
  --n-accent-50: rgba(45, 212, 176, 0.14);
  --n-danger: #f07178;
  --n-bg: #0e1422;
  --n-surface: #171e2e;
  --n-text: #e8edf7;
  --n-muted: #9aa8c2;
  --n-border: #2a354c;
  --n-sidebar-bg: #0a101c;
  --n-sidebar-hover: rgba(255, 255, 255, 0.08);
}

html.theme-dark .topbar .btn-light,
[data-bs-theme="dark"] .topbar .btn-light {
  background: var(--n-bg);
  border-color: var(--n-border);
  color: var(--n-text);
}
html.theme-dark .topbar .btn-light:hover,
[data-bs-theme="dark"] .topbar .btn-light:hover {
  background: var(--n-border);
  color: #fff;
}

html.theme-dark .card,
[data-bs-theme="dark"] .card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

html.theme-dark .table-light,
[data-bs-theme="dark"] .table-light {
  --bs-table-bg: color-mix(in srgb, var(--n-surface) 92%, #000);
  --bs-table-color: var(--n-text);
  --bs-table-border-color: var(--n-border);
  color: var(--n-text);
  border-color: var(--n-border);
}

html.theme-dark .table > :not(caption) > * > *,
[data-bs-theme="dark"] .table > :not(caption) > * > * {
  color: var(--n-text);
  border-color: var(--n-border);
}

html.theme-dark .form-control,
html.theme-dark .form-select,
html.theme-dark .input-group-text,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  background-color: var(--n-bg);
  border-color: var(--n-border);
  color: var(--n-text);
}

html.theme-dark .form-control:focus,
html.theme-dark .form-select:focus,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: var(--n-bg);
  border-color: var(--n-accent);
  color: var(--n-text);
  box-shadow: 0 0 0 0.2rem rgba(45, 212, 176, 0.2);
}

html.theme-dark .nav-tabs,
[data-bs-theme="dark"] .nav-tabs {
  border-bottom-color: var(--n-border);
}
html.theme-dark .nav-tabs .nav-link,
[data-bs-theme="dark"] .nav-tabs .nav-link {
  color: var(--n-muted);
}
html.theme-dark .nav-tabs .nav-link:hover,
[data-bs-theme="dark"] .nav-tabs .nav-link:hover {
  border-color: var(--n-border);
  color: var(--n-text);
}
html.theme-dark .nav-tabs .nav-link.active,
[data-bs-theme="dark"] .nav-tabs .nav-link.active {
  background: var(--n-surface);
  border-color: var(--n-border) var(--n-border) var(--n-surface);
  color: var(--n-text);
}

html.theme-dark .badge.text-bg-light,
[data-bs-theme="dark"] .badge.text-bg-light {
  background-color: var(--n-bg) !important;
  color: var(--n-text) !important;
  border-color: var(--n-border) !important;
}

html.theme-dark .alert,
[data-bs-theme="dark"] .alert {
  border-color: var(--n-border);
}

html.theme-dark .role-badge.user {
  background: var(--n-primary-50);
  color: var(--n-primary-600);
}
html.theme-dark .role-badge.admin {
  background: var(--n-accent-50);
  color: var(--n-accent);
}

html.theme-dark .stat-card.warning .stat-icon {
  color: #f0b429;
  background: rgba(240, 180, 41, 0.15);
}
html.theme-dark .stat-card.danger .stat-icon {
  color: var(--n-danger);
  background: rgba(240, 113, 120, 0.15);
}

html.theme-dark .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-secondary {
  color: var(--n-muted);
  border-color: var(--n-border);
}
html.theme-dark .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background: var(--n-border);
  border-color: var(--n-border);
  color: var(--n-text);
}

html.theme-dark .text-muted,
[data-bs-theme="dark"] .text-muted {
  color: var(--n-muted) !important;
}

html.theme-dark .auth-wrapper {
  background: linear-gradient(135deg, #0b1424 0%, #060a12 100%);
}
html.theme-dark .auth-wrapper--photo {
  background-color: #060a12;
  background-image:
    linear-gradient(135deg, rgba(6, 10, 18, 0.88) 0%, rgba(11, 20, 36, 0.78) 50%, rgba(15, 118, 110, 0.35) 100%),
    var(--auth-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

html.theme-dark code {
  color: #9ec5fe;
}

html.theme-dark .page-title,
html.theme-dark h1, html.theme-dark h2, html.theme-dark h3, html.theme-dark h4, html.theme-dark h5, html.theme-dark h6,
[data-bs-theme="dark"] .page-title,
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6 {
  color: var(--n-text);
}

html.theme-dark .card-header,
html.theme-dark .card-footer,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
  color: var(--n-text);
  background: transparent;
  border-color: var(--n-border);
}

html.theme-dark .form-label,
html.theme-dark .text-uppercase.text-muted,
[data-bs-theme="dark"] .form-label {
  color: var(--n-muted) !important;
}

html.theme-dark .badge.text-bg-light,
html.theme-dark .badge.text-bg-light.text-muted,
[data-bs-theme="dark"] .badge.text-bg-light {
  background-color: var(--n-bg) !important;
  color: var(--n-text) !important;
  border: 1px solid var(--n-border);
}

html.theme-dark .table-light > :not(caption) > * > *,
html.theme-dark thead.table-light th,
[data-bs-theme="dark"] .table-light > :not(caption) > * > *,
[data-bs-theme="dark"] thead.table-light th {
  background-color: color-mix(in srgb, var(--n-bg) 55%, var(--n-surface)) !important;
  color: var(--n-muted) !important;
  border-color: var(--n-border) !important;
}

html.theme-dark .table-hover > tbody > tr:hover > *,
[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: color-mix(in srgb, var(--n-primary) 14%, var(--n-surface));
  color: var(--n-text);
}

html.theme-dark .table-active,
html.theme-dark .table-active > *,
[data-bs-theme="dark"] .table-active,
[data-bs-theme="dark"] .table-active > * {
  --bs-table-bg-state: color-mix(in srgb, var(--n-accent) 16%, var(--n-surface));
  color: var(--n-text);
}

html.theme-dark .list-group-item,
[data-bs-theme="dark"] .list-group-item {
  background-color: var(--n-surface);
  border-color: var(--n-border);
  color: var(--n-text);
}

html.theme-dark .dropdown-menu,
[data-bs-theme="dark"] .dropdown-menu {
  background-color: var(--n-surface);
  border-color: var(--n-border);
  color: var(--n-text);
}

html.theme-dark .modal-content,
[data-bs-theme="dark"] .modal-content {
  background-color: var(--n-surface);
  color: var(--n-text);
  border-color: var(--n-border);
}

html.theme-dark .bar-chart .bar.empty {
  background: var(--n-border);
}

html.theme-dark input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
}

html.theme-dark .btn-link,
[data-bs-theme="dark"] .btn-link {
  color: var(--n-primary);
}

html.theme-dark .page-link,
[data-bs-theme="dark"] .page-link {
  background-color: var(--n-surface);
  border-color: var(--n-border);
  color: var(--n-text);
}

html.theme-dark .page-item.disabled .page-link,
[data-bs-theme="dark"] .page-item.disabled .page-link {
  background-color: var(--n-bg);
  border-color: var(--n-border);
  color: var(--n-muted);
}

html.theme-dark .fw-semibold,
html.theme-dark strong,
[data-bs-theme="dark"] .fw-semibold,
[data-bs-theme="dark"] strong {
  color: inherit;
}

html.theme-dark .stat-card .stat-value {
  color: var(--n-text);
}



/* ---------- First-login focus journey ---------- */

body.naitive-tour-open {
  overflow: hidden;
}

.naitive-tour[hidden] { display: none !important; }

.naitive-tour {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2000 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none;
}

.naitive-tour:not([hidden]) {
  display: block !important;
}

.naitive-tour-backdrop,
.naitive-tour-card {
  pointer-events: auto;
}

.naitive-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 28, 0.62);
  backdrop-filter: blur(2px);
  z-index: 1;
}

.naitive-tour-card {
  position: absolute;
  z-index: 2;
  width: min(380px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  background: var(--n-surface);
  color: var(--n-text);
  border: 1px solid var(--n-border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  padding: 1rem 1.1rem 1.1rem;
  animation: naitive-tour-in 0.22s ease;
}

@keyframes naitive-tour-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.naitive-tour-progress {
  height: 4px;
  background: var(--n-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.85rem;
}
.naitive-tour-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--n-accent), var(--n-primary));
  transition: width 0.2s ease;
}

.naitive-tour-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--n-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.naitive-tour-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
  color: var(--n-text);
}

.naitive-tour-body {
  margin: 0 0 1rem;
  color: var(--n-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.naitive-tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.naitive-tour-target {
  position: relative;
  z-index: 2005 !important;
  box-shadow: 0 0 0 3px var(--n-accent), 0 0 0 8px rgba(23, 184, 151, 0.25) !important;
  border-radius: 10px;
  background-clip: padding-box;
}
.sidebar .nav-link.naitive-tour-target {
  background: rgba(23, 184, 151, 0.18) !important;
  color: #fff !important;
}
.topbar .naitive-tour-target {
  background: var(--n-surface) !important;
}

/* ---------- System config ---------- */

.sys-config {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-width: 1120px;
  padding: 0.75rem 0.75rem 2rem;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .sys-config {
    padding: 1rem 1.25rem 2.5rem;
  }
}

.sc-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.35rem 0.5rem;
  margin-bottom: 0.25rem;
}

.sc-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  color: var(--n-text);
}

.sc-lead {
  max-width: 40rem;
  line-height: 1.5;
}

.sc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--n-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--n-bg) 65%, var(--n-surface));
}

.sc-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 9px;
  color: var(--n-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sc-tab:hover {
  color: var(--n-text);
  background: color-mix(in srgb, var(--n-surface) 80%, transparent);
}

.sc-tab.active {
  color: var(--n-text);
  background: var(--n-surface);
  border-color: var(--n-border);
  box-shadow: 0 1px 2px rgba(15, 26, 46, 0.06);
}

.sc-tab-count {
  margin-left: 0.15rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--n-primary);
  background: var(--n-primary-50);
}

.sc-panel {
  border: 1px solid var(--n-border);
  border-radius: 14px;
  background: var(--n-surface);
  padding: 1.75rem 1.5rem;
}

.sc-tabs-card {
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 26, 46, 0.04);
}

.sc-tabs-card > .card-header {
  background: color-mix(in srgb, var(--n-bg) 55%, var(--n-surface));
  border-bottom: 1px solid var(--n-border);
  padding: 1rem 1.35rem 0;
}

.sys-config .nav-tabs {
  border-bottom: none;
  gap: 0.4rem;
}

.sys-config .nav-tabs .nav-link {
  color: var(--n-muted);
  border: 1px solid transparent;
  border-bottom: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.9rem 1.25rem;
  margin: 0 0.1rem;
  border-radius: 10px 10px 0 0;
}

.sys-config .nav-tabs .nav-link:hover {
  color: var(--n-text);
  border-color: transparent;
}

.sys-config .nav-tabs .nav-link.active {
  color: var(--n-text);
  background: var(--n-surface);
  border-color: var(--n-border);
  border-bottom-color: var(--n-surface);
}

.sc-tour-panel {
  padding: 1.75rem 1.5rem 2rem !important;
}

.sc-tour-panel .sc-tour-copy {
  align-items: flex-start;
  gap: 1.15rem;
}

.sc-head-meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.35rem 0.5rem;
}

.sc-count {
  font-size: 1.55rem;
  font-weight: 750;
  line-height: 1;
  color: var(--n-primary);
  letter-spacing: -0.03em;
}

.sc-section-title {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 0.35rem;
  color: var(--n-text);
}

.sc-tour-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--n-border);
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--n-accent) 10%, var(--n-surface)), var(--n-surface) 55%);
}

.sc-tour-copy {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: min(100%, 18rem);
  flex: 1;
}

.sc-tour-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--n-accent);
  background: var(--n-accent-50);
  font-size: 1.25rem;
}

.sc-log {
  border: none;
  border-radius: 0;
  background: var(--n-surface);
  overflow: hidden;
}

.sc-log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--n-border);
}

.sc-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sc-filter .form-select {
  min-width: 12rem;
  background-color: var(--n-bg);
  border-color: var(--n-border);
}

.sc-log-table-wrap {
  overflow-x: auto;
}

.sc-log-table {
  --bs-table-bg: transparent;
  margin: 0;
  font-size: 0.9rem;
  border-collapse: collapse;
  width: 100%;
}

.sc-log-table thead th {
  background: color-mix(in srgb, var(--n-bg) 70%, var(--n-surface));
  color: var(--n-muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--n-border);
  white-space: nowrap;
  padding: 0.85rem 1.35rem;
  vertical-align: middle;
}

.sc-log-table tbody td {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--n-border);
  border-top: none;
  vertical-align: middle;
  box-sizing: border-box;
}

.sc-log-table tbody tr:hover td {
  background: color-mix(in srgb, var(--n-primary) 5%, transparent);
}

.sc-when {
  min-width: 9.5rem;
}

.sc-when-main {
  display: block;
  font-weight: 600;
  color: var(--n-text);
  white-space: nowrap;
}

.sc-when-code {
  display: block;
  margin-top: 0.15rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
}

.sc-company {
  max-width: 10rem;
  color: var(--n-text);
}

.sc-user {
  font-weight: 550;
  white-space: nowrap;
}

.sc-details {
  max-width: 26rem;
  color: var(--n-muted);
}

.sc-details-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
}

.sc-ip code {
  font-size: 0.78rem;
  color: var(--n-muted);
  background: transparent;
  padding: 0;
}

.sc-empty {
  text-align: center;
  color: var(--n-muted);
  padding: 2.5rem 1rem !important;
}

.sc-log-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.sc-log-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--n-border);
  background: color-mix(in srgb, var(--n-bg) 55%, var(--n-surface));
}

.sc-log-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.sc-log-pager .btn.disabled,
.sc-log-pager .btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

.sc-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.sc-pill-ok {
  color: #0a7a5f;
  background: var(--n-accent-50);
  border-color: color-mix(in srgb, var(--n-accent) 25%, transparent);
}

.sc-pill-accent {
  color: var(--n-primary);
  background: var(--n-primary-50);
  border-color: color-mix(in srgb, var(--n-primary) 20%, transparent);
}

.sc-pill-info {
  color: #1d4f91;
  background: #e8f0fb;
  border-color: #c9dbf3;
}

.sc-pill-warn {
  color: #9a5b00;
  background: #fff4e1;
  border-color: #f0d3a0;
}

.sc-pill-muted {
  color: var(--n-muted);
  background: var(--n-bg);
  border-color: var(--n-border);
}

.sc-billing-panel {
  padding: 2.25rem 2rem 2.75rem !important;
  border: none;
  border-radius: 0;
}

.sc-provider-logo {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  border-radius: 10px;
  border: 1px solid var(--n-border);
  background: var(--n-bg);
  display: inline-grid !important;
  place-items: center;
  overflow: hidden !important;
  flex: 0 0 48px !important;
  box-sizing: border-box;
}
.sc-provider-logo img {
  display: block !important;
  width: auto !important;
  height: auto !important;
  max-width: 36px !important;
  max-height: 36px !important;
  object-fit: contain !important;
  padding: 0 !important;
  margin: 0 !important;
}
.sc-provider-fallback {
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--n-primary);
  line-height: 1;
}

.sc-billing-form {
  margin-top: 1.25rem;
  display: grid;
  gap: 1.35rem;
}

.sc-billing-block {
  padding: 1.5rem 1.5rem 1.65rem;
  border: 1px solid var(--n-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--n-bg) 45%, var(--n-surface));
}

.sc-billing-block-head {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--n-border);
}

.sc-billing-step {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 750;
  color: #fff;
  background: var(--n-primary);
  line-height: 1;
}

.sc-billing-block-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--n-text);
}

.sc-billing-block-lead {
  margin: 0;
  font-size: 0.9rem;
  color: var(--n-muted);
  line-height: 1.45;
  max-width: 48rem;
}

.sc-billing-alert {
  margin-bottom: 1.25rem;
  padding: 0.95rem 1.1rem;
  border-radius: 10px;
}

.sc-billing-form .row {
  margin-bottom: 0;
  --bs-gutter-y: 1.15rem;
}

.sc-billing-form .form-label {
  margin-bottom: 0.45rem;
  font-weight: 600;
}

.sc-billing-form .form-control,
.sc-billing-form .form-select {
  padding: 0.7rem 0.85rem;
  min-height: 2.75rem;
}

.sc-billing-form .form-text {
  margin-top: 0.4rem;
}

.sc-billing-form .font-monospace {
  font-size: 0.82rem;
}

.sc-billing-check {
  padding: 0.85rem 1rem;
  border: 1px dashed var(--n-border);
  border-radius: 10px;
  background: var(--n-surface);
  width: 100%;
}

.sc-billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.35rem 0.15rem 0.25rem;
}

@media (max-width: 768px) {
  .sc-billing-panel {
    padding: 1.5rem 1.15rem 2rem !important;
  }
  .sc-billing-block {
    padding: 1.15rem 1.05rem 1.25rem;
  }
}
.sc-tour-panel {
  padding: 2rem 1.75rem 2.25rem !important;
}

html.theme-dark .sc-tour-bar,
[data-bs-theme="dark"] .sc-tour-bar {
  background: linear-gradient(135deg, color-mix(in srgb, var(--n-accent) 12%, var(--n-surface)), var(--n-surface) 60%);
}

html.theme-dark .sc-pill-info,
[data-bs-theme="dark"] .sc-pill-info {
  color: #9ec0ef;
  background: rgba(111, 160, 224, 0.14);
  border-color: rgba(111, 160, 224, 0.28);
}

html.theme-dark .sc-pill-warn,
[data-bs-theme="dark"] .sc-pill-warn {
  color: #f0c37a;
  background: rgba(194, 119, 0, 0.18);
  border-color: rgba(194, 119, 0, 0.35);
}

html.theme-dark .sc-pill-ok,
[data-bs-theme="dark"] .sc-pill-ok {
  color: var(--n-accent);
}


/* ---------- Conversion history table ---------- */

.hist-panel {
  border: 1px solid var(--n-border);
  border-radius: 12px;
  background: var(--n-surface);
  overflow: hidden;
}

.hist-table-wrap {
  overflow-x: auto;
}

.hist-table {
  --bs-table-bg: transparent;
  margin: 0;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.hist-table thead th {
  background: color-mix(in srgb, var(--n-bg) 70%, var(--n-surface));
  color: var(--n-muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--n-border);
  white-space: nowrap;
  padding: 0.85rem 1.15rem;
  vertical-align: middle;
}

.hist-table tbody td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--n-border);
  border-top: none;
  vertical-align: middle;
  box-sizing: border-box;
}

.hist-table tbody tr:last-child td {
  border-bottom: none;
}

.hist-table tbody tr:hover td {
  background: color-mix(in srgb, var(--n-primary) 5%, transparent);
}

.hist-id {
  color: var(--n-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hist-user {
  white-space: nowrap;
  font-weight: 550;
}

.hist-user a {
  text-decoration: none;
}

.hist-user a:hover {
  text-decoration: underline;
}

.hist-file {
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--n-text);
}

.hist-type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--n-muted);
  background: var(--n-bg);
  border: 1px solid var(--n-border);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}

.hist-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.hist-pill-ok {
  color: #0a7a5f;
  background: var(--n-accent-50);
  border-color: color-mix(in srgb, var(--n-accent) 25%, transparent);
}

.hist-pill-fail {
  color: #a11f2c;
  background: #fde8ea;
  border-color: #f0c0c6;
  cursor: help;
}

.hist-size {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--n-muted);
}

.hist-time {
  white-space: nowrap;
  color: var(--n-muted);
  font-size: 0.86rem;
}

.hist-actions {
  white-space: nowrap;
}

.hist-actions .btn {
  padding: 0.25rem 0.5rem;
}

.hist-actions-none {
  color: var(--n-border);
  font-weight: 600;
}

.hist-empty {
  text-align: center;
  color: var(--n-muted);
  padding: 2.75rem 1rem !important;
}

.hist-empty .bi {
  display: block;
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  opacity: 0.55;
}

.hist-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.9rem 1.15rem 1.1rem;
  border-top: 1px solid var(--n-border);
  background: color-mix(in srgb, var(--n-bg) 55%, var(--n-surface));
}

.hist-footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.hist-per-page {
  width: auto;
  min-width: 4.5rem;
}

.hist-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.hist-pager .btn.disabled,
.hist-pager .btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

html.theme-dark .hist-pill-fail,
[data-bs-theme="dark"] .hist-pill-fail {
  color: #f0a0a8;
  background: rgba(220, 53, 69, 0.16);
  border-color: rgba(220, 53, 69, 0.32);
}

html.theme-dark .hist-pill-ok,
[data-bs-theme="dark"] .hist-pill-ok {
  color: var(--n-accent);
}

#naitiveConfettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2600;
}
