/* ================================================================
   Hair Academy — Editorial Design System
   ================================================================ */

/* ── Theme Tokens ─────────────────────────────────────────────── */

:root {
  /* Deep Cinematic Colors */
  --ha-bg-body: #08080a;
  --ha-bg-surface: #121215;
  --ha-bg-surface-hover: #18181c;
  --ha-bg-surface-raised: rgba(24, 24, 28, 0.65);
  --ha-bg-sidebar: #040405;
  --ha-bg-input: #0e0e11;

  /* Subtle Architectural Borders */
  --ha-border: rgba(255, 255, 255, 0.08);
  --ha-border-subtle: rgba(255, 255, 255, 0.03);
  --ha-border-glow: rgba(226, 194, 144, 0.4);

  /* Typography */
  --ha-text-primary: #ffffff;
  --ha-text-secondary: #a1a1aa;
  --ha-text-muted: #71717a;

  /* Editorial Champagne Accent */
  --ha-accent: #E2C290;
  --ha-accent-hover: #f3dcae;
  --ha-accent-subtle: rgba(226, 194, 144, 0.08);

  /* Status */
  --ha-success: #86efac;
  --ha-warning: #fde047;
  --ha-danger: #fca5a5;
  --ha-danger-hover: rgba(252, 165, 165, 0.15);
  --ha-info: #93c5fd;

  /* Geometry */
  --ha-radius-sm: 4px;
  --ha-radius-md: 12px;
  --ha-radius-lg: 24px;
  --ha-radius-xl: 32px;

  /* Shadows */
  --ha-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --ha-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --ha-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --ha-shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
  --ha-shadow-glow: 0 0 40px rgba(226, 194, 144, 0.15);

  /* Typography Families */
  --ha-font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --ha-font-heading: 'Playfair Display', Georgia, serif;

  /* Transitions */
  --ha-transition-fast: 150ms cubic-bezier(.4, 0, .2, 1);
  --ha-transition-base: 300ms cubic-bezier(0.16, 1, 0.3, 1);
  --ha-transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --ha-sidebar-w: 300px;
  --ha-sidebar-w-collapsed: 68px;
  --ha-header-h: 72px;
}


/* ── Base ─────────────────────────────────────────────────────── */

html {
  scrollbar-gutter: stable;
  overflow-x: hidden;
}

html, body {
  height: 100%;
}

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

body {
  margin: 0;
  font-family: var(--ha-font);
  line-height: 1.5;
  color: var(--ha-text-primary);
  background: var(--ha-bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:focus-visible {
  outline: 2px solid var(--ha-accent);
  outline-offset: 2px;
}

h1, h2, h3 {
  font-family: var(--ha-font-heading);
  font-weight: 400;
}

h1 {
  font-size: 3.5rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

h1 i {
  font-style: italic;
  color: var(--ha-accent);
}

h2 {
  font-size: 2rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.5rem;
}

a {
  color: var(--ha-accent);
  transition: color var(--ha-transition-fast);
}

a:hover {
  color: var(--ha-accent-hover);
  text-decoration: underline;
}

.ti {
  stroke-width: 1.2;
}


/* ── Scrollbar ────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ha-accent);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}


/* ── Ambient Background FX ───────────────────────────────────── */

.ha-bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background-image: linear-gradient(180deg, #0c0c0f 0%, #040405 100%);
}

.ha-bg-fx__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.8;
  animation: ha-float 25s infinite ease-in-out alternate;
}

.ha-bg-fx__blob--1 {
  top: -20%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(226, 194, 144, 0.08), transparent 60%);
}

.ha-bg-fx__blob--2 {
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(226, 194, 144, 0.06), transparent 60%);
  animation-delay: -12.5s;
  animation-direction: alternate-reverse;
}

.ha-bg-fx__blob--3 {
  top: 30%;
  left: 50%;
  width: 40vw;
  height: 40vw;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.02), transparent 50%);
  animation: ha-pulse 15s infinite ease-in-out alternate;
}

.ha-bg-fx::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100px 100px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 15%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 50%, black 15%, transparent 75%);
}

@keyframes ha-float {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(8%, 12%) scale(1.05); }
  66%  { transform: translate(-5%, 8%) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes ha-pulse {
  0%   { transform: translate(-50%, -10%) scale(0.9); opacity: 0.5; }
  100% { transform: translate(-50%, 10%) scale(1.1); opacity: 1; }
}


/* ── Animations ───────────────────────────────────────────────── */

@keyframes ha-fade-in {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: blur(0); }
}

@keyframes ha-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ha-scale-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes ha-slide-down {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ha-animate-in {
  animation: ha-slide-up 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ha-animate-fade {
  animation: ha-fade-in var(--ha-transition-base) both;
}

.ha-animate-scale {
  animation: ha-scale-in var(--ha-transition-base) both;
}

.ha-stagger > * {
  animation: ha-slide-up 800ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ha-stagger > *:nth-child(1) { animation-delay: 100ms; }
.ha-stagger > *:nth-child(2) { animation-delay: 200ms; }
.ha-stagger > *:nth-child(3) { animation-delay: 300ms; }
.ha-stagger > *:nth-child(4) { animation-delay: 400ms; }
.ha-stagger > *:nth-child(5) { animation-delay: 500ms; }
.ha-stagger > *:nth-child(6) { animation-delay: 600ms; }
.ha-stagger > *:nth-child(7) { animation-delay: 700ms; }
.ha-stagger > *:nth-child(8) { animation-delay: 800ms; }
.ha-stagger > *:nth-child(9) { animation-delay: 900ms; }
.ha-stagger > *:nth-child(10) { animation-delay: 1000ms; }
.ha-stagger > *:nth-child(n+11) { animation-delay: 1100ms; }


/* ── Tooltip ──────────────────────────────────────────────────── */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(.92);
  padding: 6px 12px;
  background: var(--ha-bg-surface-raised);
  color: var(--ha-text-primary);
  border: 1px solid var(--ha-border);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  border-radius: 8px;
  box-shadow: var(--ha-shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--ha-transition-fast), transform var(--ha-transition-fast);
  z-index: 9999;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

[data-tooltip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 8px);
}

[data-tooltip-pos="left"]::after {
  bottom: auto;
  top: 50%;
  left: auto;
  right: calc(100% + 8px);
  transform: translateY(-50%) scale(.92);
}

[data-tooltip-pos="left"]:hover::after {
  transform: translateY(-50%) scale(1);
}

[data-tooltip-pos="right"]::after {
  bottom: auto;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%) scale(.92);
}

[data-tooltip-pos="right"]:hover::after {
  transform: translateY(-50%) scale(1);
}

[data-bs-theme="light"] [data-tooltip]::after {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}


/* ── Spinner (iOS-style 12-blade) ─────────────────────────────── */

@keyframes ha-spinner-rotate {
  to { transform: rotate(360deg); }
}

.ha-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  position: relative;
  animation: ha-spinner-rotate .8s steps(12) infinite;
}

