:root {
  --bg: #0f1117;
  --bg-soft: #161a23;
  --panel: #1b2029;
  --panel-2: #212734;
  --line: #2c3340;
  --line-soft: #242a35;
  --text: #e8ecf4;
  --text-dim: #9aa4b6;
  --text-faint: #6c7789;
  --accent: #7c6cff;
  --accent-2: #4fc3f7;
  --ok: #3ddc97;
  --warn: #ffc44d;
  --err: #ff6b6b;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(124, 108, 255, 0.20), transparent 60%),
    radial-gradient(900px 520px at 105% 0%, rgba(79, 195, 247, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); }

/* ---------- layout ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(15, 17, 23, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.brand .dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.topbar .spacer { flex: 1; }

.session-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}

.session-chip .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.16);
}

.wrap {
  max-width: 940px;
  margin: 0 auto;
  padding: 34px 28px 90px;
}

.wrap.narrow { max-width: 560px; }

.crumb {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 18px;
}

.crumb a { color: var(--text-dim); text-decoration: none; }
.crumb a:hover { color: var(--text); }

h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

h2 {
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.lede {
  color: var(--text-dim);
  margin: 0 0 26px;
  max-width: 66ch;
}

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

.card > h2:first-child { margin-top: 0; }

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}

.step .num {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.step h2 { margin: 0; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

.tool {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tool:hover {
  transform: translateY(-2px);
  border-color: #3b4457;
  background: var(--panel-2);
}

.tool.disabled {
  opacity: 0.62;
  pointer-events: none;
}

.tool .icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.9), rgba(79, 195, 247, 0.85));
  margin-bottom: 14px;
}

.tool h3 {
  margin: 0 0 6px;
  font-size: 16.5px;
  letter-spacing: -0.01em;
}

.tool p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
}

/* ---------- forms ---------- */

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 6px;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.6;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.18);
}

input:disabled, textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 620px) {
  .row { grid-template-columns: 1fr; }
  .wrap { padding: 24px 18px 80px; }
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0;
}

.check input { margin: 2px 0 0; accent-color: var(--accent); }

button {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6a5cf0);
  color: #fff;
}

.btn-primary:hover:not(:disabled) { filter: brightness(1.09); }

.btn-secondary {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) { background: #29303e; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--line);
}

.btn-ghost:hover:not(:disabled) { color: var(--text); }

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

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.actions .spacer { flex: 1; }

/* ---------- typeahead ---------- */

.combo { position: relative; }

.combo-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel-2);
  border: 1px solid #3b4457;
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  padding: 5px;
}

.combo-item {
  padding: 9px 11px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}

.combo-item:hover,
.combo-item.active {
  background: var(--bg-soft);
  border-color: var(--line);
}

.combo-item .ci-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-item .ci-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.combo-item .ci-meta .sep { color: var(--text-faint); }
.combo-item .ci-meta .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
}

.combo-note {
  padding: 10px 11px;
  font-size: 13px;
  color: var(--text-faint);
}

.combo-item mark {
  background: rgba(124, 108, 255, 0.28);
  color: inherit;
  border-radius: 2px;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* ---------- feedback ---------- */

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
  white-space: pre-wrap;
}

.alert.error { background: rgba(255, 107, 107, 0.10); border-color: rgba(255, 107, 107, 0.42); color: #ffb4b4; }
.alert.ok    { background: rgba(61, 220, 151, 0.10); border-color: rgba(61, 220, 151, 0.40); color: #a5efcd; }
.alert.warn  { background: rgba(255, 196, 77, 0.10); border-color: rgba(255, 196, 77, 0.40); color: #ffdc9b; }
.alert.info  { background: rgba(79, 195, 247, 0.09); border-color: rgba(79, 195, 247, 0.34); color: #b6e4fb; }

.hidden { display: none !important; }

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 7px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.status-line {
  font-size: 13px;
  color: var(--text-dim);
  min-height: 20px;
}

/* ---------- resolved entity panels ---------- */

.resolved {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

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

.entity {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.entity.pending { border-left-color: var(--line); }
.entity.bad { border-left-color: var(--err); }

.entity .k {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 5px;
}

.entity .v {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.entity .meta {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.entity .open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-2);
  text-decoration: none;
}

.entity .open:hover { text-decoration: underline; }

.entity .open svg { opacity: 0.85; }

.tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
}

/* ---------- instructor list ---------- */

.people { margin-top: 18px; }

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.person .mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.person.found .mark  { background: rgba(61, 220, 151, 0.16); color: var(--ok); }
.person.missing .mark { background: rgba(255, 107, 107, 0.16); color: var(--err); }
.person.ambiguous .mark { background: rgba(255, 196, 77, 0.16); color: var(--warn); }
.person.busy .mark { background: var(--panel-2); color: var(--text-faint); }

.person .who { flex: 1; min-width: 0; }

.person .name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person .sub {
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person.missing .name { color: #ffb4b4; }

.person .drop {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 17px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.person .drop:hover { color: var(--err); }

.summary {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 12px;
}

/* ---------- log ---------- */

details.log {
  margin-top: 26px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}

details.log summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--text-faint);
  user-select: none;
}

details.log pre {
  margin: 0;
  padding: 0 14px 14px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--text-dim);
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.foot {
  margin-top: 30px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
}
