/**
 * EC-IELTS DESIGN SYSTEM
 * 
 * Unified design system with centralized tokens in /static/css/tokens/
 * This file serves as the main stylesheet and component definitions.
 * 
 * Token Hierarchy:
 * 1. /tokens/base.css - Core design tokens (colors, spacing, typography, effects)
 * 2. /tokens/light-theme.css - Light mode refinements
 * 3. /tokens/dark-theme.css - Dark mode refinements
 * 4. /tokens/legacy-compat.css - Backward compatibility layer for existing code
 * 5. design.css (this file) - Component styles and utilities
 * 
 * Multi-Tenant Branding:
 * - Tenant-specific colors flow through context processor
 * - Brand tokens override base accent color
 * - Theme system applies after branding
 */

@import url("./tokens/base.css");
@import url("./tokens/light-theme.css");
@import url("./tokens/dark-theme.css");
@import url("./tokens/legacy-compat.css");

/* ============================================================================
   CENTRALIZED COMPONENT SYSTEM
   ============================================================================
   These files contain reusable component styles for all UI elements.
   Each component is designed to work with the token system and all themes.
*/
@import url("./components/buttons.css");
@import url("./components/forms.css");
@import url("./components/cards.css");
@import url("./components/tables.css");
@import url("./components/modals.css");
@import url("./components/filters.css");
@import url("./components/badges.css");
@import url("./components/dropdowns.css");
@import url("./components/pagination.css");
@import url("./components/toggles.css");
@import url("./components/empty-states.css");

html {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

/* System preference: Respect OS dark mode when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
}
.heading-font {
  font-family: var(--font-heading);
}
.supporting-font {
  font-family: var(--font-supporting);
}
main.container {
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

main.container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}
.topbar {
  position: sticky;
  top: 0;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  z-index: 1000;
  height: 72px;
  display: flex;
  align-items: center;
}
html[data-theme="dark"] .topbar {
  background: color-mix(in oklab, var(--surface) 82%, transparent);
}
.topbar-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-items: center;
  max-width: 100%;
  padding: 0 var(--space-4);
  height: 100%;
  width: min(100%, var(--content-max-width));
  margin: 0 auto;
  gap: var(--space-4);
}
.topbar.has-sidebar .topbar-shell {
  width: 100%;
  margin: 0;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.nav-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease);
}
.nav-toggle:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.brand-mark {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
}
.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
}
.brand-text {
  white-space: nowrap;
}
.workspace-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
}
.workspace-pill:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.nav {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  white-space: nowrap;
}
.nav-item {
  color: var(--color-text);
  text-decoration: none;
  padding: 0 var(--space-3);
  min-height: 44px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--dur-base) var(--ease);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--border-subtle);
  background: var(--bg);
}

/* Navbar icon and label for mixed content items */
.nav-item .nav-icon {
  font-size: 18px;
  vertical-align: middle;
  line-height: 1;
}

.nav-item .nav-label {
  line-height: 1.2;
}
.nav-item:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.nav-item.button {
  background: var(--accent-button);
  color: white;
  padding: 0 var(--space-4);
  min-height: 44px;
  border-radius: 999px;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.nav-item.button:hover {
  background: var(--accent-strong);
  box-shadow: var(--shadow-md);
}
.ielts-listening-mcq {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 900px) {
  .ielts-listening-mcq {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    align-items: start;
  }
}
.ielts-listening-mcq__media {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
  display: grid;
  gap: var(--space-2);
}
.ielts-listening-mcq__audio {
  width: 100%;
}
.ielts-listening-mcq__hint {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}
.ielts-listening-mcq__content {
  display: grid;
  gap: var(--space-3);
}
.ielts-listening-mcq__meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}
.ielts-listening-mcq__prompt {
  font-size: 1.1rem;
  font-weight: 600;
}
.ielts-listening-mcq__instruction {
  color: var(--color-text-muted);
  font-weight: 500;
}
.ielts-listening-mcq__options {
  display: grid;
  gap: var(--space-2);
}
.ielts-listening-mcq__option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 44px;
  cursor: pointer;
  transition:
    transform var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease);
}
.ielts-listening-mcq__option:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}
.ielts-listening-mcq__option input {
  margin-top: 2px;
}
.ielts-listening-mcq__option-body {
  display: grid;
  gap: 2px;
}
.ielts-listening-mcq__option-label {
  font-weight: 700;
}
.ielts-listening-mcq__option-text {
  color: var(--text);
}
.pte-listening-mcq {
  display: grid;
  gap: var(--space-4);
}
.pte-listening-mcq__intro,
.pte-listening-mcq__player,
.pte-listening-mcq__content {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
  display: grid;
  gap: var(--space-3);
}
.pte-listening-mcq__title {
  font-size: 1.2rem;
  font-weight: 700;
}
.pte-listening-mcq__prompt,
.pte-listening-mcq__question {
  font-size: 1.05rem;
  font-weight: 600;
}
.pte-listening-mcq__note {
  color: var(--color-text-muted);
}
.pte-listening-mcq__player-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}
.pte-listening-mcq__timer {
  color: var(--color-text-muted);
  font-weight: 600;
}
.pte-listening-mcq__progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.pte-listening-mcq__progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  transition: width var(--dur-base) var(--ease);
}
.pte-listening-mcq__meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}
.pte-listening-mcq__options {
  display: grid;
  gap: var(--space-2);
}
.pte-listening-mcq__option {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 44px;
  cursor: pointer;
  transition:
    transform var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease);
}
.pte-listening-mcq__option:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}
.pte-listening-mcq__option input {
  margin-top: 2px;
}
.pte-listening-mcq__option-body {
  display: grid;
  gap: 2px;
}
.pte-listening-mcq__option-label {
  font-weight: 700;
}
.pte-listening-mcq__option-text {
  color: var(--text);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  color: var(--text-on-accent);
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  border: none;
  cursor: pointer;
  transition:
    transform var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}
.checkbox-group {
  display: inline-flex;
  align-items: center;
  justify-content: start;
  gap: var(--space-2);
  cursor: pointer;
  transition:
    transform var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}