.ha-spinner::before,
.ha-spinner::after,
.ha-spinner i {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 5px;
  margin-left: -1px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center 10px;
}

.ha-spinner i:nth-child(1) { transform: rotate(30deg); opacity: .08; }
.ha-spinner i:nth-child(2) { transform: rotate(60deg); opacity: .17; }
.ha-spinner i:nth-child(3) { transform: rotate(90deg); opacity: .25; }
.ha-spinner i:nth-child(4) { transform: rotate(120deg); opacity: .33; }
.ha-spinner i:nth-child(5) { transform: rotate(150deg); opacity: .42; }
.ha-spinner i:nth-child(6) { transform: rotate(180deg); opacity: .5; }
.ha-spinner i:nth-child(7) { transform: rotate(210deg); opacity: .58; }
.ha-spinner i:nth-child(8) { transform: rotate(240deg); opacity: .67; }
.ha-spinner i:nth-child(9) { transform: rotate(270deg); opacity: .75; }
.ha-spinner i:nth-child(10) { transform: rotate(300deg); opacity: .83; }
.ha-spinner::before { transform: rotate(330deg); opacity: .92; }
.ha-spinner::after { opacity: 1; }

.ha-spinner--white { color: #fff; }
.ha-spinner--dark { color: var(--ha-text-primary); }
.ha-spinner--sm { width: 16px; height: 16px; }
.ha-spinner--sm::before,
.ha-spinner--sm::after,
.ha-spinner--sm i {
  height: 4px;
  transform-origin: center 8px;
}


/* ── Button with spinner ──────────────────────────────────────── */

.ha-btn-loading {
  position: relative;
  pointer-events: none;
}

.ha-btn-loading > *:not(.ha-spinner) {
  visibility: hidden;
}

.ha-btn-loading > .ha-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  visibility: visible;
}


/* ── Card — Glass Morphism ───────────────────────────────────── */

.ha-card {
  background: linear-gradient(145deg, rgba(20, 20, 25, 0.6) 0%, rgba(10, 10, 12, 0.8) 100%);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-lg);
  padding: 2.5rem;
  transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--ha-shadow-glass);
}

.ha-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--ha-shadow-glow);
}

.ha-card--clickable {
  cursor: pointer;
}

.ha-card--clickable:hover {
  border-color: var(--ha-border-glow);
  box-shadow: var(--ha-shadow-glow);
}

.ha-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ha-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ha-text-primary);
  margin: 0;
}

.ha-card__subtitle {
  font-size: .8125rem;
  color: var(--ha-text-secondary);
  margin: 0;
}

.ha-card__body {
  /* container for card content */
}

.ha-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--ha-border-subtle);
}


/* ── Course Card — Portrait (3:4 aspect) ─────────────────────── */

.ha-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 32px;
}

.ha-course-card {
  position: relative;
  border-radius: var(--ha-radius-lg);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--ha-border);
  transition: all 500ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--ha-shadow-glass);
}

.ha-course-card:hover {
  border-color: var(--ha-border-glow);
  box-shadow: var(--ha-shadow-glow);
  transform: translateY(-8px);
}

.ha-course-card__cover {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 700ms ease;
}

.ha-course-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ha-course-card:hover .ha-course-card__cover {
  transform: scale(1.08);
}

.ha-course-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}

/* Play button overlay */
.ha-course-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.75rem;
  z-index: 2;
  opacity: 0;
  transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ha-course-card:hover .ha-course-card__play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  background: var(--ha-accent);
  color: #000;
  border-color: var(--ha-accent);
}

.ha-course-card__bookmark {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .45);
  border-radius: var(--ha-radius-sm);
  color: #fff;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background var(--ha-transition-fast);
  z-index: 3;
}

.ha-course-card__bookmark:hover {
  background: rgba(0, 0, 0, .65);
}

.ha-course-card__bookmark.active {
  color: var(--ha-warning);
}

.ha-course-card__medal {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
}

.ha-course-card__medal img {
  width: 36px;
  height: 38px;
}

.ha-course-card__body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 24px;
  z-index: 2;
}

.ha-course-card__title {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ha-text-primary);
  margin: 0 0 8px;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ha-course-card__meta {
  font-family: var(--ha-font);
  font-size: 0.8125rem;
  color: var(--ha-accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ha-course-card__meta i {
  font-size: .875rem;
  margin-right: 2px;
}

.ha-course-card__progress {
  margin-top: 10px;
}

.ha-course-card__progress-label {
  font-size: .6875rem;
  color: var(--ha-text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}


/* ── Course Card — Compact ───────────────────────────────────── */

.ha-course-card--compact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--ha-radius-md);
  border: 1px solid var(--ha-border-subtle);
  transition: all 300ms ease;
  aspect-ratio: auto;
}

.ha-course-card--compact:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--ha-border);
  transform: translateX(4px);
}

.ha-course-card--compact .ha-course-card__cover,
.ha-course-card--compact .ha-course-card__img {
  position: relative;
  width: 120px;
  height: 80px;
  border-radius: var(--ha-radius-sm);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  inset: auto;
}

.ha-course-card--compact .ha-course-card__body {
  position: relative;
  padding: 0;
  flex: 1;
  min-width: 0;
}

.ha-course-card--compact .ha-course-card__content {
  flex: 1;
  min-width: 0;
}

.ha-course-card--compact h3 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.ha-course-card--compact .ha-course-card__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ha-course-card--compact::after {
  display: none;
}

.ha-course-card__medal-sm {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 26px;
  z-index: 3;
}


/* ── Stat Grid — Editorial Joined Cells ──────────────────────── */

.ha-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--ha-border-subtle);
  border: 1px solid var(--ha-border-subtle);
  border-radius: var(--ha-radius-lg);
  overflow: hidden;
}

@media (max-width: 991px) {
  .ha-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575px) {
  .ha-stat-grid { grid-template-columns: 1fr; }
}

.ha-stat {
  background: var(--ha-bg-body);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  position: relative;
}

.ha-stat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(226, 194, 144, 0.03), transparent 70%);
  opacity: 0;
  transition: opacity 300ms ease;
}

.ha-stat:hover::before {
  opacity: 1;
}

.ha-stat__value {
  font-family: var(--ha-font-heading);
  font-size: 3.5rem;
  font-weight: 400;
  line-height: 1;
  color: var(--ha-text-primary);
  font-style: italic;
}

.ha-stat__label {
  font-family: var(--ha-font);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ha-text-muted);
}

.ha-stat__content {
  min-width: 0;
}

.ha-stat-grid .ha-card {
  background: var(--ha-bg-body);
  border: none;
  box-shadow: none;
  padding: 32px;
  border-radius: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.ha-stat-grid .ha-card:hover {
  box-shadow: none;
}


/* ── User Card ────────────────────────────────────────────────── */

.ha-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-md);
  transition: border-color var(--ha-transition-fast),
              background var(--ha-transition-fast);
}

