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

:root {
  --bg:           #0d0f11;
  --bg-raised:    #13171a;
  --bg-card:      #181d21;
  --bg-hover:     #1e242a;
  --border:       #252c33;
  --border-light: #2e3740;

  --text:         #d4dce6;
  --text-muted:   #6b7a8d;
  --text-dim:     #3d4a58;

  --accent:       #e8f04a;   /* electric yellow — the one pop of colour */
  --accent-dim:   #b8be3a;

  --green:        #3dffa0;
  --red:          #ff4d6a;
  --orange:       #ff8c42;
  --blue:         #4db8ff;
  --purple:       #b46fff;

  --font-display: 'Syne', sans-serif;
  --font-mono:    'Space Mono', monospace;

  --radius:       4px;
  --radius-lg:    8px;
  --transition:   150ms ease;
}

/* ── Base ──────────────────────────────────────────────── */
html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: 0.8; }

/* ── Nav ───────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  color: var(--accent);
  font-size: 1.2rem;
}

.navbar-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  letter-spacing: 0.03em;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--bg-hover);
  opacity: 1;
}

.nav-link.active { color: var(--accent); }
.nav-link-muted { font-size: 0.8rem; color: var(--text-dim); }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0d0f11;
  font-weight: 700;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dim); color: #0d0f11; opacity: 1; border-color: var(--accent-dim); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-light);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-muted); color: var(--text); opacity: 1; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); opacity: 1; }

.btn-danger { border-color: var(--red); color: var(--red); background: transparent; }
.btn-danger:hover { background: rgba(255,77,106,0.1); opacity: 1; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.72rem; }

/* ── Layout ────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-body { padding: 1.25rem; }

/* ── Dashboard Grid ────────────────────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}

.stat-block {
  background: var(--bg-card);
  padding: 1.25rem 1.5rem;
  position: relative;
}

.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.yellow { color: var(--accent); }
.stat-value.blue { color: var(--blue); }

/* ── Dashboard Layout ──────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.category-section {}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.category-icon { font-size: 1rem; }

.project-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
}

/* ── Project Card ──────────────────────────────────────── */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition);
}

.project-card:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
  opacity: 1;
}

.project-card.status-active::before { background: var(--green); }
.project-card.status-blocked::before { background: var(--red); }
.project-card.status-paused::before { background: var(--accent); }
.project-card.status-complete::before { background: var(--blue); }

.project-card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.project-card-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.task-count {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ── Badges & Pills ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-green  { background: rgba(61,255,160,0.12); color: var(--green); }
.badge-red    { background: rgba(255,77,106,0.12); color: var(--red); }
.badge-yellow { background: rgba(232,240,74,0.12); color: var(--accent); }
.badge-blue   { background: rgba(77,184,255,0.12); color: var(--blue); }
.badge-purple { background: rgba(180,111,255,0.12); color: var(--purple); }
.badge-gray   { background: rgba(107,122,141,0.15); color: var(--text-muted); }
.badge-orange { background: rgba(255,140,66,0.12); color: var(--orange); }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Activity Feed ─────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.activity-item:last-child { border-bottom: none; }

.activity-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.activity-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.activity-project {
  font-size: 0.72rem;
  color: var(--accent);
}

/* ── Agent Queue ───────────────────────────────────────── */
.queue-item {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-raised);
  transition: border-color var(--transition);
}

.queue-item:hover { border-color: var(--border-light); }

.queue-icon { color: var(--text-dim); font-size: 0.9rem; flex-shrink: 0; margin-top: 2px; }

.queue-item-title {
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.3;
}

.queue-item-project {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* ── Tables ────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

th {
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ── Forms ─────────────────────────────────────────────── */
.form-section {
  max-width: 640px;
}

.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: border-color var(--transition);
  outline: none;
  appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

textarea { min-height: 100px; resize: vertical; }

.form-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Priority indicators ───────────────────────────────── */
.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.priority-high   { background: var(--red); box-shadow: 0 0 4px var(--red); }
.priority-medium { background: var(--accent); }
.priority-low    { background: var(--text-dim); }

/* ── Project detail ────────────────────────────────────── */
.project-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.project-detail-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.project-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}

/* ── Inline task row ───────────────────────────────────── */
.task-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.task-row:last-child { border-bottom: none; }
.task-row-title { flex: 1; font-size: 0.85rem; }
.task-row-meta { display: flex; align-items: center; gap: 0.5rem; }

/* ── Login ─────────────────────────────────────────────── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand-icon {
  font-size: 2.5rem;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

.login-brand-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* ── Flash messages ────────────────────────────────────── */
.flash {
  padding: 0.7rem 2rem;
  font-size: 0.82rem;
  border-bottom: 1px solid transparent;
}
.flash-notice { background: rgba(61,255,160,0.08); border-color: rgba(61,255,160,0.2); color: var(--green); }
.flash-alert  { background: rgba(255,77,106,0.08); border-color: rgba(255,77,106,0.2); color: var(--red); }

/* ── Footer ────────────────────────────────────────────── */
.footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.footer-sep { color: var(--text-dim); }

/* ── Utilities ─────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.flex { display: flex; align-items: center; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Chat Layout ───────────────────────────────────────── */
.chat-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: calc(100vh - 52px - 2rem - 48px);
  min-height: 500px;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-sidebar-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-list-item {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--bg-hover);
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: background var(--transition);
}

