/* Palette mirrors the Eureka web LIGHT theme (theme.ts tokensFor('light')): white surfaces on a zinc-50 canvas, zinc greys,
   Deere green/yellow accents. Graph/flow viewports stay dark (--viz) on purpose: they draw light text and glowing edges. */
:root {
  --bg: #fafafa;         /* canvas, zinc 50 */
  --appbar: #ffffff;
  --panel: #ffffff;      /* surface */
  --panel-2: #f4f4f5;    /* zinc 100: hover / raised */
  --border: #e4e4e7;     /* zinc 200 */
  --border-strong: #d4d4d8;
  --text: #18181b;       /* zinc 900 */
  --muted: #52525b;      /* zinc 600 */
  --faint: #71717a;      /* zinc 500 */
  --green: #367c2b;      /* Deere green */
  --green-dark: #2a6322;
  --green-light: #5fa854;
  --yellow: #ffde00;     /* Deere yellow */
  --yellow-text: #8a6d00;/* yellow is unreadable as text on white; use this for "highlight" text */
  --blue: #2563eb;
  --purple: #7c3aed;
  --red: #dc2626;
  --viz: #0b0f14;        /* dark viewport for graphs, flows, timelines */
  --viz-2: #151c25;
  --code-bg: #f4f4f5;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --appbar-h: 56px;
  --drawer-w: 264px;
  --ok: #15803d;
  --warn-text: #8a6d00;
  --note-bg: #fffbe6;    /* blockquotes / callouts */
  --pass-bg: #f0fdf4;
  --fail-bg: #fef2f2;
  --input-bg: #ffffff;
  color-scheme: light;
}
/* Dark theme: zinc-950 canvas, zinc-900 surfaces. Text-role greens/yellows are lifted so they stay readable. */
:root[data-theme="dark"] {
  --bg: #09090b;
  --appbar: #18181b;
  --panel: #18181b;
  --panel-2: #27272a;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --green-dark: #7cc46e;
  --yellow-text: #f5d90a;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --red: #f87171;
  --viz: #0b0f14;
  --viz-2: #151c25;
  --code-bg: #1f1f23;
  --ok: #4ade80;
  --warn-text: #fbbf24;
  --note-bg: #2a2410;
  --pass-bg: #0f2a1a;
  --fail-bg: #2f1414;
  --input-bg: #1f1f23;
  color-scheme: dark;
}
:root[data-theme="dark"] .appbar { box-shadow: 0 1px 2px rgba(0,0,0,.4); }
:root[data-theme="dark"] .menu { box-shadow: 0 10px 30px rgba(0,0,0,.6); }
:root[data-theme="dark"] .nav-link.active, :root[data-theme="dark"] .nav-item.active { background: rgba(124,196,110,.16); }
:root[data-theme="dark"] .pill.mcp { background: #1e3a8a; color: #bfdbfe; }
:root[data-theme="dark"] .pill.a2a { background: #4c1d95; color: #ddd6fe; }
:root[data-theme="dark"] .pill.inactive { background: #7f1d1d; color: #fecaca; }
:root[data-theme="dark"] .mode.manual { background: #78350f; color: #fde68a; }
:root[data-theme="dark"] .mode.automated { background: #1e3a8a; color: #bfdbfe; }
:root[data-theme="dark"] .mode.verify { background: #14532d; color: #bbf7d0; }
:root[data-theme="dark"] .q.correct { border-color: var(--ok); }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
:root[data-theme="dark"] .theme-moon { display: none; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, Segoe UI, Roboto, sans-serif; }
a { color: var(--blue); }
code, pre { font-family: var(--mono); font-size: 13px; }
pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; }
code:not(pre code) { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
table { border-collapse: collapse; width: 100%; margin: 10px 0; }
th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel-2); }

/* ---------------------------------------------------------------- app bar */
.appbar { position: sticky; top: 0; z-index: 20; height: var(--appbar-h); display: flex; align-items: center; gap: 8px; padding: 0 12px 0 8px; background: var(--appbar); border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.iconbtn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.iconbtn:hover { background: var(--panel-2); color: var(--text); }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px; border-radius: 6px; text-decoration: none; color: inherit; min-width: 0; }
.brand:focus-visible { outline: 2px solid var(--green-light); outline-offset: 2px; }
.brandmark { width: 34px; height: 34px; filter: drop-shadow(0 0 4px rgba(255, 160, 0, .35)); }
.brandtext { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brandname { font-weight: 600; font-size: 16px; }
.brandsub { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status .ok { color: var(--green); } .status .warn { color: #d97706; } .status .bad { color: var(--red); }
.eureka-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 13px; text-decoration: none; white-space: nowrap; }
.btn.small { padding: 6px 10px; font-size: 12px; }

/* user chip + menu (mirrors Eureka's OktaUserChip) */
.userchip { position: relative; }
.chipbtn { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; }
.chipbtn:hover { background: var(--panel-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.avatar.off { background: var(--panel-2); color: var(--muted); }
.menu { position: absolute; right: 0; top: 44px; min-width: 240px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; z-index: 30; }
.menu-head { padding: 8px 10px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--panel-2); }
.menu-item.danger { color: var(--red); }

/* ---------------------------------------------------------------- shell: drawer + content */
.shell { display: grid; grid-template-columns: var(--drawer-w) 1fr; min-height: calc(100vh - var(--appbar-h)); transition: grid-template-columns .2s; }
.shell.nav-closed { grid-template-columns: 0 1fr; }
.shell.nav-closed .drawer { transform: translateX(-100%); visibility: hidden; }
.drawer { position: sticky; top: var(--appbar-h); height: calc(100vh - var(--appbar-h)); display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--border); overflow: hidden; transition: transform .2s; }
.drawer-scroll { flex: 1; overflow: auto; padding: 12px 10px; }
.drawer h3 { margin: 16px 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav-link, .nav-item { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--text); text-decoration: none; font-size: 14px; }
.nav-link:hover, .nav-item:hover { background: var(--panel-2); }
.nav-link.active, .nav-item.active { background: rgba(54,124,43,.10); color: var(--green-dark); font-weight: 600; }
.nav-link .ico { width: 22px; text-align: center; color: var(--muted); }
.nav-link.active .ico { color: var(--green-dark); }
.nav-item .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); font-size: 12px; flex: none; }
.nav-item.done .num { background: var(--yellow); color: #000; }
.nav-item.active .num { background: var(--green); color: #fff; }
.drawer-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.drawer-foot .btn { text-align: center; text-decoration: none; }

/* course sections (one per learning track) */
.course { margin: 2px 0; }
.course-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.course-head:hover { background: var(--panel-2); }
.course.current > .course-head { color: var(--green-dark); }
.course .chev { width: 14px; color: var(--muted); transition: transform .15s; display: inline-block; }
.course.open > .course-head .chev { transform: rotate(90deg); }
.course-title { flex: 1; }
.course-count { font-size: 11px; font-weight: 400; color: var(--muted); }
.course-body { display: none; padding-left: 10px; }
.course.open > .course-body { display: block; }
.course-body .nav-item { font-size: 13px; padding: 7px 10px; }
.course-body .nav-item span:last-child { min-width: 0; overflow-wrap: anywhere; }
.course.sub > .course-head { padding: 6px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.course.sub.current > .course-head { color: var(--green-dark); }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.crumb a { color: var(--muted); text-decoration: none; } .crumb a:hover { color: var(--text); }
.crumb span:last-child { color: var(--text); }

.content { padding: 24px 32px 60px; max-width: 1100px; min-width: 0; }
.credit { margin-top: 28px; text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; }
.credit b { color: var(--green-dark); }

/* ---------------------------------------------------------------- home (the hero is intentionally dark: it is the supernova footage) */
.hero { position: relative; display: flex; align-items: center; padding: 40px 44px; border: 1px solid var(--border-strong); border-radius: 16px; overflow: hidden; background: #050510; color: #f4f4f5; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.hero-full { min-height: calc(100vh - var(--appbar-h) - 48px); border-radius: 18px; }
.nova-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: 68% 50%; background: #050510; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4,4,15,.85) 0%, rgba(4,4,15,.5) 45%, rgba(4,4,15,0) 70%); pointer-events: none; }
.hero-credit { position: absolute; right: 14px; bottom: 10px; font-size: 11px; color: rgba(255,255,255,.55); }
.hero-text { position: relative; z-index: 1; max-width: 560px; text-shadow: 0 1px 14px rgba(0,0,0,.75); }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--yellow); margin-bottom: 14px; }
.hero h1 { margin: 0 0 14px; font-size: 44px; line-height: 1.08; letter-spacing: -.01em; }
.hero h1 b { color: var(--yellow); }
.hero p { margin: 0 0 24px; color: #d4d4d8; font-size: 17px; max-width: 46ch; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .actions .btn { text-decoration: none; padding: 10px 18px; }
.hero .actions .btn.ghost { background: rgba(0,0,0,.35); border-color: rgba(255,255,255,.35); color: #fff; backdrop-filter: blur(4px); }
.hero-meta { margin-top: 26px; font-size: 12px; color: #a1a1aa; letter-spacing: .02em; }
.hero-courses { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.course-chip { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(0,0,0,.35); backdrop-filter: blur(4px); color: #f4f4f5; text-decoration: none; font-size: 13px; }
.course-chip:hover { border-color: var(--yellow); }
.course-chip span { font-size: 11px; color: #a1a1aa; }
#view-home { padding: 0; }
.content:has(#view-home:not([hidden])) { padding: 24px 24px 24px; max-width: none; }
.content:has(#view-home:not([hidden])) .credit { display: none; }

.lesson h1 { margin-top: 0; font-size: 28px; }
.lesson h2 { margin-top: 28px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.lesson blockquote { border-left: 4px solid var(--yellow); margin: 12px 0; padding: 6px 14px; background: var(--note-bg); border-radius: 0 8px 8px 0; }
.lesson .mcp-figure { margin: 18px 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.lesson .mcp-figure svg { display: block; width: 100%; height: auto; max-width: 760px; margin: 0 auto; font-family: inherit; }
.lesson .mcp-figure figcaption { margin-top: 8px; text-align: center; font-size: 13px; color: var(--muted); }

.widget { margin-top: 24px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.widget h2 { margin: 0 0 12px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.widget h2::before { content: "▶"; color: var(--green); font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.btn { background: var(--green); color: #fff; border: 0; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn.warn { background: var(--yellow); color: #000; }
select, input[type=text], input[type=number], textarea { background: var(--input-bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 10px; font-family: inherit; }
textarea { font-family: var(--mono); width: 100%; min-height: 120px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }
.field { display: flex; flex-direction: column; gap: 2px; }
.row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) {
  .row { grid-template-columns: 1fr; }
  .hero { padding: 28px 22px; } .hero h1 { font-size: 30px; } .hero-full { min-height: calc(100vh - var(--appbar-h) - 32px); }
  .brandsub, .status, .eureka-link, .chipname { display: none; }
  .shell { grid-template-columns: 1fr; }
  .drawer { position: fixed; left: 0; width: var(--drawer-w); z-index: 15; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  .content { padding: 16px; }
}
.hint { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.mcp { background: #dbeafe; color: #1e40af; }
.pill.a2a { background: #ede9fe; color: #5b21b6; }
.pill.inactive { background: #fee2e2; color: #991b1b; }

/* MCP flow (dark viewport) */
.flow { display: grid; grid-template-columns: 1fr 380px; gap: 16px; }
.flow svg { width: 100%; height: 340px; background: var(--viz); border-radius: 8px; border: 1px solid var(--border-strong); }
.lane-label { fill: #a1a1aa; font-size: 12px; font-family: var(--mono); }
.lane-line { stroke: #3f3f46; stroke-width: 1; }
.msg-line { stroke: #4c9be8; stroke-width: 2; marker-end: url(#arrow); opacity: .25; transition: opacity .25s; }
.msg-line.active { opacity: 1; stroke: var(--yellow); }
.msg-text { fill: #a1a1aa; font-size: 11px; font-family: var(--mono); opacity: .5; }
.msg-text.active { fill: var(--yellow); opacity: 1; }
.step-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.step-box h4 { margin: 0 0 6px; color: var(--green-dark); }

/* graph (dark viewport) */
#graph { height: 460px; background: var(--viz); border-radius: 8px; border: 1px solid var(--border-strong); }
.detail { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; min-height: 80px; margin-top: 10px; font-size: 14px; }
.detail h4 { margin: 0 0 4px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span::before { content: "●"; margin-right: 4px; }
.legend .l-host::before { color: #d4a800; } .legend .l-eureka::before { color: #6cc070; }
.legend .l-mcp::before { color: #4c9be8; } .legend .l-a2a::before { color: #b48ef0; } .legend .l-user::before { color: #71717a; }
.legend .l-sys::before { color: #ef6f6c; } .legend .l-job::before { color: #ffb14a; } .legend .l-table::before { color: #8b98a8; }
.legend .l-run::before { color: #ff4d4d; } .legend .l-err::before { color: #b00020; }
#lp-graph { height: 480px; background: radial-gradient(ellipse at center, #0f1620 0%, var(--viz) 70%); border-radius: 8px; border: 1px solid var(--border-strong); }

/* state machine */
.states { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.state { padding: 10px 16px; border-radius: 999px; border: 2px solid var(--border); color: var(--muted); font-weight: 600; transition: all .3s; }
.state.on { border-color: var(--green); color: var(--green-dark); box-shadow: 0 0 0 4px rgba(54,124,43,.15); }
.state.fail { border-color: var(--red); color: var(--red); }
.arrow { color: var(--muted); }

/* quiz */
.quiz { margin-top: 24px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.quiz h2 { margin: 0 0 8px; font-size: 18px; }
.q { margin: 14px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.q p { margin: 0 0 8px; font-weight: 600; }
.q label { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 14px; padding: 4px 0; cursor: pointer; }
.q.correct { border-color: #16a34a; background: var(--pass-bg); } .q.wrong { border-color: var(--red); background: var(--fail-bg); }
.feedback { font-size: 13px; margin-top: 6px; color: var(--muted); }
.q.correct .feedback { color: var(--ok); } .q.wrong .feedback { color: var(--red); }
.q.correct label { cursor: default; }
.q.swap { animation: q-swap .45s ease-out; }
@keyframes q-swap { from { opacity: 0; transform: translateY(-6px); background: var(--note-bg); } to { opacity: 1; transform: none; } }
.score { font-weight: 700; color: var(--green-dark); }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; color: var(--muted); }
.out { max-height: 320px; }
.ok { color: var(--ok); } .bad { color: var(--red); }

/* live pipeline (stage cards are light; the graphs below are dark viewports) */
.pipeline { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.stage { flex: 1 1 180px; background: var(--panel-2); border: 2px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; transition: border-color .3s, box-shadow .3s; }
.stage code { font-size: 12px; color: var(--muted); }
.stage-title { font-weight: 700; }
.stage-status { margin-top: 4px; font-size: 12px; color: var(--muted); }
.stage.running { border-color: #d4a800; box-shadow: 0 0 0 4px rgba(255,222,0,.25); animation: pulse 1s infinite alternate; }
.stage.done { border-color: #16a34a; } .stage.done .stage-status { color: var(--ok); }
.stage.error { border-color: var(--red); } .stage.error .stage-status { color: var(--red); }
.stage.warn { border-color: #d4a800; } .stage.warn .stage-status { color: var(--warn-text); }
.stage-arrow { align-self: center; color: var(--muted); font-size: 22px; }
@keyframes pulse { from { opacity: .75; } to { opacity: 1; } }
.bar-row { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.bar-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 14px; background: linear-gradient(90deg, var(--red), #ffb14a); border-radius: 4px; min-width: 4px; transition: width .6s; }
.bar-n { color: var(--muted); text-align: right; }

/* module 7 rebuilt: swimlane flow, waterfall, lineage, log */
.lp-h { margin: 16px 0 6px; font-size: 14px; }
.lp-h .hint { font-weight: 400; }
#lp-flow { height: 440px; background: var(--viz); border-radius: 8px; border: 1px solid var(--border-strong); }
#lp-lineage { height: 360px; background: var(--viz); border-radius: 8px; border: 1px solid var(--border-strong); }
.lp-log { height: 360px; max-height: none; margin: 0; font-size: 12px; }
.wf { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 8px; }
.wf-axis { position: relative; height: 16px; margin-left: 230px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.wf-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 10px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.wf-tick.last { transform: translateX(-100%); }
.wf-row { display: grid; grid-template-columns: 230px 1fr; align-items: center; gap: 0; margin: 6px 0; }
.wf-label { font-size: 12px; color: var(--text); line-height: 1.3; padding-right: 10px; }
.wf-label code { font-size: 11px; color: var(--muted); }
.wf-track { position: relative; height: 26px; background: repeating-linear-gradient(90deg, transparent 0 24.9%, var(--border) 25% 25.2%); border-radius: 4px; }
.wf-bar { position: absolute; top: 3px; height: 20px; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; white-space: nowrap; font-size: 11px; color: #000; font-weight: 600; transition: width .4s; }
.wf-bar span { position: absolute; left: 100%; margin-left: 8px; color: var(--text); font-weight: 400; }
.wf-bar.lbl-left span { left: auto; right: 100%; margin-left: 0; margin-right: 8px; }
.wf-bar.lbl-in span { position: static; margin: 0; color: #000; font-weight: 600; }
.wf-track { overflow: visible; }
#lp-logs { white-space: pre-wrap; word-break: break-word; }
.wf-bar.done { background: linear-gradient(90deg, #6cc070, #a3e29f); }
.wf-bar.error { background: linear-gradient(90deg, #ef6f6c, #ff9f9c); }
.wf-bar.running { background: linear-gradient(90deg, #ffde00, #fff08a); }
.wf-limit { position: absolute; top: -4px; bottom: -4px; border-left: 2px dashed var(--red); }
.wf-total { margin-top: 8px; font-size: 12px; }

/* ---------------------------------------------------------------- DIF course: graph-first widgets */
.dg-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.dg-wrap.solo { grid-template-columns: 1fr; }
.dg-wrap.form { grid-template-columns: 300px minmax(0, 1fr); }
.dg-wrap.sim { grid-template-columns: 280px minmax(0, 1fr); }
@media (max-width: 960px) { .dg-wrap, .dg-wrap.form, .dg-wrap.sim { grid-template-columns: 1fr; } }
.dg { background: var(--viz); border-radius: 8px; border: 1px solid var(--border-strong); }
.dg-side { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 13px; min-height: 120px; }
.dg-side.below { margin-top: 10px; min-height: 0; }
.arch .lp-h { margin-top: 12px; }
.arch .dg { margin-bottom: 4px; }

/* ---------------------------------------------------------------- knighting ceremony */
.knight-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(9, 9, 11, .62); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: kn-fade .25s ease-out; }
.knight-overlay.out { animation: kn-fade .25s ease-in reverse forwards; }
.knight-card { width: min(640px, 100%); background: var(--panel); border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: kn-pop .45s cubic-bezier(.2, 1.4, .4, 1); }
.knight-scene { display: block; width: 100%; height: auto; }
.knight-stage { position: relative; }
.knight-fx { position: absolute; inset: 0; pointer-events: none; }
/* portrait box = SVG units x 318..482, y 46..250 of the 560x300 scene; turned toward the knight with a real 3D rotation */
.kn-portrait-3d { position: absolute; left: 56.8%; top: 15.3%; width: 29.3%; height: 68%; perspective: 520px; perspective-origin: 50% 40%; }
.kn-portrait-3d img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transform: rotateY(-26deg) rotateZ(-3deg); transform-origin: 50% 55%; border-radius: 50% 50% 0 0 / 42% 42% 0 0; -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent); filter: drop-shadow(-6px 4px 10px rgba(0,0,0,.6)); animation: kn-turn 1.1s ease-out both; }
@keyframes kn-turn { from { transform: rotateY(0deg) rotateZ(0deg); } to { transform: rotateY(-26deg) rotateZ(-3deg); } }
.knight-text { padding: 18px 22px 20px; }
.knight-text .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--green-dark); }
.knight-text h2 { margin: 6px 0 8px; font-size: 22px; }
.knight-text h2 b { color: var(--green-dark); }
.knight-text p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.knight-text .toolbar { margin: 0; }
.kn-stars circle { animation: kn-twinkle 2.4s ease-in-out infinite; }
.kn-knight { animation: kn-bow 1.2s ease-out both; transform-origin: 150px 250px; }
.kn-arm { transform-origin: 356px 176px; transform-box: view-box; animation: kn-dub 2.6s ease-in-out .6s both; }
.kn-spark { opacity: 0; animation: kn-spark 2.6s ease-out .6s both; }
@keyframes kn-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes kn-pop { from { transform: translateY(30px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes kn-twinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes kn-bow { from { transform: translateY(-8px); } to { transform: none; } }
@keyframes kn-dub { 0% { transform: rotate(-70deg); } 30% { transform: rotate(-70deg); } 45% { transform: rotate(4deg); } 52% { transform: rotate(0deg); } 65% { transform: rotate(-30deg); } 78% { transform: rotate(4deg); } 85% { transform: rotate(0deg); } 100% { transform: rotate(0deg); } }
@keyframes kn-spark { 0%, 44% { opacity: 0; r: 4; } 47% { opacity: 1; r: 16; } 55% { opacity: 0; r: 26; } 77% { opacity: 0; r: 4; } 80% { opacity: 1; r: 16; } 88% { opacity: 0; r: 26; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .kn-arm, .kn-knight, .kn-spark, .kn-stars circle, .knight-card, .kn-portrait-3d img { animation: none; } .kn-spark { opacity: 0; } }
.dg-detail h4 { margin: 0 0 6px; color: var(--green-dark); font-size: 14px; }
.dg-detail p { margin: 6px 0; font-size: 13px; }
.dg-name { display: block; font-size: 11px; color: var(--muted); word-break: break-all; margin-bottom: 6px; }
.dg-say { margin: 10px 0; padding: 10px 14px; border-left: 3px solid var(--yellow); background: var(--note-bg); border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.5; min-height: 20px; }
.dg-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.dg-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.dg-legend img { width: 16px; height: 16px; border-radius: 3px; margin-right: 5px; vertical-align: -4px; }
.dg-form { display: grid; gap: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12px; }
.dg-form label { display: grid; gap: 3px; color: var(--muted); font-weight: 600; }
.dg-form input, .dg-form select, .dg-form textarea { width: 100%; font-family: var(--mono); font-size: 12px; font-weight: 400; }
.dg-form .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dg-form details { margin-top: 4px; } .dg-form summary { cursor: pointer; color: var(--muted); }
.dg-form pre { max-height: 260px; font-size: 11px; }
.dg-side.actions { display: grid; gap: 6px; align-content: start; }
.sim-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
@media (max-width: 960px) { .sim-actions { grid-template-columns: 1fr 1fr; } }
.sim-actions > div { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: grid; gap: 6px; align-content: start; font-size: 12px; }
.sim-actions h4 { margin: 0; font-size: 11px; color: var(--green-dark); text-transform: uppercase; letter-spacing: .05em; }
.sim-actions .btn { width: 100%; text-align: left; font-size: 12px; padding: 7px 10px; }
.sim-actions select, .sim-actions textarea { width: 100%; font-family: var(--mono); font-size: 11px; }
.sim-actions summary { cursor: pointer; color: var(--muted); }
.dg-side.actions h4 { margin: 8px 0 0; font-size: 11px; color: var(--green-dark); text-transform: uppercase; letter-spacing: .05em; }
.dg-side.actions h4:first-child { margin-top: 0; }
.dg-side.actions .btn { width: 100%; text-align: left; }
.dg-side.actions select, .dg-side.actions textarea { width: 100%; font-family: var(--mono); font-size: 11px; }
.dg-side.actions summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.dif-live { margin-top: 12px; background: var(--panel-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.dif-live h4 { margin: 0 0 8px; font-size: 13px; color: var(--green-dark); }
.dif-live pre { margin: 8px 0 0; max-height: 260px; }
.dif-radio-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 16px; margin-top: 10px; }
.dif-radio { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 13px; cursor: pointer; }
.dif-checklist { padding-left: 18px; margin: 8px 0; display: grid; gap: 6px; font-size: 13px; }
.dif-checklist label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.cmd { display: block; margin: 6px 0; font-family: var(--mono); font-size: 12px; background: var(--viz); color: #e4e4e7; padding: 6px 8px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; }
.mode { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; vertical-align: middle; }
.mode.manual { background: #fef3c7; color: #92400e; } .mode.automated { background: #dbeafe; color: #1e40af; } .mode.verify { background: #dcfce7; color: #15803d; }

/* ---------------------------------------------------------------- AWS design course widgets */
.aws-form { display: grid; gap: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 13px; align-content: start; margin-bottom: 12px; }
.aws-form.cols { grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.aws-form.cols .aws-inline { grid-column: 1 / -1; }
@media (max-width: 700px) { .aws-form.cols { grid-template-columns: 1fr; } }
.aws-field { display: grid; gap: 4px; color: var(--muted); font-weight: 600; }
.aws-field b { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: 12px; }
.aws-field select { font-weight: 400; }
.aws-field.aws-inline { grid-template-columns: auto 1fr; align-items: center; font-weight: 400; color: var(--text); }
.aws-form input[type=range] { width: 100%; accent-color: var(--green); }
.aws-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; font-weight: 400; color: var(--text); }
.aws-checks label { display: flex; gap: 6px; align-items: center; }
.aws-h4 { margin: 14px 0 6px; font-size: 12px; color: var(--green-dark); text-transform: uppercase; letter-spacing: .05em; }
.aws-watch { margin: 6px 0 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
.aws-watch li.ok { color: var(--ok); }
.aws-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.aws-chip { display: grid; gap: 1px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-width: 96px; }
.aws-chip small { color: var(--muted); font-size: 11px; } .aws-chip b { font-family: var(--mono); font-size: 13px; }
.aws-chip.ok b { color: var(--ok); } .aws-chip.warn b { color: var(--warn-text); } .aws-chip.bad b { color: var(--red); }
.aws-track { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; height: 14px; overflow: hidden; }
.aws-track .bar { height: 100%; background: linear-gradient(90deg, var(--green), var(--yellow)); }
.aws-track .bar.thr { background: linear-gradient(90deg, var(--red), #ffb14a); }
.bar-label small { color: var(--muted); font-family: var(--mono); }
.aws-review { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; display: grid; gap: 6px; }
.aws-review li.ok::marker { content: "✓ "; color: var(--ok); } .aws-review li.bad::marker { content: "✗ "; color: var(--red); }
.aws-review li small { color: var(--muted); }
.aws-total { font-size: 22px; margin-bottom: 10px; } .aws-total b { color: var(--green-dark); }
.aws-cost-row { margin-bottom: 10px; font-size: 13px; }
.aws-cost-head { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.aws-cost-n { font-family: var(--mono); font-size: 12px; }
.aws-ic { vertical-align: -4px; margin-right: 6px; border-radius: 4px; }
.aws-icons { display: flex; gap: 4px; margin: 4px 0 2px; } .aws-icons .aws-ic { margin: 0; }
.aws-cost-head b .aws-ic, .aws-review .aws-ic { vertical-align: -4px; }
.dg-detail h4 .aws-ic { vertical-align: -5px; }
@media (max-width: 700px) { .aws-cost-head { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- reference pages (#/reference/<id>): exposure affiliations lineage */
.content:has(#view-reference:not([hidden])) { max-width: 1480px; }
.lin-facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; min-height: 58px; }
.lin-fact { display: grid; gap: 1px; min-width: 120px; padding: 8px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.lin-fact b { font-size: 20px; line-height: 1.2; color: var(--green-dark); }
.lin-fact b a { color: inherit; font-family: var(--mono); font-size: 17px; }
.lin-fact span { font-size: 12px; color: var(--muted); }
.lin-note { margin: 6px 0 14px; }
.lin-explorer { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; scroll-margin-top: calc(var(--appbar-h) + 12px); }
.lin-explorer .toolbar { margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.lin-explorer .toolbar select { max-width: 340px; }
.lin-explorer .toolbar a.btn { text-decoration: none; }
.lin-frame { display: block; width: 100%; height: min(80vh, 900px); min-height: 520px; border: 0; background: var(--panel); }
.lin-explorer:fullscreen { display: flex; flex-direction: column; border-radius: 0; }
.lin-explorer:fullscreen .lin-frame { flex: 1; height: auto; min-height: 0; }
.lin-narrow { display: none; }
@media (max-width: 900px) { .lin-narrow { display: block; } }
.lin-doc { margin-top: 28px; }
.lin-doc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.lin-doc .lin-doc-head h2 { margin: 0; padding: 0; border: 0; }
.lin-sec { margin: 10px 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; scroll-margin-top: calc(var(--appbar-h) + 12px); }
.lin-sec > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 16px; border-radius: 10px; }
.lin-sec > summary:hover { background: var(--panel-2); }
.lin-sec[open] > summary { border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.lin-sec-body { padding: 4px 16px 12px; overflow-x: auto; }
.lin-doc h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 28px; scroll-margin-top: calc(var(--appbar-h) + 12px); }
.lin-doc table { font-size: 13px; }
.lin-doc img { display: block; max-width: 100%; height: auto; margin: 12px 0; border-radius: 12px; }
.lin-widget { margin: 12px 0; }
.lin-widget .dg-side { overflow-x: auto; }
.lin-widget .dg-side table { font-size: 11px; }
.lin-widget .aff-rows { overflow-x: auto; }
.lin-widget tr[data-edge] { cursor: pointer; }
.lin-widget tr[data-edge]:hover, .lin-widget tr[data-edge]:focus { background: var(--panel-2); outline: none; }
.lin-graph { font: 600 11px/1.2 system-ui, sans-serif; color: var(--green-dark); background: transparent; border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px 8px; cursor: pointer; white-space: nowrap; vertical-align: 1px; }
.lin-graph:hover { border-color: var(--green); background: var(--panel-2); }
td > code + .lin-graph, td > a + .lin-graph { margin-left: 6px; }
