/* Murphy land — NNseqs-DB-inspired single-column Folio reader (light + automatic system dark mode). */
:root {
  color-scheme: light;
  --font: "Nunito", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;

  --ink: #26323f; --g900: #2b2b2b; --label: #5d6b7c; --muted-ink: #4a5868;
  --muted: #69788a; --faint: #69788a;
  --b700: #0163cb; --b500: #2e93fe; --b200: #add5ff; --b100: #d6e9ff;
  --p300: #fb98c6; --p500: #e96ba8; --p700: #b83276;
  --green: #187a52; --warn: #cf3d4f;

  --line: #d3dde8; --line-hover: #a9bcd0; --line-strong: #c7d3e0; --line-soft: #e4ebf3; --row-line: #edf2f7;
  --bg: #f6f9fc; --bar: #f6f9fc; --surface: #ffffff; --recess: #eef4fa; --hover: #f0f6fd;
  --chip: #eef5fe; --chip-hover: #dceafd; --up-bg: #e5f5ee; --up-border: #bfe6d4; --down-bg: #fdecef;
  --pink-tint: #fdeaf3; --pink-border: #f5c6dc;
  --muted-box-bg: #fdf1f4; --muted-box-border: #f5cdd6;

  --gradient: linear-gradient(90deg, #0163cb, #2e93fe 55%, #fb98c6);
  --gradient-faint: linear-gradient(90deg, #9cc6f5, #a9d0fb 55%, #f6bfd9);
  --ring: rgba(46, 147, 254, 0.22);

  --r: 10px; --r-lg: 14px;
  --pop: 0 12px 32px rgba(20, 50, 90, 0.12), 0 2px 6px rgba(20, 50, 90, 0.06);
  --backdrop: rgba(20, 38, 62, 0.32);
  --solid-bg: var(--b700); --solid-hover: var(--b500); --solid-ink: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e7eef7; --g900: #f3f7fc; --label: #9fb2c7; --muted-ink: #b8c7d8; --muted: #8a9eb5; --faint: #7d92aa;
    --b700: #6cb4ff; --b500: #93c8ff; --b200: #2a4f7a; --b100: #1b3454; --p300: #fb98c6; --p500: #f693c2; --p700: #f693c2;
    --green: #53d6a0; --warn: #f47c8a;
    --line: #27374b; --line-hover: #3c5370; --line-strong: #32465e; --line-soft: #202f42; --row-line: #1c2a3b;
    --bg: #0f1620; --bar: #131c28; --surface: #16202e; --recess: #1c293a; --hover: #1e2e42;
    --chip: #192d45; --chip-hover: #223b59; --up-bg: #163329; --up-border: #235242; --down-bg: #3a1d25;
    --pink-tint: #351d2d; --pink-border: #59304b;
    --muted-box-bg: #2c1a22; --muted-box-border: #5a2e3c;
    --gradient: linear-gradient(90deg, #2e93fe, #6cb4ff 55%, #fb98c6);
    --gradient-faint: linear-gradient(90deg, #254f80, #386da8 55%, #7a4564);
    --ring: rgba(108, 180, 255, 0.28);
    --pop: 0 18px 44px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
    --backdrop: rgba(5, 10, 18, 0.62);
    --solid-bg: #1f7ae0; --solid-hover: #2e93fe; --solid-ink: #ffffff;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7eef7; --g900: #f3f7fc; --label: #9fb2c7; --muted-ink: #b8c7d8; --muted: #8a9eb5; --faint: #7d92aa;
  --b700: #6cb4ff; --b500: #93c8ff; --b200: #2a4f7a; --b100: #1b3454; --p300: #fb98c6; --p500: #f693c2; --p700: #f693c2;
  --green: #53d6a0; --warn: #f47c8a;
  --line: #27374b; --line-hover: #3c5370; --line-strong: #32465e; --line-soft: #202f42; --row-line: #1c2a3b;
  --bg: #0f1620; --bar: #131c28; --surface: #16202e; --recess: #1c293a; --hover: #1e2e42;
  --chip: #192d45; --chip-hover: #223b59; --up-bg: #163329; --up-border: #235242; --down-bg: #3a1d25;
  --pink-tint: #351d2d; --pink-border: #59304b;
  --muted-box-bg: #2c1a22; --muted-box-border: #5a2e3c;
  --gradient: linear-gradient(90deg, #2e93fe, #6cb4ff 55%, #fb98c6);
  --gradient-faint: linear-gradient(90deg, #254f80, #386da8 55%, #7a4564);
  --ring: rgba(108, 180, 255, 0.28);
  --pop: 0 18px 44px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.35);
  --backdrop: rgba(5, 10, 18, 0.62);
  --solid-bg: #1f7ae0; --solid-hover: #2e93fe; --solid-ink: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; overflow-x: clip; background: var(--bg); color: var(--ink);
  font: 500 15px/1.55 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
body::before { content: ""; display: block; height: 4px; width: 100%; background: var(--gradient); }
body.sheet-open { overflow: hidden; }
h1, h2, h3, h4, h5, p, ul, pre { margin: 0; padding: 0; }
.entry-title, .entry-body, .entry-venue, .why-summary, .why-source, .code-box { overflow-wrap: anywhere; word-break: break-word; }
.entry, .entry-head, .entry-copy, .entry-main { min-width: 0; }
ul { list-style: none; }
a { color: var(--b700); text-decoration: none; transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
a:hover { color: var(--b500); }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
code { font: 0.84em var(--mono); background: var(--recess); padding: 0.08em 0.34em; border-radius: 5px; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); border-radius: 6px; }

.folio { max-width: 820px; margin: 0 auto; padding: 0 22px 76px; }

/* Band 1: Dateline + nav + theme */
.dateline {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px;
  padding: 13px 0 4px; font: 600 0.76rem/1.4 var(--font); color: var(--muted);
}
.edition-nav { display: inline-flex; align-items: center; gap: 6px; }
.ed-arrow { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font: 700 0.78rem/1 var(--font); color: var(--muted); }
.ed-arrow:hover:not(:disabled) { background: var(--hover); color: var(--b700); }
.ed-arrow:disabled { opacity: 0.32; cursor: default; }
.ed-today { margin-left: 2px; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--b700); font: 700 0.7rem/1.3 var(--font); }
.ed-today:hover { background: var(--chip-hover); }
.dateline-right { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.nav { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font: 600 0.78rem/1.2 var(--font); color: var(--muted); }
.nav > button { padding: 3px 0; border-bottom: 1.5px solid transparent; }
.nav > button:hover { color: var(--b700); }
.nav .nav-muted { color: var(--warn); }

.admin-controls { display: inline-flex; align-items: center; gap: 6px; }
.admin-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--b700); border: 1px solid var(--b200); font: 700 0.72rem/1.3 var(--font); }
.admin-badge:hover { background: var(--chip-hover); }
.admin-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }
.admin-commit-btn { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; background: var(--solid-bg); color: var(--solid-ink); font: 700 0.72rem/1.3 var(--font); }
.admin-commit-btn:hover:not(:disabled) { background: var(--solid-hover); color: var(--solid-ink); }

.theme-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; color: var(--muted); border: 1px solid transparent; }
.theme-btn:hover { background: var(--hover); color: var(--b700); border-color: var(--line-soft); }
.theme-btn svg { width: 16px; height: 16px; }

/* Band 2: Centered masthead + Feeling Lucky */
.masthead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px 16px; padding: 14px 0 16px; border-bottom: 1px solid var(--line-soft); }
.masthead .brand { grid-column: 2; justify-self: center; }
.masthead .lucky-btn { grid-column: 3; justify-self: end; }
.brand { display: inline-flex; align-items: baseline; gap: 12px; color: inherit; text-decoration: none; cursor: pointer; }
.brand:hover h1 { color: var(--b700); }
.brand:hover .brand-logo { border-color: var(--b500); box-shadow: 0 2px 10px var(--ring); }
.brand-logo { align-self: center; width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--line-soft); box-shadow: 0 2px 8px rgba(20, 50, 90, 0.08); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.masthead h1 { font: 800 clamp(1.85rem, 3.8vw, 2.35rem)/1 var(--font); letter-spacing: -0.035em; color: var(--g900); transition: color 0.15s ease; }
.ver { margin-left: 9px; font-size: 0.42em; font-weight: 700; letter-spacing: 0; color: var(--muted); }

.lucky-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px;
  border: 1px solid transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient-faint) border-box;
  color: var(--b700); font: 700 0.78rem/1 var(--font); white-space: nowrap; box-shadow: 0 2px 8px rgba(1, 99, 203, 0.06);
}
.lucky-btn:hover { background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(1, 99, 203, 0.12); }
.lucky-btn:active { transform: translateY(0); }
.lucky-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gradient); flex: none; }

