/**
 * NOVIS — Invoice System
 * High-Performance Minimalism design system (Bootstrap 5.3 shell, sidebar navigation)
 */

/* --- Typography & base --- */
@import url("https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap");

:root {
  --app-font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --app-font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  /* Overridden in header.php from Settings → Primary color */
  --wl-primary: #0040e0;
  --wl-primary-dark: #002fa8;
  --wl-primary-rgb: 0, 64, 224;
  --app-brand: var(--wl-primary);
  --app-brand-dark: var(--wl-primary-dark);
  --app-ink: #0b1c30;
  --app-ink-muted: #565e74;
  --app-surface: #ffffff;
  --app-surface-2: #eff4ff;
  --app-canvas: #f8fafc;
  --app-canvas-2: #e5eeff;
  --app-border: rgba(11, 28, 48, 0.08);
  --app-border-strong: rgba(11, 28, 48, 0.14);
  --app-radius: 0.25rem;
  --app-radius-lg: 0.5rem;
  --app-radius-xl: 0.75rem;
  --app-shadow-sm: 0 1px 2px rgba(11, 28, 48, 0.05), 0 1px 1px rgba(11, 28, 48, 0.04);
  --app-shadow-md: 0 2px 10px rgba(11, 28, 48, 0.07), 0 1px 3px rgba(11, 28, 48, 0.05);
  --app-shadow-lg: 0 10px 32px rgba(11, 28, 48, 0.1), 0 2px 8px rgba(11, 28, 48, 0.05);
  --app-shadow-3d: 0 4px 16px rgba(11, 28, 48, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  --app-transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --app-transition-slow: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --app-sidebar-w: 264px;
  --app-topbar-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: rgba(var(--wl-primary-rgb), 0.22);
  color: var(--app-ink);
}

/* Accessible "skip to content" (hidden until focused) */
.app-skip-link {
  position: fixed;
  top: -48px;
  left: 12px;
  z-index: 1200;
  padding: 0.6rem 1.1rem;
  background: var(--app-brand);
  color: #fff;
  border-radius: var(--app-radius);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: top var(--app-transition);
}
.app-skip-link:focus {
  top: 12px;
  color: #fff;
}

body.app-body {
  font-family: var(--app-font);
  font-size: 0.9375rem;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--app-ink);
  background-color: var(--app-canvas);
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========== App shell: sidebar + topbar + content ========== */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
}

.app-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 28, 48, 0.42);
  z-index: 1035;
  opacity: 0;
  transition: opacity var(--app-transition-slow);
}
.app-sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--app-sidebar-w);
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transform: translateX(-100%);
  transition: transform var(--app-transition-slow);
  overflow-y: auto;
}
.app-sidebar.app-sidebar--open {
  transform: translateX(0);
  box-shadow: var(--app-shadow-lg);
}

@media (min-width: 768px) {
  .app-sidebar {
    transform: none;
  }
  .app-sidebar-backdrop {
    display: none !important;
  }
}

body.app-sidebar-locked {
  overflow: hidden;
}
@media (min-width: 768px) {
  body.app-sidebar-locked {
    overflow: auto;
  }
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
}

.app-sidebar-logo img {
  height: 32px;
  width: auto;
  display: block;
}

.app-sidebar-close {
  border: none;
  background: transparent;
  color: var(--app-ink-muted);
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: var(--app-radius);
  transition: background var(--app-transition), color var(--app-transition);
}
.app-sidebar-close:hover {
  background: var(--app-surface-2);
  color: var(--app-ink);
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.25rem 0.75rem 1.5rem;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--app-ink-muted);
  font-family: var(--app-font);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: var(--app-radius);
  transition: background var(--app-transition), color var(--app-transition);
  cursor: pointer;
}

.app-nav-link i:first-child {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.app-nav-link:hover {
  background: var(--app-surface-2);
  color: var(--app-ink);
}

.app-nav-link.active {
  background: rgba(var(--wl-primary-rgb), 0.1);
  color: var(--wl-primary);
}

.app-nav-group-toggle {
  justify-content: flex-start;
}

.app-nav-chevron {
  margin-left: auto;
  font-size: 0.7rem;
  transition: transform var(--app-transition);
}
.app-nav-group-toggle[aria-expanded="true"] .app-nav-chevron {
  transform: rotate(180deg);
}

.app-nav-subgroup {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.15rem 0 0.35rem 1.65rem;
}

.app-nav-sublink {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  color: var(--app-ink-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--app-radius);
  transition: background var(--app-transition), color var(--app-transition);
}
.app-nav-sublink i {
  width: 14px;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.85;
}
.app-nav-sublink:hover {
  background: var(--app-surface-2);
  color: var(--app-ink);
}
.app-nav-sublink.active {
  color: var(--wl-primary);
  font-weight: 700;
}

/* --- Main column --- */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .app-main {
    margin-left: var(--app-sidebar-w);
  }
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--app-topbar-h);
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  background: rgba(248, 250, 252, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--app-border);
}

.app-topbar-menu {
  border: none;
  background: transparent;
  color: var(--app-ink);
  width: 38px;
  height: 38px;
  border-radius: var(--app-radius);
  font-size: 1.05rem;
  transition: background var(--app-transition);
}
.app-topbar-menu:hover {
  background: var(--app-surface-2);
}

