/*
 * theme_components.css — Component Styles
 * =========================================
 * All component styles for the enterprise bluish theme.
 *
 * RULES (from CLAUDE_UI_LOCK.md):
 *   - Every rule MUST start with .themed
 *   - Every component MUST use tokens from theme_tokens.css
 *   - No inline styles, no arbitrary hex values
 *   - Mobile breakpoints included for every component
 *
 * TABLE OF CONTENTS:
 *   1.  Layout — Sidebar, Header, Page Wrapper
 *   2.  Navigation — Sidebar links, sections, user info
 *   3.  Parent Navbar
 *   4.  Cards & Panels
 *   5.  Buttons
 *   6.  Form Elements
 *   7.  Tables
 *   8.  Badges & Chips
 *   9.  Status Indicators (Attendance)
 *  10.  Alerts & Flash Messages
 *  11.  Modals
 *  12.  Dropdowns
 *  13.  Stats & Metrics
 *  14.  AI & Insights Components
 *  15.  AI Workshop Components
 *  16.  Charts (CSS variables for JS consumption)
 *  17.  Interventions
 *  18.  Responsive — Mobile fixes
 */


/* =============================================================================
   1. LAYOUT — SIDEBAR, HEADER, PAGE WRAPPER
   ============================================================================= */

.themed .t-sidebar {
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-sm);
}

.themed .t-header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--shadow-sm);
}

.themed .t-page-wrapper {
  background-color: var(--color-canvas);
  min-height: 100vh;
}

.themed .t-main-content {
  background-color: var(--color-canvas);
}

/* Mobile backdrop for sidebar */
.themed .t-mobile-backdrop {
  background-color: var(--color-overlay);
}


/* =============================================================================
   2. NAVIGATION — SIDEBAR LINKS, SECTIONS, USER INFO
   ============================================================================= */

.themed .t-nav-link {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--nav-link-color);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  transition: background-color var(--transition-fast),
              color var(--transition-fast);
  text-decoration: none;
  gap: var(--space-2-5);
  position: relative;
}

.themed .t-nav-link:hover {
  background-color: var(--nav-link-hover-bg);
  color: var(--nav-link-hover-color);
  text-decoration: none;
}

.themed .t-nav-link.active {
  background-color: var(--nav-link-active-bg);
  color: var(--nav-link-active-text);
  font-weight: var(--font-weight-medium);
}

/* Left border accent on active nav item */
.themed .t-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 3px;
  background-color: var(--nav-link-active-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.themed .t-nav-link svg {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  transition: color var(--transition-fast);
}

.themed .t-nav-section-header {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--nav-section-color);
  text-transform: uppercase;
  letter-spacing: 0.075em;
  padding: var(--space-2) var(--space-4) var(--space-1);
  margin-top: var(--space-2);
}

.themed .t-nav-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-3) var(--space-3);
}

.themed .t-user-info {
  background-color: var(--nav-user-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-4);
}

.themed .t-user-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-600);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
}

.themed .t-user-name {
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-base);
  line-height: var(--leading-tight);
}

.themed .t-user-role {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}


/* =============================================================================
   3. PARENT NAVBAR
   ============================================================================= */

.themed .t-parent-navbar {
  background-color: var(--color-primary-800);
  box-shadow: var(--shadow-md);
}

.themed .t-parent-nav-link {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transition: background-color var(--transition-fast),
              color var(--transition-fast);
  gap: var(--space-2);
}

.themed .t-parent-nav-link:hover {
  background-color: var(--color-primary-700);
  color: var(--color-text-inverse);
  text-decoration: none;
}

.themed .t-parent-nav-link.active {
  background-color: var(--color-primary-700);
  color: var(--color-text-inverse);
}

.themed .t-parent-mobile-menu {
  background-color: var(--color-primary-900);
  border-top: 1px solid var(--color-primary-700);
}

.themed .t-parent-mobile-link {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--text-base);
  text-decoration: none;
  gap: var(--space-2-5);
  transition: background-color var(--transition-fast);
}

.themed .t-parent-mobile-link:hover {
  background-color: var(--color-primary-800);
  text-decoration: none;
}

.themed .t-parent-footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-subtle);
  font-size: var(--text-sm);
}


/* =============================================================================
   4. CARDS & PANELS
   ============================================================================= */

.themed .t-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.themed .t-card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.themed .t-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  margin: 0;
}

