:root {
  color-scheme: light;
  --paper: #f8f9f7;
  --ink: #23312e;
  --muted: #5e6b65;
  --line: #dce2dc;
  --accent: #266b59;
  --soft: #e7efe9;
  --sidebar: #202e29;
  --focus: #167cbb;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
::selection {
  background: #c9e4d6;
  color: #152f24;
}
input {
  caret-color: var(--accent);
}
[hidden] {
  display: none !important;
}
.skip {
  position: fixed;
  left: 10px;
  top: -80px;
  z-index: 100;
  background: white;
  padding: 14px;
}
.skip:focus {
  top: 10px;
}
h1,
h2,
h3,
p {
  margin: 0;
}
button {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  min-height: 40px;
}
button:hover {
  background: var(--soft);
}
.primary {
  background: var(--accent);
  color: white;
  padding: 12px 20px;
}
.primary:hover {
  background: #1b5445;
}
.secondary {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 16px;
}
.gate {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px;
}
.gate form {
  width: min(100%, 380px);
}
.mark {
  width: 44px;
  height: 44px;
  background: var(--soft);
  padding: 8px;
  border-radius: 10px;
  margin-bottom: 30px;
}
.mark svg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}
.gate h1 {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 550;
  margin-bottom: 18px;
}
.gate p {
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 28px;
}
.gate label {
  display: block;
  font-weight: 550;
  margin-bottom: 8px;
}
.gate input {
  width: 100%;
  height: 48px;
  border: 1px solid #aab8af;
  border-radius: 7px;
  padding: 12px;
  background: #fff;
  margin-bottom: 12px;
}
.gate button {
  width: 100%;
}
.gate #login-status {
  margin: 16px 0;
  font-size: 13px;
}
.gate small {
  color: var(--muted);
}
#app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100svh;
}
.sidebar {
  background: var(--sidebar);
  color: #d3ddd7;
  padding: 34px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100svh;
}
.brand {
  color: #f1f6f2;
  font-size: 24px;
  letter-spacing: -0.03em;
  text-decoration: none;
  padding: 0 16px;
}
.brand span {
  display: block;
  font-size: 12px;
  color: #b8c9be;
  letter-spacing: 0;
  margin-top: 5px;
}
.nav-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  margin: 46px 16px 12px;
  color: #b8c9be;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.sidebar nav button {
  color: #d3ddd7;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 15px;
  width: 100%;
  border-radius: 6px;
}
.sidebar nav button:hover,
.sidebar nav button[aria-current="true"] {
  background: #344a3f;
  color: #fff;
}
.nav-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.sidebar nav .total {
  margin-left: auto;
  font-size: 11px;
  color: #c2d1c7;
  font-variant-numeric: tabular-nums;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 30px 14px 0;
}
.sidebar-bottom p {
  font-size: 12px;
  line-height: 1.7;
  color: #b8c9be;
  margin: 12px 0;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a4cbb4;
  display: inline-block;
  margin-right: 7px;
}
.private-label {
  font-size: 12px;
}
.quiet {
  color: #d3ddd7;
  padding: 0;
}
.quiet:hover {
  background: #344a3f;
}
main {
  min-width: 0;
}
.topbar {
  height: 74px;
  padding: 0 36px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.breadcrumb {
  font-size: 12px;
  color: var(--muted);
}
.breadcrumb span {
  padding: 0 12px;
  color: #89958e;
}
.breadcrumb strong {
  font-weight: 500;
  color: var(--ink);
}
.topbar-actions { display:flex;align-items:center;gap:10px }
.history-controls { display:flex;gap:4px;margin-right:12px }
.history-controls button { width:32px;min-height:36px;display:grid;place-items:center }
.history-controls svg { width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.5 }
.breadcrumb { margin-right:auto }
.note-actions { display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px }
.note-actions button { font-size:12px;padding:0 10px }
.graph-pages { display:flex;align-items:center;justify-content:space-between;gap:8px;margin:16px 0;font-size:12px }
.graph-tools { flex-wrap:wrap }
.graph-tools > div { flex-wrap:wrap;gap:4px }
.mobile-lock { display:none }
.readonly {
  font-size: 11px;
  border: 1px solid var(--line);
  padding: 5px 9px;
  border-radius: 20px;
}
.workspace-heading {
  padding: 38px 36px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.workspace-heading h1 {
  font-size: 29px;
  letter-spacing: -0.025em;
  font-weight: 550;
  margin-bottom: 9px;
}
.workspace-heading p {
  color: var(--muted);
  line-height: 1.6;
}
.toolbar {
  padding: 0 36px 25px;
  display: flex;
  gap: 16px;
  align-items: center;
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  max-width: 540px;
  flex: 1;
  padding: 0 13px;
  height: 43px;
}
.search svg {
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.5;
}
.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  outline-offset: 0;
  padding: 10px 0;
}
.search input::placeholder {
  color: var(--muted);
}
kbd {
  font: 12px inherit;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 5px;
  border-radius: 3px;
}
.view-toggle {
  margin-left: auto;
  background: #e9ede8;
  display: flex;
  padding: 3px;
  border-radius: 8px;
}
.view-toggle button {
  min-height: 34px;
  padding: 0 18px;
  font-size: 13px;
  color: var(--muted);
}
.view-toggle button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px #17251a15;
}
#mobile-category {
  display: none;
}
#notice {
  margin: 0 36px;
  color: #805022;
  line-height: 1.6;
}
#notice:not(:empty) {
  padding: 12px 0;
}
.content {
  display: flex;
  border-top: 1px solid var(--line);
  min-height: calc(100svh - 310px);
}
.results {
  flex: 1;
  min-width: 0;
  padding: 22px 36px;
}
.result-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  font-variant-numeric: tabular-nums;
}
.note-row {
  width: 100%;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 20px 4px;
  text-align: left;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.note-row:hover,
.note-row[aria-current="true"] {
  background: #edf2ec;
}
.note-row h2 {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.note-row p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kind {
  font-size: 10px;
  text-transform: capitalize;
  color: var(--muted);
  padding-top: 5px;
}
.type-mark {
  width: 27px;
  height: 30px;
  border: 1px solid #b2c3b7;
  border-radius: 4px;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}
.details {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 24px;
  overflow-wrap: anywhere;
}
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}
.detail-head span {
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
}
.details h2 {
  font-size: 24px;
  font-weight: 550;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}
.details h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 26px 0 12px;
}
.fact {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.fact p {
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}
.fact small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 12px;
  line-height: 1.7;
}
.relationship {
  display: block;
  text-align: left;
  width: 100%;
  padding: 10px 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.7;
}
.relationship span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.empty {
  padding: 60px 0;
  max-width: 450px;
}
.empty h2 {
  font-size: 21px;
  font-weight: 500;
  margin-bottom: 12px;
}
.empty p {
  color: var(--muted);
  line-height: 1.8;
}
.graph-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}
.graph-tools button {
  border: 1px solid var(--line);
  background: white;
  min-width: 38px;
  margin-left: 4px;
  padding: 0 10px;
}
.graph-tools > div {
  display: flex;
}
#graph {
  width: 100%;
  height: min(57vh, 600px);
  display: block;
  touch-action: none;
  cursor: grab;
}
.edge {
  stroke: #9bad9f;
  stroke-width: 1.4;
}
.edge.disputed {
  stroke-dasharray: 5 5;
}
.graph-node {
  cursor: pointer;
}
.graph-node circle {
  fill: #f4f8f2;
  stroke: #668c74;
  stroke-width: 1.5;
}
.graph-node.selected circle {
  fill: #266b59;
  stroke: #266b59;
}
.graph-node text {
  font:
    13px -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  fill: var(--ink);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.graph-node:hover circle {
  stroke-width: 3;
}
.graph-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.graph-chip {
  font-size: 12px;
  padding: 5px 10px;
  margin: 8px 6px 0 0;
  border: 1px solid var(--line);
  min-height: 32px;
}
footer {
  border-top: 1px solid var(--line);
  padding: 17px 36px;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
#load-more {
  margin-top: 20px;
}
* {
  scrollbar-width: thin;
  scrollbar-color: #b8c7bc transparent;
}
@media (min-width: 1600px) {
  .results {
    padding-right: 60px;
  }
  .workspace-heading,
  .toolbar,
  .topbar {
    padding-left: 48px;
  }
}
@media (max-width: 1100px) {
  #app {
    grid-template-columns: 185px minmax(0, 1fr);
  }
  .details {
    width: 290px;
    padding: 20px;
  }
  .results {
    padding: 20px;
  }
  .topbar,
  .workspace-heading,
  .toolbar,
  footer {
    padding-left: 24px;
    padding-right: 24px;
  }
  .toolbar {
    gap: 10px;
  }
}
@media (max-width: 760px) {
  .breadcrumb { font-size:11px }
  .breadcrumb span { padding:0 4px }
  .topbar .readonly { display:none }
  .history-controls { margin-right:6px;gap:0 }
  .mobile-lock { display:block;min-height:36px;padding:0 10px }
  #app {
    display: block;
  }
  .sidebar {
    display: none;
  }
  .topbar {
    height: 57px;
    padding: 0 20px;
  }
  .workspace-heading {
    padding: 27px 20px 20px;
  }
  .workspace-heading h1 {
    font-size: 25px;
  }
  .workspace-heading p {
    font-size: 13px;
  }
  .toolbar {
    padding: 0 20px 20px;
    flex-wrap: wrap;
  }
  .search {
    max-width: none;
    flex-basis: 100%;
  }
  .view-toggle {
    margin-left: 0;
  }
  .view-toggle button {
    padding: 0 14px;
  }
  #mobile-category {
    display: block;
    margin-left: auto;
    max-width: 52%;
    border: 1px solid var(--line);
    background: white;
    padding: 8px;
    border-radius: 7px;
    color: var(--ink);
  }
  .results {
    padding: 18px 20px;
  }
  .details {
    width: 100%;
    border-left: 0;
    padding: 22px;
  }
  .content:has(.details:not([hidden])) .results {
    display: none;
  }
  .result-meta {
    font-size: 10px;
  }
  .note-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .kind {
    display: none;
  }
  #snapshot-date {
    text-align: right;
  }
  #graph {
    height: 440px;
  }
  .graph-tools {
    align-items: flex-start;
  }
  .graph-tools p {
    max-width: 130px;
    line-height: 1.6;
  }
  footer {
    padding: 16px 20px;
    flex-direction: column;
    gap: 7px;
  }
  #notice {
    margin: 0 20px;
  }
  .gate h1 {
    font-size: 32px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: background 0.15s ease-out;
  }
  .details {
    animation: arrive 0.18s ease-out;
  }
  @keyframes arrive {
    from {
      opacity: 0.7;
    }
    to {
      opacity: 1;
    }
  }
}
