:root {
  --bg: #0f0f11;
  --bg-soft: #17171b;
  --bg-card: #1c1c21;
  --bg-hover: #23232a;
  --border: #2a2a33;
  --border-strong: #3a3a46;
  --fg: #ebe8e1;
  --fg-muted: #9a968d;
  --fg-dim: #6a6760;
  --accent: #f5a524;
  --accent-soft: rgba(245, 165, 36, 0.12);
  --accent-line: rgba(245, 165, 36, 0.4);
  --danger: #e5484d;
  --success: #46a758;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

code, pre, .mono { font-family: var(--mono); }

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
}
.topbar .brand .dot { color: var(--accent); }
.topbar .brand-icon { display: block; flex: 0 0 auto; }
.topbar .nav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}
.topbar .nav a {
  color: var(--fg-muted);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
}
.topbar .nav a:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.topbar .nav a.active { color: var(--accent); background: var(--accent-soft); }
.topbar .spacer { flex: 1; }
.topbar .user {
  font-size: 12px;
  color: var(--fg-muted);
  font-family: var(--mono);
}
.topbar .user .role {
  color: var(--accent);
  margin-left: 6px;
}

/* Phone / narrow viewport: let the topbar wrap so the nav links don't
   get clipped or overflow horizontally. The nav drops to a second row
   below the brand + user/logout strip. */
@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 14px;
  }
  .topbar .nav {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    overflow-x: auto;
  }
  .topbar .nav a {
    padding: 6px 8px;
    font-size: 12px;
  }
  .topbar .spacer { display: none; }
  .topbar .user {
    margin-left: auto;
    font-size: 11px;
  }
  .topbar .brand { font-size: 13px; }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
  /* Wrap so the action button (e.g. "+ New prompt") drops to a second
     row on narrow screens instead of getting pushed off the right edge
     by a long H1 + subtitle. */
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.page-header .subtitle {
  color: var(--fg-muted);
  font-size: 13px;
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.search-bar input[type="search"] {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
}
.search-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--accent-line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 1fr;
  gap: 14px;
  align-items: stretch;
}
/* card-wrap is the positioning context for the kebab; make it stretch to
   the row height so the inner card fills it. */