.themed .t-card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-0-5);
}

.themed .t-card-body {
  padding: var(--space-6);
}

.themed .t-card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface-muted);
}

/* Compact card variant */
.themed .t-card-sm .t-card-header {
  padding: var(--space-3) var(--space-4);
}
.themed .t-card-sm .t-card-body {
  padding: var(--space-4);
}

/* Panel — full-width section divider */
.themed .t-panel {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Info panel — highlighted */
.themed .t-panel-info {
  background-color: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  color: var(--color-info-text);
  font-size: var(--text-base);
}


/* =============================================================================
   5. BUTTONS
   ============================================================================= */

.themed .t-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast),
              box-shadow var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.themed .t-btn:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.themed .t-btn:disabled,
.themed .t-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.themed .t-btn-primary {
  background-color: var(--color-primary-600);
  border-color: var(--color-primary-600);
  color: var(--color-text-inverse);
}
.themed .t-btn-primary:hover {
  background-color: var(--color-primary-700);
  border-color: var(--color-primary-700);
}
.themed .t-btn-primary:active {
  background-color: var(--color-primary-800);
}

/* Secondary */
.themed .t-btn-secondary {
  background-color: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text-base);
}
.themed .t-btn-secondary:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-strong);
}

/* Danger */
.themed .t-btn-danger {
  background-color: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger-text);
}
.themed .t-btn-danger:hover {
  background-color: #fecaca;
  border-color: var(--color-danger-text);
}

/* Ghost */
.themed .t-btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}
.themed .t-btn-ghost:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text-base);
}

/* Success */
.themed .t-btn-success {
  background-color: var(--color-success-text);
  border-color: var(--color-success-text);
  color: var(--color-text-inverse);
}
.themed .t-btn-success:hover {
  background-color: #166534;
  border-color: #166534;
}

/* Size variants */
.themed .t-btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  gap: var(--space-1-5);
}

.themed .t-btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-lg);
}

.themed .t-btn-xl {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
}

/* Icon-only button */
.themed .t-btn-icon {
  padding: var(--space-2);
  width: 2.25rem;
  height: 2.25rem;
}
.themed .t-btn-icon.t-btn-sm {
  width: 1.75rem;
  height: 1.75rem;
  padding: var(--space-1);
}


/* =============================================================================
   6. FORM ELEMENTS
   ============================================================================= */

.themed .t-label {
  display: block;
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-base);
  margin-bottom: var(--space-1-5);
}

.themed .t-label-required::after {
  content: ' *';
  color: var(--color-danger-text);
}

.themed .t-input,
.themed .t-select,
.themed .t-textarea {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-text-base);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  line-height: var(--leading-normal);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.themed .t-input::placeholder,
.themed .t-textarea::placeholder {
  color: var(--color-text-subtle);
}

.themed .t-input:hover,
.themed .t-select:hover,
.themed .t-textarea:hover {
  border-color: var(--color-border-focus);
}

.themed .t-input:focus,
.themed .t-select:focus,
.themed .t-textarea:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

.themed .t-input:disabled,
.themed .t-select:disabled,
.themed .t-textarea:disabled {
  background-color: var(--color-surface-muted);
  color: var(--color-text-subtle);
  cursor: not-allowed;
}

/* Select with caret */
.themed .t-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

.themed .t-textarea {
  resize: vertical;
  min-height: 5rem;
}

/* Error state */
.themed .t-input-error {
  border-color: var(--color-border-error);
}
.themed .t-input-error:focus {
  box-shadow: 0 0 0 3px var(--color-danger-bg);
  border-color: var(--color-border-error);
}

/* Checkbox / Radio — defensive override
   t-input sets width:100% which stretches checkboxes into full-width bars.
   This higher-specificity rule (0,3,1) beats t-input (0,2,0) without !important. */
.themed input[type="checkbox"].t-input,
.themed input[type="radio"].t-input {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  padding: 0;
  accent-color: var(--color-primary-600);
}

/* Dedicated boolean-field hook — prefer t-checkbox over t-input on checkboxes */
.themed .t-checkbox {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  accent-color: var(--color-primary-600);
}

/* Form group */
.themed .t-form-group {
  margin-bottom: var(--space-5);
}

/* In inline flex rows (filter bars, header forms), remove the bottom margin so
   items-end can properly align form groups with sibling buttons. */