.app-topbar-title {
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  color: var(--app-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--app-ink-muted);
  border-radius: var(--app-radius);
  transition: background var(--app-transition), color var(--app-transition), transform var(--app-transition);
}
.app-icon-btn:hover {
  background: var(--app-surface-2);
  color: var(--wl-primary);
}
.app-icon-btn:active {
  transform: scale(0.94);
}

.app-user-menu {
  position: relative;
}

.app-user-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: none;
  background: transparent;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  border-radius: 999px;
  transition: background var(--app-transition);
}
.app-user-trigger:hover {
  background: var(--app-surface-2);
}

.app-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--wl-primary) 0%, var(--wl-primary-dark) 100%);
  flex-shrink: 0;
}

.app-user-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--app-ink);
  white-space: nowrap;
}

.app-user-chevron {
  font-size: 0.65rem;
  color: var(--app-ink-muted);
}

.app-content {
  flex: 1;
  min-width: 0;
}

/* --- Mobile bottom nav --- */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  background: var(--app-surface);
  border-top: 1px solid var(--app-border);
  box-shadow: 0 -4px 16px rgba(11, 28, 48, 0.06);
}

.app-bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  border: none;
  background: transparent;
  color: var(--app-ink-muted);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--app-radius);
  transition: color var(--app-transition), transform var(--app-transition);
  text-decoration: none;
}
.app-bottom-nav-link i {
  font-size: 1rem;
}
.app-bottom-nav-link:active {
  transform: scale(0.92);
}
.app-bottom-nav-link.active {
  color: var(--wl-primary);
}

body.app-body > .app-shell {
  padding-bottom: 0;
}
@media (max-width: 767.98px) {
  .app-content {
    padding-bottom: 4.25rem;
  }
}

/* Page container spacing (inner .container-fluid used by each page) */
body.app-body .app-content > .container-fluid,
body.app-body .app-content > .container {
  max-width: 100%;
  padding-left: clamp(1rem, 3vw, 2.5rem);
  padding-right: clamp(1rem, 3vw, 2.5rem);
  padding-top: clamp(1.15rem, 2.8vw, 1.85rem);
  padding-bottom: clamp(2rem, 5vw, 3.25rem);
}

/* --- App-wide dropdown polish --- */
body.app-body .dropdown-menu {
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-lg);
  padding: 0.35rem;
  border: 1px solid var(--app-border);
}

body.app-body .dropdown-item {
  border-radius: calc(var(--app-radius) - 2px);
  font-weight: 500;
  font-size: 0.9rem;
}

body.app-body .dropdown-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--app-ink-muted);
}

.navbar.app-navbar .dropdown-menu .dropdown-item .nav-dropdown-item-icon,
.dropdown-menu .dropdown-item .nav-dropdown-item-icon {
  color: var(--wl-primary);
  opacity: 0.95;
}

/* --- User menu profile card (top of the account dropdown) --- */
body.app-body .dropdown-menu.app-user-dropdown {
  min-width: 280px;
  overflow: hidden;
}

.app-user-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin: -0.35rem -0.35rem 0;
  padding: 1rem 1rem 0.85rem;
}

.app-user-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--wl-primary) 0%, var(--wl-primary-dark) 100%);
}

.app-user-card__body {
  min-width: 0;
}

.app-user-card__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--app-ink);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.app-user-card__email {
  font-size: 0.8rem;
  color: var(--app-ink-muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.app-user-account-type {
  padding: 0.5rem 0.75rem 0.6rem;
}

.app-user-account-type__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--app-ink-muted);
  margin-bottom: 0.2rem;
}

.app-user-account-type__value {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--app-ink);
}

.app-user-card__manage {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--wl-primary);
  text-decoration: none;
}

.app-user-card__manage:hover {
  text-decoration: underline;
}

/* Placeholder "coming soon" items in the account dropdown */
.app-user-soon-item {
  display: flex;
  align-items: center;
  color: var(--app-ink-muted) !important;
  cursor: default;
  pointer-events: none;
}

.app-user-soon-item .nav-dropdown-item-icon {
  color: var(--app-ink-muted) !important;
  opacity: 0.6;
}

.app-user-soon-badge {
  margin-left: auto;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--app-ink-muted);
  background: var(--app-surface-2);
}

/* --- Cards (global) — tonal layers + micro-borders, not heavy shadows --- */
body.app-body .card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow-sm);
  background: var(--app-surface);
  transition: box-shadow var(--app-transition-slow), border-color var(--app-transition);
}

body.app-body .card.border-0 {
  border: 1px solid transparent;
}

body.app-body .card:hover {
  box-shadow: var(--app-shadow-md);
  border-color: var(--app-border-strong);
}

body.app-body .card.shadow-sm {
  box-shadow: var(--app-shadow-sm) !important;
}

body.app-body .card-header {
  border-bottom: 1px solid var(--app-border);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.015em;
  background: var(--app-surface-2) !important;
  border-radius: var(--app-radius-lg) var(--app-radius-lg) 0 0 !important;
}

body.app-body .card-header.bg-white {
  background: var(--app-surface) !important;
}

