:root {
  --ink: #181512;
  --muted: #667085;
  --line: #e6ddcc;
  --paper: #fffef9;
  --page: #f8f7f3;
  --front: #2368b2;
  --front-soft: #eef6ff;
  --production: #c24c3d;
  --production-soft: #fff2ef;
  --management: #98630d;
  --management-soft: #fff7e6;
  --success: #277354;
  --success-soft: #edf8f1;
  --shadow: 0 10px 28px rgba(31, 26, 20, 0.07);
  --radius: 8px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

button,
input,
textarea { font: inherit; }

button { cursor: pointer; }

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

h1,
h2,
h3,
h4,
p { letter-spacing: 0; }

.hidden { display: none !important; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.header-inner {
  display: flex;
  max-width: 1180px;
  min-height: 76px;
  margin: 0 auto;
  padding: 14px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #225ca9 0 58%, #f2c94c 58% 100%);
  color: #fff;
  font-weight: 900;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
}

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

.language-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.language-switch button {
  min-width: 68px;
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.language-switch button.active {
  background: var(--ink);
  color: #fff;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.auth-view {
  max-width: 1080px;
  min-height: calc(100vh - 160px);
  margin: 0 auto;
  display: grid;
  align-items: center;
}

.auth-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.78fr);
  gap: 56px;
  align-items: center;
  padding: 58px 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
  box-shadow: 0 18px 46px rgba(31, 26, 20, 0.08);
  overflow: hidden;
}

.auth-layout::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 46%;
  height: 5px;
  background: var(--front);
  content: "";
}

.auth-layout::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 54%;
  height: 5px;
  background: #efc84b;
  content: "";
}

.auth-heading {
  max-width: 590px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-heading h2,
.page-heading h2,
.map-intro h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.auth-heading h2 {
  max-width: 560px;
  font-size: 44px;
  line-height: 1.12;
}

.auth-heading > p:last-child,
.page-heading > p:last-child,
.map-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.auth-route-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 500px;
  margin-top: 34px;
  gap: 10px;
}

.auth-route-preview div {
  padding: 11px 12px;
  border: 1px solid #cbdcf1;
  border-radius: 7px;
  background: var(--front-soft);
}

.auth-route-preview div:nth-child(2) {
  border-color: #efc1ba;
  background: var(--production-soft);
}

.auth-route-preview div:nth-child(3) {
  border-color: #e4c782;
  background: var(--management-soft);
}

.auth-route-preview small,
.auth-route-preview strong {
  display: block;
}

.auth-route-preview small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.auth-route-preview strong {
  margin-top: 5px;
  color: var(--front);
  font-size: 15px;
  font-weight: 900;
}

.auth-route-preview div:nth-child(2) strong { color: var(--production); }
.auth-route-preview div:nth-child(3) strong { color: var(--management); }

.login-card {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(31, 26, 20, 0.08);
}

.login-card-head {
  display: flex;
  align-items: center;
  gap: 13px;
}

.login-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  overflow: hidden;
}

.login-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-icon b { font-size: 11px; }

.login-card h3 {
  margin: 0;
  font-size: 24px;
}

.login-explanation {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.demo-preview {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  align-items: center;
  gap: 7px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.demo-preview > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.demo-preview .secondary-button {
  min-height: 36px;
  padding: 6px 8px;
  font-size: 11px;
}

label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid #d7cfbf;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input {
  min-height: 44px;
  padding: 9px 11px;
}

textarea {
  min-height: 94px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(35, 104, 178, 0.2);
  outline-offset: 2px;
}

.primary-button,
.owner-button,
.secondary-button,
.icon-text-button,
.detail-link,
.close-detail,
.edit-button,
.upload-button {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 900;
}

.primary-button {
  border: 1px solid var(--front);
  background: var(--front);
  color: #fff;
}

.owner-button {
  border: 1px solid var(--management);
  background: var(--management);
  color: #fff;
}

.secondary-button,
.icon-text-button,
.detail-link,
.close-detail,
.edit-button,
.upload-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.auth-note {
  margin: -4px 0 0;
  color: var(--muted);
  text-align: left;
  font-size: 12px;
}

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

.mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 900;
}