.button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border-subtle);
  box-shadow: none;
}
button.nav-item {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-subtle);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: 999px;
}
button.nav-item:hover {
  background: var(--surface);
  border-color: var(--border);
}
.nav-dropdown {
  position: relative;
}
.nav-dropdown summary {
  list-style: none;
  cursor: pointer;
}
.nav-dropdown[open] > summary {
  background: var(--bg);
}
html[data-theme="dark"] .nav-dropdown[open] > summary {
  background: var(--bg);
}
.nav-dropdown .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  width: 240px;
  padding: var(--space-2);
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity var(--dur-base) var(--ease),
    transform var(--dur-base) var(--ease),
    visibility var(--dur-base) var(--ease);
}
.nav-dropdown[open] .menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-dropdown .menu .menu-item {
  display: flex;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  min-height: 44px;
  padding: 8px var(--space-3);
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  border-radius: 8px;
  white-space: normal;
  line-height: 1.3;
  font-weight: 600;
  transition:
    background var(--dur-base) var(--ease),
    color var(--dur-base) var(--ease);
}
.nav-dropdown .menu .menu-item:hover {
  background: color-mix(in oklab, var(--bg) 90%, transparent);
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  margin: 0 var(--space-2);
}
.nav-item.icon-only {
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--bg);
  border-color: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-item.icon-only .material-icons-outlined {
  font-size: 20px;
}
@media (max-width: 768px) {
  .topbar {
    height: 64px;
  }
  .topbar-shell {
    padding: 0 var(--space-3);
    gap: var(--space-3);
  }
  .brand-text {
    font-size: 15px;
  }
  .workspace-pill {
    display: none;
  }
  .nav {
    gap: 4px;
  }
  .nav-item {
    padding: 0 var(--space-2);
    font-size: 12px;
  }
}

.card h2 {
  color: var(--text);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
}
.grid.two {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}
.grid.three {
  grid-template-columns: repeat(3, 1fr);
}
.grid.four {
  grid-template-columns: repeat(4, 1fr);
}
.grid.gap-2 {
  gap: var(--space-2);
}
.grid.gap-3 {
  gap: var(--space-3);
}
.grid.gap-4 {
  gap: var(--space-4);
}
.grid.gap-6 {
  gap: var(--space-6);
}

.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.list-item {
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* Courses Grid Layout */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

/* Responsive Grid */
@media (max-width: 1024px) {
  .courses-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }
}



@media (max-width: 640px) {
  .courses-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

/* Course Cards */
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.course-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-footer {
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-smooth) var(--ease-smooth);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.card.span2 {
  grid-column: span 2;
}
.card h2 {
  color: var(--text);
  margin: 0 0 var(--space-3);
  padding-bottom: 6px;
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}
.actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--accent-button);
  color: white;
  text-decoration: none;
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: 999px;
  transition: all var(--dur-smooth) var(--ease-smooth);
  font-weight: 500;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}
.button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.button:active {
  transform: translateY(0);
}
.button.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}
.button.secondary:hover {
  background: var(--bg);
  border-color: var(--border);
}
.button.danger {
  background: var(--danger);
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.3);
}
.button.danger:hover {
  background: #dc2626;
}
.button.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border: none;
  padding: 0 var(--space-3);
}
.button.ghost:hover {
  background: var(--bg);
  color: var(--text);
}
.button.sm {
  min-height: 36px;
  padding: 0 var(--space-3);
  font-size: 13px;
}
.button.lg {
  min-height: 52px;
  padding: 0 var(--space-5);
  font-size: 15px;
}
.link {
  color: #334155;
  text-decoration: none;
}
html[data-theme="dark"] .link {
  color: var(--accent);
}
.auth .form p {
  margin-bottom: var(--space-3);
}
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 0 var(--space-3);
  outline: none;
  font-family: var(--font-family);
  font-size: 14px;
  transition: all var(--dur-base) var(--ease);
}
input[type="checkbox"]:hover {
  background-color: none;
  box-shadow: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
input[type="checkbox"] {
  width: auto;
  height: 18px;
  width: 18px;
  border-radius: 4px;
  cursor: pointer;
  accent-color: var(--accent);
}
input[type="radio"] {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  accent-color: var(--accent);
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  appearance: none;
}
textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}
button {
  border: none;
  cursor: pointer;
}
@media (max-width: 640px) {
  .container {
    padding: var(--space-4) var(--space-3);
  }
}