/* --- Stat cards (dashboard "Growth" cards) — flat tonal surface, no border, subtle shadow --- */
.stat-card {
  position: relative;
  border-radius: var(--app-radius-xl);
  overflow: hidden;
  border: 1px solid transparent;
  transition: box-shadow var(--app-transition-slow), transform var(--app-transition-slow);
}

.stat-card--3d {
  box-shadow: var(--app-shadow-3d);
}

.stat-card--3d:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(11, 28, 48, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .stat-card--3d,
  .stat-card--3d:hover {
    transform: none;
    transition: none;
  }
}

.stat-card .card-title {
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  opacity: 0.94;
  font-weight: 700;
}

.stat-card h2 {
  font-size: clamp(1.15rem, 3.2vw, 1.95rem);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-card .icon-shape {
  width: 52px;
  height: 52px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--app-radius-lg);
  box-shadow: none;
}

@media (max-width: 991.98px) {
  .stat-card .card-body {
    padding: 1rem;
  }
  .stat-card .icon-shape {
    width: 44px;
    height: 44px;
  }
  .stat-card .icon-shape .fs-2 {
    font-size: 1.25rem !important;
  }
}

/* Gradient variants (dashboard) — one hue family per KPI, kept in the same tonal register */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--wl-primary) 0%, var(--wl-primary-dark) 100%) !important;
}
.bg-gradient-success {
  background: linear-gradient(135deg, #0f9d70 0%, #0b7a58 100%) !important;
}
.bg-gradient-info {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
}
.bg-gradient-secondary {
  background: linear-gradient(135deg, #565e74 0%, #434656 100%) !important;
}
.bg-gradient-warning {
  background: linear-gradient(135deg, #f0ad4e 0%, #d98f2b 100%) !important;
}
.bg-gradient-danger {
  background: linear-gradient(135deg, #d94848 0%, #ba1a1a 100%) !important;
}
.bg-gradient-violet {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%) !important;
}
.bg-gradient-jade {
  background: linear-gradient(135deg, #0d9488 0%, #065f46 100%) !important;
}
.bg-gradient-dark {
  background: linear-gradient(135deg, #475569 0%, #1e293b 100%) !important;
}
.text-violet { color: #7c3aed !important; }
.text-jade { color: #0d9488 !important; }

/* --- Flat KPI cards (dashboard) — white surface, colored left rule, plain icon, trend badge --- */
.stat-card-flat {
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  border-left: 3px solid var(--stat-accent, var(--wl-primary));
  background: var(--app-surface);
  box-shadow: var(--app-shadow-sm);
  transition: box-shadow var(--app-transition-slow), transform var(--app-transition-slow);
}

.stat-card-flat:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-md);
}

@media (prefers-reduced-motion: reduce) {
  .stat-card-flat,
  .stat-card-flat:hover {
    transform: none;
    transition: none;
  }
}

.stat-card-flat .card-body {
  padding: 1.1rem 1.25rem;
}

.stat-card-flat__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.stat-card-flat__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--app-ink-muted);
}

.stat-card-flat__icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--stat-accent, var(--wl-primary));
}

.stat-card-flat__value-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.stat-card-flat__value {
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-ink);
  font-variant-numeric: tabular-nums;
}

.stat-card-flat__hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--app-ink-muted);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.stat-card__trend--up {
  color: #0f9d70;
}

.stat-card__trend--down {
  color: #ba1a1a;
}

