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

:root {
  /* Surfaces */
  --gals-color-bg: #f4f6f8;
  --gals-color-surface: #fff;
  --gals-color-text: #1a1a1a;
  --gals-color-text-strong: #1e293b;
  --gals-color-text-muted: #64748b;
  --gals-color-text-subtle: #94a3b8;

  /* Brand & actions */
  --gals-color-accent: #14b8a6;
  --gals-color-accent-dark: #0d9488;
  --gals-color-accent-hover: #0f766e;
  --gals-color-accent-soft: #5eead4;
  --gals-color-accent-warm: #fbbf24;
  /* Ночная палитра промо-ролика: блок с древом познания на лендинге. */
  --gals-color-night: #03110e;
  --gals-color-night-glow: #0b2a26;
  --gals-color-on-night: #eefbf7;
  --gals-color-accent-bright: #2dd4bf;
  --gals-color-accent-pale: #ccfbf1;
  --gals-color-link: #2563eb;
  --gals-color-link-hover: #1d4ed8;
  --gals-color-primary: #2563eb;
  --gals-color-primary-hover: #1d4ed8;

  /* Borders & states */
  --gals-color-border: #cbd5e1;
  --gals-color-border-subtle: #e2e8f0;
  --gals-color-danger: #dc2626;
  --gals-color-danger-hover: #b91c1c;
  --gals-color-secondary-bg: #e2e8f0;
  --gals-color-secondary-hover: #cbd5e1;
  --gals-color-secondary-text: #334155;
  --gals-color-success-bg: #dcfce7;
  --gals-color-success-text: #166534;
  --gals-color-error-bg: #fee2e2;
  --gals-color-error-text: #991b1b;

  /* Mastery status badges */
  --gals-color-status-gap: #991b1b;
  --gals-color-status-gap-bg: #fee2e2;
  --gals-color-status-in-progress: #92400e;
  --gals-color-status-in-progress-bg: #fef3c7;
  --gals-color-status-solid: #166534;
  --gals-color-status-solid-bg: #dcfce7;
  --gals-color-status-correct: #f0fdf4;
  --gals-color-status-correct-bg: #14532d;
  --gals-color-status-notes: #166534;
  --gals-color-status-notes-bg: #dcfce7;
  --gals-color-status-untouched: #475569;
  --gals-color-status-untouched-bg: #f1f5f9;

  /* Typography */
  --gals-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gals-font-display: "Literata", Georgia, serif;
  --gals-line-height: 1.5;

  /* Spacing & shape */
  --gals-radius-sm: 8px;
  --gals-radius-md: 12px;
  --gals-radius-lg: 16px;
  --gals-space-sm: 0.5rem;
  --gals-space-md: 1rem;
  --gals-space-lg: 1.5rem;
  --gals-shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
  --gals-focus-ring-color: var(--gals-color-accent-soft);

  /* Layout */
  --gals-layout-narrow: 560px;
  --gals-layout-wide: 720px;
}

body {
  margin: 0;
  font-family: var(--gals-font-sans);
  /* Prices and counters need lining figures whatever the heading font's default is. */
  font-variant-numeric: lining-nums;
  background: var(--gals-color-bg);
  color: var(--gals-color-text);
  line-height: var(--gals-line-height);
  min-height: 100vh;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--gals-layout-narrow);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.container.container--wide,
body:not(.landing-page) .container:has(.task-list--detailed) {
  max-width: var(--gals-layout-wide);
}

.card {
  background: var(--gals-color-surface);
  border-radius: var(--gals-radius-md);
  padding: var(--gals-space-lg);
  box-shadow: var(--gals-shadow-card);
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.subtitle {
  color: var(--gals-color-text-muted);
  margin: 0 0 var(--gals-space-lg);
  font-size: 0.95rem;
}

.input {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  margin-bottom: var(--gals-space-md);
  border: 1px solid var(--gals-color-border);
  border-radius: var(--gals-radius-sm);
  font-size: 1rem;
}

.input:focus {
  outline: 2px solid var(--gals-color-primary);
  border-color: var(--gals-color-primary);
}

.password-field {
  position: relative;
  margin-bottom: var(--gals-space-md);
}

.password-field .input {
  margin-bottom: 0;
  padding-right: 2.75rem;
}

.password-field__toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--gals-radius-sm);
  background: transparent;
  color: var(--gals-color-text-muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.password-field__toggle:hover {
  color: var(--gals-color-text-strong);
  background: var(--gals-color-secondary-bg);
}

.password-field__toggle:focus-visible {
  outline: 2px solid var(--gals-color-primary);
  outline-offset: 1px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--gals-radius-sm);
  /* <button> would otherwise fall back to the UA font while <a class="btn"> inherits ours. */
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--gals-color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--gals-color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--gals-color-primary-hover);
  text-decoration: none;
}

.btn:disabled,
.btn.is-disabled,
a.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary:disabled:hover,
.btn-primary.is-disabled:hover {
  background: var(--gals-color-primary);
}

.btn-secondary:disabled:hover,
.btn-secondary.is-disabled:hover {
  background: var(--gals-color-secondary-bg);
}

.btn-go {
  width: 100%;
  padding: 0.85rem 1.5rem;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--gals-color-accent), var(--gals-color-accent-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.btn-go:hover {
  background: linear-gradient(135deg, var(--gals-color-accent-dark), var(--gals-color-accent-hover));
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: var(--gals-color-secondary-bg);
  color: var(--gals-color-secondary-text);
}

.btn-secondary:hover {
  background: var(--gals-color-secondary-hover);
  text-decoration: none;
}

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

.btn-danger:hover {
  background: var(--gals-color-danger-hover);
  text-decoration: none;
  color: #fff;
}

.link-danger {
  color: var(--gals-color-danger);
  font-weight: 600;
}

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

.btn-link {
  background: none;
  color: var(--gals-color-text-muted);
  font-weight: 500;
  padding: var(--gals-space-sm);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.language-switcher-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.language-switcher {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}

.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
}

.lang-picker__details {
  position: relative;
}

.lang-picker__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--gals-color-border);
  background: transparent;
  border-radius: var(--gals-radius-sm);
  cursor: pointer;
  list-style: none;
  color: var(--gals-color-text-muted);
  line-height: 1.4;
}

.lang-picker__trigger::-webkit-details-marker {
  display: none;
}

.lang-picker__trigger:hover {
  color: var(--gals-color-text);
  border-color: var(--gals-color-text-muted);
}

.lang-picker__trigger:focus-visible {
  outline: 2px solid var(--gals-focus-ring-color, var(--gals-color-accent));
  outline-offset: 2px;
}

.lang-picker__flag {
  display: block;
  width: 1.25rem;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.lang-picker__chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.55;
}

.lang-picker__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  min-width: 9.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.25rem;
  border: 1px solid var(--gals-color-border);
  border-radius: var(--gals-radius-sm);
  background: var(--gals-color-surface, #fff);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.lang-picker__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: calc(var(--gals-radius-sm) - 2px);
  background: transparent;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gals-color-text);
  cursor: pointer;
  text-align: left;
}

.lang-picker__option:hover {
  background: rgba(0, 0, 0, 0.05);
}

.lang-picker__option:focus-visible {
  outline: 2px solid var(--gals-focus-ring-color, var(--gals-color-accent));
  outline-offset: -2px;
}

.language-switcher--prominent {
  gap: 0.65rem;
}

.lang-picker__langs {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

/* Header navigation inside the language menu — phone only (see @media below); on desktop the
   same links sit in the header row. */
.lang-picker__nav,
.lang-picker__burger,
.lang-picker__name-menu {
  display: none;
}

.lang-picker__nav {
  flex-direction: column;
  gap: 0.125rem;
  padding-bottom: 0.25rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--gals-color-border);
}

.lang-picker__link {
  display: block;
  padding: 0.55rem 0.6rem;
  border-radius: calc(var(--gals-radius-sm) - 2px);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gals-color-text);
  text-decoration: none;
}

.lang-picker__link:hover {
  background: var(--gals-color-accent-soft);
  text-decoration: none;
}

.lang-picker__link:focus-visible {
  outline: 2px solid var(--gals-focus-ring-color, var(--gals-color-accent));
  outline-offset: -2px;
}

/* ☰ drawn with borders: three 2px bars, 14px wide. */
.lang-picker__burger {
  width: 14px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  position: relative;
}

.lang-picker__burger::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  border-top: 2px solid currentColor;
}

@media (max-width: 860px) {
  .lang-picker__nav {
    display: flex;
  }

  .lang-picker__burger {
    display: block;
  }

  .lang-picker__details:has(.lang-picker__burger) .lang-picker__chevron,
  .lang-picker__name-lang {
    display: none;
  }

  .lang-picker__name-menu {
    display: inline;
  }

  .lang-picker__details:has(.lang-picker__nav) .lang-picker__menu {
    min-width: 13rem;
    width: max-content;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
}

.language-switcher--prominent .lang-picker__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gals-color-text-muted);
  white-space: nowrap;
}

.language-switcher--prominent .lang-picker__details {
  padding: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.language-switcher--prominent .lang-picker__trigger {
  padding: 0.5rem 0.85rem;
  border: none;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(232, 237, 245, 0.88);
}

.language-switcher--prominent .lang-picker__trigger:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.language-switcher--prominent .lang-picker__current-name {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .language-switcher--prominent .lang-picker__label,
  .language-switcher--prominent .lang-picker__current-name {
    display: none;
  }

  .language-switcher--prominent .lang-picker__trigger {
    padding: 0.45rem 0.5rem;
  }
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gals-color-text-strong);
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.messages li {
  padding: 0.75rem 1rem;
  border-radius: var(--gals-radius-sm);
  margin-bottom: var(--gals-space-sm);
  background: var(--gals-color-success-bg);
  color: var(--gals-color-success-text);
}

.messages li.error {
  background: var(--gals-color-error-bg);
  color: var(--gals-color-error-text);
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.task-item:last-child {
  border-bottom: none;
}

.task-item.done .task-title {
  text-decoration: line-through;
  color: #94a3b8;
}

.task-list--detailed .task-item--detailed {
  display: block;
  padding: 1.25rem 0;
}

.task-item--collapsible {
  /* Full-width block so summary/body don't sit in a row flex with siblings. */
  display: block;
  padding: 0;
  border-bottom: 1px solid var(--gals-color-border-subtle);
}

.task-item--collapsible:last-child {
  border-bottom: none;
}

.task-details {
  padding: 0;
}

.task-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 1rem 0;
  cursor: pointer;
  list-style: none;
}

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

.task-summary::before {
  content: "▸";
  flex-shrink: 0;
  color: var(--gals-color-text-muted);
  transition: transform 0.15s ease;
}

.task-details[open] > .task-summary::before {
  transform: rotate(90deg);
}

.task-summary-title {
  flex: 1 1 12rem;
  font-weight: 600;
  color: var(--gals-color-text-strong);
}

.task-summary-main {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
}

.task-summary-main .task-summary-title {
  flex: none;
  width: 100%;
}

.task-summary:has(.task-summary-aside) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 0.75rem;
  row-gap: 0.2rem;
}

.task-summary:has(.task-summary-aside)::before {
  grid-column: 1;
  grid-row: 1;
}

.task-summary:has(.task-summary-aside) .task-summary-main {
  grid-column: 2;
  grid-row: 1;
  flex: none;
}

.task-summary:has(.task-summary-aside) .task-summary-aside {
  grid-column: 3;
  grid-row: 1;
}

.task-summary-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  flex-shrink: 0;
}

.task-summary-meta,
.task-summary-duration,
.task-summary-checks {
  font-size: 0.875rem;
  color: var(--gals-color-text-muted);
}

.task-summary-checks,
.task-summary-aside .task-summary-duration {
  white-space: nowrap;
}

@media (max-width: 540px) {
  .task-summary:has(.task-summary-aside) {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .task-summary:has(.task-summary-aside) .task-summary-aside {
    grid-column: 2;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem 0.65rem;
  }

  .task-summary-aside .task-summary-duration {
    white-space: normal;
  }
}

.work-time-assignment {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.9375rem;
  color: var(--gals-color-text-muted);
}

.assignment-nav-fallback {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.9rem;
}

.task-summary-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  min-width: 0;
}

.task-summary-badge--done {
  background: var(--gals-color-status-correct-bg);
  color: var(--gals-color-status-correct);
}

.task-summary-badge--notes {
  background: var(--gals-color-status-notes-bg);
  color: var(--gals-color-status-notes);
}

.task-summary-badge--pending {
  background: var(--gals-color-status-in-progress-bg);
  color: var(--gals-color-status-in-progress);
}

.task-summary-badge--draft {
  background: var(--gals-color-secondary-bg);
  color: var(--gals-color-secondary-text);
}

.task-summary-badge--review {
  background: var(--gals-color-status-gap-bg);
  color: var(--gals-color-status-gap);
}

.task-details-body {
  padding: 0 0 1.25rem 1.1rem;
  min-width: 0;
}

.task-set-meta {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--gals-color-text-muted);
}

.task-list-filter {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.875rem;
}

.task-list-filter .btn-link {
  font-size: inherit;
}

.cycle-action-banner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cycle-action-banner p {
  margin: 0;
}

/* Weak client + LaTeX: inside expanded task body only. */
.task-details-body > .math-weak-banner {
  margin: 0 0 1rem;
}

.math-weak-banner {
  margin: 0 0 0.75rem;
  padding: 0.75rem 0.9rem;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: var(--gals-radius-sm);
  color: #9a3412;
}

.math-weak-banner[hidden] {
  display: none !important;
}

.math-weak-banner__text {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.math-weak-banner__actions {
  margin: 0;
}

.math-weak-banner .btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
}

.task-item-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.task-item-heading {
  flex: 1;
  min-width: 0;
}

.task-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
  margin-left: 2rem;
}

.task-instructions {
  position: relative;
  margin: 0;
  padding: 1rem 1.1rem;
  background: #f8fafc;
  border-left: 3px solid #14b8a6;
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: #334155;
}
.task-instructions:has(> .task-flag) {
  padding-right: 4.75rem;
}
.task-instructions > .task-flag {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  left: auto;
  width: max-content;
  z-index: 1;
  margin: 0;
}

.task-instructions.markdown-body {
  white-space: normal;
}

.task-instructions.markdown-body p {
  margin: 0 0 0.65rem;
}

.task-instructions.markdown-body p:last-child {
  margin-bottom: 0;
}

.task-instructions.markdown-body ul,
.task-instructions.markdown-body ol {
  margin: 0.35rem 0 0.65rem;
  padding-left: 1.35rem;
}

.task-instructions.markdown-body li {
  margin: 0.2rem 0;
}

.task-instructions.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0.65rem 0;
}

.task-instructions.markdown-body th,
.task-instructions.markdown-body td {
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.task-instructions.markdown-body th {
  background: #f1f5f9;
  font-weight: 600;
}

.task-instructions.markdown-body strong {
  font-weight: 600;
  color: #1e293b;
}

.task-instructions.markdown-body blockquote {
  margin: 0.5rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--gals-color-border);
  color: var(--gals-color-text-muted);
}

.task-instructions.markdown-body blockquote p {
  margin-bottom: 0.35rem;
}

.task-instructions.markdown-body .task-blank,
.draft-markdown .task-blank {
  display: inline-block;
  min-width: 2.5em;
  border-bottom: 1.5px solid #94a3b8;
  vertical-align: baseline;
  margin: 0 0.15em;
}

.task-instructions.markdown-body .task-math,
.draft-markdown .task-math,
.task-check-analysis.markdown-body .task-math {
  display: inline-block;
  vertical-align: -0.15em;
  line-height: 1;
}

.task-instructions.markdown-body .task-math math,
.draft-markdown .task-math math,
.task-check-analysis.markdown-body .task-math math {
  font-size: 1.05em;
}

.task-instructions a {
  color: #0d9488;
  font-weight: 600;
  word-break: break-all;
}

.task-instructions a:hover {
  color: #0f766e;
}

.task-item.done .task-instructions {
  opacity: 0.55;
}

.task-fluentto {
  margin: 0.25rem 0 0.5rem;
  display: block;
  width: fit-content;
  max-width: 100%;
  align-self: flex-start;
}

.btn-fluentto {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  width: auto;
}

.btn-fluentto:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #fff;
}