.inquiries-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.inquiries-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.inquiries-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.inquiries-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.inquiries-stat-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.inquiries-stat-card h3 {
  margin: 0 0 var(--space-2);
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}
.inquiries-stat-card .value {
  font-size: 1.4rem;
  font-weight: 700;
}
.inquiries-filters {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}
.inquiries-filters input,
.inquiries-filters select {
  min-width: 200px;
}
.inquiries-table-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  width: 100%;
  margin-top: var(--space-3);
}
.inquiries-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.inquiries-table thead th {
  background: var(--bg);
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border-subtle);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.inquiries-table tbody td {
  padding: 12px 10px;
  border-top: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.inquiries-table tbody tr:hover td {
  background: var(--bg);
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--text);
}
.status-chip.new {
  background: #e0f2fe;
  color: #075985;
  border-color: #bae6fd;
}
.status-chip.nurturing {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.status-chip.converted {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}
.status-chip.lost {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
.status-chip.inactive {
  background: #e5e7eb;
  color: #374151;
  border-color: #d1d5db;
}
.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.table-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.table-action:hover {
  background: var(--bg);
  border-color: var(--border);
}
.inquiry-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.inquiry-status-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: var(--space-4);
}
.status-path {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.status-button {
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.status-button.active {
  background: var(--accent-contrast);
  border-color: var(--accent);
  color: var(--text);
}
.inquiry-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1.5fr;
  gap: var(--space-5);
  margin-top: var(--space-4);
}
.notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.notes-item {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-3);
}
.key-info-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.key-info-list p {
  margin: 0;
  padding: var(--space-2);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
}

@media (max-width: 960px) {
  .inquiries-stats {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
  .inquiry-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Form field errors */
.error-text {
  color: var(--danger);
  font-size: 14px;
  margin-top: 4px;
  padding: 6px 10px;
  background-color: rgba(252, 74, 70, 0.1);
  border-left: 3px solid var(--danger);
  border-radius: 2px;
  display: block;
}
html[data-theme="dark"] .error-text {
  background-color: rgba(252, 74, 70, 0.15);
}

/* Landing hero */
.hero {
  padding: var(--space-8) 0 var(--space-7);
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(
    135deg,
    var(--accent-contrast) 0%,
    rgba(238, 242, 255, 0.5) 100%
  );
}
html[data-theme="dark"] .hero {
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.7) 0%,
    rgba(11, 15, 23, 0.6) 100%
  );
}
.hero-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.hero-title {
  font-size: 48px;
  line-height: 1.1;
  margin: 0;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  color: var(--muted);
  max-width: 640px;
  font-size: 18px;
  line-height: 1.6;
}
.hero-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.hero-meta {
  display: flex;
  gap: var(--space-3);
  color: var(--muted);
  font-size: 14px;
}
.hero-stat {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.hero-stat-value {
  font-weight: 600;
  color: var(--text);
}
.hero-stat-label {
  color: var(--muted);
}

.features {
  margin-top: var(--space-6);
}

/* Testimonials & FAQ */
.testimonial {
  background: var(--surface);
  padding: var(--space-2);
  border-left: 3px solid var(--accent);
}
.faq p {
  margin: 6px 0;
}

/* Grid helpers */
.grid.two {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

/* App shell with optional left sidebar */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
.app-shell.has-sidebar {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr;
  height: calc(100vh - 72px);
  gap: 0;
}
.app-shell.has-sidebar {
  --content-max-width: 1360px;
}
body.sidebar-collapsed .app-shell.has-sidebar {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}
body[data-portal="student"] .app-shell.has-sidebar > .container {
  max-width: 100%;
  margin: 0;
}

main.container {
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

.sidebar {
  position: relative;
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100%;
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
  overflow-x: hidden;
}
html[data-theme="dark"] .sidebar {
  background: rgba(15, 23, 42, 0.98);
}
.sidebar-toggle-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.sidebar-overlay {
  display: none;
}
@media (max-width: 991px) {
  .sidebar-toggle-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    z-index: 1000;
    pointer-events: none;
    transition: background 0.3s ease;
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar-overlay {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: var(--surface);
  }
  html[data-theme="dark"] .sidebar {
    background: rgba(15, 23, 42, 0.98);
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar {
    transform: translateX(0);
  }
  html:has(.sidebar-toggle-checkbox:checked) {
    overflow: hidden;
  }
  html:has(.sidebar-toggle-checkbox:checked) body {
    overflow: hidden;
  }
  .app-shell.has-sidebar {
    grid-template-columns: 1fr;
  }
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.sidebar-head-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--color-text-muted);
}

.sidebar-brand-mobile {
  display: none;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
}
.sidebar-brand-mobile .brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
}
.sidebar-brand-mobile .brand-text {
  font-weight: 700;
  font-size: 16px;
}

@media (max-width: 768px) {
  .sidebar-brand-mobile {
    display: flex;
  }
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--color-text-muted);
  border-radius: 12px;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
  cursor: pointer;
  transition: all var(--dur-smooth) var(--ease-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--bg);
  color: var(--color-text);
  border-color: var(--border);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sidebar-group {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-group-title {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.sidebar-group-label {
  flex: 1;
}

.sidebar-group-toggle {
  font-size: 16px;
  color: var(--color-text-muted);
  transition:
    transform 120ms var(--ease-smooth),
    color 120ms var(--ease-smooth);
}

.sidebar-section-collapsed {
  gap: 0;
  padding-bottom: var(--space-2);
}

.sidebar-section-collapsed .sidebar-link {
  display: none;
}

.sidebar-section-collapsed .sidebar-group-toggle {
  transform: rotate(-90deg);
}

.sidebar-group.is-active {
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.sidebar-group.is-active .sidebar-group-label {
  color: var(--color-text);
}

.sidebar-group.is-active .sidebar-group-toggle {
  color: var(--color-text);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
  padding: 0 var(--space-3);
  min-height: 44px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--dur-smooth) var(--ease-smooth);
  border: 1px solid transparent;
  background: transparent;
}

.sidebar-link .sidebar-icon {
  font-size: 20px;
  color: var(--color-text-muted);
  transition: color var(--dur-smooth) var(--ease-smooth);
}

.sidebar-link .label {
  flex: 1;
}

.sidebar-link:hover {
  background: var(--surface);
  color: var(--color-text);
  border-color: var(--border-subtle);
}

.sidebar-link:hover .sidebar-icon {
  color: var(--color-text);
}

.sidebar-link.active {
  background: var(--surface);
  color: var(--color-text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.sidebar-link.active .sidebar-icon {
  color: var(--color-text);
}

.sidebar-link.muted {
  color: var(--color-text-muted);
}

.sidebar-link.muted:hover {
  color: var(--color-text);
}

.sidebar-link.muted .sidebar-icon {
  color: var(--color-text-muted);
}

.sidebar-link.danger {
  color: var(--danger);
}

.sidebar-link.danger .sidebar-icon {
  color: var(--danger);
}

.sidebar-link.danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-utility {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--dur-smooth) var(--ease-smooth);
}

.sidebar-utility:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.sidebar-utility.danger {
  color: var(--danger);
}

.sidebar-utility.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.24);
}

.sidebar-logout {
  margin: 0;
}

.sidebar-dropdown {
  position: relative;
}

.sidebar-dropdown summary {
  list-style: none;
}

.sidebar-dropdown[open] > summary {
  background: var(--bg);
  color: var(--color-text);
  border-color: var(--border);
}

.sidebar-dropdown .menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 240px;
  padding: 6px;
  z-index: 40;
  max-height: 60vh;
  overflow: auto;
}

.sidebar-dropdown .menu .menu-item {
  display: flex;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  min-height: 44px;
  padding: 6px var(--space-3);
  align-items: center;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: normal;
  line-height: 1.3;
}

.sidebar-dropdown .menu .menu-item:hover {
  background: var(--bg);
}

.sidebar-dropdown .menu form {
  margin: 0;
}

body.sidebar-collapsed .app-shell.has-sidebar {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

body.sidebar-collapsed .sidebar-head-label,
body.sidebar-collapsed .sidebar-group-title,
body.sidebar-collapsed .sidebar-link .label {
  display: none;
}

body.sidebar-collapsed .app-shell.has-sidebar .sidebar {
  padding: var(--space-4) var(--space-3);
  gap: var(--space-3);
}

body.sidebar-collapsed .sidebar-head {
  justify-content: center;
}

body.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  right: var(--space-3);
  top: var(--space-3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
}

body.sidebar-collapsed .sidebar-toggle .material-icons-outlined {
  transform: rotate(180deg);
  transition: transform var(--dur-smooth) var(--ease-smooth);
}

body.sidebar-collapsed .sidebar-group {
  padding: var(--space-2);
  align-items: center;
}

body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0;
  min-height: 44px;
  width: 44px;
}

/* Responsive: hide sidebar on small screens */
@media (max-width: 768px) {
  .topbar {
    height: 56px;
  }
  .topbar .container {
    padding: 0 var(--space-3);
    column-gap: var(--space-2);
  }
  .topbar-center {
    display: none;
  }
  .topbar .logo {
    font-size: 16px;
  }
  .topbar-brand .brand-text {
    display: none;
  }
  .nav {
    gap: var(--space-1);
  }
  .nav-item {
    padding: 0 var(--space-2);
    min-height: 40px;
    font-size: 13px;
  }
  .nav-item.icon-only {
    width: 40px;
    height: 40px;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-shell.has-sidebar {
    display: flex;
    flex-direction: column;
  }
  body.sidebar-collapsed .app-shell.has-sidebar {
    display: flex;
    flex-direction: column;
  }
  .app-shell.has-sidebar > .container {
    grid-column: 1 / -1;
    width: 100%;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: var(--surface);
  }
  html[data-theme="dark"] .sidebar {
    background: rgba(15, 23, 42, 0.98);
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    z-index: 1000;
    pointer-events: none;
    transition: background 0.3s ease;
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar-overlay {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
  }
  html:has(.sidebar-toggle-checkbox:checked) {
    overflow: hidden;
  }
  html:has(.sidebar-toggle-checkbox:checked) body {
    overflow: hidden;
  }
  .app-shell .container {
    max-width: 100%;
  }
}

/* Pills (used for credentials) */
.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  background: #f9fafb;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Tables */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table tbody td {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 14px;
  color: var(--text);
}
.table tbody tr:hover td {
  background: var(--bg);
}
.table.compact thead th,
.table.compact tbody td {
  padding: 10px 12px;
}
.table thead th:first-child,
.table tbody td:first-child {
  padding-left: 20px;
}
.table thead th:last-child,
.table tbody td:last-child {
  padding-right: 20px;
}
.table a:not(.button) {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--dur-base) var(--ease);
}
.table a:not(.button):hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* Table data cell classes for booking table */
.table-td-coach {
  font-weight: 600;
  font-size: 12px;
}
.table-td-date {
  font-size: 12px;
}
.table-td-date-display {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.table-td-date-main {
  font-size: 12px;
}
.table-td-date-time {
  font-size: 10px;
  color: var(--muted);
}
.table-td-timezone {
  font-size: 12px;
}
.table-td-actions {
}
.table-td-actions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.table-td-action-button {
  padding: 4px 10px;
  font-size: 11px;
}
.table-td-empty {
  text-align: center;
  padding: var(--space-4);
  color: var(--muted);
  font-size: 12px;
}

/* Additional table data cell classes for admin tables */
.table-td-student {
  font-size: 12px;
}
.table-td-datetime {
  font-size: 12px;
}
.table-td-status {
  font-size: 12px;
}

/* Table data cell classes for catalog manage page */
.table-td-id {
  font-size: 12px;
  font-family: monospace;
}
.table-td-order {
  font-size: 12px;
  font-family: monospace;
}
.table-td-qtype {
  font-size: 12px;
  font-weight: 600;
  max-width: 180px;
  width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-td-family {
  font-size: 12px;
}
.table-td-test {
  font-size: 12px;
}
.table-td-section {
  font-size: 12px;
}
.table-td-prompt {
  font-size: 12px;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-td-skills {
  font-size: 12px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-td-options {
  font-size: 12px;
  font-family: monospace;
  text-align: center;
}
.table-td-answer {
  font-size: 12px;
  text-align: center;
}
.table-td-catalog-actions {
  font-size: 12px;
}
.table-td-catalog-actions-container {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.table-td-catalog-actions-container .action-btn-text {
  display: none;
}
.table-td-catalog-actions-container .action-btn {
  padding: 6px;
  min-width: 32px;
  width: 32px;
}

/* Professional Action Buttons */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  color: #475569;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  white-space: nowrap;
  min-width: 32px;
  height: 32px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.action-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.action-btn-icon {
  font-size: 12px;
  line-height: 1;
}

.action-btn-text {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* View Button */
.action-btn-view:hover {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  border-color: var(--accent-strong);
  color: var(--text-on-accent);
}

/* Edit Button */
.action-btn-edit:hover {
  background: var(--success);
  border-color: var(--success);
  color: var(--text-on-accent);
}

/* Duplicate Button */
.action-btn-duplicate:hover {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  border-color: var(--accent-strong);
  color: var(--text-on-accent);
}

/* Delete Button */
.action-btn-delete:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--text-on-accent);
}

/* Compact mode for smaller screens */
@media (max-width: 640px) {
  .action-btn-text {
    display: none;
  }

  .action-btn {
    padding: 6px 8px;
    min-width: 32px;
    width: 32px;
  }

  .table-td-catalog-actions-container {
    gap: 4px;
  }
}
.table-td-checkbox {
  width: 36px;
}

/* Icon buttons */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0 6px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
.icon-button:hover {
  background: var(--bg);
}
html[data-theme="dark"] .icon-button:hover {
  background: var(--bg);
}
.icon-button.danger {
  color: var(--danger);
}
.icon-button.success {
  color: var(--accent);
}

/* Badges */
.badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--border-subtle);
}
.badge.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.2);
}
.badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.badge.warning {
  background: rgba(251, 191, 36, 0.1);
  color: #d97706;
  border-color: rgba(251, 191, 36, 0.2);
}
.badge.info {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.2);
}
.badge.neutral {
  background: var(--bg);
  color: var(--muted);
  border-color: var(--border-subtle);
}

/* Print styles */
@media print {
  .topbar {
    display: none !important;
  }
  .container {
    max-width: 100%;
    padding: 0;
  }
  .card {
    box-shadow: none;
    border: 1px solid var(--border-subtle);
  }
  .actions {
    display: none;
  }
}
/* Modal */
#modal-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
}
#modal-root.open {
  pointer-events: auto;
}
#modal-root .modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 1;
}
#modal-root .modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  width: min(520px, 90vw);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
  z-index: 2;
}
#modal-root .actions {
  justify-content: flex-end;
}