.mode-badge.owner {
  background: var(--management-soft);
  color: var(--management);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.main-nav button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.main-nav button.active {
  background: var(--ink);
  color: #fff;
}

.portal-page { display: none; }
.portal-page.active { display: block; }

.map-intro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 18px;
  margin-bottom: 14px;
}

.map-intro p { margin: 0; }

.t0-module {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid #a9d7bf;
  border-radius: var(--radius);
  background: var(--success-soft);
}

.t0-code {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  color: var(--success);
  font-size: 18px;
  font-weight: 900;
}

.t0-copy h3,
.t0-copy p { margin: 0; }

.t0-copy h3 { font-size: 18px; }

.t0-copy > p:last-child {
  margin-top: 4px;
  color: #3c6656;
  font-size: 13px;
  line-height: 1.45;
}

.dual-track-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 20px;
}

.track-column,
.management-track {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.track-column {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.front-track {
  border-color: #ccdcf0;
  border-top: 4px solid var(--front);
  background: #fbfdff;
}

.production-track {
  border-color: #efd2cc;
  border-top: 4px solid var(--production);
  background: #fffaf9;
}

.track-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.track-heading > span {
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--front-soft);
  color: var(--front);
  font-size: 10px;
  font-weight: 900;
}

.production-track .track-heading > span {
  background: var(--production-soft);
  color: var(--production);
}

.track-heading.management > span {
  background: var(--management-soft);
  color: var(--management);
}

.track-heading h3 {
  margin: 0;
  font-size: 18px;
}

.track-nodes {
  display: grid;
  gap: 30px;
}

.track-node {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 22px;
  width: 100%;
  min-height: 74px;
  padding: 11px 12px;
  border: 1px solid #b9d4ef;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  align-items: center;
  gap: 10px;
  text-align: left;
  box-shadow: 0 4px 14px rgba(35, 104, 178, 0.055);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.production-track .track-node {
  border-color: #efc1ba;
  box-shadow: 0 4px 14px rgba(194, 76, 61, 0.05);
}

.management-nodes .track-node {
  border-color: #e4c782;
  box-shadow: 0 4px 14px rgba(152, 99, 13, 0.055);
}

.track-node:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: -29px;
  width: 2px;
  height: 25px;
  background: currentColor;
  color: var(--front);
  content: "";
}

.track-node:not(:last-child)::before {
  position: absolute;
  z-index: 1;
  left: calc(50% - 5px);
  bottom: -31px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--front);
  border-bottom: 2px solid var(--front);
  content: "";
  transform: rotate(45deg);
}

.production-track .track-node:not(:last-child)::after { color: var(--production); }
.production-track .track-node:not(:last-child)::before {
  border-right-color: var(--production);
  border-bottom-color: var(--production);
}

.management-nodes .track-node:not(:last-child)::after { color: var(--management); }
.management-nodes .track-node:not(:last-child)::before {
  border-right-color: var(--management);
  border-bottom-color: var(--management);
}

.node-code {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 6px;
  background: var(--front-soft);
  color: var(--front);
  font-size: 15px;
  font-weight: 900;
}

.production-track .node-code {
  background: var(--production-soft);
  color: var(--production);
}

.management-nodes .node-code {
  background: var(--management-soft);
  color: var(--management);
}

.node-copy { min-width: 0; }

.node-copy strong,
.node-copy small { display: block; }

.node-copy strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.node-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.node-pay {
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--front-soft);
  color: var(--front);
  font-size: 14px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.production-track .node-pay { background: var(--production-soft); color: var(--production); }
.management-nodes .node-pay { background: var(--management-soft); color: var(--management); }

.node-arrow {
  color: var(--muted);
  font-size: 23px;
  text-align: center;
}

.track-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(31, 26, 20, 0.1);
}

.track-node.selected {
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(35, 104, 178, 0.11);
}

