/* ═══════════════════════════════════════════
   Second Brain Copilot — Styles
   Notion-inspired design system
   ═══════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg: #ffffff;
  --bg-secondary: #f7f6f3;
  --bg-tertiary: #f0efec;
  --bg-hover: #ededec;
  --text: #37352f;
  --text-secondary: #6b6b6b;
  --text-tertiary: #9b9a97;
  --border: #e3e2df;
  --border-light: #eeeeec;
  --accent: #2eaadc;
  --accent-hover: #258db3;
  --accent-light: #e8f4f8;
  --success: #0f7b6c;
  --success-light: #dbeddb;
  --warning: #d9730d;
  --warning-light: #fdecc8;
  --danger: #e03e3e;
  --danger-light: #fbe4e4;
  --purple: #6940a5;
  --purple-light: #eae4f2;
  --pink: #ad1a72;
  --pink-light: #f4dfeb;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Consolas, "PT Mono", monospace;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --transition: 150ms ease;
  --sidebar-width: 260px;
  --topbar-height: 48px;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

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

img { max-width: 100%; display: block; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
}

code {
  background: var(--bg-tertiary);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.85em;
}

pre code { background: none; padding: 0; }

/* ── Utility ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.btn:hover { background: var(--bg-hover); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-light); }

.btn-lg { padding: 10px 24px; font-size: 1rem; border-radius: var(--radius-lg); }

.btn-ghost {
  border: none;
  background: none;
  color: var(--text-secondary);
}

.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.875rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.form-textarea { min-height: 80px; resize: vertical; }

.form-select { cursor: pointer; }

.form-hint { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 2px; }

/* ── Badges / Tags ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 3px;
  white-space: nowrap;
}

.badge-default { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-blue { background: var(--accent-light); color: #1a6d8e; }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: #9a5b13; }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-pink { background: var(--pink-light); color: var(--pink); }

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

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

th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
}

th {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover { background: var(--bg-hover); }

/* ── Cards ── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover { box-shadow: var(--shadow); border-color: #d0cfc9; }

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   LANDING PAGE
   ═══════════════════════════════════════════ */

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.navbar-brand:hover { text-decoration: none; }

.navbar-logo {
  width: 28px;
  height: 28px;
  background: var(--text);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.875rem;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.navbar-links a {
  padding: 6px 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.navbar-links a:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Features Grid ── */
.features {
  padding: 60px 24px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.feature-card {
  text-align: center;
  padding: 32px 24px;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}

.feature-icon-blue { background: var(--accent-light); }
.feature-icon-green { background: var(--success-light); }
.feature-icon-purple { background: var(--purple-light); }

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Hub Showcase ── */
.hub-showcase {
  padding: 60px 24px;
  background: var(--bg-secondary);
}

.section-title {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 1rem;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  max-width: 1000px;
  margin: 0 auto;
}

.hub-card {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: default;
}

.hub-card-icon {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.hub-card h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.hub-card p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ── How it works ── */
.how-it-works {
  padding: 60px 24px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.step h3 { font-size: 1rem; margin-bottom: 6px; }
.step p { font-size: 0.875rem; color: var(--text-secondary); }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border-light);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* ═══════════════════════════════════════════
   DASHBOARD (app.html)
   ═══════════════════════════════════════════ */

/* ── Login Screen ── */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 24px;
}

.login-screen h1 { font-size: 1.5rem; }
.login-screen p { color: var(--text-secondary); }

/* ── App Shell ── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  z-index: 10;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
}

.topbar-brand:hover { text-decoration: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* ── Sidebar ── */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  padding: 12px 8px;
  overflow-y: auto;
}

.sidebar-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 8px 10px 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  cursor: pointer;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--bg-hover);
  color: var(--text);
  font-weight: 500;
}

.sidebar-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

/* ── Content Area ── */
.content {
  padding: 24px 32px;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-height));
}

.content-header {
  margin-bottom: 24px;
}

.content-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.content-header p {
  color: var(--text-secondary);
  margin-top: 4px;
}

.content-header-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ── Hub Grid (dashboard home) ── */
.hub-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.hub-overview-card {
  padding: 20px;
  cursor: pointer;
}

.hub-overview-card:hover { border-color: var(--accent); }

.hub-overview-icon { font-size: 1.6rem; margin-bottom: 8px; }

.hub-overview-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.hub-overview-card .meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ── Schema Table ── */
.schema-table th:first-child,
.schema-table td:first-child { min-width: 160px; }

.schema-table .type-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 3px;
  font-family: var(--font-mono);
}

/* ── Filter Toolbar ── */
.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.filter-toolbar .form-input,
.filter-toolbar .form-select {
  width: auto;
  min-width: 120px;
}

/* ── Page Detail ── */
.page-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

.page-detail-grid .prop-group { margin-bottom: 8px; }

.prop-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prop-value {
  font-size: 0.875rem;
}