/* Question Detail Page Professional Styles */
.question-detail-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.question-detail-header {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  padding: var(--space-4) var(--space-3);
  color: var(--text-on-accent);
}

.question-detail-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 var(--space-1) 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.question-detail-subtitle {
  font-size: 0.875rem;
  opacity: 0.9;
  margin: 0;
}

.question-detail-form {
  padding: var(--space-4) var(--space-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-input,
.form-textarea {
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background: var(--surface);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.form-message {
  min-height: 20px;
  margin-top: var(--space-2);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.charlie-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  font-size: 16px;
}

.btn-success {
  background: linear-gradient(135deg, #38b2ac 0%, #319795 100%);
  color: white;
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 178, 172, 0.3);
}

.btn-icon {
  font-size: 1rem;
}

/* Section Styles */
.skills-section,
.options-section,
.answer-section {
  padding: var(--space-4) var(--space-3);
  border-bottom: 1px solid #e2e8f0;
}

.skills-section:last-child,
.options-section:last-child,
.answer-section:last-child {
  border-bottom: none;
}

.section-header {
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 var(--space-1) 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  justify-content: center;
}

.section-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
}

/* Skills Grid */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.skill-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #f59e0b;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.add-option-form {
  background: var(--bg);
  padding: var(--space-3);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.option-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.existing-options {
  background: var(--surface);
  padding: var(--space-3);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.options-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 var(--space-2) 0;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.option-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.option-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-strong) 100%
  );
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.option-text {
  font-size: 0.875rem;
  color: var(--text);
  flex: 1;
}

/* Answer Form */
.answer-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.form-help {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: var(--space-1);
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  text-align: center;
  color: #9ca3af;
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: var(--space-2);
}

.empty-text {
  font-size: 0.875rem;
  margin: 0;
}



/* Fix Add Question page - make both cards wider horizontally like catalog manager */
body[data-portal="admin"]
  .app-shell.has-sidebar
  main.container:has(section.page-add-question) {
  width: 100% !important;
}

section.page-add-question .card,
section.page-add-question + section .card {
  max-width: 100% !important;
  width: 100% !important;
  padding: var(--space-5) !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

section.page-add-question + section .card > form.grid.three {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

section.page-add-question + section .card > form.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

/* Make filter form use auto-fit grid like catalog manager for full width - override inline styles */
section:has(> .card > form.grid.three) .card > form.grid.three[style*="gap"] {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: var(--space-5) !important;
  margin-bottom: var(--space-4) !important;
}

/* Make post form use auto-fit grid like catalog manager - override inline styles */
section:has(> .card > form.grid.three) .card > form.grid.two[style*="gap"] {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: var(--space-5) !important;
}

/* Prevent forms from shrinking */
section:has(> .card > form.grid.three) .card > form.grid.three,
section:has(> .card > form.grid.three) .card > form.grid.two {
  width: 100% !important;
  min-width: 100% !important;
}

/* Responsive Design for Question Detail */
@media (max-width: 1024px) {
  .form-row,
  .options-grid {
    grid-template-columns: 1fr;
  }

  .question-detail-header {
    padding: var(--space-3) var(--space-2);
  }

  .question-detail-form,
  .skills-section,
  .options-section,
  .answer-section {
    padding: var(--space-3) var(--space-2);
  }
}

/* AI-NOTE: Student Dashboard - Modern Design */
/* AI-NOTE: Complete redesign with full-width stats, 2-column grid, better visual hierarchy */

.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-5);
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: var(--space-6);
  align-items: stretch;
}

.dashboard-hero-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dashboard-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.dashboard-hero-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
}

