/* ==========================================================================
   Affrevo design system
   ========================================================================== */

:root {
  --ah-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ah-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ah-bg: #f6f7f9;
  --ah-surface: #ffffff;
  --ah-surface-2: #fafbfc;
  --ah-border: #e7e9ee;
  --ah-border-strong: #d8dce3;

  --ah-text: #0f1729;
  --ah-text-2: #475467;
  --ah-muted: #8a94a6;

  --ah-accent: #5b5bf0;
  --ah-accent-hover: #4a48dd;
  --ah-accent-soft: #eef0ff;
  --ah-accent-ring: rgba(91, 91, 240, 0.18);
  --ah-gradient: linear-gradient(135deg, #6d6bff 0%, #9b5cff 55%, #d65cff 100%);

  --ah-success: #12a150;
  --ah-success-soft: #e8f7ee;
  --ah-warning: #c27803;
  --ah-warning-soft: #fdf4e3;
  --ah-danger: #dc3545;
  --ah-danger-soft: #fdecee;
  --ah-info: #0b84d6;
  --ah-info-soft: #e6f3fc;

  --ah-side-bg: #0b0d14;
  --ah-side-bg-2: #12151f;
  --ah-side-border: rgba(255, 255, 255, 0.06);
  --ah-side-text: #8e96a8;
  --ah-side-text-hover: #e6e9f0;

  --ah-radius-sm: 6px;
  --ah-radius: 10px;
  --ah-radius-lg: 14px;
  --ah-shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --ah-shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.03);
  --ah-shadow-md: 0 8px 24px -6px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.04);
  --ah-shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.18);

  --ah-sidebar-w: 248px;
  --ah-topbar-h: 60px;

  /* Bootstrap bridge */
  --bs-body-font-family: var(--ah-font);
  --bs-body-font-size: 0.875rem;
  --bs-body-color: var(--ah-text);
  --bs-body-bg: var(--ah-bg);
  --bs-border-color: var(--ah-border);
  --bs-border-radius: var(--ah-radius-sm);
  --bs-primary: var(--ah-accent);
  --bs-primary-rgb: 91, 91, 240;
  --bs-success-rgb: 18, 161, 80;
  --bs-danger-rgb: 220, 53, 69;
  --bs-warning-rgb: 194, 120, 3;
  --bs-info-rgb: 11, 132, 214;
  --bs-link-color: var(--ah-accent);
  --bs-link-hover-color: var(--ah-accent-hover);
  --bs-secondary-color: var(--ah-muted);
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  margin: 0;
  font-family: var(--ah-font);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ah-text);
  background: var(--ah-bg);
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.006em;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--ah-text);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
h1, .h1 { font-size: 1.5rem; }
h2, .h2 { font-size: 1.375rem; }
h3, .h3 { font-size: 1.2rem; }
h4, .h4 { font-size: 1.05rem; }
h5, .h5 { font-size: 0.95rem; }
h6, .h6 { font-size: 0.875rem; }

a { color: var(--ah-accent); text-decoration: none; }
a:hover { color: var(--ah-accent-hover); }

code, kbd, .font-monospace { font-family: var(--ah-mono); font-size: 0.8em; }
code { color: #6b36d9; background: #f3efff; padding: 0.1em 0.4em; border-radius: 4px; }

::selection { background: var(--ah-accent-ring); }

.text-muted, .text-secondary { color: var(--ah-muted) !important; }
.text-primary { color: var(--ah-accent) !important; }
.text-success { color: var(--ah-success) !important; }
.text-danger { color: var(--ah-danger) !important; }
.text-warning { color: var(--ah-warning) !important; }
.text-info { color: var(--ah-info) !important; }
.text-dark { color: var(--ah-text) !important; }
.bg-light { background-color: var(--ah-surface-2) !important; }
.bg-primary { background-color: var(--ah-accent) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--ah-border) !important; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cfd4dc transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3d8e0; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #b9c0cb; }

/* ==========================================================================
   App shell
   ========================================================================== */

.ah-app { display: flex; min-height: 100vh; }

.ah-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--ah-sidebar-w);
  background: var(--ah-side-bg);
  background-image:
    radial-gradient(120% 50% at 0% 0%, rgba(109, 107, 255, 0.16) 0%, transparent 60%),
    radial-gradient(80% 40% at 100% 100%, rgba(214, 92, 255, 0.08) 0%, transparent 60%);
  border-right: 1px solid var(--ah-side-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.25s ease;
}

