/* ── open-think TUI dashboard ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0c;
  --pane-bg: #0f1115;
  --pane-bg-soft: #13161c;
  --border: #2a2f3a;
  --border-bright: #4a5160;
  --fg: #e4e7ec;
  --fg-dim: #9ba3b0;
  --fg-faint: #6b7280;
  --green: #5af78e;
  --cyan: #57c7ff;
  --yellow: #f3f99d;
  --magenta: #ff6ac1;
  --red: #ff5c57;
  --accent: #ff6ac1;
  --accent-soft: rgba(255, 106, 193, 0.12);
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
code { font-family: inherit; color: var(--cyan); }
button { font: inherit; background: none; border: none; color: inherit; cursor: pointer; }

.app {
  max-width: 1240px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

/* ── Tab bar ── */
.tabbar {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--pane-bg);
}
.tab {
  padding: 0.7rem 1.4rem;
  color: var(--fg-dim);
  border-right: 1px solid var(--border);
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: color 0.12s, background 0.12s;
}
.tab:hover:not(.active) { color: var(--cyan); background: rgba(87, 199, 255, 0.04); }
.tab.active {
  color: #0a0a0c;
  background: var(--accent);
  font-weight: 700;
}
.tab.active .key { color: #0a0a0c; }
.tab .key { color: var(--accent); font-weight: 700; }
.tab-spacer { flex: 1; border-right: 1px solid var(--border); }
.tab-meta {
  padding: 0.7rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 11px;
  color: var(--fg-dim);
}
.pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  background: rgba(90, 247, 142, 0.08);
  border: 1px solid rgba(90, 247, 142, 0.35);
  color: var(--green);
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.05em;
}
.dim { color: var(--fg-faint); }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
}

