/* ============================================
   CHub — main.css
   Persistent left-sidebar layout
   Uses tokens from variables.css
   ============================================ */


/* ============================================
   1. RESET & BASE
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "rlig" 1, "calt" 1;
}

body {
  display: flex;
  min-height: 100vh;
  height: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--foreground);
  background-color: var(--background);
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: 2.143rem; }
h2 { font-size: 1.714rem; }
h3 { font-size: 1.286rem; }
h4 { font-size: 1.143rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.857rem; }

p {
  line-height: var(--leading-normal);
}

ul, ol {
  list-style: none;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
}

::selection {
  background: var(--brand);
  color: white;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

::placeholder {
  color: var(--muted-foreground);
  opacity: 0.6;
}

/* --- Scrollbar --- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background-color: oklch(0.5 0 0);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}


/* ============================================
   2. APP SHELL LAYOUT
   ============================================ */

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  overflow-y: auto;
  overflow-x: hidden;
}

.app-main {
  position: relative;
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background: var(--background);
  position: sticky;
  top: 0;
  z-index: calc(var(--z-sticky) - 1);
}

.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--foreground);
  font-size: 1.25rem;
  transition: background-color var(--transition-fast);
}

.mobile-menu-toggle:hover {
  background-color: var(--muted);
}

.app-header-spacer {
  flex: 1;
}

.app-content {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 1.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.app-public {
  min-height: 100vh;
  background: var(--background);
  width: 100%;
}

.sidebar-overlay {
  display: none;
}

/* --- Mobile responsive shell --- */

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 250ms ease;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sticky) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms;
  }

  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .app-content {
    padding: 1rem;
  }
}


/* ============================================
   3. SIDEBAR COMPONENTS
   ============================================ */

/* --- Header / Brand --- */

.sidebar-header {
  padding: 1rem 1rem 0.5rem;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-md);
  color: inherit;
}

.sidebar-brand:hover {
  background: var(--sidebar-accent);
  text-decoration: none;
}

.sidebar-logo-img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.sidebar-brand-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--sidebar-foreground);
}

/* --- Navigation --- */

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.sidebar-section {
  padding: 0.25rem 0.75rem;
}

.sidebar-section + .sidebar-section {
  margin-top: 0.5rem;
}

.sidebar-heading {
  height: 2rem;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--sidebar-muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4375rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--sidebar-muted-foreground);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
}

.sidebar-item:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--sidebar-accent);
  color: var(--brand);
  font-weight: 500;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-item.active .sidebar-icon {
  opacity: 1;
  color: var(--brand);
}

/* --- Collapsible sidebar menus --- */

.sidebar-menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4375rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--sidebar-muted-foreground);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
}

.sidebar-menu-toggle:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
}

.sidebar-menu.open > .sidebar-menu-toggle {
  color: var(--sidebar-accent-foreground);
}

.sidebar-menu-chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform var(--transition-fast);
}

.sidebar-menu.open > .sidebar-menu-toggle > .sidebar-menu-chevron {
  transform: rotate(90deg);
}

.sidebar-menu-items {
  display: none;
  padding-left: 1.625rem;
}

.sidebar-menu.open > .sidebar-menu-items {
  display: block;
}

.sidebar-menu-items .sidebar-item {
  font-size: 0.8125rem;
}

.sidebar-badge-danger {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.0625rem 0.375rem;
  background-color: var(--destructive);
  color: #fff;
  border-radius: var(--radius-full);
  line-height: 1.25rem;
}

/* --- Footer / User --- */

.sidebar-footer {
  flex-shrink: 0;
  padding: 0.75rem;
  border-top: 1px solid var(--sidebar-border);
  position: relative;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-md);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--sidebar-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-detail {
  font-size: 0.6875rem;
  color: var(--sidebar-muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--sidebar-muted-foreground);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  flex-shrink: 0;
  font-family: inherit;
}

.sidebar-user-menu:hover {
  background: var(--sidebar-accent);
  color: var(--foreground);
}

/* --- User Dropdown --- */

.sidebar-user-dropdown {
  display: none;
  position: absolute;
  bottom: calc(100% + 0.25rem);
  left: 0.75rem;
  right: 0.75rem;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
}

.sidebar-user-dropdown.open {
  display: block;
  animation: dropdown-in var(--transition-fast) ease-out;
}

@keyframes dropdown-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--popover-foreground);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--accent);
  color: var(--accent-foreground);
  text-decoration: none;
}