.themed .flex > .t-form-group,
.themed form.flex .t-form-group {
  margin-bottom: 0;
}

/* Form hint / helper text */
.themed .t-form-hint {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
}
.themed .t-form-error {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-danger-text);
}

/* Checkbox / Radio */
.themed .t-checkbox,
.themed .t-radio {
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  cursor: pointer;
  accent-color: var(--color-primary-600);
}

/* Search input with icon */
.themed .t-search-wrapper {
  position: relative;
}
.themed .t-search-wrapper .t-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  width: 1rem;
  height: 1rem;
  pointer-events: none;
}
.themed .t-input-search {
  padding-left: 2.25rem;
}


/* =============================================================================
   7. TABLES
   ============================================================================= */

.themed .t-table-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background-color: var(--color-surface);
}

.themed .t-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.themed .t-table thead {
  background-color: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
}

.themed .t-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.themed .t-table td {
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-base);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

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

.themed .t-table tbody tr:hover {
  background-color: var(--color-surface-hover);
}

/* Compact table */
.themed .t-table-compact th,
.themed .t-table-compact td {
  padding: var(--space-2) var(--space-3);
}

/* Striped table */
.themed .t-table-striped tbody tr:nth-child(even) {
  background-color: var(--color-surface-muted);
}

/* Numeric column alignment */
.themed .t-table .t-col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* Responsive table wrapper */
.themed .t-table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}


/* =============================================================================
   8. BADGES & CHIPS
   ============================================================================= */

.themed .t-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-0-5) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
  white-space: nowrap;
}

.themed .t-badge-success {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
}
.themed .t-badge-warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: 1px solid var(--color-warning-border);
}
.themed .t-badge-danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid var(--color-danger-border);
}
.themed .t-badge-info {
  background-color: var(--color-info-bg);
  color: var(--color-info-text);
  border: 1px solid var(--color-info-border);
}
.themed .t-badge-neutral {
  background-color: var(--color-surface-muted);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.themed .t-badge-primary {
  background-color: var(--color-primary-50);
  color: var(--color-primary-700);
  border: 1px solid var(--color-primary-200);
}

/* Dot indicator */
.themed .t-badge-dot::before {
  content: '';
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--radius-full);
  background-color: currentColor;
  flex-shrink: 0;
}


/* =============================================================================
   9. STATUS INDICATORS — ATTENDANCE
   ============================================================================= */

.themed .t-status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--transition-fast),
              box-shadow var(--transition-fast);
  user-select: none;
}

/* Present */
.themed .t-status-present {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  border-color: var(--color-success-border);
}
.themed .t-status-present.active,
.themed .t-status-present[data-active="true"] {
  background-color: var(--color-success-text);
  color: var(--color-text-inverse);
  box-shadow: 0 0 0 2px var(--color-success-border);
}

/* Absent */
.themed .t-status-absent {
  background-color: var(--color-danger-bg);
  color: var(--color-danger-text);
  border-color: var(--color-danger-border);
}
.themed .t-status-absent.active,
.themed .t-status-absent[data-active="true"] {
  background-color: var(--color-danger-text);
  color: var(--color-text-inverse);
  box-shadow: 0 0 0 2px var(--color-danger-border);
}

/* Late */
.themed .t-status-late {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
  border-color: var(--color-warning-border);
}
.themed .t-status-late.active,
.themed .t-status-late[data-active="true"] {
  background-color: var(--color-warning-text);
  color: var(--color-text-inverse);
  box-shadow: 0 0 0 2px var(--color-warning-border);
}

/* Excused */
.themed .t-status-excused {
  background-color: var(--color-info-bg);
  color: var(--color-info-text);
  border-color: var(--color-info-border);
}
.themed .t-status-excused.active,
.themed .t-status-excused[data-active="true"] {
  background-color: var(--color-info-text);
  color: var(--color-text-inverse);
  box-shadow: 0 0 0 2px var(--color-info-border);
}

/* Early departure */
.themed .t-status-early {
  background-color: var(--color-surface-muted);
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.themed .t-status-early.active,
.themed .t-status-early[data-active="true"] {
  background-color: var(--color-text-muted);
  color: var(--color-text-inverse);
}

/* Counter tile for attendance summary */
.themed .t-stat-tile {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.themed .t-stat-tile-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.themed .t-stat-tile-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}


/* =============================================================================
   10. ALERTS & FLASH MESSAGES
   ============================================================================= */

.themed .t-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border-width: 1px;
  border-style: solid;
  border-left-width: 4px;
  font-size: var(--text-base);
}