.ha-user-card:hover {
  border-color: var(--ha-border);
  background: rgba(255, 255, 255, 0.05);
}

.ha-user-card--clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.ha-user-card--clickable:hover {
  text-decoration: none;
  color: inherit;
  border-color: var(--ha-border-glow);
}

.ha-user-card__info {
  min-width: 0;
  flex: 1;
}

.ha-user-card__name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--ha-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ha-user-card__detail {
  font-size: .75rem;
  color: var(--ha-text-muted);
}

.ha-user-card__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.ha-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}


/* ── Badge — Pill with Border ────────────────────────────────── */

.ha-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 1px solid var(--ha-border);
  border-radius: 999px;
  background: transparent;
}

.ha-badge--accent  { background: rgba(226, 194, 144, 0.1); color: var(--ha-accent); border-color: var(--ha-border-glow); }
.ha-badge--success { color: var(--ha-success); border-color: rgba(134, 239, 172, 0.3); background: rgba(134, 239, 172, 0.08); }
.ha-badge--warning { color: var(--ha-warning); border-color: rgba(253, 224, 71, 0.3); background: rgba(253, 224, 71, 0.08); }
.ha-badge--danger  { color: var(--ha-danger); border-color: rgba(252, 165, 165, 0.3); background: rgba(252, 165, 165, 0.08); }
.ha-badge--info    { color: var(--ha-info); border-color: rgba(147, 197, 253, 0.3); background: rgba(147, 197, 253, 0.08); }
.ha-badge--muted   { color: var(--ha-text-secondary); border-color: rgba(255, 255, 255, 0.1); }


/* ── Dropdown (shadcn-like) ───────────────────────────────────── */

.ha-dropdown {
  position: relative;
  display: inline-block;
}

.ha-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  padding: 4px;
  background: var(--ha-bg-surface-raised);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-md);
  box-shadow: var(--ha-shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 1000;
  opacity: 0;
  transform: scale(.96) translateY(-4px);
  transform-origin: top left;
  pointer-events: none;
  transition: opacity var(--ha-transition-fast),
              transform var(--ha-transition-fast);
}

.ha-dropdown.open .ha-dropdown-menu,
.ha-dropdown-menu.show {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.ha-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: .875rem;
  color: var(--ha-text-primary);
  text-decoration: none;
  border-radius: var(--ha-radius-sm);
  transition: background var(--ha-transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.ha-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ha-text-primary);
  text-decoration: none;
}

.ha-dropdown-item--danger { color: var(--ha-danger); }
.ha-dropdown-item--danger:hover { background: var(--ha-danger-hover); }

.ha-dropdown-divider {
  height: 1px;
  margin: 4px 0;
  background: var(--ha-border-subtle);
}


/* ── Modal Scrollbar ──────────────────────────────────────────── */

.modal-content {
  overflow: hidden;
  border-radius: var(--ha-radius-lg) !important;
}

.modal-body {
  overflow-y: auto;
  max-height: 70vh;
  scrollbar-gutter: stable;
}

.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}


/* ── Searchable Select ────────────────────────────────────────── */

.ha-search-select {
  position: relative;
}

.ha-search-select__input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 32px;
  background: var(--ha-bg-input);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-sm);
  color: var(--ha-text-primary);
  font-size: .875rem;
  outline: none;
  transition: border-color var(--ha-transition-fast);
}

.ha-search-select__input:focus {
  border-color: var(--ha-accent);
}

.ha-search-select__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  background: var(--ha-bg-surface-raised);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-md);
  box-shadow: var(--ha-shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 1000;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--ha-transition-fast),
              transform var(--ha-transition-fast);
  scrollbar-gutter: stable;
}

.ha-search-select.open .ha-search-select__dropdown {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ha-search-select__option {
  padding: 8px 10px;
  font-size: .875rem;
  color: var(--ha-text-primary);
  border-radius: var(--ha-radius-sm);
  cursor: pointer;
  transition: background var(--ha-transition-fast);
}

.ha-search-select__option:hover,
.ha-search-select__option.active {
  background: rgba(255, 255, 255, 0.05);
}

.ha-search-select__option.selected {
  color: var(--ha-accent);
  font-weight: 600;
}

.ha-search-select__empty {
  padding: 12px 10px;
  font-size: .8125rem;
  color: var(--ha-text-muted);
  text-align: center;
}


/* ── Form Inputs ──────────────────────────────────────────────── */

.ha-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--ha-bg-input);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-sm);
  color: var(--ha-text-primary);
  font-size: .875rem;
  font-family: var(--ha-font);
  outline: none;
  transition: border-color var(--ha-transition-fast),
              box-shadow var(--ha-transition-fast);
}

.ha-input:focus {
  border-color: var(--ha-accent);
}

.ha-input::placeholder {
  color: var(--ha-text-muted);
}

.ha-input--error {
  border-color: var(--ha-danger);
}

.ha-input--error:focus {
  border-color: var(--ha-danger);
}

.ha-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ha-text-secondary);
  margin-bottom: 4px;
}


/* ── Buttons — Editorial Sharp ───────────────────────────────── */

.ha-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 32px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--ha-font);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 0;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  outline: none;
}

.ha-btn:focus-visible {
  outline: 2px solid var(--ha-accent);
  outline-offset: 2px;
}

.ha-btn--primary {
  background: var(--ha-text-primary);
  color: var(--ha-bg-body);
}

.ha-btn--primary:hover {
  background: var(--ha-accent);
  color: var(--ha-bg-body);
  box-shadow: var(--ha-shadow-glow);
  text-decoration: none;
}

.ha-btn--ghost {
  background: transparent;
  color: var(--ha-text-primary);
  border: 1px solid var(--ha-border);
}

.ha-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--ha-accent);
  color: var(--ha-accent);
  text-decoration: none;
}

.ha-btn--danger {
  background: rgba(252, 165, 165, 0.15);
  color: var(--ha-danger);
  border: 1px solid rgba(252, 165, 165, 0.3);
}

.ha-btn--danger:hover {
  background: rgba(252, 165, 165, 0.25);
  text-decoration: none;
}

.ha-btn--sm {
  padding: 8px 20px;
  font-size: 0.75rem;
}

.ha-btn--icon {
  padding: 6px;
  width: 36px;
  height: 36px;
}

.ha-btn--icon svg {
  width: 18px;
  height: 18px;
}


/* ── Data Table ───────────────────────────────────────────────── */

.ha-table-wrap {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-lg);
  overflow: hidden;
}

.ha-table {
  width: 100%;
  border-collapse: collapse;
}

.ha-table th {
  padding: 16px 24px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ha-text-muted);
  border-bottom: 1px solid var(--ha-border-subtle);
  text-align: left;
  background: transparent;
}