.prop-value a { color: var(--accent); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 0.875rem; }

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-state {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 40px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   DOCS PAGE
   ═══════════════════════════════════════════ */

.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 56px);
}

.docs-sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--border-light);
  padding: 20px 16px;
  background: var(--bg-secondary);
}

.docs-sidebar-section {
  margin-bottom: 20px;
}

.docs-sidebar-section h4 {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  padding-left: 8px;
}

.docs-sidebar-section a {
  display: block;
  padding: 4px 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  border-radius: var(--radius);
  transition: background var(--transition);
}

.docs-sidebar-section a:hover {
  background: var(--bg-hover);
  text-decoration: none;
  color: var(--text);
}

.docs-sidebar-section a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.docs-content {
  padding: 40px 48px;
  max-width: 860px;
}

.docs-content h1 { font-size: 2rem; margin-bottom: 8px; }
.docs-content h2 { font-size: 1.4rem; margin-top: 48px; margin-bottom: 12px; padding-top: 24px; border-top: 1px solid var(--border-light); }
.docs-content h3 { font-size: 1.1rem; margin-top: 28px; margin-bottom: 8px; }
.docs-content p { margin-bottom: 12px; }
.docs-content ul, .docs-content ol { margin-bottom: 12px; padding-left: 24px; }
.docs-content li { margin-bottom: 4px; }

.docs-content .endpoint {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.method-badge {
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 3px;
  font-family: var(--font-mono);
}

.method-get { background: var(--accent-light); color: #1a6d8e; }
.method-post { background: var(--success-light); color: var(--success); }
.method-patch { background: var(--warning-light); color: #9a5b13; }
.method-delete { background: var(--danger-light); color: var(--danger); }

.endpoint-path { font-family: var(--font-mono); font-size: 0.875rem; }

.endpoint-body { padding: 14px; }
.endpoint-body p { font-size: 0.875rem; }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease-out;
  max-width: 360px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }

@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast-out {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-out {
  to { transform: translateY(12px); opacity: 0; }
}

/* ── Autocomplete / People Search ── */
.autocomplete-wrap { position: relative; }

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
}

.autocomplete-item {
  padding: 8px 10px;
  font-size: 0.875rem;
  cursor: pointer;
}

.autocomplete-item:hover { background: var(--bg-hover); }

.autocomplete-item .name { font-weight: 500; }
.autocomplete-item .email { font-size: 0.75rem; color: var(--text-tertiary); }

.people-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.people-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-light);
  border-radius: 3px;
  font-size: 0.8125rem;
}

.people-tag-remove {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1;
}

.people-tag-remove:hover { color: var(--danger); }

/* ═══════════════════════════════════════════
   CHAT PAGE (chat.html)
   ═══════════════════════════════════════════ */

/* ── Chat Shell ── */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
}

/* ── Chat Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-header-left { display: flex; flex-direction: column; }

.chat-header-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.chat-header-subtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

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

/* ── Messages Area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Welcome Screen ── */
.chat-welcome {
  text-align: center;
  padding: 60px 20px 40px;
  margin: auto 0;
}

.chat-welcome-icon { font-size: 3rem; margin-bottom: 16px; }
.chat-welcome h2 { font-size: 1.4rem; margin-bottom: 8px; }
.chat-welcome p { color: var(--text-secondary); max-width: 420px; margin: 0 auto 24px; }

.chat-suggestions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.chat-suggestion {
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.chat-suggestion:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ── Chat Bubbles ── */
.chat-bubble-wrap {
  display: flex;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.chat-bubble-user { justify-content: flex-end; }
.chat-bubble-assistant { justify-content: flex-start; }
.chat-bubble-error { justify-content: flex-start; }

.chat-bubble {
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
}

.chat-bubble-user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble-assistant .chat-bubble {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}

.chat-bubble-err {
  background: var(--danger-light) !important;
  color: var(--danger) !important;
  border: 1px solid var(--danger) !important;
}

/* ── Typing Indicator ── */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 18px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Query Results Card ── */
.chat-results-card {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
  font-weight: 500;
}

.chat-results-table-wrap {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: auto;
}

.chat-results-card table { font-size: 0.8125rem; }
.chat-results-card th { font-size: 0.75rem; }
.chat-results-card td { padding: 6px 12px; }

.chat-result-row[data-url] {
  cursor: pointer;
}

.chat-result-row[data-url]:hover {
  background: var(--accent-light) !important;
}

.chat-results-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.chat-results-more {
  padding: 8px 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border-light);
}

/* ── Confirmation Card ── */
.chat-confirm-card {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.chat-confirm-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-confirm-icon { font-size: 1.2rem; }

.chat-confirm-props {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  font-size: 0.8125rem;
}

.chat-confirm-props li {
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
}

.chat-confirm-props li:last-child { border-bottom: none; }

.chat-confirm-comment {
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 12px;
  font-style: italic;
}

.chat-confirm-actions {
  display: flex;
  gap: 8px;
}

/* ── Input Bar ── */
.chat-input-bar {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  transition: border-color var(--transition);
}

.chat-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 0.875rem;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  background: transparent;
  color: var(--text);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}

.chat-send-btn:hover { background: var(--accent-hover); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ═══════════════════════════════════════════
   COMMAND CENTER (command.html)
   ═══════════════════════════════════════════ */

/* ── Shell Layout ── */
.cmd-shell {
  display: grid;
  grid-template-columns: 220px 1fr 6px var(--chat-width, 360px);
  grid-template-rows: 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
#cmd-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
}

.cmd-sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

.cmd-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
}

.cmd-brand:hover { text-decoration: none; }

.cmd-sidebar-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 12px 16px 4px;
}

