/* Dataset viewer. Colors, radii, shadows and type sizes are Thinkspan's system tokens
   (@thinkspan/widgets tsthemes/dictionaries/ThinkspanTheme.json and ThinkspanThemeDark.json).
   The layout is denser than the app's: this is for reviewing a whole household at once. */

:root {
  --bg-screen: #F2F1EE;
  --bg-low: #F7F6F3;
  --bg-mid: #FCFBF8;
  --bg-high: #FFFFFF;
  --bg-field: #E6E5E1;
  --bg-field-hover: #D9D8D5;
  --bg-subtle: #EDECE8;
  --bg-control: #1A1919;
  --bg-control-hover: #262625;
  --content-primary: #1A1919;
  --content-secondary: #807F7D;
  --content-tertiary: #ABAAA7;
  --content-inverse: #FFFFFF;
  --border-subtle: #E6E5E1;
  --border-muted: #C6C5C1;
  --border-strong: #B2B2AF;
  --brand: #0096E0;
  --brand-strong: #016BA3;
  --brand-subtle: #B3E5FF;
  --info-bg: #F0F9FF;
  --error: #D62D24;
  --error-bg: #FEF3F2;
  --error-border: #FBAAA6;
  --warning: #F56D1A;
  --warning-bg: #FFF6ED;
  --warning-border: #FDD4AB;
  --success: #46AF3F;
  --success-bg: #F3FBF2;
  --success-border: #C8EDC5;
  --interactive: #F89249;
  --rule-notes: #E6C8C8;
  --rule-reminder: #0096E0;
  --ai-start: #C355E8;
  --ai-end: #0096E0;
  --shadow: 0 4px 6px rgba(23, 23, 23, 0.10);
  --shadow-subtle: 0 1px 3px rgba(23, 23, 23, 0.06);
  --radius-small: 4px;
  --radius: 8px;
  --radius-large: 12px;
  --radius-xlarge: 16px;
  /* One hue per kind of record. Not Thinkspan tokens: the app has none for this. Notes keep
     the app's note pink and reminders its reminder blue. */
  --c-people: #138C8A;
  --c-wallet: #4C5BD4;
  --c-things: #A9742B;
  --c-health: #DB4F57;
  --c-finance: #3E9B51;
  --c-notes: #CF7F8D;
  --c-journal: #9B5FC0;
  --c-reminders: #0096E0;
  --c-passcodes: #5B6573;
  --c-documents: #E8832A;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-screen: #1A1919;
    --bg-low: #262625;
    --bg-mid: #2C2C2C;
    --bg-high: #333231;
    --bg-field: #333231;
    --bg-field-hover: #403F3D;
    --bg-subtle: #262625;
    --bg-control: #FCFBF8;
    --bg-control-hover: #E6E5E1;
    --content-primary: #FFFFFF;
    --content-secondary: #B2B2AF;
    --content-tertiary: #807F7D;
    --content-inverse: #1A1919;
    --border-subtle: #403F3D;
    --border-muted: #666664;
    --border-strong: #737270;
    --brand: #0CA8EB;
    --brand-strong: #7CD4FD;
    --brand-subtle: #065A86;
    --info-bg: #07304A;
    --error: #EE4E45;
    --error-bg: #450D0A;
    --error-border: #B8251D;
    --warning: #F89249;
    --warning-bg: #421308;
    --warning-border: #BF3C0F;
    --success: #69C563;
    --success-bg: #0D270C;
    --success-border: #2C6E27;
    --rule-reminder: #0CA8EB;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.4);
    --c-people: #2BB3AF;
    --c-wallet: #7F8CF0;
    --c-things: #D39A4C;
    --c-health: #EE6E74;
    --c-finance: #62C174;
    --c-notes: #E29AA6;
    --c-journal: #BC86DD;
    --c-reminders: #36B8F5;
    --c-passcodes: #9BA6B5;
    --c-documents: #F5A04F;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--bg-screen);
  color: var(--content-primary);
  font-family: -apple-system, "SF Pro Text", BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 400;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.link, main p a, .prose a, td a, .linky a { color: var(--brand-strong); }
code, pre, .mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 0.86rem; }
pre {
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-low);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
h1, h2, h3, h4 { font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.85rem; line-height: 1.15; }
h2 { font-size: 1.3rem; margin: 28px 0 12px; }
h3 { font-size: 1.05rem; margin: 18px 0 8px; }
h4 { font-size: 0.95rem; margin: 12px 0 6px; }
p { margin: 6px 0 10px; }
.muted { color: var(--content-secondary); }
.faint { color: var(--content-tertiary); }
.small { font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 20px 0; }