.ha-table td {
  padding: 24px;
  font-size: 0.9375rem;
  color: var(--ha-text-primary);
  border-bottom: 1px solid var(--ha-border-subtle);
  transition: background 300ms ease;
}

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

.ha-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}


/* ── Progress Bar — Thin with Glow Dot ───────────────────────── */

.ha-progress {
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  width: 100%;
}

.ha-progress__fill {
  height: 100%;
  background: var(--ha-accent);
  box-shadow: 0 0 12px var(--ha-accent-subtle);
  position: relative;
  transition: width var(--ha-transition-slow);
}

.ha-progress__fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  width: 6px;
  height: 6px;
  background: var(--ha-accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--ha-accent);
}

.ha-progress__fill--success { background: var(--ha-success); box-shadow: 0 0 12px rgba(134, 239, 172, 0.2); }
.ha-progress__fill--warning { background: var(--ha-warning); box-shadow: 0 0 12px rgba(253, 224, 71, 0.2); }
.ha-progress__fill--danger  { background: var(--ha-danger); box-shadow: 0 0 12px rgba(252, 165, 165, 0.2); }


/* ── Empty State ──────────────────────────────────────────────── */

.ha-empty {
  text-align: center;
  padding: 3rem 1rem;
}

.ha-empty__icon {
  color: var(--ha-text-muted);
  margin-bottom: .75rem;
}

.ha-empty__icon svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.2;
}

.ha-empty__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ha-text-primary);
  margin: 0 0 4px;
}

.ha-empty__text {
  font-size: .8125rem;
  color: var(--ha-text-muted);
  margin: 0;
}


/* ── Header Buttons (icon only, no bg) ────────────────────────── */

.ha-header__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: var(--ha-radius-sm);
  color: var(--ha-text-secondary);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: color var(--ha-transition-fast);
}

.ha-header__btn:hover {
  color: var(--ha-text-primary);
  text-decoration: none;
}

.ha-header__btn i {
  font-size: 1.35rem;
}

.ha-header__btn .icon-sun { display: none; }
.ha-header__btn .icon-moon { display: block; }
[data-bs-theme="light"] .ha-header__btn .icon-sun { display: block; }
[data-bs-theme="light"] .ha-header__btn .icon-moon { display: none; }


/* ── Toast/Snackbar ───────────────────────────────────────────── */

.ha-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.ha-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--ha-bg-surface-raised);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-md);
  box-shadow: var(--ha-shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  font-size: .875rem;
  color: var(--ha-text-primary);
  pointer-events: auto;
  animation: ha-slide-down var(--ha-transition-slow) both;
}

.ha-toast--success { border-left: 3px solid var(--ha-success); }
.ha-toast--error   { border-left: 3px solid var(--ha-danger); }
.ha-toast--warning { border-left: 3px solid var(--ha-warning); }
.ha-toast--info    { border-left: 3px solid var(--ha-info); }

.ha-toast.removing {
  animation: ha-fade-in var(--ha-transition-fast) reverse both;
}


/* ── Alert ────────────────────────────────────────────────────── */

.ha-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--ha-radius-md);
  font-size: .875rem;
  border: 1px solid;
}

.ha-alert--success { background: rgba(134, 239, 172, 0.08); border-color: rgba(134, 239, 172, 0.2); color: var(--ha-success); }
.ha-alert--danger  { background: rgba(252, 165, 165, 0.08); border-color: rgba(252, 165, 165, 0.2); color: var(--ha-danger); }
.ha-alert--warning { background: rgba(253, 224, 71, 0.08); border-color: rgba(253, 224, 71, 0.2); color: var(--ha-warning); }
.ha-alert--info    { background: rgba(147, 197, 253, 0.08); border-color: rgba(147, 197, 253, 0.2); color: var(--ha-info); }


/* ── Avatar ───────────────────────────────────────────────────── */

.ha-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--ha-accent-subtle);
  color: var(--ha-accent);
  font-size: .8125rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.ha-avatar--sm { width: 28px; height: 28px; font-size: .6875rem; }
.ha-avatar--lg { width: 48px; height: 48px; font-size: 1rem; }

.ha-avatar-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--ha-border-glow);
}


/* ── Utility ──────────────────────────────────────────────────── */

.ha-text-muted { color: var(--ha-text-muted) !important; }
.ha-text-secondary { color: var(--ha-text-secondary) !important; }
.ha-text-success { color: var(--ha-success) !important; }
.ha-text-warning { color: var(--ha-warning) !important; }
.ha-text-danger { color: var(--ha-danger) !important; }
.ha-text-accent { color: var(--ha-accent) !important; }

.ha-gap-sm { gap: .5rem; }
.ha-gap-md { gap: 1rem; }
.ha-gap-lg { gap: 1.5rem; }


/* ── Pagination ───────────────────────────────────────────────── */

.ha-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
}

.ha-pagination__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--ha-text-secondary);
  background: transparent;
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ha-transition-fast),
              color var(--ha-transition-fast);
}

.ha-pagination__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ha-text-primary);
  text-decoration: none;
}

.ha-pagination__item.active {
  background: var(--ha-accent);
  border-color: var(--ha-accent);
  color: var(--ha-bg-body);
}

.ha-pagination__item:disabled,
.ha-pagination__item.disabled {
  opacity: .4;
  pointer-events: none;
}


/* ── List Group — Editorial ──────────────────────────────────── */

.ha-list {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

.ha-list__item {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 32px 0;
  border-bottom: 1px solid var(--ha-border-subtle);
  transition: background var(--ha-transition-fast);
}

.ha-list__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ha-list__item:first-child {
  padding-top: 0;
}

.ha-list__item:hover {
  background: transparent;
}

.ha-list__item--clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.ha-list__item--clickable:hover {
  color: inherit;
  text-decoration: none;
}

.ha-list__content {
  flex: 1;
  min-width: 0;
}

.ha-list__title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--ha-text-primary);
}

.ha-list__subtitle {
  font-size: .75rem;
  color: var(--ha-text-muted);
  margin-top: 2px;
}

.ha-list__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}


/* ── Tabs ─────────────────────────────────────────────────────── */

.ha-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--ha-border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ha-tabs::-webkit-scrollbar {
  display: none;
}

.ha-tab {
  padding: 10px 16px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--ha-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--ha-transition-fast),
              border-color var(--ha-transition-fast);
}

.ha-tab:hover {
  color: var(--ha-text-primary);
  text-decoration: none;
}

.ha-tab.active {
  color: var(--ha-accent);
  border-bottom-color: var(--ha-accent);
  font-weight: 600;
}


/* ── Confirm Dialog ───────────────────────────────────────────── */

.ha-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: ha-fade-in var(--ha-transition-fast) both;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ha-dialog {
  width: 100%;
  max-width: 400px;
  background: var(--ha-bg-surface-raised);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-lg);
  padding: 24px;
  box-shadow: var(--ha-shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  animation: ha-scale-in var(--ha-transition-base) both;
}