.hero-plan {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.hero-plan-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.dashboard-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.dashboard-main .span-2 {
  grid-column: 1 / -1;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--space-4);
}

.snapshot-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg);
}

.snapshot-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.snapshot-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

.snapshot-note {
  margin-top: var(--space-2);
  font-size: 14px;
  color: var(--text);
}

.snapshot-note.muted {
  color: var(--muted);
}

.section-score-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.section-score {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  font-size: 14px;
}

.section-score-value {
  font-weight: 700;
  color: var(--accent);
}

.section-score-date {
  font-size: 12px;
  color: var(--muted);
}

.support-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.support-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.support-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.support-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.support-divider {
  height: 1px;
  background: var(--border-subtle);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.resource-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: var(--bg);
}

.resource-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.analytics-section {
  margin-top: var(--space-6);
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.analytics-header h2 {
  margin: 0 0 var(--space-1);
}

.analytics-tabs {
  margin-top: var(--space-4);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tabs input {
  display: none;
}

.tabs label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-smooth) var(--ease-smooth);
}

.tabs input:checked + label {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.tab-panels {
  width: 100%;
  margin-top: var(--space-4);
}

.tab-panel {
  display: none;
  width: 100%;
}

#analytics-overview:checked ~ .tab-panels .panel-overview,
#analytics-skills:checked ~ .tab-panels .panel-skills,
#analytics-types:checked ~ .tab-panels .panel-types,
#analytics-pacing:checked ~ .tab-panels .panel-pacing,
#analytics-tags:checked ~ .tab-panels .panel-tags {
  display: grid;
  gap: var(--space-4);
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  min-height: 88px;
}

.hero-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.hero-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.dashboard .btn-primary,
.dashboard .btn-secondary {
  min-height: 44px;
}

.dashboard .card,
.dashboard .btn-primary,
.dashboard .btn-secondary,
.dashboard .link-arrow {
  transition: all var(--dur-base) var(--ease);
}

.dashboard .card-title .material-icons-outlined {
  color: var(--muted);
}

.dashboard .result-score {
  color: var(--text);
}

.dashboard .link-arrow {
  color: var(--text);
}

.dashboard .link-arrow:hover {
  color: var(--muted);
}

/* Dashboard Header - Title and Plan Selector */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.dashboard-title h1 {
  margin: 0 0 var(--space-2);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.dashboard-title p {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}

.plan-selector {
  display: flex;
  align-items: center;
}

.plan-selector select {
  padding: var(--space-2) var(--space-3);
  font-size: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--dur-smooth) var(--ease-smooth);
}