.stat-card-flat--primary { --stat-accent: var(--wl-primary); }
.stat-card-flat--violet { --stat-accent: #7c3aed; }
.stat-card-flat--info { --stat-accent: #0891b2; }
.stat-card-flat--success { --stat-accent: #0f9d70; }
.stat-card-flat--warning { --stat-accent: #d98f2b; }
.stat-card-flat--danger { --stat-accent: #ba1a1a; }
.stat-card-flat--dark { --stat-accent: #475569; }
.stat-card-flat--jade { --stat-accent: #0d9488; }
.stat-card-flat--emerald { --stat-accent: #059669; }
.stat-card-flat--amber { --stat-accent: #b45309; }
.stat-card-flat--rose { --stat-accent: #be185d; }

html[data-bs-theme="dark"] .stat-card-flat {
  background: var(--app-surface);
  border-color: var(--app-border);
}

/* --- Net profit hero card --- */
.net-profit-hero {
  position: relative;
  border-radius: var(--app-radius-xl);
  padding: 1.75rem 2rem;
  background: linear-gradient(135deg, var(--wl-primary) 0%, var(--wl-primary-dark) 100%);
  box-shadow: 0 10px 28px -10px rgba(var(--wl-primary-rgb), 0.4);
  color: #fff;
  overflow: hidden;
}

.net-profit-hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.net-profit-hero__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.85);
}

.net-profit-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  white-space: nowrap;
}

.net-profit-hero__badge--up {
  background: rgba(16, 185, 129, 0.25);
}

.net-profit-hero__badge--down {
  background: rgba(248, 113, 113, 0.25);
}

.net-profit-hero__value {
  margin-top: 0.9rem;
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.net-profit-hero__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
}

.net-profit-hero__meta i {
  opacity: 0.8;
}

/* --- Forms — "Ghost" style: transparent bg, 1px border, cobalt focus glow --- */
body.app-body .form-control,
body.app-body .form-select {
  border-radius: var(--app-radius);
  border-color: var(--app-border-strong);
  background: transparent;
  padding: 0.55rem 0.9rem;
  font-size: 0.9375rem;
  transition: border-color var(--app-transition), box-shadow var(--app-transition);
}

body.app-body .form-control:focus,
body.app-body .form-select:focus {
  border-color: var(--app-brand);
  box-shadow: 0 0 0 3px rgba(var(--wl-primary-rgb), 0.16);
}

body.app-body .form-label,
body.app-body label.form-label {
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--app-ink);
  margin-bottom: 0.35rem;
}

body.app-body .input-group-text {
  border-radius: var(--app-radius);
  border-color: var(--app-border-strong);
  background: var(--app-surface-2);
  color: var(--app-ink-muted);
  font-weight: 500;
}

/* --- Buttons — rectangular, 0.25rem radius; hover darkens, never lifts --- */
body.app-body .btn {
  border-radius: var(--app-radius);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.48rem 1.05rem;
  letter-spacing: -0.01em;
  transition: background var(--app-transition), box-shadow var(--app-transition), border-color var(--app-transition),
    color var(--app-transition);
}

body.app-body .btn-primary {
  background: var(--app-brand);
  border: 1px solid var(--app-brand);
  color: #fff;
}

body.app-body .btn-primary:hover,
body.app-body .btn-primary:focus-visible {
  background: var(--app-brand-dark);
  border-color: var(--app-brand-dark);
  color: #fff;
}

body.app-body .btn-primary:active {
  transform: scale(0.98);
}

body.app-body .btn-outline-secondary {
  border-color: var(--app-border-strong);
  color: var(--app-ink-muted);
}

body.app-body .btn-outline-secondary:hover {
  border-color: var(--app-ink-muted);
  color: var(--app-ink);
  background: var(--app-surface-2);
}

body.app-body .btn-outline-primary {
  border-color: var(--wl-primary);
  color: var(--wl-primary);
}

body.app-body .btn-outline-primary:hover,
body.app-body .btn-outline-primary:focus-visible,
body.app-body .btn-outline-primary:active {
  background: var(--wl-primary-dark);
  border-color: var(--wl-primary-dark);
  color: #fff;
  box-shadow: none;
}

body.app-body .btn-outline-primary:hover .fas,
body.app-body .btn-outline-primary:hover .far,
body.app-body .btn-outline-primary:hover .fab,
body.app-body .btn-outline-primary:focus-visible .fas,
body.app-body .btn-outline-primary:active .fas {
  color: inherit;
}

body.app-body .btn-link {
  font-weight: 600;
}

/* --- Tables --- */
body.app-body .table-responsive {
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  overflow: hidden;
}

body.app-body .table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}

body.app-body .table thead.bg-light {
  background: var(--app-surface-2) !important;
}

body.app-body .table thead th {
  font-family: var(--app-font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--app-ink-muted);
  border-bottom-width: 1px;
}

body.app-body .table-hover > tbody > tr:hover > * {
  --bs-table-hover-bg: rgba(var(--wl-primary-rgb), 0.04);
}

body.app-body .table > :not(caption) > * > * {
  padding: 0.8rem 1rem;
  vertical-align: middle;
}

/* Data-heavy figures align on tabular numerals */
body.app-body .table td.text-end,
body.app-body .font-mono,
body.app-body .table td[data-numeric] {
  font-variant-numeric: tabular-nums;
}

/* --- Pagination --- */
body.app-body .pagination .page-link {
  color: var(--wl-primary);
  border-radius: var(--app-radius);
  border-color: var(--app-border-strong);
  font-weight: 600;
  min-width: 2.35rem;
  text-align: center;
}

body.app-body .pagination .page-item.active .page-link {
  background: var(--wl-primary);
  border-color: var(--wl-primary);
  color: #fff;
}

body.app-body .pagination .page-link:hover {
  background: rgba(var(--wl-primary-rgb), 0.08);
  color: var(--wl-primary-dark);
}

/* --- Alerts --- */
body.app-body .alert {
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow-sm);
}

/* --- Badges / Status chips — "low-fill": 10% tint bg, full-opacity text --- */
body.app-body .badge {
  font-weight: 700;
  padding: 0.38em 0.7em;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

body.app-body .badge.bg-primary {
  background: rgba(var(--wl-primary-rgb), 0.12) !important;
  color: var(--wl-primary-dark) !important;
}
body.app-body .badge.bg-success {
  background: rgba(15, 157, 112, 0.12) !important;
  color: #0b7a58 !important;
}
body.app-body .badge.bg-warning {
  background: rgba(240, 173, 78, 0.18) !important;
  color: #8a5a10 !important;
}
body.app-body .badge.bg-danger {
  background: rgba(186, 26, 26, 0.1) !important;
  color: #ba1a1a !important;
}
body.app-body .badge.bg-secondary {
  background: rgba(86, 94, 116, 0.12) !important;
  color: #434656 !important;
}
body.app-body .badge.bg-info {
  background: rgba(8, 145, 178, 0.12) !important;
  color: #0e7490 !important;
}

/* --- Avatar (dashboard table) --- */
.avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* --- Modals — "High-Performance Blur": 12px backdrop, subtle sharp shadow --- */
body.app-body .modal-content {
  border-radius: var(--app-radius-xl);
  border: 1px solid var(--app-border-strong);
  box-shadow: 0 4px 24px rgba(11, 28, 48, 0.14);
}

body.app-body .modal-backdrop.show {
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0.4;
}

body.app-body .modal-header .modal-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- List group --- */
body.app-body .list-group-item {
  border-color: var(--app-border);
}

/* --- Login page (split hero + form; utility pages use .login-panel-standalone) --- */
body.login-page {
  font-family: var(--app-font);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--app-ink);
  color: #f8fafc;
}

.login-shell {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

@media (min-width: 992px) {
  .login-shell {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 1fr;
    min-height: 100vh;
    min-height: 100dvh;
  }
}

.login-hero {
  position: relative;
  min-width: 0;
  min-height: 100%;
  align-self: stretch;
  padding: clamp(1.75rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, rgba(var(--wl-primary-rgb), 0.4) 0%, transparent 55%),
    radial-gradient(800px 400px at 80% 90%, rgba(0, 64, 224, 0.22) 0%, transparent 50%),
    linear-gradient(155deg, #060a14 0%, #0f1c33 45%, #0b1c30 100%);
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .login-hero {
    min-height: min(44vh, 420px);
  }
}

.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.035'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.9;
  pointer-events: none;
}

.login-hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(36rem, 100%);
}

.login-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.18;
  margin-bottom: 1rem;
}

.login-hero p {
  color: rgba(248, 250, 252, 0.78);
  font-size: 1.05rem;
  line-height: 1.62;
  margin-bottom: 0;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--app-radius);
  background: rgba(var(--wl-primary-rgb), 0.18);
  border: 1px solid rgba(var(--wl-primary-rgb), 0.4);
  color: #cdd8ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.login-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  flex: 1;
  min-width: 0;
  min-height: 100%;
  align-self: stretch;
  width: 100%;
  padding: 0;
  background: var(--app-canvas);
}

/* Split login: form sits directly on panel (no floating card) */
.login-panel .login-card {
  width: 100%;
  max-width: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1.25rem, 6vw, 4rem);
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Shared + utility pages: raised glass card */
.login-card {
  width: 100%;
  box-sizing: border-box;
  padding: clamp(1.75rem, 4vw, 2.5rem);
}

.login-panel-standalone .login-card {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--app-radius-xl);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow-lg);
}