.ha-dialog__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ha-text-primary);
  margin: 0 0 8px;
}

.ha-dialog__text {
  font-size: .875rem;
  color: var(--ha-text-secondary);
  margin: 0 0 20px;
}

.ha-dialog__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}


/* ── Tag/Pill ─────────────────────────────────────────────────── */

.ha-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ha-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: .75rem;
  font-weight: 500;
  color: var(--ha-text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ha-border);
  border-radius: 999px;
  text-decoration: none;
  transition: background var(--ha-transition-fast),
              color var(--ha-transition-fast);
}

.ha-tag:hover {
  background: var(--ha-accent-subtle);
  color: var(--ha-accent);
  text-decoration: none;
}

.ha-tag.active {
  background: var(--ha-accent);
  color: var(--ha-bg-body);
  border-color: var(--ha-accent);
}


/* ── Section Header ───────────────────────────────────────────── */

.ha-section {
  margin-bottom: 80px;
}

.ha-section__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 40px;
}

.ha-section__title {
  font-size: 2.25rem;
  font-family: var(--ha-font-heading);
  color: var(--ha-text-primary);
  font-weight: 400;
  margin: 0;
}

.ha-section__desc {
  font-size: .8125rem;
  color: var(--ha-text-muted);
  margin: 4px 0 0;
}


/* ── Page Header ──────────────────────────────────────────────── */

.ha-page-header {
  margin-bottom: 64px;
  padding-top: 40px;
}

.ha-page-title {
  font-size: 3.5rem;
  font-weight: 400;
  color: var(--ha-text-primary);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.ha-page-subtitle {
  font-family: var(--ha-font);
  font-size: 1rem;
  color: var(--ha-text-secondary);
  margin: 16px 0 0;
  font-weight: 300;
  letter-spacing: 0.02em;
}


/* ── Inline Thumbnail ─────────────────────────────────────────── */

.ha-thumb {
  width: 80px;
  height: 50px;
  border-radius: var(--ha-radius-sm);
  background: linear-gradient(135deg, var(--ha-accent) 0%, var(--ha-accent-hover) 100%);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.ha-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ha-thumb__badge {
  position: absolute !important;
  bottom: 2px;
  left: 2px;
  width: 18px !important;
  height: 20px !important;
}


/* ── Detail List (sidebar info) ────────────────────────────────── */

.ha-detail-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ha-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ha-detail-label {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ha-text-muted);
}

.ha-detail-value {
  font-size: .875rem;
  color: var(--ha-text-primary);
}

@media (max-width: 767px) {
  [style*="grid-template-columns: 1fr 320px"] {
    grid-template-columns: 1fr !important;
  }
}


/* ── Scrollable card body ─────────────────────────────────────── */

.ha-card__scroll {
  max-height: 340px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}


/* ================================================================
   Layout — Sidebar + Header + Main
   ================================================================ */

/* ── Sidebar — Editorial Glass ───────────────────────────────── */

.ha-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--ha-sidebar-w);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-right: 1px solid var(--ha-border-subtle);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transition: width var(--ha-transition-slow);
  overflow: visible;
}

.ha-sidebar.collapsed {
  width: var(--ha-sidebar-w-collapsed);
}

/* sidebar inner elements transitions */
.ha-nav-link span,
.ha-nav-group__label,
.ha-sidebar__brand-text,
.ha-sidebar__logo,
.ha-sidebar__user-info {
  transition: opacity var(--ha-transition-base), max-width var(--ha-transition-base);
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
  opacity: 1;
}

.ha-sidebar__header {
  transition: padding var(--ha-transition-slow);
}

.ha-sidebar__footer {
  transition: padding var(--ha-transition-slow);
}

.ha-nav-link {
  transition: background var(--ha-transition-fast),
              color var(--ha-transition-fast),
              padding var(--ha-transition-slow),
              justify-content var(--ha-transition-slow);
}

.ha-sidebar__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: visible;
}

/* collapsed state */
.ha-sidebar.collapsed .ha-nav-link span,
.ha-sidebar.collapsed .ha-nav-group__label,
.ha-sidebar.collapsed .ha-sidebar__brand-text,
.ha-sidebar.collapsed .ha-sidebar__logo,
.ha-sidebar.collapsed .ha-sidebar__user-info {
  opacity: 0;
  max-width: 0;
}

.ha-sidebar.collapsed .ha-nav-link {
  justify-content: center;
  padding: 10px;
}

.ha-sidebar.collapsed .ha-nav-link i {
  font-size: 1.25rem;
}

.ha-sidebar.collapsed .ha-sidebar__header {
  justify-content: center;
  padding: 16px 10px;
}

.ha-sidebar.collapsed .ha-sidebar__footer {
  justify-content: center;
  padding: 12px 10px;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.ha-sidebar.collapsed .ha-sidebar__user,
.ha-sidebar.collapsed .ha-user-pill {
  justify-content: center;
  padding: 8px;
  gap: 0;
}

.ha-sidebar.collapsed .ha-user-info {
  display: none;
}

.ha-sidebar.collapsed .ha-user-pill .ha-nav-link--logout {
  display: none;
}

.ha-sidebar.collapsed .ha-user-pill.show-logout .ha-nav-link--logout {
  display: flex;
}

.ha-sidebar.collapsed .ha-nav-link--logout {
  justify-content: center;
}

.ha-sidebar.collapsed .ha-nav-group {
  padding-bottom: 6px;
  margin-bottom: 2px;
}

.ha-sidebar.collapsed .ha-sidebar__collapse-btn i {
  transform: rotate(180deg);
}

.ha-sidebar.collapsed + .ha-overlay + .ha-main {
  margin-left: var(--ha-sidebar-w-collapsed);
}

.ha-sidebar.collapsed + .ha-overlay + .ha-main .ha-header {
  left: var(--ha-sidebar-w-collapsed);
}

.ha-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  height: 120px;
  flex-shrink: 0;
}

.ha-sidebar__brand {
  text-decoration: none;
  color: var(--ha-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ha-sidebar__brand img {
  height: auto;
  width: auto;
}

.ha-sidebar__brand-text {
  font-family: var(--ha-font-heading);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ha-text-primary);
}

.ha-sidebar__logo {
  max-width: 80%;
  max-height: 80px;
  object-fit: contain;
}

.ha-sidebar__close {
  display: none;
  background: none;
  border: none;
  color: var(--ha-text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 1.25rem;
}

.ha-sidebar__collapse-btn {
  position: absolute;
  bottom: 80px;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ha-bg-surface-raised);
  border: 1px solid var(--ha-border);
  color: var(--ha-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .875rem;
  z-index: 1200;
  box-shadow: var(--ha-shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color var(--ha-transition-fast),
              background var(--ha-transition-fast),
              box-shadow var(--ha-transition-fast);
}

.ha-sidebar__collapse-btn:hover {
  color: var(--ha-text-primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: var(--ha-shadow-md);
}

.ha-sidebar__collapse-btn i {
  transition: transform var(--ha-transition-slow);
}

.ha-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 32px;
  scrollbar-gutter: stable;
}

.ha-nav-group {
  margin-bottom: 32px;
}

.ha-nav-group__label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ha-text-muted);
  margin-bottom: 16px;
}

.ha-nav-group__label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ha-border-subtle);
}