/* icons: the app's own single-color icons, tinted by the text color */
.icon {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  vertical-align: -4px;
}
.icon.sm { width: 16px; height: 16px; vertical-align: -3px; }
.icon.lg { width: 28px; height: 28px; }
.icon.xl { width: 40px; height: 40px; }

/* layout */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 56px;
  padding: 0 20px;
  background: var(--bg-mid);
  border-bottom: 1px solid var(--border-subtle);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; }
.brand .logo { width: 26px; height: 26px; color: var(--brand); }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--content-secondary); }
.crumbs a { color: var(--content-primary); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .search input {
  width: 320px;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-field) url("/icons/isc-magnifying_glass.svg") 10px center / 16px no-repeat;
  color: var(--content-primary);
  font: inherit;
}
.topbar .toplink { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.layout { display: flex; align-items: flex-start; }
.sidenav {
  position: sticky;
  top: 56px;
  flex: none;
  width: 232px;
  height: calc(100vh - 56px);
  overflow: auto;
  padding: 16px 12px;
  border-right: 1px solid var(--border-subtle);
}
.sidenav .owner { display: flex; gap: 10px; align-items: center; padding: 4px 8px 14px; }
.sidenav a.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--content-primary);
  font-weight: 500;
}
.sidenav a.item:hover { background: var(--bg-subtle); text-decoration: none; }
.sidenav a.item.active { background: var(--bg-control); color: var(--content-inverse); }
.sidenav a.item .n { margin-left: auto; font-size: 0.8rem; color: inherit; opacity: 0.7; }
.sidenav .group { margin: 16px 10px 6px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--content-tertiary); font-weight: 600; }
main { flex: 1; min-width: 0; padding: 24px 32px 80px; max-width: 1320px; }
.head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.head .icon-tile {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: var(--radius-large);
  background: var(--bg-high);
  box-shadow: var(--shadow);
}
.head .meta { color: var(--content-secondary); margin-top: 4px; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .cols, .cols.even { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* surfaces */
.card {
  background: var(--bg-mid);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--border-subtle);
  padding: 16px 18px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flat { box-shadow: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  padding: 12px;
  background: var(--bg-high);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 600;
  text-align: center;
}
.tile:hover { text-decoration: none; background: var(--bg-mid); }
.tile .n { font-weight: 400; color: var(--content-secondary); font-size: 0.85rem; }

/* author knowledge: never looks like saved data */
.author {
  background: var(--info-bg);
  border: 1px solid var(--brand-subtle);
  border-radius: var(--radius-large);
  padding: 14px 16px;
}
.author-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-strong);
  margin-bottom: 6px;
}
.author .author-label { display: flex; }
.inline-author { background: var(--info-bg); border-left: 3px solid var(--brand); padding: 6px 10px; border-radius: 0 var(--radius) var(--radius) 0; }
.callout { border-radius: var(--radius); padding: 10px 12px; border: 1px solid; }
.callout.error { background: var(--error-bg); border-color: var(--error-border); }
.callout.warning { background: var(--warning-bg); border-color: var(--warning-border); }
.callout.gap, .callout.neutral { background: var(--bg-low); border-color: var(--border-subtle); }
.callout.success { background: var(--success-bg); border-color: var(--success-border); }

/* chips: the app's filter pills */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 1000px;
  background: var(--bg-field);
  border: 0;
  color: var(--content-primary);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { background: var(--bg-field-hover); text-decoration: none; }