.dropdown-item-danger:hover {
  background: var(--danger-muted);
  color: var(--danger);
}

.dropdown-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

.dropdown-label {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  margin-top: 0.25rem;
}

.dropdown-menu.open {
  display: block;
  animation: dropdown-in var(--transition-fast) ease-out;
}


/* ============================================
   4. FLASH MESSAGES
   ============================================ */

.flash-container {
  position: relative;
  z-index: 1;
  padding: 0.75rem 1.5rem 0;
  max-width: 1200px;
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}

.flash {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  line-height: var(--leading-normal);
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  animation: slideDown var(--transition-normal) ease-out;
}

.flash-success {
  background-color: var(--success-muted);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.2);
}

.flash-error {
  background-color: var(--danger-muted);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.flash-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: opacity var(--transition-fast);
}

.flash-close:hover {
  opacity: 1;
}

.flash-container-public {
  max-width: 480px;
  margin: 0.5rem auto;
  padding: 0 1rem;
}

/* Offset flash messages when lesson sidebar is present */
.app-main:has(.lesson-layout) > .flash-container {
  padding-left: calc(var(--sidebar-width-lesson) + 1.5rem);
}

@media (max-width: 768px) {
  .flash-container,
  .app-main:has(.lesson-layout) > .flash-container {
    padding: 0 1rem;
  }
}


/* ============================================
   5. UTILITY — Typography
   ============================================ */

.text-xs   { font-size: 0.75rem;  line-height: 1rem; }
.text-sm   { font-size: 0.857rem; line-height: 1.25rem; }
.text-base { font-size: 1rem;     line-height: 1.5rem; }
.text-lg   { font-size: 1.143rem; line-height: 1.75rem; }
.text-xl   { font-size: 1.286rem; line-height: 1.75rem; }
.text-2xl  { font-size: 1.714rem; line-height: 2rem; }
.text-3xl  { font-size: 2.143rem; line-height: 2.5rem; }

.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.tracking-tight { letter-spacing: var(--tracking-tight); }
.leading-none   { line-height: 1; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whitespace-nowrap { white-space: nowrap; }
.tabular-nums      { font-variant-numeric: tabular-nums; }

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ============================================
   6. UTILITY — Text Colors
   ============================================ */

.text-muted-foreground { color: var(--muted-foreground); }
.text-brand            { color: var(--brand); }
.text-destructive      { color: var(--destructive); }
.text-success          { color: var(--success); }
.text-warning          { color: var(--warning); }


/* ============================================
   7. UTILITY — Display
   ============================================ */

.hidden       { display: none !important; }
.block        { display: block; }
.inline-block { display: inline-block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ============================================
   8. UTILITY — Flexbox
   ============================================ */

.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.flex-1          { flex: 1 1 0%; }
.inline-flex     { display: inline-flex; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.shrink-0        { flex-shrink: 0; }


/* ============================================
   9. UTILITY — Grid
   ============================================ */

.grid        { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }


/* ============================================
   10. UTILITY — Gap
   ============================================ */

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-7 { gap: 1.75rem; }
.gap-8 { gap: 2rem; }


/* ============================================
   11. UTILITY — Space-Y
   ============================================ */

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }


/* ============================================
   12. UTILITY — Width
   ============================================ */

.w-full { width: 100%; }


/* ============================================
   13. UTILITY — Padding
   ============================================ */

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-7 { padding: 1.75rem; }
.p-8 { padding: 2rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem;  padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem;    padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem;  padding-right: 1.5rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem;  padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem;    padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-6 { padding-top: 1.5rem;  padding-bottom: 1.5rem; }


/* ============================================
   14. UTILITY — Margin
   ============================================ */

.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }
.m-6 { margin: 1.5rem; }
.m-7 { margin: 1.75rem; }
.m-8 { margin: 2rem; }

.mx-auto { margin-left: auto; margin-right: auto; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-7 { margin-top: 1.75rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-7 { margin-bottom: 1.75rem; }
.mb-8 { margin-bottom: 2rem; }


/* ============================================
   15. UTILITY — Borders & Radius
   ============================================ */

.border   { border: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }

.rounded      { border-radius: var(--radius); }
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.divide-y > * + * {
  border-top: 1px solid var(--border);
}


/* ============================================
   16. UTILITY — Shadows
   ============================================ */

.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }


/* ============================================
   17. SEPARATOR
   ============================================ */

.separator {
  height: 1px;
  width: 100%;
  background-color: var(--border);
  flex-shrink: 0;
}


/* ============================================
   18. CARDS
   ============================================ */

.card {
  background-color: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-dark {
  background-color: rgba(0, 0, 0, 0.12);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem 1.5rem 0;
}

.card-header.collapsible {
  padding-bottom: 1.5rem;
}

.card-content.collapsed {
  display: none;
}

.card-title {
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--card-foreground);
}

.card-description {
  font-size: 0.857rem;
  color: var(--muted-foreground);
  line-height: var(--leading-normal);
}

.card-header:last-child {
  padding-bottom: 1.5rem;
}

.card-content {
  padding: 1.5rem;
}

.card-header + .card-content {
  padding-top: 1.5rem;
}

.card-footer {
  display: flex;
  align-items: center;
  padding: 0 1.5rem 1.5rem;
}

.card-header + .card-footer {
  padding-top: 1.5rem;
}

.card-content + .card-footer {
  padding-top: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }
}

.dashboard-col {
  min-width: 0;
}

.dashboard-col > .flex:first-child {
  min-height: 2rem;
}


/* ============================================
   19. BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 36px;
  padding: 0 1rem;
  font-size: 0.857rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity var(--transition-fast);
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn:disabled,
.btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* Primary (light on dark) */
.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: oklch(0.85 0 0);
}

/* Brand (orange) */
.btn-brand {
  background-color: var(--brand);
  color: var(--brand-foreground);
  border-color: var(--brand);
}

.btn-brand:hover {
  background-color: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-brand:focus-visible {
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--brand-ring);
}

/* Secondary */
.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--secondary);
}

