:root {
  color-scheme: light;
  --bg: #fbf8f1;
  --surface: #fffdfa;
  --surface-rail: color-mix(in srgb, var(--surface) 72%, transparent);
  --surface-tint: #fff8ec;
  --surface-sunken: #f6f1e8;
  --surface-strong: #fff6e8;
  --selected: #fff3dd;
  --ink: #18130f;
  --ink-2: #3d352e;
  --muted: #6b6259;
  --faint: #958b80;
  --label: #5a3e1b;
  --line: #ebe2d5;
  --line-strong: #d9ccbc;
  --orange: #ff5a1f;
  --orange-text: #b4410f;
  --orange-soft: #fff0e5;
  --accent-solid: #b4410f;
  --on-accent: #ffffff;
  --accent-line: #efb88e;
  --heat: 255, 90, 31;
  --hover: rgba(255, 90, 31, 0.06);
  --focus: rgba(185, 67, 18, 0.5);
  --focus-soft: rgba(255, 90, 31, 0.14);
  --green: #1f7f47;
  --green-soft: #eaf7ee;
  --green-line: #bfe4c8;
  --status-ok: #1e9d58;
  --blue: #1c5fb0;
  --blue-soft: #edf4ff;
  --blue-line: #c7dbfb;
  --yellow: #ad7500;
  --yellow-soft: #fff3d0;
  --yellow-line: #edcc79;
  --yellow-ink: #804d00;
  --red: #c1432e;
  --tag-bg: #f2efe8;
  --tag-line: #e3ddd2;
  --tag-ink: #4f4840;
  --note-bg: #fff6df;
  --note-line: #f1d99e;
  --note-ink: #5c4c35;
  --mark-bg: #f1ebe1;
  --mark-ink: #4a3b2c;
  --toast-bg: #251d16;
  --toast-ink: #ffffff;
  --backdrop: rgba(31, 23, 17, 0.36);
  --shadow: 0 14px 36px rgba(82, 56, 27, 0.08);
  --shadow-pop-color: rgba(64, 42, 20, 0.18);
  /* Categorical chart slots: validated order, light-surface steps. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-other: #b8b0a6;
  --chart-grid: #ece5da;
  --radius: 6px;
  --mono: ui-monospace, "SFMono-Regular", "Roboto Mono", "Cascadia Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #15120f;
    --surface: #1d1915;
    --surface-tint: #241e18;
    --surface-sunken: #191512;
    --surface-strong: #2a2119;
    --selected: #31251a;
    --ink: #f2ebe2;
    --ink-2: #d5ccc1;
    --muted: #a99d90;
    --faint: #7f7469;
    --label: #e2bd92;
    --line: #2e2720;
    --line-strong: #43392f;
    --orange: #ff6a33;
    --orange-text: #ff9563;
    --orange-soft: #36231a;
    --accent-solid: #ff8a57;
    --on-accent: #1a0e07;
    --accent-line: #8a4d2a;
    --heat: 255, 120, 60;
    --hover: rgba(255, 120, 60, 0.08);
    --focus: rgba(255, 149, 99, 0.7);
    --focus-soft: rgba(255, 120, 60, 0.2);
    --green: #6bd497;
    --green-soft: #16291e;
    --green-line: #285a3e;
    --status-ok: #4cc47f;
    --blue: #8cbaff;
    --blue-soft: #16223a;
    --blue-line: #2c4774;
    --yellow: #e3b341;
    --yellow-soft: #2d2410;
    --yellow-line: #5a4718;
    --yellow-ink: #e8c46a;
    --red: #ff8a72;
    --tag-bg: #27211b;
    --tag-line: #392f26;
    --tag-ink: #cfc5b8;
    --note-bg: #282012;
    --note-line: #4b3d1e;
    --note-ink: #e4d5b2;
    --mark-bg: #2b241d;
    --mark-ink: #e8dccd;
    --toast-bg: #f2ebe2;
    --toast-ink: #1a140f;
    --backdrop: rgba(0, 0, 0, 0.55);
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
    --shadow-pop-color: rgba(0, 0, 0, 0.5);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-other: #5d554c;
    --chart-grid: #2c2620;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue);
}

.icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

:where(button, input, select, a):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 64px 1fr 34px;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(360px, 1fr);
  gap: 20px;
  align-items: stretch;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.hn-mark {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--orange);
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  align-items: stretch;
  justify-content: center;
  height: 100%;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0 18px;
  border-bottom: 3px solid transparent;
  min-width: 84px;
}

.tab:hover,
.tab:focus-visible {
  color: var(--orange-text);
}

.tab.is-active {
  color: var(--orange-text);
  border-bottom-color: var(--orange);
  font-weight: 700;
}

.status-dot {
  content: "";
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 99px;
  background: var(--status-ok);
  margin-right: 7px;
  vertical-align: 1px;
}

.saved-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0 8px 0 11px;
  white-space: nowrap;
}

.saved-button:hover,
.utility-menu > summary:hover {
  border-color: var(--accent-line);
}

.saved-button strong {
  min-width: 22px;
  border-radius: 99px;
  background: var(--surface-sunken);
  color: var(--ink);
  padding: 1px 7px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.saved-button.is-active {
  color: var(--on-accent);
  background: var(--accent-solid);
  border-color: var(--accent-solid);
}

.saved-button.is-active .icon {
  fill: currentColor;
}

.saved-button.is-active strong {
  background: color-mix(in srgb, var(--on-accent) 22%, transparent);
  color: var(--on-accent);
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr) minmax(360px, 420px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.left-rail,
.workbench {
  min-width: 0;
  background: var(--surface-rail);
}

.left-rail {
  border-right: 1px solid var(--line);
  padding: 22px 12px;
  overflow: auto;
}

.rail-section {
  padding-bottom: 12px;
}

.rail-section h2 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding: 0 8px;
}

.month-list {
  display: grid;
  gap: 1px;
}

.archive-toggle {
  width: 100%;
  min-height: 34px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  margin-top: 8px;
  padding: 6px 8px;
  text-align: left;
  font-size: 13px;
}

.archive-toggle:hover {
  color: var(--orange-text);
  border-color: var(--accent-line);
}

.month-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 5px;
  padding: 6px 8px;
  text-align: left;
  font-size: 14px;
}

.month-row:hover {
  background: var(--hover);
}

.month-row.is-active {
  color: var(--orange-text);
  background: var(--orange-soft);
  box-shadow: inset 3px 0 0 var(--orange);
  font-weight: 700;
}

.month-row.is-muted {
  color: var(--faint);
}

.month-row span:last-child {
  color: var(--faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.month-row.is-active span:last-child {
  color: inherit;
}

.main-panel {
  min-width: 0;
  overflow: auto;
  padding: 22px 24px 20px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-bottom: 12px;
}

.view-header h2,
.subpage h2 {
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.view-header p,
.subpage p {
  color: var(--muted);
  max-width: 720px;
}

.thread-link {
  color: var(--ink-2);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.thread-link:hover {
  color: var(--orange-text);
  text-decoration-color: currentColor;
}

.partial-note {
  display: block;
  margin-top: 4px;
  color: var(--yellow-ink);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(190px, 1.25fr);
  grid-template-areas:
    "search search search sort"
    "category type effort reset";
  gap: 10px 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  margin-bottom: 14px;
}

.toolbar .search-wrap {
  grid-area: search;
}

.toolbar .filter-category {
  grid-area: category;
}

.toolbar .filter-type {
  grid-area: type;
}

.toolbar .filter-effort {
  grid-area: effort;
}

.toolbar .filter-sort {
  grid-area: sort;
}

.toolbar #clearFilters {
  grid-area: reset;
  justify-self: start;
  border-color: transparent;
  background: transparent;
  color: var(--orange-text);
  font-weight: 650;
  padding: 0 10px;
}

.toolbar #clearFilters:hover {
  background: var(--hover);
}

.mobile-filter-toggle {
  display: none;
}

.filter-control {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.toolbar-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.search-wrap input,
.toolbar select,
.ghost-button {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  min-height: 38px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.ghost-button:hover {
  border-color: var(--accent-line);
  background: var(--hover);
}

.search-wrap input {
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a8075' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='m10.5 10.5 3 3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px 50%;
  background-size: 15px;
}

.search-wrap input:focus,
.toolbar select:focus {
  border-color: var(--accent-line);
}

.toolbar select {
  min-width: 0;
}

.ghost-button {
  width: auto;
  white-space: nowrap;
}

.idea-cards {
  display: none;
}

/* Product shell: two core views plus global support controls. */
.topbar {
  grid-template-columns: minmax(260px, 1fr) auto minmax(280px, 1fr);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.utility-menu {
  position: relative;
}

.utility-menu > summary {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 0 12px;
  list-style: none;
  white-space: nowrap;
}

.utility-menu > summary::-webkit-details-marker {
  display: none;
}

.utility-menu > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  margin-left: 10px;
  transition: transform 140ms ease;
}

.utility-menu[open] > summary::after {
  transform: translateY(2px) rotate(225deg);
}

.utility-menu[open] > summary {
  border-color: var(--accent-line);
  background: var(--orange-soft);
}

.utility-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 92px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 22px 54px var(--shadow-pop-color);
  padding: 16px;
}

.utility-popover section {
  display: grid;
  gap: 8px;
}

.utility-popover-header {
  position: sticky;
  top: -16px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  padding: 8px 0;
  margin: -8px 0 12px;
  border-bottom: 1px solid var(--line);
}

.utility-popover section + section {
  border-top: 1px solid var(--line);
  margin-top: 15px;
  padding-top: 15px;
}

.utility-popover p,
.utility-popover small {
  color: var(--muted);
  line-height: 1.5;
}

.utility-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 2px 0;
}

.utility-facts div {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px;
}

.utility-facts dt {
  color: var(--muted);
  font-size: 11px;
}

.utility-facts dd {
  margin: 3px 0 0;
  font-weight: 750;
}

.backup-actions > div {
  display: flex;
  gap: 8px;
}

.rail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.rail-section .rail-heading h2 {
  margin: 0;
}

.workspace.is-context-view {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.is-context-view .left-rail,
.workspace.is-context-view .workbench {
  display: none;
}

.results-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 16px;
  color: var(--muted);
  font-size: 12px;
  padding: 0 2px 10px;
}

.results-summary #resultCount {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}



textarea {
  font: inherit;
}

.active-filter-note {
  border: 1px solid var(--accent-line);
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  background: var(--orange-soft);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.active-filter-note[hidden] {
  display: none;
}

.active-filter-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.focus-copy {
  display: grid;
  gap: 4px;
}

.focus-kicker {
  color: var(--orange-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.focus-copy p,
.focus-copy small {
  color: var(--muted);
}

.idea-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px;
  cursor: pointer;
  transition: border-color 120ms ease;
}

.idea-card:hover {
  border-color: var(--line-strong);
}

.idea-card.is-selected {
  border-color: var(--accent-line);
  box-shadow: inset 3px 0 0 var(--orange);
}

.card-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
}

.card-head h3 {
  font-size: 16px;
  line-height: 1.2;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.card-head p {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.card-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0 0 43px;
}

.card-signals span {
  border-radius: 99px;
  background: var(--tag-bg);
  color: var(--tag-ink);
  padding: 1px 8px;
  font-size: 12px;
  line-height: 1.6;
}

.card-signals span:first-child {
  color: var(--ink);
  font-weight: 650;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.card-actions .text-link {
  margin-left: auto;
}

.table-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: auto;
}

.idea-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

.idea-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  color: var(--muted);
  background: var(--surface-tint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  line-height: 1.15;
  white-space: normal;
}

.idea-table th:first-child,
.idea-table td:first-child {
  padding-left: 12px;
}

.idea-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  vertical-align: top;
}

.idea-table tr:last-child td {
  border-bottom: 0;
}

.idea-table tbody tr {
  background: transparent;
  cursor: pointer;
}

.idea-table tbody tr:hover {
  background: var(--surface-tint);
}

.idea-table tbody tr.is-selected {
  background: var(--selected);
  box-shadow: inset 3px 0 0 var(--orange);
}

.idea-table tbody tr.is-selected .project-select {
  color: var(--orange-text);
}

.empty-row {
  padding: 0;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 28px 20px;
  color: var(--ink);
}

.empty-state strong {
  font-size: 16px;
}

.empty-state span {
  color: var(--muted);
}

.idea-cell {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
}

.project-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--mark-ink);
  background: var(--mark-bg);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.idea-card .project-mark {
  width: 32px;
  height: 32px;
}