.ah-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  height: var(--ah-topbar-h);
  padding: 0 1.1rem;
  color: #fff;
  font-weight: 650;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--ah-side-border);
  flex-shrink: 0;
}
.ah-brand:hover { color: #fff; }
.ah-brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--ah-gradient);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -4px rgba(124, 92, 255, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.ah-brand-mark svg { width: 16px; height: 16px; color: #fff; stroke-width: 2.4; }
.ah-brand-logo { width: 32px; height: 32px; border-radius: 9px; display: block; object-fit: cover; flex-shrink: 0; }
.ah-brand small {
  display: block;
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--ah-side-text);
  letter-spacing: 0.02em;
  margin-top: 1px;
}

.ah-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.65rem 1rem; scrollbar-color: #2a2f3d transparent; }
.ah-nav::-webkit-scrollbar-thumb { background-color: #262b38; }

.ah-nav-label {
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #5a6275;
  padding: 1rem 0.65rem 0.4rem;
}
.ah-nav-label:first-child { padding-top: 0.35rem; }

.ah-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--ah-side-text);
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s, color 0.15s;
  position: relative;
}
.ah-nav-link svg { width: 17px; height: 17px; stroke-width: 1.9; flex-shrink: 0; opacity: 0.85; }
.ah-nav-link:hover { color: var(--ah-side-text-hover); background: rgba(255, 255, 255, 0.04); }
.ah-nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(109, 107, 255, 0.22), rgba(109, 107, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(139, 132, 255, 0.18);
}
.ah-nav-link.active svg { opacity: 1; color: #a9a6ff; }
.ah-nav-link .ah-chevron { margin-left: auto; width: 14px; height: 14px; transition: transform 0.2s; opacity: 0.6; }
.ah-nav-link[aria-expanded="true"] .ah-chevron { transform: rotate(90deg); }
.ah-nav-link.has-active { color: var(--ah-side-text-hover); }

.ah-subnav { list-style: none; margin: 0.15rem 0 0.35rem; padding: 0 0 0 1.55rem; position: relative; }
.ah-subnav::before {
  content: '';
  position: absolute;
  left: 1.05rem; top: 4px; bottom: 4px;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}
.ah-subnav a {
  display: block;
  padding: 0.38rem 0.65rem;
  border-radius: 7px;
  color: var(--ah-side-text);
  font-size: 0.81rem;
  font-weight: 450;
  transition: color 0.15s, background-color 0.15s;
  position: relative;
}
.ah-subnav a:hover { color: var(--ah-side-text-hover); background: rgba(255, 255, 255, 0.035); }
.ah-subnav a.active { color: #fff; background: rgba(255, 255, 255, 0.06); font-weight: 550; }
.ah-subnav a.active::before {
  content: '';
  position: absolute;
  left: -0.52rem; top: 50%;
  width: 5px; height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: #a9a6ff;
  box-shadow: 0 0 0 3px rgba(169, 166, 255, 0.18);
}

.ah-side-footer {
  border-top: 1px solid var(--ah-side-border);
  padding: 0.75rem;
  flex-shrink: 0;
}
.ah-side-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: 10px;
  background: var(--ah-side-bg-2);
  border: 1px solid var(--ah-side-border);
}
.ah-side-user .ah-avatar { width: 32px; height: 32px; font-size: 0.75rem; }
.ah-side-user-name { color: #e6e9f0; font-weight: 600; font-size: 0.8rem; line-height: 1.2; }
.ah-side-user-role { color: var(--ah-side-text); font-size: 0.7rem; text-transform: capitalize; }
.ah-side-user a { margin-left: auto; color: var(--ah-side-text); padding: 6px; border-radius: 7px; display: grid; }
.ah-side-user a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.ah-side-user a svg { width: 16px; height: 16px; }

.ah-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--ah-gradient);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.ah-main { flex: 1; min-width: 0; margin-left: var(--ah-sidebar-w); display: flex; flex-direction: column; }

.ah-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--ah-topbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.75rem;
  background: rgba(246, 247, 249, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--ah-border);
}

.ah-crumbs { display: flex; align-items: center; gap: 0.45rem; font-size: 0.84rem; color: var(--ah-muted); min-width: 0; }
.ah-crumbs svg { width: 14px; height: 14px; opacity: 0.6; }
.ah-crumbs strong { color: var(--ah-text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

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

.ah-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 280px;
  height: 36px;
  padding: 0 0.6rem 0 0.75rem;
  background: var(--ah-surface);
  border: 1px solid var(--ah-border);
  border-radius: 9px;
  color: var(--ah-muted);
  box-shadow: var(--ah-shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ah-search:focus-within { border-color: var(--ah-accent); box-shadow: 0 0 0 3px var(--ah-accent-ring); }
.ah-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.ah-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 0.83rem; color: var(--ah-text); }
.ah-search input::placeholder { color: var(--ah-muted); }
.ah-kbd {
  font-family: var(--ah-font);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ah-muted);
  border: 1px solid var(--ah-border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 0.35rem;
  line-height: 1.5;
  background: var(--ah-surface-2);
}

.ah-icon-btn {
  position: relative;
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ah-text-2);
  transition: background-color 0.15s, border-color 0.15s;
}
.ah-icon-btn:hover { background: var(--ah-surface); border-color: var(--ah-border); }
.ah-icon-btn svg { width: 18px; height: 18px; }
.ah-icon-btn .notification-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 0.62rem;
  line-height: 16px;
  background: var(--ah-danger);
  color: #fff;
  border: 2px solid var(--ah-bg);
  box-sizing: content-box;
}

.ah-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 28px;
  padding: 0 0.7rem;
  border-radius: 999px;
  background: var(--ah-success-soft);
  color: var(--ah-success);
  font-size: 0.72rem;
  font-weight: 600;
}
.ah-live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: relative; }
.ah-live-dot::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: ah-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ah-ping { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.8); opacity: 0; } }

.ah-user-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--ah-border);
  border-radius: 999px;
  background: var(--ah-surface);
  color: var(--ah-text);
  font-weight: 550;
  font-size: 0.8rem;
  box-shadow: var(--ah-shadow-xs);
}
.ah-user-btn .ah-avatar { width: 28px; height: 28px; font-size: 0.68rem; }
.ah-user-btn svg { width: 14px; height: 14px; color: var(--ah-muted); }
.ah-user-btn::after { display: none; }

.ah-content { flex: 1; padding: 1.75rem; width: 100%; max-width: 1600px; margin: 0 auto; }
.ah-content > .container-fluid, .ah-content > .container { padding-left: 0; padding-right: 0; }
.ah-content > .container-fluid.py-3, .ah-content > .container-fluid.py-4 { padding-top: 0 !important; }
.ah-content > .container-fluid.mt-4 { margin-top: 0 !important; }

.ah-menu-toggle { display: none; }
.ah-backdrop { display: none; }

@media (max-width: 991.98px) {
  .ah-sidebar { transform: translateX(-100%); box-shadow: var(--ah-shadow-lg); }
  body.ah-sidebar-open .ah-sidebar { transform: none; }
  body.ah-sidebar-open .ah-backdrop { display: block; position: fixed; inset: 0; background: rgba(11, 13, 20, 0.45); z-index: 1035; }
  .ah-main { margin-left: 0; }
  .ah-menu-toggle { display: inline-grid; }
  .ah-search { display: none; }
  .ah-topbar, .ah-content { padding-left: 1rem; padding-right: 1rem; }
}