.btn-secondary:hover {
  background-color: oklch(0.32 0 0);
}

/* Destructive */
.btn-destructive {
  background-color: var(--destructive);
  color: #ffffff;
  border-color: var(--destructive);
}

.btn-destructive:hover {
  background-color: oklch(0.63 0.191 22.216);
}

/* Outline */
.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--input);
}

.btn-outline:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

/* Ghost */
.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--accent);
  color: var(--accent-foreground);
}

/* Link */
.btn-link {
  background-color: transparent;
  color: var(--brand);
  border-color: transparent;
  height: auto;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-link:hover {
  color: var(--brand-hover);
}

/* --- Button Sizes --- */

.btn-sm {
  height: 32px;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  height: 40px;
  padding: 0 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* --- Icon-only Buttons --- */

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-icon.btn-lg {
  width: 40px;
  height: 40px;
}

/* --- Full-width Button --- */

.btn-block {
  display: flex;
  width: 100%;
}


/* ============================================
   20. BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.1875rem 0.5rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.01em;
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 1px solid transparent;
  background-color: transparent;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.badge-default {
  color: var(--foreground);
  border-color: var(--border);
}

.badge-secondary {
  color: var(--muted-foreground);
  border-color: var(--border);
}

.badge-brand {
  color: var(--brand);
  border-color: var(--brand);
}

.badge-success {
  color: var(--success);
  border-color: var(--success);
}

.badge-warning {
  color: var(--warning);
  border-color: var(--warning);
}

.badge-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.badge-info {
  color: var(--info);
  border-color: var(--info);
}

.badge-outline {
  color: var(--muted-foreground);
  border-color: var(--border);
}

.badge-destructive {
  color: var(--destructive);
  border-color: var(--destructive);
}


/* ============================================
   21. TABLES
   ============================================ */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.857rem;
  text-align: left;
}

.table caption {
  padding: 0.5rem 0;
  color: var(--muted-foreground);
  font-size: 0.857rem;
  text-align: left;
}

.table thead {
  border-bottom: 1px solid var(--border);
}

.table th {
  height: 40px;
  padding: 0 0.5rem;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
  vertical-align: middle;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--foreground);
}

.sort-icon {
  font-size: 0.625rem;
}

.table td {
  padding: 0.5rem;
  vertical-align: middle;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-fast);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:hover {
  background-color: oklch(0.269 0 0 / 50%);
}


/* ============================================
   22. FORMS
   ============================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.form-label {
  font-size: 0.857rem;
  font-weight: 500;
  color: var(--foreground);
  line-height: var(--leading-normal);
}

.form-control {
  display: flex;
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  font-size: 0.857rem;
  line-height: var(--leading-normal);
  color: var(--foreground);
  background-color: transparent;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px oklch(0.556 0 0 / 25%);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Native <select> dark theming.
   .form-control sets background-color: transparent so a bare <select>
   inherits the OS default chrome (white on Windows). Force dark
   surface + custom caret app-wide. Closed-state and the popped option
   list both render dark (option background is honored on Win/Linux). */