.login-card .login-logo {
  max-width: 180px;
  height: auto;
  display: block;
  margin: 0 auto 1.25rem;
}

.login-card .login-title {
  text-align: center;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--app-ink);
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
}

.login-card .login-sub {
  text-align: center;
  color: var(--app-ink-muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

.login-card .form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--app-ink);
  margin-bottom: 0.4rem;
}

.login-card .input-group-text {
  background: var(--app-surface-2);
  border-color: var(--app-border-strong);
  color: var(--app-ink-muted);
  border-radius: var(--app-radius) 0 0 var(--app-radius);
}

.login-card .form-control {
  border-color: var(--app-border-strong);
  border-radius: 0 var(--app-radius) var(--app-radius) 0;
  padding: 0.7rem 1rem;
}

.login-card .form-control:focus {
  border-color: var(--app-brand);
  box-shadow: 0 0 0 3px rgba(var(--wl-primary-rgb), 0.18);
}

.login-card .btn-login {
  width: 100%;
  padding: 0.75rem 1rem;
  font-weight: 700;
  border-radius: var(--app-radius);
  border: none;
  background: var(--app-brand);
  color: #fff;
  transition: background var(--app-transition);
}

.login-card .btn-login:hover {
  background: var(--app-brand-dark);
  color: #fff;
}

.login-card .alert {
  border-radius: var(--app-radius-lg);
  font-size: 0.9rem;
}

.login-footer-note {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--app-ink-muted);
}

/* Standalone utility pages (e.g. reset password) — one centered panel */
.login-panel-standalone {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--app-canvas);
}

/* --- Login page: centered card auth (login.php) --- */
body.login-page--auth {
  background: radial-gradient(1200px 700px at 15% -10%, rgba(var(--wl-primary-rgb), 0.16) 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 100%, rgba(var(--wl-primary-rgb), 0.12) 0%, transparent 55%),
    linear-gradient(160deg, #eef4ff 0%, #f7fafe 45%, #eaf1fb 100%);
}

html[data-bs-theme="dark"] body.login-page--auth {
  background: radial-gradient(1200px 700px at 15% -10%, rgba(var(--wl-primary-rgb), 0.14) 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 100%, rgba(var(--wl-primary-rgb), 0.1) 0%, transparent 55%),
    linear-gradient(160deg, #060a14 0%, #0f1c33 55%, #0b1c30 100%);
}

.login-auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.login-auth-card {
  width: 100%;
  max-width: 380px;
  box-sizing: border-box;
  padding: 2.25rem 2rem;
  border-radius: 1.5rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow-lg);
}

.login-auth-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  border-radius: 0.85rem;
  background: var(--app-surface-2);
  border: 1px solid var(--app-border);
  color: var(--app-brand);
}

.login-auth-icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

.login-auth-title {
  text-align: center;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--app-ink);
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.login-auth-sub {
  text-align: center;
  color: var(--app-ink-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1.75rem;
}

.login-auth-label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--app-ink-muted);
  margin-bottom: 0.4rem;
}