/* Notifications dropdown */
.navbar-notification { position: relative; }
.notification-dropdown {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  width: 360px;
  background: var(--ah-surface);
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg);
  box-shadow: var(--ah-shadow-lg);
  overflow: hidden;
  z-index: 1050;
}
.notification-header { display: flex; align-items: center; justify-content: space-between; padding: 0.85rem 1rem; border-bottom: 1px solid var(--ah-border); }
.notification-header h6 { font-weight: 600; }
.btn-close-notification { border: 0; background: transparent; color: var(--ah-muted); display: grid; padding: 4px; border-radius: 6px; }
.btn-close-notification:hover { background: var(--ah-surface-2); color: var(--ah-text); }
.notification-body { max-height: 380px; overflow-y: auto; }
.notification-footer { display: flex; align-items: center; justify-content: space-between; padding: 0.65rem 1rem; border-top: 1px solid var(--ah-border); background: var(--ah-surface-2); }
.view-all-link { font-size: 0.8rem; font-weight: 600; }

/* Flash messages */
.flash-messages { margin-bottom: 1.25rem; display: grid; gap: 0.5rem; }

/* ==========================================================================
   Page header helper
   ========================================================================== */

.ah-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.ah-page-title { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.03em; margin: 0; }
.ah-page-sub { color: var(--ah-muted); margin: 0.25rem 0 0; font-size: 0.875rem; }
.ah-page-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Normalise the many legacy page headers so every page shares one rhythm */
.ah-content .d-flex.justify-content-between.align-items-center.mb-4 h1,
.ah-content .d-flex.justify-content-between.align-items-center.mb-4 h2,
.ah-content .d-flex.justify-content-between.align-items-center.mb-4 h3,
.ah-content .page-header h1, .ah-content .page-header h2, .ah-content .page-header h3,
.ah-content .page-title {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--ah-text);
  margin-bottom: 0.15rem;
}
.ah-content .d-flex.justify-content-between.align-items-center.mb-4 h1 i,
.ah-content .d-flex.justify-content-between.align-items-center.mb-4 h2 i,
.ah-content .page-title i,
.ah-content .page-header h1 i, .ah-content .page-header h2 i { color: var(--ah-accent); font-size: 0.85em; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--ah-surface);
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg);
  box-shadow: var(--ah-shadow-xs);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card.shadow, .card.shadow-sm, .card.shadow-lg { box-shadow: var(--ah-shadow-sm) !important; }
.card.border-0 { border: 1px solid var(--ah-border) !important; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ah-border);
  padding: 0.95rem 1.25rem;
  font-weight: 600;
}
.card-header:first-child { border-radius: calc(var(--ah-radius-lg) - 1px) calc(var(--ah-radius-lg) - 1px) 0 0; }
.card-header.bg-white, .card-header.bg-light, .card-header.bg-transparent { background: transparent !important; }
.card-header h1, .card-header h2, .card-header h3, .card-header h4, .card-header h5, .card-header h6 { margin: 0; font-size: 0.92rem; font-weight: 600; letter-spacing: -0.01em; }
.card-header.bg-primary, .card-header.bg-dark, .card-header.bg-info, .card-header.bg-success, .card-header.bg-secondary {
  background: transparent !important;
  color: var(--ah-text) !important;
}
.card-header.bg-primary *, .card-header.bg-dark *, .card-header.bg-info *, .card-header.bg-success *, .card-header.bg-secondary * { color: inherit !important; }
.card-body { padding: 1.25rem; }
.card-footer { background: var(--ah-surface-2); border-top: 1px solid var(--ah-border); padding: 0.85rem 1.25rem; }
.card-footer:last-child { border-radius: 0 0 calc(var(--ah-radius-lg) - 1px) calc(var(--ah-radius-lg) - 1px); }
.card-title { font-weight: 600; letter-spacing: -0.01em; }

