/* =========================================================================
   ИнфоСтарт Studio — design system
   ========================================================================= */

:root {
  --bg: #f4f6fb;
  --bg-soft: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --ink: #0f172a;
  --ink-2: #26334d;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-3: #0ea5e9;
  --brand-soft: #eef2ff;
  --good: #059669;
  --good-soft: #ecfdf5;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.18);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-sm: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -8%, rgba(99, 102, 241, 0.14), transparent 34rem),
    radial-gradient(circle at 92% 2%, rgba(14, 165, 233, 0.1), transparent 30rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.has-modal {
  overflow: hidden;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

img {
  max-width: 100%;
}

::selection {
  background: rgba(79, 70, 229, 0.2);
}

:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.35);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.14em;
}

.is-hidden {
  display: none !important;
}

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

.noscript {
  margin: 24px auto;
  max-width: 720px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
}

/* -------------------------------------------------------------------------
   Topbar
   ------------------------------------------------------------------------- */

.studio-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 28px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, #4338ca, #2563eb 55%, #0ea5e9);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mode-switch {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-3);
}

.mode-switch button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  transition: 0.16s ease;
}

.mode-switch button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

.mode-switch button.is-active {
  color: var(--brand);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.mode-lock {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11px;
  font-weight: 700;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
}

.topbar-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.topbar-user-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user-copy strong {
  font-size: 12px;
}

.topbar-user-copy small {
  color: var(--muted);
  font-size: 10px;
}

/* -------------------------------------------------------------------------
   Buttons, pills, fields
   ------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  transition: 0.16s ease;
}

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

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

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.22);
}

.btn-primary:hover {
  box-shadow: 0 12px 22px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: #b8c4d6;
  background: var(--surface-2);
}

.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: #fff;
}

.btn-danger {
  background: var(--bad);
  color: #fff;
}

.btn-danger-ghost {
  border-color: #fecaca;
  background: var(--bad-soft);
  color: var(--bad);
}

.btn-danger-ghost:hover {
  background: #fee2e2;
}

.btn-sm {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-lg {
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 13px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.btn.is-pulsing {
  animation: pulse-brand 1.8s ease infinite;
}

.btn.is-busy {
  opacity: 0.75;
}

@keyframes pulse-brand {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.22);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(79, 70, 229, 0.12);
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  transition: 0.14s;
}

.icon-btn:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn-danger:hover {
  border-color: #fecaca;
  background: var(--bad-soft);
  color: var(--bad);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.pill .icon {
  width: 0.95em;
  height: 0.95em;
}

.pill-neutral {
  background: var(--surface-3);
  color: var(--muted);
}

.pill-new {
  background: var(--brand-soft);
  color: var(--brand);
}

.pill-due {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill-scheduled {
  background: #ecfeff;
  color: #0e7490;
}

.pill-success {
  background: var(--good-soft);
  color: var(--good);
}

.pill-danger {
  background: var(--bad-soft);
  color: var(--bad);
}

.pill-warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field textarea,
.field select,
.compact-select select,
.search-box input,
.tree-search input,
.test-row input,
.test-row textarea,
.inline-field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  transition: 0.15s;
}

.field input,
.field select,
.compact-select select,
.search-box input,
.inline-field input {
  height: 38px;
  padding: 0 11px;
}

.field textarea,
.test-row textarea {
  padding: 9px 11px;
  line-height: 1.55;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.compact-select select:focus,
.search-box input:focus,
.tree-search input:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.13);
}

.field small,
.field-help {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.field-wide {
  grid-column: 1 / -1;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
}

.check-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.check-field.check-inline {
  gap: 6px;
}

.inline-field {
  display: flex;
  gap: 6px;
  align-items: center;
}

.inline-field input {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -------------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------------- */

.studio-main {
  flex: 1 0 auto;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px 28px 60px;
}

.studio-view {
  animation: view-in 0.25s ease;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.studio-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.footer-inner {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 20px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  color: var(--muted);
  font-size: 11px;
}

.footer-privacy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.footer-dot {
  margin: 0 7px;
  color: var(--muted-2);
}

/* -------------------------------------------------------------------------
   Guest dashboard
   ------------------------------------------------------------------------- */

.guest-dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feed-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 15px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
}

.feed-banner > div {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.feed-banner strong {
  font-size: 12px;
}

.feed-banner span {
  opacity: 0.85;
}

.feed-banner .btn {
  margin-left: auto;
}

.guest-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  gap: 40px;
  align-items: center;
  padding: 44px 46px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 82% 12%, rgba(34, 211, 238, 0.18), transparent 24rem),
    radial-gradient(circle at 4% 100%, rgba(129, 140, 248, 0.32), transparent 30rem),
    linear-gradient(135deg, #0c1530 0%, #172554 52%, #2e1065 100%);
  color: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.guest-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to right, transparent, #000 70%);
  pointer-events: none;
}

.guest-hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c7d2fe;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.guest-hero h1 {
  margin-top: 15px;
  font-size: clamp(30px, 3.6vw, 48px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.guest-hero h1 span {
  color: #a5b4fc;
}

.hero-lead {
  max-width: 640px;
  margin-top: 16px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-actions .btn-ghost {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.hero-actions .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

.hero-footnotes {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 22px;
  color: #94a3b8;
  font-size: 10.5px;
  font-weight: 600;
}

.hero-footnotes span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.guest-hero-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
}

.readiness-ring {
  --progress: 0;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(
    #22d3ee calc(var(--progress) * 1%),
    rgba(255, 255, 255, 0.13) 0
  );
  position: relative;
}

.readiness-ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #16224a;
}

.readiness-ring-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.readiness-ring-inner strong {
  font-size: 28px;
  letter-spacing: -0.04em;
}

.readiness-ring-inner span {
  color: #94a3b8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero-card-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.hero-card-kicker {
  color: #a5b4fc;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-card-copy strong {
  font-size: 36px;
  line-height: 1;
}

.hero-card-copy > span:last-child {
  color: #94a3b8;
  font-size: 11px;
}

.hero-card-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-card-split div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero-card-split span {
  color: #94a3b8;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-card-split strong {
  font-size: 18px;
}

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

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 17px;
}

.stat-card > div {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.stat-card > div > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 21px;
  letter-spacing: -0.03em;
}

.stat-card small {
  color: var(--muted-2);
  font-size: 10px;
}

.guest-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}

.guest-main-col,
.guest-side-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 16px;
}