.themed .t-alert-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 1px;
}

.themed .t-alert-success {
  background-color: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}
.themed .t-alert-warning {
  background-color: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}
.themed .t-alert-danger {
  background-color: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger-text);
}
.themed .t-alert-info {
  background-color: var(--color-info-bg);
  border-color: var(--color-info-border);
  color: var(--color-info-text);
}


/* =============================================================================
   11. MODALS
   ============================================================================= */

.themed .t-modal-backdrop {
  background-color: var(--color-overlay);
}

.themed .t-modal-panel {
  background-color: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.themed .t-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.themed .t-modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  margin: 0;
}

.themed .t-modal-body {
  padding: var(--space-6);
}

.themed .t-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface-muted);
}

.themed .t-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.themed .t-modal-close:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-text-base);
}


/* =============================================================================
   12. DROPDOWNS
   ============================================================================= */

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

.themed .t-dropdown-menu {
  position: absolute;
  z-index: var(--z-dropdown);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 10rem;
  overflow: hidden;
  padding: var(--space-1);
}

.themed .t-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  color: var(--color-text-base);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.themed .t-dropdown-item:hover {
  background-color: var(--color-surface-hover);
  text-decoration: none;
}

.themed .t-dropdown-item-danger {
  color: var(--color-danger-text);
}
.themed .t-dropdown-item-danger:hover {
  background-color: var(--color-danger-bg);
}

.themed .t-dropdown-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-1) 0;
}


/* =============================================================================
   13. STATS & METRICS (Page-level stat cards)
   ============================================================================= */

.themed .t-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.themed .t-stat-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.themed .t-stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.themed .t-stat-icon-primary {
  background-color: var(--color-primary-50);
  color: var(--color-primary-600);
}
.themed .t-stat-icon-success {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
}
.themed .t-stat-icon-warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
}
.themed .t-stat-icon-danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.themed .t-stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-base);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.themed .t-stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
}

.themed .t-stat-change {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.themed .t-stat-change-up { color: var(--color-success-text); }
.themed .t-stat-change-down { color: var(--color-danger-text); }
.themed .t-stat-change-neutral { color: var(--color-text-muted); }

/* Page header with actions */
.themed .t-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.themed .t-page-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  margin: 0;
  line-height: var(--leading-tight);
}

.themed .t-page-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.themed .t-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.themed .t-section-title {
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  margin: 0;
}

/* Separator */
.themed .t-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}


/* =============================================================================
   14. AI & INSIGHTS COMPONENTS
   ============================================================================= */

/* Insight card (severity-colored) */
.themed .t-insight-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.themed .t-insight-card-critical {
  border-left: 4px solid var(--color-danger-text);
}
.themed .t-insight-card-warning {
  border-left: 4px solid var(--color-warning-icon);
}
.themed .t-insight-card-info {
  border-left: 4px solid var(--color-info-icon);
}

/* AI report content */
.themed .t-ai-section-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
  break-inside: avoid;
}

/* Entity anonymization badges */
.themed .t-ai-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-0-5) var(--space-1-5);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  font-weight: var(--font-weight-semibold);
}
.themed .t-ai-badge-student {
  background-color: var(--color-primary-50);
  color: var(--color-primary-700);
  border: 1px solid var(--color-primary-200);
}
.themed .t-ai-badge-teacher {
  background-color: #f0fdfa;
  color: #0d9488;
  border: 1px solid #99f6e4;
}

/* AI report section body */
.themed .t-ai-section-body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-base);
}
.themed .t-ai-section-body ul {
  list-style: disc;
  padding-left: var(--space-5);
  margin: var(--space-2) 0;
}
.themed .t-ai-section-body li {
  margin-bottom: var(--space-1-5);
}
.themed .t-ai-section-body strong {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
}
.themed .t-ai-section-body p {
  margin-bottom: var(--space-3);
}


/* =============================================================================
   15. AI WORKSHOP COMPONENTS
   ============================================================================= */

.themed .t-workshop-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
  overflow: hidden;
}

.themed .t-workshop-card:hover {
  box-shadow: var(--shadow-md);
}

.themed .t-workshop-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