/* ── Pane ── */
.pane {
  border: 1px solid var(--border);
  background: var(--pane-bg);
  position: relative;
  padding: 1.5rem 1.25rem 1.25rem;
}
.pane + .pane { border-left: none; }
.pane-title {
  position: absolute;
  top: -0.65em;
  left: 1rem;
  background: var(--bg);
  padding: 0 0.5rem;
  color: var(--cyan);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pane-title .key { color: var(--accent); }

/* ── Sidebar ── */
.sidebar { min-height: 0; }
.nav-tree { line-height: 1.95; font-size: 12.5px; }
.nav-tree .group {
  color: var(--fg-faint);
  margin-top: 1.1rem;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-tree .group:first-child { margin-top: 0.2rem; }
.nav-tree a {
  display: block;
  color: var(--fg);
  text-decoration: none;
  padding-left: 1.2rem;
  position: relative;
  transition: color 0.12s, transform 0.12s;
}
.nav-tree a::before {
  content: '├─';
  color: var(--fg-faint);
  position: absolute;
  left: 0;
}
.nav-tree a.last::before { content: '└─'; }
.nav-tree a:hover {
  color: var(--cyan);
  text-decoration: none;
  transform: translateX(2px);
}
.nav-tree a.current {
  color: var(--green);
}
.nav-tree a.current::after { content: ' ●'; color: var(--green); }
.nav-tree a:focus-visible {
  outline: none;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Main pane ── */
.main-pane { padding: 2.25rem 2.25rem; min-height: 75vh; }
.view { display: none; animation: fadeIn 0.25s ease-out; }
.view.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.main-pane p {
  color: var(--fg-dim);
  margin: 0.5rem 0 1.25rem;
  max-width: 65ch;
  font-size: 13.5px;
  line-height: 1.7;
}
.main-pane p strong { color: var(--fg); font-weight: 700; }
.main-pane p code { color: var(--green); font-size: 12.5px; padding: 0.05em 0.3em; background: rgba(90,247,142,0.08); border-radius: 2px; }
.main-pane p a { color: var(--cyan); }

/* ── Hero (Home view) ── */
.hero { margin-bottom: 2rem; }
.badge {
  display: inline-block;
  color: var(--fg-dim);
  font-size: 11px;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border-bright);
  border-radius: 100px;
  margin-bottom: 1.5rem;
}
.badge .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 0.45rem;
  box-shadow: 0 0 6px rgba(90, 247, 142, 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}
.hero h1 {
  font-size: 2.6rem;
  line-height: 1.05;
  margin: 0 0 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.hero h1 .accent { color: var(--accent); }
.hero .lead {
  color: var(--fg-dim);
  font-size: 14px;
  max-width: 60ch;
  margin: 0 0 1.75rem;
  line-height: 1.7;
}
.install-line {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  background: var(--pane-bg-soft);
  border: 1px solid var(--border-bright);
  color: var(--fg);
  font-size: 13px;
}
.install-line .prompt { color: var(--green); margin-right: 0.6rem; }
.install-note {
  color: var(--fg-faint);
  font-size: 11px;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

/* ── Section headers ── */
.view-title {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 0 0 0.4rem;
  font-weight: 700;
}
.view-sub {
  color: var(--fg-dim);
  font-size: 13.5px;
  margin: 0 0 2rem !important;
  max-width: 65ch;
}
h2.section-h {
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 2.5rem 0 0.6rem;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 0.4rem;
  font-weight: 700;
}

/* ── Concept grid ── */
.concept-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0;
  margin: 0 0 1rem;
}
.concept {
  border: 1px solid var(--border);
  padding: 1.1rem 1.2rem 1.2rem;
  margin: -1px 0 0 -1px;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.concept:hover {
  background: var(--pane-bg-soft);
  border-color: var(--border-bright);
  z-index: 2;
}
.concept .num {
  color: var(--accent);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.concept h3 {
  margin: 0.3rem 0 0.6rem;
  color: var(--green);
  font-size: 1rem;
  font-weight: 700;
}
.concept p {
  margin: 0 0 0.85rem !important;
  color: var(--fg-dim);
  font-size: 12px !important;
  line-height: 1.6 !important;
  max-width: none !important;
}
.concept .demo {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  font-size: 11px;
  line-height: 1.6;
}
.demo .prompt { color: var(--green); }
.demo .out { color: var(--fg-dim); }
.demo .check { color: var(--green); }
.demo .dim { color: var(--fg-faint); }
.demo .cyan { color: var(--cyan); }

/* ── Architecture ── */
.arch-ascii {
  color: var(--fg-faint);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
  margin: 1.25rem 0 0;
  overflow-x: auto;
  padding: 1rem 0;
}
.arch-ascii .g { color: var(--green); }
.arch-ascii .c { color: var(--cyan); }
.arch-ascii .y { color: var(--yellow); }
.arch-ascii .dim { color: var(--fg-faint); }

/* ── Install steps ── */
ol.steps {
  list-style: none;
  counter-reset: step;
  margin: 0.5rem 0 0;
}
ol.steps li {
  counter-increment: step;
  padding: 1.1rem 0 1.1rem 3.2rem;
  border-bottom: 1px dashed var(--border);
  position: relative;
}
ol.steps li:first-child { padding-top: 0; }
ol.steps li:last-child { border-bottom: none; }
ol.steps li::before {
  content: '[' counter(step, decimal-leading-zero) ']';
  color: var(--accent);
  position: absolute;
  left: 0;
  top: 1.1rem;
  font-weight: 700;
  font-size: 12px;
}
ol.steps li:first-child::before { top: 0; }
ol.steps li h3 {
  margin: 0 0 0.5rem;
  font-size: 13.5px;
  color: var(--fg);
  font-weight: 700;
}
ol.steps li .terminal {
  background: var(--pane-bg-soft);
  border: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  font-size: 12.5px;
  color: var(--fg);
}
ol.steps li .terminal + .terminal { margin-top: 0.4rem; }
ol.steps li .terminal .prompt { color: var(--green); margin-right: 0.5rem; }
ol.steps li .note {
  margin: 0.6rem 0 0 !important;
  color: var(--fg-faint) !important;
  font-size: 11.5px !important;
  font-style: italic;
}

/* ── Link list (Docs view) ── */
ul.link-list {
  list-style: none;
  margin: 1rem 0;
}
ul.link-list li {
  display: grid;
  grid-template-columns: 140px 1fr;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
ul.link-list .link-label {
  color: var(--fg-faint);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding-top: 0.2rem;
}

/* ── Status bar ── */
.statusbar {
  display: flex;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--pane-bg);
  font-size: 11px;
  align-items: center;
}
.statusbar .left, .statusbar .right { padding: 0.55rem 1rem; }
.statusbar .left { color: var(--green); display: flex; align-items: center; gap: 0.5rem; }
.statusbar .spacer { flex: 1; }
.statusbar .right { color: var(--fg-dim); display: flex; gap: 1.1rem; }
.statusbar .right span { white-space: nowrap; }
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(90, 247, 142, 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(90, 247, 142, 0.7); }
  50% { opacity: 0.55; box-shadow: 0 0 2px rgba(90, 247, 142, 0.3); }
}
.key-pill {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  background: rgba(255, 106, 193, 0.12);
  color: var(--accent);
  border: 1px solid rgba(255, 106, 193, 0.35);
  border-radius: 2px;
  margin-right: 0.35rem;
  font-size: 10.5px;
  font-weight: 700;
}

/* ── Help modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease-out;
}
.modal[hidden] { display: none; }
.modal-pane {
  background: var(--pane-bg);
  border: 1px solid var(--border-bright);
  padding: 2rem 2.5rem;
  min-width: 320px;
  max-width: 90vw;
  position: relative;
}
.modal-pane h3 {
  margin: 0 0 1rem;
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  color: var(--fg-faint);
  font-size: 1.4rem;
  line-height: 1;
}
.modal-close:hover { color: var(--accent); }
.help-table { border-collapse: collapse; }
.help-table td {
  padding: 0.3rem 1rem 0.3rem 0;
  font-size: 12px;
  color: var(--fg-dim);
  vertical-align: middle;
}
.help-table td:first-child { white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 820px) {
  .app { padding: 0.75rem; }
  .layout { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 1px solid var(--border); border-top: none; }
  .main-pane { padding: 1.5rem 1.25rem; }
  .hero h1 { font-size: 1.9rem; }
  .tabbar { overflow-x: auto; }
  .tab-meta { display: none; }
  .statusbar .right { gap: 0.6rem; font-size: 10px; }
  .sidebar { padding-top: 1.2rem; }
}

@media (max-width: 480px) {
  .statusbar .right span:nth-child(n+4) { display: none; }
  .concept-list { grid-template-columns: 1fr; }
}