.btn-fluentto--link {
  background: transparent;
  color: #4f46e5;
  border: none;
  width: auto;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-fluentto--link:hover {
  background: transparent;
  color: #4338ca;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.landing-page:not(.app-page) .task-instructions {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border-left-color: #5eead4;
}

.task-title {
  font-weight: 600;
  margin: 0;
}

.task-duration {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0.25rem 0 0;
}

.progress {
  background: #e2e8f0;
  border-radius: 999px;
  height: 8px;
  margin: 1rem 0;
  overflow: hidden;
}

.progress-bar {
  background: #22c55e;
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1rem;
}

.dash {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.dash-head-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem 1rem;
}

.dash-head-actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  white-space: nowrap;
}

.dash-head-actions .btn-link {
  padding-left: 0;
  padding-right: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 480px) {
  /* Заголовок отдельной строкой, кнопки под ним в один ряд: с длинными подписями
     («Добавить профиль») в одну строку с заголовком они не помещаются. */
  .dash-head-actions {
    width: 100%;
  }
}

.dash-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-title-row .dash-title {
  margin: 0;
}

.dash-add-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border: 1.5px solid var(--landing-border, var(--gals-color-border-subtle));
  border-radius: 50%;
  color: var(--gals-color-text-muted);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.dash-add-icon:hover,