.chat-list-item:hover,
.chat-list-item.active { background: var(--bg-hover); opacity: 1; }

.chat-list-item-title {
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-item-meta {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.provider-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.provider-dot-claude    { background: #e8883a; }
.provider-dot-openai    { background: var(--green); }
.provider-dot-synthetic { background: var(--purple); }

.chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}

.chat-provider-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(232,136,58,0.12);
  color: #e8883a;
}
.chat-provider-badge.openai    { background: rgba(61,255,160,0.12); color: var(--green); }
.chat-provider-badge.synthetic { background: rgba(180,111,255,0.12); color: var(--purple); }

.chat-ctx-bar {
  padding: 0.35rem 1rem;
  background: rgba(180,111,255,0.04);
  border-bottom: 1px solid rgba(180,111,255,0.08);
  font-size: 0.65rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.chat-ctx-pill {
  background: rgba(180,111,255,0.1);
  color: var(--purple);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.62rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chat-msg-user {
  align-self: flex-end;
}

.chat-msg-assistant {
  align-self: flex-start;
}

.chat-msg-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chat-msg-user .chat-msg-label { text-align: right; }

.chat-msg-bubble {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-user .chat-msg-bubble {
  background: rgba(232,240,74,0.08);
  border: 1px solid rgba(232,240,74,0.15);
  border-radius: 8px 8px 2px 8px;
  color: var(--text);
}

.chat-msg-assistant .chat-msg-bubble {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 2px 8px 8px 8px;
  color: var(--text);
}

.chat-input-area {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-form-inline {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex: 1;
}

.chat-form-inline .chat-input-box {
  flex: 1;
}

.chat-input-box {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  resize: none;
  background: var(--bg-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  outline: none;
  line-height: 1.4;
}

.chat-input-box:focus { border-color: var(--accent); }

.chat-run-btn {
  background: rgba(77,184,255,0.1);
  color: var(--blue);
  border: 1px solid rgba(77,184,255,0.25);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all var(--transition);
}
.chat-run-btn:hover { background: rgba(77,184,255,0.18); opacity: 1; }

/* ── Mobile chat override ──────────────────────────────── */
@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 52px - 1rem - 56px);
  }

  .chat-sidebar  { display: none; }
  .chat-sidebar.mobile-visible  { display: flex; width: 100%; }
  .chat-main     { display: none; }
  .chat-main.mobile-visible     { display: flex; }

  [data-chat-target="layout"][data-mobile-view="list"] .chat-sidebar { display: flex; }
  [data-chat-target="layout"][data-mobile-view="list"] .chat-main    { display: none; }
  [data-chat-target="layout"][data-mobile-view="chat"] .chat-sidebar { display: none; }
  [data-chat-target="layout"][data-mobile-view="chat"] .chat-main    { display: flex; }
/* ── Category Index ────────────────────────────────── */
.category-index-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.category-index-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
}

.category-index-card:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
  opacity: 1;
}

.category-index-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.category-index-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.category-index-stats {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

/* ── Detail Grid (2-col layout used in project/task show) ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}

/* ── Bottom Tab Nav (mobile only) ──────────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color var(--transition);
}

.mobile-tab:hover,
.mobile-tab.active {
  color: var(--accent);
  opacity: 1;
}

.mobile-tab-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.mobile-tab-label {
  font-size: 0.52rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

/* ── Mobile Breakpoint ─────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-links,
  .navbar-actions { display: none; }

  .navbar {
    padding: 0 1rem;
    justify-content: space-between;
  }

  /* Show brand + a standalone new project button on mobile */
  .navbar-mobile-action { display: flex; align-items: center; gap: 0.75rem; }

  .mobile-bottom-nav { display: flex; }

  .main-content {
    padding: 1rem;
    padding-bottom: 5rem; /* clear fixed bottom nav */
  }

  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }

  .dashboard-grid { grid-template-columns: 1fr; }

  .project-detail-grid { grid-template-columns: 1fr; }

  .detail-grid { grid-template-columns: 1fr; }

  .page-title { font-size: 1.4rem; }

  .page-header {
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
  }

  .category-index-grid { grid-template-columns: repeat(2, 1fr); }

  .project-cards { grid-template-columns: 1fr; }

  .form-section { max-width: 100%; }

  .login-card { width: 100%; max-width: 360px; }
}

/* ── Loading Animation ──────────────────────────────────── */
.loading-dots span {
  animation: loadingDots 1.4s infinite;
  opacity: 0.3;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingDots {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* ── Chat Typing Indicator ──────────────────────────────── */
.chat-typing {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  padding: 0.15rem 0;
}

.chat-typing-dot {
  width: 9px;
  height: 9px;
  background: #6b7a8d;
  border-radius: 50%;
  display: inline-block;
  animation: chatTyping 1.4s infinite ease-in-out both;
}

.chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatTyping {
  0%, 80%, 100% { transform: scale(0); }
  40%           { transform: scale(1); }
}

/* ── Markdown Body ──────────────────────────────────────── */
.markdown-body { line-height: 1.6; }
.markdown-body p { margin: 0 0 0.6em; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255,255,255,0.07);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.markdown-body pre {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.5em 0;
}
.markdown-body pre code { background: none; padding: 0; font-size: 0.82em; }
.markdown-body ul, .markdown-body ol { padding-left: 1.4em; margin: 0.4em 0; }
.markdown-body li { margin-bottom: 0.2em; }
.markdown-body h1,.markdown-body h2,.markdown-body h3 { font-weight: 700; margin: 0.8em 0 0.3em; line-height: 1.3; }
.markdown-body h1 { font-size: 1.15em; }
.markdown-body h2 { font-size: 1.05em; }
.markdown-body h3 { font-size: 0.95em; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 0.5em 0; font-size: 0.88em; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 0.35em 0.6em; text-align: left; }
.markdown-body th { background: rgba(255,255,255,0.05); font-weight: 600; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 0.75em 0; }
.markdown-body a { color: var(--accent, #e8f04a); }

/* ── Enhanced Chat UI ──────────────────────────────────── */

/* Chat send button */
.chat-send-btn {
  background: var(--accent);
  color: #0d0f11;
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--accent-dim);
}

.chat-send-btn svg {
  width: 16px;
  height: 16px;
}

/* Chat input hint */
.chat-input-hint {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.5rem;
  opacity: 0.7;
}

/* Welcome screen for empty conversations */
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-welcome-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 1rem;
  opacity: 0.8;
}

.chat-welcome-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.chat-welcome-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 400px;
}

/* Chat header improvements */
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.chat-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--bg-hover);
  transition: all var(--transition);
}