.dashboard-hero .plan-selector select {
  width: 100%;
  min-height: 44px;
}

@media (max-width: 1024px) {
  .dashboard-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .dashboard-main {
    grid-template-columns: 1fr;
  }

  .resources-grid {
    grid-template-columns: 1fr;
  }

  .snapshot-grid {
    grid-template-columns: 1fr;
  }
}

.plan-selector select:hover,
.plan-selector select:focus {
  border-color: var(--accent);
  outline: none;
}

.plan-selector .badge {
  padding: var(--space-2) var(--space-3);
  background: var(--accent-contrast);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
}

/* Stats Row - Full-width stat cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--dur-smooth) var(--ease-smooth);
}

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

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  font-size: 24px;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* Dashboard Grid - 2-column layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

/* On larger screens, create 3-column first row */
@media (min-width: 1025px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
      "todays booking target"
      "social live courses"
      "progress results results";
  }

  .dashboard-grid .todays-plan-card {
    grid-area: todays;
  }

  .dashboard-grid .booking-card {
    grid-area: booking;
  }

  .dashboard-grid .target-card {
    grid-area: target;
  }

  .dashboard-grid .similar-students-card {
    grid-area: social;
  }

  .dashboard-grid .live-class-card {
    grid-area: live;
  }

  .dashboard-grid .top-courses-card {
    grid-area: courses;
  }

  .dashboard-grid .progress-card {
    grid-area: progress;
  }

  .dashboard-grid .results-card {
    grid-area: results;
  }

  .dashboard-grid .next-level-card {
    grid-column: 1 / -1;
  }
}

/* Card Base Styles */
.card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--dur-smooth) var(--ease-smooth);
}

.dashboard .card {
  padding: 0;
  overflow: hidden;
  transition: all var(--dur-smooth) var(--ease-smooth);
}

.dashboard .card:hover {
  box-shadow: var(--shadow-soft);
  border-color: var(--border);
  transform: translateY(-2px);
}

.dashboard .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
}

.dashboard .card-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.dashboard .card-title .material-icons-outlined {
  font-size: 22px;
  color: var(--accent);
}

.dashboard .card-title h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.dashboard .card-badge {
  display: flex;
  align-items: center;
}

.dashboard .card-badge .badge {
  padding: var(--space-1) var(--space-2);
  font-size: 12px;
  font-weight: 500;
}

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

.dashboard-grid .todays-plan-card > .card-body,
.dashboard-grid .booking-card > .card-body,
.dashboard-grid .target-card > .card-body,
.dashboard-grid .similar-students-card > .card-body,
.dashboard-grid .live-class-card > .card-body,
.dashboard-grid .top-courses-card > .card-body {
  padding: calc(var(--space-6) / 2);
}

.link-arrow {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--dur-smooth) var(--ease-smooth);
}

.link-arrow:hover {
  color: var(--accent-dark);
}

/* Today's Plan Card */
.todays-plan-card {
  grid-column: auto;
}

.weak-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.weak-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.weak-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.weak-tag {
  padding: var(--space-1) var(--space-2);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

/* Weekly Plan Card */
.weekly-plan-card {
  grid-column: span 2;
}

.weekly-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--bg);
  border-radius: var(--radius);
}

.weekly-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  text-align: center;
}

.weekly-icon {
  font-size: 24px;
}

.weekly-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.weekly-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

/* Booking Card */
.booking-card {
  grid-column: auto;
}

.booking-text {
  margin: 0 0 var(--space-4);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* Urgency Badge for Booking Card */
.urgency-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--error-bg);
  color: var(--error);
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
}

/* Next Level Card */
.next-level-card {
  grid-column: auto;
  border-left: 4px solid var(--brand-accent);
}

.next-level-text {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

/* Similar Students Card */
.similar-students-card {
  background: var(--neutral-bg);
}

.similar-students-text {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

/* Milestone Toast */
.milestone-toast {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  margin-bottom: var(--space-3);
  background: var(--brand-accent);
  color: white;
  border-radius: var(--radius-md);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.milestone-content {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: 520px;
}

.milestone-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.milestone-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.milestone-text strong {
  font-size: 15px;
  font-weight: 700;
}

.milestone-text p {
  margin: 0;
  font-size: 13px;
  opacity: 0.9;
}

.milestone-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: background 0.15s ease;
}

.milestone-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.milestone-content .charlie-face {
  font-size: 20px;
}

.confetti {
  position: fixed;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.95;
  animation: ecConfettiFall 2.2s ease-in forwards;
  z-index: 1500;
  pointer-events: none;
}

@keyframes ecConfettiFall {
  to {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0;
  }
}

.next-action-rail {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-2) 0 var(--space-4);
}

.next-action-inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.next-action-text {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-small {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--dur-smooth) var(--ease-smooth);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--border-subtle);
  border-color: var(--border);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-small {
  padding: var(--space-1) var(--space-3);
  font-size: 13px;
  background: var(--accent);
  color: white;
}

.btn-small:hover {
  background: var(--accent-dark);
}

.btn-small .material-icons-outlined {
  font-size: 16px;
}

/* Progress Card */
.progress-card {
  grid-column: auto;
}

/* Results Card */
.results-card {
  grid-column: auto;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--bg);
  border-radius: var(--radius);
  transition: background var(--dur-smooth) var(--ease-smooth);
}

.result-item:hover {
  background: var(--border-subtle);
}

.result-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.result-label {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.result-score {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
}

.result-sparkline {
  flex-shrink: 0;
  width: 60px;
  height: 24px;
  display: block;
}

.result-date {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  text-align: center;
}

.empty-state .material-icons-outlined {
  font-size: 48px;
  color: var(--border);
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.weak-types {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* Progress Summary - Sparkline and Last Results cards */
.progress-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}

.progress-summary .card {
  margin: 0;
}

.progress-summary .card p {
  margin: var(--space-1) 0;
  font-size: 14px;
  color: var(--text);
}

.progress-summary .card strong {
  color: var(--accent);
}

.skills-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-4);
  align-items: start;
}

.radar-chart canvas {
  width: 100%;
  height: 220px;
}