.panel-head-sm {
  padding: 18px 20px 12px;
}

.panel-head h2 {
  margin-top: 2px;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.panel-head-sm h2 {
  font-size: 16px;
}

.section-kicker {
  color: var(--brand);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.count-bubble {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.link-btn {
  padding: 3px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand);
  font-size: 9.5px;
  font-weight: 700;
}

.link-btn:hover {
  background: var(--brand-soft);
}

.attempt-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 58vh;
  overflow: auto;
}

.attempt-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
}

.attempt-row:nth-child(odd) {
  background: var(--surface-2);
}

.attempt-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.attempt-main strong {
  font-size: 11.5px;
}

.attempt-main small {
  overflow: hidden;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attempt-metrics {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

/* Library toolbar */

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 24px 16px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
}

.segmented button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 700;
}

.segmented button.is-active {
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.compact-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.compact-select > span {
  position: absolute;
  left: 9px;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}

.compact-select select {
  width: auto;
  min-width: 132px;
  max-width: 230px;
  padding-left: 29px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 16px, calc(100% - 8px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 180px;
  padding-left: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.13);
}

.search-box input {
  border: 0;
  box-shadow: none !important;
  background: transparent;
  padding-left: 0;
}

.search-box input:focus {
  outline: none;
}

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

.task-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: 0.18s ease;
}

.task-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: var(--shadow-md);
}

.task-card.is-due {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffdf5, #fff);
}

.task-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.exam-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.task-topic {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card-head .pill {
  margin-left: auto;
}

.task-card h3 {
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.task-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
}

.task-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 5px;
}

.task-card-foot .muted {
  font-family: var(--mono);
  font-size: 9px;
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 0 24px 24px;
}

/* Side cards */

.side-panel-card {
  padding-bottom: 16px;
}

.due-list,
.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px 12px;
}

.due-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.due-item:hover {
  background: var(--surface-2);
}

