/* Nawa Lab - dark "terminal ops" theme. External stylesheet only: the CSP forbids inline styles. */

:root {
  --bg: #060a11;
  --bg-2: #0a111c;
  --surface: #0e1623;
  --surface-2: #131e30;
  --surface-3: #192741;
  --line: #1f2d44;
  --line-2: #2b3d5c;
  --text: #dbe5f3;
  --muted: #8a9bb5;
  --dim: #5c6e8a;
  --accent: #2dd4bf;
  --accent-ink: #04201c;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --blue: #38bdf8;
  --violet: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --high: #fb923c;
  --crit: #f43f5e;
  --radius: 12px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-2: #e8eef6;
  --surface: #ffffff;
  --surface-2: #f4f7fc;
  --surface-3: #e6eef8;
  --line: #d3dce8;
  --line-2: #b8c6d8;
  --text: #132033;
  --muted: #4d5d74;
  --dim: #6a7b93;
  --accent: #0f766e;
  --accent-ink: #f0fdfa;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --blue: #0369a1;
  --violet: #6d28d9;
  --ok: #047857;
  --warn: #b45309;
  --high: #c2410c;
  --crit: #be123c;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(45, 212, 191, 0.09), transparent 60%),
    radial-gradient(700px 400px at -10% 0%, rgba(56, 189, 248, 0.07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 0.85rem; }
code, kbd, pre { font-family: var(--mono); }
code {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  font-size: 0.88em;
  color: #bfe9ff;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.7rem 1.5rem;
  background: rgba(6, 10, 17, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(45, 212, 191, 0.4);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
}
.brand-name small { color: var(--muted); font-weight: 500; margin-left: 0.35rem; }

.prefs {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.pref-theme {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.pref-theme svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}
.pref-theme .icon-sun {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pref-theme .icon-moon {
  fill: currentColor;
}
.pref-theme:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.pref-lang {
  display: inline-flex;
  align-items: stretch;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.pref-lang a,
.pref-lang span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.15rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.pref-lang a:hover {
  color: var(--text);
  text-decoration: none;
}
.pref-lang .is-on {
  background: var(--accent);
  color: var(--accent-ink);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav { display: flex; align-items: center; gap: 0.25rem; margin-left: 0; flex-wrap: wrap; min-width: 0; }
.nav a {
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.account { position: relative; flex-shrink: 0; }
.account > summary { list-style: none; }
.account > summary::-webkit-details-marker { display: none; }
.who {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--mono);
  background: var(--surface);
  cursor: pointer;
}
.who:hover { color: var(--text); border-color: var(--line-2); }
.account[open] .who { color: var(--text); border-color: var(--accent); }
.who-email {
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.who-caret {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.account[open] .who-caret { transform: rotate(180deg); }
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 30;
  min-width: 12.5rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 0.15rem;
}
.account-menu a,
.account-menu button {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.account-menu a:hover,
.account-menu button:hover {
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
}
.account-menu a.active { color: var(--accent); background: var(--accent-soft); }
.account-menu form { margin: 0; }

.page { max-width: 1180px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.page > * + * { margin-top: 1.25rem; }

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.82rem;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* ---------- surfaces ---------- */

.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
}
.card.narrow { max-width: 460px; margin-inline: auto; }
.card > :last-child { margin-bottom: 0; }

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem 2rem 1.75rem;
  background:
    linear-gradient(rgba(45, 212, 191, 0.045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(45, 212, 191, 0.045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, #0d1828, #08101b);
}
.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.22), transparent 65%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.eyebrow::before { content: "> "; color: var(--dim); }
.lede { color: var(--muted); max-width: 70ch; }
.hero .lede { margin: 0.35rem 0 0; }
.hero-steps { margin-top: 1.6rem; }
.hint { color: var(--muted); font-size: 0.86rem; }
.crumbs { color: var(--dim); font-size: 0.85rem; font-family: var(--mono); margin-bottom: 0.6rem; }
.crumbs a { color: var(--muted); }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 0.75rem;
}
.section-title h2 { margin: 0; }

/* ---------- stat cards ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  border-top: 2px solid var(--accent);
}
.stat.blue { border-top-color: var(--blue); }
.stat.violet { border-top-color: var(--violet); }
.stat.warn { border-top-color: var(--warn); }
.stat-value { font-family: var(--mono); font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.3rem; }

/* ---------- banners ---------- */

.banner {
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  background: var(--surface);
}
.banner.ok { border-color: rgba(52, 211, 153, 0.4); border-left-color: var(--ok); color: #b7f5da; }
.banner.error { border-color: rgba(244, 63, 94, 0.45); border-left-color: var(--crit); color: #ffc6d1; }
.banner.info { border-color: rgba(56, 189, 248, 0.4); border-left-color: var(--blue); color: #c6ecff; }

/* ---------- buttons and forms ---------- */

button, .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
button:hover, .button-link:hover { background: #5eead4; text-decoration: none; }
button:active, .button-link:active { transform: translateY(1px); }
button.secondary, .button-link.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line-2);
}
button.secondary:hover, .button-link.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
button.danger { background: transparent; color: #ffb4c2; border-color: rgba(244, 63, 94, 0.55); }
button.danger:hover { background: rgba(244, 63, 94, 0.12); }
.icon-btn {
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: transparent;
  color: var(--text);
  border-color: var(--line-2);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--muted); color: var(--accent); }
.icon-btn svg { width: 1.05rem; height: 1.05rem; fill: currentColor; display: block; }
.input-row { display: flex; align-items: center; gap: 0.4rem; }
.input-row input { flex: 1; min-width: 0; }
.run-actions { display: flex; align-items: stretch; gap: 0.5rem; flex-wrap: wrap; }
.run-actions form { margin: 0; display: flex; }
.run-actions .button-link { flex: 1; width: auto; margin-top: 0; }
.stop-btn {
  background: var(--crit);
  border-color: var(--crit);
  color: #fff;
}
.stop-btn:hover {
  background: #be123c;
  border-color: #be123c;
  color: #fff;
}
.run-actions .stop-btn {
  width: 2.75rem;
  min-width: 2.75rem;
  height: auto;
  min-height: 100%;
}
.access-detail {
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.access-detail p { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.86rem; }
.access-detail p:last-child { margin-bottom: 0; }
.lab-ttl { display: grid; gap: 0.4rem; margin-top: 0.55rem; }
.lab-ttl-left { font-family: var(--mono); font-weight: 700; color: var(--text); }
.lab-ttl.is-soon .lab-ttl-left { color: var(--warn); }
.lab-ttl.is-gone .lab-ttl-left { color: var(--crit); }
.ttl-extend { margin: 0; }
.ttl-extend button { width: 100%; }
.ttl-extend.is-off,
.ttl-wait.is-off { display: none; }

button.linkish {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  font-weight: 500;
}
button.linkish:hover { color: var(--text); background: var(--surface-2); }

form { margin: 0; }
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin: 0.85rem 0 0.3rem; }
label.inline-check { display: flex; gap: 0.5rem; align-items: center; color: var(--text); font-weight: 500; margin: 0.4rem 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #070d16;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 0.55rem 0.75rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { accent-color: var(--accent); width: 1rem; height: 1rem; }
.grid { display: grid; gap: 0.1rem; max-width: 460px; }
.grid button { margin-top: 0.9rem; justify-self: start; }
.grid .icon-btn { margin-top: 0; }
.settings-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); max-width: 420px; }
.settings-form button { margin-top: 0.75rem; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.inline-actions form { display: inline-flex; }

/* ---------- badges and chips ---------- */

.badge, .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--line-2);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-weight: 600; }
.status-locked { color: var(--dim); }
.status-available { color: var(--blue); border-color: rgba(56, 189, 248, 0.45); background: rgba(56, 189, 248, 0.08); }
.status-in-progress { color: var(--warn); border-color: rgba(251, 191, 36, 0.45); background: rgba(251, 191, 36, 0.08); }
.status-completed { color: var(--ok); border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.08); }
.tag-flag { color: var(--crit); border-color: rgba(244, 63, 94, 0.45); background: rgba(244, 63, 94, 0.08); }
.tag-fix { color: var(--ok); border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.08); }
.sev-beginner { color: var(--ok); }
.sev-intermediate { color: var(--warn); }
.sev-advanced { color: var(--high); }
.sev-expert { color: var(--crit); }

/* ---------- progress meter ---------- */

.meter { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--blue)); transition: width 0.3s ease; }
.meter-0 > span { width: 0; }
.meter-10 > span { width: 10%; }
.meter-20 > span { width: 20%; }
.meter-30 > span { width: 30%; }
.meter-40 > span { width: 40%; }
.meter-50 > span { width: 50%; }
.meter-60 > span { width: 60%; }
.meter-70 > span { width: 70%; }
.meter-80 > span { width: 80%; }
.meter-90 > span { width: 90%; }
.meter-100 > span { width: 100%; background: linear-gradient(90deg, var(--ok), var(--accent)); }

/* ---------- lab cards ---------- */

.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.lab-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.lab-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.lab-card.is-locked { opacity: 0.72; }
.lab-card.is-completed { border-color: rgba(52, 211, 153, 0.4); }
.lab-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.lab-card h2 { margin: 0; font-size: 1.12rem; }
.lab-card h2 a { color: var(--text); }
.lab-card h2 a:hover { color: var(--accent); text-decoration: none; }
.lab-summary { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.35rem; flex: 1; }
.lab-card-flash { width: 100%; }
.lab-card-foot { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.lab-card-foot form { display: inline-flex; margin: 0; }
.lab-facts { display: flex; gap: 0.9rem; color: var(--dim); font-size: 0.8rem; font-family: var(--mono); flex-wrap: wrap; }

/* ---------- stepper ---------- */

.stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
}
.step {
  position: relative;
  padding: 0.75rem 0.9rem 0.75rem 3rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  counter-increment: step;
}
.step::before {
  content: counter(step);
  position: absolute;
  left: 0.8rem;
  top: 50%;
  translate: 0 -50%;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
}
.step strong { display: block; font-size: 0.92rem; }
.step span { color: var(--muted); font-size: 0.8rem; }
.step.current { border-color: rgba(45, 212, 191, 0.55); background: var(--accent-soft); }
.step.current::before { border-color: var(--accent); color: var(--accent); }
.step.done { border-color: rgba(52, 211, 153, 0.4); }
.step.done::before { content: "\2713"; background: var(--ok); border-color: var(--ok); color: #03231a; }

/* ---------- lab detail ---------- */

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.detail-side { position: sticky; top: 4.5rem; display: grid; gap: 1rem; }
.detail-side .card { padding: 1.1rem 1.2rem; }
.detail-side h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.checklist { margin: 0; padding-left: 1.1rem; }
.checklist li { margin: 0.3rem 0; }
.tool-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.run-panel { display: grid; gap: 0.75rem; }
.run-panel .button-link, .run-panel button:not(.icon-btn) { width: 100%; }
.run-panel .run-actions .button-link { width: auto; }
.reset-form { margin: 0; }
.reset-btn {
  background: transparent;
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
}
.reset-btn:hover {
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-color: var(--warn);
  color: var(--warn);
}

.cp {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0 0.9rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.cp:first-of-type { border-top: 0; }
.cp-num {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
}
.cp.cleared .cp-num { background: rgba(52, 211, 153, 0.15); border-color: rgba(52, 211, 153, 0.5); color: var(--ok); }
.cp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.cp-head strong { font-size: 1rem; }
.cp-state { margin-left: auto; font-size: 0.8rem; font-weight: 700; }
.cp-state.cleared, .cleared { color: var(--ok); }
.cp-state.pending, .pending { color: var(--dim); }
.cp-body > * { margin-top: 0.55rem; }
.cp-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; max-width: 560px; }
.cp-form input { flex: 1; min-width: 220px; font-family: var(--mono); }
.cp-form label { flex-basis: 100%; margin: 0; }
.cp details {
  border: 1px dashed var(--line-2);
  border-radius: 9px;
  padding: 0.5rem 0.8rem;
  background: rgba(251, 191, 36, 0.04);
}
.cp summary { cursor: pointer; color: var(--warn); font-size: 0.85rem; font-weight: 600; }
.cp details p { margin: 0.5rem 0 0; color: var(--text); }
.flag-format { font-family: var(--mono); color: var(--accent); }

.lock-panel { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.lock-panel .lock-icon { font-size: 2rem; }

/* ---------- tables and heatmap ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
caption { text-align: left; padding: 0.6rem 0.9rem; }
th, td { padding: 0.6rem 0.9rem; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
td form { display: inline; }
.heat { text-align: center; font-family: var(--mono); font-weight: 700; }
.heat-0 { color: var(--dim); }
.heat-1 { color: var(--high); background: rgba(251, 146, 60, 0.1); }
.heat-2 { color: var(--warn); background: rgba(251, 191, 36, 0.1); }
.heat-3 { color: var(--blue); background: rgba(56, 189, 248, 0.1); }
.heat-4 { color: var(--ok); background: rgba(52, 211, 153, 0.14); }
.person-row { display: flex; align-items: center; gap: 0.5rem; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.mini-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.3rem; }
.mini-list li { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.mini-list .cleared::before { content: "\2713  "; }
.mini-list .pending::before { content: "\25CB  "; }

details.person { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0.2rem 1rem; margin-top: 0.7rem; }
details.person > summary { cursor: pointer; padding: 0.7rem 0; font-weight: 600; }
details.person[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 0.6rem; }
.cp-block { padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.cp-block:last-child { border-bottom: 0; }
.cp-block-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---------- materials ---------- */

.session-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.session-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 0 1.15rem;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  color: var(--text);
}
.session-cover {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--surface-2);
}
.session-card .session-no,
.session-card h2,
.session-card p,
.session-card .inline-actions { padding-left: 1.25rem; padding-right: 1.25rem; }
.session-card .session-no { padding-top: 0.9rem; }
.doc-cover {
  display: block;
  width: min(100%, 52rem);
  height: 220px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin: 1rem 0 0;
}
.session-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-2px); }
.session-no { font-family: var(--mono); color: var(--accent); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; }
.session-card h2 { margin: 0; }
.session-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.toc { position: sticky; top: 4.5rem; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--surface); }
.toc h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.toc a { display: block; padding: 0.25rem 0.5rem; border-radius: 6px; color: var(--muted); font-size: 0.86rem; }
.toc a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.tabs a { padding: 0.4rem 0.9rem; color: var(--muted); font-weight: 600; font-size: 0.86rem; }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }
.tabs a:hover { text-decoration: none; background: var(--surface-2); }

.prose { max-width: 78ch; }
.prose img {
  display: block;
  width: 100%;
  max-width: 44rem;
  height: 230px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin: 0.9rem 0 1.3rem;
  background: var(--surface-2);
}
.prose h1 { font-size: 1.7rem; }
.prose h2 { font-size: 1.3rem; margin-top: 2.1rem; padding-top: 1.2rem; border-top: 1px solid var(--line); scroll-margin-top: 5rem; }
.prose h3 { margin-top: 1.5rem; color: var(--accent); scroll-margin-top: 5rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0.25rem 0; }
.prose pre {
  background: #050a12;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.5;
}
.prose pre code { background: none; border: 0; padding: 0; color: #cfe3ff; }
.prose blockquote {
  margin: 1rem 0;
  padding: 0.7rem 1rem;
  border-left: 4px solid var(--warn);
  background: rgba(251, 191, 36, 0.06);
  border-radius: 0 10px 10px 0;
  color: #f6e3ae;
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose table { margin: 1rem 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: block; overflow-x: auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose img { max-width: 100%; }

/* ---------- login landing ---------- */

body.landing {
  background: #050814;
}
body.landing .topbar {
  position: absolute;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(6, 10, 17, 0.55), transparent);
  border-bottom-color: transparent;
  backdrop-filter: none;
}
body.landing .pref-theme,
body.landing .pref-lang {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(10, 16, 28, 0.55);
}
body.landing .pref-theme { color: #e8eef8; }
body.landing .pref-lang a,
body.landing .pref-lang span { color: #c9d4e6; }
body.landing .pref-lang .is-on { color: var(--accent-ink); }
body.landing .page {
  max-width: none;
  padding: 0;
}
body.landing .foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: none;
  background: linear-gradient(0deg, rgba(6, 10, 17, 0.7), transparent);
  border-top-color: transparent;
  color: #c9d4e6;
}

.login-scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}
.login-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 55% 40%;
}
.login-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 10, 17, 0.72) 0%, rgba(6, 10, 17, 0.18) 46%, rgba(6, 10, 17, 0.62) 100%),
    linear-gradient(180deg, rgba(6, 10, 17, 0.28) 0%, transparent 28%, rgba(6, 10, 17, 0.55) 100%);
}
.login-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 400px);
  gap: 2.5rem;
  align-items: center;
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 6.5rem 1.5rem 4.5rem;
}
.login-copy h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  max-width: 16ch;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}
.login-copy .lede {
  color: #d5deee;
  max-width: 42ch;
}
.login-card {
  background: rgba(10, 16, 28, 0.78);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

@media (max-width: 900px) {
  .detail-layout, .doc-layout, .login-wrap { grid-template-columns: 1fr; }
  .detail-side, .toc { position: static; }
  .topbar { flex-wrap: wrap; gap: 0.6rem; }
  .nav { margin-left: 0; flex-basis: 100%; order: 3; }
  .prefs, .account { order: 2; }
  .who-email { max-width: 12ch; }
  .login-copy h1 { max-width: none; }
  .login-wrap { padding-top: 5.5rem; align-content: end; }
}

html[data-theme="light"] body {
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(15, 118, 110, 0.08), transparent 60%),
    radial-gradient(700px 400px at -10% 0%, rgba(3, 105, 161, 0.06), transparent 55%),
    var(--bg);
}
html[data-theme="light"] .topbar {
  background: rgba(243, 246, 251, 0.88);
}
html[data-theme="light"] code { color: #0c4a6e; }
html[data-theme="light"] .banner.ok { color: #065f46; }
html[data-theme="light"] .banner.error { color: #9f1239; }
html[data-theme="light"] .banner.info { color: #075985; }
html[data-theme="light"] body.landing .topbar {
  background: linear-gradient(180deg, rgba(6, 10, 17, 0.62), transparent);
}
html[data-theme="light"] body.landing .brand,
html[data-theme="light"] body.landing .brand-name {
  color: #f4f7fc;
}
html[data-theme="light"] body.landing .brand-name small { color: #c9d4e6; }
html[data-theme="light"] body.landing .pref-theme,
html[data-theme="light"] body.landing .pref-lang {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(10, 16, 28, 0.62);
}
html[data-theme="light"] body.landing .pref-theme { color: #e8eef8; }
html[data-theme="light"] body.landing .pref-lang a,
html[data-theme="light"] body.landing .pref-lang span { color: #c9d4e6; }
html[data-theme="light"] body.landing .pref-lang .is-on {
  background: #2dd4bf;
  color: #04201c;
}
html[data-theme="light"] body.landing .foot { color: #e8eef8; }
html[data-theme="light"] .login-copy,
html[data-theme="light"] .login-copy h1 {
  color: #f7fafc;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7), 0 8px 40px rgba(0, 0, 0, 0.45);
}
html[data-theme="light"] .login-copy .eyebrow { color: #5eead4; }
html[data-theme="light"] .login-copy .lede {
  color: #eef3fa;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}
html[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(19, 32, 51, 0.12);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  color: var(--text);
}
html[data-theme="light"] .login-card h2 { color: var(--text); }
html[data-theme="light"] .login-card .hint,
html[data-theme="light"] .login-card label { color: var(--muted); }
html[data-theme="light"] .hero {
  background:
    linear-gradient(rgba(15, 118, 110, 0.07) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(15, 118, 110, 0.07) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, #eef4fb, #f8fafc);
}
html[data-theme="light"] .hero::after {
  background: radial-gradient(circle, rgba(15, 118, 110, 0.18), transparent 65%);
}
html[data-theme="light"] .hero h1,
html[data-theme="light"] .hero .lede { color: var(--text); }
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] input:not([type]),
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background: #ffffff;
  color: var(--text);
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color: var(--dim); }
html[data-theme="light"] .prose blockquote { color: #6b4f08; }
html[data-theme="light"] .account-menu { box-shadow: 0 16px 40px rgba(19, 32, 51, 0.12); }

.cp-flash {
  margin: 0.55rem 0 0;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 0.9rem;
}
.cp-flash.ok { border-color: rgba(52, 211, 153, 0.45); color: var(--ok); background: rgba(52, 211, 153, 0.08); }
.cp-flash.error { border-color: rgba(244, 63, 94, 0.45); color: var(--crit); background: rgba(244, 63, 94, 0.08); }
.hint-open { margin: 0.45rem 0; }
.hint-open[hidden] { display: none; }
.hint-body {
  margin: 0.55rem 0 0.35rem;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}
.lab-state { margin: 0 0 0.75rem; }
.run-panel > form + .button-link,
.run-panel > form + form,
.run-panel > .button-link + form { margin-top: 0.5rem; }

.lab-boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(6, 10, 17, 0.72);
  backdrop-filter: blur(8px);
}
.lab-boot[hidden] { display: none; }
.lab-boot-card {
  width: min(440px, 92vw);
  padding: 1.6rem 1.5rem 1.35rem;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}
.boot-code {
  display: inline-block;
  margin: 0 0 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--accent);
  font: 650 0.72rem/1.3 ui-monospace, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.boot-code[hidden], .boot-meta[hidden], .boot-summary[hidden] { display: none; }
.boot-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}
.boot-summary {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.lab-boot-card::after {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin-top: 1.1rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.boot-steps {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.boot-steps li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1.8rem;
  color: var(--muted);
  opacity: 0.32;
}
.boot-steps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: 2px solid var(--accent);
}
.lab-boot.is-on .boot-steps li:nth-child(1) { animation: boot-step 0.45s 0.12s forwards; }
.lab-boot.is-on .boot-steps li:nth-child(2) { animation: boot-step 0.45s 0.7s forwards; }
.lab-boot.is-on .boot-steps li:nth-child(3) { animation: boot-step 0.45s 1.25s forwards; }
@keyframes boot-step {
  to { opacity: 1; color: var(--text); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal {
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 1.25rem 1.3rem;
  max-width: 26rem;
  width: min(26rem, calc(100vw - 2rem));
}
.modal::backdrop { background: rgba(6, 10, 17, 0.62); }
.modal h2 { margin-bottom: 0.4rem; }
.modal label { display: block; margin: 0.85rem 0 0.3rem; font-weight: 600; }
.modal input { width: 100%; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .lab-boot.is-on .boot-steps li { opacity: 1; color: var(--text); }
}
