:root {
  --bg: #0d1117;
  --surface-1: #161b22;
  --surface-2: #1c2128;
  --border: #21262d;
  --text-primary: #c9d1d9;
  --text-secondary: #a3acb8;
  --text-tertiary: #8b949e;
  --accent: #39d353;
  --accent-on: #0d1117;
  --warning: #d29922;
  --danger: #f85149;

  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-xl: 22px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  --radius: 3px;
  --radius-sm: 2px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

nav {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-6);
}
nav .brand { color: var(--accent); font-weight: 600; font-size: var(--text-base); }

.container { max-width: 900px; margin: 0 auto; padding: var(--space-6) var(--space-4); }

.text-muted, .text-tertiary { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }
.d-none { display: none; }

.note {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: var(--text-xs);
}

.badge {
  display: inline-block;
  border: 1px solid var(--text-tertiary);
  color: var(--text-tertiary);
  padding: 0 5px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

/* Breadcrumb */
.breadcrumb {
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  color: var(--text-tertiary);
}
.breadcrumb a { color: var(--accent); }
.breadcrumb .sep { color: var(--text-tertiary); padding: 0 var(--space-1); }

/* Inputs */
.input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  outline: none;
  border-radius: var(--radius);
}
.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Buttons */
.btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 1px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  background: none;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
  border: none;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
}
.btn-secondary {
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn-secondary-warning {
  border: 1px solid var(--warning);
  color: var(--warning);
}
.btn-secondary-muted {
  border: 1px solid var(--text-tertiary);
  color: var(--text-tertiary);
}
.btn-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-1) var(--space-3);
}
.btn-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}
.btn-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Dense row pattern (lists + grid-based tables) */
.row-list .row,
.row-grid .row {
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding: var(--space-2) 0;
  color: inherit;
  text-decoration: none;
}
.row-list .row {
  display: flex;
}
.row-list .row:hover,
.row-grid .row:hover {
  background: var(--surface-2);
}
.row-list .row:focus-visible {
  background: var(--surface-2);
  outline: none;
  box-shadow: inset 2px 0 0 var(--accent);
}
.row-grid .row:focus-within {
  background: var(--surface-2);
  outline: none;
  box-shadow: inset 2px 0 0 var(--accent);
}

/* Notice banners */
.notice {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}
.notice-warning {
  border: 1px solid var(--warning);
  color: var(--warning);
  padding: var(--space-2);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
}

/* Quoted text (lines beginning with '>') */
.quote {
  color: var(--text-tertiary);
  border-left: 2px solid var(--border);
  padding-left: var(--space-2);
  display: inline-block;
}

/* Message body (long-form reading) */
.message-body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  max-width: 70ch;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Empty state */
.empty-state {
  color: var(--text-tertiary);
  padding: var(--space-6) 0;
}

/* Thread-list grid (group.html) */
.thread-row-grid {
  display: grid;
  grid-template-columns: 1fr minmax(120px, 200px) minmax(70px, 90px) minmax(30px, 44px);
  gap: 0 var(--space-3);
  align-items: baseline;
  padding: var(--space-2) 0;
}

/* OTP code input (otp.html) */
.input-otp {
  font-size: 24px;
  letter-spacing: 12px;
  text-align: center;
  color: var(--accent);
  padding: var(--space-3);
}
