:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-alt: #f0f3f4;
  --ink: #182029;
  --muted: #66707c;
  --line: #d9dedf;
  --line-strong: #aeb8bc;
  --blue: #265f99;
  --blue-soft: #dfeefa;
  --green: #277356;
  --green-soft: #dff1e8;
  --amber: #b86b1f;
  --amber-soft: #fff0d8;
  --orange: #d66b1f;
  --red: #a13c3c;
  --red-soft: #f8e2e0;
  --violet: #63508f;
  --violet-soft: #ece7f5;
  --shadow: 0 14px 28px rgba(32, 44, 54, 0.09);
  --radius: 8px;
  --gap-page: 18px;
  --gap-panel: 14px;
  --pad-panel-x: 14px;
  --pad-panel-y: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.76), rgba(255,255,255,0) 260px),
    var(--bg);
  overflow-x: hidden;
  line-height: 1.45;
}

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

button {
  border: 1px solid #c9d2d7;
  background: linear-gradient(180deg, #ffffff, #f7fafb);
  color: var(--ink);
  min-height: 36px;
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(24, 32, 41, 0.08);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background 140ms ease, color 140ms ease;
}

button:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 5px 12px rgba(38, 95, 153, 0.13);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.primary {
  background: linear-gradient(180deg, #2d6fa8, var(--blue));
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 7px 16px rgba(38, 95, 153, 0.22);
}

.primary:hover {
  color: #fff;
  background: linear-gradient(180deg, #347db9, #1f527f);
}

.danger {
  border-color: #d8aaa6;
  color: var(--red);
}

.delete-icon-button {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border-color: #d8aaa6;
  background: var(--surface);
  color: var(--red);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.delete-icon-button:hover {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.icon-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(120deg, rgba(38, 95, 153, 0.08), rgba(39, 115, 86, 0.08)),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-brand h1,
.auth-copy h2 {
  margin: 0;
  letter-spacing: 0;
}

.auth-brand h1 {
  font-size: 18px;
}

.auth-brand p,
.auth-copy p {
  margin: 4px 0 0;
  color: var(--muted);
}

.auth-copy {
  margin-bottom: 16px;
}

.auth-copy h2 {
  font-size: 24px;
}

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

.auth-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  border: 1px solid #c7d0d5;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.auth-message {
  margin-bottom: 12px;
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.auth-message.good {
  background: var(--green-soft);
  color: var(--green);
}

.auth-message.bad {
  background: var(--red-soft);
  color: var(--red);
}

.auth-switch {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.auth-switch button {
  min-height: 28px;
  margin-left: 6px;
  padding: 0 8px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
  line-height: 1.15;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.logout-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.logout-user {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: calc(100vh - 59px);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar {
  position: sticky;
  top: 59px;
  align-self: start;
  max-height: calc(100vh - 59px);
  overflow: auto;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  scrollbar-gutter: stable;
}

.project-mini {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.project-mini label,
.field label,
.compact-field label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.project-mini input,
.project-mini textarea {
  width: 100%;
  border: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
}

.project-mini textarea {
  min-height: 26px;
  resize: both;
  overflow: auto;
}

.project-meta {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.nav button {
  justify-content: flex-start;
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  text-align: left;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.nav button:hover,
.nav button.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.nav .count {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #e8edf0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-ai-panel {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-ai-panel .ai-automation {
  margin-top: 0;
}

.sidebar-ai-panel .api-settings-grid {
  grid-template-columns: 1fr;
}

.main {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  padding: 18px 20px 34px;
}

.view-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.view-header h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0;
}

.view-header p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 78ch;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  border-radius: 6px;
  padding: 0 7px;
  border: 0;
  background: #e8edf0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: none;
  pointer-events: none;
}

.pill.good,
.badge.good {
  background: var(--green-soft);
  color: var(--green);
}

.pill.warn,
.badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill.bad,
.badge.bad {
  background: var(--red-soft);
  color: var(--red);
}

.pill.info,
.badge.info {
  background: var(--blue-soft);
  border-color: #b7d4ec;
  color: var(--blue);
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--gap-panel);
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.layout-3 {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 360px;
  gap: var(--gap-panel);
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.layout-2 > *,
.layout-3 > * {
  min-width: 0;
}

.layout-rcfa {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: var(--gap-panel);
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.layout-rcfa > * {
  min-width: 0;
}

.rcfa-canvas-layout {
  grid-template-columns: 1fr;
}

.rcfa-canvas-layout .canvas-shell {
  order: 1;
}

.rcfa-canvas-layout .rcfa-node-editor {
  order: 2;
  position: static;
  max-height: none;
}

.cra-canvas-layout {
  display: grid;
  gap: var(--gap-panel);
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.cra-canvas-layout > * {
  min-width: 0;
}

.cra-canvas-layout .cra-left-rail {
  display: contents;
}

.cra-canvas-layout .cra-top-stack {
  order: 1;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 2.1fr);
  align-items: stretch;
}

.cra-canvas-layout .cra-logic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cra-canvas-layout .canvas-shell {
  order: 2;
}

.cra-canvas-layout .cra-idea-editor {
  order: 3;
  position: static;
  max-height: none;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}

.validation-panel {
  margin-top: var(--gap-panel);
}

.validation-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.panel-header {
  padding: 12px var(--pad-panel-x);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.panel-body {
  padding: var(--pad-panel-y) var(--pad-panel-x);
}

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

.project-import-panel {
  margin-bottom: var(--gap-panel);
}

.project-import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.file-upload-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.file-upload-field input[type="file"] {
  width: 100%;
  border: 1px dashed #b7c3c9;
  border-radius: 6px;
  padding: 8px;
  background: #fff;
  color: var(--muted);
}

.md-check-list {
  margin-top: 10px;
}

.user-table td,
.user-table th,
.project-table td,
.project-table th {
  vertical-align: middle;
}

.project-table .current-row {
  background: rgba(223, 238, 250, 0.42);
}

.project-table td:first-child strong {
  margin-right: 6px;
}

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

.field-grid.single {
  grid-template-columns: 1fr;
}

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

.compact-field.full {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea,
.compact-field input,
.compact-field select,
.compact-field textarea,
.readonly-text-box,
.readonly-value {
  width: 100%;
  border: 1px solid #c7d0d5;
  border-radius: 6px;
  padding: 8px 9px;
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 2px rgba(24, 32, 41, 0.04);
}

.readonly-value {
  display: flex;
  align-items: center;
  min-height: 34px;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(240, 243, 244, 0.88), rgba(247, 249, 250, 0.88)),
    var(--surface-alt);
  color: var(--muted);
  font-weight: 800;
  box-shadow: inset 3px 0 0 #c2ccd1;
}

.field textarea,
.compact-field textarea {
  resize: both;
  overflow: auto;
  min-height: 72px;
  line-height: 1.45;
}

input[readonly],
textarea[readonly],
select:disabled {
  border-color: #cfd7db;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(240, 243, 244, 0.88), rgba(247, 249, 250, 0.88)),
    var(--surface-alt);
  color: var(--muted);
  cursor: default;
  box-shadow: inset 3px 0 0 #c2ccd1;
}

select:disabled {
  opacity: 1;
}

.field textarea[rows="1"],
.compact-field textarea[rows="1"] {
  min-height: 34px;
}

.readonly-text-box {
  min-height: 34px;
  resize: both;
  overflow: auto;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(240, 243, 244, 0.88), rgba(247, 249, 250, 0.88)),
    var(--surface-alt);
  color: var(--muted);
  box-shadow: inset 3px 0 0 #c2ccd1;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.compact-field input:focus,
.compact-field select:focus,
.compact-field textarea:focus {
  outline: 2px solid rgba(38, 95, 153, 0.18);
  border-color: var(--blue);
}

.summary-line {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.ai-automation {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.ai-automation button {
  width: 100%;
}

.ai-stage-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.ai-run-message {
  margin: 0;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-run-message.good {
  background: var(--green-soft);
  color: var(--green);
}

.ai-run-message.bad {
  background: var(--red-soft);
  color: var(--red);
}

.ai-run-message.warn {
  background: #fff4df;
  color: #9a5a00;
}

.api-settings {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.api-settings summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.api-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.api-settings-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.api-settings-grid label.full {
  grid-column: 1 / -1;
}

.api-settings-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.api-settings-grid input,
.api-settings-grid select,
.api-settings-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.api-settings-grid textarea {
  min-height: 32px;
  resize: both;
  overflow: auto;
}

.api-model-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.api-model-field .compact {
  min-height: 32px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 900;
}

.api-model-message {
  display: block;
  min-height: 14px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.api-model-message.good {
  color: var(--green);
}

.api-model-message.bad {
  color: var(--red);
}

.api-model-message.warn {
  color: #9a5a00;
}

.empty-state {
  padding: 14px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.check-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--muted);
  line-height: 1.45;
}

.check-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  background: var(--surface-alt);
  color: var(--muted);
}

.check-dot.good {
  background: var(--green-soft);
  color: var(--green);
}

.check-dot.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.canvas-shell {
  min-width: 0;
  max-width: 100%;
}

.canvas-scroll {
  overflow: auto;
  max-height: calc(100vh - 196px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

#rcfaScroll {
  min-height: min(640px, calc(100vh - 196px));
}

.canvas-map {
  position: relative;
  display: grid;
  gap: 12px;
  align-items: start;
  min-height: 500px;
  padding: 12px;
}

.edge-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.lane {
  position: relative;
  z-index: 1;
  min-width: 224px;
  display: grid;
  gap: 22px;
}

.lane-title {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,0.95);
  font-size: 13px;
  font-weight: 800;
}

.node-card,
.cra-card,
.resource-card,
.solution-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(32, 44, 54, 0.07);
  min-height: 96px;
}

.node-card:hover,
.node-card.selected,
.cra-card:hover,
.cra-card.selected {
  border-color: var(--blue);
}

.node-card.selected,
.cra-card.selected {
  outline: 2px solid rgba(38, 95, 153, 0.18);
}

.node-name {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
  text-align: left;
}

.node-name:hover {
  color: var(--blue);
}

.node-card.type-HF {
  border-left-color: var(--red);
}

.node-card.type-IF {
  border-left-color: var(--blue);
}

.node-card.type-EF {
  border-left-color: var(--amber);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.code {
  font-weight: 900;
  letter-spacing: 0;
}

.card-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.card-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.check-action {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.check-action:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.check-action.checked {
  border-color: #b7d4ec;
  background: var(--blue-soft);
  color: var(--blue);
}

.action-checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--blue);
  cursor: pointer;
}

.card-actions button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.rcfa-node-editor {
  max-height: calc(100vh - 128px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.rcfa-node-editor .panel-header {
  padding: 10px 12px;
}

.rcfa-node-editor .panel-header h3 {
  font-size: 14px;
}

.rcfa-node-editor .panel-body {
  padding: 10px 12px;
}

.rcfa-node-editor .compact-form {
  gap: 9px;
}

.rcfa-node-editor .split-row {
  gap: 8px;
}

.rcfa-node-editor .compact-field label {
  margin-bottom: 4px;
  font-size: 11px;
}

.rcfa-node-editor .compact-field input,
.rcfa-node-editor .compact-field select,
.rcfa-node-editor .compact-field textarea,
.rcfa-node-editor .readonly-value {
  padding: 6px 7px;
  font-size: 12px;
  line-height: 1.35;
}

.rcfa-node-editor .readonly-value {
  min-height: 30px;
}

.rcfa-node-editor .compact-field textarea {
  min-height: 58px;
}

.rcfa-node-editor .card-actions button,
.rcfa-node-editor .edge-editor-head button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.edge-editor {
  display: grid;
  gap: 10px;
}

.edge-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.edge-card {
  box-shadow: none;
}

.add-node-slot {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.add-circle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(32, 44, 54, 0.08);
}

.add-circle:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.add-column-lane {
  min-height: 100%;
  align-content: center;
  justify-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
}

.add-column-lane span {
  font-size: 12px;
  font-weight: 800;
}

.inspector {
  position: sticky;
  top: 86px;
}

.cra-left-rail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

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

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.spp-table {
  table-layout: fixed;
  min-width: 1880px;
}

.spp-col-select {
  width: 78px;
}

.spp-col-code {
  width: 84px;
}

.spp-col-event {
  width: 420px;
}

.spp-col-short {
  width: 120px;
}

.spp-col-impact,
.spp-col-judgment {
  width: 180px;
}

.spp-col-position,
.spp-col-long {
  width: 220px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

td input,
td select,
td textarea {
  width: 100%;
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: #fff;
  font-size: 12px;
  line-height: 1.35;
}

td textarea {
  min-height: 62px;
  resize: both;
  overflow: auto;
}

td textarea[rows="1"] {
  min-height: 34px;
}

td.select-cell,
td.manage-cell {
  width: 54px;
  min-width: 54px;
  padding: 6px;
  text-align: center;
  vertical-align: middle;
}

td .action-checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

td .delete-icon-button {
  margin: 0 auto;
}

.spp-table th,
.spp-table td {
  word-break: keep-all;
  overflow-wrap: break-word;
}

.spp-table .event-cell {
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.spp-table td input,
.spp-table td textarea {
  min-width: 0;
}

.cra-map {
  grid-template-columns: repeat(7, minmax(230px, 1fr));
  min-width: 1740px;
}

.cra-board {
  display: grid;
  gap: 12px;
  min-width: 980px;
  padding: 12px;
}

.cra-top-stack {
  display: grid;
  gap: 10px;
}

.cra-logic-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.cra-block,
.cra-idea-cell {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(32, 44, 54, 0.06);
  min-width: 0;
}

.cra-block.selected,
.cra-idea-cell.selected {
  border-color: var(--blue);
  outline: 2px solid rgba(38, 95, 153, 0.18);
}

.cra-block:nth-child(2),
.cra-logic-grid .cra-block {
  border-left-color: var(--violet);
}

.cra-block .card-title {
  font-size: 12px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.cra-box-name {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  text-align: left;
  line-height: 1.3;
}

.cra-box-name:hover {
  color: var(--blue);
}

.cra-matrix {
  display: grid;
  gap: 8px;
  align-items: stretch;
}

.cra-matrix-head,
.cra-row-head {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  min-width: 0;
}

.cra-matrix-head {
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.resource-head {
  background: var(--blue-soft);
}

.resource-head-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.resource-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.resource-head span {
  color: var(--muted);
  font-size: 11px;
}

.resource-add-button {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.resource-add-button:hover {
  border-color: var(--blue);
  background: #fff;
}

.cra-row-head {
  display: grid;
  gap: 5px;
  align-content: start;
  padding: 8px;
  background: #fff;
  border-left: 4px solid var(--green);
}

.cra-row-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cra-idea-cell {
  min-height: 104px;
  align-content: start;
  align-items: start;
  border-left-color: var(--line-strong);
}

.cra-idea-cell.has-idea {
  border-left-color: var(--orange);
}

.cra-idea-cell.empty-idea {
  border-left-color: var(--line-strong);
}

.cra-idea-cell p {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.cra-idea-cell:focus-within {
  border-color: var(--blue);
  outline: 2px solid rgba(38, 95, 153, 0.18);
}

.cra-idea-input {
  width: 100%;
  min-width: 0;
  min-height: 76px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.cra-idea-input:focus {
  border-color: var(--blue);
  outline: 0;
  box-shadow: 0 0 0 2px rgba(38, 95, 153, 0.12);
}

.cra-idea-editor {
  max-height: calc(100vh - 128px);
  overflow: auto;
  scrollbar-gutter: stable;
}

.rcfa-map {
  min-width: 1540px;
  column-gap: 36px;
  row-gap: 12px;
}

.cra-card.axis {
  border-left-color: var(--violet);
}

.cra-card.resource,
.resource-card {
  border-left-color: var(--green);
}

.cra-card.solution,
.solution-card {
  border-left-color: var(--blue);
}

.cra-card.side {
  border-left-color: var(--amber);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.home-process {
  margin-top: var(--gap-panel);
}

.home-summary {
  margin-top: var(--gap-panel);
}

.process-page {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.process-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.process-title h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: 0;
}

.process-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.process-flow {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 20px;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
}

.process-step {
  position: relative;
  min-height: 168px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: #fff;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 7px;
  min-width: 0;
}

.process-step::after {
  content: "→";
  position: absolute;
  right: -20px;
  top: 50%;
  z-index: 3;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
  transform: translateY(-50%);
}

.process-step-4::after {
  content: "↓";
  right: 50%;
  top: auto;
  bottom: -20px;
  transform: translateX(50%);
}

.process-step-5::after,
.process-step-6::after,
.process-step-7::after {
  content: "←";
  right: auto;
  left: -22px;
}

.process-step-8::after {
  content: none;
}

.process-step-1 {
  grid-column: 1;
  grid-row: 1;
}

.process-step-2 {
  grid-column: 2;
  grid-row: 1;
}

.process-step-3 {
  grid-column: 3;
  grid-row: 1;
}

.process-step-4 {
  grid-column: 4;
  grid-row: 1;
}

.process-step-5 {
  grid-column: 4;
  grid-row: 2;
  border-left-color: var(--green);
}

.process-step-6 {
  grid-column: 3;
  grid-row: 2;
  border-left-color: var(--amber);
}

.process-step-7 {
  grid-column: 2;
  grid-row: 2;
  border-left-color: var(--violet);
}

.process-step-8 {
  grid-column: 1;
  grid-row: 2;
  border-left-color: var(--ink);
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-no {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.step-tag {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.process-step h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.process-step p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.step-output {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.step-output span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.step-output strong {
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.step-link {
  justify-self: start;
  min-height: 30px;
  margin-top: 4px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  border-color: #cbd5da;
  background: linear-gradient(180deg, #fff, #f6f9fa);
  color: var(--blue);
  box-shadow: none;
}

.step-link:hover {
  box-shadow: 0 4px 10px rgba(38, 95, 153, 0.12);
}

.flow-line {
  display: none;
}

.learn-page {
  display: grid;
  gap: var(--gap-panel);
  min-width: 0;
}

.learn-hero {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(223, 238, 250, 0.82), rgba(255, 255, 255, 0.9) 42%, rgba(223, 241, 232, 0.86)),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.learn-hero-copy {
  display: grid;
  gap: 6px;
  align-items: start;
  min-width: 0;
}

.learn-hero-copy h3 {
  margin: 0;
  max-width: none;
  font-size: 24px;
  line-height: 1.18;
  letter-spacing: 0;
  word-break: keep-all;
}

.learn-hero-copy p {
  margin: 0;
  max-width: 72ch;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.learn-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: var(--gap-panel);
  align-items: start;
  min-width: 0;
}

.learn-rail {
  position: sticky;
  top: 78px;
  display: grid;
  gap: 7px;
  align-items: start;
  min-width: 0;
}

.learn-rail button {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  justify-self: stretch;
  min-height: 42px;
  padding: 7px 9px;
  text-align: left;
}

.learn-rail button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.learn-topic-tag {
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.learn-rail button.active .learn-topic-tag {
  background: var(--green);
  color: #fff;
}

.learn-abbrev-box {
  display: grid;
  grid-column: 1 / -1;
  flex-basis: 100%;
  gap: 8px;
  margin-top: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.learn-abbrev-box > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.learn-abbrev-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.learn-abbrev-button {
  display: inline-grid;
  gap: 2px;
  align-content: center;
  justify-items: start;
  min-height: 28px;
  padding: 0 8px;
  border-color: var(--line);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.learn-abbrev-button.expanded {
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 6px;
  align-items: start;
  min-height: 64px;
  flex-basis: 100%;
  padding: 10px 12px;
  border-color: var(--violet);
  background: var(--violet-soft);
  color: var(--violet);
  text-align: left;
}

.learn-abbrev-button strong {
  font-size: 11px;
  line-height: 1.2;
}

.learn-abbrev-button span {
  font-size: 11px;
  line-height: 1.25;
}

.learn-abbrev-button small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.45;
  white-space: normal;
}

.learn-abbrev-button.expanded strong {
  white-space: nowrap;
  padding-top: 1px;
}

.learn-abbrev-button.expanded span {
  min-width: 0;
  color: var(--violet);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.learn-content {
  display: grid;
  gap: var(--gap-panel);
  min-width: 0;
}

.learn-stage-panel,
.learn-checkpoint,
.learn-framework-figure,
.learn-map-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.learn-stage-head,
.learn-section-title {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.learn-stage-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.learn-stage-head h3,
.learn-section-title h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
  word-break: keep-all;
}

.learn-section-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.learn-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 0;
}

.learn-focus-block {
  padding: 14px;
}

.learn-focus-block + .learn-focus-block {
  border-left: 1px solid var(--line);
  background: var(--surface-alt);
}

.learn-focus-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.learn-focus-block ul,
.learn-focus-block ol {
  margin: 0;
  padding-left: 20px;
}

.learn-focus-block li {
  margin: 7px 0;
  line-height: 1.55;
  word-break: keep-all;
}

.learn-source-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f7faf8);
}

.learn-source-checks div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
}

.learn-source-checks div + div {
  border-left: 1px solid var(--line);
}

.learn-source-checks span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.learn-source-checks strong {
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.learn-framework-figure {
  padding: 10px;
  background: #fff;
}

.learn-framework-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.learn-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.learn-question-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.learn-question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.learn-question-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  word-break: keep-all;
}

.learn-question-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 12px 0;
}

.learn-question-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.learn-question-dot {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.learn-question-dot.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.learn-question-dot.done {
  border-color: #9bc8b0;
  background: var(--green-soft);
  color: var(--green);
}

.learn-question-card .learn-options {
  padding: 12px;
}

.learn-question-card .learn-feedback {
  margin: 0 12px 12px;
}

.learn-question-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 0 12px 12px;
}

.learn-question-nav span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.learn-option {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 96px;
  padding: 10px;
  text-align: left;
}

.learn-option span {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 900;
}

.learn-option strong {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.learn-option.selected {
  border-width: 2px;
}

.learn-option.correct {
  border-color: #9bc8b0;
  background: var(--green-soft);
  color: var(--green);
}

.learn-option.correct span {
  background: var(--green);
  color: #fff;
}

.learn-option.incorrect {
  border-color: #d8aaa6;
  background: var(--red-soft);
  color: var(--red);
}

.learn-option.incorrect span {
  background: var(--red);
  color: #fff;
}

.learn-feedback {
  margin: 0 14px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--muted);
  line-height: 1.5;
}

.learn-feedback.good {
  border-color: #9bc8b0;
  background: var(--green-soft);
  color: var(--green);
}

.learn-feedback.bad {
  border-color: #d8aaa6;
  background: var(--red-soft);
  color: var(--red);
}

.learn-map-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.learn-map-section .learn-section-title {
  grid-column: 1;
  grid-row: 1;
  align-content: center;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbfd, #f4faf6);
}

.learn-map-section .learn-section-title h3 {
  font-size: 17px;
}

.learn-map-section .learn-section-title p {
  max-width: 44ch;
  font-size: 12px;
}

.learn-map-puzzle {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #f7faf8);
}

.learn-map-match-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 34px minmax(180px, 0.95fr);
  gap: 10px;
  align-items: stretch;
  min-width: 430px;
}

.learn-map-clues,
.learn-map-arrows,
.learn-puzzle-slots {
  display: grid;
  gap: 8px;
  align-content: start;
}

.learn-map-arrows span,
.learn-map-inline-arrow {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 18px;
  font-weight: 900;
}

.learn-clue-row,
.learn-puzzle-tile {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.learn-clue-row span,
.learn-puzzle-tile span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.learn-clue-row strong,
.learn-puzzle-tile strong {
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: keep-all;
}

.learn-puzzle-tile {
  cursor: pointer;
  text-align: left;
}

.learn-puzzle-tile.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.learn-puzzle-tile.correct {
  border-color: #9bc8b0;
  background: var(--green-soft);
  color: var(--green);
}

.learn-puzzle-tile.locked,
.learn-puzzle-tile:disabled {
  opacity: 1;
  cursor: default;
}

.learn-puzzle-tile.locked span {
  background: var(--green);
  color: #fff;
}

.learn-puzzle-tile.misplaced {
  border-color: #ebc58a;
  background: var(--amber-soft);
  color: var(--amber);
}

.learn-puzzle-actions {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 14px 14px;
  background: #f7faf8;
}

.learn-map {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #fff, #f7faf8);
}

.learn-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  text-align: left;
}

.learn-map-row.active {
  border-color: var(--violet);
  background: var(--violet-soft);
  color: var(--violet);
}

.rcfa-side,
.cra-side {
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.rcfa-side {
  font-weight: 800;
}

.cra-side {
  color: var(--blue);
  font-weight: 900;
}

.map-arrow {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-weight: 900;
}

.learn-map-row.active .map-arrow {
  background: var(--violet);
  color: #fff;
}

.learn-map-note {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.learn-map-note strong {
  font-size: 18px;
  line-height: 1.3;
  color: var(--violet);
}

.learn-map-note.empty strong,
.learn-map-note.empty span {
  color: var(--muted);
}

.learn-map-note small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.learn-map-note span {
  color: var(--ink);
  line-height: 1.55;
}

.report-preview {
  overflow: auto;
  max-height: calc(100vh - 190px);
  min-height: 480px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.58;
  scrollbar-gutter: stable both-edges;
}

.report-preview h1 {
  margin: 0 0 14px;
  font-size: 24px;
  letter-spacing: 0;
}

.report-preview h2 {
  margin: 22px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 17px;
  letter-spacing: 0;
}

.report-preview p {
  margin: 7px 0;
}

.report-bullet {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.report-bullet::before {
  content: "";
  width: 5px;
  height: 5px;
  min-width: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.report-bullet strong {
  min-width: 88px;
  color: var(--muted);
}

.report-preview-table {
  margin: 8px 0 14px;
  box-shadow: none;
}

.report-preview-table table {
  min-width: 680px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .main {
    width: 100%;
    max-width: 100vw;
  }

  .sidebar {
    position: static;
    top: auto;
    z-index: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 9px 14px;
  }

  .project-mini {
    display: none;
  }

  .nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow: auto;
    margin-top: 0;
  }

  .nav button {
    width: auto;
    min-height: 36px;
  }

  .layout-2,
  .layout-3 {
    grid-template-columns: 1fr;
  }

  .learn-hero,
  .learn-shell {
    grid-template-columns: 1fr;
  }

  .learn-map-section {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .learn-rail {
    position: static;
    top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .learn-rail button {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
    grid-template-columns: 72px max-content;
  }

  .learn-rail button > span:last-child {
    white-space: nowrap;
  }

  .learn-map-section .learn-section-title {
    grid-column: 1;
    grid-row: 1;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .learn-map-puzzle,
  .learn-puzzle-actions {
    grid-column: 1 / -1;
  }

  .learn-map-puzzle {
    grid-row: 2;
  }

  .learn-puzzle-actions {
    grid-row: 3;
  }

  .learn-map-note {
    grid-column: 2;
    grid-row: 1;
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }

  .learn-map-puzzle {
    gap: 8px;
  }

  .learn-map-match-row {
    grid-template-columns: minmax(170px, 1fr) 32px minmax(170px, 0.95fr);
    min-width: 404px;
  }

  .learn-map-note {
    border-left: 0;
  }

  .inspector {
    position: sticky;
    top: 86px;
  }

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

  .process-step {
    min-height: 158px;
    padding: 10px;
    gap: 5px;
  }

  .process-step-1 {
    grid-column: 1;
    grid-row: 1;
  }

  .process-step-2 {
    grid-column: 2;
    grid-row: 1;
  }

  .process-step-3 {
    grid-column: 3;
    grid-row: 1;
  }

  .process-step-4 {
    grid-column: 4;
    grid-row: 1;
  }

  .process-step-5 {
    grid-column: 4;
    grid-row: 2;
  }

  .process-step-6 {
    grid-column: 3;
    grid-row: 2;
  }

  .process-step-7 {
    grid-column: 2;
    grid-row: 2;
  }

  .process-step-8 {
    grid-column: 1;
    grid-row: 2;
  }

  .process-step::after {
    content: "→";
    right: -17px;
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .process-step-4::after {
    content: "↓";
    left: 50%;
    right: auto;
    top: auto;
    bottom: -17px;
    transform: translateX(-50%);
  }

  .process-step-5::after,
  .process-step-6::after,
  .process-step-7::after {
    content: "←";
    right: auto;
    left: -17px;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .process-step-8::after {
    content: none;
  }

  .process-title {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar,
  .view-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .top-actions,
  .toolbar {
    justify-content: flex-start;
  }

  .learn-hero {
    padding: 12px;
  }

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

  .learn-hero-copy h3 {
    max-width: none;
    font-size: 26px;
  }

  .learn-focus-grid,
  .learn-options,
  .learn-source-checks {
    grid-template-columns: 1fr;
    overflow: visible;
  }

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

  .learn-map-section .learn-section-title,
  .learn-map-note,
  .learn-map-puzzle,
  .learn-puzzle-actions {
    grid-column: 1;
  }

  .learn-map-section .learn-section-title {
    grid-row: 1;
    border-right: 0;
  }

  .learn-map-note {
    grid-row: 2;
    border-top: 1px solid var(--line);
  }

  .learn-map-puzzle {
    grid-row: 3;
  }

  .learn-puzzle-actions {
    grid-row: 4;
  }

  .learn-question-toolbar {
    grid-template-columns: 1fr;
  }

  .learn-map-puzzle {
    gap: 6px;
    padding: 10px;
  }

  .learn-map-match-row {
    grid-template-columns: minmax(156px, 1fr) 26px minmax(142px, 0.95fr);
    min-width: 342px;
    gap: 6px;
  }

  .learn-map-clues,
  .learn-map-arrows,
  .learn-puzzle-slots {
    gap: 6px;
  }

  .learn-map-arrows span,
  .learn-map-inline-arrow {
    min-height: 44px;
    font-size: 15px;
  }

  .learn-clue-row,
  .learn-puzzle-tile {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 6px;
    min-height: 44px;
    padding: 7px;
  }

  .learn-clue-row span,
  .learn-puzzle-tile span {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  .learn-clue-row strong,
  .learn-puzzle-tile strong {
    font-size: 13px;
  }

  .learn-question-dots {
    justify-content: flex-start;
  }

  .learn-stage-head {
    grid-template-columns: 1fr;
  }

  .learn-focus-block + .learn-focus-block {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .learn-source-checks div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .learn-abbrev-button.expanded {
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 10px;
  }

  .learn-map-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .map-arrow {
    transform: rotate(90deg);
  }

  .main {
    padding: 12px;
  }

  .field-grid,
  .split-row,
  .layout-rcfa {
    grid-template-columns: 1fr;
  }

  .cra-canvas-layout .cra-top-stack,
  .cra-canvas-layout .cra-logic-grid {
    grid-template-columns: 1fr;
  }

  .cra-idea-cell {
    min-height: 118px;
  }

  .cra-idea-input {
    min-height: 82px;
  }

  .inspector {
    position: static;
  }

  .brand h1 {
    font-size: 15px;
  }

  .view-header h2 {
    font-size: 20px;
  }

  .view-header {
    margin-bottom: 12px;
  }

  .status-strip {
    margin-bottom: 10px;
  }

  .panel-header,
  .panel-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .process-page {
    padding: 12px;
  }

  .process-flow {
    grid-template-columns: 1fr;
  }

  .process-step,
  .process-step-1,
  .process-step-2,
  .process-step-3,
  .process-step-4,
  .process-step-5,
  .process-step-6,
  .process-step-7,
  .process-step-8 {
    grid-column: 1;
    grid-row: auto;
    min-height: 0;
  }

  .process-step::after,
  .process-step-2::after,
  .process-step-3::after,
  .process-step-4::after,
  .process-step-5::after,
  .process-step-6::after,
  .process-step-7::after {
    content: "↓";
    left: 50%;
    right: auto;
    top: auto;
    bottom: -22px;
    transform: translateX(-50%);
  }

  .process-step-8::after {
    content: none;
  }

  .process-title h3 {
    font-size: 22px;
  }
}

@media (max-width: 360px) {
  .learn-rail button {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .learn-rail button > span:last-child {
    white-space: normal;
  }
}