.chip.on { background: var(--bg-control); color: var(--content-inverse); }
.chip .n {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 1000px;
  background: var(--border-muted);
  color: var(--content-primary);
  font-size: 0.75rem;
  display: inline-grid;
  place-items: center;
}
.chip.on .n { background: var(--bg-control-hover); color: var(--content-inverse); }
select.chip { padding-right: 28px; appearance: auto; }

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 1000px;
  font-size: 0.76rem;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--content-secondary);
  white-space: nowrap;
}
.badge.current, .badge.ok { background: var(--success-bg); color: var(--success); }
.badge.stale, .badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.error { background: var(--error-bg); color: var(--error); }
.badge.gap, .badge.unknown, .badge.missing { background: var(--bg-subtle); color: var(--content-secondary); }
.badge.author { background: var(--info-bg); color: var(--brand-strong); }
.badge.dark { background: var(--bg-control); color: var(--content-inverse); }
.badge.ai { background: linear-gradient(90deg, var(--ai-start), var(--ai-end)); color: #fff; }
.badge .icon { width: 13px; height: 13px; vertical-align: -2px; }

/* buttons and forms */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 1000px;
  background: var(--bg-control);
  color: var(--content-inverse);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.button.secondary { background: var(--bg-field); color: var(--content-primary); }
.button:hover { background: var(--bg-control-hover); text-decoration: none; }
.button.secondary:hover { background: var(--bg-field-hover); }
input[type=text], input[type=search], textarea, select {
  font: inherit;
  color: var(--content-primary);
  background: var(--bg-field);
  border: 0;
  border-radius: var(--radius);
  padding: 8px 10px;
}
textarea { width: 100%; min-height: 72px; resize: vertical; }

/* The hosted copy's password (viewer.js): until it is checked, only its form shows. */
html.locked body > :not(.gate) { display: none !important; }
.gate { display: flex; flex-direction: column; gap: 12px; width: calc(100% - 32px); max-width: 340px; margin: 18vh auto 0; padding: 24px; }
.gate h1 { margin: 0; font-size: 1.4rem; }
.gate input { font: inherit; font-size: 16px; color: var(--content-primary); background: var(--bg-field); border: 0; border-radius: var(--radius); padding: 10px 12px; }
.gate .button { justify-content: center; }
.gate-error { color: var(--error); min-height: 1.3em; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* tables */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
th { font-size: 0.78rem; font-weight: 600; color: var(--content-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover { background: var(--bg-low); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.fields th { width: 34%; text-transform: none; letter-spacing: 0; font-size: 0.88rem; font-weight: 500; }
table.fields td pre { padding: 6px 8px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ↕"; color: var(--content-tertiary); }
.matrix td, .matrix th { padding: 4px 6px; font-size: 0.8rem; text-align: center; }
.matrix td.k { text-align: left; }
.heat { display: inline-block; min-width: 28px; padding: 1px 4px; border-radius: var(--radius-small); }

/* record cards, like the app's list items */
.cards { display: flex; flex-direction: column; gap: 8px; }
.rcard {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: start;
  padding: 12px 14px;
  background: var(--bg-mid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  border-left: 3px solid transparent;
}
.rcard:hover { background: var(--bg-high); text-decoration: none; }
.rcard .icon { margin-top: 2px; color: var(--content-secondary); }
.rcard .t { font-weight: 600; overflow-wrap: anywhere; }
.rcard .sub { color: var(--content-secondary); font-size: 0.86rem; }
.rcard .snippet { grid-column: 2 / 4; color: var(--content-secondary); font-size: 0.9rem; white-space: pre-line;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.rcard .badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.rcard.has-thumb { grid-template-columns: 28px minmax(0, 1fr) auto 84px; }
.rcard .thumb {
  grid-column: 4;
  grid-row: 1 / span 2;
  width: 84px;
  height: 64px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-small);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}
.rcard.has-thumb .snippet { grid-column: 2 / 4; }
.mini-thumb {
  width: 44px;
  height: 34px;
  margin-left: auto;
  flex: none;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius-small);
  border: 1px solid var(--border-subtle);
}
.month { margin: 22px 0 6px; font-weight: 600; color: var(--content-secondary); font-size: 0.9rem; }
.mini { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius); }
.mini:hover { background: var(--bg-low); text-decoration: none; }
.mini .icon { color: var(--content-secondary); }

/* files */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.fcard { display: flex; flex-direction: column; background: var(--bg-mid); border-radius: var(--radius-large);
  box-shadow: var(--shadow-subtle); overflow: hidden; border: 1px solid var(--border-subtle); }
.fcard:hover { text-decoration: none; box-shadow: var(--shadow); }
.fcard .thumb { height: 170px; background: var(--bg-subtle) center / cover no-repeat; display: grid; place-items: center; }
.fcard .body { padding: 10px 12px; }
.fcard .p { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 0.78rem; color: var(--content-secondary);
  overflow-wrap: anywhere; }
.preview { width: 100%; border-radius: var(--radius); background: var(--bg-subtle); }
img.preview { height: auto; max-height: 82vh; object-fit: contain; }
iframe.preview { height: 82vh; border: 0; }

/* conversations */
.bubble { max-width: 80%; padding: 10px 14px; border-radius: var(--radius-xlarge); margin: 6px 0; }
.bubble.user { margin-left: auto; background: var(--bg-control); color: var(--content-inverse); border-bottom-right-radius: 4px; }
.bubble.model { background: var(--bg-high); border: 1px solid var(--border-subtle); border-bottom-left-radius: 4px; }
.bubble.tool { background: var(--bg-low); border: 1px dashed var(--border-muted); font-size: 0.85rem; max-width: 100%; }
.turn + .turn { margin-top: 14px; }

/* charts */
svg { max-width: 100%; height: auto; }
svg text { font-family: inherit; fill: var(--content-secondary); font-size: 11px; }
svg .grid { stroke: var(--border-subtle); stroke-width: 1; }
svg .lane { fill: var(--bg-mid); }
svg .lane.alt { fill: var(--bg-low); }
svg .lane-label { fill: var(--content-primary); font-size: 12px; font-weight: 500; }
svg .dot { stroke: var(--bg-mid); stroke-width: 0.8; }
svg .dot:hover { stroke: var(--content-primary); stroke-width: 2; }
svg .event { stroke: var(--border-strong); stroke-width: 1; }
svg .event.wrong, svg .event-end.wrong { stroke: var(--error); fill: var(--error); stroke-width: 1.5; }
svg .event-end { fill: var(--border-strong); }
svg .story line { stroke: var(--brand); stroke-dasharray: 2 3; opacity: 0.6; }
svg .story circle { fill: var(--brand); }
svg .story text { fill: #fff; font-size: 10px; font-weight: 600; text-anchor: middle; }
svg.histogram rect { fill: var(--content-primary); opacity: 0.8; }
svg.histogram .count { fill: var(--content-primary); }
svg .link { stroke: var(--border-muted); stroke-width: 1.2; }
svg .center { fill: var(--bg-control); }
svg .center-label { fill: var(--content-primary); font-weight: 600; font-size: 13px; }
svg .node-label { fill: var(--content-primary); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; color: var(--content-secondary); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* comments */
.comment { padding: 10px 12px; border-radius: var(--radius); background: var(--bg-low); border: 1px solid var(--border-subtle); }
.comment + .comment { margin-top: 8px; }
.comment .who { font-size: 0.82rem; color: var(--content-secondary); }
details > summary { cursor: pointer; color: var(--content-secondary); font-weight: 500; }
details[open] > summary { margin-bottom: 8px; }
.prose p:first-child { margin-top: 0; }
.prose table { margin: 8px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.kv dt { color: var(--content-secondary); }
.kv dd { margin: 0; }
.hidden { display: none !important; }
.empty { padding: 28px; text-align: center; color: var(--content-secondary); }
.idlink { color: var(--brand-strong); border-bottom: 1px dotted var(--brand-strong); }
.count-line { color: var(--content-secondary); font-size: 0.9rem; margin: 6px 0 10px; }

/* folded panels: what is not the record itself starts closed and shows a count */
details.fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  color: var(--content-primary);
  font-weight: 500;
  margin: 0;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h3 { margin: 0; }
details.fold > summary::after {
  content: "";
  margin-left: auto;
  width: 16px;
  height: 16px;
  flex: none;
  background: var(--content-secondary);
  -webkit-mask: url("/icons/isc-chevron_down.svg") center / contain no-repeat;
  mask: url("/icons/isc-chevron_down.svg") center / contain no-repeat;
  transition: transform 0.15s;
}
details.fold[open] > summary { margin-bottom: 12px; }
details.fold[open] > summary::after { transform: rotate(180deg); }
details.card.fold:not([open]) { padding-top: 12px; padding-bottom: 12px; box-shadow: none; background: var(--bg-low); }
details.card.fold:not([open]) > summary h3 { font-size: 0.98rem; color: var(--content-secondary); }
details.card.fold:not([open]):hover { background: var(--bg-mid); }
details.author.fold:not([open]) { padding-top: 10px; padding-bottom: 10px; }
details.author.fold > summary .author-label { margin: 0; }
.pill {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 1000px;
  background: var(--bg-field);
  color: var(--content-secondary);
  font-size: 0.76rem;
  font-weight: 500;
  display: inline-grid;
  place-items: center;
}
details.sub { margin-top: 8px; }
details.sub > summary { font-size: 0.86rem; }

/* timeline sections: shown or hidden from the chips above the chart */
.chip.section { background: var(--bg-high); border: 1px solid var(--border-subtle); }
.chip.section:hover { background: var(--bg-mid); }
.chip.section.off { opacity: 0.45; background: var(--bg-field); }
.chip.section.off .sw { background: var(--content-tertiary) !important; }
.chip .sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
svg .rec.hidden { display: none; }

/* a person's or thing's page: profile on top, then its story */
.profile { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 20px; align-items: center; margin-bottom: 18px; padding: 20px 22px; }
.profile-picture { width: 112px; height: 112px; border-radius: var(--radius-large); object-fit: cover; background: var(--bg-high);
  box-shadow: var(--shadow); display: grid; place-items: center; }
.profile-picture.avatar { border-radius: 50%; }
.profile-main h1 { font-size: 1.7rem; }
.profile-role { color: var(--content-secondary); margin: 4px 0 10px; font-size: 1.02rem; }
.profile-facts { gap: 6px; }
.profile-stats { display: flex; gap: 26px; margin-top: 14px; }
.profile-stats div { display: flex; flex-direction: column; }
.profile-stats b { font-size: 1.25rem; font-weight: 600; }
.profile-stats span { font-size: 0.8rem; color: var(--content-secondary); }
.profile-links { display: flex; flex-direction: column; gap: 6px; align-self: start; text-align: right; }
@media (max-width: 900px) { .profile { grid-template-columns: 80px 1fr; } .profile-links { grid-column: 1 / 3; text-align: left; } }

.story-year { position: relative; margin-top: 18px; }
.story-year-label { font-weight: 600; font-size: 0.95rem; color: var(--content-secondary); margin: 0 0 6px 70px; }
.story-item {
  display: grid;
  grid-template-columns: 56px 30px minmax(0, 1fr) auto;
  gap: 0 12px;
  padding: 8px 6px;
  border-radius: var(--radius);
  position: relative;
}
.story-item:hover { background: var(--bg-low); text-decoration: none; }
.story-item::before { content: ""; position: absolute; left: 82px; top: 0; bottom: 0; width: 2px; background: var(--border-subtle); }
.story-date { text-align: right; font-size: 0.82rem; color: var(--content-secondary); padding-top: 5px; font-variant-numeric: tabular-nums; }
.story-dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-high);
  border: 2px solid var(--border-muted); display: grid; place-items: center; color: var(--content-secondary); }
.story-item.mentioned .story-dot { border-style: dashed; background: var(--bg-low); }
.story-title { font-weight: 600; overflow-wrap: anywhere; padding-top: 4px; }
.story-text { white-space: pre-line; color: var(--content-primary); font-size: 0.92rem; margin-top: 2px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.story-item.mentioned .story-text { color: var(--content-secondary); }
.story-text mark { background: var(--warning-bg); color: inherit; border-radius: 3px; padding: 0 2px; }
.story-meta { margin-top: 4px; font-size: 0.78rem; color: var(--content-tertiary); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.story-meta .mono { font-size: 0.74rem; }
.story-thumb { width: 72px; height: 56px; object-fit: cover; object-position: top; border-radius: var(--radius-small);
  border: 1px solid var(--border-subtle); align-self: start; margin-top: 4px; }
svg.mileage .mileline { stroke: var(--content-secondary); stroke-width: 2; }

/* people and things: a card per entity with its picture and the files linked to it */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.entity-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.entity-card:hover { text-decoration: none; background: var(--bg-high); box-shadow: var(--shadow); }
.entity-head { display: flex; gap: 12px; align-items: center; }
.entity-picture { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: var(--radius);
  background: var(--bg-subtle); border: 1px solid var(--border-subtle); }
.entity-picture.round { border-radius: 50%; }
.entity-picture.initials { display: grid; place-items: center; font-weight: 600; font-size: 1.15rem;
  color: var(--content-secondary); background: var(--bg-field); border: 0; }
.entity-picture.icon-holder { display: grid; place-items: center; color: var(--content-secondary); }
.entity-name { min-width: 0; }
.entity-name .t { font-weight: 600; overflow-wrap: anywhere; }
.entity-files { display: flex; gap: 6px; align-items: center; }
.entity-files img { width: 54px; height: 42px; object-fit: cover; object-position: top; border-radius: var(--radius-small);
  border: 1px solid var(--border-subtle); background: var(--bg-subtle); }
.entity-files .more { font-size: 0.8rem; color: var(--content-secondary); padding: 0 4px; }

/* pictures of people and pets: round, as the app shows avatars */
img.icon-tile.avatar { object-fit: cover; border-radius: 50%; padding: 0; }
img.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.rcard[data-kind=person] .thumb, .rcard[data-kind=dog] .thumb { width: 64px; border-radius: 50%; justify-self: end; }

/* --- kinds of record: a colored edge, a faint tint and a colored icon wherever a record appears --- */
[data-section=people] { --kind: var(--c-people); }
[data-section=wallet] { --kind: var(--c-wallet); }
[data-section=things] { --kind: var(--c-things); }
[data-section=health] { --kind: var(--c-health); }
[data-section=finance] { --kind: var(--c-finance); }
[data-section=notes] { --kind: var(--c-notes); }
[data-section=journal] { --kind: var(--c-journal); }
[data-section=reminders] { --kind: var(--c-reminders); }
[data-section=passcodes] { --kind: var(--c-passcodes); }
[data-section=documents] { --kind: var(--c-documents); }

.rcard[data-section] { border-left: 3px solid var(--kind); background: color-mix(in srgb, var(--kind) 5%, var(--bg-mid)); }
.rcard[data-section]:hover { background: color-mix(in srgb, var(--kind) 9%, var(--bg-high)); }
.rcard[data-section] > .icon { color: var(--kind); }

.mini[data-section] { border-left: 3px solid color-mix(in srgb, var(--kind) 75%, transparent); border-radius: 4px var(--radius) var(--radius) 4px; }
.mini[data-section]:hover { background: color-mix(in srgb, var(--kind) 7%, transparent); }
.mini[data-section] > .icon { color: var(--kind); }

.story-dot[data-section], .story-item[data-section] .story-dot { border-color: var(--kind); color: var(--kind); }
.story-item[data-section]:hover { background: color-mix(in srgb, var(--kind) 6%, transparent); }

.entity-card[data-section], .fcard[data-section] { border-top: 3px solid var(--kind); }
.entity-card[data-section] .entity-picture.icon-holder, .entity-card[data-section] .entity-picture.initials {
  color: var(--kind); background: color-mix(in srgb, var(--kind) 12%, var(--bg-high)); }

.head[data-section] .icon-tile, .profile[data-section] .profile-picture.icon-tile {
  color: var(--kind); background: color-mix(in srgb, var(--kind) 12%, var(--bg-high)); }
.profile[data-section] { border-top: 4px solid var(--kind); }

.chip[data-section] > .icon, .tile[data-section] > .icon { color: var(--kind); }
.tile[data-section] { border-bottom: 3px solid var(--kind); }

/* a record's page: the same header as a person's or thing's page, then its text, fields and links */
.crumbs { color: var(--content-secondary); margin-bottom: 2px; }
.crumbs a { color: inherit; }
.crumbs a:hover { color: var(--brand-strong); }
.belongs-to { gap: 6px; margin-top: 10px; }
.belongs { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; border-radius: 999px;
  background: var(--bg-high); border: 1px solid var(--border-subtle); font-size: 0.85rem; color: var(--content-primary); }
.belongs:hover { text-decoration: none; background: var(--bg-mid); }
.belongs img, .belongs-icon { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; }
.belongs-icon { display: grid; place-items: center; background: color-mix(in srgb, var(--kind, var(--content-tertiary)) 14%, var(--bg-high));
  color: var(--kind, var(--content-secondary)); }
.belongs .muted { font-size: 0.78rem; }
.pager { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin: 2px 0; }
@media (max-width: 900px) { .pager { justify-content: flex-start; } }
.says { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.55; margin-top: 4px;
  padding: 2px 0 2px 14px; border-left: 3px solid var(--kind, var(--border-muted)); }
mark.linked { background: color-mix(in srgb, var(--brand) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
mark.mention { background: color-mix(in srgb, var(--warning) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.link-list .story-item { grid-template-columns: 30px minmax(0, 1fr) auto; margin: 0 -6px; }
.link-list .story-item::before { display: none; }
img.story-dot { object-fit: cover; padding: 0; }

/* the overview's family: one row per generation, oldest first, then the pets */
.family-card { margin: 16px 0; }
.gen-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 16px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.family-card .row + .gen-row { border-top: 0; margin-top: 4px; }
.gen-label { font-size: 0.85rem; font-weight: 600; color: var(--content-secondary); }
.gen-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 8px; }
.member { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius);
  background: var(--bg-high); border: 1px solid var(--border-subtle); border-left: 3px solid var(--kind); color: var(--content-primary); }
.member:hover { text-decoration: none; box-shadow: var(--shadow); }
.member.is-owner { background: color-mix(in srgb, var(--kind) 8%, var(--bg-high)); }
.member-picture { width: 46px; height: 46px; flex: none; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  background: var(--bg-field); color: var(--content-secondary); font-weight: 600; }
.member.gone .member-picture { filter: grayscale(1); opacity: 0.7; }
.member-text { min-width: 0; flex: 1; }
.member-name { font-weight: 600; font-size: 0.9rem; line-height: 1.25; overflow-wrap: anywhere; }
.member-role { font-size: 0.8rem; color: var(--content-secondary); }
.member-count { font-size: 0.76rem; color: var(--content-tertiary); margin-top: 1px; }
@media (max-width: 700px) { .gen-row { grid-template-columns: 1fr; gap: 8px; } }

/* a folded group in the sidebar */
.sidenav details.navgroup > summary { display: flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; }
.sidenav details.navgroup > summary::-webkit-details-marker { display: none; }
.sidenav details.navgroup > summary::before {
  content: ""; width: 12px; height: 12px; flex: none; background: currentColor; transform: rotate(-90deg); transition: transform 0.15s;
  -webkit-mask: url("/icons/isc-chevron_down.svg") center / contain no-repeat; mask: url("/icons/isc-chevron_down.svg") center / contain no-repeat; }
.sidenav details.navgroup[open] > summary::before { transform: none; }
.sidenav details.navgroup > summary:hover { color: var(--content-secondary); }
.sidenav details.navgroup > summary .n { margin-left: auto; padding: 0 7px; border-radius: 999px; background: var(--warning-bg);
  color: var(--warning); font-size: 0.72rem; letter-spacing: 0; text-transform: none; }
.sidenav details.navgroup[open] > summary .n { display: none; }