/* Source type badge */
.themed .t-workshop-badge-text {
  background-color: var(--color-primary-50);
  color: var(--color-primary-700);
}
.themed .t-workshop-badge-file {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
}

/* Difficulty badges */
.themed .t-difficulty-easy {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
}
.themed .t-difficulty-medium {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: 1px solid var(--color-warning-border);
}
.themed .t-difficulty-hard {
  background-color: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid var(--color-danger-border);
}

/* API usage widget */
.themed .t-api-usage-widget {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

/* Workshop slide — minimal override, keep fullscreen intact */
.themed .t-workshop-slide-container {
  background-color: var(--color-canvas);
}


/* =============================================================================
   16. CHART CONTAINERS (CSS context for JS)
   ============================================================================= */

/* Chart.js reads CSS vars via getComputedStyle — defined on .themed body */
/* See CLAUDE_UI_LOCK.md §Chart Integration for JS usage */

.themed .t-chart-container {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}

.themed .t-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.themed .t-chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
}

.themed .t-chart-legend-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Correlation indicator display */
.themed .t-correlation-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1-5) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
}
.themed .t-correlation-good {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
}
.themed .t-correlation-ok {
  background-color: var(--color-warning-bg);
  color: var(--color-warning-text);
}
.themed .t-correlation-poor {
  background-color: var(--color-danger-bg);
  color: var(--color-danger-text);
}


/* =============================================================================
   17. INTERVENTION COMPONENTS
   ============================================================================= */

.themed .t-intervention-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}

/* Priority indicators */
.themed .t-priority-urgent {
  border-left: 4px solid var(--color-danger-text);
}
.themed .t-priority-high {
  border-left: 4px solid var(--color-warning-icon);
}
.themed .t-priority-medium {
  border-left: 4px solid var(--color-info-icon);
}
.themed .t-priority-low {
  border-left: 4px solid var(--color-border-strong);
}

/* Timeline item */
.themed .t-timeline-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
}
.themed .t-timeline-item:last-child {
  border-bottom: none;
}

.themed .t-timeline-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-600);
  flex-shrink: 0;
  margin-top: 0.375rem;
}

/* Conversation message bubbles — t-msg-* classes are on the outer flex row wrapper,
   not the inner bubble div. Visual styling (bg, color, border-radius) lives in
   Tailwind classes on the inner bubble div. These rules are layout-only. */
.themed .t-msg-bubble {
  max-width: 75%;
}

.themed .t-msg-sent {
  /* layout only — inner bubble div carries bg-blue-600 text-white */
}

.themed .t-msg-received {
  /* layout only — inner bubble div carries bg-white border border-gray-200 */
}

/* Login page container */
.themed .t-auth-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 24rem;
}

.themed .t-auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}


/* =============================================================================
   19. LOGIN PAGE — Split-panel layout (Claude-style)
   ============================================================================= */

/* Page wrapper — exact viewport fill, no page scroll on login */
.themed .t-login-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--color-canvas);
}

/* ── Top navbar ── */
.themed .t-login-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
  height: var(--header-height);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.themed .t-login-nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.themed .t-login-nav-brand-logo {
  height: 2rem;
  width: auto;
}

.themed .t-login-nav-brand-name {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-base);
  letter-spacing: -0.01em;
}

.themed .t-login-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.themed .t-login-nav-link {
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.themed .t-login-nav-link:hover {
  color: var(--color-text-base);
}

/* ── Two-column body — fills remaining viewport height ── */
.themed .t-login-body {
  display: grid;
  grid-template-columns: 42fr 58fr;   /* slightly wider visual panel */
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* ── Left column — form ── */
.themed .t-login-left {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-10);
  background-color: var(--color-surface);
  overflow-y: auto;
}

.themed .t-login-form-wrap {
  width: 100%;
  max-width: 24rem;
}

.themed .t-login-form-logo {
  height: 3rem;
  width: auto;
  margin-bottom: var(--space-3);
}

.themed .t-login-form-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-base);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-1);
}

.themed .t-login-form-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

/* Auth card override inside login — fill full wrap width */
.themed .t-login-left .t-auth-card {
  max-width: 100%;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  background-color: var(--color-surface);
}

/* ── Right column — product visual ── */
.themed .t-login-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-10) var(--space-8);
  background: linear-gradient(
    148deg,
    var(--color-primary-50)  0%,
    var(--color-primary-100) 55%,
    var(--color-primary-200) 100%
  );
  position: relative;
  overflow: hidden;
}