.cmd-hub-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 16px;
  font-size: 0.875rem;
  font-family: var(--font);
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.cmd-hub-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.cmd-hub-btn.active {
  background: var(--bg-hover);
  color: var(--text);
  font-weight: 500;
  border-left-color: var(--accent);
}

.cmd-hub-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.cmd-sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 16px;
}

.cmd-sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
}

.cmd-sidebar-link {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.cmd-sidebar-user {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.btn-sm { padding: 3px 8px; font-size: 0.75rem; }

/* ── Center Panel ── */
#cmd-center {
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
}

#cmd-center-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.cmd-center-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#cmd-center-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ── Card Grid ── */
#cmd-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  flex: 1;
}

.cmd-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: box-shadow var(--transition), border-color var(--transition);
}

.cmd-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: #d0cfc9;
}

.cmd-card-overdue {
  border-left: 3px solid var(--danger);
}

.cmd-card-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 8px;
  line-height: 1.4;
  color: var(--text);
}

.cmd-card-props {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cmd-card-prop {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
}

.cmd-card-prop-label {
  color: var(--text-tertiary);
  min-width: 70px;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.cmd-card-prop-value {
  color: var(--text-secondary);
}

/* ── Drag Divider ── */
#cmd-divider {
  background: var(--border-light);
  cursor: col-resize;
  transition: background var(--transition);
  position: relative;
}

#cmd-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 24px;
  background: var(--text-tertiary);
  border-radius: 1px;
  opacity: 0;
  transition: opacity var(--transition);
}

#cmd-divider:hover {
  background: var(--accent-light);
}

#cmd-divider:hover::after {
  opacity: 1;
}

/* ── Chat Panel (right) ── */
#cmd-chat {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-light);
  background: var(--bg);
  overflow: hidden;
}

.cmd-chat-header {
  display: flex;
  flex-direction: column;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.cmd-chat-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.cmd-chat-subtitle {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

#cmd-chat .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  gap: 8px;
}

#cmd-chat .chat-bubble {
  font-size: 0.8125rem;
  padding: 8px 12px;
  max-width: 90%;
}

#cmd-chat .chat-results-card {
  max-width: 100%;
}

#cmd-chat .chat-results-card table { font-size: 0.75rem; }
#cmd-chat .chat-results-card th { font-size: 0.6875rem; }

#cmd-chat .chat-confirm-card {
  max-width: 100%;
  padding: 12px;
  font-size: 0.8125rem;
}

#cmd-chat .chat-input-wrap {
  max-width: none;
}

/* ── Add Item Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 1.4rem;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ── Tab Bar ── */
.cmd-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cmd-tab {
  padding: 5px 14px;
  font-size: 0.8125rem;
  font-family: var(--font);
  font-weight: 400;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.cmd-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.cmd-tab.active {
  background: var(--bg-tertiary);
  font-weight: 500;
  color: var(--text);
  border-color: var(--border);
}

/* ── Compact Modal ── */
.modal-content-sm {
  max-width: 440px;
}

.form-input-lg {
  font-size: 1rem;
  padding: 12px 14px;
}

/* ── Modal Success State ── */
.modal-success {
  text-align: center;
  padding: 24px 16px;
}

.modal-success-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.modal-success-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.modal-success-title {
  display: block;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 0.9375rem;
}

.modal-success-title:hover {
  text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 16px; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .docs-content { padding: 24px 16px; }
  .page-detail-grid { grid-template-columns: 1fr; }
  .chat-messages { padding: 16px; }
  .chat-input-bar { padding: 12px 16px; }
  .chat-bubble { max-width: 95%; }
  .chat-suggestions { flex-direction: column; align-items: center; }

  /* Command Center responsive */
  .cmd-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  #cmd-sidebar {
    display: none;
  }
  #cmd-divider {
    display: none;
  }
  #cmd-chat {
    display: none;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .cmd-shell {
    grid-template-columns: 180px 1fr 6px var(--chat-width, 300px);
  }
  .cmd-hub-btn { font-size: 0.8125rem; padding: 6px 12px; }
}