.chat-new-btn:hover {
  color: var(--text);
  background: var(--border-light);
}

/* Utility classes for responsive visibility */
.desktop-only { display: inline; }
.mobile-only { display: none; }

/* ── Mobile Chat Enhancements ─────────────────────────── */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline !important; }

  /* Full-screen chat on mobile */
  .chat-layout {
    height: calc(100vh - 52px - 56px) !important; /* navbar + bottom nav */
    min-height: auto;
    border: none;
    border-radius: 0;
  }

  /* Larger message bubbles on mobile */
  .chat-msg {
    max-width: 90%;
  }

  .chat-msg-bubble {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
  }

  /* Prominent input area */
  .chat-input-area {
    padding: 1rem;
    background: var(--bg-raised);
    border-top: 1px solid var(--border);
  }

  .chat-input-box {
    min-height: 44px;
    max-height: 150px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.6rem 1rem;
  }

  .chat-send-btn {
    width: 44px;
    height: 44px;
  }

  .chat-send-btn svg {
    width: 18px;
    height: 18px;
  }

  /* Simpler header on mobile */
  .chat-header {
    padding: 0.75rem 1rem;
    background: var(--bg-raised);
  }

  .chat-header-title {
    font-size: 1rem;
  }

  /* Welcome screen adjustments */
  .chat-welcome {
    padding: 1.5rem;
  }

  .chat-welcome-icon {
    font-size: 2.5rem;
  }

  .chat-welcome-title {
    font-size: 1.25rem;
  }

  .chat-welcome-subtitle {
    font-size: 0.8rem;
  }

  /* Hide context bar on mobile */
  .chat-ctx-bar {
    display: none;
  }

  /* More padding for messages */
  .chat-messages {
    padding: 1rem;
    gap: 1rem;
  }
}