/* Coloured stat cards from legacy pages become calm, accent-edged tiles */
.card.bg-primary, .card.bg-success, .card.bg-info, .card.bg-warning, .card.bg-danger, .card.bg-dark, .card.bg-secondary,
.card.text-white.bg-primary, .card.text-white.bg-success, .card.text-white.bg-info {
  background: var(--ah-surface) !important;
  color: var(--ah-text) !important;
  position: relative;
  overflow: hidden;
}
.card.bg-primary *, .card.bg-success *, .card.bg-info *, .card.bg-warning *, .card.bg-danger *, .card.bg-dark *, .card.bg-secondary * { color: inherit; }
.card.bg-primary::before, .card.bg-success::before, .card.bg-info::before, .card.bg-warning::before, .card.bg-danger::before, .card.bg-dark::before, .card.bg-secondary::before {
  content: '';
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 3px;
}
.card.bg-primary::before { background: var(--ah-gradient); }
.card.bg-success::before { background: var(--ah-success); }
.card.bg-info::before { background: var(--ah-info); }
.card.bg-warning::before { background: #f5a524; }
.card.bg-danger::before { background: var(--ah-danger); }
.card.bg-dark::before, .card.bg-secondary::before { background: #64748b; }
.card.bg-primary .text-white-50, .card.bg-success .text-white-50, .card.bg-info .text-white-50, .card.bg-warning .text-white-50, .card.bg-danger .text-white-50,
.card.bg-primary .opacity-75, .card.bg-success .opacity-75, .card.bg-info .opacity-75 { color: var(--ah-muted) !important; opacity: 1 !important; }

.border-left-primary { border-left: 3px solid var(--ah-accent) !important; }
.border-left-success { border-left: 3px solid var(--ah-success) !important; }
.border-left-info { border-left: 3px solid var(--ah-info) !important; }
.border-left-warning { border-left: 3px solid #f5a524 !important; }
.border-left-danger { border-left: 3px solid var(--ah-danger) !important; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --bs-btn-padding-x: 0.85rem;
  --bs-btn-padding-y: 0.45rem;
  --bs-btn-font-size: 0.835rem;
  --bs-btn-font-weight: 550;
  --bs-btn-border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  letter-spacing: -0.005em;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--ah-accent-ring) !important; }
.btn svg { width: 15px; height: 15px; }
.btn i.me-1, .btn i.me-2, .btn svg.me-1, .btn svg.me-2 { margin-right: 0 !important; }
.btn-sm { --bs-btn-padding-x: 0.6rem; --bs-btn-padding-y: 0.28rem; --bs-btn-font-size: 0.78rem; --bs-btn-border-radius: 7px; gap: 0.3rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { --bs-btn-padding-x: 1.15rem; --bs-btn-padding-y: 0.65rem; --bs-btn-font-size: 0.92rem; --bs-btn-border-radius: 10px; }
.btn-block, .w-100.btn { width: 100%; }

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--ah-accent);
  --bs-btn-border-color: var(--ah-accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--ah-accent-hover);
  --bs-btn-hover-border-color: var(--ah-accent-hover);
  --bs-btn-active-bg: var(--ah-accent-hover);
  --bs-btn-active-border-color: var(--ah-accent-hover);
  --bs-btn-disabled-bg: var(--ah-accent);
  --bs-btn-disabled-border-color: var(--ah-accent);
  box-shadow: 0 1px 2px rgba(74, 72, 221, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-secondary, .btn-light, .btn-outline-secondary, .btn-outline-dark, .btn-outline-light, .btn-default, .btn-white {
  --bs-btn-color: var(--ah-text);
  --bs-btn-bg: var(--ah-surface);
  --bs-btn-border-color: var(--ah-border-strong);
  --bs-btn-hover-color: var(--ah-text);
  --bs-btn-hover-bg: var(--ah-surface-2);
  --bs-btn-hover-border-color: #c4cad4;
  --bs-btn-active-color: var(--ah-text);
  --bs-btn-active-bg: #f0f2f5;
  --bs-btn-active-border-color: #c4cad4;
  box-shadow: var(--ah-shadow-xs);
}
.btn-outline-primary {
  --bs-btn-color: var(--ah-accent);
  --bs-btn-bg: var(--ah-surface);
  --bs-btn-border-color: #cfd0fb;
  --bs-btn-hover-color: var(--ah-accent-hover);
  --bs-btn-hover-bg: var(--ah-accent-soft);
  --bs-btn-hover-border-color: #b9bbf8;
  --bs-btn-active-color: var(--ah-accent-hover);
  --bs-btn-active-bg: #e3e5ff;
  --bs-btn-active-border-color: #b9bbf8;
}
.btn-success {
  --bs-btn-color: #fff; --bs-btn-bg: var(--ah-success); --bs-btn-border-color: var(--ah-success);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #0e8a44; --bs-btn-hover-border-color: #0e8a44;
  --bs-btn-active-bg: #0e8a44; --bs-btn-active-border-color: #0e8a44;
}
.btn-danger {
  --bs-btn-color: #fff; --bs-btn-bg: var(--ah-danger); --bs-btn-border-color: var(--ah-danger);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #c22b3a; --bs-btn-hover-border-color: #c22b3a;
  --bs-btn-active-bg: #c22b3a; --bs-btn-active-border-color: #c22b3a;
}
.btn-warning {
  --bs-btn-color: #5c3b00; --bs-btn-bg: #fbd38d; --bs-btn-border-color: #f6c46a;
  --bs-btn-hover-color: #5c3b00; --bs-btn-hover-bg: #f6c46a; --bs-btn-hover-border-color: #f0b545;
}
.btn-info {
  --bs-btn-color: #fff; --bs-btn-bg: var(--ah-info); --bs-btn-border-color: var(--ah-info);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #0a72b8; --bs-btn-hover-border-color: #0a72b8;
}
.btn-dark {
  --bs-btn-color: #fff; --bs-btn-bg: #111827; --bs-btn-border-color: #111827;
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #1f2937; --bs-btn-hover-border-color: #1f2937;
}
.btn-outline-success { --bs-btn-color: var(--ah-success); --bs-btn-bg: var(--ah-surface); --bs-btn-border-color: #b9e6cb; --bs-btn-hover-color: var(--ah-success); --bs-btn-hover-bg: var(--ah-success-soft); --bs-btn-hover-border-color: #9fdcb7; }
.btn-outline-danger { --bs-btn-color: var(--ah-danger); --bs-btn-bg: var(--ah-surface); --bs-btn-border-color: #f5c2c8; --bs-btn-hover-color: var(--ah-danger); --bs-btn-hover-bg: var(--ah-danger-soft); --bs-btn-hover-border-color: #f0a8b0; }
.btn-outline-warning { --bs-btn-color: var(--ah-warning); --bs-btn-bg: var(--ah-surface); --bs-btn-border-color: #f3dcaa; --bs-btn-hover-color: var(--ah-warning); --bs-btn-hover-bg: var(--ah-warning-soft); --bs-btn-hover-border-color: #eccb84; }
.btn-outline-info { --bs-btn-color: var(--ah-info); --bs-btn-bg: var(--ah-surface); --bs-btn-border-color: #b8dcf4; --bs-btn-hover-color: var(--ah-info); --bs-btn-hover-bg: var(--ah-info-soft); --bs-btn-hover-border-color: #98ccef; }
.btn-link { --bs-btn-color: var(--ah-accent); --bs-btn-hover-color: var(--ah-accent-hover); text-decoration: none; box-shadow: none; }
.btn-group > .btn { box-shadow: none; }
.btn-group { box-shadow: var(--ah-shadow-xs); border-radius: 8px; }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-label, label.form-label, .col-form-label {
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--ah-text-2);
  margin-bottom: 0.35rem;
}
.form-control, .form-select, .input-group-text {
  font-size: 0.85rem;
  border-color: var(--ah-border-strong);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--ah-text);
  background-color: var(--ah-surface);
  box-shadow: var(--ah-shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control-sm, .form-select-sm { font-size: 0.8rem; padding: 0.32rem 0.6rem; border-radius: 7px; }
.form-select { padding-right: 2.25rem; }
.form-control::placeholder { color: #a3abba; }
.form-control:hover, .form-select:hover { border-color: #c4cad4; }
.form-control:focus, .form-select:focus {
  border-color: var(--ah-accent);
  box-shadow: 0 0 0 3px var(--ah-accent-ring);
  outline: 0;
}
.form-control:disabled, .form-control[readonly] { background-color: var(--ah-surface-2); color: var(--ah-text-2); }
.form-control.is-invalid { border-color: var(--ah-danger); }
.input-group-text { background: var(--ah-surface-2); color: var(--ah-muted); box-shadow: none; }
.input-group > .form-control, .input-group > .form-select { box-shadow: none; }
.input-group { box-shadow: var(--ah-shadow-xs); border-radius: 8px; }
.form-text { color: var(--ah-muted); font-size: 0.76rem; }
.invalid-feedback { font-size: 0.76rem; }
.form-check-input { border-color: var(--ah-border-strong); }
.form-check-input:checked { background-color: var(--ah-accent); border-color: var(--ah-accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--ah-accent-ring); border-color: var(--ah-accent); }
.form-switch .form-check-input { width: 2.1em; }
textarea.form-control { min-height: 84px; }

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: #f8f9fc;
  --bs-table-striped-bg: #fafbfc;
  --bs-table-border-color: var(--ah-border);
  margin-bottom: 0;
  color: var(--ah-text);
  font-size: 0.83rem;
}
.table > thead > tr > th, .table > thead th, .table th {
  background: var(--ah-surface-2);
  color: var(--ah-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--ah-border);
  padding: 0.7rem 1rem;
  white-space: nowrap;
  vertical-align: middle;
}
.table > :not(caption) > * > * { padding: 0.8rem 1rem; border-bottom-color: var(--ah-border); }
.table td { vertical-align: middle; }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-hover > tbody > tr { transition: background-color 0.1s; }
.table thead.table-light th, .table thead.table-dark th, .table thead.thead-light th, .table thead.thead-dark th, .table .table-dark th {
  background: var(--ah-surface-2) !important;
  color: var(--ah-muted) !important;
  border-color: var(--ah-border) !important;
}
.table-bordered > :not(caption) > * > * { border-color: var(--ah-border); }
.table-responsive { border-radius: inherit; }
.card > .table-responsive:first-child > .table thead th:first-child,
.card-body.p-0 > .table-responsive > .table thead th:first-child { border-top-left-radius: calc(var(--ah-radius-lg) - 1px); }
.card > .table-responsive:first-child > .table thead th:last-child,
.card-body.p-0 > .table-responsive > .table thead th:last-child { border-top-right-radius: calc(var(--ah-radius-lg) - 1px); }
.fixed-layout-table { table-layout: fixed; }

/* ==========================================================================
   Badges, alerts, misc
   ========================================================================== */

.badge {
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.01em;
  padding: 0.3em 0.6em;
  border-radius: 6px;
  line-height: 1.3;
}
.badge.rounded-pill { border-radius: 999px; padding: 0.3em 0.7em; }
.badge.bg-primary, .badge-primary { background: var(--ah-accent-soft) !important; color: var(--ah-accent) !important; }
.badge.bg-success, .badge-success { background: var(--ah-success-soft) !important; color: var(--ah-success) !important; }
.badge.bg-danger, .badge-danger { background: var(--ah-danger-soft) !important; color: var(--ah-danger) !important; }
.badge.bg-warning, .badge-warning { background: var(--ah-warning-soft) !important; color: var(--ah-warning) !important; }
.badge.bg-info { background: var(--ah-info-soft) !important; color: var(--ah-info) !important; }
.badge.bg-secondary, .badge.bg-light { background: #f0f2f5 !important; color: var(--ah-text-2) !important; }
.badge.bg-dark { background: #1f2430 !important; color: #fff !important; }
.badge.text-dark, .badge.text-light { color: inherit; }

.alert {
  border-radius: var(--ah-radius);
  font-size: 0.84rem;
  border: 1px solid transparent;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-dismissible { padding-right: 3rem; }
.alert-success { background: var(--ah-success-soft); border-color: #c7ebd5; color: #0b6b36; }
.alert-danger, .alert-error { background: var(--ah-danger-soft); border-color: #f7cdd2; color: #a3202d; }
.alert-warning { background: var(--ah-warning-soft); border-color: #f3dfb4; color: #8a5600; }
.alert-info, .alert-primary, .alert-message { background: var(--ah-accent-soft); border-color: #d7d9fd; color: #3c3ab0; }
.alert-secondary, .alert-light { background: var(--ah-surface-2); border-color: var(--ah-border); color: var(--ah-text-2); }

.dropdown-menu {
  --bs-dropdown-link-active-bg: var(--ah-accent-soft);
  --bs-dropdown-link-active-color: var(--ah-accent);
  border: 1px solid var(--ah-border);
  border-radius: 12px;
  box-shadow: var(--ah-shadow-lg);
  padding: 0.35rem;
  font-size: 0.84rem;
  min-width: 12rem;
}
.dropdown-item {
  border-radius: 7px;
  padding: 0.45rem 0.65rem;
  color: var(--ah-text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.dropdown-item svg, .dropdown-item i { width: 15px; height: 15px; color: var(--ah-muted); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--ah-surface-2); color: var(--ah-text); }
.dropdown-item.text-danger:hover { background: var(--ah-danger-soft); }
.dropdown-divider { border-color: var(--ah-border); margin: 0.35rem 0; }
.dropdown-header { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ah-muted); font-weight: 600; }

.nav-tabs { border-bottom: 1px solid var(--ah-border); gap: 0.25rem; }
.nav-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ah-muted);
  font-weight: 550;
  font-size: 0.84rem;
  padding: 0.65rem 0.85rem;
  margin-bottom: -1px;
  border-radius: 0;
  background: transparent;
}
.nav-tabs .nav-link:hover { color: var(--ah-text); border-bottom-color: var(--ah-border-strong); }
.nav-tabs .nav-link.active { color: var(--ah-text); border-bottom-color: var(--ah-accent); background: transparent; }
.nav-pills .nav-link { border-radius: 8px; color: var(--ah-text-2); font-weight: 550; font-size: 0.84rem; }
.nav-pills .nav-link.active { background: var(--ah-accent-soft); color: var(--ah-accent); }

.pagination { gap: 0.25rem; --bs-pagination-font-size: 0.8rem; }
.page-link {
  border-radius: 7px !important;
  border: 1px solid var(--ah-border);
  color: var(--ah-text-2);
  min-width: 32px;
  text-align: center;
  padding: 0.35rem 0.65rem;
}
.page-link:hover { background: var(--ah-surface-2); color: var(--ah-text); border-color: var(--ah-border-strong); }
.page-item.active .page-link { background: var(--ah-accent); border-color: var(--ah-accent); color: #fff; }
.page-item.disabled .page-link { color: #c0c6d0; background: transparent; }

.modal-content { border: 1px solid var(--ah-border); border-radius: 16px; box-shadow: var(--ah-shadow-lg); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--ah-border); padding: 1rem 1.25rem; }
.modal-header.bg-primary, .modal-header.bg-danger, .modal-header.bg-dark, .modal-header.bg-success { background: var(--ah-surface) !important; color: var(--ah-text) !important; }
.modal-header.bg-primary *, .modal-header.bg-danger *, .modal-header.bg-dark *, .modal-header.bg-success * { color: inherit !important; }
.modal-header .btn-close-white { filter: none; }
.modal-title { font-weight: 600; font-size: 1rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--ah-border); background: var(--ah-surface-2); padding: 0.75rem 1.25rem; }
.modal-backdrop.show { opacity: 1; background: rgba(15, 23, 41, 0.35); backdrop-filter: blur(2px); }

.list-group-item { border-color: var(--ah-border); padding: 0.75rem 1rem; }
.list-group-item.active { background: var(--ah-accent-soft); color: var(--ah-accent); border-color: var(--ah-border); }
.list-group-item-action:hover { background: var(--ah-surface-2); }

.progress { background: #eef0f4; border-radius: 999px; height: 8px; }
.progress-bar { background: var(--ah-gradient); border-radius: 999px; }
.progress-bar.bg-success { background: var(--ah-success) !important; }
.progress-bar.bg-warning { background: #f5a524 !important; }
.progress-bar.bg-danger { background: var(--ah-danger) !important; }

.breadcrumb { font-size: 0.8rem; margin-bottom: 0.5rem; }
.breadcrumb-item a { color: var(--ah-muted); }
.breadcrumb-item.active { color: var(--ah-text-2); }

.tooltip-inner { background: #111827; border-radius: 7px; font-size: 0.75rem; padding: 0.35rem 0.6rem; }
.spinner-border { color: var(--ah-accent); }
hr { border-color: var(--ah-border); opacity: 1; }

/* Empty states inside tables and cards */
.ah-content .text-center.py-4.text-muted, .ah-content .text-center.py-5 { color: var(--ah-muted); }
.ah-content .text-center.py-5 > i[data-feather], .ah-content .text-center.py-5 > svg.feather,
.ah-content .text-center.py-5 > .fas, .ah-content .text-center.py-5 > .fa {
  color: #c3c8d4 !important;
}

/* ==========================================================================
   Legacy helper classes still used by templates
   ========================================================================== */

.feather { width: 16px; height: 16px; vertical-align: -0.2em; }
.cursor-pointer { cursor: pointer; }
.section-title { font-size: 0.95rem; font-weight: 600; color: var(--ah-text); margin-bottom: 1rem; }
.chart-container { position: relative; width: 100%; }

.stats-card {
  background: var(--ah-surface);
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--ah-shadow-xs);
}
.stats-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--ah-accent-soft); color: var(--ah-accent); }
.stats-icon.success { background: var(--ah-success-soft); color: var(--ah-success); }
.stats-icon.warning { background: var(--ah-warning-soft); color: var(--ah-warning); }
.stats-icon.danger { background: var(--ah-danger-soft); color: var(--ah-danger); }
.stats-info h3 { margin: 0; font-size: 1.4rem; font-weight: 650; }
.stats-info p { margin: 0; color: var(--ah-muted); font-size: 0.8rem; }

.user_profile_pic { display: flex; align-items: center; gap: 0.75rem; }
.g_field .label { font-size: 0.75rem; color: var(--ah-muted); font-weight: 550; }
.g_field .text { font-size: 0.875rem; color: var(--ah-text); }

.fade-in { animation: ah-fade-in 0.35s ease both; }
.slide-in-left, .slide-in-right { animation: ah-fade-in 0.35s ease both; }
@keyframes ah-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.ajax_indicator { display: none; }
.ajax_indicator.processing { display: inline-block; }

.kanban-container { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; }
.kanban-column { background: var(--ah-surface-2); border: 1px solid var(--ah-border); border-radius: var(--ah-radius-lg); min-width: 280px; padding: 0.75rem; }
.kanban-card { background: var(--ah-surface); border: 1px solid var(--ah-border); border-radius: var(--ah-radius); padding: 0.75rem; margin-bottom: 0.5rem; box-shadow: var(--ah-shadow-xs); }

/* Bootstrap-select */
.bootstrap-select .dropdown-toggle {
  border: 1px solid var(--ah-border-strong) !important;
  background: var(--ah-surface) !important;
  border-radius: 8px !important;
  font-size: 0.85rem;
  color: var(--ah-text) !important;
  box-shadow: var(--ah-shadow-xs);
}
.bootstrap-select .dropdown-toggle:focus { outline: 0 !important; border-color: var(--ah-accent) !important; box-shadow: 0 0 0 3px var(--ah-accent-ring) !important; }

/* Page entrance */
.ah-content > * { animation: ah-fade-in 0.3s ease both; }

/* ==========================================================================
   Dashboard building blocks (shared, usable on any page)
   ========================================================================== */

.ah-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 1199.98px) { .ah-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .ah-kpis { grid-template-columns: 1fr; } }

.ah-kpi {
  background: var(--ah-surface);
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg);
  padding: 1.1rem 1.2rem 1.05rem;
  box-shadow: var(--ah-shadow-xs);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.ah-kpi:hover { box-shadow: var(--ah-shadow-md); }
.ah-kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.ah-kpi-label { font-size: 0.78rem; font-weight: 550; color: var(--ah-text-2); }
.ah-kpi-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--ah-accent-soft); color: var(--ah-accent); }
.ah-kpi-icon svg { width: 16px; height: 16px; }
.ah-kpi-icon.green { background: var(--ah-success-soft); color: var(--ah-success); }
.ah-kpi-icon.amber { background: var(--ah-warning-soft); color: var(--ah-warning); }
.ah-kpi-icon.blue { background: var(--ah-info-soft); color: var(--ah-info); }
.ah-kpi-icon.pink { background: #fdeefb; color: #c026d3; }
.ah-kpi-value { font-size: 1.75rem; font-weight: 650; letter-spacing: -0.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ah-kpi-sub { margin-top: 0.4rem; font-size: 0.76rem; color: var(--ah-muted); display: flex; align-items: center; gap: 0.35rem; }
.ah-kpi.featured { background: #0f1120; border-color: #0f1120; color: #fff; }
.ah-kpi.featured::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(90% 120% at 100% 0%, rgba(155, 92, 255, 0.45) 0%, transparent 55%),
              radial-gradient(70% 90% at 0% 100%, rgba(91, 91, 240, 0.35) 0%, transparent 60%);
  pointer-events: none;
}
.ah-kpi.featured > * { position: relative; z-index: 1; }
.ah-kpi.featured .ah-kpi-label { color: rgba(255, 255, 255, 0.72); }
.ah-kpi.featured .ah-kpi-sub { color: rgba(255, 255, 255, 0.55); }
.ah-kpi.featured .ah-kpi-icon { background: rgba(255, 255, 255, 0.1); color: #fff; }

.ah-delta { display: inline-flex; align-items: center; gap: 0.15rem; font-weight: 600; font-size: 0.72rem; padding: 0.05rem 0.4rem; border-radius: 5px; }
.ah-delta.up { color: var(--ah-success); background: var(--ah-success-soft); }
.ah-delta.down { color: var(--ah-danger); background: var(--ah-danger-soft); }

.ah-panel { background: var(--ah-surface); border: 1px solid var(--ah-border); border-radius: var(--ah-radius-lg); box-shadow: var(--ah-shadow-xs); height: 100%; display: flex; flex-direction: column; }
.ah-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem 0.25rem; }
.ah-panel-title { font-size: 0.92rem; font-weight: 600; margin: 0; letter-spacing: -0.015em; }
.ah-panel-sub { font-size: 0.76rem; color: var(--ah-muted); margin: 0.1rem 0 0; }
.ah-panel-body { padding: 1rem 1.25rem 1.25rem; flex: 1; }

.ah-segmented { display: inline-flex; padding: 3px; background: #eceef2; border-radius: 9px; gap: 2px; }
.ah-segmented a {
  padding: 0.3rem 0.7rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--ah-text-2);
}
.ah-segmented a:hover { color: var(--ah-text); }
.ah-segmented a.active { background: var(--ah-surface); color: var(--ah-text); box-shadow: var(--ah-shadow-sm); }

.ah-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--ah-surface);
  border: 1px solid var(--ah-border);
  border-radius: var(--ah-radius-lg);
  box-shadow: var(--ah-shadow-xs);
  margin-bottom: 1rem;
}
.ah-strip > div { padding: 0.9rem 1.2rem; border-left: 1px solid var(--ah-border); }
.ah-strip > div:first-child { border-left: 0; }
.ah-strip-label { font-size: 0.72rem; color: var(--ah-muted); font-weight: 550; display: flex; align-items: center; gap: 0.4rem; }
.ah-strip-value { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; margin-top: 0.15rem; font-variant-numeric: tabular-nums; }
@media (max-width: 991.98px) { .ah-strip { grid-template-columns: repeat(2, 1fr); } .ah-strip > div { border-left: 0; border-top: 1px solid var(--ah-border); } }

.ah-rank-list { list-style: none; margin: 0; padding: 0; }
.ah-rank-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px dashed var(--ah-border); }
.ah-rank-item:last-child { border-bottom: 0; }
.ah-rank-n { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 0.7rem; font-weight: 650; background: #f0f2f5; color: var(--ah-text-2); flex-shrink: 0; }
.ah-rank-item:nth-child(1) .ah-rank-n { background: var(--ah-gradient); color: #fff; }
.ah-rank-name { font-weight: 550; font-size: 0.84rem; line-height: 1.25; }
.ah-rank-meta { font-size: 0.72rem; color: var(--ah-muted); }
.ah-rank-val { margin-left: auto; font-weight: 650; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.ah-rank-bar { height: 4px; border-radius: 4px; background: #eef0f4; margin-top: 0.35rem; overflow: hidden; }
.ah-rank-bar span { display: block; height: 100%; background: var(--ah-gradient); border-radius: 4px; }

.ah-empty { text-align: center; padding: 2.25rem 1rem; color: var(--ah-muted); }
.ah-empty-icon { width: 44px; height: 44px; margin: 0 auto 0.75rem; border-radius: 12px; display: grid; place-items: center; background: var(--ah-surface-2); border: 1px solid var(--ah-border); color: #a0a8b8; }
.ah-empty-icon svg { width: 20px; height: 20px; }
.ah-empty-title { color: var(--ah-text); font-weight: 600; font-size: 0.86rem; margin-bottom: 0.15rem; }
.ah-empty p { font-size: 0.78rem; margin: 0; }

.ah-id-menu { position: fixed; z-index: 2000; min-width: 190px; margin: 0; }
.ah-id-menu .dropdown-item { font-size: 0.82rem; }
.ah-id-menu .dropdown-item i { width: 14px; color: var(--ah-muted); }
.fa-ellipsis-h.copy-btn, .fa-copy, .external-link { cursor: pointer; }
.ah-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); z-index: 2100; background: #111827; color: #fff;
  font-size: 0.8rem; padding: 0.55rem 0.9rem; border-radius: 8px; box-shadow: var(--ah-shadow-xs); opacity: 0; pointer-events: none;
  transition: opacity .15s ease, transform .15s ease; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ah-toast.show { opacity: 1; transform: translate(-50%, 0); }

th.mask-toggle { cursor: pointer; user-select: none; white-space: nowrap; }
th.mask-toggle:hover, th.mask-toggle.revealed { color: var(--ah-accent) !important; }
.masked.revealed { color: var(--ah-text) !important; letter-spacing: normal !important; white-space: nowrap; }

.ah-quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.ah-quick a {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.75rem;
  border: 1px solid var(--ah-border);
  border-radius: 11px;
  color: var(--ah-text);
  background: var(--ah-surface);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.ah-quick a:hover { border-color: #cfd0fb; box-shadow: 0 0 0 3px var(--ah-accent-ring); }
.ah-quick-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--ah-accent-soft); color: var(--ah-accent); flex-shrink: 0; }
.ah-quick-icon svg { width: 16px; height: 16px; }
.ah-quick strong { display: block; font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.ah-quick small { font-size: 0.72rem; color: var(--ah-muted); }

.ah-legend { display: flex; gap: 1rem; font-size: 0.76rem; color: var(--ah-text-2); }
.ah-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.ah-legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }

/* Settings: staff + roles */
.ah-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
@media (max-width: 767.98px) { .ah-form-grid { grid-template-columns: 1fr; } }
.ah-form-grid .span-2 { grid-column: 1 / -1; }
.ah-field label, .ah-field .form-label, .ah-field .form-control-label { font-size: 0.78rem; font-weight: 600; color: var(--ah-text-2); margin-bottom: 0.35rem; }
.ah-field .form-text { font-size: 0.74rem; color: var(--ah-muted); }
.ah-toggle-rows { display: flex; flex-direction: column; gap: 0.65rem; }
.ah-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; border: 1px solid var(--ah-border); border-radius: 12px; background: var(--ah-surface-2); }
.ah-toggle-row strong { display: block; font-size: 0.84rem; }
.ah-toggle-row span { font-size: 0.74rem; color: var(--ah-muted); }
.ah-switch { position: relative; display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; user-select: none; }
.ah-switch input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; margin: 0; background: #e4e7ec; border-radius: 999px; position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s; }
.ah-switch input::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; box-shadow: 0 1px 2px rgba(15,23,42,.18); transition: transform .15s; }
.ah-switch input:checked { background: var(--ah-accent); }
.ah-switch input:checked::after { transform: translateX(16px); }
.ah-switch input:focus-visible { outline: 2px solid var(--ah-accent); outline-offset: 2px; }
.ah-switch.compact { flex-direction: column; gap: 0.3rem; min-width: 58px; }
.ah-switch.compact .ah-switch-label { font-size: 0.7rem; font-weight: 600; color: var(--ah-muted); }
.ah-switch.compact input:checked + .ah-switch-label { color: var(--ah-accent); }
.ah-presets { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ah-preset { border: 1px solid var(--ah-border); background: var(--ah-surface); border-radius: 10px; padding: 0.55rem 0.85rem; font-size: 0.78rem; font-weight: 600; color: var(--ah-text-2); cursor: pointer; }
.ah-preset:hover, .ah-preset.active { border-color: var(--ah-accent); color: var(--ah-accent); background: var(--ah-accent-soft); }
.ah-perm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }
@media (max-width: 1199.98px) { .ah-perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .ah-perm-grid { grid-template-columns: 1fr; } }
.ah-perm-card { border: 1px solid var(--ah-border); border-radius: 14px; padding: 1rem; background: var(--ah-surface); min-height: 100%; }
.ah-perm-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.85rem; }
.ah-perm-card h3 { font-size: 0.9rem; font-weight: 650; margin: 0; }
.ah-perm-card p { font-size: 0.74rem; color: var(--ah-muted); margin: 0.15rem 0 0; }
.ah-perm-link { font-size: 0.72rem; font-weight: 600; color: var(--ah-accent); background: none; border: 0; padding: 0; cursor: pointer; }
.ah-perm-acts { display: flex; gap: 0.35rem; }
.ah-perm-extra { margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px dashed var(--ah-border); display: flex; flex-direction: column; gap: 0.45rem; }
.ah-perm-extra .ah-switch { font-size: 0.78rem; color: var(--ah-text-2); }
.ah-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
@media (max-width: 767.98px) { .ah-menu-grid { grid-template-columns: 1fr 1fr; } }
.ah-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.8rem 0.9rem; border: 1px solid var(--ah-border); border-radius: 12px; background: var(--ah-surface); }
.ah-menu-item strong { display: block; font-size: 0.82rem; }
.ah-menu-item small { display: block; color: var(--ah-muted); font-size: 0.72rem; }
.ah-sticky-save { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.25rem 0 1.5rem; margin-top: 0.5rem; }
.ah-role-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--ah-border); }
.ah-role-card:last-child { border-bottom: 0; }
.ah-role-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--ah-accent-soft); color: var(--ah-accent); flex-shrink: 0; }
.ah-role-icon svg { width: 18px; height: 18px; }
.ah-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.ah-chip { font-size: 0.68rem; font-weight: 600; padding: 0.12rem 0.45rem; border-radius: 999px; background: #f0f2f5; color: var(--ah-text-2); }
.ah-chip.on { background: var(--ah-success-soft); color: var(--ah-success); }
.ah-avatar-upload { display: flex; align-items: center; gap: 1rem; }
.ah-avatar-upload .ah-avatar { width: 64px; height: 64px; font-size: 1.1rem; }
.ah-pw { position: relative; }
.ah-pw .form-control { padding-right: 6.5rem; }
.ah-pw .btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