.login-auth-input {
  position: relative;
  display: flex;
  align-items: center;
}

.login-auth-input svg {
  position: absolute;
  left: 0.9rem;
  width: 1rem;
  height: 1rem;
  color: var(--app-ink-muted);
  pointer-events: none;
}

.login-auth-input input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.9rem 0.7rem 2.35rem;
  border-radius: 0.75rem;
  border: 1px solid var(--app-border-strong);
  background: var(--app-surface-2);
  color: var(--app-ink);
  font-size: 0.9rem;
  transition: border-color var(--app-transition), box-shadow var(--app-transition), background var(--app-transition);
}

.login-auth-input input::placeholder {
  color: var(--app-ink-muted);
  opacity: 0.85;
}

.login-auth-input input:focus {
  outline: none;
  border-color: var(--app-brand);
  background: var(--app-surface);
  box-shadow: 0 0 0 3px rgba(var(--wl-primary-rgb), 0.16);
}

.login-auth-input input#password {
  padding-right: 2.5rem;
}

.login-auth-eye {
  position: absolute;
  right: 0.6rem;
  width: 1.85rem;
  height: 1.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--app-ink-muted);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background var(--app-transition), color var(--app-transition);
}

.login-auth-eye svg {
  width: 1.05rem;
  height: 1.05rem;
}

.login-auth-eye:hover {
  background: var(--app-border);
  color: var(--app-ink);
}

.login-auth-forgot {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--app-brand);
  text-decoration: none;
}

.login-auth-forgot:hover {
  text-decoration: underline;
}

.login-auth-submit {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 0.75rem;
  border: none;
  background: #0b1c30;
  color: #fff;
  transition: background var(--app-transition), transform var(--app-transition);
}

.login-auth-submit svg {
  width: 1.05rem;
  height: 1.05rem;
}

.login-auth-submit:hover {
  background: var(--app-brand-dark);
}

html[data-bs-theme="dark"] .login-auth-submit {
  background: var(--app-brand);
}

html[data-bs-theme="dark"] .login-auth-submit:hover {
  background: var(--app-brand-dark);
}

.login-auth-submit:active {
  transform: scale(0.98);
}

.login-auth-divider {
  position: relative;
  text-align: center;
  margin: 1.5rem 0 1.25rem;
}

.login-auth-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid var(--app-border);
}

.login-auth-divider span {
  position: relative;
  padding: 0 0.75rem;
  background: var(--app-surface);
  color: var(--app-ink-muted);
  font-size: 0.78rem;
}

.login-auth-social {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.login-auth-social-btn {
  flex: 1;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 1px solid var(--app-border-strong);
  background: var(--app-surface);
  color: var(--app-ink-muted);
  font-size: 1rem;
  cursor: not-allowed;
  opacity: 0.55;
}

.login-auth-social-btn svg {
  width: 1.15rem;
  height: 1.15rem;
}

.login-auth-footer {
  text-align: center;
  margin: 0;
  font-size: 0.78rem;
  color: var(--app-ink-muted);
}

/* --- Theme toggle icons (moon in light UI, sun in dark UI) --- */
.theme-icon-when-dark {
  display: none !important;
}
html[data-bs-theme="dark"] .theme-icon-when-light {
  display: none !important;
}
html[data-bs-theme="dark"] .theme-icon-when-dark {
  display: inline-block !important;
}

.login-theme-bar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
}
.login-theme-bar .app-icon-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.login-theme-bar .app-icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* Thin scrollbars (WebKit + Firefox) */
body.app-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--wl-primary-rgb), 0.32) transparent;
}

body.app-body ::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

body.app-body ::-webkit-scrollbar-track {
  background: transparent;
}

body.app-body ::-webkit-scrollbar-thumb {
  background: rgba(var(--wl-primary-rgb), 0.32);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

body.app-body ::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--wl-primary-rgb), 0.5);
  background-clip: padding-box;
}

/* ========== Dark mode (global) ========== */
html[data-bs-theme="dark"] {
  color-scheme: dark;
  --app-ink: #e8edf5;
  --app-ink-muted: #9aa3b8;
  --app-surface: #101a2c;
  --app-surface-2: #0c1424;
  --app-canvas: #070d18;
  --app-canvas-2: #0f1728;
  --app-border: rgba(255, 255, 255, 0.08);
  --app-border-strong: rgba(255, 255, 255, 0.13);
}

html[data-bs-theme="dark"] body.app-body {
  color: var(--app-ink);
  background-color: var(--app-canvas);
}

html[data-bs-theme="dark"] .app-sidebar {
  background: var(--app-surface);
  border-right-color: var(--app-border);
}

html[data-bs-theme="dark"] .app-sidebar-logo img {
  filter: brightness(0) invert(1);
}

html[data-bs-theme="dark"] .app-topbar {
  background: rgba(7, 13, 24, 0.86);
  border-bottom-color: var(--app-border);
}

html[data-bs-theme="dark"] .app-bottom-nav {
  background: var(--app-surface);
  border-top-color: var(--app-border);
}

html[data-bs-theme="dark"] body.app-body .card {
  background: var(--app-surface);
  border-color: var(--app-border);
}