.card-wrap { display: flex; }
.card-wrap > .card { flex: 1; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.12s ease, transform 0.12s ease;
  text-decoration: none;
  color: var(--fg);
}
.card:hover {
  border-color: var(--accent-line);
  text-decoration: none;
  transform: translateY(-1px);
}
.card .thumb {
  position: relative;
  height: 100px;
  border-radius: 6px;
  background: linear-gradient(135deg, #26262e 0%, #1c1c22 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  color: var(--accent);
  font-size: 28px;
  font-weight: 600;
  overflow: hidden;
}
.card .thumb-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  display: block;
}
.card .thumb-letter { display: none; }
.card .thumb.thumb-fallback .thumb-letter { display: inline; }
.card .thumb.thumb-fallback { /* image removed by onerror */ }
.card .title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
}
.card .meta {
  color: var(--fg-muted);
  font-size: 12px;
  font-family: var(--mono);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  /* Pin tags to the bottom so cards with shorter titles still align. */
  margin-top: auto;
}
.tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}
.tag.visibility-private { color: var(--fg-dim); }
.tag.visibility-shared { color: #a78bfa; border-color: rgba(167, 139, 250, 0.3); }
.tag.visibility-public { color: var(--success); border-color: rgba(70, 167, 88, 0.3); }

/* Package kind — MD (drop) vs HTML (explainer). Distinct from visibility
   colours so the two stack readably. */
.tag.kind-md {
  color: #7cc4ff;
  border-color: rgba(124, 196, 255, 0.4);
  background: rgba(124, 196, 255, 0.08);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.tag.kind-html {
  color: #c4f47c;
  border-color: rgba(196, 244, 124, 0.4);
  background: rgba(196, 244, 124, 0.08);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.tag.source-idea {
  color: #d8a0ff;
  border-color: rgba(216, 160, 255, 0.4);
  background: rgba(216, 160, 255, 0.08);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty h2 {
  color: var(--fg);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent-line); background: var(--bg-hover); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1306;
  font-weight: 600;
}
.btn-primary:hover { background: #ffb84a; border-color: #ffb84a; color: #1a1306; }
.btn-danger {
  color: var(--danger);
  border-color: rgba(229, 72, 77, 0.3);
}
.btn-ghost { background: transparent; }

/* Compact icon button used by inline row/card actions (delete, etc.).
   Appears on hover for the grid card, always-on for the list row so
   it's reachable on touch. */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color 80ms ease, border-color 80ms ease, background 80ms ease;
}
.btn-icon:hover { color: var(--fg); border-color: var(--border-strong); }
.btn-icon-danger:hover {
  color: var(--danger);
  border-color: rgba(229, 72, 77, 0.4);
  background: rgba(229, 72, 77, 0.08);
}

/* Grid card: position the delete form on top of the card. The form is a
   sibling of <a class="card"> (forms can't legally be nested inside <a>)
   so we use card-wrap as the positioning context. */
.card-wrap { position: relative; }
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  margin: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity 100ms ease;
}
.card-wrap:hover .card-actions,
.card-actions:focus-within { opacity: 1; }
/* On touch devices there's no hover — keep it visible. */
@media (hover: none) {
  .card-actions { opacity: 0.7; }
}

/* List row actions: keep the cell narrow so it doesn't push everything
   else around. The td gets onclick=stopPropagation so clicking the
   button doesn't trigger the row navigation. */
.list-table .actions-col { width: 44px; padding: 6px 10px; text-align: right; }
.row-actions { margin: 0; display: inline-block; }

.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(245, 165, 36, 0.08), transparent);
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
}
.auth-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.auth-card .brand-mark {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}
.auth-card p {
  color: var(--fg-muted);
  margin: 0 0 20px;
}
.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus,
.auth-card input[type="email"]:focus {
  outline: none; border-color: var(--accent-line);
}
.auth-card .full { width: 100%; justify-content: center; }
.auth-card .error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

.viewer-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 54px);
  transition: grid-template-columns 180ms ease;
}
.viewer-layout.sidebar-collapsed {
  grid-template-columns: 32px 1fr;
}
.viewer-sidebar {
  position: relative;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 18px 16px;
  overflow-y: auto;
  max-height: calc(100vh - 54px);
}
.viewer-layout.sidebar-collapsed .viewer-sidebar {
  padding: 18px 0;
  overflow: hidden;
}
.viewer-layout.sidebar-collapsed .viewer-sidebar > *:not(.sidebar-toggle) {
  display: none;
}
.sidebar-toggle {
  position: absolute;
  top: 14px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-muted);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.sidebar-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}
.viewer-layout.sidebar-collapsed .sidebar-toggle {
  right: 50%;
  transform: translateX(50%);
}
.viewer-sidebar h2 {
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 0 6px;
  font-weight: 500;
}
.viewer-sidebar h2:first-child { margin-top: 0; }
.viewer-sidebar .pkg-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}
.viewer-sidebar .pkg-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 14px;
}
.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.file-list li a {
  display: block;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}
.file-list li a:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.file-list li a.active { color: var(--accent); background: var(--accent-soft); }

.viewer-main {
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.viewer-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}
.viewer-frame {
  flex: 1;
  border: 0;
  background: var(--bg);
  color-scheme: dark;
  width: 100%;
}
/* Compact icon-only button — sits in the viewer toolbar next to the
   "Open standalone" link without the heavy border of a regular .btn. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 0;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-btn:disabled { cursor: default; }
.icon-btn.flash-ok { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-btn.flash-bad { color: var(--danger); border-color: var(--danger); }
.icon-btn.liked { color: #ef4444; border-color: #ef4444; }
.icon-btn.liked svg { fill: currentColor; }
.icon-btn.liked:hover { color: #b91c1c; border-color: #b91c1c; background: rgba(239, 68, 68, 0.08); }
.icon-btn.starred { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-btn.starred svg { fill: currentColor; }
.icon-btn.starred:hover { color: var(--accent); border-color: var(--accent); }
/* Conversation panel — comment-body markdown renders inline tags only;
   give paragraphs sane spacing and lists their own breathing room. */