.dash-add-icon:focus-visible {
  border-color: var(--landing-accent, var(--gals-color-accent));
  color: var(--landing-accent, var(--gals-color-accent));
  background: color-mix(in srgb, var(--landing-accent-soft, #e6f5f3) 55%, #fff);
  outline: none;
}

.dash-title {
  margin: 0 0 0.2rem;
  font-family: var(--gals-font-display);
  font-size: clamp(1.65rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--landing-ink, var(--gals-color-text-strong));
}

.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Переключатель профилей у ребёнка. Показывается только когда профилей больше одного. */
.child-profiles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
}

.child-profiles-label {
  font-size: 0.9rem;
  color: var(--text-muted, #6b7280);
}

.child-profile {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.child-profile.is-current {
  border-color: var(--accent, #16a34a);
  background: var(--accent-soft, #ecfdf5);
  font-weight: 600;
  cursor: default;
}

.child-profile-todo {
  min-width: 1.4em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: var(--accent, #16a34a);
  color: #fff;
  font-size: 0.8rem;
  text-align: center;
}

.dash-profile {
  --dash-rail: transparent;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.15rem 1.25rem 1.15rem 1.35rem;
  border: 1px solid var(--landing-border, var(--gals-color-border-subtle));
  border-radius: var(--landing-radius, var(--gals-radius-md));
  background: var(--gals-color-surface);
  box-shadow: var(--landing-shadow, var(--gals-shadow-card));
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.dash-profile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--dash-rail);
}

a.dash-profile:hover {
  text-decoration: none;
  border-color: var(--landing-accent, var(--gals-color-accent));
  background: color-mix(in srgb, var(--landing-accent-soft, #e6f5f3) 55%, #fff);
  transform: translateY(-2px);
  box-shadow: var(--landing-shadow-lg, 0 8px 24px rgba(20, 32, 27, 0.08));
}

a.dash-profile:focus-visible {
  outline: 2px solid var(--landing-accent, var(--gals-color-accent));
  outline-offset: 2px;
}

.dash-profile--attention {
  --dash-rail: var(--landing-accent, var(--gals-color-accent));
  border-color: color-mix(in srgb, var(--landing-accent, #0d9488) 45%, var(--landing-border, #e2e8f0));
}

.dash-profile--waiting {
  --dash-rail: var(--gals-color-status-in-progress);
  border-style: dashed;
}

.dash-profile--calm {
  --dash-rail: var(--landing-border, var(--gals-color-border-subtle));
}

.dash-profile--setup {
  gap: 0.85rem;
}

.dash-profile-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

/* The delete "×" is absolutely placed in the card's top-right 2rem; keep a long name from running under it. */
.dash-item:has(.dash-profile-delete) .dash-profile-main {
  padding-right: 1.25rem;
}

.dash-profile-name {
  margin: 0;
  font-family: var(--gals-font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.dash-profile-gate {
  flex-shrink: 0;
  max-width: 14rem;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--landing-accent-ink, var(--gals-color-accent-dark));
  line-height: 1.25;
}

.dash-profile--waiting .dash-profile-gate {
  color: var(--gals-color-status-in-progress);
}

.dash-profile-meta,
.dash-profile-status {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--landing-ink, var(--gals-color-text-strong));
  line-height: 1.35;
}

.dash-profile-meta {
  font-weight: 400;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.dash-profile-focus {
  margin: 0;
  font-size: 0.88rem;
  color: var(--landing-muted, var(--gals-color-text-muted));
  line-height: 1.35;
}

.dash-profile-meter {
  height: 0.65rem;
  background: color-mix(in srgb, var(--landing-border, #e2e8f0) 70%, #fff);
  border-radius: 999px;
  overflow: hidden;
}

.dash-profile-meter-bar {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--landing-accent, var(--gals-color-accent)),
    color-mix(in srgb, var(--landing-accent, #0d9488) 70%, #5eead4)
  );
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* HUD — numbers in the heading face, captions in the promo video's monospace ("II · ЕВРОПА"). */
.hud-label {
  font-family: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.hud-num {
  font-family: var(--gals-font-display);
  font-weight: 700;
  font-size: 1.65rem;
  line-height: 1;
  color: var(--landing-ink, var(--gals-color-text));
  font-variant-numeric: lining-nums tabular-nums;
}

.hud-num small {
  font-size: 0.55em;
  font-weight: 600;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

/* Dashboard card (2026-09-29): whose profile, today, the knowledge map, and both ways in. */
.dash-card-head .landing-eyebrow {
  font-size: 11px;
}

.dash-card-head .dash-profile-name {
  margin-top: 6px;
}

.dash-profile-name a {
  color: inherit;
  text-decoration: none;
}

.dash-profile-name a:hover {
  color: var(--landing-accent-ink, var(--gals-color-accent-dark));
}

.dash-card-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: 16px 24px;
  align-items: end;
}

.dash-stat {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.dash-stat-empty {
  font-size: 0.95rem;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.dash-seg {
  display: flex;
  gap: 3px;
  height: 8px;
}

.dash-seg-item {
  flex: 1;
  min-width: 0;
  border-radius: 3px;
  background: #e7eeeb;
}

/* same kinds as the task badges (core/parent_task_ui.py) */
.dash-seg-item--done { background: var(--landing-accent, #0d9488); }
.dash-seg-item--notes { background: #34d399; }
.dash-seg-item--review { background: #f87171; }
.dash-seg-item--draft { background: #fbbf24; }

.dash-mapbar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #e7eeeb;
}

.dash-mapbar i {
  display: block;
  height: 100%;
}

.dash-map--solid { background: #22c55e; }
.dash-map--in_progress { background: #f59e0b; }
.dash-map--gap { background: #f43f5e; }
.dash-map--untouched { background: #cbd5e1; }

.dash-maplegend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  font-size: 13px;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.dash-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
}

.dash-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--landing-border, var(--gals-color-border));
}

.dash-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--landing-accent-ink, var(--gals-color-accent-dark));
  background: var(--landing-accent-soft, var(--gals-color-accent-soft));
}

.dash-btn:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--landing-accent-soft, #e6f5f3) 60%, var(--landing-accent, #0d9488) 14%);
}

.dash-btn--primary {
  color: #fff;
  background: var(--landing-accent-ink, var(--gals-color-accent-dark));
}

.dash-btn--primary:hover {
  background: var(--landing-accent, var(--gals-color-accent));
}

.dash-rhythm-line {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--landing-faint, var(--gals-color-text-subtle));
}

@media (max-width: 600px) {
  .dash-card-stats {
    grid-template-columns: 1fr;
  }

  .dash-rhythm-line {
    flex-basis: 100%;
    margin-left: 0;
  }
}

.progress-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.progress-period {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.progress-period-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.progress-period-field {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin: 0;
  font-size: 0.9rem;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.progress-period-field select {
  box-sizing: border-box;
  font: inherit;
  line-height: 1.2;
  color: inherit;
  height: 2rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--landing-border, #e2e8f0) 80%, transparent);
  border-radius: 0.4rem;
  background: var(--landing-bg, #fff);
}

.progress-check-summary {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.progress-stat {
  padding: 0.85rem 0 0;
  border-top: 1px solid color-mix(in srgb, var(--landing-border, #e2e8f0) 80%, transparent);
}

.progress-stat-title {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.progress-movement-list,
.progress-long-lived {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.progress-long-lived a,
.progress-movement-list a {
  color: inherit;
  text-underline-offset: 0.15em;
}

.progress-movement-item--up::before {
  content: "↑ ";
  color: var(--landing-accent, var(--gals-color-accent));
}

.progress-movement-item--down::before {
  content: "↓ ";
  color: var(--gals-color-status-gap, #dc2626);
}

.dash-profile-cta {
  align-self: flex-start;
}

.dash-item {
  position: relative;
}

.dash-profile-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  color: var(--gals-color-text-muted);
  font-size: 1.15rem;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.dash-profile-delete:hover,
.dash-profile-delete:focus-visible {
  background: color-mix(in srgb, var(--gals-color-danger) 12%, transparent);
  color: var(--gals-color-danger);
  outline: none;
}

@keyframes dash-profile-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dash-list > li .dash-profile {
  animation: dash-profile-in 0.4s ease both;
}

.dash-list > li:nth-child(2) .dash-profile {
  animation-delay: 0.05s;
}

.dash-list > li:nth-child(3) .dash-profile {
  animation-delay: 0.1s;
}

.dash-list > li:nth-child(4) .dash-profile {
  animation-delay: 0.15s;
}

@media (prefers-reduced-motion: reduce) {
  .dash-list > li .dash-profile {
    animation: none;
  }

  a.dash-profile:hover {
    transform: none;
  }

  .dash-profile-meter-bar {
    transition: none;
  }
}

@media (max-width: 540px) {
  .dash-profile {
    padding: 1rem 1rem 1rem 1.15rem;
  }

  .dash-profile-gate {
    max-width: 9.5rem;
    font-size: 0.85rem;
  }
}


.empty {
  text-align: center;
  color: #64748b;
  padding: 2rem 1rem;
}

.form-errors {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

textarea.input {
  resize: vertical;
  min-height: 6rem;
  font-family: inherit;
}

.help-text {
  font-size: 0.8rem;
  color: #64748b;
  margin: -0.5rem 0 1rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.home-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.home-links .btn {
  text-align: center;
}

/* ── Landing page ── */

body.landing-page {
  --landing-ground: #fbfcfc;
  --landing-surface: #fff;
  --landing-ink: #14201b;
  --landing-muted: #5c6b64;
  /* ui.md § Доступность: контраст вторичного текста на лендинге не ниже #78716c
     (4.8:1 на белом). Old #8a9691 was 3.06:1 — failed AA at the 12.5-13.5px sizes
     it's actually used at (landing-review.md §14). */
  --landing-faint: #78716c;
  --landing-border: #e4eae7;
  --landing-border-strong: #d2dcd7;
  --landing-accent: #0d9488;
  --landing-accent-ink: #0f766e;
  --landing-accent-soft: #e6f5f3;
  --landing-shadow: 0 1px 2px rgba(20, 32, 27, 0.04), 0 12px 32px -12px rgba(20, 32, 27, 0.14);
  --landing-shadow-lg: 0 1px 2px rgba(20, 32, 27, 0.05), 0 40px 80px -32px rgba(13, 148, 136, 0.22);
  --landing-radius: 14px;
  --landing-max: 1120px;

  --gals-color-bg: var(--landing-ground);
  --gals-color-surface: var(--landing-surface);
  --gals-color-text: var(--landing-ink);
  --gals-color-text-muted: var(--landing-muted);
  --gals-color-text-subtle: var(--landing-faint);
  --gals-color-border: var(--landing-border);
  --gals-color-border-subtle: var(--landing-border-strong);
  --gals-color-accent: var(--landing-accent);
  --gals-color-accent-dark: var(--landing-accent-ink);
  --gals-color-accent-soft: var(--landing-accent-soft);
  --gals-focus-ring-color: var(--landing-accent);

  --gals-font-body: "DM Sans", var(--gals-font-sans);

  margin: 0;
  font-family: var(--gals-font-body);
  color: var(--landing-ink);
  background: var(--landing-ground);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.landing-page .container.landing-container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.landing-page h1,
body.landing-page h2,
body.landing-page h3 {
  font-family: var(--gals-font-display);
}

.landing-wrap {
  max-width: var(--landing-max);
  margin: 0 auto;
  padding: 0 24px;
}

.landing-site {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 252, 252, 0.82);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--landing-border);
  padding-top: env(safe-area-inset-top, 0);
}

.landing-site-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

/* Anchored sections (header link "Prices" → #pricing) stop below the sticky 64px header. */
body.landing-page section[id] {
  scroll-margin-top: 64px;
}

.landing-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--landing-ink);
  font-weight: 650;
}

.landing-logo:hover {
  text-decoration: none;
  opacity: 0.9;
}

/* В шапке — только слово GALS: знак бренда (древо познания из промо-ролика) рисуется
   на самой странице в полном размере, см. static/js/knowledge-tree.js. Плитка со знаком
   (тот же static/favicon.svg) осталась в app/layout ради одного случая — staff на телефоне,
   где слово не помещается (ниже). */
.landing-logo-mark {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 12px -4px rgba(13, 148, 136, 0.6);
}

.landing-logo-text {
  letter-spacing: 0.14em;
  font-size: 17px;
  font-family: var(--gals-font-display);
  font-weight: 700;
}

.landing-nav-end {
  display: flex;
  align-items: center;
  gap: 18px;
}

.lang-picker--landing .lang-picker__trigger {
  padding: 6px 9px;
  border-color: var(--landing-border);
  background: var(--landing-surface);
  color: var(--landing-faint);
}

.lang-picker--landing .lang-picker__trigger:hover {
  color: var(--landing-muted);
}

.lang-picker--landing .lang-picker__flag {
  width: 1.15rem;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.lang-picker--landing .lang-picker__menu {
  border-color: var(--landing-border);
  background: var(--landing-surface);
  box-shadow: 0 8px 24px rgba(12, 18, 34, 0.14);
}

.lang-picker--landing .lang-picker__option {
  color: var(--landing-muted);
}

.lang-picker--landing .lang-picker__option:hover {
  color: var(--landing-ink);
  background: var(--landing-accent-soft);
}

.landing-docs-link {
  font-size: 14px;
  font-weight: 550;
  color: var(--landing-muted);
  text-decoration: none;
}

.landing-docs-link:hover {
  color: var(--landing-ink);
  text-decoration: none;
}

.landing-staff-link {
  font-size: 13px;
  font-weight: 550;
  color: var(--landing-faint);
  text-decoration: none;
}

.landing-staff-link:hover {
  color: var(--landing-muted);
  text-decoration: none;
}

.landing-staff-count {
  color: var(--landing-ink);
  font-weight: 650;
}

/* Hero on squared paper, as in the promo video: faint teal grid that fades out towards the
   edges so it never sits hard behind the text. */
.landing-hero {
  position: relative;
  isolation: isolate;
  padding: 72px 0 56px;
}

.landing-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to right, rgba(13, 148, 136, 0.1) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(to bottom, rgba(13, 148, 136, 0.1) 1px, transparent 1px) 0 0 / 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 75% 85% at 50% 45%, #000 35%, transparent 90%);
  mask-image: radial-gradient(ellipse 75% 85% at 50% 45%, #000 35%, transparent 90%);
  pointer-events: none;
}

.landing-hero-grid {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  gap: 64px;
  align-items: center;
}

/* Parent hero is text only: the tree lives once, in the dark band below. */
.landing-hero-solo {
  grid-template-columns: minmax(0, 40rem);
}

/* Caption above a headline, in the promo video's caption style ("II · ЕВРОПА"): spaced
   monospace caps after a short teal rule — not a pill. */
.landing-eyebrow {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-family: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--landing-muted);
}

/* The rule sits on the first line's middle, also when a long caption wraps (fr, es). */
.landing-eyebrow-dot {
  flex: none;
  width: 18px;
  height: 2px;
  margin-top: calc(0.75em - 1px);
  background: var(--landing-accent);
}

/* Wide tracking breaks Devanagari shaping and looks loose in CJK. */
.landing-eyebrow:lang(hi),
.landing-eyebrow:lang(ja),
.landing-eyebrow:lang(ko),
.landing-eyebrow:lang(zh-hans) {
  letter-spacing: 0.06em;
}

body.landing-page .landing-hero h1 {
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.022em;
  font-weight: 700;
  margin: 22px 0 0;
  text-wrap: balance;
}

.landing-lead {
  font-size: 19px;
  line-height: 1.55;
  color: var(--landing-muted);
  max-width: 42ch;
  margin: 20px 0 0;
  white-space: pre-line;
}

.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 32px;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: 11px;
  cursor: pointer;
  border: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.landing-btn-primary {
  /* Darker shade as the resting background: white text on --landing-accent is
     3.74:1 (fails AA), on --landing-accent-ink it's 5.47:1 (ui.md § Доступность). */
  background: var(--landing-accent-ink);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(15, 118, 110, 0.65);
}

.landing-btn-primary:hover {
  background: var(--landing-accent);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

.landing-btn-primary svg {
  transition: transform 0.15s ease;
}

.landing-btn-primary:hover svg {
  transform: translateX(3px);
}

.landing-link-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14.5px;
  font-weight: 560;
  color: var(--landing-muted);
  text-decoration: none;
}

.landing-link-secondary:hover {
  color: var(--landing-accent-ink);
  text-decoration: none;
}

.landing-link-secondary svg {
  transition: transform 0.15s ease;
}

.landing-link-secondary:hover svg {
  transform: translateX(3px);
}

.landing-trust {
  margin-top: 26px;
  font-size: 13.5px;
  color: var(--landing-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.landing-trust svg {
  color: var(--landing-accent);
  flex: none;
}

.landing-device {
  position: relative;
}

.landing-device::before {
  content: "";
  position: absolute;
  inset: -8% -6% -14%;
  background: radial-gradient(60% 60% at 70% 30%, rgba(13, 148, 136, 0.14), transparent 70%);
  filter: blur(6px);
  z-index: 0;
}

/* Hero на /self/: ответ печатают, проверяют и показывают дыру в объяснении.
   Печатает static/js/answer-demo.js; --ready (0…1) на карточке и строках разбора — его. */
.landing-answer-demo {
  position: relative;
  z-index: 1;
  background: var(--landing-surface);
  border: 1px solid var(--landing-border);
  border-radius: 20px;
  box-shadow: var(--landing-shadow-lg);
  padding: 22px 22px 20px;
}

.landing-answer-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.landing-answer-hi {
  font-size: 13px;
  color: var(--landing-faint);
  font-weight: 600;
}

.landing-answer-topic {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--landing-accent-ink);
  background: var(--landing-accent-soft);
  padding: 4px 11px;
  border-radius: 100px;
  white-space: nowrap;
}

.landing-answer-task {
  margin: 12px 0 0;
  font-family: var(--gals-font-display);
  font-size: 19px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--landing-ink);
}

.landing-answer-box {
  margin-top: 16px;
  padding: 12px 14px 14px;
  border: 1px solid var(--landing-border-strong);
  border-radius: 12px;
  background: #fff;
}

.landing-answer-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--landing-faint);
}

/* Весь ответ лежит невидимым под печатаемым: рамка не растёт по мере набора. */
.landing-answer-text {
  position: relative;
  margin-top: 6px;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--landing-ink);
}

.landing-answer-ghost {
  visibility: hidden;
}

.landing-answer-typed {
  position: absolute;
  inset: 0;
  opacity: var(--fade, 1);
}

.landing-answer-demo.is-typing .landing-answer-typed::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--landing-accent);
  animation: landing-caret 0.9s steps(1) infinite;
}

@keyframes landing-caret {
  50% {
    opacity: 0;
  }
}

/* Рамка разбора видна всегда (бледно) — место читается как «здесь будет разбор»;
   строки проявляются после проверки. */
.landing-answer-card {
  --ready: 0;
  margin-top: 12px;
  padding: 12px 16px 14px;
  background: var(--landing-surface);
  border: 1px solid var(--landing-border-strong);
  border-radius: 12px;
  box-shadow: var(--landing-shadow);
  opacity: calc(0.45 + 0.55 * var(--ready));
}

.landing-answer-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--landing-accent-ink);
}

.landing-answer-points {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.landing-answer-points li {
  --ready: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 8px;
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--landing-ink);
  opacity: var(--ready);
  transform: translateY(calc((1 - var(--ready)) * 8px));
}

.landing-answer-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  color: #fff;
  background: var(--landing-accent-ink);
}

.landing-answer-mark svg {
  width: 12px;
  height: 12px;
}

.landing-answer-points li.gap .landing-answer-mark {
  color: var(--landing-ink);
  background: var(--gals-color-accent-warm);
}

/* /self/, тёмная полоса: мини-карта знаний на тех же значках статусов, что и экран «Прогресс»
   (.mastery-status-badge). Тема — та же, что в демо hero; сами статусы — иллюстрация. */
.landing-map-card {
  width: 100%;
  max-width: 460px;
  justify-self: center;
  background: var(--landing-surface);
  border-radius: 20px;
  box-shadow: var(--landing-shadow-lg);
  padding: 22px 22px 12px;
  color: var(--landing-ink);
}

.landing-map-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--landing-accent-ink);
}

.landing-map-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.landing-map-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--landing-border);
  font-size: 15.5px;
  font-weight: 560;
}

.landing-pains {
  padding: 56px 0 64px;
  border-top: 1px solid var(--landing-border);
  background: linear-gradient(180deg, #fff 0%, var(--landing-ground) 100%);
}

.landing-pains-head {
  text-align: center;
  max-width: 58ch;
  margin: 0 auto 44px;
}

.landing-pains-head h2 {
  font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
}

.landing-pains-head p {
  color: var(--landing-muted);
  font-size: 16px;
  margin: 12px 0 0;
}

.landing-pains-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}

.landing-pain-card {
  background: var(--landing-surface);
  border: 1px solid var(--landing-border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--landing-shadow);
}

.landing-pain-q {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--landing-ink);
  letter-spacing: -0.01em;
}

.landing-pain-a {
  margin: 6px 0 0;
  font-size: 14.5px;
  color: var(--landing-accent-ink);
  line-height: 1.45;
}

.landing-pains-anchor {
  text-align: center;
  margin: 32px auto 0;
  max-width: 52ch;
  font-size: 17px;
  font-weight: 600;
  color: var(--landing-ink);
  letter-spacing: -0.01em;
  font-family: var(--gals-font-display);
}

.landing-steps {
  padding: 20px 0 84px;
}

.landing-steps-head {
  text-align: center;
  max-width: 52ch;
  margin: 0 auto 40px;
}

.landing-steps-head h2 {
  font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
}

.landing-steps-head p {
  color: var(--landing-muted);
  font-size: 16px;
  margin: 12px 0 0;
}

.landing-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Five steps: three on the first row, two centered on the second, same card width. */
.landing-steps-grid:has(> :nth-child(5):last-child) {
  grid-template-columns: repeat(6, 1fr);
}

.landing-steps-grid:has(> :nth-child(5):last-child) > :nth-child(n) {
  grid-column: span 2;
}

.landing-steps-grid:has(> :nth-child(5):last-child) > :nth-child(4) {
  grid-column: 2 / span 2;
}

.landing-steps-grid:has(> :nth-child(5):last-child) > :nth-child(5) {
  grid-column: 4 / span 2;
}

.landing-step {
  background: var(--landing-surface);
  border: 1px solid var(--landing-border);
  border-radius: 16px;
  padding: 26px 24px;
  box-shadow: var(--landing-shadow);
}

.landing-step-ico {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--landing-accent-soft);
  color: var(--landing-accent-ink);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.landing-step h3 {
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.01em;
  margin: 0;
}

.landing-step p {
  font-size: 14.5px;
  color: var(--landing-muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

.landing-privacy {
  padding: 40px 0;
  border-top: 1px solid var(--landing-border);
}

.landing-privacy-inner {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
}

.landing-privacy-ico {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--landing-accent-soft);
  color: var(--landing-accent-ink);
  display: grid;
  place-items: center;
  flex: none;
}

.landing-privacy h2 {
  font-size: 19px;
  font-weight: 640;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.landing-privacy p {
  font-size: 14.5px;
  color: var(--landing-muted);
  line-height: 1.55;
  margin: 0;
}

.landing-privacy-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--landing-accent-ink);
  text-decoration: none;
}

.landing-privacy-link svg {
  transition: transform 0.15s ease;
}

.landing-privacy-link:hover svg {
  transform: translateX(3px);
}

.landing-pricing {
  padding: 56px 0 84px;
  border-top: 1px solid var(--landing-border);
}

.landing-pricing-head {
  text-align: center;
  max-width: 42ch;
  margin: 0 auto 36px;
}

.landing-pricing-head h2 {
  font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
}

.landing-pricing-head p {
  color: var(--landing-muted);
  font-size: 16px;
  margin: 12px 0 0;
  line-height: 1.5;
}

/* Лесенка по темпу: Неспешно (бесплатно) / Спокойно (S) / Усердно (M). Темп словами,
   без единиц «наборы/проверки» — они в оферте (ссылка под блоком). */
.landing-pricing-ladder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 56rem;
  margin: 0 auto;
}

.landing-pricing-tier {
  padding: 26px 20px 22px;
  text-align: center;
  border: 1px solid var(--landing-border);
  border-radius: 16px;
  background: var(--landing-surface);
  box-shadow: var(--landing-shadow);
}

.landing-pricing-plan {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--landing-accent-ink);
}

.landing-pricing-amount {
  font-family: var(--gals-font-display);
  font-size: clamp(30px, 4.4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--landing-ink);
  margin: 12px 0 0;
  line-height: 1.1;
}

.landing-pricing-amount span {
  font-family: var(--gals-font-body, inherit);
  font-size: 0.4em;
  font-weight: 500;
  color: var(--landing-muted);
  letter-spacing: 0;
}

/* Знак валюты — того же размера, что и сумма (иначе «1790 ₽» читается как «1790» с пылинкой). */
.landing-pricing-amount .landing-pricing-currency {
  font-family: var(--gals-font-body, inherit);
  font-size: 1em;
  font-weight: 650;
  color: inherit;
  letter-spacing: 0;
}

.landing-pricing-detail {
  font-size: 16px;
  color: var(--landing-ink);
  margin: 14px 0 0;
  line-height: 1.4;
}

.landing-pricing-tag {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--landing-faint);
}

.landing-pricing-usd-note {
  text-align: center;
  margin: 18px auto 0;
  font-size: 14px;
  color: var(--landing-muted);
}

.landing-pricing-cta-row {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.landing-pricing-cta-row .landing-btn {
  min-width: 11.5rem;
  justify-content: center;
}

/* Телефон: ступень — одна компактная строка (название и темп слева, цена справа), чтобы
   три ступени не превращались в экран прокрутки. */
@media (max-width: 760px) {
  .landing-pricing-ladder {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 26rem;
  }

  .landing-pricing-tier {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 14px;
    padding: 16px 18px;
    text-align: left;
  }

  .landing-pricing-tier .landing-pricing-plan,
  .landing-pricing-tier .landing-pricing-detail,
  .landing-pricing-tier .landing-pricing-tag {
    grid-column: 1;
  }

  .landing-pricing-tier .landing-pricing-amount {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin: 0;
    text-align: right;
    font-size: 30px;
  }

  .landing-pricing-tier .landing-pricing-detail {
    margin: 4px 0 0;
    font-size: 15px;
  }

  .landing-pricing-tier .landing-pricing-tag {
    margin: 2px 0 0;
  }
}

.landing-pricing-note {
  text-align: center;
  margin: 28px auto 0;
  max-width: 52ch;
  font-size: 13.5px;
  color: var(--landing-faint);
}

.landing-pricing-note a,
.landing-pricing-legal a {
  color: var(--landing-accent-ink);
}

.landing-pricing-legal {
  padding: 0 0 64px;
  text-align: center;
  font-size: 13.5px;
  color: var(--landing-faint);
}

.landing-pricing-legal p {
  margin: 0;
}

body.app-page .landing-pricing {
  padding: 8px 0 28px;
  border-top: none;
}

body.app-page .landing-pricing-head {
  text-align: left;
  margin: 0 0 20px;
  max-width: none;
}

body.app-page .landing-pricing-cta-row {
  justify-content: flex-start;
}

.landing-home-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--landing-accent);
  text-decoration: none;
}

.landing-home-link:hover {
  color: var(--landing-accent-ink);
}

body.auth-page {
  display: flex;
  flex-direction: column;
}

body.auth-page .landing-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  min-height: 100vh;
}

body.auth-page .auth-backdrop-header {
  position: relative;
  z-index: 50;
}

.auth-backdrop {
  position: relative;
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px));
}

.auth-overlay__scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(1.5px);
  cursor: pointer;
}

.auth-overlay__stage {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-height: 100%;
  overflow: auto;
}

.auth-overlay__panel {
  position: relative;
  padding-top: 44px;
}

.auth-overlay__close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.12);
  transition: color 0.15s ease, background 0.15s ease;
}

.auth-overlay__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

.auth-overlay .auth-card {
  margin: 0;
  box-shadow: 0 24px 48px -20px rgba(20, 32, 27, 0.35);
}

.auth-overlay .auth-alt-role {
  margin-top: 16px;
}

.auth-overlay .auth-alt-role a {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.auth-overlay .auth-alt-role a:hover {
  color: #fff;
}

/* Адрес поддержки под карточкой входа: форма обращений только для авторизованных,
   поэтому тем, кто войти не может, нужна видимая дверь. Оформлен как соседний
   alt-role: тот же размер и та же читаемость поверх скрима. */
.auth-support-note {
  margin: 12px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--landing-muted);
}

.auth-support-note a {
  color: inherit;
  font-weight: 560;
}

.auth-overlay .auth-support-note {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.auth-overlay .auth-support-note a {
  color: #fff;
}

.auth-card-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--landing-border);
}

.auth-card-links__back {
  color: var(--landing-muted);
  font-size: 14px;
  font-weight: 560;
  text-decoration: none;
}

.auth-card-links__back:hover {
  color: var(--landing-accent-ink);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 64px;
}

.auth-main-inner {
  width: 100%;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: var(--landing-surface);
  border: 1px solid var(--landing-border);
  border-radius: 22px;
  box-shadow: 0 18px 40px -24px rgba(20, 32, 27, 0.25);
  padding: 38px 36px 34px;
}

.auth-card .landing-eyebrow {
  margin-bottom: 16px;
}

.auth-card h1 {
  font-size: clamp(2rem, 5vw, 2.375rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.auth-modes {
  display: flex;
  gap: 4px;
  margin: 0 0 22px;
  padding: 4px;
  background: #eef3f0;
  border-radius: 12px;
}

.auth-mode {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.2;
  color: var(--landing-muted);
  padding: 10px 8px;
  border-radius: 9px;
}

.auth-mode:hover {
  color: var(--landing-ink);
}

.auth-mode.is-active {
  background: #fff;
  color: var(--landing-ink);
  box-shadow: 0 1px 2px rgba(20, 32, 27, 0.08);
}

.auth-mode:focus-visible {
  outline: 2px solid var(--landing-accent);
  outline-offset: 2px;
}

.auth-lead {
  color: var(--landing-muted);
  font-size: 14.5px;
  line-height: 1.5;
  margin: 0 0 26px;
}

.auth-field {
  margin-bottom: 18px;
}

.auth-field label {
  font-size: 13.5px;
  margin-bottom: 7px;
}

body.auth-page .auth-card .input {
  font-size: 15px;
  border-width: 1.5px;
  border-color: #cbd5e1;
  border-radius: 11px;
  padding: 13px 14px;
}

body.auth-page .auth-card .input:focus {
  border-color: var(--landing-accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

body.auth-page .auth-card .input::placeholder {
  color: #9aa8a2;
}

body.auth-page .auth-card .password-field .input {
  padding-right: 3rem;
}

.auth-forgot-row {
  margin: -6px 0 22px;
}

.auth-forgot {
  color: var(--landing-accent);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
}

.auth-forgot:hover {
  color: var(--landing-accent-ink);
  text-decoration: underline;
}

.auth-errors {
  background: rgba(226, 75, 74, 0.1);
  color: #a32d2d;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  margin: 0 0 18px;
}

.auth-errors .errorlist {
  list-style: none;
  margin: 0;
  padding: 0;
}

body.auth-page .auth-card .auth-field.has-error .input {
  border-color: #c47878;
  background: #fffdfb;
}

body.auth-page .auth-card .auth-field.has-error .input:focus {
  border-color: #a34b4b;
  box-shadow: 0 0 0 3px rgba(163, 75, 75, 0.12);
}

.auth-field-error {
  margin: 7px 2px 0;
  font-size: 13px;
  line-height: 1.35;
  color: #8f3d3d;
}

.auth-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}

.auth-messages li {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 10px;
  background: var(--gals-color-success-bg);
  color: var(--gals-color-success-text);
}

.auth-messages li:last-child {
  margin-bottom: 0;
}

.auth-messages li.error {
  background: rgba(226, 75, 74, 0.1);
  color: #a32d2d;
}

.auth-submit {
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: var(--landing-accent);
  border: 0;
  border-radius: 12px;
  padding: 15px 18px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.auth-submit:hover {
  background: var(--landing-accent-ink);
}

.auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.auth-submit:disabled:hover {
  background: var(--landing-accent);
}

.auth-submit:active {
  transform: translateY(1px);
}

.auth-submit:disabled:active {
  transform: none;
}

.auth-submit:focus-visible {
  outline: 2px solid var(--landing-accent);
  outline-offset: 2px;
}

.auth-submit--link {
  display: block;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.auth-step-title {
  font-family: var(--gals-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 10px;
}

.auth-step-lead {
  color: var(--landing-muted);
  font-size: 14.5px;
  line-height: 1.45;
  margin: 0 0 24px;
  word-break: break-word;
}

.auth-step-secondary {
  appearance: none;
  width: 100%;
  margin-top: 10px;
  border: none;
  background: transparent;
  color: var(--landing-muted);
  font: inherit;
  font-size: 14.5px;
  font-weight: 560;
  cursor: pointer;
  padding: 12px;
}

.auth-step-secondary:hover {
  color: var(--landing-accent-ink);
}

.auth-help {
  color: var(--gals-color-text-subtle, #8a9691);
  font-size: 12px;
  line-height: 1.4;
  margin: 6px 2px 0;
}

.auth-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--landing-muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 18px 2px 0;
}

.auth-hint svg {
  flex: none;
  margin-top: 1px;
  color: var(--landing-faint);
}

.auth-alt-role {
  margin: 20px 0 0;
  text-align: center;
  font-size: 14px;
}

.auth-alt-role a {
  color: var(--landing-muted);
  font-weight: 560;
  text-decoration: none;
}

.auth-alt-role a:hover {
  color: var(--landing-accent-ink);
}

@media (max-width: 520px) {
  .auth-card {
    padding: 30px 22px;
  }

  .landing-home-link {
    display: none;
  }
}

/* ── App (logged-in) shell — landing tokens + green actions ── */

body.landing-page.app-page {
  --gals-color-primary: var(--landing-accent);
  --gals-color-primary-hover: var(--landing-accent-ink);
  --gals-color-link: var(--landing-accent);
  --gals-color-link-hover: var(--landing-accent-ink);
}

body.app-page .container.app-container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.app-page .app-site {
  margin-bottom: 0;
  background: var(--landing-ground);
  backdrop-filter: none;
}

body.app-page .app-main {
  padding: 28px 0 48px;
}

body.app-page .app-messages {
  margin: 0 0 1.25rem;
}

body.app-page .card {
  border: 1px solid var(--landing-border);
  box-shadow: var(--landing-shadow);
  border-radius: var(--landing-radius);
}

/* ---- Profile screens, cabinet redesign (2026-09-29) ---- */

body.app-page .app-main {
  overflow-x: clip; /* the squared paper of .profile-head bleeds past the column */
}

/* Head of Tasks / Plan / Progress: whose profile, then its name, on squared paper (landing hero). */
.profile-head {
  position: relative;
  isolation: isolate;
  padding: 18px 0 14px;
  margin-bottom: 6px;
}

.profile-head::before {
  content: "";
  position: absolute;
  inset: -40px -200px 0;
  z-index: -1;
  background:
    linear-gradient(to right, rgba(13, 148, 136, 0.08) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(to bottom, rgba(13, 148, 136, 0.08) 1px, transparent 1px) 0 0 / 28px 28px;
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 35%, transparent 100%);
  pointer-events: none;
}

.profile-head .landing-eyebrow {
  font-size: 11px;
}

.profile-head h1 {
  margin: 10px 0 0;
}

/* Set summary on «Задания»: checked N / M with a segment per task, then the set's facts. */
.today-hud {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) 1.6fr;
  gap: 14px 24px;
  align-items: center;
  margin: 0 0 14px;
  padding: 16px 20px;
  border: 1px solid var(--landing-border);
  border-radius: var(--landing-radius);
  background: var(--landing-surface, #fff);
  box-shadow: var(--landing-shadow);
}

.today-hud .child-subtitle-row {
  margin: 0;
}

.today-hud__checked .hud-num {
  font-size: 1.9rem;
}

/* Tasks as separate cards, the left edge in the colour of the task's badge (kept live: the
   badge class changes after a check, :has() follows it). */
body.app-page .card.task-list-card,
.card.task-list-card {
  padding: 0;
  border: 0 !important;
  background: none;
  box-shadow: none !important;
}

.task-list-card .task-item--collapsible {
  margin: 0 0 10px;
  padding: 0 18px;
  border: 1px solid var(--landing-border);
  border-left: 4px solid #e2e8f0;
  border-radius: 14px;
  background: var(--landing-surface, #fff);
  box-shadow: var(--landing-shadow);
}

.task-list-card .task-item--collapsible:last-child {
  border-bottom: 1px solid var(--landing-border);
}

/* Only the badge in the card's own summary line — the body can hold badges of earlier checks. */
.task-item:has(> .task-details > .task-summary .task-summary-badge--done) { border-left-color: var(--landing-accent, #0d9488); }
.task-item:has(> .task-details > .task-summary .task-summary-badge--notes) { border-left-color: #34d399; }
.task-item:has(> .task-details > .task-summary .task-summary-badge--review) { border-left-color: #f87171; }
.task-item:has(> .task-details > .task-summary .task-summary-badge--draft),
.task-item:has(> .task-details > .task-summary .task-summary-badge--pending) { border-left-color: #fbbf24; }

/* «Set checked»: the map as the video's tree on the night of the landing's tree band. */
.set-moment {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 18px;
  align-items: center;
  margin: 18px 0;
  padding: 14px 22px;
  border-radius: var(--landing-radius);
  color: #eefbf7;
  background: radial-gradient(ellipse at 18% 60%, var(--gals-color-night-glow) 0%, var(--gals-color-night) 80%);
  overflow: hidden;
}

.set-moment__tree {
  --kt-branch: #2dd4bf;
  --kt-tip: #ccfbf1;
  /* the legend's colour, so an untouched light does not melt into the branches */
  --kt-untouched: #cbd5e1;
}

/* The small tree here is a glance, not a reading: section names would be unreadable. */
.set-moment .kt-label {
  display: none;
}

.set-moment .hud-label {
  color: rgba(238, 251, 247, 0.7);
}

.set-moment .dash-maplegend {
  margin: 8px 0 10px;
  color: rgba(238, 251, 247, 0.85);
}

.set-moment__link {
  color: #5eead4;
  font-weight: 600;
  text-decoration: none;
}

.set-moment__link:hover {
  color: #ccfbf1;
}

.set-moment__note {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(238, 251, 247, 0.16);
  font-size: 15px;
  line-height: 1.45;
  color: rgba(238, 251, 247, 0.9);
}

.set-moment-next {
  margin: 0 0 18px;
}

/* «Прогресс»: the map as a tree of its real links (knowledge-tree.js, variant graph). */
.map-hero {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) 1.8fr;
  gap: 10px 28px;
  align-items: center;
  margin: 8px 0 18px;
  padding: 24px 28px;
  border-radius: var(--landing-radius);
  color: #eefbf7;
  background: radial-gradient(ellipse at 65% 55%, var(--gals-color-night-glow) 0%, var(--gals-color-night) 78%);
  overflow: hidden;
}

.map-hero .hud-label {
  display: block;
  margin-bottom: 4px;
  color: rgba(238, 251, 247, 0.62);
}

.map-hero__stats {
  display: grid;
  gap: 10px;
}

.map-hero__stat {
  display: grid;
  grid-template-columns: 12px auto 1fr;
  gap: 10px;
  align-items: baseline;
  margin: 0;
}

.map-hero__stat .dash-dot {
  align-self: center;
}

.map-hero__stat .hud-num {
  color: #eefbf7;
  font-size: 28px;
}

.map-hero__label {
  font-size: 14px;
  color: rgba(238, 251, 247, 0.78);
}

.map-hero__hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(238, 251, 247, 0.55);
}

.map-hero__tree {
  --kt-branch: #2dd4bf;
  --kt-tip: #ccfbf1;
  --kt-untouched: #cbd5e1;
  min-width: 0;
}

/* Under the crown (knowledge-tree.js puts the tree before it), so its height never moves the lights. */
.map-hero__caption {
  min-height: 2.9em;
  white-space: pre-line;
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  color: rgba(238, 251, 247, 0.85);
}

@media (max-width: 720px) {
  .map-hero {
    grid-template-columns: 1fr;
    padding: 18px 16px;
  }

  .map-hero__stats {
    grid-template-columns: 1fr 1fr;
  }

  .map-hero__stats > .hud-label,
  .map-hero__hint {
    grid-column: 1 / -1;
  }

  /* Too small to read at phone width — the list below is grouped by the same sections. */
  .map-hero .kt-label {
    display: none;
  }
}

@media (max-width: 600px) {
  .today-hud {
    grid-template-columns: 1fr;
  }

  .set-moment {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
}

body.app-page h1 {
  font-family: var(--gals-font-display);
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  letter-spacing: -0.01em;
}

body.app-page h2,
body.app-page h3 {
  font-family: var(--gals-font-display);
}

body.app-page .progress-text,
body.app-page .empty {
  color: var(--landing-muted);
}

body.app-page .app-subnav {
  border-bottom: 1px solid var(--landing-border);
  background: var(--landing-surface);
}

body.app-page .app-subnav-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 14px;
}

body.app-page .app-subnav-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  margin: -8px 4px -8px -12px;
  color: var(--landing-muted);
  text-decoration: none;
}

body.app-page .app-subnav-back:hover {
  color: var(--landing-accent-ink);
  text-decoration: none;
}

body.app-page .app-subnav-back:focus-visible {
  outline: 2px solid var(--gals-color-accent);
  outline-offset: 2px;
  border-radius: var(--gals-radius-sm);
}

body.app-page .app-subnav-back-icon {
  display: block;
  width: 0.5rem;
  height: 0.5rem;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

body.app-page .app-subnav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

body.app-page .app-subnav-link {
  color: var(--landing-muted);
  text-decoration: none;
  font-weight: 560;
}

body.app-page .app-subnav-link:hover {
  color: var(--landing-accent-ink);
  text-decoration: none;
}

body.app-page .app-subnav-link.is-active {
  color: var(--landing-accent-ink);
  font-weight: 600;
  cursor: default;
}

body.app-page .app-toolbar-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--landing-muted);
  text-decoration: none;
}

body.app-page .app-toolbar-link:hover {
  color: var(--landing-accent-ink);
  text-decoration: none;
}

body.app-page .app-toolbar-sep {
  color: var(--landing-faint);
  padding: 0 6px;
  user-select: none;
}

body.app-page .app-toolbar-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--landing-accent-soft, #e6f5f3);
  color: var(--landing-accent-ink, var(--gals-color-accent-dark));
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

body.app-page .app-toolbar-badge:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

body.app-page .app-toolbar-form {
  display: inline;
}

body.app-page .app-toolbar-form .btn-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--landing-muted);
  padding: 0;
}

body.app-page .app-toolbar-form .btn-link:hover {
  color: var(--landing-accent-ink);
}

body.app-page .landing-site-inner {
  gap: 12px;
}

body.app-page .landing-nav-end {
  margin-left: auto;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  /* Шапка телефона — одна строка. У staff (со ссылкой «Служебное») слово GALS скрыто:
     вместе с ним она шире экрана и страница ползёт вбок. `flex-wrap` оставлен запасным: на
     совсем узком экране кнопки уйдут на вторую строку. */
  body.app-page .landing-wrap {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  body.app-page .landing-site-inner {
    height: auto;
    padding-block: 10px;
    gap: 8px;
  }

  /* Слово GALS убираем только там, где шапка иначе не помещается — рядом со ссылкой
     «Служебное» (её видят staff). У остальных оно на месте. */
  body.app-page .landing-site-inner:has(.landing-staff-link) .landing-logo-text {
    display: none;
  }

  body.app-page .landing-site-inner:has(.landing-staff-link) .landing-logo-mark {
    display: block;
  }

  body.app-page .landing-nav-end {
    justify-content: flex-end;
    gap: 6px 8px;
    flex-wrap: wrap;
    /* Без этого блок не сжимается и `flex-wrap` не срабатывает. */
    flex-shrink: 1;
    min-width: 0;
  }

  body.app-page .app-toolbar-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
  }

  body.app-page .app-toolbar-link,
  body.app-page .app-toolbar-form .btn-link {
    font-size: 13px;
  }

  body.app-page .lang-picker--landing .lang-picker__trigger {
    padding: 5px 9px;
  }
}

body.app-page .input:focus {
  outline: none;
  border-color: var(--landing-accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.landing-site-footer {
  border-top: 1px solid var(--landing-border);
  padding: 26px 0;
}

.landing-foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13.5px;
  color: var(--landing-faint);
}

.landing-foot-inner a {
  color: var(--landing-faint);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.landing-foot-inner a:hover {
  color: var(--landing-ink, inherit);
}

.legal-page .container {
  max-width: 44rem;
}

.legal-doc {
  padding: 1.5rem 0 3rem;
  line-height: 1.55;
}

.legal-doc h1 {
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
}

.legal-doc h2 {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.6rem;
}

.legal-doc h3 {
  font-size: 1.05rem;
  margin: 1.1rem 0 0.4rem;
}

.legal-back {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.legal-lead {
  color: var(--muted, #555);
  margin: 0 0 1.25rem;
}

.legal-section {
  margin-bottom: 0.5rem;
}

.legal-note {
  font-size: 0.9rem;
  color: var(--muted, #555);
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1rem;
  font-size: 0.95rem;
}

.legal-table th,
.legal-table td {
  border: 1px solid var(--border, #ddd);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.legal-table th {
  background: var(--surface-2, #f6f6f6);
}

/* Hero: страницу тетради пишут, фотографируют, проверяют и разбирают ошибку —
   та же сцена, что в промо-ролике. Рисует static/js/check-demo.js. */
.landing-check-demo {
  position: relative;
  background: var(--landing-surface);
  border: 1px solid var(--landing-border);
  border-radius: 18px;
  box-shadow: var(--landing-shadow-lg);
  padding: 12px;
}

.landing-check-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Под страницей, а не поверх неё, так что поправку «→ 7/8» карточка не закрывает ни на
   телефоне, ни в длинных переводах. Рамка с заголовком видна всегда (бледно) — место
   читается как «здесь будет разбор»; текст проявляется после проверки: --ready от 0 до 1
   ставит check-demo.js. */
.landing-check-card {
  --ready: 0;
  margin: 10px 6px 4px;
  padding: 12px 16px;
  background: var(--landing-surface);
  border: 1px solid var(--landing-border-strong);
  border-radius: 12px;
  box-shadow: var(--landing-shadow);
  opacity: calc(0.45 + 0.55 * var(--ready));
}

.landing-check-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--landing-accent-ink);
}

.landing-check-card-text {
  opacity: var(--ready);
  transform: translateY(calc((1 - var(--ready)) * 8px));
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--landing-ink);
}

/* «Как в видео»: тёмная полоса с большим деревом, растёт при прокрутке. */
.landing-tree-band {
  background: radial-gradient(ellipse at 75% 65%, var(--gals-color-night-glow) 0%, var(--gals-color-night) 70%);
  color: var(--gals-color-on-night);
  padding: 80px 0;
  overflow: hidden;
}

.landing-tree-band-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 48px;
  align-items: center;
}

body.landing-page .landing-tree-band h2 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
  color: var(--gals-color-on-night);
  text-wrap: balance;
}

.landing-tree-band p {
  color: color-mix(in srgb, var(--gals-color-on-night) 78%, transparent);
  font-size: 18px;
  line-height: 1.55;
  margin: 18px 0 0;
  max-width: 34em;
}

.landing-tree-band-video {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 10px 18px;
  border: 1px solid color-mix(in srgb, var(--gals-color-accent-warm) 50%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--gals-color-accent-warm);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.landing-tree-band-video:hover {
  background: color-mix(in srgb, var(--gals-color-accent-warm) 10%, transparent);
  text-decoration: none;
}

.landing-promo-player {
  display: block;
  width: 100%;
  max-width: 420px;
  max-height: 70vh;
  margin-top: 28px;
  border-radius: 12px;
  background: #000;
}

.landing-promo-player[hidden] {
  display: none;
}

.landing-tree-band-art {
  --kt-branch: var(--gals-color-accent-bright);
  --kt-tip: var(--gals-color-accent-pale);
  --kt-fruit: var(--gals-color-accent-warm);
  width: 100%;
  max-width: 560px;
  justify-self: center;
}

@media (max-width: 860px) {
  /* 72px of top air is a desktop measure; on a phone it pushed the CTA below the first screen. */
  .landing-hero {
    padding-top: 28px;
  }

  .landing-hero-grid {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .landing-tree-band {
    padding: 56px 0;
  }

  .landing-tree-band-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .landing-tree-band-art {
    max-width: 420px;
  }

  .landing-lead {
    max-width: 42ch;
  }

  .landing-steps-grid,
  .landing-steps-grid:has(> :nth-child(5):last-child) {
    grid-template-columns: 1fr;
  }

  .landing-steps-grid:has(> :nth-child(5):last-child) > :nth-child(n),
  .landing-steps-grid:has(> :nth-child(5):last-child) > :nth-child(4),
  .landing-steps-grid:has(> :nth-child(5):last-child) > :nth-child(5) {
    grid-column: auto;
  }

  .landing-device {
    order: 2;
  }

  .landing-docs-link {
    display: none;
  }

  .landing-privacy-inner {
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.landing-page * {
    transition: none !important;
  }
}

body.landing-page a:focus-visible,
body.landing-page button:focus-visible,
body.landing-page .landing-task:focus-visible {
  outline: 2px solid var(--landing-accent);
  outline-offset: 3px;
  border-radius: 8px;
}
/* Documentation */

.docs-main {
  padding: 24px 0 64px;
}

body.landing-page.docs-page .docs-sidebar {
  top: calc(64px + 1rem);
  max-height: calc(100vh - 64px - 2rem);
}

.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}

@media (max-width: 720px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
}

.docs-sidebar {
  padding: 1rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.docs-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin: 0 0 0.75rem;
}

.docs-sidebar > .docs-nav-group + .docs-nav-group {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.docs-nav-group > summary,
.docs-nav-nested > summary {
  cursor: pointer;
}

.docs-nav-group:not([open]) > :not(summary),
.docs-nav-nested:not([open]) > :not(summary) {
  display: none;
}

.docs-nav-group > summary {
  list-style: none;
}

.docs-nav-group > summary::-webkit-details-marker,
.docs-nav-nested > summary::-webkit-details-marker {
  display: none;
}

.docs-nav-heading {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  margin: 0;
}

.docs-nav-heading.is-current {
  color: #1d4ed8;
}

.docs-nav-group > summary::before,
.docs-nav-nested > summary::before {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-right: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-0.05rem);
  vertical-align: 0.05rem;
}

.docs-nav-group[open] > summary::before,
.docs-nav-nested[open] > summary::before {
  transform: rotate(45deg) translateY(-0.1rem);
}

.docs-nav-group[open] > summary {
  margin-bottom: 0.35rem;
}

.docs-nav-branch {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr);
  align-items: start;
}

.docs-nav-branch > .docs-nav-nested {
  grid-column: 1 / -1;
  grid-row: 1;
}

.docs-nav-branch > .docs-nav-link {
  grid-column: 2;
  grid-row: 1;
  z-index: 1;
}

.docs-nav-nested > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  min-height: 2.1rem;
  list-style: none;
}

.docs-nav-nested > summary::before {
  margin-right: 0;
}

.docs-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-nav-link {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #475569;
  text-decoration: none;
}

.docs-nav-link:hover {
  background: #f1f5f9;
  text-decoration: none;
}

.docs-nav-link.is-active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.docs-nav-children {
  margin: 0.15rem 0 0.4rem 0.65rem;
  padding-left: 0.35rem;
  border-left: 1px solid #e2e8f0;
}

.docs-nav-children .docs-nav-link {
  font-size: 0.82rem;
  padding: 0.25rem 0.45rem;
}

.docs-crumbs {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: #64748b;
}

.docs-crumbs a {
  color: #475569;
}

.docs-crumbs span {
  margin: 0 0.35rem;
  color: #94a3b8;
}

.docs-article {
  padding: 1.5rem 1.75rem;
  min-width: 0;
}

.docs-index-section {
  margin-top: 1.5rem;
  scroll-margin-top: 5.5rem;
}

.docs-article .prose h2,
.docs-article .prose h3,
.docs-article .prose h4 {
  scroll-margin-top: 5.5rem;
}

.docs-index-section h2,
.docs-index-section h3,
.docs-index-section h4 {
  margin: 0 0 0.25rem;
}

.docs-index-section h2 {
  font-size: 1.1rem;
}

.docs-index-section h3 {
  font-size: 1rem;
}

.docs-index-section h4 {
  font-size: 0.95rem;
}

.docs-index-section .docs-index-section {
  margin-top: 0.85rem;
  margin-left: 0.15rem;
}

.docs-index-audience {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 0.5rem;
}

.docs-index-list {
  margin: 0;
  padding-left: 1.25rem;
}

.docs-index-list li {
  margin-bottom: 0.35rem;
}

.docs-index-children {
  margin: 0.25rem 0 0.6rem 1.1rem;
}

.docs-index-desc {
  color: #64748b;
  font-size: 0.9rem;
}

.docs-index-note {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: #64748b;
}

.alert-table {
  width: 100%;
  border-collapse: collapse;
}

.alert-table th,
.alert-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--gals-color-border-subtle, #e2e8f0);
  vertical-align: top;
}

.alert-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.alert-badge-critical,
.alert-badge-firing {
  color: var(--gals-color-status-gap, #991b1b);
  background: var(--gals-color-status-gap-bg, #fee2e2);
}

.alert-badge-warning {
  color: var(--gals-color-status-in-progress, #92400e);
  background: var(--gals-color-status-in-progress-bg, #fef3c7);
}

.alert-badge-ok {
  color: var(--gals-color-status-solid, #166534);
  background: var(--gals-color-status-solid-bg, #dcfce7);
}

.alert-badge-suppressed,
.alert-badge-unknown {
  color: var(--gals-color-secondary-text, #334155);
  background: var(--gals-color-secondary-bg, #e2e8f0);
}

.alert-fetch-error {
  color: var(--gals-color-error-text, #991b1b);
}

.prose h1 {
  font-size: 1.6rem;
  margin-top: 0;
}

.prose h2 {
  font-size: 1.2rem;
  margin-top: 1.75rem;
}

.prose h3 {
  font-size: 1rem;
  margin-top: 1.25rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0.75rem 0;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
}

.prose li {
  margin: 0.25rem 0;
}

.prose code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.prose pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.45;
}

.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.prose th,
.prose td {
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.prose th {
  background: #f8fafc;
}

.prose a {
  word-break: break-word;
}

.prose .mermaid {
  margin: 1rem 0;
  overflow-x: auto;
  text-align: center;
}

.prose .mermaid svg {
  max-width: 100%;
  height: auto;
}

/* ER-схема: натуральный размер, прокрутка вбок, клик — на весь экран. */
.prose .mermaid-zoomable {
  text-align: left;
  cursor: zoom-in;
}

.prose .mermaid-zoomable svg {
  max-width: none;
}

.mermaid-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: auto;
  padding: 1rem;
  background: #fff;
  cursor: zoom-out;
}

.mermaid-overlay svg {
  max-width: none;
  height: auto;
}

.prose .docs-plantuml {
  margin: 1rem 0;
  /* The reading column is narrow; let a wide diagram keep its native size and
     scroll sideways here instead of shrinking to unreadable. Left-aligned, not
     centered: a centered child wider than a scroll container clips its own left
     edge and can't be scrolled back into view. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
}

.prose .docs-plantuml svg,
.prose .docs-plantuml img {
  max-width: none;
  height: auto;
  /* PlantUML draws dark strokes/text assuming a white canvas; its own inline
     background is stripped in core/plantuml.py so height:auto can win. */
  background: #fff;
  border-radius: 6px;
}

.prose .docs-plantuml-full {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  text-align: right;
}

.prose .docs-plantuml-full a {
  color: #64748b;
}

/* Assignment navigation (parent past sets) */

.assignment-nav {
  margin-bottom: 1rem;
  padding: 0;
}

.assignment-nav-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gals-color-text-muted);
  user-select: none;
}

.assignment-nav-summary::-webkit-details-marker {
  display: none;
}

.assignment-nav-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.assignment-nav[open] > .assignment-nav-summary::before {
  transform: rotate(90deg);
}

.assignment-nav-summary:hover {
  color: var(--gals-color-text-strong);
}

.assignment-nav-list {
  list-style: none;
  margin: 0;
  padding: 0 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 12rem;
  overflow-y: auto;
  border-top: 1px solid var(--gals-color-border-subtle);
}

.assignment-nav-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.2rem 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
}

.assignment-nav-link:hover {
  background: var(--gals-color-status-untouched-bg);
  text-decoration: none;
}

.assignment-nav-link.is-active {
  background: #dbeafe;
}

.assignment-nav-link--current {
  font-weight: 600;
}

.assignment-nav-date {
  font-weight: 600;
  color: var(--gals-color-text-strong);
  min-width: 0;
  flex: 1 1 12rem;
  line-height: 1.3;
}

.assignment-nav-when {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  min-width: 0;
}

.assignment-nav-duration {
  font-weight: 600;
  color: var(--gals-color-text-strong);
  font-variant-numeric: lining-nums tabular-nums;
}

.assignment-nav-range {
  font-size: 0.85rem;
  color: var(--gals-color-text-muted);
  line-height: 1.3;
  font-variant-numeric: lining-nums tabular-nums;
}

.assignment-nav-meta {
  font-size: 0.85rem;
  color: var(--gals-color-text-muted);
  text-align: right;
  line-height: 1.25;
  align-self: center;
}

.assignment-nav--secondary {
  margin: 1.5rem 0 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.assignment-nav--secondary .assignment-nav-summary {
  padding: 0.35rem 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gals-color-text-subtle);
}

.assignment-nav--secondary .assignment-nav-list {
  padding: 0.5rem 0 0;
  border-top: 1px solid var(--gals-color-border-subtle);
  max-height: 14rem;
}

.task-comment {
  margin: 0.75rem 0 0 2rem;
}

.task-comment-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.task-comment-input {
  margin-bottom: 0.5rem;
  min-height: 3.5rem;
  font-size: 0.9rem;
  resize: vertical;
}

.task-comment-save {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.task-report {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.task-report-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.task-answer-compose {
  position: relative;
}

.task-answer-compose .task-report-input {
  padding-right: 3.4rem;
}

.task-report-attach-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.task-report-attach-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.9rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted, #5c6560);
  cursor: pointer;
}

.task-report-attach-btn:hover:not(:disabled) {
  color: var(--text, #1c241f);
  background: rgba(0, 0, 0, 0.04);
}

.task-report-attach-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.task-report-attach-note {
  margin: 0 0 0.5rem;
  color: var(--muted, #5c6560);
  font-size: 0.8rem;
}

.task-report-attach-note--error {
  color: #b3261e;
}

.task-report-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.task-report-attach-list li {
  position: relative;
}

.task-report-attach-list img {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 0.4rem;
}

.task-report-attach-remove {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1c241f;
  color: #fff;
  font-size: 1rem;
  line-height: 1.5rem;
  cursor: pointer;
}

/* Зона нажатия крестика — 44px, хотя рисуется он меньше. */
.task-report-attach-remove::after {
  content: "";
  position: absolute;
  inset: -0.65rem;
}

.task-report-answer-label {
  font-size: 0.95rem;
}

.task-report-input {
  padding-right: 2.6rem;
}

.task-report-attach-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.task-report-attach-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.4rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--muted, #5c6560);
  cursor: pointer;
}

.task-report-attach-btn:hover {
  color: var(--text, #1c241f);
  background: rgba(0, 0, 0, 0.04);
}

.task-report-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.65rem;
  padding: 0;
  list-style: none;
}

.task-report-attach-list li {
  position: relative;
}

.task-report-attach-list img {
  display: block;
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 0.35rem;
}

.task-report-attach-remove {
  position: absolute;
  top: -0.3rem;
  right: -0.3rem;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #1c241f;
  color: #fff;
  font-size: 0.75rem;
  line-height: 1.1rem;
  cursor: pointer;
}

.task-report-input {
  margin-bottom: 0.65rem;
  min-height: 5.5rem;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.9rem;
  resize: vertical;
}

.task-report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.task-flag {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

.task-flag-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  gap: 0.4rem;
}

button.task-flag-vote {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.25rem;
  min-width: 2rem;
  min-height: 2rem;
  border: 0;
  background: transparent;
  color: var(--gals-color-text-muted);
  cursor: pointer;
}

button.task-flag-vote:hover,
.task-flag-vote.is-on,
.task-flag-vote[aria-pressed="true"] {
  color: var(--gals-color-link, var(--gals-color-accent));
  background: transparent;
}

.task-flag--feedback {
  margin: 0;
}

.task-revision-toggle {
  cursor: pointer;
  list-style: none;
  font-size: 0.85rem;
  color: var(--gals-color-text-muted);
}

.task-revision-toggle::-webkit-details-marker {
  display: none;
}

.task-revision-toggle::before {
  content: "↻ ";
}

.task-revision-body {
  margin-top: 0.75rem;
  padding: 0.85rem;
  background: var(--gals-color-bg);
  border-radius: var(--gals-radius-sm);
}

.task-revision-body .draft-revision {
  min-height: 3.5rem;
  font-size: 0.9rem;
  resize: vertical;
}

.task-revision-saved,
.task-revision-warning {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--gals-color-text-muted);
}

.task-revision-saved::before {
  content: "✓ ";
}

.regen-panel {
  margin-top: 1rem;
}

.regen-panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.regen-panel-count {
  flex: 1 1 12rem;
  margin: 0;
  font-size: 0.875rem;
  color: var(--gals-color-text-muted);
}

.regen-clear {
  font-size: 0.85rem;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.ai-actions > .strategy-hint,
.ai-actions > p {
  flex: 1 1 100%;
  width: 100%;
  margin: 0;
}

.ai-actions form {
  display: inline-flex;
  margin: 0;
}

.strategy-textarea {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.85rem;
  min-height: 0;
  resize: none;
}

/* ── Subscription page ──
   Two treatments, deliberately unlike each other: the status panel is tinted and
   rail-marked by state, the plan chooser is a plain white card. One type scale. */

body.subscription-page {
  --sub-fs-xs: 0.8125rem;
  --sub-fs-sm: 0.9375rem;
  --sub-fs-md: 1rem;
  --sub-fs-lg: 1.375rem;
  --sub-fs-price: 1.5rem;
  --sub-fs-xl: 1.75rem;
  --sub-state: var(--landing-border-strong, var(--gals-color-border));
  --sub-state-soft: color-mix(in srgb, var(--landing-border, #e4eae7) 30%, #fff);
  --sub-state-ink: var(--landing-ink, var(--gals-color-text-strong));
}

body.subscription-page .app-main-inner {
  max-width: 780px;
}

/* The page title has to out-rank the panel headline below it; the shared app h1
   lands within 2px of it, which reads as no hierarchy at all. */
body.subscription-page h1 {
  margin-bottom: 1.1rem;
  font-size: clamp(1.85rem, 5vw, 2.25rem);
}

.sub-status {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.35rem 1rem;
  overflow: hidden;
  margin: 0 0 1rem;
  padding: 1.35rem 1.5rem 1.5rem 1.65rem;
  border: 1px solid color-mix(in srgb, var(--sub-state) 40%, var(--landing-border, #e4eae7));
  border-radius: var(--landing-radius, var(--gals-radius-md));
  background: var(--sub-state-soft);
}

.sub-status::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--sub-state);
}

.sub-status--active,
.sub-status--managed {
  --sub-state: var(--landing-accent, var(--gals-color-accent));
  --sub-state-soft: color-mix(in srgb, var(--landing-accent-soft, #e6f5f3) 45%, #fff);
  --sub-state-ink: var(--landing-accent-ink, var(--gals-color-accent-dark));
}

.sub-status--pending_payment,
.sub-status--cancelling {
  --sub-state: var(--gals-color-status-in-progress);
  --sub-state-soft: color-mix(in srgb, var(--gals-color-status-in-progress-bg) 55%, #fff);
  --sub-state-ink: var(--gals-color-status-in-progress);
}

.sub-status-main {
  min-width: 0;
}

.sub-status-eyebrow {
  margin: 0 0 0.35rem;
  font-size: var(--sub-fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.sub-status-plan {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.1rem 0.75rem;
  margin: 0;
  font-family: var(--gals-font-display);
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.sub-status-plan-name {
  font-size: var(--sub-fs-xl);
  font-weight: 600;
  color: var(--landing-ink, var(--gals-color-text-strong));
}

.sub-status-line {
  margin: 0.6rem 0 0;
  max-width: 46ch;
  font-size: var(--sub-fs-sm);
  line-height: 1.45;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.sub-status--pending_payment .sub-status-line,
.sub-status--cancelling .sub-status-line {
  font-weight: 500;
  color: var(--sub-state-ink);
}

.sub-status-foot {
  margin: 0.4rem 0 0;
  max-width: 52ch;
  font-size: var(--sub-fs-xs);
  line-height: 1.4;
  color: var(--landing-faint, var(--gals-color-text-subtle));
}

.sub-status-badge {
  align-self: start;
  justify-self: end;
  padding: 0.25rem 0.7rem;
  /* The border carries the pill on the free state, where the tint is near-white. */
  border: 1px solid color-mix(in srgb, var(--sub-state) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--sub-state) 16%, #fff);
  color: var(--sub-state-ink);
  font-size: var(--sub-fs-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sub-meters {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem 2rem;
}

.sub-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.4rem;
}

.sub-meter-label {
  font-size: var(--sub-fs-xs);
  font-weight: 600;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.sub-meter-value {
  font-size: var(--sub-fs-sm);
  color: var(--landing-muted, var(--gals-color-text-muted));
  font-variant-numeric: lining-nums tabular-nums;
}

.sub-meter-value b {
  font-size: var(--sub-fs-lg);
  font-weight: 600;
  font-family: var(--gals-font-display);
  color: var(--landing-ink, var(--gals-color-text-strong));
}

.sub-meter-rail {
  height: 0.4rem;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--sub-state) 18%, #fff);
}

.sub-meter-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--sub-state);
  transition: width 0.35s ease;
}

.sub-meter--exhausted .sub-meter-bar {
  background: var(--gals-color-status-in-progress);
}

.sub-meter--exhausted .sub-meter-value,
.sub-meter--exhausted .sub-meter-foot {
  color: var(--gals-color-status-in-progress);
}

.sub-meter-foot {
  margin: 0.35rem 0 0;
  font-size: var(--sub-fs-xs);
  color: var(--landing-faint, var(--gals-color-text-subtle));
}

.sub-plans {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sub-plans-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
}

.sub-plans-head-text {
  min-width: 0;
  flex: 1 1 12rem;
}

.sub-plans-head h2 {
  margin: 0 0 0.3rem;
  font-family: var(--gals-font-display);
  font-size: var(--sub-fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sub-plans-head .plan-picker-currency {
  flex: 0 0 auto;
  margin-top: 0.15rem;
}

.sub-plans-lead {
  margin: 0;
  max-width: 58ch;
  font-size: var(--sub-fs-sm);
  line-height: 1.45;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.plan-picker {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.plan-picker-currency {
  display: inline-flex;
  align-self: flex-start;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--landing-border, var(--gals-color-border));
  border-radius: 999px;
  background: var(--landing-ground, var(--gals-color-bg));
}

.plan-picker-currency-option {
  position: relative;
  margin: 0;
}

.plan-picker-currency-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.plan-picker-currency-option span {
  display: block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--landing-muted, var(--gals-color-text-muted));
  transition: background 0.15s ease, color 0.15s ease;
}

.plan-picker-currency-option:has(input:checked) span {
  background: var(--landing-accent, var(--gals-color-accent));
  color: #fff;
}

.plan-picker-currency-option:has(input:focus-visible) span {
  outline: 2px solid var(--landing-accent, var(--gals-color-accent));
  outline-offset: 2px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  align-items: stretch;
  gap: 0.75rem;
  margin: 0;
  border: none;
  padding: 0;
  min-width: 0;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 1rem 1.1rem 1.1rem;
  border: 1.5px solid var(--landing-border, var(--gals-color-border));
  border-radius: var(--landing-radius, var(--gals-radius-md));
  background: var(--gals-color-surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

/* Selectable plans only — the Free card is a destination, not a radio. */
label.plan-card {
  cursor: pointer;
}

label.plan-card:hover {
  border-color: color-mix(in srgb, var(--landing-accent, #0d9488) 45%, var(--landing-border, #e4eae7));
}

.plan-card:has(input:checked) {
  border-color: var(--landing-accent, var(--gals-color-accent));
  background: color-mix(in srgb, var(--landing-accent-soft, #e6f5f3) 45%, #fff);
}

.plan-card:has(input:focus-visible) {
  outline: 2px solid var(--landing-accent, var(--gals-color-accent));
  outline-offset: 2px;
}

.plan-card:has(input:disabled) {
  cursor: default;
}

label.plan-card:has(input:disabled):hover {
  border-color: var(--landing-border, var(--gals-color-border));
}

.plan-card--free {
  background: color-mix(in srgb, var(--landing-ground, #fbfcfc) 70%, #fff);
}

.plan-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.plan-card-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.plan-card-name {
  font-size: var(--sub-fs-sm);
  font-weight: 600;
  color: var(--landing-ink, var(--gals-color-text-strong));
}

.plan-card-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--landing-accent-soft, #e6f5f3);
  color: var(--landing-accent-ink, var(--gals-color-accent-dark));
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.plan-card-price {
  font-family: var(--gals-font-display);
  font-size: var(--sub-fs-price);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--landing-ink, var(--gals-color-text-strong));
}

.plan-card-price--free {
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.plan-card-price-rub {
  display: none;
}

.plan-picker:has(#billing-region-rub:checked) .plan-card-price-usd,
.plan-picker--rub .plan-card-price-usd {
  display: none;
}

.plan-picker:has(#billing-region-rub:checked) .plan-card-price-rub,
.plan-picker--rub .plan-card-price-rub {
  display: inline;
}

.plan-card-period {
  font-family: var(--gals-font-sans);
  font-size: var(--sub-fs-sm);
  font-weight: 500;
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.plan-card-facts {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.15rem;
  padding-top: 0.6rem;
  border-top: 1px solid color-mix(in srgb, var(--landing-border, #e4eae7) 75%, transparent);
}

.plan-card-fact {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: var(--sub-fs-xs);
  color: var(--landing-muted, var(--gals-color-text-muted));
}

.plan-card-fact-n {
  font-size: var(--sub-fs-sm);
  font-weight: 600;
  color: var(--landing-ink, var(--gals-color-text-strong));
  font-variant-numeric: lining-nums tabular-nums;
}

.plan-card-note {
  margin: 0;
  font-size: var(--sub-fs-xs);
  line-height: 1.35;
  color: var(--gals-color-status-in-progress);
}

.plan-card-note--quiet {
  margin-top: -0.35rem;
  color: var(--landing-faint, var(--gals-color-text-subtle));
}

/* Leaving a paid plan: available, never loud. */
.plan-card-action {
  align-self: flex-start;
  padding: 0.3rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--gals-color-danger) 35%, transparent);
  border-radius: var(--gals-radius-sm);
  background: none;
  color: var(--gals-color-danger);
  font-family: inherit;
  font-size: var(--sub-fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.plan-card-action:hover {
  border-color: var(--gals-color-danger);
  background: color-mix(in srgb, var(--gals-color-danger) 7%, transparent);
}

.plan-card-action:focus-visible {
  outline: 2px solid var(--gals-color-danger);
  outline-offset: 2px;
}

.plan-picker-confirm {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  max-width: 58ch;
  font-weight: 400;
  font-size: var(--sub-fs-sm);
  line-height: 1.45;
  color: var(--landing-muted, var(--gals-color-text-muted));
  margin: 0;
}

.plan-picker-confirm input {
  margin-top: 0.2rem;
  accent-color: var(--landing-accent, var(--gals-color-accent));
}

/* .btn-go is full-bleed by default — sized for a narrow column, not this one. */
.sub-plans .form-actions {
  margin-top: 0;
}

.sub-plans .btn-go {
  width: auto;
  min-width: 15rem;
  font-size: var(--sub-fs-md);
  letter-spacing: 0.02em;
}

@media (max-width: 560px) {
  .sub-plans .btn-go {
    width: 100%;
  }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.print-pack-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin: 0;
}

.print-pack-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  color: var(--gals-color-text-muted);
  text-decoration: none;
}

.print-pack-link:hover {
  color: var(--gals-color-link, var(--gals-color-accent));
  background: var(--gals-color-border-subtle, #e2e8f0);
  text-decoration: none;
}

.print-pack-icon {
  display: block;
}

.section-title {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.markdown-body {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.markdown-body h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.markdown-body p {
  margin: 0 0 0.65rem;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.35rem 0 0.65rem;
  padding-left: 1.35rem;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0.65rem 0;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.6rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.markdown-body th {
  background: #f1f5f9;
  font-weight: 600;
}

.job-status-card {
  text-align: center;
}

.job-status-label {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.job-status-hint {
  color: #64748b;
  font-size: 0.875rem;
  margin: 0.75rem 0 0;
}

.job-status-hint--secondary {
  margin-top: 0.35rem;
  opacity: 0.85;
}

.onboarding-plan-skeleton__hint,
.onboarding-plan-skeleton .job-status-hint {
  color: #64748b;
  font-size: 0.875rem;
  margin: 0.5rem 0 0;
}

.onboarding-plan-skeleton .job-status-hint--secondary {
  margin-top: 0.35rem;
}

.job-status-error {
  color: #b91c1c;
  font-size: 0.9rem;
}

.job-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: #eff6ff;
}

.job-banner--busy {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.job-banner--busy > p {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.job-banner__spinner {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  border: 2px solid rgba(13, 148, 136, 0.2);
  border-top-color: var(--gals-color-accent, #0d9488);
  border-radius: 50%;
  animation: task-photo-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.strategy-intro {
  margin-bottom: 1rem;
}

.strategy-intro.strategy-plan-context {
  box-sizing: border-box;
}

.strategy-plan-context.is-editing p,
.strategy-plan-context.is-editing.strategy-hint {
  white-space: pre-line;
}

.strategy-plan-context.strategy-hint {
  box-sizing: border-box;
}

.strategy-intro p {
  margin: 0;
  color: var(--gals-color-text-muted);
  font-size: 0.95rem;
}

.strategy-next-step {
  margin-bottom: 1rem;
  background: var(--gals-color-success-bg);
  border: 1px solid #86efac;
}

.strategy-next-step-title {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: var(--gals-color-success-text);
}

.strategy-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--gals-color-text-muted);
}

.strategy-suggestion {
  margin-bottom: 1rem;
}

.strategy-briefing-form,
.strategy-refine-form {
  margin-bottom: 1rem;
}

.briefing-field {
  margin-bottom: 1rem;
}

.learner-type-picker {
  margin-bottom: 1.25rem;
  border: 0;
  padding: 0;
  min-inline-size: 0;
}

.profile-onboarding-card > h1 {
  margin-bottom: 1rem;
}

.profile-onboarding-card .learner-type-picker {
  margin-bottom: 1.85rem;
}

.learner-type-picker legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding: 0;
}

/* Переключатель «Для себя / Для ребёнка» — сегментированный: два сегмента, активный подсвечен. */
.learner-type-options {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--gals-color-secondary-bg);
}

.learner-type-option {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.learner-type-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.learner-type-option span {
  display: block;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gals-color-text-muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.learner-type-option input:checked + span {
  background: var(--gals-color-surface, #fff);
  color: var(--landing-ink, var(--gals-color-text-strong));
  box-shadow: 0 1px 3px rgba(20, 32, 27, 0.14);
}

.learner-type-option input:focus-visible + span {
  outline: 2px solid var(--landing-accent, var(--gals-color-accent));
  outline-offset: 2px;
}

.briefing-field-label-wrap {
  position: relative;
  margin-bottom: 0.35rem;
}

.briefing-field-label-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.briefing-field-label-row label {
  margin-bottom: 0;
}

.briefing-field-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 1px solid var(--landing-border, #d1d5db);
  border-radius: 50%;
  background: var(--gals-color-surface, #fff);
  color: var(--gals-color-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.briefing-field-info-btn:hover,
.briefing-field-info-btn[aria-expanded="true"] {
  border-color: var(--gals-color-primary);
  color: var(--gals-color-primary);
}

.briefing-field-info-btn:focus-visible {
  outline: 2px solid var(--gals-color-accent);
  outline-offset: 2px;
}

.briefing-field-tooltip {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--gals-color-text-muted);
  background: var(--gals-color-surface, #fff);
  border: 1px solid var(--landing-border, #e5e7eb);
  border-radius: var(--gals-radius-sm, 6px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.briefing-field-tooltip[hidden] {
  display: none;
}

.strategy-form {
  margin-bottom: 1rem;
}

.strategy-job-banner .job-status-error:not([hidden]) {
  margin-top: 0.75rem;
}

.strategy-job-actions {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.strategy-job-failed .job-status-error {
  margin: 0.5rem 0 0.75rem;
}

.strategy-editor-panes {
  display: grid;
  gap: 0.75rem;
  height: 28rem;
}

.strategy-pane-edit,
.strategy-pane-preview {
  height: 100%;
  min-height: 0;
  position: relative;
}

.strategy-plan-mode-btn {
  position: absolute;
  top: 0.5rem;
  right: 1.75rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--gals-color-text-muted, #64748b);
  cursor: pointer;
}

.strategy-plan-mode-btn:hover:not(:disabled) {
  color: var(--gals-color-text, #0f172a);
  background: var(--gals-color-surface, #fff);
}

.strategy-plan-mode-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.strategy-editor.is-edit-mode .strategy-plan-mode-btn--edit {
  display: none;
}

.strategy-editor.is-view-mode .strategy-plan-mode-btn--preview {
  display: none;
}

.strategy-pane-edit {
  display: flex;
  flex-direction: column;
}

.strategy-plan-preview {
  border: 1px solid var(--gals-color-border);
  border-radius: var(--gals-radius-sm);
  padding: 0.75rem 2.25rem 0.75rem 1rem;
  height: 100%;
  max-height: none;
  overflow: auto;
  background: #fafafa;
  box-sizing: border-box;
}

.strategy-edit-hint {
  color: var(--gals-color-text-muted);
  font-size: 0.875rem;
  margin: 0 0 0.65rem;
  flex-shrink: 0;
}

.strategy-editor.is-view-mode .strategy-pane-edit {
  display: none;
}

.strategy-editor.is-edit-mode .strategy-pane-preview {
  display: none;
}

.strategy-editor.is-edit-mode .strategy-textarea {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  resize: none;
  padding-top: 2.25rem;
  padding-right: 2.25rem;
}

.strategy-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.strategy-editor--full-height #strategy-plan-form {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 15rem);
}

.strategy-editor--full-height .strategy-editor-panes {
  flex: 1;
  min-height: 0;
  height: auto;
}

.strategy-editor--full-height .strategy-plan-preview {
  height: 100%;
}

.strategy-editor--full-height .onboarding-plan-skeleton {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 18rem);
}

.strategy-editor--full-height .onboarding-plan-skeleton__preview {
  flex: 1;
  min-height: 10rem;
}

.strategy-editor-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin-top: 0.65rem;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .strategy-editor-panes {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .strategy-pane-edit,
  .strategy-pane-preview {
    height: auto;
  }

  .strategy-plan-preview {
    height: auto;
    overflow: visible;
  }

  .strategy-editor-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin-top: 0.5rem;
  }

  .strategy-editor-actions .btn {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }

  .strategy-editor--full-height #strategy-plan-form {
    min-height: calc(100dvh - 17rem);
  }

  .strategy-editor--full-height .strategy-editor-panes {
    height: calc(100dvh - 20rem);
    min-height: 14rem;
  }

  .strategy-editor--full-height .strategy-plan-preview {
    height: 100%;
    overflow: auto;
  }

  .strategy-editor--full-height .onboarding-plan-skeleton {
    min-height: calc(100dvh - 21rem);
  }

  .onboarding-assignment-skeleton {
    min-height: calc(100dvh - 18rem);
  }

  .strategy-editor-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin-top: 0.5rem;
  }

  .strategy-editor-links .btn-link {
    text-align: center;
    padding: 0.5rem 0;
  }
}

.strategy-editor-links .btn-link {
  padding: 0;
  border: none;
  font: inherit;
  color: var(--gals-color-link);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.strategy-editor-links .btn-link:hover:not(:disabled):not(.is-disabled) {
  color: var(--gals-color-link-hover);
  text-decoration: underline;
}

.strategy-editor-links .btn-link:disabled,
.strategy-editor-links .btn-link.is-disabled,
.strategy-editor-links a.btn-link[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: none;
}

.strategy-inline-link-form {
  display: inline;
  margin: 0;
}

.strategy-editor-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gals-color-border);
}

.strategy-editor-footer form {
  margin: 0;
}

.strategy-secondary-actions {
  margin: -0.5rem 0 1rem;
}

.onboarding-subnav-inner {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  padding-top: 0.65rem;
  padding-bottom: 0.85rem;
}

.onboarding-stepper {
  width: 100%;
}

.onboarding-stepper-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.onboarding-stepper-list-desktop {
  display: flex;
}

.onboarding-stepper-item {
  display: flex;
  align-items: center;
}

.onboarding-stepper-item.is-current .onboarding-stepper-label {
  font-weight: 600;
}

.onboarding-stepper-item.is-done {
  color: var(--gals-color-text-muted);
}

.onboarding-stepper-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
}

.onboarding-stepper-link.is-disabled {
  opacity: 0.55;
}

.onboarding-stepper-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--gals-color-border);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.onboarding-stepper-item.is-current .onboarding-stepper-marker {
  border-color: var(--gals-color-accent);
  background: var(--gals-color-accent-soft, rgba(13, 148, 136, 0.12));
}

.onboarding-stepper-item.is-done .onboarding-stepper-marker {
  border-color: var(--gals-color-status-success, #16a34a);
}

.onboarding-stepper-sep {
  width: 1.25rem;
  height: 1px;
  background: var(--gals-color-border);
  list-style: none;
}

.onboarding-stepper-compact {
  display: none;
  width: 100%;
}

.onboarding-stepper-compact-label {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.onboarding-stepper-progress {
  height: 0.35rem;
  background: var(--gals-color-border);
  border-radius: 999px;
  overflow: hidden;
}

.onboarding-stepper-progress-bar {
  height: 100%;
  background: var(--gals-color-accent);
}

.onboarding-step-panel {
  margin-bottom: 1rem;
}

.onboarding-wait {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.onboarding-wait__spinner {
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  border: 2px solid rgba(13, 148, 136, 0.2);
  border-top-color: var(--gals-color-accent, #0d9488);
  border-radius: 50%;
  animation: task-photo-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.onboarding-wait__body {
  flex: 1 1 auto;
  min-width: 0;
}

.onboarding-wait__label {
  margin: 0;
  font-weight: 600;
}

.onboarding-wait__hint {
  margin: 0.35rem 0 0;
  color: var(--gals-color-text-muted);
  font-size: 0.9rem;
}

.onboarding-plan-skeleton__label {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.onboarding-plan-skeleton__hint {
  margin: 0 0 1rem;
  color: var(--gals-color-text-muted);
  font-size: 0.9rem;
}

.onboarding-plan-skeleton__preview {
  display: grid;
  gap: 0.65rem;
}

.onboarding-plan-skeleton__line {
  height: 0.85rem;
  border-radius: 0.35rem;
  background: linear-gradient(
    90deg,
    rgba(13, 148, 136, 0.08) 0%,
    rgba(13, 148, 136, 0.18) 50%,
    rgba(13, 148, 136, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: onboarding-plan-shimmer 1.4s ease-in-out infinite;
}

.onboarding-plan-skeleton__line--title {
  width: 42%;
  height: 1.1rem;
}

.onboarding-plan-skeleton__line--short {
  width: 58%;
}

.onboarding-plan-skeleton__line--medium {
  width: 78%;
}

.onboarding-assignment-loading {
  margin-bottom: 1rem;
}

.onboarding-assignment-skeleton {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 16rem);
}

.onboarding-assignment-skeleton__tasks {
  display: grid;
  gap: 0.75rem;
  flex: 1;
}

.onboarding-assignment-skeleton__task {
  display: grid;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--gals-color-border);
  border-radius: var(--gals-radius-sm);
  background: #fafafa;
}

@keyframes onboarding-plan-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (max-width: 720px) {
  .onboarding-stepper-list-desktop {
    display: none;
  }

  .onboarding-stepper-compact {
    display: block;
  }
}

.onboarding-checklist {
  margin-top: 0.65rem;
}

.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.onboarding-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--gals-color-border);
  font-size: 0.95rem;
}

.onboarding-step:last-child {
  border-bottom: none;
}

.onboarding-step.is-done {
  color: var(--gals-color-text-muted);
}

.onboarding-step.is-current .onboarding-step-label {
  font-weight: 600;
}

.onboarding-step-marker {
  width: 1.25rem;
  flex-shrink: 0;
}

.onboarding-step-label {
  flex: 1 1 12rem;
}

.onboarding-step-action {
  margin-left: auto;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.link-warning-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
}

.link-warning-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.link-warning-list {
  margin: 0;
  padding-left: 1.25rem;
}

.link-warning-list li + li {
  margin-top: 0.35rem;
}

.link-warning-reason {
  color: #92400e;
  font-size: 0.9rem;
}

.link-warning-hint {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: #78350f;
}

.mastery-map-form .section-title {
  margin-top: 0;
}

.mastery-topic-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.mastery-topic-row {
  display: grid;
  gap: 0.35rem 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--gals-color-border-subtle);
  border-radius: var(--gals-radius-sm);
  background: var(--gals-color-bg);
}

.mastery-topic-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gals-color-text-muted);
}

.mastery-topic-static {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--gals-color-text);
}

.mastery-topic-static-title {
  font-weight: 600;
}

.mastery-map-form-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.mastery-map-form-header .section-title {
  margin: 0;
}

.mastery-map-read .section-title {
  margin-top: 0;
}

.mastery-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gals-color-border-subtle);
}

.mastery-filter-chip {
  appearance: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0;
  border: none;
  background: none;
  color: var(--gals-color-text-muted);
  cursor: pointer;
  line-height: 1.5;
  text-decoration: none;
}

.mastery-filter-chip.is-active {
  color: var(--gals-color-text-muted);
  opacity: 1;
}

.mastery-filter-chip:not(.is-active) {
  color: var(--gals-color-text-subtle);
  font-weight: 400;
  opacity: 0.28;
}

.mastery-filter-chip:not(.is-active):hover {
  opacity: 0.5;
}

.mastery-filter-chip:focus-visible {
  outline: 2px solid var(--gals-color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.mastery-filter-empty {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--gals-color-text-muted);
}

.mastery-filter-empty .btn {
  margin-left: 0.5rem;
  vertical-align: baseline;
}

.mastery-subject-group {
  margin-top: 1.25rem;
}

.mastery-subject-group:first-of-type {
  margin-top: 0;
}

.mastery-subject-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gals-color-text-strong);
}

.mastery-read-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mastery-read-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--gals-color-border-subtle);
  scroll-margin-top: 6rem;
}

.mastery-read-item[hidden],
.mastery-read-item--filtered-out {
  display: none !important;
}

.mastery-subject-group[hidden],
.mastery-subject-group--filtered-out {
  display: none !important;
}

.mastery-read-item:last-child {
  border-bottom: none;
}

.mastery-read-title {
  flex: 1 1 12rem;
}

.topic-archive {
  flex: 1 1 12rem;
  min-width: 0;
}

.topic-archive-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  cursor: pointer;
  list-style: none;
}

.topic-archive-summary::-webkit-details-marker {
  display: none;
}

.topic-archive-summary::before {
  content: "▸";
  flex-shrink: 0;
  color: var(--gals-color-text-muted);
  transition: transform 0.15s ease;
}

.topic-archive[open] > .topic-archive-summary::before {
  transform: rotate(90deg);
}

.topic-archive .mastery-read-title {
  flex: 1 1 auto;
}

.topic-archive-panel {
  padding: 0.35rem 0 0.15rem;
}

.topic-archive-list {
  margin: 0;
}

.topic-archive-reason {
  margin: 0 0 0.5rem;
}

.topic-archive-earlier-wrap {
  list-style: none;
  margin: 0.75rem 0 0.25rem;
  padding: 0;
}

.topic-archive-earlier {
  margin: 0;
}

.task-check-topic-note {
  margin: 0.15rem 0 0.5rem;
  color: var(--gals-color-text-muted);
  font-size: 0.9rem;
}

.mastery-status-picker {
  position: relative;
  flex: 0 0 auto;
}

.mastery-status-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: none;
  cursor: pointer;
  font: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.mastery-status-picker-trigger:hover {
  box-shadow: 0 0 0 1px var(--gals-color-border-subtle);
}

.mastery-status-picker-trigger:focus-visible {
  outline: 2px solid var(--gals-color-accent);
  outline-offset: 2px;
}

.mastery-status-picker-chevron {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.1rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.7;
}

.mastery-status-picker-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 9rem;
  padding: 0.5rem;
  border: 1px solid var(--gals-color-border-subtle);
  border-radius: var(--gals-radius-sm);
  background: var(--gals-color-bg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.mastery-status-picker-menu[hidden] {
  display: none !important;
}

.mastery-status-picker-option {
  width: 100%;
  justify-content: flex-start;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.mastery-status-picker-option:hover,
.mastery-status-picker-option:focus-visible {
  filter: brightness(0.97);
  outline: 2px solid var(--gals-color-accent);
  outline-offset: 1px;
}

.mastery-status-picker-option.is-selected {
  box-shadow: inset 0 0 0 1px currentColor;
}

.mastery-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.mastery-status-badge--gap {
  background: var(--gals-color-status-gap-bg);
  color: var(--gals-color-status-gap);
}

.mastery-status-badge--in_progress {
  background: var(--gals-color-status-in-progress-bg);
  color: var(--gals-color-status-in-progress);
}

.mastery-status-badge--solid {
  background: var(--gals-color-status-solid-bg);
  color: var(--gals-color-status-solid);
}

.mastery-status-badge--untouched {
  background: var(--gals-color-status-untouched-bg);
  color: var(--gals-color-status-untouched);
}

.onboarding-step-pending {
  font-size: 0.875rem;
  color: var(--gals-color-text-muted);
  margin-right: 0.5rem;
}

/* --- AI task check --- */
.task-check {
  width: auto;
  height: auto;
  max-width: 100%;
  min-width: 0;
  margin: 0.75rem 0 0 2rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gals-color-border-subtle);
  border-left: 4px solid var(--gals-color-border);
  border-radius: 10px;
  background: var(--gals-color-bg);
}
/* Полоска разбора — цвет заливки бейджа, не чернил. */
.task-check--correct { border-left-color: var(--gals-color-status-correct-bg); }
.task-check--minor_errors { border-left-color: var(--gals-color-status-notes-bg); }
.task-check--major_gaps,
.task-check--not_done { border-left-color: var(--gals-color-status-gap-bg); }
.task-check--needs_parent { border-left-color: var(--gals-color-status-untouched-bg); }
.task-check-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  min-width: 0;
}
.task-check-by {
  font-size: 0.8rem;
  color: var(--gals-color-text-muted);
  min-width: 0;
}
.task-check-when {
  font-size: 0.8rem;
  color: var(--gals-color-text-muted);
  font-variant-numeric: lining-nums tabular-nums;
}
.task-check-analysis {
  font-size: 0.925rem;
  min-width: 0;
  overflow-wrap: break-word;
}
.task-check-photos {
  max-width: 100%;
  box-sizing: border-box;
}
.task-check-photos-label {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: var(--gals-color-text-subtle, #64748b);
}
.task-check-photos-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 100%;
}
.task-check-photos-item {
  flex: 0 0 4.5rem;
  width: 4.5rem;
  height: 4.5rem;
  max-width: 4.5rem;
  overflow: hidden;
}
.task-check-photos-link {
  display: block;
  flex: 0 0 4.5rem;
  width: 4.5rem;
  height: 4.5rem;
  max-width: 4.5rem;
  border-radius: 0.35rem;
  overflow: hidden;
  border: 1px solid var(--gals-color-border, rgba(0, 0, 0, 0.12));
  box-sizing: border-box;
}
.task-check-photos-thumb {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  max-width: 100%;
  object-fit: cover;
}
.task-check-photos--history {
  margin-top: 0.5rem;
}
.task-check-photos--compare {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gals-color-border-subtle, #e2e8f0);
  max-width: 100%;
}
.task-check-photos-compare-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 100%;
}
.task-check-photos-compare-item {
  margin: 0;
  max-width: 100%;
}
.task-check-photos-compare-link {
  display: block;
  max-width: 100%;
  border-radius: 0.35rem;
  overflow: hidden;
  border: 1px solid var(--gals-color-border, rgba(0, 0, 0, 0.12));
  background: var(--gals-color-surface, #fff);
}
.task-check-photos-full {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  vertical-align: top;
  background: var(--gals-color-surface-muted, #f1f5f9);
  min-height: 2rem;
}
.task-check-history {
  margin: 0.5rem 0 0 2rem;
  font-size: 0.875rem;
  border: 1px solid var(--gals-color-border-subtle, #e2e8f0);
  border-radius: 0.5rem;
  background: var(--gals-color-surface, #fff);
}
.task-check-history-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.55rem 0.75rem;
  color: var(--gals-color-text-muted);
  user-select: none;
}
.task-check-history-summary::-webkit-details-marker {
  display: none;
}
.task-check-history-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}
.task-check-history[open] > .task-check-history-summary::before {
  transform: rotate(90deg);
}
.task-check-history-summary:hover {
  color: var(--gals-color-text-strong);
}
.task-check-history-body {
  padding: 0 0.75rem 0.75rem;
  border-top: 1px solid var(--gals-color-border-subtle, #e2e8f0);
}
.task-check-history-item {
  margin-top: 0.75rem;
}
.task-check-history-item .task-check {
  margin-left: 0;
  margin-top: 0.35rem;
}
.task-check-history-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--gals-color-text-muted);
}
.task-check-reshoot-hint {
  margin: 0.75rem 0 0 2rem;
  font-size: 0.925rem;
  color: var(--gals-color-text-strong);
}
.task-check-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}
.task-check-form { margin-top: 0.5rem; margin-left: 2rem; }
.task-report-panel { margin-top: 0.5rem; margin-left: 2rem; }
.task-report-panel .task-report {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.task-recognized-answer {
  position: relative;
  margin-top: 0.75rem;
  margin-bottom: 0;
  margin-left: 0;
  font-size: 0.875rem;
  border: 1px solid var(--gals-color-border-subtle, #e2e8f0);
  border-radius: 0.5rem;
  background: var(--gals-color-surface, #fff);
  overflow: hidden;
}
.task-check-analysis > .task-recognized-answer {
  margin-top: 0.85rem;
}
.task-review-result > .task-recognized-answer,
[data-check-result] + .task-recognized-answer {
  margin-left: 2rem;
}
.task-recognized-answer-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  color: var(--gals-color-text-muted, #64748b);
  font-weight: 500;
  list-style: none;
  user-select: none;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}
.task-recognized-answer-body:has(> .task-flag--recognize) {
  padding-right: 4.75rem;
}
.task-recognized-answer-body > .task-flag--recognize {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  left: auto;
  width: max-content;
  z-index: 1;
  margin: 0;
}
.task-recognized-answer-summary::-webkit-details-marker {
  display: none;
}
.task-recognized-answer-summary::before {
  content: "▸";
  flex-shrink: 0;
  color: var(--gals-color-text-muted, #64748b);
  transition: transform 0.15s ease;
}
.task-recognized-answer[open] > .task-recognized-answer-summary::before {
  transform: rotate(90deg);
}
.task-recognized-answer-summary:hover {
  color: var(--gals-color-text-strong, #0f172a);
  background: var(--gals-color-surface-muted, #f8fafc);
}
.task-recognized-answer-read {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid var(--gals-color-border-subtle, #e2e8f0);
}
.task-recognized-answer:not([open]) .task-recognized-answer-read {
  display: none;
}
.task-recognized-answer-body {
  position: relative;
  padding: 0.75rem 2.25rem 0.75rem 0.9rem;
  border: 1px solid var(--gals-color-border, #e2e8f0);
  border-radius: 0.375rem;
  background: var(--gals-color-surface-muted, #f8fafc);
}
.task-recognized-answer-edit {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid var(--gals-color-border-subtle, #e2e8f0);
}
.task-recognized-edit-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--gals-color-text-muted, #64748b);
  cursor: pointer;
}
.task-recognized-edit-btn:hover,
.task-recognized-edit-btn[aria-pressed="true"] {
  color: var(--gals-color-text, #0f172a);
  background: var(--gals-color-surface, #fff);
}
.task-recognized-answer-input {
  margin-top: 0.5rem;
  width: 100%;
}
.task-recognized-answer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.task-recognized-answer--editing .task-recognized-answer-read {
  display: none;
}
.task-recognized-answer--editing .task-recognized-answer-edit {
  display: block;
  border-top: 1px solid var(--gals-color-border-subtle, #e2e8f0);
}
.task-report-panel--after-check { margin-top: 0; padding: 0; border: none; background: transparent; }
.task-parent-verified-form { margin-bottom: 0.75rem; }
.task-parent-verified-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  margin-bottom: 0.65rem;
  font-weight: 500;
  cursor: pointer;
}
.task-parent-verified-checkbox { margin-top: 0; flex-shrink: 0; }
.task-parent-verified-verdict {
  margin: 0.35rem 0 0.75rem;
}
.task-parent-verified-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.5rem;
}
.task-parent-verified-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  cursor: pointer;
}
.task-parent-verified-note {
  margin: 0.35rem 0 0;
}
.task-parent-verified-note-input { width: 100%; }
.task-ai-block--disabled { opacity: 0.55; }
.task-photo-form { margin-top: 0.75rem; }
.task-photo-upload { margin-bottom: 0.5rem; }
.task-review-result .task-photo-upload { margin-top: 0.75rem; }
.photo-upload-box { position: relative; display: inline-block; }
.photo-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.photo-capture-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  cursor: pointer;
  font: inherit;
}
.photo-capture-btn__icon[hidden] {
  display: none;
}
.photo-capture-btn__icon { flex-shrink: 0; }
.photo-capture-btn__spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: task-photo-spin 0.7s linear infinite;
  flex-shrink: 0;
}
.photo-upload-box--busy .photo-capture-btn__icon { display: none; }
.photo-upload-box--disabled .photo-capture-btn {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.photo-quota-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  max-width: 100%;
}
.photo-quota-note {
  margin: 0.35rem 0 0;
  max-width: 32rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--gals-color-text-muted);
}
.photo-quota-wrap .photo-quota-note {
  margin: 0;
}
.photo-quota-note a {
  display: inline;
  font-weight: 500;
}
.photo-quota-note--warn {
  color: var(--gals-color-text, #0f172a);
}
.photo-quota-note[hidden],
.photo-quota-wrap.is-tip-off .photo-quota-note {
  display: none;
}
.photo-upload-input:focus-visible + .photo-capture-btn {
  outline: 2px solid var(--gals-color-primary);
  outline-offset: 2px;
}
.photo-capture-error {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gals-color-danger-text, #b91c1c);
}
.photo-capture-success {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gals-color-success-text, #166534);
}
.photo-capture-success--error {
  color: var(--gals-color-danger-text, #b91c1c);
}
.photo-stack { margin-bottom: 0.65rem; }
.photo-stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.photo-stack-item {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
}
.photo-stack-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.35rem;
  border: 1px solid var(--gals-color-border, rgba(255, 255, 255, 0.12));
  display: block;
}
.photo-stack-remove {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid var(--gals-color-border, #cbd5e1);
  border-radius: 50%;
  background: var(--gals-color-surface, #fff);
  color: var(--gals-color-text-muted, #64748b);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}
.photo-stack-remove:hover {
  background: var(--gals-color-surface-muted, #f1f5f9);
  color: var(--gals-color-text-strong, #0f172a);
  border-color: var(--gals-color-border, #94a3b8);
}
.photo-stack-item--add { display: flex; }
.photo-stack-add {
  width: 100%;
  height: 100%;
  border: 1px dashed var(--gals-color-border, rgba(255, 255, 255, 0.2));
  border-radius: 0.35rem;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.photo-stack-add:disabled,
.photo-stack-remove:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.photo-capture-hints {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: var(--gals-color-text-subtle);
}
.photo-capture-hints > summary {
  cursor: pointer;
  color: var(--gals-color-text-muted);
}
.photo-capture-hints > p {
  margin: 0.35rem 0 0;
  line-height: 1.45;
}
@keyframes task-photo-spin {
  to { transform: rotate(360deg); }
}
.task-review-form .task-report-actions { margin-top: 0.75rem; }
.task-report-actions[hidden] { display: none; }

.photo-capture-hints > summary {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.task-report-panel--recheck { margin-top: 0.5rem; margin-left: 2rem; }
.task-recheck-toggle { margin-top: 0.35rem; margin-left: 2rem; }
.task-service-and-review {
  position: relative;
  min-width: 0;
}
.task-service-and-review:has(.task-flag--feedback) .task-check-head {
  padding-right: 4.75rem;
}
.task-service-and-review .task-flag--feedback {
  position: absolute;
  top: 0.35rem;
  right: 0;
  left: auto;
  width: max-content;
  z-index: 1;
  margin: 0;
}
.task-review-root { margin-top: 0.25rem; min-width: 0; }
.topic-theory {
  margin-top: 0.5rem;
  margin-left: 2rem;
}
.topic-theory-picker { margin-bottom: 0.5rem; }
.topic-theory-picker__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  margin: 0;
  padding: 0.15rem 0;
  color: var(--gals-color-text-subtle);
  cursor: pointer;
  list-style: none;
}
.topic-theory-picker__label::-webkit-details-marker {
  display: none;
}
.topic-theory-picker__label::before {
  content: "▸";
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.topic-theory-picker[open] > .topic-theory-picker__label::before {
  transform: rotate(90deg);
}
.topic-theory-picker__label:hover {
  color: var(--gals-color-text-strong, #0f172a);
}
.topic-theory-picker__hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--gals-color-text-muted, #64748b);
}
.topic-theory-picker__options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.topic-theory-picker__option {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--gals-color-border, #cbd5e1);
  border-radius: 0.35rem;
  font: inherit;
  font-weight: 400;
  text-align: left;
  color: inherit;
  cursor: pointer;
  background: transparent;
}
.topic-theory-picker__option:hover:not(:disabled) {
  border-color: var(--gals-color-text-strong, #1e293b);
  text-decoration: none;
}
.topic-theory-picker__option.is-active {
  border-color: var(--gals-color-text-strong, #1e293b);
  border-width: 2px;
  padding: calc(0.45rem - 1px) calc(0.55rem - 1px);
}
.topic-theory-picker__option.is-busy,
.topic-theory-picker__option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.topic-theory-picker__option-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.topic-theory-picker__subject {
  font-size: 0.75rem;
  color: var(--gals-color-text-subtle);
}
.topic-theory-picker__title {
  font-size: 0.95rem;
  line-height: 1.3;
  word-break: break-word;
}
.topic-theory__panel-slot { margin-top: 0.5rem; }

.topic-theory-wait {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.topic-theory-wait__spinner {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  border: 2px solid rgba(13, 148, 136, 0.2);
  border-top-color: var(--gals-color-accent, #0d9488);
  border-radius: 50%;
  animation: task-photo-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.topic-theory-wait__body {
  flex: 1 1 auto;
  min-width: 0;
}

.topic-theory-wait__label {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gals-color-text);
}

.topic-theory-wait__hint {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--gals-color-text-muted);
  transition: opacity 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .topic-theory-wait__spinner {
    animation: none;
    border-color: var(--gals-color-accent, #0d9488);
    opacity: 0.55;
  }
  .topic-theory-wait__hint {
    transition: none;
  }
}

.topic-theory-result-row {
  display: flex;
  align-items: flex-start;
  gap: 0.15rem;
}
.topic-theory-result-row .topic-theory-result {
  flex: 1 1 auto;
  min-width: 0;
}
.topic-theory-print {
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.topic-theory-result {
  margin: 0;
  border: 1px solid var(--gals-color-border-subtle, rgba(0, 0, 0, 0.12));
  border-radius: 0.35rem;
  background: var(--gals-color-surface, #fff);
  overflow: hidden;
}
.topic-theory-result__title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gals-color-text-muted, #64748b);
  cursor: pointer;
  list-style: none;
}
.topic-theory-result__title::-webkit-details-marker {
  display: none;
}
.topic-theory-result__title::before {
  content: "▸";
  flex-shrink: 0;
  color: var(--gals-color-text-muted, #64748b);
  transition: transform 0.15s ease;
}
.topic-theory-result[open] > .topic-theory-result__title::before {
  transform: rotate(90deg);
}
.topic-theory-result__title:hover {
  color: var(--gals-color-text-strong, #0f172a);
  background: var(--gals-color-surface-muted, #f8fafc);
}
.topic-theory-result__body {
  padding: 0 0.7rem 0.7rem;
  font-size: 0.95rem;
  border-top: 1px solid var(--gals-color-border-subtle, rgba(0, 0, 0, 0.08));
  min-width: 0;
}
.topic-theory-error .btn { margin-top: 0.35rem; }
.task-job-status {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: var(--gals-color-text-subtle);
}
.task-job-status--error { color: var(--gals-color-danger-text, #b91c1c); }
.task-review-in-progress {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  margin-top: 0.5rem;
  min-width: 0;
}
.task-review-in-progress .task-job-status {
  margin-top: 0;
  min-width: 0;
}
.task-review-cancel-btn {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.task-report-panel--busy { opacity: 0.92; }

/* Узкие экраны: вложенные отступы карточки задания съедают ~94px из 375px —
   схлопываем каскад, чтобы блоку проверки досталась почти вся ширина. */
@media (max-width: 540px) {
  .card {
    padding: 1rem;
  }

  .task-details-body {
    padding-left: 0.5rem;
    min-width: 0;
  }

  .task-body,
  .task-check,
  .task-check-form,
  .task-check-history,
  .task-check-reshoot-hint,
  .task-report-panel,
  .task-report-panel--recheck,
  .task-review-in-progress,
  .topic-theory {
    margin-left: 0.5rem;
  }

  .task-recognized-answer,
  .task-review-result > .task-recognized-answer,
  [data-check-result] + .task-recognized-answer {
    margin-left: 0.5rem;
  }

}

/* child-facing */
.child-subtitle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--gals-space-lg);
}
.child-subtitle-row__text {
  margin-bottom: 0;
  min-width: 0;
}
.child-subtitle-row__text .subtitle {
  margin-bottom: 0.15rem;
}

.assignment-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1rem;
  row-gap: 0.2rem;
  margin: 0.45rem 0 0;
  max-width: 36rem;
}

.assignment-facts__row {
  display: contents;
}

.assignment-facts dt {
  margin: 0;
  color: var(--gals-color-text-muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.assignment-facts dd {
  margin: 0;
  color: var(--gals-color-text);
  font-size: 0.95rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.dashboard-date {
  margin: 0;
  font-size: 0.875rem;
  color: var(--landing-muted);
}
.child-subtitle-row__link {
  flex-shrink: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--landing-muted);
  text-decoration: none;
  white-space: nowrap;
}
.child-subtitle-row__link:hover {
  color: var(--landing-accent-ink);
  text-decoration: none;
}

.task-check-child {
  margin-top: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  background: var(--gals-color-status-correct-bg);
  color: var(--gals-color-status-correct);
}
.task-check-child--minor_errors {
  background: var(--gals-color-status-notes-bg);
  color: var(--gals-color-status-notes);
}
.task-check-child--major_gaps,
.task-check-child--not_done {
  background: var(--gals-color-status-gap-bg);
  color: var(--gals-color-status-gap);
}
.task-check-child-status { font-weight: 600; }
.task-check-child-analysis { margin-top: 0.35rem; }
.task-check-child-analysis > summary {
  cursor: pointer;
  color: var(--gals-color-text-muted);
  font-size: 0.9rem;
}

.child-past-list {
  list-style: none;
  display: block;
  margin: 0;
  padding: 0;
  max-height: none;
  overflow: visible;
  border-top: none;
  gap: 0;
}
.child-past-link {
  display: block;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gals-color-border, #e5e7eb);
  text-decoration: none;
  color: inherit;
}
.child-past-link:last-child {
  border-bottom: none;
}
.task-history-instructions {
  margin: 0.5rem 0 0.75rem;
}
.task-history-instructions > summary {
  cursor: pointer;
  color: var(--gals-color-text-muted);
  font-size: 0.9rem;
}
.task-history-label {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.85rem;
  color: var(--gals-color-text-muted);
}
.task-history-answer {
  margin: 0.35rem 0 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--gals-color-surface-muted, #f3f4f6);
}
.task-history-answer-text {
  white-space: pre-wrap;
  font-size: 0.95rem;
}
.task-history-status {
  margin: 0.5rem 0 0;
  font-weight: 600;
  color: var(--gals-color-text-muted);
}
.task-history-status--done {
  color: var(--gals-color-success-text, #15803d);
}

.confirm-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: 26rem;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.confirm-dialog__body {
  padding: 1.5rem;
}
.confirm-dialog__text {
  margin: 0 0 1.25rem;
}
.confirm-dialog__actions {
  justify-content: flex-end;
}

.control-work-modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: 42rem;
  width: calc(100% - 2rem);
  max-height: calc(100% - 2rem);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}
.control-work-modal[open] {
  display: flex;
  flex-direction: column;
}
.control-work-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}
.control-work-modal__form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  padding: 1.25rem 1.5rem 1.25rem;
}
.control-work-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}
.control-work-modal__header .section-title {
  margin: 0;
}
.control-work-modal__lead {
  flex-shrink: 0;
  margin: 0 0 0.75rem;
}
.control-work-modal__toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}
.control-work-modal__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.control-work-modal__toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.control-work-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}
.control-work-modal__actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}
.control-work-modal__status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}
.control-work-modal__count {
  margin: 0;
}
.control-work-modal__limit {
  margin: 0;
}
.control-work-modal__limit.is-over {
  color: var(--gals-color-danger, #dc2626);
}
.control-work-topic-list {
  flex: 1 1 auto;
  min-height: 8rem;
  overflow: auto;
  border: 1px solid var(--gals-color-border, #e5e7eb);
  border-radius: 10px;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
}
.control-work-modal__empty {
  margin: 0.75rem 0.35rem;
  color: var(--gals-color-text-muted);
}
.control-work-modal__empty .btn {
  margin-left: 0.5rem;
  vertical-align: baseline;
}
.control-work-modal__empty[hidden] {
  display: none !important;
}
.control-work-modal__footer {
  flex-shrink: 0;
}
.control-work-modal__footer .form-actions {
  margin-top: 0;
}
.control-work-topic-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.5rem;
  row-gap: 0.2rem;
  align-items: start;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--gals-color-border, #e5e7eb);
}
.control-work-topic-row[hidden] {
  display: none !important;
}
.control-work-topic-row:last-child {
  border-bottom: none;
}
.control-work-topic-row > input {
  margin-top: 0.35rem;
}
.control-work-topic-row__body {
  min-width: 0;
}
.control-work-topic-row__title {
  display: block;
  font-weight: 600;
}
.control-work-topic-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin-top: 0.15rem;
}
.control-work-topic-row__tag {
  font-size: 0.8rem;
  color: var(--gals-color-text-muted);
}
.assignment--control-work {
  margin-top: 1rem;
}

/* Экран «Дети»: карточки в языке дашборда (.dash-profile). */
.child-card-edit {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--gals-color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.child-card-edit:hover {
  color: var(--landing-accent, var(--gals-color-accent));
}

.child-card-unnamed {
  color: var(--gals-color-text-muted);
  font-style: italic;
  font-weight: 500;
}

.child-card-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--gals-color-text-muted);
}

.child-card-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--landing-border, var(--gals-color-border-subtle));
}

.child-card-status.is-ready .child-card-dot {
  background: var(--landing-accent, var(--gals-color-accent));
}

.child-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.child-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--landing-border, var(--gals-color-border-subtle));
  border-radius: 999px;
  background: var(--gals-color-surface);
  font-size: 0.875rem;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
}

.child-chip:hover {
  border-color: var(--landing-accent, var(--gals-color-accent));
  color: var(--landing-accent, var(--gals-color-accent));
  text-decoration: none;
}

.child-chip--add {
  border-style: dashed;
  color: var(--gals-color-text-muted);
}

.child-card-actions {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-shrink: 0;
}

.child-card-delete:hover {
  color: var(--gals-color-danger);
}

/* Дашборд: «Дети» — тихая ссылка в шапке, «Добавить профиль» — пунктирная карточка в конце списка. */
.dash-head-link {
  font-size: 0.9rem;
  color: var(--gals-color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dash-head-link:hover {
  color: var(--landing-accent, var(--gals-color-accent));
}

.dash-add {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  border: 1.5px dashed var(--landing-border, var(--gals-color-border-subtle));
  border-radius: var(--landing-radius, var(--gals-radius-md));
  color: var(--gals-color-text-muted);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.dash-add:hover,
.dash-add:focus-visible {
  border-color: var(--landing-accent, var(--gals-color-accent));
  color: var(--landing-accent, var(--gals-color-accent));
  background: color-mix(in srgb, var(--landing-accent-soft, #e6f5f3) 55%, #fff);
  text-decoration: none;
  outline: none;
}

/* «+ Добавить …» как кнопка формы (POST): сбрасываем стили <button>. */
button.dash-add {
  width: 100%;
  background: none;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

/* Плашка «По итогам прошлого набора»: заголовок и список «тема: было → стало». */
.mastery-changes-banner ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.mastery-changes-banner li + li {
  margin-top: 0.25rem;
}