html[data-bs-theme="dark"] body.app-body .card:hover {
  border-color: var(--app-border-strong);
}

html[data-bs-theme="dark"] body.app-body .card-header {
  border-bottom-color: var(--app-border);
  color: var(--app-ink);
  background: var(--app-surface-2) !important;
}

html[data-bs-theme="dark"] body.app-body .text-muted {
  color: #9aa3b8 !important;
}

html[data-bs-theme="dark"] body.app-body .form-control,
html[data-bs-theme="dark"] body.app-body .form-select {
  background-color: var(--app-surface-2);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--app-ink);
}

html[data-bs-theme="dark"] body.app-body .form-control::placeholder {
  color: #6b7690;
}

html[data-bs-theme="dark"] body.app-body .table {
  --bs-table-color: var(--app-ink);
  border-color: var(--app-border);
}

html[data-bs-theme="dark"] body.app-body .table-responsive {
  border-color: var(--app-border);
  background: var(--app-surface);
}

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

html[data-bs-theme="dark"] body.app-body .table thead.bg-light,
html[data-bs-theme="dark"] body.app-body .table thead.table-light {
  --bs-table-bg: var(--app-surface-2);
  --bs-table-color: var(--app-ink-muted);
  background: var(--app-surface-2) !important;
  color: var(--app-ink);
}

html[data-bs-theme="dark"] body.app-body .table thead.bg-light th,
html[data-bs-theme="dark"] body.app-body .table thead.table-light th {
  background-color: var(--app-surface-2) !important;
  color: var(--app-ink-muted) !important;
  border-color: var(--app-border) !important;
}

html[data-bs-theme="dark"] body.app-body .table thead th {
  color: var(--app-ink-muted);
}

html[data-bs-theme="dark"] body.app-body .modal-content {
  background: var(--app-surface);
  border-color: var(--app-border-strong);
  color: var(--app-ink);
}

html[data-bs-theme="dark"] body.app-body .modal-header,
html[data-bs-theme="dark"] body.app-body .modal-footer {
  border-color: var(--app-border);
}

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

html[data-bs-theme="dark"] body.app-body .border,
html[data-bs-theme="dark"] body.app-body .border-top,
html[data-bs-theme="dark"] body.app-body .border-bottom {
  border-color: var(--app-border) !important;
}

html[data-bs-theme="dark"] body.app-body .bg-white {
  background-color: var(--app-surface) !important;
}

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

html[data-bs-theme="dark"] body.app-body .dropdown-item {
  color: var(--app-ink);
}
html[data-bs-theme="dark"] body.app-body .dropdown-item:hover,
html[data-bs-theme="dark"] body.app-body .dropdown-item:focus {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

html[data-bs-theme="dark"] body.app-body .pagination .page-link {
  background: var(--app-surface);
  border-color: var(--app-border);
  color: var(--wl-primary);
}

html[data-bs-theme="dark"] body.app-body .pagination .page-item.active .page-link {
  color: #fff;
}

html[data-bs-theme="dark"] body.app-body .pagination .page-link:hover {
  background: rgba(var(--wl-primary-rgb), 0.15);
}

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

html[data-bs-theme="dark"] .stat-card--3d {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-bs-theme="dark"] .stat-card--3d:hover {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] body.app-body {
  scrollbar-color: rgba(var(--wl-primary-rgb), 0.42) transparent;
}

html[data-bs-theme="dark"] body.app-body ::-webkit-scrollbar-thumb {
  background: rgba(var(--wl-primary-rgb), 0.42);
  background-clip: padding-box;
}

/* Login page — dark theme panel */
html[data-bs-theme="dark"] body.login-page {
  background: #070d18;
}

html[data-bs-theme="dark"] .login-panel {
  background: var(--app-canvas);
}

html[data-bs-theme="dark"] .login-panel .login-card {
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html[data-bs-theme="dark"] .login-panel-standalone .login-card {
  background: rgba(16, 26, 44, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

html[data-bs-theme="dark"] .login-card .login-title,
html[data-bs-theme="dark"] .login-card .form-label {
  color: var(--app-ink);
}

html[data-bs-theme="dark"] .login-card .login-sub {
  color: var(--app-ink-muted);
}

html[data-bs-theme="dark"] .login-card .input-group-text {
  background: var(--app-surface-2);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--app-ink-muted);
}

html[data-bs-theme="dark"] .login-card .form-control {
  background: var(--app-surface-2);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

html[data-bs-theme="dark"] .login-panel-standalone {
  background: var(--app-canvas);
}

/* --- Dashboard welcome (index) --- */
.dashboard-welcome {
  position: relative;
  border-radius: var(--app-radius-xl);
  overflow: hidden;
  border: 1px solid var(--app-border) !important;
  box-shadow: var(--app-shadow-md);
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(var(--wl-primary-rgb), 0.06) 100%);
}

.dashboard-welcome__bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 80% at 90% -30%, rgba(var(--wl-primary-rgb), 0.14) 0%, transparent 52%);
  pointer-events: none;
}

html[data-bs-theme="dark"] .dashboard-welcome {
  border-color: var(--app-border) !important;
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(var(--wl-primary-rgb), 0.14) 100%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

html[data-bs-theme="dark"] .dashboard-welcome__bg {
  background: radial-gradient(ellipse 120% 80% at 90% -20%, rgba(var(--wl-primary-rgb), 0.24) 0%, transparent 55%);
}

.dashboard-welcome .card-body {
  z-index: 2;
}

.dashboard-welcome__eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--wl-primary);
}