.skills-heatmap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.type-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: var(--space-3);
}
.type-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg);
  min-height: 110px;
}
.type-card.acc-low {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
}
.type-card.acc-mid {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.35);
}
.type-card.acc-high {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}
.type-card .type-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.type-card .type-acc {
  font-size: 13px;
  font-weight: 600;
}
.type-card.acc-low .type-acc {
  color: #ef4444;
}
.type-card.acc-mid .type-acc {
  color: #f59e0b;
}
.type-card.acc-high .type-acc {
  color: #10b981;
}
.type-card .type-meta {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.type-card .type-meta .micro-pill {
  background: transparent;
  border-color: var(--border-subtle);
}
.type-card .type-actions {
  display: flex;
  align-items: center;
}
.type-card .type-actions .link-arrow {
  font-size: 13px;
}

@media (max-width: 1280px) {
  .type-heatmap-grid {
    grid-template-columns: repeat(3, minmax(240px, 1fr));
  }
}
@media (max-width: 960px) {
  .type-heatmap-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}
@media (max-width: 640px) {
  .type-heatmap-grid {
    grid-template-columns: 1fr;
  }
}

.heatmap-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.heatmap-item.acc-low .heatmap-value {
  color: #ef4444;
}
.heatmap-item.acc-mid .heatmap-value {
  color: #f59e0b;
}
.heatmap-item.acc-high .heatmap-value {
  color: #10b981;
}

.heatmap-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.heatmap-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.heatcells {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.heatcell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--border-subtle);
}

.heatcell.on {
  background: var(--accent);
}
.heatmap-item.acc-low .heatcell.on {
  background: #ef4444;
}
.heatmap-item.acc-mid .heatcell.on {
  background: #f59e0b;
}
.heatmap-item.acc-high .heatcell.on {
  background: #10b981;
}

.heatmap-item .link-arrow {
  margin-left: auto;
}

.heatmap-legend {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.legend-label {
  font-size: 12px;
  color: var(--muted);
}

.pacing-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pacing-breakdown {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.pacing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.pacing-item.pace-fast {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.07);
}
.pacing-item.pace-medium {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.07);
}
.pacing-item.pace-slow {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.07);
}

.trends-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
}

.trend-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.trend-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.trend-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.trend-accuracy {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.trend-meta {
  display: flex;
  gap: var(--space-2);
}

.micro-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.target-set {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.target-bands {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.band-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.band-label {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.band-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
}

.band-value.target {
  color: var(--accent);
}

.band-value.positive {
  color: #10b981;
}

.band-value.warning {
  color: #f59e0b;
}

.band-value.negative {
  color: #ef4444;
}

.band-value.high {
  color: #10b981;
}

.band-value.medium {
  color: #f59e0b;
}

.band-value.low {
  color: #9ca3af;
}

.target-actions {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.due-today-badge {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.due-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.due-count {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.target-change summary {
  list-style: none;
}
.target-change[open] summary .material-icons-outlined {
  transform: rotate(180deg);
}
/* Insight Hook - Top recommendation pill with collapsible details */
.insight-hook {
  margin-top: var(--space-2);
}

.insight-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: linear-gradient(
    135deg,
    var(--accent-contrast) 0%,
    rgba(238, 242, 255, 0.5) 100%
  );
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-smooth) var(--ease-smooth);
  user-select: none;
}

.insight-pill:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.insight-pill:active {
  transform: translateY(0);
}

.insight-pill .material-icons-outlined {
  font-size: 24px;
  color: var(--accent);
}

/* Responsive override: collapse dashboard grid to single column on mobile */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.insight-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insight-text strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.insight-text .muted {
  font-size: 0.875rem;
  color: var(--muted);
}

.insight-pill .expand-icon {
  transition: transform var(--dur-smooth) var(--ease-smooth);
  color: var(--muted);
}

.insight-pill.expanded .expand-icon {
  transform: rotate(180deg);
}

.insight-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-smooth) var(--ease-smooth);
}

.insight-pill.expanded + .insight-details {
  max-height: 1000px;
  margin-top: var(--space-4);
}

/* Insights Section - Collapsible detailed analytics */
.insights-section {
  margin-top: var(--space-3);
}

.insights-section summary {
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  padding: var(--space-4);
  list-style: none;
  user-select: none;
  transition: color var(--dur-smooth) var(--ease-smooth);
  letter-spacing: -0.01em;
}

.insights-section summary:hover {
  color: var(--accent);
}

.insights-section summary::-webkit-details-marker {
  display: none;
}

.insights-content {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

/* Pacing Card */
.pacing-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pacing-summary .pacing-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pacing-summary .pacing-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.pacing-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.pacing-legend .legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.pacing-legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pacing-legend .legend-label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}

/* Responsive Dashboard */
@media (max-width: 768px) {
  .top-strip {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-strip-right {
    width: 100%;
    justify-content: space-between;
  }

  .quick-stats {
    width: 100%;
  }

  .stat-pill {
    flex: 1;
    justify-content: center;
  }

  .dashboard-grid,
  .primary-cta,
  .progress-summary {
    grid-template-columns: 1fr;
  }
  .skills-layout {
    grid-template-columns: 1fr;
  }
  .radar-chart canvas {
    height: 180px;
  }
  .stats-row {
    grid-template-columns: 1fr;
  }
  .pacing-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
  .pacing-legend {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .app-shell.has-sidebar {
    display: flex;
    flex-direction: column;
  }
  body.sidebar-collapsed .app-shell.has-sidebar {
    display: flex;
    flex-direction: column;
  }
  .app-shell.has-sidebar > .container {
    grid-column: 1 / -1;
    width: 100%;
  }
  body.sidebar-collapsed .app-shell.has-sidebar > .container {
    grid-column: 1 / -1;
    width: 100%;
  }

  .app-shell.has-sidebar .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: var(--surface);
  }
  html[data-theme="dark"] .app-shell.has-sidebar .sidebar {
    background: rgba(15, 23, 42, 0.98);
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    z-index: 1000;
    pointer-events: none;
    transition: background 0.3s ease;
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar-overlay {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
  }
  html:has(.sidebar-toggle-checkbox:checked) {
    overflow: hidden;
  }
  html:has(.sidebar-toggle-checkbox:checked) body {
    overflow: hidden;
  }

  body[data-portal="student"] main.container {
    padding-bottom: 96px;
  }

  .sp-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .sp-actions .button {
    width: 100%;
  }

  #attempt-history-fragment .actions,
  #student-questions-filters .actions {
    flex-direction: column;
    align-items: stretch;
  }

  #attempt-history-fragment .actions .button,
  #student-questions-filters .actions .button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .app-shell.has-sidebar {
    display: flex;
    flex-direction: column;
  }
  body.sidebar-collapsed .app-shell.has-sidebar {
    display: flex;
    flex-direction: column;
  }
  .app-shell.has-sidebar > .container {
    width: 100%;
  }
  body.sidebar-collapsed .app-shell.has-sidebar > .container {
    width: 100%;
  }
  .app-shell.has-sidebar .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: var(--surface);
  }
  html[data-theme="dark"] .app-shell.has-sidebar .sidebar {
    background: rgba(15, 23, 42, 0.98);
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    z-index: 1000;
    pointer-events: none;
    transition: background 0.3s ease;
  }
  .sidebar-toggle-checkbox:checked ~ .sidebar-overlay {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
  }
  html:has(.sidebar-toggle-checkbox:checked) {
    overflow: hidden;
  }
  html:has(.sidebar-toggle-checkbox:checked) body {
    overflow: hidden;
  }
}

/* Shadcn Sonner Toast Styles */
.sonner-toaster {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none; /* Allow clicking through the container area */
  align-items: center;
}

.sonner-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
  min-width: 320px;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
  opacity: 0;
  /* Enter animation: slide down and fade in */
  /* Exit animation: fade out after 4s delay */
  animation:
    sonner-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    sonner-exit 0.5s ease 4s forwards;
}