/* Band 3: Feed controls & custom NNseqs-DB pickers */
.feed-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 14px 0 12px; font: 600 0.82rem/1.3 var(--font); }
.feed-meta-left { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.text-seg { display: inline-flex; align-items: center; gap: 2px; }
.text-seg button { position: relative; padding: 4px 8px 6px; color: var(--label); font-weight: 600; white-space: nowrap; }
.text-seg button:hover, .text-seg button.is-active { color: var(--b700); }
.text-seg button.is-active { font-weight: 700; }
.text-seg button.is-active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px; background: var(--b700); }
.feed-meta .text-seg button:first-child { padding-left: 2px; }
.feed-meta .text-seg button:first-child::after { left: 2px; }
.feed-status { font: 600 0.76rem/1.3 var(--font); color: var(--muted); white-space: nowrap; }
.feed-status.is-error { color: var(--warn); }

.feed-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pick { position: relative; display: inline-block; }
.pick.is-poster { width: 146px; }
.pick input { width: 100%; height: 30px; padding: 0 26px 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 600 0.78rem/1 var(--font); text-overflow: ellipsis; cursor: pointer; }
.pick input::placeholder { color: var(--muted); opacity: 1; }
.pick input:hover { border-color: var(--line-hover); }
.pick input:focus { outline: none; border-color: var(--b500); box-shadow: 0 0 0 3px var(--ring); }
.pick.open input:not([readonly]) { cursor: text; }
.pick:not(.open) input, .pick input[readonly] { caret-color: transparent; }
.pick.has-clear input { padding-right: 44px; }
.pick::after {
  content: ""; position: absolute; top: 50%; right: 9px; width: 10px; height: 6px; margin-top: -3px; pointer-events: none;
  background-color: var(--b700); transition: transform 0.15s ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%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 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pick.open::after { transform: rotate(180deg); }
.pick .labels { display: block; height: 0; padding: 0 28px 0 10px; overflow: hidden; visibility: hidden; white-space: pre; font: 600 0.78rem/1 var(--font); }
.pick-clear { position: absolute; top: 50%; right: 23px; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; font: 700 0.88rem/1 var(--font); color: var(--muted); }
.pick-clear:hover { background: var(--hover); color: var(--b700); }

@keyframes dropPop { from { opacity: 0; transform: translateY(-4px); } }
.opts { position: fixed; z-index: 30; max-height: 310px; overflow-y: auto; margin: 0; padding: 5px; list-style: none; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--pop); animation: dropPop 0.14s ease-out; }
.opts li { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 7px 10px; border-radius: calc(var(--r-lg) - 5px); cursor: pointer; white-space: nowrap; font: 600 0.83rem/1.3 var(--font); color: var(--ink); transition: color 0.12s ease, background-color 0.12s ease; }
.opts li .opt-main { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.opts li.on { background: var(--hover); color: var(--b700); }
.opts li.sel { color: var(--b700); font-weight: 800; }
.opts li mark { background: none; color: var(--b700); font-weight: 800; }
.opts li small { flex: none; font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.opts li.opts-empty { color: var(--muted); cursor: default; font-weight: 600; }

.active-filters { padding: 0 0 10px; }
.active-filters > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--b700); font: 600 0.75rem var(--font); }
.filter-chip button { font-size: 0.95rem; line-height: 1; color: var(--b700); opacity: 0.75; }
.filter-chip button:hover { opacity: 1; }
.rerank-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 13px; margin: 0 0 10px; background: var(--chip); border: 1px solid var(--b200); border-radius: 8px; font: 600 0.8rem var(--font); color: var(--ink); }

