/* GigaTeach: tokens, base, shell and shared components. Step views live in views.css. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --font-sans:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', Inter,
    'Segoe UI Variable Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:
    ui-monospace, 'SF Mono', Menlo, 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
  --bg: #ffffff;
  --fill: #f5f5f7;
  --fill-2: #ebebef;
  --fill-3: #e1e1e6;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #6e6e73;
  --faint: #636368;
  --disabled: #b0b0b5;
  --line: #e8e8ed;
  --line-2: #d2d2d7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --link: #0066cc;
  --accent-soft: #eaf3fd;
  --green: #1d7f3a;
  --green-dot: #34c759;
  --green-soft: #ecf8ef;
  --orange: #a85100;
  --orange-dot: #ff9f0a;
  --orange-soft: #fff5e6;
  --red: #c4001a;
  --red-dot: #ff3b30;
  --red-soft: #fff0ef;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --pill: 980px;
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.05);
  --focus-ring: 0 0 0 3px #0071e3;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 150ms;
  --t: 240ms;
  --t-slow: 480ms;
  --header-h: 52px;
  --sidebar-w: 264px;
  --content-w: 900px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-padding-top: calc(var(--header-h) + 32px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}
[hidden] {
  display: none !important;
}
img,
svg {
  display: block;
  max-width: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button {
  cursor: pointer;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
h1,
h2,
h3,
h4,
h5,
p {
  margin: 0;
}
h1,
h2,
h3 {
  text-wrap: balance;
}
p {
  text-wrap: pretty;
}
ul,
ol {
  margin: 0;
  padding: 0;
}
::selection {
  background: #cfe3fb;
}
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus {
  top: 10px;
  color: #fff;
}
.icon {
  flex: none;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.eyebrow {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.005em;
}
.footnote {
  font-size: 13px;
  color: var(--faint);
}

/* ---------- Shell ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: grid;
  align-items: center;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  grid-template-areas: 'brand steps new';
  padding-right: 16px;
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar .nav-toggle {
  display: none;
  grid-area: toggle;
}
.brand {
  grid-area: brand;
  justify-self: start;
  margin-left: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.022em;
}
.brand:hover {
  color: var(--ink);
  text-decoration: none;
}
.steps {
  grid-area: steps;
  display: flex;
  justify-content: center;
  min-width: 0;
  padding: 0 16px;
}
.steps:empty {
  display: none;
}
.btn-new {
  grid-area: new;
  color: var(--ink-2);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-h));
}
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  background: var(--fill);
}
.sidebar-title {
  padding: 28px 24px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: 0;
}
.project-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 24px;
  display: grid;
  align-content: start;
  gap: 2px;
  scrollbar-width: thin;
}
.project-row {
  position: relative;
  min-width: 0;
}
.project-item {
  display: grid;
  gap: 2px;
  padding: 10px 44px 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  transition: background var(--t-fast) var(--ease);
}
.project-row > .project-more {
  position: absolute;
  right: 5px;
  top: 10px;
  color: var(--muted);
}
.project-menu {
  position: fixed;
  margin: 0;
  width: 200px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper, white);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}
.project-menu .btn {
  width: 100%;
  justify-content: flex-start;
  color: var(--danger, #d92d20);
}
.project-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
  text-decoration: none;
}
.project-item[aria-current='page'] {
  background: rgba(0, 0, 0, 0.07);
}
.project-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.project-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.project-meta.is-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s var(--ease) infinite;
}
.sidebar-empty {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--faint);
}
.sidebar-skeleton {
  display: grid;
  gap: 8px;
  padding: 4px 0;
}
.scrim {
  display: none;
}

.main {
  min-width: 0;
  padding: 64px 64px 120px;
}
.main-inner {
  max-width: var(--content-w);
  margin: 0 auto;
}

/* ---------- Step bar (segmented control) ---------- */
.steps-list {
  list-style: none;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: rgba(118, 118, 128, 0.12);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.steps-list::-webkit-scrollbar {
  display: none;
}
.steps-item {
  flex: none;
}
.steps-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    color var(--t) var(--ease);
}
.steps-btn:hover {
  background: rgba(255, 255, 255, 0.5);
}
.steps-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.steps-item.is-current .steps-btn {
  background: #fff;
  font-weight: 600;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.1),
    0 0 0 0.5px rgba(0, 0, 0, 0.05);
}
.steps-item.is-locked .steps-btn {
  color: var(--disabled);
  cursor: default;
}
.steps-item.is-locked .steps-btn:hover {
  background: transparent;
}
.steps-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange-dot);
}
.steps-btn .spinner {
  --size: 11px;
}

/* ---------- Status dot ---------- */
.tone-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--disabled);
}
.tone-dot.tone-warning {
  background: var(--orange-dot);
}
.tone-dot.tone-danger {
  background: var(--red-dot);
}
.tone-dot.tone-success {
  background: var(--green-dot);
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 38px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--btn-h);
  padding: 0 18px;
  border: 0;
  border-radius: var(--pill);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  user-select: none;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    opacity var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}