#comments-panel .comment-body p { margin: 0 0 6px; }
#comments-panel .comment-body p:last-child { margin-bottom: 0; }
#comments-panel .comment-body code { background: var(--bg); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
#comments-panel .comment-body pre { background: var(--bg); padding: 8px 10px; border-radius: 6px; font-size: 12px; overflow-x: auto; margin: 6px 0; }
#comments-panel .comment-body ul, #comments-panel .comment-body ol { margin: 4px 0; padding-left: 20px; }
#comments-panel .comment-body a { color: var(--accent); }
.md-panel {
  padding: 24px;
  max-width: 780px;
  margin: 0 auto;
  overflow-y: auto;
}
.md-panel pre {
  background: var(--bg-card);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
}
.md-panel code {
  background: var(--bg-soft);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.92em;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--bg-soft);
  color: var(--fg-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table tr:last-child td { border-bottom: 0; }
.table .mono { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 14px;
  font-weight: 600;
}
.panel p.dim {
  color: var(--fg-muted);
  font-size: 13px;
  margin: 0 0 14px;
}

form.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
form.inline input, form.inline select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
}
form.inline input:focus, form.inline select:focus {
  outline: none; border-color: var(--accent-line);
}

/* Themed select — strip native chrome, apply our own chevron, match input look. */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%239a968d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 30px 8px 10px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  line-height: 1.2;
}
select:hover { border-color: var(--border-strong); }
select:focus {
  outline: none;
  border-color: var(--accent-line);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23f5a524' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
/* Inside option list — best-effort across browsers (Firefox respects, Chrome/Safari mostly don't). */
select option {
  background: var(--bg-card);
  color: var(--fg);
}

label.field-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-right: 4px;
  display: block;
}

/* Stack: vertical form column with consistent spacing. */
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack > .field-label { margin: 6px 0 -2px; }

/* Field: themed input/select that fills its container. */
.field {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 13px;
  box-sizing: border-box;
}
.field:focus { outline: none; border-color: var(--accent-line); }
select.field {
  /* keep the chevron aware of full width */
  padding-right: 32px;
}

.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-soft);
  color: var(--fg-muted);
}

.banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--fg);
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  margin-bottom: 18px;
}
.banner .label {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: block;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  color: var(--fg-muted);
  background: var(--bg-card);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--fg);
}
.drop-zone input[type="file"] { display: none; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); color: var(--success); }

.footer {
  margin-top: auto;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  text-align: center;
}

/* ---- Yawasa landing + portal ----------------------------------------- */

.splash-body {
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--sans);
}

.splash-header {
  display: flex;
  justify-content: flex-end;
  padding: 20px 24px;
}

.splash-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.yawasa-logo {
  font-family: "Silkscreen", "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: clamp(3.5rem, 13vw, 9rem);
  line-height: 1;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-align: center;
  user-select: none;
  text-shadow:
    2px 2px 0 rgba(245, 165, 36, 0.18),
    -1px -1px 0 rgba(245, 165, 36, 0.18);
}

.splash-footer {
  text-align: center;
  padding: 24px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  letter-spacing: 0.18em;
}