.due-item > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.due-item strong {
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.due-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.due-item > .icon {
  color: var(--muted-2);
}

.due-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-soft);
}

.due-panel .btn-block {
  width: calc(100% - 32px);
  margin: 0 16px;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
}

.history-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  flex: 0 0 auto;
}

.history-mark.is-good {
  background: var(--good-soft);
  color: var(--good);
}

.history-mark.is-bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.history-row > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.history-row strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row small {
  color: var(--muted-2);
  font-size: 9px;
}

.grade-chip {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.side-empty {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 18px;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.side-empty .icon {
  color: var(--muted-2);
  font-size: 16px;
}

.local-panel {
  padding: 18px 20px;
}

.local-panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--brand);
}

.local-panel-head > div {
  display: flex;
  flex-direction: column;
}

.local-panel-head strong {
  color: var(--ink);
  font-size: 12px;
}

.local-panel-head span {
  color: var(--muted);
  font-size: 9px;
}

.local-panel p {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.local-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.local-actions .btn {
  padding: 5px 8px;
  font-size: 10px;
}

.sets-panel {
  overflow: hidden;
}

.sets-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 390px;
  overflow: auto;
  padding: 0 14px 14px;
}

.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 10px;
}

.set-row:hover {
  background: var(--surface-2);
}

.set-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.set-main strong {
  font-size: 12.5px;
}

.set-main > span {
  color: var(--muted);
  font-size: 10px;
}

.progress-track {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-3));
  transition: width 0.3s;
}

.set-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.set-percent {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.skeleton-card {
  height: 175px;
  background: linear-gradient(90deg, #f8fafc 25%, #eef2f7 50%, #f8fafc 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-card span {
  display: block;
  height: 12px;
  border-radius: 5px;
  background: rgba(203, 213, 225, 0.45);
}

.skeleton-card span:nth-child(1) {
  width: 45%;
}

.skeleton-card span:nth-child(2) {
  width: 80%;
}

.skeleton-card span:nth-child(3) {
  width: 65%;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 22px;
}

.empty-state h3 {
  color: var(--ink);
  font-size: 16px;
}

.empty-state p {
  max-width: 340px;
  font-size: 12px;
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Practice session
   ------------------------------------------------------------------------- */

.session-view {
  max-width: 1080px;
  margin: 0 auto;
}

.session-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 10px 0;
}

.session-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.session-title > span {
  font-size: 13px;
  font-weight: 700;
}

.session-title small {
  color: var(--muted);
  font-size: 10px;
}

.session-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 260px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.session-progress .progress-track {
  flex: 1;
}

.session-timer {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-2);
}

.practice-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.practice-head {
  padding: 30px 34px 22px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 100% 0, rgba(99, 102, 241, 0.08), transparent 22rem),
    var(--surface-2);
}

.practice-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.soft-badge {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  border: 1px solid var(--line);
}

.practice-head h1 {
  margin-top: 13px;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: -0.03em;
}

.practice-subline {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.practice-statement {
  padding: 28px 34px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.7;
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 34px 20px;
}

.attachment-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
}

.file-chip:hover {
  border-color: var(--brand-2);
  color: var(--brand);
  text-decoration: none;
}

.answer-zone {
  padding: 0 34px 26px;
}

.answer-zone textarea {
  min-height: 96px;
  font-size: 14px;
}

.answer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
}

.answer-actions .muted {
  font-size: 10px;
}