/* Feed sheet & cards */
.feed-list { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; }
.entry { padding: 13px 18px; border-bottom: 1px solid var(--row-line); transition: background-color 0.14s ease; }
.entry:last-child { border-bottom: 0; }
.entry:hover { background: var(--hover); }
.entry-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px 12px; margin-bottom: 5px; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font: 600 0.76rem/1.3 var(--font); color: var(--muted); min-width: 0; }
.entry-tags { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.byline-author { display: inline-flex; align-items: center; gap: 6px; color: var(--g900); font-weight: 700; }
.byline-author:hover { color: var(--b700); }
.meta-sep { color: var(--line-strong); }
.entry-origin { display: inline-block; max-width: min(100%, 30ch); font: 500 0.71rem/1.3 var(--mono); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.entry-origin:hover { color: var(--b700); text-decoration: underline; }
.meta-hop { display: inline-block; padding: 1px 6px; border: 1px solid var(--line-soft); border-radius: 5px; background: var(--bar); color: var(--muted); font-size: 0.69rem; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.meta-hop-0 { color: var(--green); background: var(--up-bg); border-color: var(--up-border); }
.meta-hop-1 { color: var(--b700); background: var(--chip); border-color: var(--b200); }
.meta-hop-2 { color: var(--p700); background: var(--pink-tint); border-color: var(--pink-border); }
.meta-kind { display: inline-block; padding: 1px 6px; border: 1px solid var(--line-soft); border-radius: 5px; background: var(--bar); color: var(--label); font-size: 0.69rem; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.meta-rating { color: var(--green); font-size: 0.74rem; font-weight: 700; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--av, #476b91); color: #fff; font: 700 0.62rem/1 var(--font); flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-sm { width: 18px; height: 18px; font-size: 0.56rem; }
.av-md { width: 30px; height: 30px; font-size: 0.72rem; }

.entry-main { display: flex; gap: 16px; align-items: flex-start; }
.entry-copy { flex: 1; min-width: 0; }
.entry-title { font: 700 1.03rem/1.32 var(--font); letter-spacing: -0.01em; color: var(--g900); }
.entry-title a { color: inherit; }
.entry-title a:hover { color: var(--b700); }
.entry-venue { font: 600 0.8rem/1.35 var(--font); color: var(--label); margin-top: 2px; }
.entry-body { margin-top: 4px; color: var(--muted-ink); font: 500 0.875rem/1.48 var(--font); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.body-link { color: var(--b700); text-decoration: underline; text-decoration-color: var(--b200); text-underline-offset: 0.18em; }
.body-link:hover { color: var(--b500); text-decoration-color: var(--b500); }
.entry-thumb { width: 92px; height: 64px; flex: none; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-soft); background: var(--recess); margin-top: 2px; display: block; }
.entry-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.entry-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; font: 600 0.75rem/1 var(--font); color: var(--muted); }
.entry-votes, .entry-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vote-pair { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); overflow: hidden; }
.vote-btn { display: inline-grid; place-items: center; width: 28px; height: 24px; color: var(--muted-ink); }
.vote-btn + .vote-btn { border-left: 1px solid var(--line-soft); }
.vote-btn svg { width: 13px; height: 13px; display: block; }
.vote-btn:hover { background: var(--chip); color: var(--b700); }
.vote-btn.is-up { background: var(--up-bg); color: var(--green); }
.vote-btn.is-down { background: var(--down-bg); color: var(--warn); }
.why-btn { padding: 3px 0; color: var(--muted); font: 600 0.75rem/1.2 var(--font); border-bottom: 1.5px solid transparent; }
.why-btn:hover { color: var(--b700); }
.why-btn.is-open { color: var(--b700); border-bottom-color: var(--b700); font-weight: 700; }
.also-links a { font: 600 0.75rem var(--font); color: var(--muted); }
.also-links a:hover { color: var(--b700); text-decoration: underline; }

/* Indented Why ledger */
.why-panel { margin: 10px 0 2px; padding: 2px 0 2px 12px; border-left: 2px solid var(--b200); font: 500 0.77rem/1.45 var(--font); color: var(--muted); }
.why-chain { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; list-style: none; margin: 0 0 4px; padding: 0; font-size: 0.76rem; color: var(--muted); }
.why-summary { color: var(--muted-ink); font-weight: 500; font-size: 0.75rem; margin-bottom: 6px; }
.why-step { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; min-width: 0; }
.why-node-link, .why-node-name { font-weight: 700; color: var(--g900); min-width: 0; overflow-wrap: anywhere; }
.why-node-link { text-decoration: underline; text-decoration-color: var(--line-hover); text-underline-offset: 0.18em; }
.why-node-link:hover { color: var(--b700); text-decoration-color: var(--b500); }
.why-arrow { color: var(--b700); flex: none; font-weight: 700; }
.why-uri { display: inline-block; max-width: min(100%, 34ch); min-width: 0; font: 500 0.7rem/1.3 var(--mono); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.why-uri:hover { color: var(--b700); text-decoration: underline; }
.why-source { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin-bottom: 6px; font-size: 0.73rem; color: var(--muted); min-width: 0; }
.why-source-lbl { flex: none; }
.why-factors { display: flex; flex-direction: column; margin: 4px 0 6px; border-top: 1px solid var(--row-line); font: 500 0.74rem/1.4 var(--font); }
.why-factors li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 3px 0; border-bottom: 1px solid var(--row-line); }
.why-factors li > span:first-child { min-width: 0; overflow-wrap: anywhere; color: var(--muted-ink); }
.why-delta { flex: none; font: 600 0.73rem var(--mono); font-variant-numeric: tabular-nums; }
.why-delta.is-pos { color: var(--green); }
.why-delta.is-neg { color: var(--warn); }
.why-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; }
.why-act { font: 700 0.75rem/1.2 var(--font); color: var(--label); }
.why-act:hover { color: var(--b700); text-decoration: underline; text-underline-offset: 0.2em; }
.why-act.is-primary { color: var(--b700); }
.why-act.is-danger { color: var(--warn); }

.feed-empty { padding: 52px 16px; text-align: center; color: var(--muted); }
.feed-footer { padding: 28px 0 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.end-note { font: 600 0.8rem var(--font); color: var(--muted); }
.colophon { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line-soft); text-align: center; font: 600 0.86rem/1.5 var(--font); color: var(--muted); }
.colophon em { font-style: italic; }

/* Buttons */
.link-btn { font: 600 0.78rem var(--font); color: var(--b700); }
.link-btn:hover { color: var(--b500); text-decoration: underline; text-underline-offset: 0.2em; }
.btn-solid, .btn-outline, .mini-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 0.8rem/1.2 var(--font); border-radius: var(--r); text-decoration: none; }
.btn-solid { background: var(--solid-bg); color: var(--solid-ink); padding: 8px 15px; border: 1px solid var(--solid-bg); }
.btn-solid:hover { background: var(--solid-hover); border-color: var(--solid-hover); color: var(--solid-ink); }
.btn-outline { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 13px; }
.btn-outline:hover { border-color: var(--line-hover); background: var(--hover); color: var(--b700); }
.mini-btn { border: 1px solid var(--line); padding: 4px 10px; font-size: 0.75rem; background: var(--surface); color: var(--ink); border-radius: 8px; }
.mini-btn:hover { border-color: var(--line-hover); background: var(--hover); color: var(--b700); }
.mini-btn.is-primary { background: var(--solid-bg); border-color: var(--solid-bg); color: var(--solid-ink); }
.mini-btn.is-primary:hover { background: var(--solid-hover); border-color: var(--solid-hover); color: var(--solid-ink); }
.mini-btn.is-danger { color: var(--warn); }
.mini-btn.is-danger:hover { border-color: var(--warn); background: var(--down-bg); color: var(--warn); }

/* Floating modal sheet */
@keyframes pop { from { opacity: 0; transform: translate(-50%, calc(-50% - 6px)); } }
.sheet-backdrop { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(2px); z-index: 40; }
.sheet { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: min(84vh, 720px); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--pop); z-index: 50; display: flex; flex-direction: column; overflow: hidden; animation: pop 0.14s ease-out; }
.sheet::before { content: ""; display: block; height: 2px; width: 100%; flex: none; background: var(--gradient); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px 0; border-bottom: 1px solid var(--line-soft); background: var(--bar); }
.sheet-title { font: 800 0.94rem/1.2 var(--font); color: var(--g900); padding: 10px 0 11px; }
.sheet-tabs { display: flex; flex-wrap: wrap; gap: 18px; }
.sheet-tabs button { font: 700 0.84rem var(--font); color: var(--muted); padding: 8px 0 10px; margin-bottom: -1px; border-bottom: 3px solid transparent; }
.sheet-tabs button:hover { color: var(--b700); }
.sheet-tabs button.is-active { color: var(--g900); border-bottom-color: var(--b700); }
.sheet-close { font-size: 1.4rem; line-height: 1; color: var(--muted); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; margin-bottom: 6px; }
.sheet-close:hover { background: var(--hover); color: var(--b700); }
.sheet-body { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; font-family: var(--font); font-size: 0.88rem; background: var(--surface); }