.burger-wrap { position: relative; }
.burger {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 18px;
  font-family: var(--mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.burger:hover { color: var(--fg); border-color: var(--border-strong); }
.burger:focus { outline: none; border-color: var(--accent-line); }
.burger-menu {
  position: absolute;
  top: 48px;
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px;
  display: none;
  z-index: 50;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.burger-menu.show { display: flex; flex-direction: column; gap: 1px; }
.burger-menu a,
.burger-menu button {
  display: block;
  padding: 9px 12px;
  color: var(--fg);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--sans);
  font-size: 13px;
  border-radius: 5px;
  cursor: pointer;
  width: 100%;
}
.burger-menu a:hover,
.burger-menu button:hover {
  background: var(--bg-hover);
  text-decoration: none;
  color: var(--accent);
}

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
}
.portal-brand {
  font-family: "Silkscreen", "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.portal-main {
  flex: 1;
  padding: 56px 32px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.portal-greeting {
  font-size: 26px;
  color: var(--fg);
  margin-bottom: 32px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.portal-greeting .dim { color: var(--fg-muted); font-weight: 400; }

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.service-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.service-tile:hover {
  border-color: var(--accent-line);
  text-decoration: none;
  transform: translateY(-1px);
}
.service-tile-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  color: var(--accent);
}
.service-tile-title { font-weight: 600; font-size: 15px; }
.service-tile-desc { color: var(--fg-muted); font-size: 12px; line-height: 1.5; }

.site-footer {
  margin-top: auto;
  padding: 28px 32px 36px;
  border-top: 1px solid var(--border);
  background: rgba(14, 17, 22, 0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}
.site-footer .left { display: flex; align-items: center; gap: 10px; }
.site-footer .left .mark {
  width: 18px;
  height: 18px;
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
}
.site-footer .copy { color: var(--fg-dim); }
.site-footer .copy strong { color: var(--fg); font-weight: 600; }
.site-footer .right { color: var(--fg-muted); font-size: 10px; }
@media (max-width: 600px) {
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 22px 18px 28px;
  }
}

.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}
.tag-pill:hover { color: var(--fg); border-color: var(--border-strong); text-decoration: none; }
.tag-pill.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.tag-pill-count {
  font-size: 10px;
  color: var(--fg-dim);
  font-weight: 500;
}
.tag-pill.active .tag-pill-count { color: var(--accent); opacity: 0.7; }

.tag-link {
  cursor: pointer;
  text-decoration: none;
}
.tag-link:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

.layout-toggle { display: inline-flex; gap: 4px; }

/* Multi-select checkboxes + sticky action bar */
.multiselect-cb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  margin: 0;
  flex: 0 0 18px;
}
.multiselect-cb:hover { border-color: var(--accent-line); }
.multiselect-cb:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.multiselect-cb:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
/* Indeterminate state — horizontal bar instead of checkmark. Browsers
   don't trigger :checked when :indeterminate, so this overrides the empty
   state and replaces (via the more specific selector ordering below). */
.multiselect-cb:indeterminate {
  background: var(--accent);
  border-color: var(--accent);
}
.multiselect-cb:indeterminate::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--bg);
  border: none;
  transform: none;
  width: auto;
}
.card-wrap > .multiselect-cb {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  /* Don't set background here — equal specificity to :checked / :indeterminate
     would override the amber-fill of the selected state. The base rule
     already gives an unchecked checkbox its bg-card chip. */
  box-shadow: 0 0 0 2px var(--bg-card);
}
/* Checkbox column — header AND body, identical widths. */
.list-table th.multiselect-cb-col,
.list-table td.multiselect-cb-cell {
  width: 36px;
  min-width: 36px;
  padding: 8px 6px 8px 12px;
  text-align: left;
}
/* Icon column — class on both header and body for matched widths. */
.list-table th.icon-col,
.list-table td.icon-col {
  width: 32px;
  min-width: 32px;
  padding-right: 4px;
}

/* Page-header select-all wrapper (grid view). */
.multiselect-all-label {
  display: inline-flex;
  align-items: center;
  margin-right: 12px;
}
.list-row.selected,
.card-wrap.selected > .card {
  border-color: var(--accent);
  background: rgba(245, 165, 36, 0.05);
}

.multiselect-bar {
  position: sticky;
  top: 54px; /* below topbar */
  z-index: 30;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--bg-card);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.multiselect-bar.show { display: flex; }
.multiselect-summary {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  padding-right: 6px;
}

/* Kebab trigger button */
.kebab {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kebab:hover { background: var(--bg-hover); color: var(--fg); border-color: var(--border); }
.kebab:focus { outline: none; border-color: var(--accent-line); }
.card-wrap { position: relative; }
.card-wrap > .kebab,
.card .kebab {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}
.card { position: relative; }

/* Menu popover */
.kebab-menu {
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  padding: 4px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.kebab-menu button {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.kebab-menu button:hover { background: var(--bg-hover); }
.kebab-menu button.danger { color: var(--danger); }
.kebab-menu button.danger:hover { background: rgba(229, 72, 77, 0.1); }
.kebab-sep {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.list-table { width: 100%; }
.list-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  padding: 8px 10px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  white-space: nowrap;
}
.list-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.list-table td.title-col { white-space: normal; min-width: 240px; }
.list-row { transition: background 80ms ease; }
.list-row:hover { background: var(--bg-hover); }
.list-row td.title-col { color: var(--fg); }
.list-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
  border-radius: 3px;
}

.tabs { display: flex; gap: 6px; }
.tab {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--fg-muted);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.tab:hover { color: var(--fg); background: var(--bg-hover); text-decoration: none; }
.tab.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
  margin: 2px 4px 2px 0;
}
.chip .x {
  cursor: pointer;
  color: var(--fg-muted);
  font-weight: bold;
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}
.chip .x:hover { color: var(--danger); }

.typeahead { position: relative; }
.typeahead-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}
.typeahead-results.show { display: block; }
.typeahead-result {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.typeahead-result:last-child { border-bottom: none; }
.typeahead-result:hover, .typeahead-result.focused {
  background: var(--bg-hover);
  color: var(--accent);
}
.typeahead-result .role-tag {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-dim);
  margin-left: 6px;
}

/* ---- Folders --------------------------------------------------------- */

.folder-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.folder-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  flex-wrap: wrap;
}
.breadcrumb-link {
  color: var(--fg-muted);
  padding: 2px 4px;
  border-radius: 4px;
}
.breadcrumb-link:hover {
  color: var(--accent);
  background: var(--bg-hover);
  text-decoration: none;
}
.breadcrumb-current {
  color: var(--fg);
  padding: 2px 4px;
}
.breadcrumb-sep {
  color: var(--fg-dim);
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.folder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 14px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
  /* Floor so all folder cards have a consistent height regardless of
     how many meta lines they carry — empty-state placeholder, plain
     folder, Unpublished (which has a 2-line description) all match. */
  min-height: 132px;
}
.folder-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-1px);
  text-decoration: none;
}
.folder-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
}
.folder-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.folder-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  word-break: break-word;
}
.folder-shared {
  font-family: var(--mono);
  color: var(--fg-muted);
}
.folder-kebab {
  position: absolute;
  top: 6px;
  right: 6px;
}
.folder-card-unpublished {
  border-style: dashed;
  border-color: var(--accent-line);
  background: linear-gradient(180deg, rgba(245, 165, 36, 0.04), var(--bg-card));
}
.folder-card-unpublished .folder-icon { color: var(--accent); }
.folder-card-unpublished .folder-name::after {
  content: " · drafts";
  color: var(--fg-dim);
  font-weight: 400;
  font-size: 11px;
  font-family: var(--mono);
}
/* Empty-state subfolder placeholder: rendered as a real folder-card
   shape (so the row height is naturally identical to a populated row,
   regardless of card-content tweaks elsewhere) but visually muted so it
   doesn't read as an interactive folder. */
.folder-card-empty {
  cursor: default;
  border-style: dashed;
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--fg-dim);
}
.folder-card-empty:hover {
  border-color: var(--border);
  transform: none;
}
.folder-card-empty .folder-icon { color: var(--fg-dim); opacity: 0.5; }