.reveal-zone {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.answer-compare {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 34px;
  font-size: 11px;
}

.answer-compare > div {
  display: flex;
  flex-direction: column;
}

.answer-compare small {
  opacity: 0.75;
  font-size: 10px;
}

.compare-icon {
  font-size: 19px;
}

.answer-compare.is-good {
  background: var(--good-soft);
  color: var(--good);
}

.answer-compare.is-bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.answer-compare.is-neutral {
  background: var(--brand-soft);
  color: var(--brand);
}

.reference-answer {
  margin: 0 34px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.reference-answer > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reference-answer > div {
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  white-space: pre-wrap;
}

.solution-block {
  margin: 14px 34px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.solution-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--brand);
  font-size: 11px;
}

.grade-panel {
  margin-top: 20px;
  padding: 22px 34px 28px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.grade-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.grade-panel-head h3 {
  margin-top: 2px;
  font-size: 15px;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.grade-btn {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  transition: 0.15s;
}

.grade-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.grade-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.grade-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.grade-text strong {
  font-size: 11px;
}

.grade-text small {
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grade-next {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}

.grade-again .grade-num {
  background: var(--bad-soft);
  color: var(--bad);
}

.grade-hard .grade-num {
  background: var(--warn-soft);
  color: var(--warn);
}

.grade-good .grade-num {
  background: #ecfeff;
  color: #0e7490;
}

.grade-easy .grade-num {
  background: var(--good-soft);
  color: var(--good);
}

/* Summary */

.summary-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.summary-hero {
  padding: 40px 36px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 86% 20%, rgba(34, 211, 238, 0.18), transparent 20rem),
    linear-gradient(135deg, #0c1530, #172554 60%, #312e81);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.summary-hero h1 {
  margin-top: 10px;
  font-size: 40px;
  letter-spacing: -0.04em;
}

.summary-hero p {
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 13px;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.summary-actions .btn-ghost {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

.summary-stat {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.summary-stat span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.summary-stat.is-good strong {
  color: var(--good);
}

.summary-stat.is-bad strong {
  color: var(--bad);
}

.summary-list {
  overflow: hidden;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
}

.summary-row > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.summary-row strong {
  font-size: 12px;
}

.summary-row small {
  color: var(--muted);
  font-size: 9.5px;
}

/* -------------------------------------------------------------------------
   Teacher shell
   ------------------------------------------------------------------------- */

.teacher-gate {
  display: grid;
  place-items: center;
  min-height: 62vh;
  padding: 30px 16px;
}

.gate-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: min(540px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgba(99, 102, 241, 0.1), transparent 20rem),
    #fff;
  box-shadow: var(--shadow-md);
}

.gate-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 22px;
}

.gate-card .eyebrow {
  color: var(--brand);
}

.gate-card h1 {
  font-size: 28px;
  letter-spacing: -0.03em;
}

.gate-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.gate-note {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 10px;
}

.teacher-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.teacher-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.teacher-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.teacher-heading h1 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.teacher-tree-meta {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
}

.teacher-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tree-toggle {
  display: none;
}

.teacher-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-height: 72vh;
}

.teacher-tree-pane {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 100px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.tree-mount {
  height: 100%;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

.tree-panel-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.tree-search {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  padding-left: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.tree-search:focus-within {
  border-color: var(--brand-2);
  background: #fff;
}

.tree-search input {
  height: 32px;
  border: 0;
  background: transparent;
  padding-left: 0;
  font-size: 11px;
}

.tree-search input:focus {
  outline: none;
  box-shadow: none;
}

.tree-head-actions {
  display: flex;
  gap: 2px;
}

.tree-head-actions .icon-btn {
  width: 29px;
  height: 29px;
}

.tree-scroll {
  flex: 1;
  overflow: auto;
  padding: 8px 7px 14px;
  scrollbar-width: thin;
}

.tree-exam {
  margin-bottom: 8px;
}

.tree-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 5px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
}

.tree-row:hover {
  background: var(--surface-2);
}

.tree-row.is-selected {
  background: var(--brand-soft);
}

.tree-row.is-selected .tree-title {
  color: var(--brand);
}

.tree-chevron {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  flex: 0 0 auto;
}

.tree-chevron .icon {
  width: 13px;
  height: 13px;
  transition: transform 0.15s;
}

.tree-chevron.is-open .icon {
  transform: rotate(90deg);
}

.tree-chevron:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.exam-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 21px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tree-exam-title {
  font-size: 11.5px;
  font-weight: 750;
}

.tree-kind-icon {
  display: grid;
  place-items: center;
  width: 18px;
  color: var(--muted);
  font-size: 13px;
  flex: 0 0 auto;
}

.tree-kind-icon.is-topic {
  color: var(--brand);
}

.tree-leaf-dot {
  width: 5px;
  height: 5px;
  margin: 0 6px 0 8px;
  border-radius: 50%;
  background: var(--muted-2);
  flex: 0 0 auto;
}

.tree-indent {
  width: 1px;
}

.tree-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.tree-title {
  overflow: hidden;
  font-size: 11px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-sub {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-meta {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}

.mini-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.mini-badge {
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 7.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-badge.is-error {
  background: var(--bad-soft);
  color: var(--bad);
}

.mini-badge.is-draft {
  background: var(--warn-soft);
  color: var(--warn);
}

.mini-badge.is-code {
  background: var(--brand-soft);
  color: var(--brand);
}

.tree-actions {
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.12s;
}

.tree-row:hover .tree-actions,
.tree-row.is-selected .tree-actions,
.tree-row:focus-within .tree-actions {
  opacity: 1;
}

.tree-action {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
}

.tree-action:hover {
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.tree-action .icon {
  width: 12px;
  height: 12px;
}

.tree-children {
  margin-left: 19px;
  padding-left: 7px;
  border-left: 1px solid var(--line);
}

.tree-exam-children {
  margin-left: 9px;
}

.tree-empty,
.tree-empty-block {
  padding: 7px 10px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-style: italic;
}

.tree-empty-block {
  text-align: center;
  padding: 26px 10px;
}

.tree-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 30px;
  color: var(--muted);
  font-size: 11px;
}

.tree-rename-input {
  width: 100%;
  height: 23px;
  padding: 0 5px;
  border: 1px solid var(--brand-2);
  border-radius: 4px;
  font-size: 11px;
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.14);
}

.tree-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
}

.tree-revision {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted-2);
}

/* Editor */

.teacher-editor-pane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  min-height: 72vh;
}

.editor-doc {
  padding: 22px 26px 30px;
}

.editor-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 80px 20px;
  color: var(--muted);
  font-size: 12px;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.editor-head > div:first-child {
  min-width: 0;
}

.editor-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: 9.5px;
}

.editor-breadcrumb .icon {
  color: var(--brand);
  margin-right: 3px;
}

.editor-breadcrumb i {
  color: var(--muted-2);
  font-style: normal;
}

.editor-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.editor-title-line h1 {
  font-size: 24px;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.editor-kind {
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dirty-badge {
  display: none;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 8px;
  font-weight: 750;
}

.dirty-badge.is-visible {
  display: inline-flex;
}

.editor-path {
  margin-top: 5px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8.5px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.issue-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 16px 0 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 9px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 10.5px;
}

.issue-banner > div {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.issue-banner strong {
  font-size: 10.5px;
}

.issue-banner span {
  opacity: 0.85;
}

.editor-form {
  margin-top: 18px;
}

.form-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section-head {
  margin-bottom: 10px;
}

.form-section-head h2 {
  font-size: 14px;
  letter-spacing: -0.015em;
}

.form-section-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

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

.editor-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
  scrollbar-width: none;
}

.editor-tab {
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.editor-tab.is-active {
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

.tab-pane {
  display: none;
  padding: 16px 0 4px;
}

.tab-pane.is-active {
  display: block;
}

.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-bottom: 7px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.md-toolbar > span:first-child {
  margin-right: 3px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.md-tool {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 25px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
}

.md-tool:hover {
  border-color: var(--line);
  background: #fff;
}

.md-hint {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 8.5px;
}

.split-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.editor-textarea textarea {
  min-height: 360px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  overflow: hidden;
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.preview-body {
  flex: 1;
  min-height: 360px;
  max-height: 620px;
  overflow: auto;
  padding: 16px 18px;
  background: #fff;
}

.html-statement {
  width: 100%;
  height: 340px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.html-solution {
  height: 240px;
}

.doc-footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9px;
}

.doc-footer-meta span {
  font-family: var(--mono);
}

/* Files */

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  padding: 26px 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
}

.upload-zone:hover {
  border-color: var(--brand-2);
  background: var(--brand-soft);
  color: var(--brand);
}

.upload-zone strong {
  color: var(--ink-2);
  font-size: 12px;
}

.upload-zone > span:last-child {
  font-size: 9.5px;
}

.upload-icon {
  font-size: 22px;
  color: var(--brand);
}

.file-table {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row .check-field {
  flex: 1;
  min-width: 0;
}

.file-row .check-field span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted-2);
  font-size: 9px;
  font-family: var(--mono);
}

/* Tests */

.tests-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.test-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.test-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.test-row-head input[type="text"] {
  flex: 1;
  height: 32px;
  padding: 0 9px;
  font-size: 11px;
}

.test-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.test-row-grid .field > span {
  font-size: 9px;
}

.test-row-grid textarea {
  font-family: var(--mono);
  font-size: 10.5px;
}

.test-row > input[type="text"] {
  height: 30px;
  padding: 0 8px;
  font-size: 10px;
}

/* Exam overview */

.overview-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.overview-stats > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.overview-stats span {
  display: block;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.overview-stats strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

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

.overview-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  transition: 0.15s;
}

.overview-card:hover {
  border-color: var(--brand-2);
  box-shadow: var(--shadow-sm);
}

.overview-card strong {
  font-size: 12px;
}

.overview-card small {
  color: var(--muted);
  font-size: 9.5px;
}

/* -------------------------------------------------------------------------
   Users panel
   ------------------------------------------------------------------------- */

.panel-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 40px;
  color: var(--muted);
  font-size: 12px;
}

.users-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.users-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.users-stats > div {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.users-stats span {
  display: block;
  color: var(--muted);
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.users-stats strong {
  font-size: 20px;
}

.invite-card {
  padding: 16px;
  border: 1px solid #a7f3d0;
  border-radius: 11px;
  background: var(--good-soft);
}

.invite-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--good);
}

.invite-head > div {
  display: flex;
  flex-direction: column;
}

.invite-head strong {
  font-size: 12px;
}

.invite-head span {
  color: #047857;
  font-size: 9.5px;
}

.invite-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.invite-grid > div {
  padding: 9px 11px;
  border: 1px dashed #6ee7b7;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.7);
}

.invite-grid span {
  display: block;
  color: #047857;
  font-size: 8px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.invite-grid code {
  font-family: var(--mono);
  font-size: 12px;
  color: #065f46;
}

.invite-actions {
  display: flex;
  gap: 5px;
}

.user-create-card,
.users-list-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.user-create-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.user-create-form .field:nth-child(3) {
  grid-column: 1 / -1;
}

.user-create-form.is-admin .field:nth-child(3) {
  grid-column: auto;
}

.user-create-form.is-admin .field:nth-child(5) {
  grid-column: 1 / -1;
}

.user-create-form > .btn {
  grid-column: 1 / -1;
  justify-self: start;
  min-width: 210px;
  margin-top: 2px;
}

.user-create-form .btn {
  height: 38px;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 7px;
  border-radius: 8px;
}

.user-row:hover {
  background: var(--surface-2);
}

.user-row.is-disabled {
  opacity: 0.55;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 9px;
  font-weight: 800;
  flex: 0 0 auto;
}

.user-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-main strong {
  font-size: 11.5px;
}

.user-main span {
  color: var(--muted);
  font-size: 9px;
}

.self-tag {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand) !important;
  font-size: 7.5px !important;
  font-weight: 750;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.user-actions .btn {
  padding: 4px 6px;
  font-size: 9.5px;
}

/* Diagnostics */

.diagnostic-summary {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.diagnostic-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 55vh;
  overflow: auto;
}

.diagnostic-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 10.5px;
}

.diagnostic-row.is-error {
  background: var(--bad-soft);
}

.diag-mark {
  color: var(--muted);
  font-size: 14px;
}

.diagnostic-row.is-error .diag-mark {
  color: var(--bad);
}

.diagnostic-row > div {
  display: flex;
  flex-direction: column;
}

.diagnostic-row strong {
  font-weight: 600;
}

.diagnostic-row small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
}

/* -------------------------------------------------------------------------
   Markdown preview
   ------------------------------------------------------------------------- */

.md {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.md > :first-child {
  margin-top: 0;
}

.md > :last-child {
  margin-bottom: 0;
}

.md h1,
.md h2,
.md h3,
.md h4 {
  margin: 1.2em 0 0.45em;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.md h1 {
  font-size: 1.55em;
}

.md h2 {
  font-size: 1.3em;
}

.md h3 {
  font-size: 1.12em;
}

.md p {
  margin: 0.65em 0;
}

.md ul,
.md ol {
  margin: 0.6em 0;
  padding-left: 1.35em;
}

.md li {
  margin: 0.22em 0;
}

.md strong {
  color: var(--ink);
}

.md code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-3);
  color: #be123c;
  font-family: var(--mono);
  font-size: 0.88em;
}

.md pre {
  margin: 0.8em 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
}

.md pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.85em;
}

.md blockquote {
  margin: 0.8em 0;
  padding: 6px 12px;
  border-left: 3px solid var(--brand-2);
  background: var(--brand-soft);
  color: var(--ink-2);
}

.md a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.md hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.2em 0;
}

.md-table-wrap {
  overflow-x: auto;
  margin: 0.8em 0;
}

.md table {
  border-collapse: collapse;
  font-size: 0.9em;
}

.md th,
.md td {
  padding: 5px 9px;
  border: 1px solid var(--line);
  text-align: left;
}

.md th {
  background: var(--surface-2);
}

.md .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.math-fallback {
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--warn-soft);
  color: var(--warn);
  font-family: var(--mono);
  font-size: 0.9em;
}

.math-fallback-display {
  display: block;
  padding: 8px;
  text-align: center;
}

/* -------------------------------------------------------------------------
   Modal / drawer / toast
   ------------------------------------------------------------------------- */

.modal-overlay,
.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  animation: fade-in 0.15s ease;
}

.panel-overlay {
  justify-content: flex-end;
  padding: 0;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal {
  width: min(520px, 100%);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s ease;
}

.modal-sm {
  width: min(420px, 100%);
}

.modal-lg {
  width: min(760px, 100%);
}

.modal-xl {
  width: min(1000px, 100%);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

.modal-head,
.side-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2,
.side-panel-head h2 {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.modal-head p,
.side-panel-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.modal-body,
.side-panel-body {
  padding: 16px 20px;
  overflow: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--line);
}

.modal-overlay.is-leaving,
.panel-overlay.is-leaving {
  animation: fade-out 0.15s ease forwards;
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

.confirm-text {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.6;
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  height: 100%;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: panel-in 0.2s ease;
}

.side-panel-wide {
  width: min(720px, 100%);
}

@keyframes panel-in {
  from {
    transform: translateX(30px);
    opacity: 0.6;
  }
}

.side-panel-body {
  flex: 1;
}

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease;
}

.toast.is-leaving {
  animation: toast-out 0.18s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toast-icon {
  color: var(--brand);
  font-size: 15px;
}

.toast-success .toast-icon {
  color: var(--good);
}

.toast-error .toast-icon {
  color: var(--bad);
}

.toast-text {
  flex: 1;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.45;
}

.toast-close {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-2);
}

.toast-close .icon {
  width: 11px;
  height: 11px;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .guest-columns {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .teacher-layout {
    grid-template-columns: 340px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .studio-topbar {
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 9px 16px;
  }

  .mode-switch {
    order: 3;
    width: 100%;
  }

  .mode-switch button {
    flex: 1;
    justify-content: center;
  }

  .mode-lock {
    display: none;
  }

  .studio-main {
    padding: 16px 16px 50px;
  }

  .guest-hero {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 30px 24px;
  }

  .guest-hero-card {
    flex-direction: row;
    text-align: left;
  }

  .hero-card-copy {
    align-items: flex-start;
  }

  .hero-card-split {
    display: none;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .guest-side-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .local-panel {
    grid-column: 1 / -1;
  }

  .teacher-layout {
    display: block;
  }

  .teacher-tree-pane {
    position: fixed;
    z-index: 80;
    left: 10px;
    top: 76px;
    bottom: 10px;
    width: min(380px, calc(100vw - 20px));
    max-height: none;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

  .teacher-layout.is-tree-open .teacher-tree-pane {
    transform: none;
  }

  .tree-mount {
    max-height: calc(100vh - 96px);
  }

  .tree-toggle {
    display: inline-grid;
  }

  .editor-doc {
    padding: 18px 16px 24px;
  }

  .editor-head {
    flex-direction: column;
  }

  .editor-actions {
    justify-content: flex-start;
  }

  .split-editor {
    grid-template-columns: 1fr;
  }

  .preview-body {
    max-height: 420px;
  }

  .user-create-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .topbar-right .user-chip {
    display: none !important;
  }

  .guest-hero h1 {
    font-size: 32px;
  }

  .guest-hero-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .readiness-ring {
    width: 104px;
    height: 104px;
  }

  .readiness-ring-inner strong {
    font-size: 22px;
  }

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

  .task-grid {
    grid-template-columns: 1fr;
    padding: 0 16px 18px;
  }

  .panel-head {
    padding: 18px 16px 12px;
  }

  .library-toolbar {
    padding: 0 16px 14px;
  }

  .guest-side-col {
    grid-template-columns: 1fr;
  }

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

  .practice-head,
  .practice-statement,
  .attachment-strip,
  .answer-zone,
  .grade-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .solution-block,
  .reference-answer {
    margin-left: 18px;
    margin-right: 18px;
  }

  .answer-compare {
    padding-left: 18px;
    padding-right: 18px;
  }

  .form-grid,
  .test-row-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid,
  .overview-stats {
    grid-template-columns: 1fr 1fr;
  }

  .users-stats {
    grid-template-columns: 1fr 1fr;
  }

  .user-create-form {
    grid-template-columns: 1fr;
  }

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

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

  .session-topbar {
    flex-wrap: wrap;
  }

  .session-progress {
    width: 100%;
  }

  .footer-inner {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 460px) {
  .mode-switch button {
    font-size: 11px;
    padding: 8px;
  }

  .guest-hero {
    padding: 24px 18px;
  }

  .hero-actions .btn {
    width: 100%;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* ---------------------------------------------------------------------------
   Unified Studio bank + DB/FS sync status
   --------------------------------------------------------------------------- */

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-pill.is-ok {
  border-color: rgba(5, 150, 105, 0.3);
  background: var(--good-soft);
  color: var(--good);
}

.sync-pill .icon {
  width: 14px;
  height: 14px;
}

.autosave-state {
  font-size: 11px;
  color: var(--good);
  font-weight: 600;
  white-space: nowrap;
}

.autosave-state.is-saving {
  color: var(--warn);
}

.autosave-state.is-error {
  color: var(--bad);
}

.bank-overview {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.bank-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.8fr);
  gap: 22px;
  padding: 26px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 90% 10%, rgba(99, 102, 241, 0.22), transparent 42%),
    linear-gradient(135deg, #111827, #1e1b4b 70%, #312e81);
  color: #f8fafc;
  box-shadow: var(--shadow-md);
}

.bank-hero-copy h1 {
  margin: 8px 0 10px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.bank-hero-copy p {
  margin: 0;
  max-width: 62ch;
  color: rgba(226, 232, 240, 0.8);
  font-size: 13px;
  line-height: 1.55;
}

.bank-hero .section-kicker {
  color: #c7d2fe;
}

.bank-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.bank-hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: center;
}

.bank-hero-stats div {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.bank-hero-stats strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.bank-hero-stats span {
  color: rgba(226, 232, 240, 0.72);
  font-size: 11px;
}

.bank-toolbar {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1.4fr) 190px minmax(220px, 1.2fr) auto;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  align-items: end;
}

.bank-toolbar .field {
  gap: 4px;
}

.bank-toolbar .field > span {
  font-size: 11px;
  color: var(--muted);
}

.bank-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.bank-summary strong {
  color: var(--ink);
}

.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 10px;
}

.bank-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.bank-card:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.bank-exam-chip {
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.bank-exam-chip.is-ege {
  background: var(--warn-soft);
  color: var(--warn);
}

.bank-card-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.bank-card-copy strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bank-card-copy small {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-card-copy em {
  color: var(--good);
  font-size: 11px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  max-width: 150px;
}

.bank-card-path {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.25;
  text-align: right;
  word-break: break-all;
  max-height: 30px;
  overflow: hidden;
}

@media (max-width: 1180px) {
  .bank-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .bank-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .bank-toolbar,
  .bank-grid {
    grid-template-columns: 1fr;
  }

  .bank-hero {
    padding: 20px;
  }
}