/* Subtle dot-grid background decoration */
.themed .t-login-right::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--color-primary-300) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.25;
  pointer-events: none;
}

.themed .t-login-preview-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  text-align: center;
}

.themed .t-login-preview-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-xl);
  box-shadow:
    0 0 0 1px var(--color-primary-200),
    var(--shadow-xl);
  display: block;
}

/* Hero slogan block (above preview image) */
.themed .t-login-hero {
  text-align: center;
  margin-bottom: var(--space-8);
}

.themed .t-login-hero-title {
  font-size: 1.75rem;           /* between text-2xl and text-3xl */
  font-weight: var(--font-weight-bold);
  color: var(--color-primary-900);
  letter-spacing: -0.025em;
  line-height: var(--leading-tight);
}

.themed .t-login-hero-slogan {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  font-style: italic;
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-600);
  line-height: var(--leading-relaxed);
}

/* Blinking cursor shown while the typewriter JS is running */
.themed .t-login-hero-slogan.t-login-slogan-typing::after {
  content: '|';
  color: var(--color-primary-400);
  font-style: normal;
  font-weight: var(--font-weight-normal);
  animation: t-cursor-blink 0.65s step-end infinite;
}

@keyframes t-cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.themed .t-login-preview-caption {
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary-700);
}

/* Placeholder shown when login-preview.png not yet provided */
.themed .t-login-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-12) var(--space-10);
  border: 2px dashed var(--color-primary-300);
  border-radius: var(--radius-xl);
  background-color: rgba(255, 255, 255, 0.45);
}

.themed .t-login-placeholder-icon {
  width: 7rem;
  height: auto;
  color: var(--color-primary-400);
}

.themed .t-login-placeholder-label {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary-700);
}

.themed .t-login-placeholder-hint {
  font-size: var(--text-sm);
  color: var(--color-primary-500);
  text-align: center;
  line-height: var(--leading-relaxed);
}

/* ── Responsive ── */

/* Tablet ≤1024px: single column, hide visual */
@media (max-width: 1024px) {
  .themed .t-login-body {
    grid-template-columns: 1fr;
  }
  .themed .t-login-right {
    display: none;
  }
}

/* Mobile ≤640px: compact navbar, tighter padding */
@media (max-width: 640px) {
  .themed .t-login-nav {
    padding: 0 var(--space-4);
  }
  .themed .t-login-nav-links {
    display: none;
  }
  .themed .t-login-left {
    padding: var(--space-8) var(--space-4);
    align-items: flex-start;
  }
}


/* =============================================================================
   18. RESPONSIVE — MOBILE FIXES
   ============================================================================= */

/* Tablet breakpoint — 768px */
@media (max-width: 768px) {

  /* Stats grid: 2 columns on tablet */
  .themed .t-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  /* Page header: stack vertically */
  .themed .t-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  /* Cards: reduce padding */
  .themed .t-card-header {
    padding: var(--space-4);
  }
  .themed .t-card-body {
    padding: var(--space-4);
  }
  .themed .t-card-footer {
    padding: var(--space-3) var(--space-4);
  }

  /* Modals: full-width on mobile */
  .themed .t-modal-panel {
    margin: var(--space-4);
    border-radius: var(--radius-lg);
  }
  .themed .t-modal-body {
    padding: var(--space-4);
  }
  .themed .t-modal-header,
  .themed .t-modal-footer {
    padding: var(--space-4);
  }

  /* Tables: force scroll wrapper */
  .themed .t-table-responsive {
    overflow-x: auto;
  }

  /* Buttons: allow wrapping */
  .themed .t-btn-group {
    flex-wrap: wrap;
  }

  /* Workshop cards: full width */
  .themed .t-workshop-grid {
    grid-template-columns: 1fr;
  }

  /* Conversation bubbles */
  .themed .t-msg-bubble {
    max-width: 90%;
  }
}

