:root {
  color-scheme: dark;
  --bg: #111715;
  --panel: #171f1c;
  --panel-2: #1d2824;
  --line: #34403b;
  --ink: #edf1ec;
  --muted: #98a49f;
  --paper: #f0eee5;
  --paper-ink: #18211e;
  --acid: #c8f36b;
  --amber: #e7a84d;
  --red: #e67a6d;
  --green: #65c58a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 50; transform: translateY(-160%); padding: 10px 14px; border-radius: 8px; background: var(--acid); color: var(--paper-ink); }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid #71a7ff; outline-offset: 3px; }

.dojo-header { min-height: 76px; position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 25px; padding: 12px clamp(20px, 4vw, 64px); border-bottom: 1px solid rgba(52,64,59,.9); background: rgba(17,23,21,.9); backdrop-filter: blur(15px); }
.dojo-brand { width: max-content; display: flex; align-items: center; gap: 11px; text-decoration: none; }
.dojo-brand > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--acid); color: var(--paper-ink); font-weight: 900; }
.dojo-brand strong, .dojo-brand small { display: block; line-height: 1.1; }
.dojo-brand small { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.header-status { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 11px; }
.header-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.header-status.ready i { background: var(--green); }
.dojo-header nav { justify-self: end; display: flex; gap: 24px; }
.dojo-header nav a { color: #b8c1bd; text-decoration: none; font-size: 12px; font-weight: 700; }

.dojo-hero { min-height: 500px; display: grid; grid-template-columns: 1fr .9fr; align-items: center; gap: 70px; padding: 80px clamp(24px, 6vw, 96px); }
.eyebrow { margin: 0 0 17px; color: var(--acid); font-size: 10px; letter-spacing: .15em; font-weight: 850; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 25px; font-size: clamp(48px, 6.3vw, 92px); line-height: .93; letter-spacing: -.066em; }
h1 em { color: var(--acid); font-style: normal; }
.dojo-hero > div > p:last-child { max-width: 720px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.loop-map { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.loop-map > div { min-height: 135px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.loop-map > div span, .loop-map > div b, .loop-map > div small { display: block; }
.loop-map > div span { color: var(--acid); font: 10px/1.4 ui-monospace, monospace; }
.loop-map > div b { margin-top: 35px; font-size: 15px; }
.loop-map > div small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.loop-map > i { color: #66736d; font-style: normal; }

.metric-strip { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-strip article { min-height: 130px; display: flex; flex-direction: column; justify-content: center; padding: 20px clamp(17px, 2.2vw, 34px); border-right: 1px solid var(--line); background: var(--panel); }
.metric-strip article:last-child { border: 0; }
.metric-strip article.accent { background: var(--acid); color: var(--paper-ink); }
.metric-strip span, .metric-strip small { color: var(--muted); font-size: 10px; }
.metric-strip .accent span, .metric-strip .accent small { color: #52623e; }
.metric-strip strong { margin: 9px 0 3px; font-size: 34px; line-height: 1; letter-spacing: -.04em; }

.workspace { display: grid; grid-template-columns: 270px minmax(0, 1fr) 310px; align-items: start; min-height: 900px; }
.agent-rail, .passport-panel { position: sticky; top: 76px; height: calc(100vh - 76px); overflow: auto; }
.agent-rail { border-right: 1px solid var(--line); background: #121917; }
.rail-head { padding: 28px 20px 14px; }
.rail-head h2, .passport-head h2 { margin-bottom: 0; font-size: 22px; letter-spacing: -.035em; }
.agent-search { min-height: 42px; display: flex; align-items: center; gap: 8px; margin: 0 14px 12px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--muted); }
.agent-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.agent-list { border-top: 1px solid var(--line); }
.agent-option { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px 16px; border: 0; border-bottom: 1px solid #27312d; background: transparent; color: var(--ink); text-align: left; }
.agent-option:hover, .agent-option.selected { background: var(--panel-2); }
.agent-option.selected { box-shadow: inset 3px 0 var(--acid); }
.agent-option strong, .agent-option small { display: block; }
.agent-option strong { font-size: 12px; line-height: 1.35; }
.agent-option small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.agent-option > span { align-self: center; min-width: 30px; padding: 4px 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font: 9px/1.2 ui-monospace, monospace; text-align: center; }
.agent-option > span.passed { border-color: #4e8062; color: var(--green); }
.loading { color: var(--muted); font-size: 12px; }

.training-floor { min-width: 0; padding: 45px clamp(24px, 4vw, 60px) 100px; background: var(--paper); color: var(--paper-ink); }
.training-floor .eyebrow { color: #397255; }
.selected-agent { min-height: 175px; display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: start; border-bottom: 1px solid #cfd2c9; }
.selected-agent h2 { margin-bottom: 10px; font-size: clamp(35px, 4vw, 56px); line-height: 1; letter-spacing: -.055em; }
.selected-agent > div > p:last-child { max-width: 720px; color: #67716c; }
.version-badge { min-width: 100px; padding: 14px; border: 1px solid #ccd0c6; border-radius: 10px; text-align: center; }
.version-badge span, .version-badge strong { display: block; }
.version-badge span { color: #6e7773; font-size: 8px; letter-spacing: .1em; }
.version-badge strong { margin-top: 7px; font-size: 22px; }
.curriculum-panel, .evaluation-panel, .score-panel, .history-panel { padding: 34px 0; border-bottom: 1px solid #cfd2c9; }
.panel-heading, .score-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 25px; }
.panel-heading h3, .score-hero h3 { margin-bottom: 0; font-size: 24px; letter-spacing: -.035em; }
.panel-heading > span { color: #7c8580; font: 11px/1.4 ui-monospace, monospace; }
.drill-list { display: grid; gap: 10px; margin-top: 24px; }
.drill-card { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: start; padding: 18px; border: 1px solid #cfd2c9; border-radius: 12px; background: rgba(255,255,255,.35); cursor: pointer; }
.drill-card:hover, .drill-card.selected { border-color: #47755d; background: #f8f7f1; }
.drill-card input { margin-top: 4px; accent-color: #2f684b; }
.drill-card strong, .drill-card small { display: block; }
.drill-card strong { font-size: 14px; }
.drill-card small { margin-top: 6px; color: #6b746f; font-size: 11px; line-height: 1.55; }
.drill-card > span { padding: 5px 7px; border-radius: 5px; background: #dfe8dc; color: #397255; font-size: 8px; letter-spacing: .08em; font-weight: 800; }
.private-badge { color: #397255 !important; }
.evaluation-panel form { margin-top: 22px; }
.evaluation-panel label, .promotion-box label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 750; }
.evaluation-panel label small { margin-left: 5px; color: #7c8580; font-weight: 400; }
textarea, input { border: 1px solid #c5c9bf; border-radius: 9px; outline: 0; background: #faf9f4; color: var(--paper-ink); }
.evaluation-panel textarea { width: 100%; padding: 15px; resize: vertical; line-height: 1.6; }
textarea:focus, input:focus { border-color: #397255; box-shadow: 0 0 0 3px rgba(57,114,85,.1); }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 14px; }
.form-foot p { margin: 0; color: #707a75; font-size: 11px; }
.button { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; border: 1px solid transparent; border-radius: 99px; font-weight: 780; font-size: 12px; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--paper-ink); color: white; }
.score-panel { padding: 30px; margin: 34px 0; border: 1px solid #bec5ba; border-radius: 16px; background: #f8f7f1; }
.score-panel.pass { border-color: #86ad91; }
.score-panel.fail { border-color: #d5a09a; }
.score-hero > div > span { color: #747d78; font-size: 10px; }
.score-ring { width: 100px; height: 100px; display: grid; place-content: center; border: 8px solid #dfe3da; border-radius: 50%; text-align: center; }
.score-panel.pass .score-ring { border-color: #72b487; }
.score-panel.fail .score-ring { border-color: #d48379; }
.score-ring strong { display: block; font-size: 32px; line-height: .9; }
.score-ring span { color: #78817c; font-size: 9px; }
.criteria-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 25px; }
.criterion { padding: 13px; border: 1px solid #d5d8d0; border-radius: 9px; }
.criterion div { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.criterion progress { width: 100%; height: 5px; margin-top: 10px; accent-color: #397255; }
.feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 25px; }
.feedback-grid h4 { margin-bottom: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.feedback-grid ul { margin: 0; padding-left: 17px; color: #626d67; font-size: 11px; line-height: 1.65; }
.table-wrap { margin-top: 20px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 13px 10px; border-bottom: 1px solid #d8dad3; text-align: left; }
th { color: #727c77; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.result-pass { color: #397255; font-weight: 800; }
.result-fail { color: #9e443b; font-weight: 800; }

.passport-panel { padding: 28px 20px 60px; border-left: 1px solid var(--line); background: #121917; }
.passport-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.passport-head > span { display: inline-block; margin-top: 12px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 8px; letter-spacing: .1em; }
.passport-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 20px 0; border-bottom: 1px solid var(--line); }
.passport-stats div { border-right: 1px solid var(--line); text-align: center; }
.passport-stats div:last-child { border: 0; }
.passport-stats span, .passport-stats strong { display: block; }
.passport-stats span { color: var(--muted); font-size: 9px; }
.passport-stats strong { margin-top: 5px; font-size: 20px; }
.competency-section, .gate-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.competency-section h3, .gate-section h3 { font-size: 12px; }
.competency { margin-top: 14px; }
.competency div { display: flex; justify-content: space-between; gap: 10px; color: #c0c8c4; font-size: 10px; }
.competency progress { width: 100%; height: 4px; accent-color: var(--acid); }
.gate-section ul { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 11px; }
.gate-section li { padding: 7px 0; }
.gate-section li::before { content: "○"; margin-right: 8px; color: #65716b; }
.gate-section li.met::before { content: "●"; color: var(--green); }
.promotion-box { margin-top: 24px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.promotion-box > span { color: var(--amber); font-size: 9px; letter-spacing: .11em; font-weight: 850; }
.promotion-box.ready > span { color: var(--green); }
.promotion-box p { margin: 9px 0 16px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.promotion-box label { margin-top: 10px; color: #bbc4c0; font-size: 10px; }
.promotion-box input, .promotion-box textarea { width: 100%; padding: 9px; border-color: var(--line); background: #101614; color: var(--ink); font-size: 11px; resize: vertical; }
.button.promote { width: 100%; margin-top: 14px; background: var(--acid); color: var(--paper-ink); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 380px; transform: translateY(90px); opacity: 0; padding: 12px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); box-shadow: 0 18px 60px rgba(0,0,0,.35); font-size: 12px; transition: .2s ease; }
.toast.show { transform: none; opacity: 1; }
.toast.error { border-color: var(--red); color: #ffc4bd; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 235px 1fr; }
  .passport-panel { position: static; width: auto; height: auto; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; border-left: 0; border-top: 1px solid var(--line); }
  .promotion-box { margin-top: 0; }
}

@media (max-width: 800px) {
  .dojo-header { grid-template-columns: 1fr auto; padding: 10px 16px; }
  .dojo-header nav { display: none; }
  .dojo-hero { grid-template-columns: 1fr; padding: 65px 20px; }
  .loop-map { grid-template-columns: 1fr 1fr; }
  .loop-map > i { display: none; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip article { border-bottom: 1px solid var(--line); }
  .metric-strip article:nth-child(even) { border-right: 0; }
  .metric-strip article:last-child { grid-column: 1 / -1; }
  .workspace { display: block; }
  .agent-rail { position: static; height: auto; max-height: 430px; border-right: 0; border-bottom: 1px solid var(--line); }
  .training-floor { padding: 38px 20px 70px; }
  .passport-panel { display: block; }
  .selected-agent { grid-template-columns: 1fr; padding-bottom: 30px; }
  .version-badge { width: 110px; }
  .criteria-grid, .feedback-grid { grid-template-columns: 1fr; }
  .form-foot { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