.production-track .track-node.selected { box-shadow: 0 0 0 3px rgba(194, 76, 61, 0.11); }
.management-nodes .track-node.selected { box-shadow: 0 0 0 3px rgba(152, 99, 13, 0.12); }

.node-selected {
  position: absolute;
  top: -9px;
  right: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}

.mobile-next {
  display: none;
  grid-column: 1 / -1;
  padding-top: 5px;
  color: var(--management);
  font-size: 11px;
  font-weight: 900;
}

.route-tail {
  display: flex;
  min-height: 74px;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.route-tail span {
  width: 2px;
  min-height: 34px;
  flex: 1;
  margin-top: 7px;
  background: var(--front);
}

.production-track .route-tail span { background: var(--production); }

.route-tail strong {
  padding: 5px 9px;
  border: 1px solid #e7d09c;
  border-radius: 5px;
  background: var(--management-soft);
  color: var(--management);
  font-size: 10px;
  font-weight: 900;
}

.merge-diagram {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  max-width: 820px;
  margin: 12px auto 0;
  align-items: center;
  gap: 8px;
  color: var(--management);
}

.merge-source,
.merge-diagram strong {
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--management-soft);
  font-size: 11px;
  font-weight: 900;
}

.merge-arm {
  height: 14px;
  border-bottom: 2px solid var(--management);
}

.merge-arm.left { transform: skewY(5deg); }
.merge-arm.right { transform: skewY(-5deg); }

.management-track {
  max-width: 680px;
  margin: 12px auto 0;
  border-color: #ead8ae;
  border-top: 4px solid var(--management);
  background: #fffdf8;
}

.management-track .track-heading { justify-content: center; }

.management-nodes {
  max-width: 560px;
  margin: 0 auto;
}

.placement-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--success);
  background: var(--success-soft);
  color: #315f4e;
  font-size: 13px;
  line-height: 1.55;
}