select.form-control,
select:not([class]) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--popover, var(--card, var(--background)));
  color: var(--popover-foreground, var(--card-foreground, var(--foreground)));
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%239ca3af' d='M6 8 0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}
select.form-control:focus {
  background-color: var(--popover, var(--card, var(--background)));
}
select.form-control option,
select.form-control optgroup,
select:not([class]) option,
select:not([class]) optgroup {
  background-color: var(--popover, var(--card, var(--background)));
  color: var(--popover-foreground, var(--card-foreground, var(--foreground)));
}
select.form-control:disabled {
  background-color: var(--popover, var(--card, var(--background)));
}
/* Multi-select / size > 1 — keep dark surface, drop the caret arrow
   since the widget renders as a list box. */
select.form-control[size]:not([size="1"]),
select.form-control[multiple] {
  background-image: none;
  padding-right: 0.75rem;
  height: auto;
}

input[type="datetime-local"].form-control::-webkit-calendar-picker-indicator,
input[type="date"].form-control::-webkit-calendar-picker-indicator,
input[type="time"].form-control::-webkit-calendar-picker-indicator {
  margin-left: auto;
  cursor: pointer;
  filter: invert(0.7);
}

/* ---- Session Time Slider ---- */

.time-slider-container {
  padding: 0.25rem 0;
}

.time-slider-track {
  position: relative;
  height: 2.5rem;
  background: oklch(0.13 0 0);
  border-radius: var(--radius);
  overflow: hidden;
}

.time-slider-ticks {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

.time-slider-tick {
  position: absolute;
  top: 0;
  width: 1px;
  background: oklch(1 0 0 / 10%);
  pointer-events: none;
}

.time-slider-tick-label {
  position: absolute;
  bottom: 2px;
  font-size: 0.5625rem;
  color: oklch(1 0 0 / 30%);
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.time-slider-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: oklch(0.646 0.222 41.116 / 30%);
  border-radius: var(--radius);
  pointer-events: none;
  transition: left 0.1s, width 0.1s;
  z-index: 2;
}

.time-slider-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  z-index: 3;
}

.time-slider-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.375rem;
}

.time-slider-label-selected {
  text-align: center;
}

.time-slider-booked {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    oklch(0.55 0.02 260 / 40%) 3px,
    oklch(0.55 0.02 260 / 40%) 6px
  );
  border-radius: var(--radius);
  z-index: 1;
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: 0.5rem 0.75rem;
  resize: vertical;
}

.form-select {
  display: flex;
  width: 100%;
  height: 36px;
  padding: 0 2rem 0 0.75rem;
  font-size: 0.857rem;
  line-height: var(--leading-normal);
  color: var(--foreground);
  background-color: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ababab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px oklch(0.556 0 0 / 25%);
}

.form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-select optgroup {
  background-color: var(--card);
  color: var(--warning);
  font-style: normal;
}

.form-select option {
  background-color: var(--card);
  color: var(--foreground);
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.857rem;
  cursor: pointer;
  user-select: none;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: var(--leading-normal);
}


/* ============================================
   23. PROGRESS BARS
   ============================================ */

.progress {
  width: 100%;
  height: 8px;
  background-color: oklch(0.922 0 0 / 20%);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-sm {
  height: 4px;
}

.progress-lg {
  height: 12px;
}

.progress-bar {
  height: 100%;
  background-color: var(--brand);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}


/* ============================================
   24. PAGE HEADER & BREADCRUMB
   ============================================ */

.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.857rem;
  color: var(--muted-foreground);
  margin-bottom: 0.5rem;
}

.breadcrumb a {
  color: var(--muted-foreground);
  transition: color var(--transition-fast);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--foreground);
  text-decoration: none;
}

.breadcrumb span {
  color: var(--muted-foreground);
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--foreground);
}

.page-description {
  font-size: 0.857rem;
  color: var(--muted-foreground);
  line-height: var(--leading-normal);
}


/* ============================================
   25. ACTION BAR
   ============================================ */

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}


/* ============================================
   26. TABS
   ============================================ */

.tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.857rem;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}

.tab:hover {
  color: var(--foreground);
  text-decoration: none;
}

.tab.active {
  color: var(--foreground);
  border-bottom-color: var(--brand);
  font-weight: 600;
}


