/* Adapted from the Local Codex graph workspace design. */
:root {
  color-scheme: light;
  --bg: #f3f3f0;
  --surface: #ffffff;
  --canvas: #fafbf8;
  --text: #20251f;
  --muted: #60675d;
  --line: #daddd5;
  --soft: #ecefe8;
  --accent: #28765a;
  --danger: #ac3535;
  --warning: #805714;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); scrollbar-color: #a7aea1 var(--bg); }
body { margin: 0; color: var(--text); font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif; -webkit-font-smoothing: antialiased; }
::selection { color: #164d38; background: #cde6d8; }
main { max-width: 1920px; margin: auto; padding: 0 32px 24px; }
h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.035em; font-weight: 600; }
h2 { margin: 0; font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; margin: 24px 0 8px; }
p { margin: 8px 0 16px; }
button, input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
button { min-height: 42px; padding: 9px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background-color .16s, border-color .16s; }
button:hover:not(:disabled) { background: var(--soft); border-color: #939d8c; }
button.primary { background: var(--text); color: white; border-color: var(--text); }
button.primary:hover:not(:disabled) { background: #354231; }
button.danger { color: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
input, select, textarea { display: block; width: 100%; min-width: 0; min-height: 42px; margin-top: 6px; padding: 9px 10px; caret-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[readonly] { background: var(--bg); }
select[multiple] { min-height: 96px; }
textarea { resize: vertical; }
label { display: block; min-width: 0; font-size: 12px; color: var(--muted); }
fieldset { min-width: 0; margin: 18px 0 0; padding: 0; border: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 14px; font-size: 13px; }
.top, .toolbar, .actions { display: flex; align-items: center; gap: 10px; }
.top { justify-content: space-between; min-height: 76px; margin: 0 -32px; padding: 12px 32px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 700; letter-spacing: -.025em; }
.brandmark { width: 32px; height: 32px; padding: 4px; border-radius: 8px; background: var(--text); color: white; fill: currentColor; }
.workspace-name { font-size: 13px; font-weight: 450; color: var(--muted); padding-left: 20px; margin-left: 9px; border-left: 1px solid var(--line); letter-spacing: 0; }
.actions { flex-wrap: wrap; margin-top: 14px; }
.top .actions { margin: 0; }
#workspaceToggle { border-color: transparent; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 28px 0 24px; }
.workspace-heading p { margin: 7px 0 0; }
.view-status { color: var(--muted); font-size: 12px; max-width: 370px; overflow-wrap: anywhere; }
.view-status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; }
.view-status.snapshot::before { background: var(--warning); }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 20px; margin-bottom: 16px; min-width: 0; }
#graphSection { border: 0; background: transparent; padding: 0; margin: 0; }
.graph-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.segmented { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 9px; background: #e8ebe3; }
.segmented button { min-height: 36px; padding: 7px 18px; background: transparent; border-color: transparent; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px #20251f12; }
.search { display: flex; align-items: center; gap: 8px; width: 330px; margin-left: auto; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.search svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.6; flex: 0 0 auto; }
.search input { margin: 0; border: 0; padding-left: 0; background: transparent; font-size: 13px; }
.filters { display: grid; grid-template-columns: 1fr 1fr 140px auto; gap: 14px; align-items: end; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; margin-bottom: 16px; }
.full { grid-column: 1 / -1; }
#filterHelp { margin: 0; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 320px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--surface); }
.canvas { min-width: 0; display: flex; flex-direction: column; background-color: var(--canvas); }
.canvas-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 20px 24px 12px; }
.canvas-heading h2 { font-size: 12px; font-weight: 600; color: var(--muted); }
#graphStatus { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.graph-scroll { height: max(460px, calc(100dvh - 400px)); max-height: 900px; overflow: auto; background-image: radial-gradient(#d5dbcf .7px, transparent .7px); background-size: 20px 20px; scrollbar-width: thin; }
.graph-scroll svg { display: block; overflow: visible; }
.node { cursor: pointer; outline: none; }
.node rect { fill: var(--surface); stroke: #a9b4a2; stroke-width: 1.2; filter: drop-shadow(0 2px 3px #20251f09); transition: stroke .18s, stroke-width .18s, fill .18s; }
.node.source rect { stroke: #579077; }
.node.sink rect { stroke: #b76c57; }
.node text { fill: var(--text); font-family: var(--mono); font-size: 13px; pointer-events: none; }
.node .subtitle { fill: var(--muted); font-size: 12px; }
.node .category { fill: var(--accent); font-size: 12px; }
.node.sink .category { fill: #9f4c31; }
.node.selected rect { stroke: var(--accent); stroke-width: 2.5; fill: #f2f8f1; animation: selection-in .28s cubic-bezier(.16, 1, .3, 1); }
.node:focus-visible rect, .node:hover rect { stroke: var(--text); stroke-width: 2.5; }
.edge { fill: none; stroke: #a6afa0; stroke-width: 1.4; cursor: pointer; transition: stroke .2s, stroke-width .2s; }
.edge.selected, .edge.connected { stroke: var(--accent); stroke-width: 2.5; }
.edge:hover, .edge:focus-visible { stroke: var(--text); stroke-width: 4; outline: none; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; }
.column-label, .graph-empty { fill: var(--muted); font-size: 12px; }
.column-label { font-family: var(--mono); }
.canvas-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; }
.canvas-hint { color: var(--muted); font-size: 12px; }
.zoom { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.zoom button { min-height: 36px; min-width: 36px; border: 0; background: transparent; padding: 6px 10px; }
.zoom output { min-width: 44px; text-align: center; font: 12px var(--mono); }
#fitGraph { border-left: 1px solid var(--line); border-radius: 0 6px 6px 0; }
#graphSelection { min-height: 37px; padding: 0 20px 14px; margin: 0; overflow-wrap: anywhere; }
.inspector { border-left: 1px solid var(--line); padding: 22px; min-width: 0; max-height: max(600px, calc(100dvh - 260px)); overflow: auto; }
.inspector > section:not([hidden]) { animation: inspector-in .25s cubic-bezier(.16, 1, .3, 1); }
.inspector-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.inspector-heading button { min-height: 34px; padding: 6px 11px; }
.inspector .fields { grid-template-columns: 1fr; gap: 13px; }
.inspector .actions { display: grid; grid-template-columns: 1fr; }
.inspector select, .inspector input { font-size: 13px; }
.inspector .help { margin-bottom: 20px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.help, .muted, .empty { color: var(--muted); font-size: 12px; }
.notice { margin: 12px 0; padding: 10px 14px; background: #e6f0e7; border: 1px solid #b9cbb7; border-radius: 7px; font-size: 13px; overflow-wrap: anywhere; }
.notice:empty { display: none; }
.notice.error { background: #faebeb; border-color: #ddabab; color: var(--danger); }
#activity { margin: 12px 0 0; }
.secondary { margin: 12px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.secondary > summary { padding: 14px 18px; font-size: 13px; color: var(--muted); cursor: pointer; }
.secondary[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.secondary > :not(summary) { margin-left: 18px; margin-right: 18px; }
.workspace-settings:not([open]) { display: none; }
.workspace-settings[open] { margin-top: 16px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.toolbar { justify-content: space-between; }
details:not(.secondary) { margin-top: 18px; }
details:not(.secondary) > summary { color: var(--muted); font-size: 12px; cursor: pointer; padding: 8px 0; }
pre { max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font: 12px/1.6 var(--mono); }
.workspace-footer { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; font-size: 12px; color: var(--muted); }
.metric { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.metric span { overflow-wrap: anywhere; }
.finding, .case { border-top: 1px solid var(--line); padding: 14px 0; }
.small, .badge { font-size: 12px; color: var(--muted); }
.warn { color: var(--warning); }
.pass { color: var(--accent); }
.fail { color: var(--danger); }
.snapshot { border-color: var(--warning); }
.break { overflow-wrap: anywhere; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; }
.check input { width: auto; min-height: 0; margin: 4px 0; }
.skip { position: fixed; top: -100px; left: 12px; z-index: 10; background: var(--surface); color: var(--text); padding: 12px; }
.skip:focus { top: 8px; }
@keyframes inspector-in { from { opacity: .5; transform: translateX(6px); } to { opacity: 1; transform: translateX(0); } }
@keyframes selection-in { from { stroke-width: 5; } to { stroke-width: 2.5; } }
@media (min-width: 1600px) { .workbench { grid-template-columns: minmax(0, 1fr) 350px; } }
@media (max-width: 1050px) {
  main { padding: 0 20px 24px; }
  .top { padding: 12px 20px; margin: 0 -20px; }
  .workspace-name { display: none; }
  .workbench { grid-template-columns: minmax(0, 1fr) 290px; }
  .search { width: 260px; }
  .canvas-hint { display: none; }
}
@media (max-width: 760px) {
  main { padding: 0 16px 20px; }
  .top { padding: 12px 16px; margin: 0 -16px; min-height: 64px; }
  .top .actions { flex-wrap: nowrap; gap: 6px; }
  .top button { padding-left: 10px; padding-right: 10px; }
  .brand { flex-shrink: 0; }
  .workspace-heading { align-items: flex-start; flex-direction: column; gap: 12px; padding: 24px 0 20px; }
  h1 { font-size: 27px; }
  .graph-toolbar { flex-wrap: wrap; }
  .segmented { order: 0; }
  #addRecord { order: 1; margin-left: auto; }
  .search { order: 2; flex: 1 1 calc(100% - 95px); width: auto; margin-left: 0; }
  #filtersToggle { order: 3; }
  .workbench { grid-template-columns: 1fr; }
  .graph-scroll { height: 420px; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); max-height: none; padding: 20px; }
  .inspector .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inspector .actions { display: flex; }
  .canvas-heading { padding: 18px 16px 12px; align-items: flex-start; }
  .canvas-heading h2 { flex: 0 0 auto; }
  #graphStatus { font-size: 12px; }
  .canvas-bottom { justify-content: flex-end; padding: 12px 16px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters button { align-self: end; }
  .two { grid-template-columns: 1fr; }
  .workspace-footer > span:last-child { display: none; }
  button { min-height: 44px; }
}
@media (max-width: 380px) {
  main { padding-left: 12px; padding-right: 12px; }
  .top { padding-left: 12px; padding-right: 12px; margin-left: -12px; margin-right: -12px; }
  .brand { font-size: 16px; gap: 6px; }
  .brandmark { width: 26px; height: 26px; }
  .top .actions { gap: 3px; }
  .top button { font-size: 12px; padding-left: 6px; padding-right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
