/* ───────────────────────────────────────────────────────────────────
   CSS Variables — Dark developer theme
   ─────────────────────────────────────────────────────────────────── */
:root {
  --bg-0: #0d1117;
  --bg-1: #161b22;
  --bg-2: #21262d;
  --bg-3: #30363d;

  --text-0: #e6edf3;
  --text-1: #8b949e;
  --text-2: #6e7681;

  --accent:       #1f6feb;
  --accent-hover: #388bfd;
  --accent-sub:   rgba(31, 111, 235, 0.15);

  --syn-keyword: #ff7b72;
  --syn-string:  #a5d6ff;
  --syn-func:    #d2a8ff;
  --syn-number:  #79c0ff;
  --syn-type:    #ffa657;
  --syn-bool:    #7ee787;

  --red:     #f85149;
  --red-sub: rgba(248, 81, 73, 0.12);
  --green:       #3fb950;
  --green-sub:   rgba(63, 185, 80, 0.12);
  --yellow:      #e3b341;
  --yellow-sub:  rgba(227, 179, 65, 0.12);

  --border:       #30363d;
  --border-muted: #21262d;

  --sidebar-w: 236px;
  --header-h:  54px;
  --radius:    6px;
  --radius-lg: 10px;
}

/* ───────────────────────────────────────────────────────────────────
   Reset & Base
   ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ───────────────────────────────────────────────────────────────────
   Login Screen
   ─────────────────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse at 15% 50%, rgba(31, 111, 235, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 20%, rgba(210, 168, 255, 0.06) 0%, transparent 50%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.login-logo { margin-bottom: 10px; }

.login-card h1 {
  font-size: 19px;
  font-weight: 600;
  color: var(--text-0);
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-1);
  margin-bottom: 14px;
}

.login-card form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  letter-spacing: 0.1px;
}

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-0);
  font-size: 13px;
  padding: 8px 10px 8px 32px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrap input::placeholder { color: var(--text-2); }

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-sub);
}

.login-error {
  font-size: 12px;
  color: var(--red);
  background: var(--red-sub);
  border: 1px solid rgba(248, 81, 73, 0.2);
  border-radius: var(--radius);
  padding: 0 10px;
  overflow: hidden;
  max-height: 0;
  transition: padding 0.2s, max-height 0.2s;
}

.login-error.visible {
  padding: 8px 10px;
  max-height: 60px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, opacity 0.15s;
  margin-top: 4px;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 0.7s linear infinite; }

/* ───────────────────────────────────────────────────────────────────
   App Layout
   ─────────────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.header {
  height: var(--header-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-text {
  font-size: 14px;
  color: var(--text-0);
  font-weight: 400;
  letter-spacing: -0.2px;
}

.brand-text strong { font-weight: 600; }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-email {
  font-size: 12px;
  color: var(--text-1);
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}

.btn-icon:hover {
  background: var(--bg-2);
  border-color: var(--text-2);
}

/* Body layout */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 0;
}

.sidebar-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-2);
  padding: 0 14px;
  margin-bottom: 6px;
}

#manual-list { list-style: none; }

.manual-item {
  cursor: pointer;
  padding: 9px 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border-left: 2px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}

.manual-item:hover:not(.disabled) { background: var(--bg-2); }

.manual-item.active {
  background: var(--accent-sub);
  border-left-color: var(--accent);
}

.manual-item.disabled {
  opacity: 0.38;
  cursor: default;
}

.manual-item-icon { flex-shrink: 0; margin-top: 1px; }

.manual-item-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.manual-item-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-0);
  line-height: 1.35;
}

.manual-item-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 3px;
  width: fit-content;
}

/* Content area */
.content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-0);
}

/* Welcome state */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 14px;
  padding: 40px;
  text-align: center;
}

.welcome-state h2 {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-0);
}

.welcome-state p {
  font-size: 13px;
  color: var(--text-1);
  max-width: 270px;
  line-height: 1.55;
}

/* Manual view */
.manual-view {
  padding: 32px 40px 48px;
  max-width: 820px;
}

.manual-header {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.manual-header h1 {
  font-size: 21px;
  font-weight: 600;
  color: var(--text-0);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.manual-header p {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
}

.step-count {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Steps */
.steps-list {
  display: flex;
  flex-direction: column;
}

.step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-muted);
}

.step:last-child { border-bottom: none; }

.step-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 1px;
}

.step-num-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.step-connector {
  flex: 1;
  width: 1px;
  background: var(--border-muted);
  margin-top: 5px;
}

.step:last-child .step-connector { display: none; }

.step-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding-bottom: 4px;
}

.step-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-0);
  line-height: 1.3;
  margin-top: 2px;
}

.step-text {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.65;
}

.step-text code,
.step-list li code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11.5px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--syn-string);
}

.step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step-list li {
  font-size: 13px;
  color: var(--text-1);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}

.step-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--bg-3);
}

/* Code blocks */
.code-block {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.code-block-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.code-lang {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  font-family: inherit;
}

.copy-btn:hover {
  background: var(--bg-3);
  color: var(--text-1);
  border-color: var(--text-2);
}

.copy-btn.copied {
  color: var(--syn-bool);
  border-color: rgba(63, 185, 80, 0.4);
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--bg-1) !important;
}

.code-block pre code.hljs {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
}

/* Notes / Callouts */
.note {
  display: flex;
  gap: 9px;
  padding: 10px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
}

.note.info {
  background: var(--accent-sub);
  border: 1px solid rgba(31, 111, 235, 0.28);
}

.note.warning {
  background: var(--yellow-sub);
  border: 1px solid rgba(227, 179, 65, 0.28);
}

.note.success {
  background: var(--green-sub);
  border: 1px solid rgba(63, 185, 80, 0.28);
}

.note-icon { flex-shrink: 0; margin-top: 1px; }

/* Downloads */
.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--syn-string);
  text-decoration: none;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.download-link:hover {
  background: var(--accent-sub);
  border-color: rgba(31, 111, 235, 0.5);
  color: var(--accent-hover);
}

.download-link.sensitive {
  color: var(--yellow);
  border-color: rgba(227, 179, 65, 0.28);
}

.download-link.sensitive:hover {
  background: var(--yellow-sub);
  border-color: var(--yellow);
  color: var(--yellow);
}

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }
