:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-soft: #f0f4f2;
  --text: #18201d;
  --muted: #5d6b64;
  --line: #d9e0dc;
  --accent: #156f65;
  --accent-strong: #0c504a;
  --blue: #275c9d;
  --red: #9d3c2f;
  --amber: #986b1e;
  --shadow: 0 10px 30px rgba(23, 31, 28, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: #17211e;
  color: #f5f7f6;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #b6e2d8;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.brand p,
.sidebar-footer {
  margin: 4px 0 0;
  color: #b9c7c1;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  color: #e9efec;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  padding: 10px 11px;
  border-radius: 6px;
  cursor: pointer;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-footer {
  margin-top: auto;
}

.workspace {
  min-width: 0;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px;
  gap: 12px;
  padding: 16px 22px;
  background: rgba(247, 248, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.toolbar[hidden] {
  display: none;
}

.search,
.select-wrap {
  display: grid;
  gap: 6px;
}

.search span,
.select-wrap span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

.content {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 28px;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 820px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat strong {
  display: block;
  font-size: 28px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.activity-panel,
.mini-list,
.source-filter-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.activity-panel {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.activity-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.activity-head h3,
.mini-list h3 {
  margin: 0;
  font-size: 16px;
}

.activity-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.activity-summary {
  min-width: 116px;
  text-align: right;
}

.activity-summary strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.activity-summary span {
  color: var(--muted);
  font-size: 12px;
}

.activity-legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.activity-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.activity-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.activity-legend .collected,
.activity-bar.collected {
  background: var(--blue);
}

.activity-legend .ingested,
.activity-bar.ingested {
  background: var(--accent);
}

.activity-chart {
  min-height: 166px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(22px, 1fr);
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0 2px;
}

.activity-day {
  min-width: 24px;
  display: grid;
  gap: 6px;
  align-items: end;
  justify-items: center;
}

.activity-bars {
  height: 124px;
  display: flex;
  align-items: end;
  gap: 3px;
}

.activity-bar {
  width: 8px;
  border-radius: 4px 4px 0 0;
  opacity: 0.9;
}

.activity-day small {
  color: var(--muted);
  font-size: 10px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.mini-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mini-list {
  min-width: 0;
  overflow: hidden;
}

.mini-list-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.mini-list-body {
  display: grid;
}

.mini-card {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 9px 14px;
  display: grid;
  gap: 2px;
  text-align: left;
  cursor: pointer;
}

.mini-card:last-child {
  border-bottom: 0;
}

.mini-card:hover {
  background: var(--panel-soft);
}

.mini-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.mini-card small,
.mini-empty {
  color: var(--muted);
  font-size: 12px;
}

.mini-empty {
  padding: 14px;
}

.source-filter-panel {
  padding: 14px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: end;
}

.idea-hero,
.idea-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.idea-hero {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 18px;
  align-items: center;
}

.idea-hero h3,
.idea-section h3,
.idea-columns h4 {
  margin: 0;
}

.idea-hero p,
.idea-section-head p,
.idea-card p,
.bridge-card p {
  color: var(--muted);
  line-height: 1.55;
}

.idea-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.idea-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.idea-stats strong {
  display: block;
  font-size: 24px;
}

.idea-stats span {
  color: var(--muted);
  font-size: 12px;
}

.idea-section {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.idea-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.idea-section-head p {
  margin: 4px 0 0;
  max-width: 760px;
}

.bridge-grid,
.lens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.idea-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.idea-columns > div {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.idea-columns h4 {
  font-size: 14px;
}

.idea-card,
.bridge-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.idea-card-top,
.bridge-score {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.idea-card h3,
.bridge-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.32;
}

.idea-card p,
.bridge-card p {
  margin: 0;
}

.idea-card button,
.bridge-links button {
  justify-self: start;
  min-height: 32px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 5px 9px;
  color: var(--accent-strong);
  background: #fff;
  cursor: pointer;
}

.idea-card button:hover,
.bridge-links button:hover {
  background: var(--panel-soft);
}

.bridge-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.source-filter-summary {
  display: grid;
  gap: 2px;
}

.source-filter-summary strong {
  font-size: 28px;
  line-height: 1;
}

.source-filter-summary span {
  color: var(--muted);
  font-size: 12px;
}

.source-filter-controls {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(150px, 190px) minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
}

.source-filter-controls label {
  display: grid;
  gap: 6px;
}

.source-filter-controls label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.quick-ranges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.small-button.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.card,
.note-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card {
  padding: 15px;
  display: grid;
  gap: 10px;
  min-height: 160px;
}

.card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  background: #fbfcfc;
  font-size: 12px;
}

.pill.high,
.pill.integrated {
  border-color: rgba(21, 111, 101, 0.35);
  color: var(--accent-strong);
  background: #eaf6f2;
}

.pill.medium,
.pill.needs-review {
  border-color: rgba(152, 107, 30, 0.35);
  color: var(--amber);
  background: #fff8e9;
}

.pill.low {
  border-color: rgba(157, 60, 47, 0.35);
  color: var(--red);
  background: #fff1ef;
}

.card button,
.link-button {
  justify-self: start;
  min-height: 34px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--accent-strong);
  background: #fff;
  cursor: pointer;
}

.card button:hover,
.link-button:hover {
  background: var(--panel-soft);
}

.note-panel {
  overflow: hidden;
}

body.preview-open {
  overflow: hidden;
}

.preview-backdrop[hidden],
.preview-drawer[hidden] {
  display: none;
}

.preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(16, 30, 25, 0.24);
}

.preview-drawer {
  position: fixed;
  z-index: 90;
  inset: 0 0 0 auto;
  width: var(--preview-drawer-width, min(520px, 42vw));
  padding-left: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 36px rgba(25, 45, 37, 0.18);
  animation: preview-slide-in 180ms ease-out;
}

.preview-resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateX(-50%);
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  z-index: 1;
}

.preview-resize-handle::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: var(--line);
  transform: translateX(-50%);
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.preview-resize-handle:focus-visible {
  outline: none;
}

.preview-resize-handle:is(:hover, :focus-visible, .is-active)::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(21, 111, 101, 0.16);
}

.preview-header,
.preview-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
}

.preview-header {
  border-bottom: 1px solid var(--line);
}

.preview-footer {
  border-top: 1px solid var(--line);
}

.preview-heading {
  min-width: 0;
  flex: 1;
}

.preview-heading h2 {
  margin: 2px 0 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 16px;
  line-height: 1.3;
}

.preview-type {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.preview-body {
  min-width: 0;
  overflow: auto;
  padding: 18px;
}

.preview-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.preview-body pre {
  max-width: 100%;
  overflow: auto;
}

.preview-body a {
  overflow-wrap: anywhere;
}

.preview-open-page {
  width: 100%;
  justify-content: center;
}

.preview-error {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel-soft);
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

.icon-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--panel-soft);
}

.icon-button:disabled {
  opacity: 0.38;
  cursor: default;
}

@keyframes preview-slide-in {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
}

.glossary-panel {
  display: grid;
  gap: 0;
}

.glossary-index {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.glossary-index a {
  min-width: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 750;
  font-size: 13px;
}

.glossary-index a:hover {
  border-color: var(--accent);
  background: var(--panel-soft);
}

.glossary-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.glossary-section {
  display: grid;
  gap: 10px;
  scroll-margin-top: 96px;
}

.glossary-section > h3 {
  margin: 0;
  font-size: 20px;
}

.glossary-terms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.glossary-term {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  scroll-margin-top: 104px;
}

.glossary-term h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.glossary-term p,
.glossary-term li {
  margin: 0 0 7px;
  color: var(--muted);
  line-height: 1.55;
}

.note-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.note-body {
  padding: 22px;
  min-width: 0;
}

.note-body h1,
.note-body h2,
.note-body h3 {
  margin-top: 22px;
}

.note-body h1:first-child,
.note-body h2:first-child {
  margin-top: 0;
}

.note-body p,
.note-body li {
  line-height: 1.65;
}

.note-body code {
  background: #eef2ef;
  border-radius: 4px;
  padding: 2px 4px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.table-scroll table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.table-scroll th,
.table-scroll td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.45;
}

.table-scroll th:last-child,
.table-scroll td:last-child {
  border-right: 0;
}

.table-scroll tbody tr:last-child td {
  border-bottom: 0;
}

.table-scroll th {
  background: #f2f6f4;
  color: var(--text);
  font-weight: 760;
  text-align: left;
  white-space: nowrap;
}

.table-scroll td {
  color: var(--muted);
}

.table-scroll td a {
  font-weight: 650;
}

.note-aside {
  border-left: 1px solid var(--line);
  background: #fafbfb;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.kv {
  display: grid;
  gap: 4px;
}

.kv span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}

.kv strong,
.kv a {
  color: var(--text);
  word-break: break-word;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  background: #fff;
}

.graph-shell,
.rq-graph-shell {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.graph-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.graph-toolbar p {
  margin: 3px 0 0;
  color: var(--muted);
}

.graph-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button,
.small-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-height: 30px;
}

.icon-button {
  width: 30px;
  border-radius: 999px;
  font-size: 17px;
  line-height: 1;
}

.small-button {
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

.icon-button:hover,
.small-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.graph-svg,
.rq-graph-svg {
  width: 100%;
  height: min(72vh, 760px);
  min-height: 520px;
  display: block;
  background:
    radial-gradient(circle at 20% 20%, rgba(42, 132, 84, 0.08), transparent 28%),
    linear-gradient(180deg, #fbfcfc 0%, #f5f8f6 100%);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.cluster-graph-stage {
  position: relative;
  min-height: 520px;
  height: min(72vh, 760px);
  background: #f7faf8;
  overflow: hidden;
}

.cluster-graph-canvas {
  width: 100%;
  height: 100%;
  min-height: 520px;
  cursor: grab;
}

.cluster-graph-canvas:active {
  cursor: grabbing;
}

.cluster-graph-loading,
.cluster-graph-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  justify-items: center;
  background: rgba(247, 250, 248, 0.92);
  color: var(--muted);
  text-align: center;
}

.cluster-graph-loading[hidden],
.cluster-graph-error[hidden] {
  display: none;
}

.cluster-graph-error strong {
  color: var(--text);
}

.cluster-graph-status {
  white-space: nowrap;
}

.rq-graph-shell {
  margin-bottom: 20px;
  box-shadow: none;
}

.rq-graph-svg {
  height: 430px;
  min-height: 340px;
}

.graph-svg:active,
.rq-graph-svg:active {
  cursor: grabbing;
}

.graph-pan-surface {
  fill: transparent;
  pointer-events: all;
}

.graph-edges line {
  stroke: rgba(62, 82, 73, 0.18);
  stroke-linecap: round;
  transition: opacity 140ms ease, stroke 140ms ease, stroke-width 140ms ease;
}

.graph-edges line.is-active {
  stroke: rgba(39, 92, 157, 0.78);
  stroke-width: 2.1;
  opacity: 1;
}

.graph-edges line.is-dimmed {
  opacity: 0.08;
}

.graph-node {
  cursor: move;
  transition: opacity 140ms ease;
}

.graph-node circle {
  stroke: #fff;
  stroke-width: 2;
  filter: drop-shadow(0 4px 8px rgba(22, 35, 29, 0.13));
  transition: stroke 140ms ease, stroke-width 140ms ease, filter 140ms ease, opacity 140ms ease;
}

.graph-node:hover circle {
  stroke: var(--text);
  stroke-width: 3;
}

.graph-node.is-focus circle {
  stroke: #17211e;
  stroke-width: 3;
}

.graph-node.is-active circle {
  stroke: #17211e;
  stroke-width: 3.2;
  filter: drop-shadow(0 8px 14px rgba(22, 35, 29, 0.26));
}

.graph-node.is-neighbor circle {
  stroke: rgba(39, 92, 157, 0.9);
  stroke-width: 2.8;
}

.graph-node.is-dimmed {
  opacity: 0.18;
}

.graph-node.is-pinned circle {
  stroke: #101815;
  stroke-dasharray: 3 2;
  stroke-width: 3;
}

.graph-node text {
  fill: var(--text);
  font-size: 11px;
  font-weight: 650;
  opacity: 0;
  paint-order: stroke;
  stroke: #fbfcfc;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.graph-node text.is-visible {
  opacity: 1;
}

.graph-tip {
  position: absolute;
  z-index: 3;
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
}

.graph-tip strong,
.graph-tip span,
.graph-tip small {
  display: block;
}

.graph-tip strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.graph-tip span {
  color: var(--accent);
  font-weight: 700;
}

.graph-tip small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar,
  .note-layout {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-dashboard-grid,
  .idea-hero,
  .idea-columns,
  .source-filter-panel,
  .source-filter-controls {
    grid-template-columns: 1fr;
  }

  .activity-head {
    flex-direction: column;
  }

  .activity-summary {
    text-align: left;
  }

  .graph-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .note-aside {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .preview-drawer {
    inset: auto 0 0;
    width: 100%;
    padding-left: 0;
    height: min(85dvh, 760px);
    border-top: 1px solid var(--line);
    border-left: 0;
    box-shadow: 0 -16px 36px rgba(25, 45, 37, 0.18);
  }

  .preview-resize-handle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .preview-drawer {
    animation: none;
  }
}