.sonner-toast:hover {
  /* Pause exit animation on hover */
  animation-play-state: paused;
}

@keyframes sonner-enter {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sonner-exit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.sonner-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.sonner-icon .material-icons-outlined {
  font-size: 20px;
}

.sonner-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sonner-message {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.5;
}

.sonner-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  margin-top: 2px;
}

.sonner-close:hover {
  opacity: 1;
  color: var(--text);
}

.sonner-close .material-icons-outlined {
  font-size: 18px;
}

@media (max-width: 640px) {
  .sonner-toaster {
    top: 16px;
    bottom: auto;
    right: 16px;
    left: 16px;
    transform: none;
    align-items: center;
  }

  .sonner-toast {
    width: 100%;
    min-width: 0;
  }
}

/* ============================================================================
   GLOBAL BORDER-RADIUS NORMALIZATION
   ============================================================================
   Override hardcoded border-radius values in templates to use curved aesthetic.
   This ensures consistent slightly-curved corners across all UI elements.
*/

/* All buttons and button-like elements - very subtle curve (8px) */
button,
.btn,
.button,
input[type="button"],
input[type="submit"],
input[type="reset"],
a[role="button"] {
  border-radius: var(--radius-md, 8px) !important;
}

/* All form elements and cards - very subtle curve (8px) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea,
select,
.card,
.section-card,
.modal,
.modal-content,
.dropdown,
.popover,
[class*="card"],
[class*="form"],
[class*="modal"] {
  border-radius: var(--radius-md, 8px) !important;
}

/* Override hardcoded 8px border-radius → keep at 8px (--radius-md) */
[style*="border-radius: 8px"] {
  border-radius: var(--radius-md, 8px) !important;
}

/* Override hardcoded 6px border-radius → 8px for better consistency */
[style*="border-radius: 6px"] {
  border-radius: var(--radius-md, 8px) !important;
}

/* Inline button styles with old radius values */
.btn[style*="border-radius: 8px"],
button[style*="border-radius: 8px"],
[class*="btn"][style*="border-radius: 8px"] {
  border-radius: var(--radius-md, 8px) !important;
}

/* ============================================
   QUESTION FORMS & PLAYERS - Design System
   ============================================
   Safe, non-breaking utility classes for question forms and player templates
   These classes provide design system alignment without requiring template changes
   Preserve all form logic and question structure - only modernize styling
 */

/* Field Group Container - Flex column with proper spacing */
.field-group-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md, 12px);
}

/* Full-width field group wrapper */
.field-group-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg, 24px);
}

/* Help text with consistent styling */
.help-text-form {
  font-size: var(--font-size-sm, 12px);
  color: var(--color-text-muted, #6b7280);
  margin-top: var(--space-sm, 6px);
  line-height: 1.5;
}

/* Audio current/display wrapper */
.audio-info-box {
  margin-top: var(--space-md, 16px);
  display: grid;
  gap: var(--space-sm, 6px);
}

/* Audio label - small uppercase */
.audio-label-small {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted, #6b7280);
}

/* Audio player styling */
.audio-player-form {
  width: 100%;
  border-radius: var(--radius-md, 8px);
}

/* Audio download link */
.audio-download-link {
  font-size: 12px;
  color: var(--color-accent, #6366f1);
  text-decoration: underline;
  transition: color var(--transition-fast, 0.15s);
}

.audio-download-link:hover {
  color: var(--color-accent-strong, #4f46e5);
  text-decoration: none;
}

/* MCQ/Options Grid Container */
.options-grid-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md, 12px);
}

/* Single option row - checkbox/radio + input */
.option-row-flex {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 8px);
}

/* Option radio/checkbox sizing */
.option-input-radio,
.option-input-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Option text input - flex 1 for growth */
.option-text-input {
  flex: 1;
  width: 100%;
}

/* Two-column grid for metadata fields */
.field-group-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md, 12px);
}

/* Three-column responsive grid */
.field-group-grid-3col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md, 12px);
}

/* Table editor container */
.table-editor-box {
  border: 1px solid var(--color-border-subtle, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-md, 12px);
  overflow-x: auto;
  background: var(--color-surface, #ffffff);
}

/* Table editor table styling */
.table-editor-form {
  width: 100%;
  border-collapse: collapse;
}

/* Button bar for table row operations */
.table-button-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm, 10px);
  margin-bottom: var(--space-md, 10px);
}

/* Responsive adjustments for question forms */
@media (max-width: 768px) {
  .field-group-grid-2col {
    grid-template-columns: 1fr;
  }
  .field-group-grid-3col {
    grid-template-columns: 1fr 1fr;
  }
  .option-row-flex {
    gap: var(--space-sm, 8px);
  }
}

@media (max-width: 480px) {
  .field-group-grid-3col {
    grid-template-columns: 1fr;
  }
  .table-editor-box {
    padding: var(--space-sm, 8px);
    font-size: 13px;
  }
}