/* Mobile breakpoint — 480px */
@media (max-width: 480px) {

  /* Stats grid: single column on small mobile */
  .themed .t-stats-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  /* Stat tiles for attendance: 2 columns */
  .themed .t-attendance-counters {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Auth card: no horizontal padding */
  .themed .t-auth-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: var(--space-6) var(--space-4);
    max-width: 100%;
  }

  /* Status buttons: smaller on narrow screens */
  .themed .t-status-btn {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-sm);
  }

  /* Table: reduce cell padding */
  .themed .t-table th,
  .themed .t-table td {
    padding: var(--space-2);
    font-size: var(--text-sm);
  }

  /* Nav link text: slightly smaller */
  .themed .t-nav-link {
    font-size: var(--text-sm);
    padding: var(--space-1-5) var(--space-3);
  }

  /* Button groups: full-width stack */
  .themed .t-btn-group-mobile-stack {
    flex-direction: column;
    width: 100%;
  }
  .themed .t-btn-group-mobile-stack .t-btn {
    width: 100%;
    justify-content: center;
  }

  /* Page title: smaller */
  .themed .t-page-title {
    font-size: var(--text-2xl);
  }
}

/* Large screen — 1280px */
@media (min-width: 1280px) {

  /* Stats grid: up to 4 columns */
  .themed .t-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   Hero / Gamification Banner
   ============================================ */
.themed .t-hero-banner {
  background: linear-gradient(to right, var(--color-primary-600), var(--color-primary-800));
  color: var(--color-text-inverse);
}

/* ============================================================
   TIMETABLE / EMPLOI DU TEMPS
   ============================================================
   Grid: 20 half-hour rows (08:00–18:00) × 6 day columns.
   Row and column positions are computed by TimetableService
   and applied via pre-generated CSS classes (.t-slot-row-N,
   .t-slot-col-N, .t-slot-span-N) — NO inline styles (R1).

   Grid coordinate system:
     Row 1  = 08:00   Row 11 = 13:00
     Row 2  = 08:30   Row 12 = 13:30
     Row 10 = 12:30   Row 20 = 17:30
     Col 1  = Lundi   Col 6  = Samedi
   ============================================================ */

/* Wrapper */
.themed .t-timetable-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

/* CSS Grid definition */
.themed .t-timetable-grid {
  display: grid;
  grid-template-columns: 52px repeat(6, 1fr);
  /* Row 1 = day headers, rows 2–21 = time slots (20 × 30-min = 40px each) */
  grid-template-rows: 52px repeat(20, 44px);
  min-width: 640px;
  position: relative;
}

/* Time label column cells */
.themed .t-timetable-time-label {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 2px 6px 0 0;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
}

/* Day header cells */
.themed .t-timetable-day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  background: var(--color-surface-alt);
  border-bottom: 2px solid var(--color-border);
  border-right: 1px solid var(--color-border-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.themed .t-timetable-day-header.is-today {
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  border-bottom-color: var(--color-primary-400);
}

/* Empty background cells (even rows = alternate shading) */
.themed .t-timetable-cell {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border-light);
  border-bottom: 1px dashed #f0f0f0;
}

.themed .t-timetable-cell:nth-child(even) {
  background: #fafafa;
}

/* Admin mode: clickable empty cells */
.themed .t-timetable-cell.is-clickable {
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}

.themed .t-timetable-cell.is-clickable:hover {
  background: var(--color-primary-50);
}

/* "+" add hint inside each empty cell (admin mode) */
.themed .t-cell-add-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 300;
  color: #cbd5e1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  user-select: none;
}

.themed .t-timetable-cell.is-clickable:hover .t-cell-add-hint {
  opacity: 1;
  color: var(--color-primary-400);
}

/* Today column highlight */
.themed .t-timetable-cell.is-today {
  background: rgba(239, 246, 255, 0.6);
}

/* ── Slot blocks ─────────────────────────────── */

.themed .t-slot-block {
  position: relative;
  margin: 2px;
  border-radius: 6px;
  padding: 4px 6px;
  overflow: hidden;
  font-size: 0.7rem;
  line-height: 1.3;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s;
  border-left: 3px solid transparent;
  z-index: 1;
}