.ha-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  font-family: var(--ha-font-heading);
  font-size: 1.125rem;
  font-style: italic;
  font-weight: 400;
  color: var(--ha-text-secondary);
  text-decoration: none;
  border-radius: 0;
  transition: all 300ms ease;
  cursor: pointer;
}

.ha-nav-link i {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-style: normal;
  opacity: 0.5;
  transition: all 300ms ease;
}

.ha-nav-link:hover {
  color: var(--ha-text-primary);
  padding-left: 8px;
  text-decoration: none;
}

.ha-nav-link:hover i {
  opacity: 1;
  color: var(--ha-accent);
}

.ha-nav-link.active {
  color: var(--ha-accent);
  padding-left: 12px;
  font-weight: 500;
  position: relative;
}

.ha-nav-link.active i {
  color: var(--ha-accent);
  opacity: 1;
}

.ha-nav-link--logout {
  color: var(--ha-text-muted);
}

.ha-nav-link--logout:hover {
  color: var(--ha-danger);
  background: var(--ha-danger-hover);
}

.ha-sidebar__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-shrink: 0;
}

.ha-sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ha-sidebar__user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ha-sidebar__user-name {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ha-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ha-sidebar__user-role {
  font-size: .6875rem;
  color: var(--ha-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}


/* ── User Pill — Sidebar Footer ──────────────────────────────── */

.ha-user-pill {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ha-border-subtle);
  border-radius: var(--ha-radius-lg);
  cursor: pointer;
  transition: all 300ms ease;
}

.ha-user-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--ha-border);
}

.ha-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ha-user-name {
  font-family: var(--ha-font-heading);
  font-size: 1.125rem;
  color: var(--ha-text-primary);
}

.ha-user-role {
  font-family: var(--ha-font);
  font-size: 0.65rem;
  color: var(--ha-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}


/* ── Overlay ──────────────────────────────────────────────────── */

.ha-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 1099;
  opacity: 0;
  transition: opacity var(--ha-transition-base);
}

.ha-overlay.open {
  opacity: 1;
}


/* ── Main Area — Transparent ─────────────────────────────────── */

.ha-main {
  margin-left: var(--ha-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: margin-left var(--ha-transition-slow);
}


/* ── Header — Gradient Fade ──────────────────────────────────── */

.ha-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--ha-header-h);
  padding: 0 64px;
  background: linear-gradient(180deg, rgba(8, 8, 10, 0.9) 0%, transparent 100%);
  pointer-events: none;
}

.ha-header > * {
  pointer-events: auto;
}

.ha-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.ha-header__hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--ha-text-primary);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 4px;
}

.ha-header__search {
  position: relative;
  max-width: 320px;
  width: 100%;
}

.ha-header__search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--ha-text-muted);
  pointer-events: none;
}

.ha-header__search input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-sm);
  color: var(--ha-text-primary);
  font-size: .8125rem;
  outline: none;
  transition: border-color var(--ha-transition-fast),
              box-shadow var(--ha-transition-fast);
}

.ha-header__search input:focus {
  border-color: var(--ha-accent);
}

.ha-header__search input::placeholder {
  color: var(--ha-text-muted);
}

.ha-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Notification Drawer ───────────────────────────────────────── */

.ha-notif-wrap {
  position: relative;
}

.ha-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--ha-danger);
  border-radius: 999px;
  border: 2px solid var(--ha-bg-body);
}

.ha-notif-drawer {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: var(--ha-bg-surface-raised);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-lg);
  box-shadow: var(--ha-shadow-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 1200;
  opacity: 0;
  transform: scale(.96) translateY(-4px);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity var(--ha-transition-fast),
              transform var(--ha-transition-fast);
}

.ha-notif-drawer.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.ha-notif-drawer__header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ha-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ha-notif-drawer__mark-all {
  background: none;
  border: none;
  color: var(--ha-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--ha-radius-sm);
  font-size: 1.125rem;
  line-height: 1;
  transition: color var(--ha-transition-fast), background var(--ha-transition-fast);
}

.ha-notif-drawer__mark-all:hover {
  color: var(--ha-accent);
  background: var(--ha-accent-subtle);
}

.ha-notif-drawer__title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--ha-text-primary);
}

.ha-notif-drawer__body {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.ha-notif-drawer__item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ha-border-subtle);
  transition: background var(--ha-transition-fast);
  align-items: flex-start;
}

.ha-notif-drawer__item:last-child {
  border-bottom: none;
}

.ha-notif-drawer__item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.ha-notif-drawer__read-btn {
  background: none;
  border: none;
  color: var(--ha-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--ha-radius-sm);
  font-size: .875rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0;
  transition: opacity var(--ha-transition-fast), color var(--ha-transition-fast), background var(--ha-transition-fast);
}

.ha-notif-drawer__item:hover .ha-notif-drawer__read-btn {
  opacity: 1;
}

.ha-notif-drawer__read-btn:hover {
  color: var(--ha-success);
  background: rgba(134, 239, 172, 0.1);
}

.ha-notif-drawer__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--ha-radius-sm);
  background: var(--ha-accent-subtle);
  color: var(--ha-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.ha-notif-drawer__content {
  min-width: 0;
  flex: 1;
}

.ha-notif-drawer__msg {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--ha-text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ha-notif-drawer__time {
  font-size: .6875rem;
  color: var(--ha-text-muted);
  margin-top: 2px;
}

.ha-notif-drawer__footer {
  padding: 10px 16px;
  text-align: center;
  border-top: 1px solid var(--ha-border-subtle);
}

.ha-notif-drawer__footer a {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ha-accent);
  text-decoration: none;
}

.ha-notif-drawer__footer a:hover {
  color: var(--ha-accent-hover);
}

.ha-notif-drawer__empty {
  padding: 24px 16px;
  text-align: center;
  font-size: .8125rem;
  color: var(--ha-text-muted);
}


/* ── Content ──────────────────────────────────────────────────── */

.ha-content {
  flex: 1;
  padding: 0 64px 80px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}


/* ── Alerts area ──────────────────────────────────────────────── */

.ha-alerts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.ha-alert__close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  margin-left: auto;
  padding: 0;
  opacity: .6;
  font-size: 1rem;
}

.ha-alert__close:hover {
  opacity: 1;
}


/* ── Footer ───────────────────────────────────────────────────── */