.btn:hover {
  text-decoration: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  cursor: default;
  opacity: 0.38;
}
.btn-sm {
  --btn-h: 32px;
  padding: 0 14px;
  font-size: 14px;
}
.btn-lg {
  --btn-h: 48px;
  padding: 0 28px;
  font-size: 17px;
}
.btn-icon {
  width: var(--btn-h);
  padding: 0;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
}
.btn-secondary {
  background: var(--fill);
  color: var(--ink);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--fill-2);
  color: var(--ink);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}
.btn-quiet {
  background: transparent;
  color: var(--link);
  padding: 0 8px;
}
.btn-quiet:hover:not(:disabled) {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #b00017;
  color: #fff;
}
.btn.is-pending {
  cursor: progress;
  opacity: 0.8;
}
.btn.is-pending::after {
  content: '';
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
/* Gray buttons sit on gray surfaces: lift them to white. */
.callout .btn-secondary,
.composer .btn-secondary,
.revise .btn-secondary,
.result .btn-secondary,
.clarify .btn-secondary {
  background: #fff;
}
.callout .btn-secondary:hover:not(:disabled),
.result .btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.7);
}

/* ---------- Badges, chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--fill);
  color: var(--ink-2);
  letter-spacing: 0;
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--link);
}
.badge-success {
  background: var(--green-soft);
  color: var(--green);
}
.badge-warning {
  background: var(--orange-soft);
  color: var(--orange);
}
.badge-danger {
  background: var(--red-soft);
  color: var(--red);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: var(--pill);
  background: var(--fill);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.3;
}
.chip-id {
  min-height: 22px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.choice {
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  border-radius: var(--pill);
  padding: 6px 14px;
  font-size: 14px;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}
.choice:hover {
  border-color: var(--faint);
}
.choice[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--link);
}
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--link);
  font-size: inherit;
}
.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Sections ---------- */
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.panel-titles {
  min-width: 0;
}
.panel-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.2;
}
.panel-lead {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
}
.panel-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: none;
  margin-right: -8px;
}
.prose {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.subhead {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.016em;
}
.bullets {
  padding-left: 20px;
  display: grid;
  gap: 6px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
}
.bullets li::marker {
  color: var(--disabled);
}

/* ---------- Callouts ---------- */
.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 14px;
  background: var(--fill);
  font-size: 15px;
  line-height: 1.45;
}
.callout-icon {
  flex: none;
  display: grid;
  place-items: center;
  height: 21px;
  color: var(--faint);
}
.callout-body {
  min-width: 0;
  flex: 1;
}
.callout-title {
  font-weight: 600;
  color: var(--ink);
}
.callout-text {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.callout-title + .callout-text {
  margin-top: 2px;
}
.callout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.callout-accent .callout-icon {
  color: var(--accent);
}
.callout-success .callout-icon {
  color: var(--green-dot);
}
.callout-warning .callout-icon {
  color: var(--orange-dot);
}
.callout-danger {
  background: var(--red-soft);
}
.callout-danger .callout-icon {
  color: var(--red-dot);
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: 8px;
}
.field + .field {
  margin-top: 28px;
}
.field-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}
.field-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.field-error {
  font-size: 13px;
  color: var(--red);
  line-height: 1.4;
}
.field-error:empty {
  display: none;
}
.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.45;
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
.input:disabled,
.textarea:disabled {
  background: var(--fill);
  color: var(--muted);
}
.input[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--red);
}
.input[aria-invalid='true']:focus,
.textarea[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px var(--red);
}
.textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.55;
}
.select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 52%,
    calc(100% - 12px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.select.sm {
  padding: 5px 30px 5px 12px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

/* ---------- Tabs ---------- */
.seg {
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--pill);
  white-space: nowrap;
  transition:
    color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}
.seg-item:hover {
  color: var(--ink);
}
.seg-item.is-active {
  background: var(--fill-2);
  color: var(--ink);
}
.seg-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Tables ---------- */
.table-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}
.table-scroll:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.data-table th,
.data-table td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  line-height: 1.45;
}
.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
}
.data-table th:last-child,
.data-table td:last-child {
  padding-right: 0;
}
.data-table thead th {
  padding-top: 0;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.data-table tbody th {
  font-weight: 500;
  color: var(--ink);
}
.data-table tfoot th,
.data-table tfoot td {
  border-bottom: 0;
  font-weight: 600;
}
.data-table .num {
  text-align: right;
  white-space: nowrap;
}
.data-table .center {
  text-align: center;
}
.nowrap {
  white-space: nowrap;
}

/* ---------- Disclosure ---------- */
.disclosures > .disclosure {
  border-bottom: 1px solid var(--line);
}
.disclosures > .disclosure:first-child {
  border-top: 1px solid var(--line);
}
.disclosure-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  cursor: pointer;
  list-style: none;
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}
.disclosure-summary::-webkit-details-marker {
  display: none;
}
.disclosure-summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.disclosure-chevron {
  order: 2;
  margin-left: auto;
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: transform var(--t) var(--ease);
}
.disclosure[open] > .disclosure-summary .disclosure-chevron {
  transform: rotate(90deg);
}
.disclosure-body {
  padding: 0 0 28px;
}
.disclosure[open] > .disclosure-body {
  animation: reveal var(--t) var(--ease-out);
}
.summary-main {
  flex: 1;
  min-width: 0;
}
.summary-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

