/* ═══════════════════════════════════════════════════════════
   Second Brain — Main Stylesheet
   VSCode Dark+ palette, JetBrains Mono, responsive
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* Background layers */
  --bg-0: #141414;
  --bg-1: #1e1e1e;
  --bg-2: #252526;
  --bg-3: #2d2d30;
  --bg-hover: #2a2d2e;

  /* Borders */
  --border: #3e3e42;
  --border-light: #4a4a4f;

  /* Text */
  --text-primary: #d4d4d4;
  --text-secondary: #9d9d9d;
  --text-muted: #6e6e6e;
  --text-bright: #e8e8e8;

  /* Accent — VSCode blue */
  --accent: #569cd6;
  --accent-hover: #4e8bbf;
  --accent-dim: #1e3a5f;

  /* Status colors */
  --green: #4ec9b0;
  --yellow: #dcdcaa;
  --orange: #ce9178;
  --red: #f44747;
  --purple: #c586c0;

  /* Kanban */
  --col-todo: #252526;
  --col-progress: #252526;
  --col-done: #252526;
  --col-archived: #1e1e1e;

  /* Priority */
  --priority-low: #4ec9b0;
  --priority-medium: #dcdcaa;
  --priority-high: #f44747;

  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-ui: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-width: 220px;
  --topbar-height: 48px;
  --bottom-nav-height: 60px;
  --transition: 0.15s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg-1);
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code, pre, .mono { font-family: var(--font-mono); }

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  padding-top: var(--topbar-height);
  padding-bottom: 0;
}

/* ── Top Bar (mobile + desktop) ──────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  z-index: 100;
}

.topbar-title {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-primary);
  padding: 0.25rem;
}

.topbar-actions { display: flex; gap: 0.5rem; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  padding: 0.75rem 0;
  z-index: 90;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem 1rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-bright);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.logo-icon { font-size: 1.2rem; }

.sidebar-section { margin-bottom: 0.5rem; }

.sidebar-section-title {
  padding: 0.35rem 1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item--add { color: var(--text-muted); }
.nav-item--add:hover { color: var(--accent); }

.nav-icon { font-size: 0.9rem; width: 1.2rem; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

/* ── Main Content ────────────────────────────────────────── */
.main-content {
  grid-column: 2;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  width: 100%;
}

/* ── Bottom Nav (mobile only, hidden on desktop) ─────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 0.35rem 0.75rem;
  text-decoration: none;
  transition: color var(--transition);
}

.bottom-nav-item small { font-size: 0.6rem; font-family: var(--font-ui); }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--accent); }

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-title {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border-light); }

.card-title {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-bright);
  margin-bottom: 0.35rem;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: background var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.icon-btn:hover { background: var(--bg-hover); }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.form-control {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  transition: border-color var(--transition);
  font-size: 0.9rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* ── Badge / Tag ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 500;
  background: var(--bg-3);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-blue { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.badge-green { background: #1a3a32; color: var(--green); border-color: var(--green); }
.badge-yellow { background: #2e2e1a; color: var(--yellow); border-color: var(--yellow); }
.badge-red { background: #3a1a1a; color: var(--red); border-color: var(--red); }
.badge-purple { background: #2a1a2e; color: var(--purple); border-color: var(--purple); }
.badge-orange { background: #2e1e14; color: var(--orange); border-color: var(--orange); }

/* ── Kanban Board ────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-column {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 200px;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.kanban-column[data-status="todo"] .kanban-column-header { color: var(--text-secondary); }
.kanban-column[data-status="in_progress"] .kanban-column-header { color: var(--yellow); }
.kanban-column[data-status="done"] .kanban-column-header { color: var(--green); }
.kanban-column[data-status="archived"] .kanban-column-header { color: var(--text-muted); }

.kanban-cards {
  padding: 0.5rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kanban-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  cursor: grab;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-size: 0.875rem;
}

.kanban-card:hover { border-color: var(--border-light); box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.kanban-card.sortable-ghost { opacity: 0.4; }
.kanban-card.sortable-drag { cursor: grabbing; box-shadow: 0 4px 16px rgba(0,0,0,0.6); }

.kanban-card-title { font-weight: 500; color: var(--text-bright); margin-bottom: 0.35rem; }
.kanban-card-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.kanban-add-btn {
  width: 100%;
  padding: 0.5rem;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  margin: 0.5rem;
  width: calc(100% - 1rem);
  transition: border-color var(--transition), color var(--transition);
}
.kanban-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Media Grid ──────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.media-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
  cursor: pointer;
}

.media-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.media-card-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2.5rem;
}

.media-card-poster img { width: 100%; height: 100%; object-fit: cover; }

.media-card-info { padding: 0.6rem 0.75rem; }

.media-card-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ── Notes List ──────────────────────────────────────────── */
.notes-list { display: flex; flex-direction: column; gap: 0.75rem; }