.ha-footer {
  padding: 16px 24px;
  font-size: .75rem;
  color: var(--ha-text-muted);
  text-align: center;
  border-top: 1px solid var(--ha-border-subtle);
}


/* ── Hero Banner ──────────────────────────────────────────────── */

.ha-hero-banner {
  position: relative;
  width: 100%;
  height: 480px;
  border-radius: var(--ha-radius-lg);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 64px;
  box-shadow: var(--ha-shadow-lg);
  border: 1px solid var(--ha-border);
}

.ha-hero-banner__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 10s ease;
}

.ha-hero-banner:hover .ha-hero-banner__bg {
  transform: scale(1.05);
}

.ha-hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
}

.ha-hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 32px;
}


/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 991px) {
  .ha-sidebar__collapse-btn {
    display: none;
  }

  .ha-sidebar {
    transform: translateX(-100%);
    width: var(--ha-sidebar-w) !important;
  }

  .ha-sidebar.open {
    transform: translateX(0);
  }

  .ha-sidebar__close {
    display: block;
  }

  .ha-overlay.open {
    display: block;
  }

  .ha-main {
    margin-left: 0;
  }

  .ha-header {
    padding: 0 24px;
  }

  .ha-header__hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ha-content {
    padding: 0 24px 40px;
  }

  .ha-hero-banner {
    height: 320px;
    padding: 32px;
  }

  .ha-stat-grid {
    border-radius: var(--ha-radius-md);
  }

  .ha-page-header {
    margin-bottom: 40px;
    padding-top: 24px;
  }

  .ha-section {
    margin-bottom: 48px;
  }

  .ha-section__header {
    margin-bottom: 24px;
  }
}

@media (max-width: 575px) {
  .ha-content {
    padding: 0 16px 32px;
  }

  h1 {
    font-size: 2rem;
  }

  .ha-course-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ha-hero-banner {
    height: 280px;
    padding: 24px;
  }
}


/* ================================================================
   Auth Pages — Login / Register
   ================================================================ */

.ha-auth-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ha-bg-body);
  font-family: var(--ha-font);
  color: var(--ha-text-primary);
  padding: 24px;
}

.ha-auth-wrapper {
  width: 100%;
  max-width: 400px;
}

.ha-auth-card {
  background: linear-gradient(145deg, rgba(20, 20, 25, 0.6) 0%, rgba(10, 10, 12, 0.8) 100%);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-xl);
  padding: 40px 32px 32px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--ha-shadow-glass);
}

.ha-auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.ha-auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--ha-radius-lg);
  background: var(--ha-accent-subtle);
  margin-bottom: 16px;
}

.ha-auth-logo-icon {
  font-style: normal;
  font-size: 1.5rem;
}

.ha-auth-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -.02em;
}

.ha-auth-subtitle {
  font-size: .875rem;
  color: var(--ha-text-secondary);
  margin: 0;
}

.ha-auth-field {
  margin-bottom: 16px;
}

.ha-auth-submit {
  width: 100%;
  padding: 10px 16px;
  margin-top: 8px;
  font-size: .9375rem;
}

.ha-auth-footer-text {
  text-align: center;
  font-size: .8125rem;
  color: var(--ha-text-muted);
  margin: 20px 0 0;
}

.ha-auth-footer-text a {
  color: var(--ha-accent);
  text-decoration: none;
  font-weight: 600;
}

.ha-auth-footer-text a:hover {
  color: var(--ha-accent-hover);
}

.ha-auth-error {
  display: block;
  font-size: .75rem;
  color: var(--ha-danger);
  margin-top: 4px;
}

.ha-auth-help {
  display: block;
  font-size: .75rem;
  color: var(--ha-text-muted);
  margin-top: 4px;
}


/* ── Auth Topbar ──────────────────────────────────────────────── */

.ha-auth-topbar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.ha-auth-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  color: var(--ha-text-secondary);
  cursor: pointer;
  font-size: 1.3rem;
  transition: color var(--ha-transition-fast);
}

.ha-auth-toggle:hover {
  color: var(--ha-text-primary);
}

.ha-auth-toggle .icon-sun { display: none; }
.ha-auth-toggle .icon-moon { display: block; }
[data-bs-theme="light"] .ha-auth-toggle .icon-sun { display: block; }
[data-bs-theme="light"] .ha-auth-toggle .icon-moon { display: none; }

.ha-auth-toggle__lang {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}


/* ── Password Toggle ──────────────────────────────────────────── */

.ha-input-password {
  position: relative;
}

.ha-input-password .ha-input {
  padding-right: 40px;
}

.ha-input-password__toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0 var(--ha-radius-sm) var(--ha-radius-sm) 0;
  color: var(--ha-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color var(--ha-transition-fast);
}

.ha-input-password__toggle:hover {
  color: var(--ha-text-primary);
}

.ha-input-password__toggle .ti-eye-off { display: none; }
.ha-input-password__toggle .ti-eye { display: block; }
.ha-input-password__toggle.active .ti-eye-off { display: block; }
.ha-input-password__toggle.active .ti-eye { display: none; }

/* ─── Bootstrap/Tabler legacy class mapping (safety net) ─────────── */
.form-control,
.form-select,
input.form-control,
select.form-select,
textarea.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--ha-bg-input);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-sm);
  color: var(--ha-text-primary);
  font-family: var(--ha-font);
  font-size: 0.9375rem;
  transition: border-color var(--ha-transition-fast);
}
.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  outline: none;
  border-color: var(--ha-accent);
}
.form-control::placeholder,
textarea.form-control::placeholder {
  color: var(--ha-text-muted);
}
.form-check-input {
  accent-color: var(--ha-accent);
}