.project-name {
  display: inline;
  font-size: 15px;
  font-weight: 750;
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}

.project-select {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.project-select:hover {
  color: var(--orange-text);
  text-decoration: underline;
}

.project-desc {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.idea-table .tag-list {
  max-height: 22px;
  overflow: hidden;
}

.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--tag-line);
  background: var(--tag-bg);
  border-radius: 99px;
  color: var(--tag-ink);
  padding: 0 7px;
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}

.reply-count {
  display: grid;
  gap: 3px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.reply-count strong {
  color: var(--ink);
}

.reply-count span {
  color: var(--muted);
  font-size: 11px;
}

.load-more-button {
  min-height: 46px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 650;
}

.idea-table .pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 99px;
  border: 1px solid transparent;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.high {
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green-line);
}

.pill.team {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--blue-line);
}

.try-next {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--ink-2);
  font-size: 12px;
  min-width: 0;
}

.try-next input {
  margin: 0;
  accent-color: var(--orange);
}

/* Save toggle: a native checkbox drawn as a bookmark. */
.try-next input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  cursor: pointer;
  background-color: var(--faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='black' stroke-width='1.4' stroke-linejoin='round' d='M4 2.5h8a.5.5 0 0 1 .5.5v10.6a.3.3 0 0 1-.48.24L8 10.9l-4.02 2.94a.3.3 0 0 1-.48-.24V3a.5.5 0 0 1 .5-.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='black' stroke-width='1.4' stroke-linejoin='round' d='M4 2.5h8a.5.5 0 0 1 .5.5v10.6a.3.3 0 0 1-.48.24L8 10.9l-4.02 2.94a.3.3 0 0 1-.48-.24V3a.5.5 0 0 1 .5-.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.try-next input[type="checkbox"]:hover {
  background-color: var(--orange-text);
}

.try-next input[type="checkbox"]:checked {
  background-color: var(--orange);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' stroke='black' stroke-width='1.4' stroke-linejoin='round' d='M4 2.5h8a.5.5 0 0 1 .5.5v10.6a.3.3 0 0 1-.48.24L8 10.9l-4.02 2.94a.3.3 0 0 1-.48-.24V3a.5.5 0 0 1 .5-.5Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' stroke='black' stroke-width='1.4' stroke-linejoin='round' d='M4 2.5h8a.5.5 0 0 1 .5.5v10.6a.3.3 0 0 1-.48.24L8 10.9l-4.02 2.94a.3.3 0 0 1-.48-.24V3a.5.5 0 0 1 .5-.5Z'/%3E%3C/svg%3E");
}

.try-next input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.idea-table .try-next {
  justify-content: center;
  padding-top: 1px;
}

.idea-table .try-next span {
  display: none;
}

/* Six-column Ideas table. */
.idea-table th:nth-child(1),
.idea-table td:nth-child(1) {
  width: 44%;
}

.idea-table th:nth-child(2),
.idea-table td:nth-child(2) {
  width: 15%;
}

.idea-table th:nth-child(3),
.idea-table td:nth-child(3),
.idea-table th:nth-child(4),
.idea-table td:nth-child(4) {
  width: 11%;
}

.idea-table th:nth-child(5),
.idea-table td:nth-child(5) {
  width: 13%;
}

.idea-table th:nth-child(6),
.idea-table td:nth-child(6) {
  width: 6%;
}

.category-label,
.type-note {
  display: block;
}

.category-label {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.type-note {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.evidence-count,
.reply-count {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.evidence-count strong,
.reply-count strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.evidence-count span,
.reply-count span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.evidence-count.is-zero strong,
.reply-count.is-zero strong {
  color: var(--faint);
  font-weight: 500;
}

.card-actions .text-link {
  color: var(--blue);
  font-size: 13px;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.card-save-inline {
  min-height: 38px;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 12px 0 10px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.card-save-inline:has(input:checked) {
  border-color: var(--accent-line);
  background: var(--orange-soft);
  color: var(--orange-text);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.sample-note {
  color: var(--muted);
}

.workbench {
  border-left: 1px solid var(--line);
  padding: 22px 22px 18px;
  overflow: auto;
}

.workbench-mobile-head {
  display: none;
}

#workbenchContent,
.workbench-top > div {
  min-width: 0;
}

.workbench-top {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.workbench-top .project-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  font-size: 13px;
}

.workbench h2 {
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.workbench-top p {
  color: var(--ink-2);
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.workbench .external {
  color: var(--blue);
  font-size: 13px;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.workbench .external:hover {
  text-decoration: underline;
}

.meta-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
  margin-bottom: 18px;
}

.evidence-source {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 2px;
}

.evidence-source strong {
  color: var(--ink-2);
  font-weight: 650;
}

.meta-list dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.meta-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

.work-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.work-section:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}

.work-section h3 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.evidence {
  color: var(--ink);
  background: var(--surface-tint);
  border-left: 3px solid var(--orange);
  border-radius: 0 6px 6px 0;
  padding: 10px 12px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.comment-stack {
  display: grid;
  gap: 8px;
}

.hot-comment {
  border-left: 2px solid var(--line-strong);
  padding: 2px 0 2px 11px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 7px;
}

.comment-stack {
  gap: 12px;
  margin-top: 10px;
}

.hot-comment p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.comment-meta {
  margin-bottom: 4px;
}

.source-state {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.source-state:hover {
  text-decoration: underline;
}

.source-state.missing {
  color: var(--yellow-ink);
  background: var(--yellow-soft);
  border-color: var(--yellow-line);
}

.source-state.verified {
  color: var(--blue);
}

.source-state.verified::after {
  content: " ↗";
}

.workbench-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 14px;
}

.workbench-actions.is-sticky {
  position: sticky;
  bottom: -18px;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  padding: 10px 0;
  backdrop-filter: blur(8px);
}

.workbench-disclosure {
  border-top: 1px solid var(--line);
  margin-bottom: 0;
}

.workbench-disclosure:last-child {
  border-bottom: 1px solid var(--line);
}

.workbench-disclosure > summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

.workbench-disclosure > summary::-webkit-details-marker {
  display: none;
}

.workbench-disclosure > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-right: 4px;
  transition: transform 140ms ease;
}

.workbench-disclosure[open] > summary::after {
  transform: rotate(225deg);
}

.workbench-disclosure > summary:hover {
  color: var(--orange-text);
}

.idea-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.idea-facts span {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: var(--muted);
  padding: 10px 0;
  font-size: 12px;
}

.idea-facts span:nth-child(odd) {
  padding-right: 12px;
}

.idea-facts span:nth-child(even) {
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.idea-facts span:nth-child(-n + 2) {
  border-bottom: 1px solid var(--line);
}

.idea-facts strong {
  order: 2;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.personal-note {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  margin-bottom: 14px;
}

.personal-note p {
  color: var(--ink-2);
}

.personal-note label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.personal-note label span,
.personal-note small,
.personal-note.is-locked p,
.source-boundary,
.section-note,
.empty-copy {
  color: var(--muted);
  font-size: 12px;
}

.personal-note textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  padding: 9px 10px;
  line-height: 1.45;
}

.personal-note textarea:focus {
  border-color: var(--accent-line);
  outline: 2px solid var(--focus-soft);
}

.personal-note.is-locked {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  border-style: dashed;
  background: transparent;
  padding: 10px 12px;
}

.personal-note.is-locked strong {
  font-size: 13px;
}

.workbench-actions .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.source-boundary {
  margin-top: 10px;
}

.workbench-backdrop {
  display: none;
}

.disclosure-body {
  padding: 0 0 14px;
}

.disclosure-body > :last-child {
  margin-bottom: 0;
}

.primary-button,
.secondary-button {
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 14px;
  font-weight: 650;
}

.primary-button {
  border: 1px solid var(--accent-solid);
  background: var(--accent-solid);
  color: var(--on-accent);
}

.primary-button:hover {
  filter: brightness(1.08);
}

.primary-button.is-saved {
  border-color: var(--accent-line);
  background: var(--orange-soft);
  color: var(--orange-text);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--accent-line);
  background: var(--hover);
}

.workbench-empty {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 240px;
}

.workbench-empty h2 {
  font-size: 21px;
}

.workbench-empty p {
  color: var(--muted);
}

.subpage {
  max-width: 1100px;
}

.section-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--orange-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 0 18px;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface);
}

#dataStatus.has-warning {
  color: var(--red);
}

#dataStatus.has-warning .status-dot {
  background: var(--red);
}

.toast {
  position: fixed;
  right: 364px;
  bottom: 10px;
  z-index: 40;
  max-width: min(320px, calc(100vw - 48px));
  background: var(--toast-bg);
  color: var(--toast-ink);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Real cross-month candidate composition, derived from the published payload. */
.trends-page {
  max-width: 1500px;
  margin: 0 auto;
}

.trends-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 16px;
}

.trend-metric-control {
  width: min(260px, 100%);
  flex: 0 0 auto;
}

.trend-metric-control select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
}

.trend-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 14px;
}

.trend-summary div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.trend-summary strong {
  font-size: 18px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.trend-summary span {
  color: var(--muted);
  font-size: 13px;
}

/* Trends charts: the at-a-glance view of the same numbers as the matrix below. */
.trend-chart {
  min-width: 0;
  margin-bottom: 16px;
}

.chart-grid.is-two-up {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-grid:not(.is-two-up) {
  display: grid;
  gap: 16px;
}

.chart-panel {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px 14px 6px;
}

.chart-grid .chart-panel {
  padding-inline: 10px;
}

.chart-panel figcaption {
  display: grid;
  gap: 2px;
  margin: 0 0 10px 4px;
}

.chart-panel figcaption strong {
  font-size: 15px;
  font-weight: 700;
}

.chart-panel figcaption span {
  color: var(--muted);
  font-size: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  list-style: none;
  margin: 0 0 6px 4px;
  padding: 0;
  color: var(--ink-2);
  font-size: 12px;
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.chart-canvas {
  position: relative;
}

.trend-svg {
  display: block;
  max-width: 100%;
  overflow: visible;
  font-family: var(--sans);
}

.chart-grid-line {
  stroke: var(--chart-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.chart-tick,
.chart-year {
  fill: var(--faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-month {
  fill: var(--muted);
  font-size: 11px;
}

.chart-month.is-gap {
  fill: var(--faint);
}

.chart-end-label,
.chart-cap-label {
  fill: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart-line {
  fill: none;
  stroke: var(--series-2);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-area {
  fill: var(--series-2);
  opacity: 0.1;
}

.chart-dot {
  fill: var(--series-2);
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-end-dot {
  fill: var(--series-2);
  stroke: var(--surface);
  stroke-width: 2;
}

.chart-column {
  fill: var(--series-2);
}

.chart-gap {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.chart-hit {
  fill: transparent;
}

.chart-hit[data-chart-month] {
  cursor: pointer;
}

.chart-hit.is-hover:not(.is-segment) {
  fill: var(--ink);
  fill-opacity: 0.06;
}

/* Stacked columns: hovering a segment recedes the rest instead of painting a band. */
.chart-segment {
  transition: opacity 120ms ease;
}

.trend-svg:has(.chart-hit.is-segment.is-hover) .chart-segment {
  opacity: 0.35;
}

.trend-svg .chart-seg:has(.is-hover) .chart-segment {
  opacity: 1;
}

.chart-tooltip {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 2px;
  min-width: 140px;
  max-width: 240px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 28px var(--shadow-pop-color);
  padding: 8px 10px;
  font-size: 12px;
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip span {
  color: var(--ink-2);
}

.chart-tooltip small {
  color: var(--muted);
  font-size: 11px;
}

.trend-matrix {
  min-width: 0;
}

.trend-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  scrollbar-gutter: stable;
}

.trend-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.trend-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  background: var(--surface-tint);
  color: var(--ink-2);
  padding: 9px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 650;
}

.trend-table thead th:first-child {
  left: 0;
  z-index: 3;
  width: 200px;
  text-align: left;
  padding-left: 14px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trend-table thead th span,
.trend-table thead th small {
  display: block;
}

.trend-table thead th small {
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
}

.trend-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 200px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
}

.trend-table tbody th strong {
  font-weight: 650;
}

.trend-table tbody th strong,
.trend-table tbody th span {
  display: block;
}

.trend-table tbody th span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  margin-top: 3px;
}

.trend-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(var(--heat), calc(var(--trend-a, 0) * 0.5));
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.trend-table td:last-child {
  border-right: 0;
}

.trend-table tr:last-child th,
.trend-table tr:last-child td {
  border-bottom: 0;
}

/* Share cells are tinted by value; the number and n/N note keep them readable without color. */
.trend-cell {
  position: relative;
  width: 100%;
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 6px 4px;
  overflow: hidden;
}

button.trend-cell:hover,
button.trend-cell:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: -2px;
  border-radius: 0;
}

.trend-value {
  position: relative;
  z-index: 1;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.trend-cell small {
  position: relative;
  z-index: 1;
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

/* A real zero stays a plain cell; only unavailable months get the hatched gap treatment. */
.trend-table td.is-gap,
.trend-table td.is-zero {
  color: var(--faint);
}

.trend-table td.is-gap .trend-cell,
.trend-table td.is-zero .trend-cell,
.trend-table td.is-gap small,
.trend-table td.is-zero small {
  color: var(--faint);
}

.trend-table td.is-gap {
  background: repeating-linear-gradient(135deg, var(--surface-sunken) 0 6px, transparent 6px 12px);
}

.trend-row.is-sample th,
.trend-row.is-sample td {
  background-color: var(--surface-tint);
  border-bottom-color: var(--line-strong);
}

.trend-row.is-sample td.is-gap {
  background: repeating-linear-gradient(135deg, var(--surface-sunken) 0 6px, transparent 6px 12px);
}

.trend-caveat {
  max-width: 980px !important;
  color: var(--muted) !important;
  font-size: 12px;
  margin-top: 12px;
}

@media (max-width: 1360px) {
  .workspace {
    grid-template-columns: 200px minmax(0, 1fr) minmax(340px, 380px);
  }

  .left-rail {
    padding: 20px 10px;
  }

  .main-panel {
    padding: 22px 18px 18px;
  }

  .workbench {
    padding: 22px 16px 18px;
  }

  .view-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar {
    gap: 8px;
  }
}

@media (min-width: 1181px) and (max-width: 1360px) {
  .topbar {
    grid-template-columns: minmax(184px, 0.7fr) minmax(340px, 1fr) minmax(320px, auto);
    gap: 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .brand p {
    display: none;
  }

  .tabs {
    min-width: 0;
  }

  .tab {
    min-width: 0;
    padding-inline: 10px;
  }

}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-rows: auto 1fr 34px;
  }

  /* Two compact rows: brand · About, then tabs · Saved. */
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "brand menu"
      "tabs aux";
    height: auto;
    padding: 10px 16px 0;
    gap: 6px 12px;
  }

  .topbar .brand {
    grid-area: brand;
  }

  .topbar .tabs {
    grid-area: tabs;
    justify-content: flex-start;
    height: auto;
  }

  .topbar .topbar-actions {
    display: contents;
  }

  .topbar .utility-menu {
    grid-area: menu;
    align-self: center;
    justify-self: end;
  }

  .topbar .saved-button,
  .topbar .site-return {
    grid-area: aux;
    align-self: center;
    justify-self: end;
  }

  .topbar .tab {
    min-height: 44px;
  }

  .workspace {
    grid-template-columns: 180px minmax(0, 1fr) minmax(300px, 330px);
  }

  .view-header {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "search search"
      "category type"
      "effort sort"
      "reset reset";
  }

  .workbench-actions {
    grid-template-columns: 1fr;
  }

  .toast {
    right: 324px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .workspace {
    grid-template-columns: 200px minmax(0, 1fr);
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .workbench {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

}

@media (max-width: 820px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  body {
    font-size: 14px;
    overflow-x: hidden;
  }

  body.workbench-drawer-open {
    overflow: hidden;
  }

  .topbar {
    position: static;
    padding: 8px 14px 0;
  }

  .brand {
    gap: 10px;
  }

  .hn-mark {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .brand h1 {
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand p {
    display: none;
  }

  .topbar,
  .brand,
  .tabs,
  .main-panel,
  .idea-card,
  .card-head {
    min-width: 0;
    max-width: 100%;
  }

  .workspace {
    display: flex;
    flex-direction: column;
  }

  .left-rail {
    order: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
    overflow: hidden;
  }

  .main-panel {
    order: 2;
    padding: 16px 14px;
  }

  .workbench {
    display: none;
  }

  .workbench.is-mobile-open {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    width: 100%;
    max-width: none;
    height: 100dvh;
    border: 0;
    background: var(--bg);
    padding: 0 16px calc(28px + env(safe-area-inset-bottom));
    overflow: auto;
    overscroll-behavior: contain;
  }

  .workbench-mobile-head {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    padding: 10px 0;
    margin-bottom: 14px;
    backdrop-filter: blur(8px);
  }

  .workbench-mobile-head .ghost-button {
    width: auto;
    min-height: 44px;
  }

  .workbench-mobile-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .left-rail .rail-section {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }

  /* The month strip is self-describing; keep its heading for assistive tech only. */
  .left-rail .rail-heading h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .left-rail .month-list {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 14px 4px;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 14px;
    scrollbar-width: none;
  }

  .left-rail .month-list::-webkit-scrollbar {
    display: none;
  }

  .left-rail .month-row,
  .left-rail .archive-toggle {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--surface);
    padding: 0 13px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .left-rail .month-row.is-active {
    border-color: var(--accent-line);
    background: var(--orange-soft);
    box-shadow: none;
  }

  .left-rail .archive-toggle {
    border-style: dashed;
  }

  .tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    width: 100%;
    padding: 0 6px;
    font-size: 14px;
    overflow: hidden;
  }

  .saved-button {
    min-height: 40px;
  }

  .view-header {
    grid-template-columns: 1fr;
  }

  .mobile-filter-toggle {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    padding: 0 12px 0 36px;
    margin-bottom: 10px;
    font-weight: 650;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a8075' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='m10.5 10.5 3 3' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px 50%;
    background-size: 15px;
  }

  .mobile-filter-toggle .filter-count {
    border-radius: 99px;
    background: var(--orange-soft);
    color: var(--orange-text);
    padding: 1px 8px;
    font-size: 12px;
  }

  .mobile-filter-toggle .filter-count[hidden] {
    display: none;
  }

  .mobile-filter-toggle::after {
    content: "+";
    margin-left: auto;
    color: var(--orange-text);
    font-size: 20px;
  }

  .mobile-filter-toggle[aria-expanded="true"]::after {
    content: "−";
  }

  .toolbar {
    display: none;
  }

  .toolbar.is-mobile-open {
    display: grid;
  }

  .toolbar #clearFilters {
    justify-self: stretch;
    border-color: var(--line-strong);
  }

  .view-header {
    margin-bottom: 10px;
  }

  .view-header h2,
  .subpage h2 {
    font-size: 23px;
  }

  .view-header p {
    font-size: 13px;
  }

  .active-filter-note {
    grid-template-columns: 1fr;
  }

  .idea-cards {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
  }

  .toolbar {
    margin-bottom: 14px;
  }

  .search-wrap input,
  .toolbar select,
  .ghost-button,
  .primary-button,
  .secondary-button {
    min-height: 44px;
  }

  .table-shell {
    display: none;
  }

  .table-footer {
    display: grid;
    align-items: start;
    justify-content: stretch;
  }

  .table-footer .ghost-button {
    width: 100%;
  }

  .workbench-actions {
    grid-template-columns: 1fr 1fr;
  }

  .workbench-actions.is-sticky {
    bottom: calc(-28px - env(safe-area-inset-bottom));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .card-actions .secondary-button,
  .card-save-inline {
    min-height: 40px;
  }

  .meta-list {
    grid-template-columns: 1fr 1fr;
  }

  .statusbar {
    display: grid;
    gap: 4px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
  }
}

/* Overrides for the simplified two-view shell. */
@media (max-width: 1180px) {
  .workspace.is-context-view {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .utility-popover {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: calc(100vw - 28px);
    max-height: calc(100dvh - 200px);
  }

  .backup-actions > div,
  .results-summary,
  .trends-heading {
    display: grid;
  }

  .trend-metric-control {
    width: 100%;
  }

  .trend-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
  }

  .trend-summary div {
    display: grid;
    gap: 0;
  }

  .trend-summary span {
    font-size: 12px;
    line-height: 1.3;
  }

  .trend-table {
    min-width: 1040px;
  }

  .trend-table thead th:first-child,
  .trend-table tbody th {
    width: 180px;
  }

  .card-head > .card-save-inline {
    grid-column: 1 / -1;
    min-height: 44px;
  }

  .idea-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    border: 0;
    background: var(--backdrop);
  }

  .workspace.is-context-view .left-rail,
  .workspace.is-context-view .workbench {
    display: none;
  }
}

@media (max-width: 360px) {
  .hn-mark {
    display: none;
  }

  .topbar {
    grid-template-areas:
      "brand menu"
      "tabs tabs"
      "aux aux";
  }

  .topbar .saved-button,
  .topbar .site-return {
    justify-self: start;
    margin-bottom: 8px;
  }
}