.note-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  transition: border-color var(--transition);
  cursor: pointer;
}

.note-card:hover { border-color: var(--border-light); }

.note-preview {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Bookmarks List ──────────────────────────────────────── */
.bookmarks-list { display: flex; flex-direction: column; gap: 0.5rem; }

.bookmark-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: border-color var(--transition);
}

.bookmark-card:hover { border-color: var(--border-light); }

.bookmark-favicon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
  object-fit: contain;
}

.bookmark-url {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Dashboard Widgets ───────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.widget {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  cursor: grab;
  transition: border-color var(--transition);
}

.widget:hover { border-color: var(--border-light); }
.widget.sortable-ghost { opacity: 0.4; }

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.widget-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.widget-count {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 300;
  color: var(--accent);
  margin: 0.5rem 0;
}

/* ── Global Search ───────────────────────────────────────── */
.global-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.global-search-box {
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  width: min(600px, 90vw);
  padding: 0.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}

.global-search-box input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-primary);
}
.global-search-box input:focus { outline: none; }

.search-results { display: flex; flex-direction: column; gap: 0.5rem; }

.search-result-item {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--bg-hover); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

/* ── Space Type Wizard ───────────────────────────────────── */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.type-card {
  background: var(--bg-3);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.type-card:hover, .type-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.type-card-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.type-card-name { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; }

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.page-link {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.page-link:hover, .page-link.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Markdown content render ─────────────────────────────── */
.md-content {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.md-content h1, .md-content h2, .md-content h3 {
  font-family: var(--font-mono);
  color: var(--text-bright);
  margin: 1rem 0 0.5rem;
}

.md-content code {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  font-size: 0.85em;
}

.md-content pre {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  overflow-x: auto;
}

.md-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin: 0.75rem 0;
}

/* ── Utility ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.font-mono { font-family: var(--font-mono); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Divider ─────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════ */

/* ── Tablet (≤1024px) ────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 200px; }

  .main-content { padding: 1.25rem 1.5rem; }

  .kanban-board { grid-template-columns: repeat(2, minmax(200px, 1fr)); }

  .media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ── Mobile (≤768px) ─────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }

  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    transform: translateX(-100%);
    width: 80vw;
    max-width: 280px;
    z-index: 200;
    top: var(--topbar-height);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  .sidebar.open { transform: translateX(0); }

  /* Overlay behind open sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
  }
  .sidebar-overlay.visible { display: block; }

  .main-content {
    grid-column: 1;
    padding: 1rem;
    padding-bottom: calc(var(--bottom-nav-height) + 1rem);
  }

  .topbar-menu-btn { display: flex; }

  /* Desktop sidebar hidden text — show full logo on desktop only */
  .sidebar-logo .logo-text { display: block; }

  /* Bottom nav visible on mobile */
  .bottom-nav { display: flex; }

  /* Kanban: horizontal scroll on mobile */
  .kanban-board {
    grid-template-columns: repeat(4, 220px);
    overflow-x: auto;
    padding-bottom: 0.75rem;
    scrollbar-width: thin;
  }

  /* Media grid: single column on phone */
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

  /* Dashboard: single column */
  .dashboard-grid { grid-template-columns: 1fr; }

  /* Page header wrap */
  .page-header { flex-direction: column; align-items: flex-start; }

  /* Type wizard: 2 columns on mobile */
  .type-grid { grid-template-columns: 1fr 1fr; }

  #toast-container { bottom: calc(var(--bottom-nav-height) + 0.75rem); right: 0.75rem; }
}

/* ── Small phones (≤400px) ───────────────────────────────── */
@media (max-width: 400px) {
  .media-grid { grid-template-columns: repeat(2, 1fr); }
  .type-grid { grid-template-columns: 1fr 1fr; }
}
