/* ============================================================
   Admin Dashboard — shadcn-inspired Component System
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Hiragino Sans GB', 'Source Han Sans SC', system-ui, sans-serif;
  color: #09090b;
  background: linear-gradient(180deg, #f6f7fb 0%, #fafafa 240px);
  font-size: 17px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-sans,
input,
button,
select,
textarea {
  font-family: inherit;
}

h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.875rem; }
p { margin: 0 0 4px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Utility --- */
.hidden { display: none !important; }
.muted { color: #71717a; font-size: 1rem; }
.hint { color: #a1a1aa; font-size: 0.9375rem; }
.error { color: #b91c1c; font-size: 1rem; margin: 4px 0 0; }
.inline { display: flex; gap: 8px; align-items: center; }
.text-sm { font-size: 1.0625rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 0.875rem;
  font-size: 1.0625rem;
  font-weight: 600;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
  white-space: nowrap;
  line-height: 1;
  font-family: inherit;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 16px 28px rgba(29, 78, 216, 0.26);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border-color: #dbe3f0;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.04);
}
.btn-secondary:hover:not(:disabled) {
  background: #f8fbff;
  border-color: #bfd5ff;
  box-shadow: 0 14px 24px rgba(59, 130, 246, 0.1);
}

.btn-destructive {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  border-color: #ef4444;
}
.btn-destructive:hover:not(:disabled) { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

.btn-ghost { background: transparent; color: #18181b; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: #f4f4f5; }

.btn-sm { height: 40px; padding: 0 16px; font-size: 1rem; }
.btn-icon { height: 44px; width: 44px; padding: 0; }
.btn-icon.btn-sm { height: 38px; width: 38px; }

.btn-full { width: 100%; }

/* --- Form --- */
.form-input {
  display: block;
  width: 100%;
  height: 48px;
  border-radius: 0.875rem;
  border: 1px solid #dbe3f0;
  padding: 10px 14px;
  font-size: 1.0625rem;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 18px rgba(15, 23, 42, 0.03);
}
.form-input:hover { border-color: #c7d7f2; }
.form-input:focus {
  border-color: #60a5fa;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15), 0 16px 30px rgba(96, 165, 250, 0.12);
}
.form-input:disabled { opacity: 0.5; cursor: not-allowed; background: #f4f4f5; }

textarea.form-input { height: auto; min-height: 104px; resize: vertical; }
select.form-input { cursor: pointer; }

input[type='file'].form-input {
  padding: 8px;
  height: 56px;
  border-style: dashed;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

input[type='file'].form-input::file-selector-button {
  margin-right: 12px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid #c9dafc;
  border-radius: 0.75rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

input[type='file'].form-input:hover::file-selector-button {
  background: #dbeafe;
  border-color: #93c5fd;
}

.form-label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  margin-top: 12px;
  letter-spacing: 0.01em;
}
.form-label:first-child { margin-top: 0; }

.form-grid { display: grid; gap: 12px; }

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-destructive { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #f4f4f5; color: #71717a; }

/* --- Card --- */
.shadcn-card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 1.375rem;
  padding: 22px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.shadcn-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.1), rgba(59, 130, 246, 0.28), rgba(16, 185, 129, 0.1));
  pointer-events: none;
}

/* --- Picture book workflow --- */
.picture-book-workflow {
  --workflow-extract: #0f172a;
  --workflow-create: #2563eb;
  --workflow-edit: #7c3aed;
  --workflow-segment: #0891b2;
  --workflow-save: #059669;
  --workflow-audio: #d97706;
  --workflow-block: #db2777;
}

.workflow-steps {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.workflow-step {
  --workflow-color: #2563eb;
  position: relative;
  min-width: 0;
  min-height: 174px;
  padding: 16px 16px 18px;
  border: 1px solid color-mix(in srgb, var(--workflow-color) 46%, #e2e8f0);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--workflow-color) 14%, #ffffff) 0%, color-mix(in srgb, var(--workflow-color) 5%, #ffffff) 100%),
    #ffffff;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--workflow-color) 10%, transparent),
    0 14px 26px color-mix(in srgb, var(--workflow-color) 12%, transparent);
}

.workflow-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 32px;
  right: -10px;
  width: 18px;
  height: 18px;
  border-top: 2px solid color-mix(in srgb, var(--workflow-color) 44%, #cbd5e1);
  border-right: 2px solid color-mix(in srgb, var(--workflow-color) 44%, #cbd5e1);
  transform: rotate(45deg);
  background: #ffffff;
  z-index: 1;
}

.workflow-step-extract { --workflow-color: var(--workflow-extract); }
.workflow-step-create { --workflow-color: var(--workflow-create); }
.workflow-step-edit { --workflow-color: var(--workflow-edit); }
.workflow-step-segment { --workflow-color: var(--workflow-segment); }
.workflow-step-save { --workflow-color: var(--workflow-save); }
.workflow-step-audio { --workflow-color: var(--workflow-audio); }
.workflow-step-block { --workflow-color: var(--workflow-block); }

.workflow-step-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--workflow-color);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 800;
  box-shadow: 0 10px 18px color-mix(in srgb, var(--workflow-color) 26%, transparent);
}

.workflow-step-body h4 {
  margin: 0 0 8px;
  color: var(--workflow-color);
  font-size: 1.0625rem;
  font-weight: 800;
}

.workflow-step-body p {
  margin: 0;
  color: #334155;
  font-size: 0.9375rem;
  line-height: 1.65;
}

.workflow-title-create { color: #2563eb; }
.workflow-title-segment { color: #0891b2; }
.workflow-title-save { color: #059669; }
.workflow-title-audio { color: #d97706; }
.workflow-title-block { color: #db2777; }

.workflow-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workflow-panel-create,
.workflow-panel-segment,
.workflow-panel-audio,
.workflow-panel-block {
  --workflow-panel-color: #2563eb;
  border-color: color-mix(in srgb, var(--workflow-panel-color) 38%, #e2e8f0);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--workflow-panel-color) 7%, #ffffff) 0%, #ffffff 58%),
    #ffffff;
}

.workflow-panel-create::before,
.workflow-panel-segment::before,
.workflow-panel-audio::before,
.workflow-panel-block::before {
  height: 3px;
  background: linear-gradient(90deg, var(--workflow-panel-color), color-mix(in srgb, var(--workflow-panel-color) 24%, #ffffff));
}

.workflow-panel-create { --workflow-panel-color: #2563eb; }
.workflow-panel-segment { --workflow-panel-color: #0891b2; }
.workflow-panel-audio { --workflow-panel-color: #d97706; }
.workflow-panel-block { --workflow-panel-color: #db2777; }

.workflow-action-extract {
  color: #ffffff;
  border-color: #0f172a;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.24);
}

.workflow-action-extract:hover:not(:disabled) {
  color: #ffffff;
  border-color: #020617;
  background: linear-gradient(135deg, #020617 0%, #1e293b 100%);
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.32);
}

.workflow-action-video {
  color: #155e75;
  border-color: #67e8f9;
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  box-shadow: 0 12px 24px rgba(8, 145, 178, 0.14);
}

.workflow-action-video:hover:not(:disabled) {
  color: #164e63;
  border-color: #22d3ee;
  background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
  box-shadow: 0 16px 28px rgba(8, 145, 178, 0.2);
}

.workflow-action-create {
  border-color: #2563eb;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.workflow-action-create:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 16px 28px rgba(29, 78, 216, 0.26);
}

.workflow-action-edit {
  color: #ffffff;
  border-color: #7c3aed;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.2);
}

.workflow-action-edit:hover:not(:disabled) {
  color: #ffffff;
  border-color: #6d28d9;
  background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
  box-shadow: 0 16px 28px rgba(109, 40, 217, 0.24);
}

.workflow-action-segment {
  color: #0e7490;
  border-color: #a5f3fc;
  background: #ecfeff;
}

.workflow-action-segment:hover:not(:disabled) {
  border-color: #67e8f9;
  background: #cffafe;
}

.workflow-action-save {
  border-color: #059669;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 12px 24px rgba(5, 150, 105, 0.2);
}

.workflow-action-save:hover:not(:disabled) {
  border-color: #047857;
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 16px 28px rgba(4, 120, 87, 0.24);
}

.workflow-action-audio {
  border-color: #d97706;
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 12px 24px rgba(217, 119, 6, 0.2);
}

.workflow-action-audio:hover:not(:disabled) {
  border-color: #b45309;
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  box-shadow: 0 16px 28px rgba(180, 83, 9, 0.24);
}

.workflow-action-audio-soft {
  color: #b45309;
  border-color: #fed7aa;
  background: #fff7ed;
}

.workflow-action-audio-soft:hover:not(:disabled) {
  border-color: #fdba74;
  background: #ffedd5;
}

.workflow-action-block {
  color: #be185d;
  border-color: #fbcfe8;
  background: #fdf2f8;
}

.workflow-action-block:hover:not(:disabled) {
  border-color: #f9a8d4;
  background: #fce7f3;
}

.guide-video-overlay {
  padding: 28px;
}

.guide-video-modal {
  width: min(1500px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  padding: 0;
  overflow: hidden;
}

.guide-video-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8feff 0%, #ffffff 100%);
}

.guide-video-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.guide-video-label {
  margin-bottom: 4px;
  color: #0891b2;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.guide-video-body {
  padding: 20px;
  background: #ffffff;
  overflow: auto;
  max-height: calc(100vh - 154px);
}

.guide-video-player {
  display: block;
  width: 100%;
  max-height: calc(100vh - 230px);
  aspect-ratio: 16 / 9;
  border: 1px solid #dbe3f0;
  border-radius: 0.875rem;
  background: #020617;
}

.guide-video-note {
  margin-top: 12px;
}

/* --- Status bar --- */
.status-bar {
  padding: 10px 16px;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 12px;
}
.status-bar-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.status-bar-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.notice-bar {
  padding: 10px 16px;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
  margin-bottom: 12px;
}

/* --- Layout grids --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.panel-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.panel-grid .full { grid-column: 1 / -1; }

.workspace-bar {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

/* --- Stat card --- */
.stat-card {
  min-height: 182px;
  border-color: #dbe6fb;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -42px;
  right: -28px;
  width: 132px;
  height: 132px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.22) 0%, rgba(96, 165, 250, 0.08) 42%, rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}
.stat-card h4 { font-size: 0.9375rem; color: #64748b; font-weight: 700; text-transform: uppercase; margin: 0; letter-spacing: 0.05em; }
.stat-card .stat-value {
  margin: 14px 0 0;
  font-size: 2.4rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}
.stat-card .stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 1rem;
  background: #eff6ff;
  color: #2563eb;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.stat-card:nth-child(2) .stat-icon {
  background: #ecfdf3;
  color: #059669;
}
.stat-card:nth-child(2)::after {
  background: radial-gradient(circle, rgba(52, 211, 153, 0.22) 0%, rgba(52, 211, 153, 0.08) 42%, rgba(255, 255, 255, 0) 72%);
}

.stat-card:nth-child(3) .stat-icon {
  background: #fef3c7;
  color: #d97706;
}
.stat-card:nth-child(3)::after {
  background: radial-gradient(circle, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0.08) 42%, rgba(255, 255, 255, 0) 72%);
}

.stat-card:nth-child(4) .stat-icon {
  background: #fee2e2;
  color: #dc2626;
}
.stat-card:nth-child(4)::after {
  background: radial-gradient(circle, rgba(248, 113, 113, 0.2) 0%, rgba(248, 113, 113, 0.08) 42%, rgba(255, 255, 255, 0) 72%);
}

/* --- Quick links --- */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.quick-link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 18px;
  border: 1px solid #deebff;
  border-radius: 1.125rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  text-decoration: none;
  color: #0f172a;
  font-size: 1.0625rem;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.quick-link-card:hover {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  box-shadow: 0 18px 28px rgba(59, 130, 246, 0.12);
  transform: translateY(-2px);
  text-decoration: none;
}
.quick-link-card i {
  color: #2563eb;
  width: 20px;
  height: 20px;
}

/* --- Table --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #e4e4e7;
}
.data-table th {
  background: linear-gradient(180deg, #fbfcff 0%, #f3f7ff 100%);
  font-weight: 600;
  font-size: 0.875rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:hover td {
  background: #f8fbff;
}
.data-table td button {
  width: auto;
  min-width: 52px;
}

.table-shell {
  border: 1px solid #dbe3f0;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.05);
}

.table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.table-note {
  font-size: 0.9375rem;
  color: #64748b;
}

.status-detail {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #b91c1c;
}

/* --- List --- */
.item-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.item-list li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid #e6edf9;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.04);
}

.item-list li:hover {
  border-color: #c7dbff;
  box-shadow: 0 18px 30px rgba(59, 130, 246, 0.08);
}
.item-list .main { min-width: 0; flex: 1; }
.item-list .name { font-weight: 700; font-size: 1.125rem; color: #0f172a; }
.item-list .sub { color: #64748b; font-size: 1rem; margin-top: 4px; }

/* --- Asset list --- */
.asset-list { margin-top: 10px; display: grid; gap: 10px; }
.asset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e6edf9;
  border-radius: 0.875rem;
  background: #f8fbff;
}
.lesson-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.lesson-classroom-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.lesson-classroom-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  padding: 4px 8px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.875rem;
  line-height: 1.2;
}

.lesson-classroom-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
}

.lesson-classroom-remove:hover {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

/* --- Action row --- */
.action-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.users-form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.users-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.users-toolbar .grow {
  flex: 1 1 240px;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination-meta {
  color: #64748b;
  font-size: 0.9375rem;
}

.table-empty {
  padding: 28px 16px;
  text-align: center;
  color: #64748b;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.student-audio-col {
  min-width: 112px;
}

.audio-playback {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.audio-playback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 76px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.08);
}

.audio-playback-btn:hover:not(:disabled) {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1e40af;
}

.audio-playback-btn-playing {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
  box-shadow: 0 8px 16px rgba(22, 101, 52, 0.08);
}

.audio-playback-native {
  display: none;
}

.pending-audio-playback {
  margin-top: 6px;
}

.feedback-status-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: min(100%, 360px);
}

.feedback-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

.feedback-stat-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.875rem;
  line-height: 1;
}

.feedback-stat-pending {
  border-color: #e4e4e7;
  background: #fafafa;
  color: #52525b;
}

.feedback-stat-unread {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.feedback-stat-read {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.feedback-stat-pending .feedback-stat-value {
  background: #f4f4f5;
  color: #52525b;
}

.feedback-stat-unread .feedback-stat-value {
  background: #fef3c7;
  color: #92400e;
}

.feedback-stat-read .feedback-stat-value {
  background: #dcfce7;
  color: #166534;
}

.feedback-row td {
  transition: background 0.15s ease;
}

.data-table tbody tr.feedback-row-pending td {
  background: #ffffff;
}

.data-table tbody tr.feedback-row-unread td {
  background: #fffbeb;
}

.data-table tbody tr.feedback-row-read td {
  background: #f8fef9;
}

.data-table tbody tr.feedback-row-pending td:first-child {
  box-shadow: inset 4px 0 0 #d4d4d8;
}

.data-table tbody tr.feedback-row-unread td:first-child {
  box-shadow: inset 4px 0 0 #f59e0b;
}

.data-table tbody tr.feedback-row-read td:first-child {
  box-shadow: inset 4px 0 0 #22c55e;
}

.data-table tbody tr.feedback-row-pending:hover td {
  background: #fafafa;
}

.data-table tbody tr.feedback-row-unread:hover td {
  background: #fef3c7;
}

.data-table tbody tr.feedback-row-read:hover td {
  background: #ecfdf5;
}

.feedback-status-stack {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.feedback-status-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.feedback-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.feedback-status-pending {
  background: #f4f4f5;
  color: #52525b;
}

.feedback-status-unread {
  background: #fef3c7;
  color: #92400e;
}

.feedback-status-read {
  background: #dcfce7;
  color: #166534;
}

.feedback-status-text {
  color: #475569;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
}

.feedback-audio-empty {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px dashed #d4d4d8;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #71717a;
  font-size: 0.9375rem;
  font-weight: 600;
}

.data-table tbody tr.feedback-row-recording td,
.data-table tbody tr.feedback-row-recording:hover td {
  background: #fff7ed;
}

.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.875rem;
  font-weight: 700;
}

.recording-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #dc2626;
  box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  animation: recording-pulse 1.2s infinite;
}

.recording-active-btn {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18);
}

.record-stop-btn-active {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

@keyframes recording-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35);
  }
  70% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
  }
}

.users-table .table-actions {
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}

.users-table .table-actions .btn {
  height: 32px;
  padding: 0 10px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: none;
}

.users-table .table-actions .btn:hover:not(:disabled) {
  transform: none;
}

.users-table .table-actions .btn-destructive {
  background: #fff5f5;
  color: #dc2626;
  border-color: #fecaca;
}

.users-table .table-actions .btn-destructive:hover:not(:disabled) {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
  box-shadow: none;
}

.users-table-shell {
  border-radius: 1.25rem;
  border-color: #e5e7eb;
  box-shadow: none;
}

.managed-classroom-list {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.managed-classroom-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.managed-classroom-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.managed-classroom-summary {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #475569;
}

.managed-classroom-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dbe3f0;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.managed-classroom-option:hover {
  border-color: #93c5fd;
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.08);
}

.managed-classroom-option input[type='checkbox'] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.managed-classroom-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.managed-classroom-name {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.managed-classroom-meta {
  font-size: 0.9375rem;
  color: #6b7280;
}

.managed-classroom-empty {
  padding: 14px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  color: #64748b;
  background: #f8fafc;
}

.users-table {
  font-size: 1rem;
}

.users-table th,
.users-table td {
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.users-table th {
  background: #f3f4f6;
  color: #111827;
  font-size: 0.9375rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
}

.users-table tbody tr:hover td {
  background: #fcfcfd;
}

.user-cell {
  min-width: 220px;
}

.user-primary {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #111827;
}

.user-secondary {
  margin-top: 4px;
  font-size: 0.9375rem;
  color: #6b7280;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.role-badge-admin {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.role-badge-teacher {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.role-badge-student {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

html[data-admin-view-role="TEACHER"] #filterRoleField,
html[data-admin-view-role="TEACHER"] #roleColumnHead {
  display: none !important;
}

.users-table th:last-child,
.users-table td:last-child {
  width: 160px;
  min-width: 160px;
}

.users-table th:last-child {
  text-align: center;
}

html[data-admin-view-role="TEACHER"] #pageHeaderTitle,
html[data-admin-view-role="TEACHER"] #filterTitle,
html[data-admin-view-role="TEACHER"] #listTitle {
  position: relative;
  color: transparent !important;
}

html[data-admin-view-role="TEACHER"] #pageHeaderTitle::after,
html[data-admin-view-role="TEACHER"] #filterTitle::after,
html[data-admin-view-role="TEACHER"] #listTitle::after {
  position: absolute;
  inset: 0;
}

html[data-admin-view-role="TEACHER"] #pageHeaderTitle::after {
  content: '学生管理';
  color: #71717a;
}

html[data-admin-view-role="TEACHER"] #filterTitle::after {
  content: '筛选学生';
  color: #09090b;
}

html[data-admin-view-role="TEACHER"] #listTitle::after {
  content: '学生列表';
  color: #09090b;
}

.workspace-bar > div:last-child .btn {
  min-width: 112px;
}

/* --- QA block --- */
.qa-block {
  margin-top: 18px;
  border-style: solid !important;
  border-color: #dbe6fb !important;
  padding: 20px;
}
.qa-block h4 { margin: 0; }
.qa-block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.qa-block-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.qa-block-index {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.qa-block-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: #0f172a;
}

.qa-block-subtitle {
  margin-top: 4px;
  color: #64748b;
  font-size: 0.9375rem;
  display: none;
}

.qa-block-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.qa-block-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qa-block-section {
  padding: 16px;
  border: 1px solid #e6edf9;
  border-radius: 1.125rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.03);
}

.qa-block-section-full {
  grid-column: 1 / -1;
}

.qa-block-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.qa-block-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.qa-block-section-note {
  margin-top: 4px;
  font-size: 0.875rem;
  color: #64748b;
  display: none;
}

.qa-block-preview {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.9);
}

.qa-block-image {
  max-width: 100%;
  max-height: 180px;
  border-radius: 0.875rem;
  border: 1px solid #dbe4ee;
}

.qa-block-audio {
  width: 100%;
}

.qa-empty {
  font-size: 0.9375rem;
  color: #64748b;
}

.qa-block-toolbar,
.control-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.qa-block-textarea {
  min-height: 132px;
}

/* --- Breadcrumb --- */
.breadcrumb { margin-bottom: 12px; }

/* --- Score badge (reusing .badge but for scores) --- */
.score-high { background: #dcfce7; color: #166534; }
.score-mid { background: #fef9c3; color: #854d0e; }
.score-low { background: #fee2e2; color: #991b1b; }

.badge-outline {
  background: #fff;
  color: #52525b;
  border: 1px solid #e4e4e7;
}

/* --- Word colors (Level2 heatmap) --- */
.word-green { background: #dcfce7; color: #166534; }
.word-yellow { background: #fef9c3; color: #854d0e; }
.word-red { background: #fee2e2; color: #991b1b; }

.word-ok td { background: #f0fdf4; }
.word-problem td { background: #fef2f2; }

.word-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Status chip (Level2) --- */
.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-right: 4px;
}
.status-chip.ok { background: #dcfce7; color: #166534; }
.status-chip.pending { background: #fef9c3; color: #92400e; }
.status-chip.failed { background: #fee2e2; color: #991b1b; }

/* --- Video player --- */
.video-player {
  width: 100%;
  max-height: 420px;
  background: #000;
  border-radius: 0.5rem;
}

.segment-paragraph {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
}

.segment-paragraph-flow {
  line-height: 1.9;
  font-size: 1.06rem;
  color: #0f172a;
}

.transcript-paragraph {
  min-height: 120px;
}

.segment-paragraph-chip {
  display: inline;
  margin: 0;
  padding: 0;
  border-radius: 6px;
  cursor: default;
  border: 0;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.segment-paragraph-chip:hover {
  background: rgba(191, 219, 254, 0.45);
}

.segment-paragraph-chip.is-selected {
  background: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.12);
}

.segment-paragraph-chip.is-covered {
  background: rgba(219, 234, 254, 0.55);
  color: #1e3a8a;
}

.cutpoint-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 8px;
}

.cutpoint-marker {
  border: 0;
  background: transparent;
  width: 14px;
  min-width: 14px;
  height: 28px;
  margin: 0 1px;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.cutpoint-marker:hover {
  background: rgba(191, 219, 254, 0.25);
}

.cutpoint-marker.is-active {
  background: rgba(191, 219, 254, 0.35);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.cutpoint-marker:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.cutpoint-hover-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 11px;
  line-height: 1;
  color: #1d4ed8;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}

.cutpoint-active-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 4px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #1d4ed8 0%, #2563eb 100%);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18), 0 4px 12px rgba(29, 78, 216, 0.35);
  opacity: 0;
  transition: opacity 0.14s ease;
  pointer-events: none;
}

.cutpoint-marker:hover .cutpoint-hover-icon {
  opacity: 1;
  transform: scale(1);
}

.cutpoint-marker.is-active .cutpoint-hover-icon {
  opacity: 0;
}

.cutpoint-marker.is-active .cutpoint-active-bar {
  opacity: 1;
}

.segment-advanced {
  margin-top: 14px;
}

.segment-block-title {
  color: #334155;
  font-weight: 700;
  margin-bottom: 10px;
}

/* --- Segment table --- */
.segment-table input[type='number'],
.segment-table textarea {
  width: 100%;
  min-width: 80px;
}
.segment-table textarea {
  min-height: 88px;
  resize: vertical;
  overflow-y: hidden;
  line-height: 1.7;
  white-space: pre-wrap;
}

.segment-row-active td {
  background: #eff6ff;
}

.segment-row-selection td {
  background: #eefbf3;
}

.segment-text-wrap {
  display: grid;
  gap: 8px;
}

.segment-text {
  display: block;
}

.segment-time-edit {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
}

.segment-time-input {
  min-width: 64px;
  padding: 6px 8px;
  height: 34px;
}

.segment-time-sep {
  color: #64748b;
  font-weight: 600;
}

.segment-time-unit {
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
  text-align: right;
}

.segment-sticky-bar {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.94));
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.segment-sticky-meta {
  min-width: 0;
}

.segment-sticky-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.segment-sticky-hint {
  margin-top: 4px;
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.5;
}

.segment-sticky-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 8px;
  margin: 0 2px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.25);
}

.segment-sticky-btn {
  min-width: 152px;
  flex-shrink: 0;
}

.segment-meta-row {
  display: flex;
  align-items: center;
}

.merge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.merge-chip-atomic {
  color: #64748b;
  background: #f8fafc;
  border-color: #e2e8f0;
}

.segment-row-merged td {
  background: #fafcff;
}

.segment-merge-group-1 td {
  box-shadow: inset 4px 0 0 #93c5fd;
}
.segment-merge-group-2 td {
  box-shadow: inset 4px 0 0 #86efac;
}
.segment-merge-group-3 td {
  box-shadow: inset 4px 0 0 #f9a8d4;
}
.segment-merge-group-4 td {
  box-shadow: inset 4px 0 0 #c4b5fd;
}
.segment-merge-group-5 td {
  box-shadow: inset 4px 0 0 #fdba74;
}
.segment-merge-group-6 td {
  box-shadow: inset 4px 0 0 #67e8f9;
}

.merge-chip.segment-merge-group-1 {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #93c5fd;
}
.merge-chip.segment-merge-group-2 {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}
.merge-chip.segment-merge-group-3 {
  color: #9d174d;
  background: #fce7f3;
  border-color: #f9a8d4;
}
.merge-chip.segment-merge-group-4 {
  color: #5b21b6;
  background: #ede9fe;
  border-color: #c4b5fd;
}
.merge-chip.segment-merge-group-5 {
  color: #9a3412;
  background: #ffedd5;
  border-color: #fdba74;
}
.merge-chip.segment-merge-group-6 {
  color: #155e75;
  background: #cffafe;
  border-color: #67e8f9;
}

/* --- Question group toggle --- */
.question-group .toggle-btn {
  width: auto;
  min-width: 72px;
}

.detail-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-stat {
  padding: 16px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.04);
}

.detail-stat-label {
  font-size: 0.75rem;
  color: #71717a;
}

.detail-stat-value {
  margin-top: 6px;
  font-size: 1.125rem;
  font-weight: 700;
  color: #09090b;
}

.question-stack {
  display: grid;
  gap: 12px;
}

.question-card {
  border: 1px solid #dbe3f0;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 18px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
}

.question-card-dashed {
  border-style: dashed;
}

.question-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.question-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.audio-wrap {
  padding: 16px 18px;
  border: 1px solid #dbe3f0;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  background: linear-gradient(180deg, #fcfdff 0%, #f6f8fe 100%);
  border-right: 1px solid #e6eaf5;
  box-shadow: 12px 0 32px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width 0.2s ease;
  overflow: hidden;
}

.sidebar-collapsed {
  width: 92px;
}

.sidebar-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  padding: 22px 20px 18px;
  border-bottom: 1px solid #e6eaf5;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #09090b;
  overflow: hidden;
  width: 100%;
}

.sidebar-logo-mark {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.sidebar-brand-copy {
  display: grid;
  gap: 2px;
}

.sidebar-brand-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.sidebar-brand-subtitle {
  display: block;
  font-size: 0.6875rem;
  color: #64748b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px 18px;
}

.sidebar-group { margin-bottom: 22px; }

.sidebar-group-label {
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 1.125rem;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  text-decoration: none;
  transform: translateY(-1px);
}
.sidebar-link-active {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.14);
}

.sidebar-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.sidebar-label {
  transition: opacity 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-collapsed .sidebar-label { opacity: 0; width: 0; }
.sidebar-collapsed .sidebar-group-label { opacity: 0; height: 0; margin: 0; }

.sidebar-footer {
  border-top: 1px solid #e6eaf5;
  padding: 16px 14px 18px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e4e4e7;
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.sidebar-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: 1.0625rem; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.9375rem; color: #64748b; white-space: nowrap; }

.sidebar-collapsed .sidebar-user {
  justify-content: center;
  padding: 8px 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* ============================================================
   Header
   ============================================================ */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(228, 228, 231, 0.9);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-header-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}

.admin-header-sep {
  color: #d4d4d8;
  font-size: 1.0625rem;
}

.admin-header-page {
  font-size: 1.0625rem;
  color: #71717a;
}

.admin-header-action {
  min-width: 88px;
  height: 38px;
}

.role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 600;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 8px 6px 10px;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: #18181b;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

.user-menu-trigger:hover {
  border-color: #bfdbfe;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.user-menu-trigger:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.user-menu-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.user-menu-avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1rem;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 292px;
  z-index: 60;
}

.user-menu-panel {
  overflow: hidden;
  border: 1px solid #e4e4e7;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 44px rgba(15, 23, 42, 0.14);
}

.user-menu-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.user-menu-name {
  font-size: 1.1875rem;
  font-weight: 700;
  color: #111827;
}

.user-menu-role-text {
  margin-top: 2px;
  font-size: 1.0625rem;
  color: #64748b;
}

.user-menu-section {
  padding: 14px 16px 10px;
}

.user-menu-label {
  margin-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-menu-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 1.0625rem;
  color: #111827;
}

.user-menu-actions {
  padding: 10px;
  display: grid;
  gap: 6px;
}

.user-menu-item {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #18181b;
  font-size: 1.0625rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.user-menu-item:hover {
  background: #f8fafc;
}

.user-menu-item-danger {
  color: #dc2626;
}

.user-menu-item-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

/* ============================================================
   Main content
   ============================================================ */
.main-content {
  margin-left: 320px;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
  display: flex;
  flex-direction: column;
}

.main-content-expanded {
  margin-left: 92px;
}

.page-content {
  flex: 1;
  padding: 30px 36px 132px;
  max-width: none;
  width: 100%;
}

/* ============================================================
   Login layout (no sidebar)
   ============================================================ */
.login-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

/* ============================================================
   Overlay (mobile sidebar)
   ============================================================ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 35;
}

body.modal-open {
  overflow: hidden;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
}

.admin-modal {
  width: min(100%, 520px);
  border: 1px solid rgba(219, 234, 254, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.admin-modal-header {
  padding: 22px 24px 12px;
}

.admin-modal-header-success {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.admin-modal-success-badge {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
  box-shadow: 0 14px 32px rgba(34, 197, 94, 0.28);
}

.admin-modal-success-label {
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #16a34a;
}

.admin-modal-header-error .admin-modal-success-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 14px 32px rgba(239, 68, 68, 0.24);
}

.admin-modal-header-error .admin-modal-success-label {
  color: #dc2626;
}

.admin-modal-alert-error {
  border-color: rgba(254, 202, 202, 0.95);
}

.admin-modal-alert-error .admin-modal-ok {
  border-color: #dc2626;
  background: #dc2626;
  color: #ffffff;
}

.admin-modal-alert-error .admin-modal-ok:hover {
  background: #b91c1c;
}

.admin-modal-body {
  padding: 0 24px 18px;
}

.admin-modal-message {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #475569;
}

.admin-modal-message-strong {
  color: #334155;
  font-weight: 600;
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 24px;
}

.admin-modal-actions .btn {
  min-width: 96px;
}

.classroom-picker-modal {
  width: min(1120px, calc(100vw - 48px));
}

.classroom-picker-modal .admin-modal-header {
  padding-bottom: 16px;
}

.classroom-picker-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-height: 292px;
  padding: 16px;
  border: 1px solid #dbe3f0;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

#createClassroomCheckboxes.form-input,
#editClassroomCheckboxes.form-input {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
  height: auto;
  min-height: 292px;
  padding: 16px;
  overflow: visible;
}

.classroom-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 124px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.classroom-picker-option:hover {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 10px 22px rgba(59, 130, 246, 0.08);
}

.classroom-picker-option input[type='checkbox'] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: #2563eb;
}

.classroom-picker-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 650;
}

.classroom-picker-empty {
  grid-column: 1 / -1;
  padding: 14px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
  color: #64748b;
  font-size: 1rem;
}

.classroom-picker-actions {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.classroom-picker-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.classroom-picker-actions .btn {
  min-width: 92px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1500px) {
  .workflow-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workflow-step:not(:last-child)::after { display: none; }
}

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .workspace-bar { grid-template-columns: 1fr; }
  .panel-grid { grid-template-columns: 1fr; }
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-card-header { flex-direction: column; }
  .table-toolbar { flex-direction: column; }
  .feedback-status-summary {
    justify-content: flex-start;
    min-width: 0;
  }
  .segment-sticky-bar {
    bottom: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .segment-sticky-btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: 320px;
  }
  .sidebar-mobile-open {
    transform: translateX(0);
  }
  .main-content,
  .main-content-expanded {
    margin-left: 0;
  }
  .admin-header {
    padding: 12px 16px;
  }
  .admin-header-left,
  .admin-header-right {
    gap: 8px;
  }
  .page-content { padding: 16px 16px 120px; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .workflow-steps { grid-template-columns: 1fr; }
  .workflow-step {
    min-height: 0;
    padding: 14px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
  }
  .workflow-step-marker { margin-bottom: 0; }
  .detail-stats { grid-template-columns: 1fr; }
  .user-menu-dropdown {
    width: min(292px, calc(100vw - 32px));
  }
  .classroom-picker-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 428px;
  }
  #createClassroomCheckboxes.form-input,
  #editClassroomCheckboxes.form-input {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 428px;
  }
  .classroom-picker-actions,
  .classroom-picker-action-group {
    width: 100%;
  }
  .classroom-picker-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
  .workflow-toolbar-actions {
    width: 100%;
    justify-content: stretch;
  }
  .workflow-toolbar-actions .btn {
    flex: 1 1 100%;
  }
  .guide-video-overlay {
    padding: 12px;
  }
  .guide-video-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
  .guide-video-header,
  .guide-video-body {
    padding: 14px;
  }
  .guide-video-header {
    align-items: stretch;
    flex-direction: column;
  }
  .guide-video-header-actions {
    justify-content: space-between;
  }
  .guide-video-body {
    max-height: calc(100vh - 188px);
  }
  .guide-video-player {
    max-height: calc(100vh - 260px);
  }
}