.follows-seg, .notify-seg { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.inline-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.follows-seg button, .notify-seg button, .inline-seg button { position: relative; padding: 4px 10px 6px; font: 700 0.8rem/1.2 var(--font); color: var(--label); border-radius: 6px; }
.follows-seg button:hover, .notify-seg button:hover, .inline-seg button:hover, .follows-seg button.is-active, .notify-seg button.is-active, .inline-seg button.is-active { color: var(--b700); }
.follows-seg button.is-active::after, .notify-seg button.is-active::after, .inline-seg button.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px; background: var(--b700); }
.follows-seg button.is-warn { color: var(--warn); }
.follows-seg button.is-warn.is-active::after { background: var(--warn); }

.discovery-bar { padding: 10px 13px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.discovery-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.discovery-controls { display: inline-flex; align-items: center; gap: 6px; }
.discovery-controls input[type="number"] { width: 72px; padding: 4px 8px; text-align: center; font: 700 0.82rem/1.2 var(--font); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.discovery-bar .form-msg:empty { display: none; }

.agent-card { padding: 10px 13px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line-soft); font-size: 0.81rem; color: var(--muted-ink); }
.agent-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.field-lbl { display: block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.lbl-inline { margin: 0; }
.sheet input[type="text"], .sheet input[type="password"], .sheet input[type="url"], .sheet input[type="search"], .sheet select, .sheet textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 500 0.86rem/1.45 var(--font); }
.sheet input:hover, .sheet select:hover, .sheet textarea:hover { border-color: var(--line-hover); }
.sheet input:focus, .sheet select:focus, .sheet textarea:focus { outline: none; border-color: var(--b500); box-shadow: 0 0 0 3px var(--ring); }
.sheet input::placeholder, .sheet textarea::placeholder { color: var(--muted); opacity: 1; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }
.row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint { font-size: 0.79rem; color: var(--muted); line-height: 1.5; }
.form-msg { font-size: 0.79rem; color: var(--muted); min-height: 1em; }
.form-msg.is-error { color: var(--warn); }
.extra-opts { padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 0.8rem; color: var(--muted); }
.extra-opts summary { cursor: pointer; font-weight: 700; color: var(--label); margin-bottom: 10px; }
.extra-opts summary:hover { color: var(--b700); }

.muted-box { padding: 12px 14px; background: var(--muted-box-bg); border: 1px solid var(--muted-box-border); border-radius: var(--r); }
.muted-box h4, .group-block h4 { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.muted-box h4 { color: var(--warn); }
.person-list { display: flex; flex-direction: column; gap: 2px; }
.person-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; border-bottom: 1px solid var(--row-line); }
.person-row:last-child { border-bottom: 0; }
.person-row:hover { background: var(--hover); }
.person-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-info > div { min-width: 0; }
.person-name { font-weight: 700; color: var(--ink); text-align: left; display: block; }
.person-name:hover { color: var(--b700); }
.person-sub { display: block; font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-sub a { color: var(--muted); }
.person-sub a:hover { color: var(--b700); text-decoration: underline; }
.person-btns { display: flex; gap: 5px; flex: none; }
.empty-li { color: var(--muted); font-size: 0.82rem; padding: 10px 4px; }
.file-lbl { cursor: pointer; }
.weights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 8px 0 12px; }
.weights-grid h5 { font-size: 0.74rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.weight-ul { display: flex; flex-direction: column; gap: 4px; font: 500 0.74rem var(--mono); }
.weight-ul li { display: flex; justify-content: space-between; gap: 8px; }
.code-box { background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 12px; font: 500 0.76rem/1.5 var(--mono); white-space: pre-wrap; color: var(--ink); }
.about-copy { font-size: 0.94rem; line-height: 1.65; color: var(--muted-ink); }
.about-copy a { font-weight: 700; }
.admin-summary-list { display: flex; flex-direction: column; gap: 5px; padding: 10px 13px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line-soft); font: 600 0.8rem/1.45 var(--font); color: var(--ink); }
.admin-summary-list li::before { content: "• "; color: var(--b700); }
.check-row { display: inline-flex; align-items: center; gap: 8px; font: 600 0.8rem/1.4 var(--font); color: var(--muted-ink); cursor: pointer; }
.check-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--b700); }
.admin-inline-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 13px; border-radius: var(--r); background: var(--chip); border: 1px solid var(--b200); font: 600 0.8rem/1.4 var(--font); color: var(--ink); }

@media (max-width: 600px) {
  .folio { padding: 0 14px 56px; }
  .masthead { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .entry { padding: 13px 14px; }
  .entry-head { flex-wrap: wrap; }
  .entry-main { flex-direction: column; }
  .entry-thumb { width: 100%; height: 150px; }
}