/* ---- Modal (folder picker, share, etc.) ----------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
  animation: modal-fade 120ms ease-out;
}
@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  /* Two declarations: vh fallback for older browsers, dvh wins where
     supported. Mobile Safari's 100vh includes the address bar + bottom
     toolbar, which is invisible chrome — so the modal would exceed the
     visible viewport and push .modal-footer (Save/Cancel) off-screen.
     dvh tracks the *currently visible* viewport. */
  max-height: calc(100vh - 60px);
  max-height: calc(100dvh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-title {
  font-size: 14px;
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  /* flex-basis: auto so the body's preferred size is its content's
     natural size — modal sizes to fit (with title + body + footer all
     visible). Without this (basis: 0), the body collapses to 0 since
     the modal has no defined height, and only title + footer render —
     all form fields hidden.

     min-height: 0 is the second half of the trick: when content
     EXCEEDS the modal's max-height cap, this lets the body shrink
     past its intrinsic size so it can scroll internally and the
     footer stays visible. */
  flex: 1 1 auto;
  min-height: 0;
}
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--bg-soft);
  /* Belt-and-suspenders: even if a future modal somehow defeats the
     flex sizing, sticky-bottom keeps the action row pinned to the
     bottom of the visible modal. */
  position: sticky;
  bottom: 0;
  z-index: 5;
}

/* ---- Modal responsive (phone-friendly) ----------------------------- */
/* Inline style="max-width:Npx" still wins on the .modal element above
   600px. Below 600px we override it with !important so a 720px-wide
   editor modal doesn't overflow a 360px screen, and we tighten the
   padding rings so input fields don't get cropped. */
@media (max-width: 600px) {
  /* Switch from "internal-scroll modal" to "scroll-the-whole-backdrop":
     the modal renders at its natural height, the backdrop scrolls when
     it overflows the viewport, and the footer is sticky-pinned to the
     bottom of the viewport so Save/Cancel are always reachable.

     This matches how iOS sheet-style modals behave and avoids the
     flex-shrink trap where the body collapsed to a single field. */
  .modal-backdrop {
    padding: 8px;
    align-items: flex-start;
    overflow-y: auto;
    /* Stop iOS rubber-banding scroll bleeding into the page underneath. */
    overscroll-behavior: contain;
  }
  .modal {
    max-width: 100% !important;
    /* Drop the height cap and the flex-column layout so content sizes
       naturally and the backdrop owns scrolling. !important to defeat
       inline style="max-width:Npx" on per-instance modals. */
    max-height: none !important;
    display: block !important;
    overflow: visible !important;
    border-radius: var(--radius);
  }
  .modal-title {
    padding: 12px 14px;
    font-size: 13px;
    /* Sticky title so the user always sees what modal they're in even
       after scrolling down through a tall form. */
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 4;
  }
  .modal-body {
    padding: 12px 14px;
    /* Defeat the desktop rule's flex sizing — body now grows naturally
       to fit its content. */
    overflow: visible;
    flex: none;
    min-height: auto;
  }
  .modal-footer {
    padding: 10px 14px;
    flex-wrap: wrap;
    /* Pin to viewport bottom — works because the modal itself is no
       longer overflow:hidden. */
    position: sticky;
    bottom: 0;
    z-index: 6;
  }
  .modal-footer .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
  /* Form fields and textareas inside modals — prevent horizontal overflow
     on phones; long placeholders / mono text shouldn't push the box wider
     than the screen. */
  .modal .field,
  .modal textarea.field,
  .modal input.field,
  .modal select.field {
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Tall inline-styled min-heights (set to make textareas comfortable
     on desktop) are still relaxed so they don't dominate the viewport,
     but no longer fighting flex-shrink. */
  .modal textarea.field {
    min-height: 100px !important;
  }
  /* Tighter container padding so cards and forms get more horizontal
     room on a 360-400px screen. */
  .container {
    padding: 18px 14px;
  }
}

/* ---- Folder picker (used inside modal) ------------------------------ */

.folder-picker {
  display: flex;
  flex-direction: column;
}
.folder-picker-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 50vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.folder-picker-row {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--fg);
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.folder-picker-row:last-child { border-bottom: none; }
.folder-picker-row:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

/* ---- Share modal chips ---------------------------------------------- */

.share-typeahead .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 28px;
  margin-bottom: 8px;
}
.share-typeahead .typeahead-results {
  position: static;
  margin-top: 4px;
}