.dashboard-welcome__title {
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--app-ink);
  line-height: 1.2;
}

.dashboard-welcome__name {
  color: var(--wl-primary);
}

.dashboard-welcome__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--wl-primary) 0%, var(--wl-primary-dark) 100%);
}

/* Main row — identity, contacts, and clock+action grouped in one vertically-centered line */
.dashboard-welcome__main {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.dashboard-welcome__identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 auto;
}

.dashboard-welcome__divider {
  display: block;
  width: 1px;
  align-self: stretch;
  min-height: 44px;
  background: var(--app-border);
  flex-shrink: 0;
}

.dashboard-welcome__divider--actions {
  margin-right: 0.5rem;
}

@media (max-width: 991.98px) {
  .dashboard-welcome__divider {
    display: none;
  }
  .dashboard-welcome__divider--actions {
    display: block;
  }
}

@media (max-width: 575.98px) {
  .dashboard-welcome__divider--actions {
    display: none;
  }
}

.dashboard-welcome__contacts {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.5rem;
  flex: 1 1 260px;
  min-width: 0;
}

.dashboard-welcome__actions {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex: 0 0 auto;
  margin-left: auto;
}

.dashboard-welcome__btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

@media (max-width: 991.98px) {
  .dashboard-welcome__actions {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--app-border);
  }
}

@media (max-width: 575.98px) {
  .dashboard-welcome__actions {
    flex-wrap: wrap;
  }
  .dashboard-welcome__btn-group {
    flex: 1 1 100%;
  }
  .dashboard-welcome__btn {
    width: 100%;
  }
}

.dashboard-welcome__meta-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 0 1 auto;
  min-width: 0;
}

.dashboard-welcome__meta-body {
  min-width: 0;
  flex: 1;
}

.dashboard-welcome__meta-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--app-ink-muted);
  margin-bottom: 0.25rem;
}

.dashboard-welcome__meta-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--app-ink);
  text-decoration: none;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: color var(--app-transition);
}

a.dashboard-welcome__meta-value:hover {
  color: var(--wl-primary);
}

.dashboard-welcome__meta-empty {
  font-size: 0.92rem;
  color: var(--app-ink-muted);
  font-style: italic;
}

.dashboard-welcome__meta-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--app-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(var(--wl-primary-rgb), 0.1);
  color: var(--wl-primary);
  font-size: 0.95rem;
}

html[data-bs-theme="dark"] .dashboard-welcome__meta-icon {
  background: rgba(var(--wl-primary-rgb), 0.2);
}

/* Footer line — de-emphasized session/security metadata, separated from the main row */
.dashboard-welcome__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--app-ink-muted);
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--app-border);
}

.dashboard-welcome__session-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .dashboard-welcome__session-dot {
    animation: dashboardSessionPulse 2.4s ease-in-out infinite;
  }
}

@keyframes dashboardSessionPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
  50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.1); }
}

.dashboard-welcome__session-text code {
  font-family: var(--app-font-mono);
  font-size: 0.78rem;
  color: var(--app-ink);
  background: none;
  padding: 0;
}

.dashboard-welcome__session-sep {
  margin: 0 0.15rem;
  opacity: 0.6;
}

/* Quick links — same pill UI the "Login history" link used to have */
.dashboard-welcome__quicklinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-left: auto;
}

@media (max-width: 575.98px) {
  .dashboard-welcome__quicklinks {
    margin-left: 0;
    width: 100%;
  }
}

.dashboard-welcome__quicklink {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--wl-primary);
  text-decoration: none;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(var(--wl-primary-rgb), 0.1);
  border: 1px solid rgba(var(--wl-primary-rgb), 0.18);
  transition: background var(--app-transition);
}

.dashboard-welcome__quicklink:hover {
  background: rgba(var(--wl-primary-rgb), 0.16);
  color: var(--wl-primary-dark);
}

/* Digital clock — compact inline readout, grouped with the primary action, not a boxed panel */
.dashboard-welcome__clock {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--app-ink-muted);
  font-size: 1rem;
}

.dashboard-welcome__clock-time {
  font-family: var(--app-font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--app-ink);
  line-height: 1.2;
}

.dashboard-welcome__clock-date {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--app-ink-muted);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.dashboard-welcome__btn {
  border-radius: var(--app-radius);
  font-weight: 600;
  padding: 0.55rem 1.2rem;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .dashboard-welcome__bg {
    animation: dashboardWelcomeGlow 20s ease-in-out infinite alternate;
  }
}

@keyframes dashboardWelcomeGlow {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}

/* Log info page */
.log-info-card {
  border-radius: var(--app-radius-lg);
  overflow: hidden;
}

.log-info-ip {
  font-family: var(--app-font-mono);
  font-size: 0.85rem;
  padding: 0.2rem 0.45rem;
  background: rgba(var(--wl-primary-rgb), 0.08);
  border-radius: var(--app-radius);
}

html[data-bs-theme="dark"] .log-info-ip {
  background: rgba(var(--wl-primary-rgb), 0.15);
}