/* ============================================
   27. EMPTY STATE
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  gap: 0.5rem;
}

.empty-state-title {
  font-size: 1.143rem;
  font-weight: 600;
  color: var(--foreground);
}

.empty-state-description {
  font-size: 0.857rem;
  color: var(--muted-foreground);
  max-width: 400px;
  line-height: var(--leading-normal);
}


/* ============================================
   28. QUIZ
   ============================================ */

.quiz-question {
  font-size: 1.143rem;
  font-weight: 600;
  line-height: var(--leading-normal);
  margin-bottom: 1rem;
  color: var(--foreground);
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  margin-bottom: 0.5rem;
  font-size: 0.857rem;
}

.quiz-option:hover {
  background-color: var(--muted);
  border-color: oklch(1 0 0 / 20%);
}

.quiz-option.selected {
  background-color: var(--brand-muted);
  border-color: var(--brand);
  color: var(--foreground);
}

.quiz-option.correct {
  background-color: var(--success-muted);
  border-color: var(--success);
}

.quiz-option.incorrect {
  background-color: var(--danger-muted);
  border-color: var(--danger);
}

.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--foreground);
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.quiz-timer-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 1.125rem;
  color: var(--brand);
}


/* ============================================
   29. LESSON LAYOUT
   ============================================ */

.lesson-layout {
  display: flex;
  margin: -1.5rem;
  min-height: calc(100vh - var(--header-height));
}

.lesson-sidebar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  bottom: 0;
  width: var(--sidebar-width-lesson);
  overflow-y: auto;
  background-color: oklch(0.155 0 0);
  border-right: 1px solid var(--sidebar-border);
  padding: 1rem 0.75rem;
  z-index: 30;
}

.lesson-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.857rem;
  font-weight: 500;
  color: var(--sidebar-foreground);
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  margin-bottom: 0.125rem;
}

.lesson-sidebar-item:hover {
  background-color: var(--sidebar-accent);
  color: var(--sidebar-accent-foreground);
  text-decoration: none;
}

.lesson-sidebar-item.active {
  background-color: var(--brand-muted);
  color: var(--brand);
  font-weight: 600;
}

.lesson-sidebar-item.completed {
  color: var(--success);
}

.lesson-sidebar-item.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.lesson-sidebar-item.completed::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background-color: var(--success);
  flex-shrink: 0;
}

.lesson-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width-lesson);
  padding: 2rem 3rem;
  max-width: 860px;
  margin-right: auto;
  max-width: 800px;
}

@media (max-width: 768px) {
  .lesson-layout {
    flex-direction: column;
    margin: -1rem;
  }

  .lesson-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 0.75rem;
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lesson-sidebar-item {
    white-space: nowrap;
    margin-bottom: 0;
  }

  .lesson-content {
    margin-left: 0;
    padding: 1.5rem;
    max-width: none;
  }
}


/* ============================================
   30. LOGIN PAGE
   ============================================ */

.app-version {
  position: fixed;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  opacity: 0.5;
  z-index: 1;
  pointer-events: none;
}

.login-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background-color: #000;
  overflow: hidden;
}

.bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  filter: blur(4px) brightness(0.35);
  z-index: 0;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  padding: 2.5rem 2rem;
  background-color: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.login-logo-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  line-height: 1;
}

.login-title {
  font-size: 1.714rem;
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--foreground);
}

.login-description {
  font-size: 0.857rem;
  color: var(--muted-foreground);
  line-height: var(--leading-normal);
  max-width: 320px;
}


/* ============================================
   31. RESPONSIVE GRID BREAKPOINTS
   ============================================ */