/* ---- Ideas (quick-capture snippets) -------------------------------- */

.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.idea-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.12s ease;
  position: relative;
}
.idea-card:hover { border-color: var(--accent-line); }
.idea-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.idea-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  flex: 1;
  word-break: break-word;
}
.idea-card-text {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 8em;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.45;
}
.idea-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  /* Pin to the bottom of the flex column so the meta line lands at the
     same position on every card regardless of whether the idea has a
     body (the body div is conditionally rendered when idea.text is
     non-empty). Cards in the same grid row stretch to equal height via
     the grid's default align-items:stretch. */
  margin-top: auto;
}
.idea-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
}
.idea-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---- Notes (short, complete, frequently-referenced) --------------- */

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.note-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 120ms ease;
  position: relative;
}
.note-row:hover { border-color: var(--accent-line); }
.note-row-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.note-row-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  flex: 1;
  word-break: break-word;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.note-pin-mark {
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
}
.note-row-body { font-size: 14px; line-height: 1.55; }
.note-row-body:empty { display: none; }
.note-row-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}
.note-row-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
}
.note-row-tags { display: flex; gap: 4px; flex-wrap: wrap; }

.note-combined {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px 26px;
}

/* Shared markdown-rendered body styling — used by .note-row-body
   AND .note-combined inside the notes page. Sized for inline use
   (no full-page margins / huge h1). The CSS variables are already
   set on :root via the layout; this just lays out the elements. */
.md-prose-host { color: var(--fg); word-break: break-word; }
.md-prose-host h1 { font-size: 22px; margin: 0.6em 0 0.4em; line-height: 1.3; }
.md-prose-host h2 { font-size: 17px; margin: 1em 0 0.35em; line-height: 1.3; padding-top: 12px; border-top: 1px solid var(--border); }
.md-prose-host h2:first-child { padding-top: 0; border-top: none; margin-top: 0; }
.md-prose-host h3 { font-size: 14px; margin: 0.9em 0 0.3em; }
.md-prose-host h4 { font-size: 12px; margin: 0.8em 0 0.3em; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.md-prose-host p { margin: 0 0 0.7em; }
.md-prose-host p:last-child { margin-bottom: 0; }
.md-prose-host a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-line); word-break: break-all; }
.md-prose-host a:hover { border-bottom-color: var(--accent); }
.md-prose-host strong { color: var(--fg); font-weight: 600; }
.md-prose-host em { color: var(--fg-muted); font-style: italic; }
.md-prose-host ul, .md-prose-host ol { margin: 0 0 0.7em; padding-left: 1.4em; }
.md-prose-host li { margin: 0.2em 0; }
.md-prose-host blockquote {
  margin: 0.6em 0;
  padding: 4px 14px;
  border-left: 3px solid var(--accent-line);
  color: var(--fg-muted);
  background: var(--bg-soft);
  border-radius: 0 6px 6px 0;
}
.md-prose-host code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}
.md-prose-host pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  margin: 0.6em 0;
  line-height: 1.5;
}
.md-prose-host pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--fg);
  font-size: 12.5px;
}
.md-prose-host hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.2em 0;
}
.md-prose-host table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6em 0;
  font-size: 13px;
}
.md-prose-host th, .md-prose-host td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.md-prose-host th {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  background: var(--bg-soft);
  font-weight: 500;
}
.md-prose-host img { max-width: 100%; height: auto; border-radius: 6px; }