/* ---------- Empty, spinner, skeleton, progress ---------- */
.empty-state {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 72px 24px;
}
.empty-icon {
  color: var(--disabled);
  margin-bottom: 14px;
}
.empty-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.empty-text {
  max-width: 420px;
  color: var(--muted);
  font-size: 16px;
}
.empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
}
.spinner {
  --size: 16px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--muted);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, #f0f0f3 0%, #f7f7f9 40%, #f0f0f3 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.progress {
  position: relative;
  height: 3px;
  border-radius: var(--pill);
  background: rgba(0, 0, 0, 0.07);
  overflow: hidden;
}
.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.7s var(--ease);
}
.progress.is-indeterminate .progress-fill {
  width: 35% !important;
  animation: indeterminate 1.5s var(--ease) infinite;
}
@keyframes indeterminate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(300%);
  }
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 12px 14px 16px;
  border-radius: 16px;
  background: rgba(29, 29, 31, 0.92);
  color: #f5f5f7;
  box-shadow: var(--shadow-pop);
  font-size: 14px;
  line-height: 1.45;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: toast-in var(--t-slow) var(--ease-out);
}
.toast.is-leaving {
  animation: toast-out var(--t) var(--ease) forwards;
}
.toast .icon {
  margin-top: 1px;
  color: #8fc3ff;
}
.toast.tone-danger .icon {
  color: #ff8a80;
}
.toast.tone-success .icon {
  color: #6fdc8c;
}
.toast.tone-warning .icon {
  color: #ffc56b;
}
.toast-text {
  flex: 1;
  min-width: 0;
}
.toast-close {
  border: 0;
  background: transparent;
  color: #a1a1a6;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  margin: -2px -2px 0 0;
}
.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Dialogs ---------- */
dialog.modal {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 0;
  padding: 0;
  border-radius: 20px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
dialog.modal.narrow {
  width: min(440px, calc(100vw - 32px));
}
dialog.modal[open] {
  animation: dialog-in var(--t-slow) var(--ease-out);
  display: flex;
  flex-direction: column;
}
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.28);
  animation: fade-in var(--t) var(--ease);
}
dialog.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.modal-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 28px 0;
}
.modal-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.modal-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
}
.modal-body {
  flex: 1;
  min-height: 0;
  padding: 16px 28px 4px;
  overflow-y: auto;
}
.modal-body .textarea {
  min-height: 220px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 24px 28px 28px;
}
.modal-close {
  margin: -4px -10px 0 0;
}
.modal-text {
  color: var(--ink-2);
  font-size: 15px;
}
.consequences {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Responsive shell ---------- */
@media (max-width: 1180px) {
  .main {
    padding: 56px 40px 110px;
  }
}
@media (max-width: 960px) {
  :root {
    --sidebar-w: 300px;
  }
  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: 'toggle brand steps new';
    padding: 0 12px 0 8px;
  }
  .topbar .nav-toggle {
    display: inline-flex;
  }
  .brand {
    margin-left: 0;
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    width: min(var(--sidebar-w), 86vw);
    transform: translateX(-102%);
    visibility: hidden;
    transition:
      transform var(--t-slow) var(--ease-out),
      visibility 0s linear var(--t-slow);
    box-shadow: var(--shadow-pop);
  }
  .nav-open .sidebar {
    transform: none;
    visibility: visible;
    transition:
      transform var(--t-slow) var(--ease-out),
      visibility 0s;
  }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t) var(--ease);
  }
  .nav-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
}
@media (max-width: 860px) {
  html {
    scroll-padding-top: 24px;
  }
  .topbar {
    position: relative;
    height: auto;
    grid-template-columns: auto auto 1fr auto;
    grid-template-rows: var(--header-h) auto;
    grid-template-areas: 'toggle brand . new' 'steps steps steps steps';
  }
  .steps {
    justify-content: flex-start;
    padding: 0 4px 10px;
    margin: 0 -4px;
  }
  .btn-new .btn-label {
    display: none;
  }
  .btn-new {
    width: var(--btn-h);
    padding: 0;
  }
}
@media (max-width: 640px) {
  .main {
    padding: 32px 20px 96px;
  }
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .panel-actions {
    margin-left: -8px;
    margin-right: 0;
  }
  .toasts {
    right: 16px;
    left: 16px;
    bottom: 16px;
    width: auto;
  }
  .modal-head {
    padding: 22px 20px 0;
  }
  .modal-body {
    padding: 14px 20px 4px;
  }
  .modal-foot {
    padding: 20px;
  }
  .modal-foot .btn {
    flex: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .spinner,
  .btn.is-pending::after {
    animation-duration: 1.6s !important;
    animation-iteration-count: infinite !important;
  }
  .progress.is-indeterminate .progress-fill {
    animation: none !important;
    transform: none;
    width: 100% !important;
    opacity: 0.35;
  }
}