.card {
  background: var(--ha-bg-surface-raised);
  color: var(--ha-text-primary);
  border: 1px solid var(--ha-border);
  border-radius: var(--ha-radius-md);
  padding: 1.25rem;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ha-border-subtle);
  padding: 0 0 1rem 0;
  margin-bottom: 1rem;
  color: var(--ha-text-primary);
}
.card-footer {
  background: transparent;
  border-top: 1px solid var(--ha-border-subtle);
  padding: 1rem 0 0 0;
  margin-top: 1rem;
}
.card-title {
  font-family: var(--ha-font-heading);
  font-size: 1.125rem;
  color: var(--ha-text-primary);
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--ha-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--ha-transition-fast);
  text-decoration: none;
}
.btn-primary {
  background: var(--ha-accent);
  color: #1a1a1a;
  border-color: var(--ha-accent);
}
.btn-primary:hover { background: var(--ha-accent-hover); }
.btn-outline-secondary,
.btn-outline-primary {
  background: transparent;
  color: var(--ha-text-primary);
  border-color: var(--ha-border);
}
.btn-outline-secondary:hover,
.btn-outline-primary:hover {
  background: var(--ha-bg-surface-hover);
  border-color: var(--ha-accent);
}
.btn-sm { font-size: 0.75rem; padding: 0.375rem 0.75rem; }
.btn-danger { background: var(--ha-danger); color: #1a1a1a; border-color: var(--ha-danger); }
.btn-secondary { background: var(--ha-bg-surface-hover); color: var(--ha-text-primary); border-color: var(--ha-border); }
.btn-warning { background: var(--ha-warning); color: #1a1a1a; border-color: var(--ha-warning); }

.text-muted { color: var(--ha-text-muted) !important; }
.text-secondary { color: var(--ha-text-secondary) !important; }
.text-danger { color: var(--ha-danger) !important; }
.text-success { color: var(--ha-success) !important; }
.text-warning { color: var(--ha-warning) !important; }
.text-end { text-align: right; }
.text-center { text-align: center; }

.page-title {
  font-family: var(--ha-font-heading);
  font-size: 1.75rem;
  color: var(--ha-text-primary);
  margin: 0;
}
.page-subtitle {
  color: var(--ha-text-muted);
  font-size: 0.9rem;
  margin: 4px 0 0;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 99px;
  background: var(--ha-bg-surface-raised);
  color: var(--ha-text-primary);
  border: 1px solid var(--ha-border);
}
.bg-azure, .bg-blue { background: var(--ha-info) !important; color: #1a1a1a !important; }
.bg-green, .bg-success { background: var(--ha-success) !important; color: #1a1a1a !important; }
.bg-red, .bg-danger { background: var(--ha-danger) !important; color: #1a1a1a !important; }
.bg-yellow, .bg-warning { background: var(--ha-warning) !important; color: #1a1a1a !important; }
.bg-orange { background: #fdba74 !important; color: #1a1a1a !important; }
.bg-teal { background: #5eead4 !important; color: #1a1a1a !important; }
.bg-secondary { background: var(--ha-bg-surface-hover) !important; color: var(--ha-text-secondary) !important; }
.bg-muted { background: var(--ha-bg-surface) !important; color: var(--ha-text-muted) !important; }

.list-group {
  list-style: none;
  padding: 0;
  margin: 0;
}
.list-group-item {
  background: transparent;
  border-bottom: 1px solid var(--ha-border-subtle);
  padding: 0.75rem 0;
  color: var(--ha-text-primary);
}
.list-group-item:last-child { border-bottom: none; }
.list-group-flush .list-group-item { border-bottom: 1px solid var(--ha-border-subtle); }
.list-group-item-action:hover { background: var(--ha-bg-surface-hover); }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--ha-radius-sm);
  border: 1px solid var(--ha-border);
  background: var(--ha-bg-surface-raised);
  color: var(--ha-text-primary);
  margin-bottom: 1rem;
}
.alert-success { border-color: var(--ha-success); background: rgba(134,239,172,0.08); color: var(--ha-success); }
.alert-danger { border-color: var(--ha-danger); background: rgba(252,165,165,0.08); color: var(--ha-danger); }
.alert-warning { border-color: var(--ha-warning); background: rgba(253,224,71,0.08); color: var(--ha-warning); }
.alert-info { border-color: var(--ha-info); background: rgba(147,197,253,0.08); color: var(--ha-info); }
.alert-dismissible .btn-close { background: transparent; border: 0; color: inherit; cursor: pointer; opacity: 0.7; }

.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ha-text-primary);
}
.table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ha-text-muted);
  padding: 0.75rem;
  border-bottom: 1px solid var(--ha-border);
}
.table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--ha-border-subtle);
}
.table-vcenter td { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--ha-bg-surface-hover); }

.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.row-cards { gap: 1.25rem; }
.col, .col-12 { flex: 1; min-width: 0; }
.col-md-3 { flex: 0 0 calc(25% - 0.75rem); }
.col-md-4 { flex: 0 0 calc(33.33% - 0.75rem); }
.col-md-5 { flex: 0 0 calc(41.67% - 0.75rem); }
.col-md-6 { flex: 0 0 calc(50% - 0.5rem); }
.col-md-8 { flex: 0 0 calc(66.67% - 0.5rem); }
.col-md-9 { flex: 0 0 calc(75% - 0.5rem); }
.col-auto { flex: 0 0 auto; }

.invalid-feedback {
  display: block;
  color: var(--ha-danger);
  font-size: 0.8rem;
  margin-top: 4px;
}

@media (max-width: 768px) {
  .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-8, .col-md-9 { flex: 0 0 100%; }
}

/* ── Utility ────────────────────────────────────────────────────── */
.d-none { display: none !important; }

/* ── Mobile UI audit (Correzione 3) ─────────────────────────────────── */
@media (max-width: 768px) {
  /* Page title scaling */
  .ha-page-title { font-size: 1.75rem !important; line-height: 1.2; }
  .ha-page-subtitle { font-size: 0.9rem !important; }

  /* Cards & containers — riduci padding */
  .ha-card { padding: 16px !important; }
  .ha-page-header { padding-left: 0 !important; padding-right: 0 !important; }

  /* Tables: scroll orizzontale forzato + font-size ridotto */
  .ha-table, .table { font-size: 0.85rem; }
  .ha-card:has(.ha-table),
  .ha-card:has(table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Stats grid → 2 col mobile, 1 col su xs */
  .ha-stat-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  .ha-stat__value { font-size: 1.5rem !important; }
  .ha-stat__label { font-size: 0.7rem !important; }

  /* Course grid → 1 col */
  .ha-course-grid { grid-template-columns: 1fr !important; gap: 12px !important; }

  /* Quiz/material grids: 2 colonne max */
  div[style*="grid-template-columns: repeat(auto-fill, minmax(180px"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(220px"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Annotate sidebar: stack verticale */
  div[style*="grid-template-columns: minmax(0, 520px) minmax(0, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  aside[style*="position: sticky"] { position: static !important; }

  /* Filter form bar → wrap a colonna singola */
  form[style*="grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Pulsanti: tap target più grandi */
  .ha-btn { min-height: 40px; padding: 8px 14px; }
  .ha-btn--sm { min-height: 36px; padding: 6px 12px; }

  /* Chat bubble più ampia */
  .ha-chat__bubble { max-width: 88% !important; }

  /* Calendar table compatta */
  .ha-table th, .ha-table td { padding: 8px 6px !important; }

  /* Modali / overlay: padding ridotto */
  .modal, .ha-modal { padding: 12px !important; }

  /* Viewer: PDF/video full width */
  .viewer-pdf iframe, .viewer-video video { height: auto !important; min-height: 50vh; }

  /* Form a 2 colonne → 1 col */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Nav prev/next materiale: stack */
  nav[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .ha-stat-grid { grid-template-columns: 1fr !important; }
  .ha-page-title { font-size: 1.5rem !important; }
  div[style*="grid-template-columns: repeat(auto-fill, minmax(180px"],
  div[style*="grid-template-columns: repeat(auto-fill, minmax(220px"] {
    grid-template-columns: 1fr !important;
  }
}