.themed .t-slot-block:hover {
  filter: brightness(0.95);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* Status variants */
.themed .t-slot-none {
  background: #f8f9fa;
  border-left-color: #cbd5e1;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-left: 3px dashed #94a3b8;
}

.themed .t-slot-draft {
  background: #fffbeb;
  border-left-color: #f59e0b;
  color: #92400e;
  border: 1px solid #fde68a;
}

.themed .t-slot-published {
  background: #f0fdf4;
  border-left-color: #22c55e;
  color: #14532d;
  border: 1px solid #bbf7d0;
}

.themed .t-slot-today {
  box-shadow: 0 0 0 2px var(--color-primary-200);
}

/* Slot subject label */
.themed .t-slot-subject {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Slot class label */
.themed .t-slot-class {
  font-size: 0.65rem;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Slot time label */
.themed .t-slot-time {
  font-size: 0.6rem;
  opacity: 0.7;
  margin-top: 2px;
}

/* Admin action buttons inside slot */
.themed .t-slot-actions {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}

.themed .t-slot-block:hover .t-slot-actions {
  opacity: 1;
}

.themed .t-slot-action-btn {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: rgba(255,255,255,0.7);
  color: #475569;
  cursor: pointer;
  border: none;
  padding: 0;
}

.themed .t-slot-action-btn:hover {
  background: rgba(255,255,255,0.95);
  color: #1e293b;
}

/* ── Legend ─────────────────────────────────── */

.themed .t-timetable-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.themed .t-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.themed .t-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Pre-generated grid row positions (08:00–17:30) ── */
/* Row 1 = 08:00, Row 2 = 08:30, ..., Row 20 = 17:30   */
/* grid-row offsets +1 because row 1 = day headers       */

.themed .t-slot-row-1  { grid-row: 2; }
.themed .t-slot-row-2  { grid-row: 3; }
.themed .t-slot-row-3  { grid-row: 4; }
.themed .t-slot-row-4  { grid-row: 5; }
.themed .t-slot-row-5  { grid-row: 6; }
.themed .t-slot-row-6  { grid-row: 7; }
.themed .t-slot-row-7  { grid-row: 8; }
.themed .t-slot-row-8  { grid-row: 9; }
.themed .t-slot-row-9  { grid-row: 10; }
.themed .t-slot-row-10 { grid-row: 11; }
.themed .t-slot-row-11 { grid-row: 12; }
.themed .t-slot-row-12 { grid-row: 13; }
.themed .t-slot-row-13 { grid-row: 14; }
.themed .t-slot-row-14 { grid-row: 15; }
.themed .t-slot-row-15 { grid-row: 16; }
.themed .t-slot-row-16 { grid-row: 17; }
.themed .t-slot-row-17 { grid-row: 18; }
.themed .t-slot-row-18 { grid-row: 19; }
.themed .t-slot-row-19 { grid-row: 20; }
.themed .t-slot-row-20 { grid-row: 21; }

/* ── Row span classes (duration in 30-min increments) ── */
.themed .t-slot-span-1  { grid-row: span 1; }   /* 30 min  */
.themed .t-slot-span-2  { grid-row: span 2; }   /* 1 hour  */
.themed .t-slot-span-3  { grid-row: span 3; }   /* 1.5 h   */
.themed .t-slot-span-4  { grid-row: span 4; }   /* 2 hours */
.themed .t-slot-span-5  { grid-row: span 5; }   /* 2.5 h   */
.themed .t-slot-span-6  { grid-row: span 6; }   /* 3 hours */
.themed .t-slot-span-8  { grid-row: span 8; }   /* 4 hours */
.themed .t-slot-span-10 { grid-row: span 10; }  /* 5 hours */
.themed .t-slot-span-12 { grid-row: span 12; }  /* 6 hours */

/* ── Day column positions (1=Lundi .. 6=Samedi) ── */
/* +1 offset because column 1 = time labels         */
.themed .t-slot-col-1 { grid-column: 2; }  /* Lundi    */
.themed .t-slot-col-2 { grid-column: 3; }  /* Mardi    */
.themed .t-slot-col-3 { grid-column: 4; }  /* Mercredi */
.themed .t-slot-col-4 { grid-column: 5; }  /* Jeudi    */
.themed .t-slot-col-5 { grid-column: 6; }  /* Vendredi */
.themed .t-slot-col-6 { grid-column: 7; }  /* Samedi   */

/* ── Mobile: collapse grid to vertical day list ── */
@media (max-width: 768px) {
  .themed .t-timetable-grid {
    display: block;
    min-width: unset;
  }

  .themed .t-timetable-wrapper {
    overflow-x: unset;
  }

  .themed .t-slot-block {
    position: static !important;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .themed .t-timetable-day-header,
  .themed .t-timetable-time-label {
    display: none;
  }

  .themed .t-slot-actions {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .themed .t-timetable-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .themed .t-timetable-grid {
    display: grid;
    min-width: 500px;
  }
}