@media (max-width: 640px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ============================================
   32. ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.animate-fade-in {
  animation: fadeIn var(--transition-normal) ease-out;
}

.animate-slide-up {
  animation: slide-up var(--transition-normal) ease-out;
}

.animate-slide-down {
  animation: slideDown var(--transition-normal) ease-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}


/* ============================================
   33. PRINT
   ============================================ */

@media print {
  .app-sidebar,
  .app-header,
  .flash-container,
  .sidebar-overlay,
  .mobile-menu-toggle {
    display: none !important;
  }

  body {
    display: block;
    background: #fff;
    color: #000;
    font-size: 12pt;
  }

  .app-main {
    margin-left: 0;
    min-height: auto;
  }

  .app-content {
    padding: 0;
    max-width: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .lesson-layout {
    display: block;
  }

  .lesson-sidebar {
    display: none !important;
  }

  .lesson-content {
    padding: 0;
    max-width: none;
    margin-left: 0;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .btn::after {
    content: none;
  }
}

/* File Attachment */
.file-attachment {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.file-attachment-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  flex-shrink: 0;
  background: var(--muted-foreground);
}

.file-icon-pdf { background: #e53e3e; }
.file-icon-doc { background: #2b6cb0; }
.file-icon-xls { background: #2f855a; }
.file-icon-ppt { background: #c05621; }
.file-icon-zip { background: #6b46c1; }
.file-icon-img { background: #d69e2e; }

.file-attachment-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.file-attachment-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-attachment-meta {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

/* Prose / Markdown Content */
.prose {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--foreground);
}

.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--foreground);
}

.prose h1 { font-size: 1.5rem; }
.prose h2 { font-size: 1.25rem; }
.prose h3 { font-size: 1.125rem; }
.prose h4 { font-size: 1rem; }

.prose p {
  margin-top: 0;
  margin-bottom: 1em;
}

.prose a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover {
  opacity: 0.8;
}

.prose strong {
  font-weight: 600;
  color: var(--foreground);
}

.prose em {
  font-style: italic;
}

.prose ul, .prose ol {
  margin-top: 0;
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }

.prose li {
  margin-bottom: 0.375em;
}

.prose li > ul, .prose li > ol {
  margin-top: 0.375em;
  margin-bottom: 0;
}

.prose blockquote {
  margin: 1em 0;
  padding: 0.75em 1em;
  border-left: 3px solid var(--brand);
  background: var(--muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--foreground);
}

.prose blockquote p {
  margin-bottom: 0.5em;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.8125em;
  padding: 0.15em 0.35em;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
}

.prose pre {
  margin: 1em 0;
  padding: 1em;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.prose pre code {
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  font-size: inherit;
}

.prose hr {
  margin: 1.5em 0;
  border: none;
  border-top: 1px solid var(--border);
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1em 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.875rem;
}

.prose table th,
.prose table td {
  padding: 0.5em 0.75em;
  border: 1px solid var(--border);
  text-align: left;
}

.prose table th {
  background: var(--muted);
  font-weight: 600;
}

.prose table tr:nth-child(even) {
  background: var(--muted);
}

.prose del {
  text-decoration: line-through;
  opacity: 0.6;
}

.prose input[type="checkbox"] {
  margin-right: 0.375em;
}

/* Weekly Availability Chart */
.avail-grid {
  display: grid;
  grid-template-columns: 140px repeat(8, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.8125rem;
}
.avail-hdr {
  background: var(--muted);
  padding: 0.5rem 0.25rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.75rem;
}
.avail-hdr-name {
  background: var(--muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.75rem;
}
.avail-day-date {
  font-weight: 400;
  color: var(--muted-foreground);
  font-size: 0.6875rem;
}
.avail-name {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  font-weight: 500;
  background: var(--card);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8125rem;
}
.avail-cell {
  position: relative;
  min-height: 2rem;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--card);
}
.avail-bar {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 3px;
  min-width: 2px;
}
.avail-bar-avail {
  background: color-mix(in srgb, var(--success) 25%, transparent);
  border: 1px solid var(--success);
  z-index: 1;
}
.avail-bar-full {
  background: color-mix(in srgb, var(--warning) 25%, transparent);
  border: 1px solid var(--warning);
  z-index: 1;
}
.avail-bar-sess {
  top: 6px;
  bottom: 6px;
  background: color-mix(in srgb, var(--brand) 30%, transparent);
  border: 1.5px dashed var(--brand);
  z-index: 2;
}
@media (max-width: 768px) {
  .avail-grid {
    grid-template-columns: 100px repeat(8, 1fr);
    font-size: 0.6875rem;
  }
  .avail-hdr { padding: 0.375rem 0.125rem; font-size: 0.625rem; }
  .avail-name { padding: 0.375rem 0.5rem; font-size: 0.6875rem; }
}

/* Spanning availability chart (bars cross day boundaries) */
.avail-grid-span {
  display: grid;
  grid-template-columns: 140px 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.8125rem;
}
.avail-row {
  position: relative;
  min-height: 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.avail-day-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  z-index: 0;
}
@media (max-width: 768px) {
  .avail-grid-span {
    grid-template-columns: 100px 1fr;
    font-size: 0.6875rem;
  }
}

/* Closeout Banner */
.closeout-banner {
  border: 1px solid var(--warning);
  background: var(--warning-muted);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}
.closeout-banner-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--warning);
  font-weight: 600;
  font-size: 0.875rem;
}
.closeout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  flex-wrap: wrap;
}
.closeout-item + .closeout-item {
  border-top: 1px solid var(--border);
}