.role-detail-panel,
.standard-detail {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  scroll-margin-top: 14px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.detail-code {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: #f0f1f3;
  font-weight: 900;
}

.detail-title h3,
.detail-title p { margin: 0; }

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

.detail-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.detail-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.detail-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.detail-section.wide { grid-column: 1 / -1; }

.detail-section.mastery {
  border-color: #c9dced;
  background: #f8fbff;
}

.detail-section.authority {
  border-color: #ecc9c2;
  background: #fff8f6;
}

.detail-section.authority h4 { color: #a83f31; }

.detail-section h4 {
  margin: 0 0 6px;
  font-size: 13px;
}

.detail-section p,
.detail-section li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.detail-section p { margin: 0; }

.detail-section ul {
  margin: 0;
  padding-left: 18px;
}

.learning-files {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

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

.learning-files h4 { margin: 0; }

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

.file-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.file-row strong,
.file-row small { display: block; }

.file-row strong { font-size: 13px; }

.file-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.empty-file {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.owner-upload {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed #d0b776;
  border-radius: 6px;
  background: var(--management-soft);
}

.owner-upload input {
  min-height: 40px;
  padding: 6px;
  background: #fff;
}

.page-heading {
  max-width: 760px;
  margin-bottom: 18px;
}

.standard-groups {
  display: grid;
  gap: 10px;
}

.standard-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.standard-group > summary {
  display: flex;
  min-height: 54px;
  padding: 13px 15px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.standard-group > summary::-webkit-details-marker { display: none; }

.standard-group > summary span {
  color: var(--muted);
  font-size: 12px;
}

.standard-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 12px 12px;
}

.standard-card {
  display: grid;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  gap: 8px;
}

.standard-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.standard-card-code {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 5px;
  background: #f0f3f7;
  color: var(--front);
  font-size: 12px;
  font-weight: 900;
}

.standard-card h4,
.standard-card p { margin: 0; }

.standard-card h4 { font-size: 15px; }

.standard-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.48;
}

.standard-card .standard-pass {
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.standard-card button { width: 100%; }

.cert-flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.cert-step {
  position: relative;
  min-width: 0;
  padding: 13px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  text-align: center;
}

.cert-step:not(:last-child)::after {
  position: absolute;
  top: 50%;
  right: -17px;
  color: var(--muted);
  content: "→";
  transform: translateY(-50%);
}

.cert-step span {
  display: grid;
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
  place-items: center;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.cert-step strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.cert-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.cert-rule {
  padding: 12px 14px;
  border-left: 4px solid var(--front);
  background: var(--front-soft);
  color: #34506d;
  font-size: 13px;
  line-height: 1.5;
}

.cert-rule.important {
  border-left-color: var(--production);
  background: var(--production-soft);
  color: #74463f;
  font-weight: 900;
}

.edit-dialog {
  width: min(860px, calc(100vw - 30px));
  max-height: calc(100vh - 30px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
  box-shadow: 0 24px 70px rgba(31, 26, 20, 0.22);
}

.edit-dialog::backdrop { background: rgba(24, 21, 18, 0.46); }

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.dialog-head h2 { margin: 0; }

.close-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 24px;
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

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

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.branding-dialog { width: min(520px, calc(100vw - 30px)); }

.branding-intro {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.branding-preview {
  display: grid;
  width: 112px;
  height: 112px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  overflow: hidden;
}

.branding-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 960px) {
  .auth-layout { gap: 30px; padding: 42px 34px; }
  .auth-heading h2 { font-size: 36px; }
  .map-intro { grid-template-columns: 1fr; gap: 4px; }
  .standard-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cert-flow { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cert-step:nth-child(4)::after { display: none; }
}

@media (max-width: 720px) {
  .header-inner {
    min-height: 68px;
    padding: 11px 12px;
    align-items: flex-start;
  }

  .brand-mark { width: 40px; height: 40px; font-size: 12px; }
  .brand-lockup h1 { font-size: 17px; }
  .brand-lockup p { display: none; }
  .language-switch button { min-width: 54px; min-height: 32px; font-size: 12px; }
  .page-shell { padding: 18px 12px 38px; }
  .auth-view { min-height: calc(100vh - 124px); }
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 34px 22px 24px;
  }
  .auth-heading { max-width: none; }
  .auth-heading h2,
  .page-heading h2,
  .map-intro h2 { font-size: 23px; }
  .auth-heading > p:last-child { font-size: 14px; }
  .auth-route-preview { margin-top: 22px; }
  .login-card { padding: 20px; }
  .demo-preview { grid-template-columns: 1fr 1fr; }
  .demo-preview > span { grid-column: 1 / -1; }
  .portal-toolbar { align-items: flex-start; }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .main-nav { position: sticky; z-index: 5; top: 0; }
  .main-nav button { min-height: 42px; padding: 6px; font-size: 12px; }

  .t0-module {
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 13px;
  }

  .t0-code { width: 46px; height: 46px; }
  .t0-module .detail-link { grid-column: 1 / -1; width: 100%; }

  .dual-track-map { grid-template-columns: 1fr; gap: 14px; }
  .track-column,
  .management-track { padding: 13px; }
  .track-node { grid-template-columns: 43px minmax(0, 1fr) auto 18px; min-height: 65px; }
  .node-code { width: 41px; height: 41px; font-size: 13px; }
  .node-copy strong { font-size: 14px; }
  .node-pay { font-size: 13px; }
  .mobile-next { display: block; }
  .route-tail { display: none; }
  .merge-diagram { display: none; }
  .management-track { margin-top: 14px; }

  .detail-head { display: grid; }
  .detail-actions { justify-content: flex-start; }
  .detail-sections { grid-template-columns: 1fr; }
  .detail-section.wide { grid-column: auto; }
  .owner-upload { grid-template-columns: 1fr; }
  .standard-cards { grid-template-columns: 1fr; }
  .cert-flow { grid-template-columns: 1fr; gap: 24px; }
  .cert-step:not(:last-child)::after {
    top: auto;
    right: auto;
    bottom: -22px;
    left: 50%;
    content: "↓";
    transform: translateX(-50%);
  }
  .cert-step:nth-child(4)::after { display: block; }
  .cert-rules { grid-template-columns: 1fr; }
  .edit-dialog { padding: 15px; }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-grid .wide { grid-column: auto; }
}

@media (max-width: 430px) {
  .auth-route-preview { gap: 6px; }
  .auth-route-preview div { padding: 8px; }
  .auth-route-preview small { font-size: 9px; }
  .auth-route-preview strong { font-size: 12px; }
  .track-node { grid-template-columns: 41px minmax(0, 1fr) 18px; }
  .node-pay { grid-column: 2; justify-self: start; text-align: left; }
  .node-arrow { grid-column: 3; grid-row: 1 / span 2; }
  .portal-toolbar { display: flex; align-items: center; }
  .toolbar-actions { margin-left: auto; justify-content: flex-end; }
}

/* V1 visual refinement: cleaner hierarchy, clearer routes, quieter detail reading. */
:root {
  --ink: #161a1f;
  --muted: #647083;
  --line: #dde3e9;
  --paper: #ffffff;
  --page: #f3f5f7;
  --front: #285fa8;
  --front-soft: #edf4fd;
  --production: #b34d3d;
  --production-soft: #fcf0ed;
  --management: #916515;
  --management-soft: #fbf5e7;
  --success: #317058;
  --success-soft: #edf7f1;
  --shadow: 0 16px 38px rgba(28, 35, 43, 0.08);
}

body { background: var(--page); }

.site-header {
  border-bottom-color: #e1e5ea;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 3px 14px rgba(28, 35, 43, 0.035);
}

.header-inner,
.page-shell { max-width: 1220px; }

.brand-mark {
  border-radius: 6px;
  box-shadow: 0 5px 14px rgba(34, 92, 169, 0.18);
}

.language-switch {
  border-color: #d7dde4;
  box-shadow: 0 2px 8px rgba(28, 35, 43, 0.04);
}

.language-switch button { transition: background 140ms ease, color 140ms ease; }

.auth-view { max-width: 1120px; }

.auth-layout {
  grid-template-columns: minmax(0, 1.12fr) minmax(350px, 0.78fr);
  gap: 52px;
  padding: 54px 58px;
  border-color: #dce2e8;
  background: #fff;
  box-shadow: 0 22px 56px rgba(28, 35, 43, 0.09);
}

.auth-layout::before,
.auth-layout::after { height: 4px; }

.auth-heading {
  max-width: 610px;
  padding-left: 23px;
  border-left: 4px solid var(--front);
}

.auth-heading h2 {
  max-width: 540px;
  font-size: 40px;
  line-height: 1.14;
}

.auth-heading > p:last-child {
  max-width: 560px;
  margin-top: 14px;
  color: #4f5d70;
}

.auth-route-preview {
  max-width: 540px;
  margin-top: 30px;
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.auth-route-preview div,
.auth-route-preview div:nth-child(2),
.auth-route-preview div:nth-child(3) {
  min-width: 0;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.auth-route-preview div:first-child { padding-left: 0; }
.auth-route-preview div:last-child { border-right: 0; }

.auth-route-preview small {
  color: #778294;
  font-size: 9px;
  letter-spacing: 0;
}

.auth-route-preview strong {
  margin-top: 4px;
  font-size: 14px;
  white-space: nowrap;
}

.login-card {
  gap: 17px;
  padding: 30px;
  border-color: #d7dde4;
  border-top: 4px solid var(--ink);
  box-shadow: 0 18px 40px rgba(28, 35, 43, 0.11);
}

.login-icon {
  width: 58px;
  height: 58px;
  border: 3px solid #f1ca4f;
  border-radius: 50%;
  background: #1b2027;
  box-shadow: 0 4px 12px rgba(28, 35, 43, 0.14);
}

.login-card h3 { font-size: 25px; }

.login-explanation {
  padding-bottom: 2px;
  color: #566376;
}

input,
textarea {
  border-color: #cfd6de;
  background: #fafbfc;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--front);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(40, 95, 168, 0.09);
}

.primary-button,
.owner-button,
.secondary-button,
.icon-text-button,
.detail-link,
.close-detail,
.edit-button,
.upload-button {
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

.primary-button:hover,
.owner-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(28, 35, 43, 0.16);
}

.secondary-button:hover,
.icon-text-button:hover,
.detail-link:hover,
.close-detail:hover,
.edit-button:hover,
.upload-button:hover {
  border-color: #aeb8c4;
  background: #f7f9fb;
}

.portal-toolbar { margin-bottom: 14px; }

.mode-badge {
  min-height: 30px;
  border: 1px solid #cfe5d9;
  background: #f3faf6;
}

.mode-badge.owner {
  border-color: #eadcb7;
  background: #fffaf0;
}

.main-nav {
  position: sticky;
  z-index: 8;
  top: 8px;
  margin-bottom: 26px;
  border-color: #d8dee5;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(28, 35, 43, 0.07);
}

.main-nav button { transition: background 140ms ease, color 140ms ease; }

.map-intro {
  align-items: center;
  margin-bottom: 18px;
}

.map-intro h2 { font-size: 30px; }

.t0-module {
  padding: 17px 18px;
  border: 0;
  border-left: 4px solid var(--success);
  background: #f3faf6;
  box-shadow: 0 8px 22px rgba(28, 35, 43, 0.055);
}

.t0-code {
  border: 1px solid #cde3d7;
  box-shadow: 0 4px 12px rgba(49, 112, 88, 0.08);
}

.dual-track-map { gap: 24px; }

.track-column,
.management-track {
  padding: 20px;
  border-color: #dce2e8;
  background: #fff;
  box-shadow: 0 10px 28px rgba(28, 35, 43, 0.055);
}

.front-track,
.production-track,
.management-track { border-top-width: 3px; }

.front-track { background: #fff; }
.production-track { background: #fff; }
.management-track { background: #fff; }

.track-heading {
  margin-bottom: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.track-heading > span { padding: 5px 8px; }
.track-heading h3 { font-size: 19px; }

.track-nodes { gap: 26px; }

.track-node {
  grid-template-columns: 50px minmax(0, 1fr) auto 20px;
  min-height: 78px;
  padding: 12px 13px;
  border-color: #cfdeef;
  border-left: 3px solid var(--front);
  box-shadow: 0 3px 10px rgba(40, 95, 168, 0.045);
}

.production-track .track-node {
  border-color: #ead4cf;
  border-left-color: var(--production);
  box-shadow: 0 3px 10px rgba(179, 77, 61, 0.045);
}

.management-nodes .track-node {
  border-color: #e6dcc0;
  border-left-color: var(--management);
  box-shadow: 0 3px 10px rgba(145, 101, 21, 0.045);
}

.track-node:not(:last-child)::after {
  left: 34px;
  bottom: -25px;
  height: 22px;
}

.track-node:not(:last-child)::before {
  left: 30px;
  bottom: -27px;
}

.node-code {
  width: 48px;
  height: 48px;
  border: 1px solid #d3e2f4;
  background: #f4f8fd;
}

.production-track .node-code {
  border-color: #efd8d3;
  background: #fdf5f3;
}

.management-nodes .node-code {
  border-color: #eadfc4;
  background: #fdf9ef;
}

.node-copy strong { font-size: 16px; }

.node-pay {
  border: 1px solid #d5e4f5;
  background: #f5f9fe;
}

.production-track .node-pay {
  border-color: #efd8d3;
  background: #fdf5f3;
}

.management-nodes .node-pay {
  border-color: #eadfc4;
  background: #fdf9ef;
}

.track-node:hover {
  transform: translateX(3px);
  border-color: #9ebcdd;
  box-shadow: 0 10px 22px rgba(28, 35, 43, 0.09);
}

.track-node.selected {
  border-width: 1px 1px 1px 4px;
  box-shadow: 0 0 0 3px rgba(40, 95, 168, 0.1), 0 10px 24px rgba(28, 35, 43, 0.08);
}

.route-tail strong,
.merge-source,
.merge-diagram strong {
  border: 1px solid #e6d8b6;
  background: #fffaf0;
}

.management-track { margin-top: 16px; }

.placement-note {
  border-radius: 6px;
  background: #f3faf6;
}

.role-detail-panel,
.standard-detail {
  padding: 24px;
  border-color: #d8dee5;
  border-top-width: 3px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(28, 35, 43, 0.09);
}

.detail-code {
  width: 54px;
  height: 54px;
  border: 1px solid #d9e0e7;
  background: #f4f6f8;
  font-size: 15px;
}

.detail-title h3 { font-size: 24px; }

.detail-sections {
  gap: 0 26px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.detail-section {
  padding: 16px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.detail-section.mastery,
.detail-section.authority {
  align-self: start;
  margin: 12px 0;
  padding: 14px 15px;
  border: 0;
  border-left: 3px solid var(--front);
  border-radius: 5px;
  background: #f5f9fe;
}

.detail-section.authority {
  border-left-color: var(--production);
  background: #fdf5f3;
}

.detail-section h4 {
  margin-bottom: 8px;
  color: #303a47;
  font-size: 13px;
}

.detail-section p,
.detail-section li {
  color: #566376;
  line-height: 1.65;
}

.learning-files {
  margin-top: 20px;
  padding-top: 18px;
}

.standard-group {
  border-color: #dbe1e7;
  background: #fff;
  box-shadow: 0 7px 20px rgba(28, 35, 43, 0.045);
}

.standard-card {
  border-color: #dce2e8;
  box-shadow: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.standard-card:hover {
  transform: translateY(-2px);
  border-color: #b8c3cf;
  box-shadow: 0 10px 22px rgba(28, 35, 43, 0.07);
}

.cert-step {
  border-color: #d8dee5;
  background: #fff;
  box-shadow: 0 6px 18px rgba(28, 35, 43, 0.045);
}

.cert-step span { box-shadow: 0 4px 10px rgba(40, 95, 168, 0.14); }

.cert-rule {
  border-color: #dce2e8;
  background: #fff;
}

.edit-dialog {
  border-color: #d6dde4;
  box-shadow: 0 28px 70px rgba(28, 35, 43, 0.2);
}

.branding-preview {
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(28, 35, 43, 0.12);
}

@media (max-width: 960px) {
  .auth-layout { gap: 34px; padding: 44px 36px; }
  .auth-heading h2 { font-size: 35px; }
}

@media (max-width: 720px) {
  .page-shell { padding-top: 16px; }
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 28px 20px 22px;
  }
  .auth-heading {
    max-width: none;
    padding: 0;
    border-top: 0;
    border-left: 0;
  }
  .auth-heading h2 { font-size: 27px; }
  .auth-route-preview { margin-top: 20px; }
  .auth-route-preview div { padding: 10px; }
  .auth-route-preview div:first-child { padding-left: 0; }
  .login-card { padding: 22px; }
  .login-icon { width: 52px; height: 52px; }
  .main-nav { top: 6px; }
  .track-column,
  .management-track { padding: 15px; }
  .track-node { grid-template-columns: 46px minmax(0, 1fr) auto 18px; }
  .track-node:not(:last-child)::after { left: 31px; }
  .track-node:not(:last-child)::before { left: 27px; }
  .detail-sections { gap: 0; }
  .detail-section.mastery,
  .detail-section.authority { margin: 10px 0; }
}

@media (max-width: 430px) {
  .auth-route-preview strong { font-size: 11px; }
  .auth-route-preview small { font-size: 8px; }
  .track-node { grid-template-columns: 43px minmax(0, 1fr) 18px; }
  .node-code { width: 41px; height: 41px; }
  .track-node:not(:last-child)::after { left: 28px; }
  .track-node:not(:last-child)::before { left: 24px; }
}
