/* ==========================================================================
   VTID Partner Intelligence — design system
   Monochrome, light mode, opaque surfaces (no translucency/glass).
   Color is reserved for meaning only. See DESIGN.md and /styleguide.
   ========================================================================== */

:root {
  /* --- Surfaces ------------------------------------------------------- */
  --bg:            #f5f5f7;              /* app canvas */
  --surface:       #ffffff;              /* cards, toolbar, panels */
  --fill:          rgba(120,120,128,.08);/* inputs, row hover */
  --fill-hover:    rgba(120,120,128,.12);
  --selected:      rgba(0,0,0,.06);      /* selected row */

  /* --- Text ----------------------------------------------------------- */
  --label:         #1d1d1f;
  --label-2:       rgba(60,60,67,.78);
  --label-3:       rgba(60,60,67,.30);

  /* --- Lines ---------------------------------------------------------- */
  --separator:     rgba(60,60,67,.18);
  --border:        rgba(60,60,67,.22);

  /* --- Accent (monochrome graphite) ----------------------------------- */
  --accent:        #1d1d1f;
  --accent-hover:  #000000;
  --on-accent:     #ffffff;
  --focus-ring:    rgba(29,29,31,.28);

  /* --- Destination colors (Settings-style icon tiles) ------------------
     The one sanctioned decorative color. Chrome and data stay neutral. */
  --c-map:     linear-gradient(160deg, #4a9bf5, #2f6fd0);
  --c-dir:     linear-gradient(160deg, #f0a24a, #d97a1f);
  --c-people:  linear-gradient(160deg, #6cc46c, #35933f);
  --c-guide:   linear-gradient(160deg, #a98cf0, #7a56d4);
  --c-lists:   linear-gradient(160deg, #3fc0c4, #1a8189);
  --c-map-solid:    #2f6fd0;
  --c-dir-solid:    #cf7a1c;
  --c-people-solid: #2f8a3b;
  --c-guide-solid:  #6f4fd0;
  --c-lists-solid:  #1a8189;   /* 4.6:1 on white — the darkest of the five */
  --pin:       #2f6fd0;                  /* map markers + clusters */

  /* --- Semantic: MEANING ONLY, never decoration ----------------------- */
  --red:           #d70015;              /* destructive */
  --red-bg:        #fdeceb;
  --green:         #248a3d;              /* affirmative (Alumni: Yes) */
  --green-bg:      #e8f5ea;
  --amber:         #b25000;              /* warning (read-only mode) */
  --amber-bg:      #fdf0e3;

  /* --- Typography ------------------------------------------------------
     SF Pro on Apple hardware via -apple-system. Sizes follow Apple's
     Dynamic Type scale, tightened for a dense desktop tool.            */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;

  --t-title1-size: 28px; --t-title1-weight: 700; --t-title1-track: -.022em;
  --t-title2-size: 22px; --t-title2-weight: 700; --t-title2-track: -.021em;
  --t-title3-size: 19px; --t-title3-weight: 600; --t-title3-track: -.015em;
  --t-headline-size: 17px; --t-headline-weight: 600; --t-headline-track: -.011em;
  --t-body-size: 15px;     --t-body-weight: 400;     --t-body-track: -.006em;
  --t-callout-size: 14px;  --t-callout-weight: 400;  --t-callout-track: -.003em;
  --t-footnote-size: 13px; --t-footnote-weight: 400; --t-footnote-track: 0;
  --row-h: 44px;           /* Apple's minimum comfortable row/target height */
  --t-caption-size: 12px;  --t-caption-weight: 400;  --t-caption-track: 0;
  --t-caption2-size: 11px; --t-caption2-weight: 500; --t-caption2-track: .006em;

  /* --- Spacing (8pt grid, 4pt subdivisions) --------------------------- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* --- Radii ----------------------------------------------------------- */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 18px; --r-full: 999px;

  /* --- Elevation (restrained) ------------------------------------------ */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 0 0 .5px rgba(0,0,0,.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);

  /* --- Layout ---------------------------------------------------------- */
  --toolbar-h: 56px;
  --sidebar-w: 260px;
  --inspector-w: 380px;
}

/* --- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: var(--t-body-size);
  letter-spacing: var(--t-body-track);
  color: var(--label);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); }

/* Focus: one consistent ring everywhere (keyboard only). */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --- Typography utilities ------------------------------------------------ */
.t-title1 { font-size: var(--t-title1-size); font-weight: var(--t-title1-weight); letter-spacing: var(--t-title1-track); }
.t-title2 { font-size: var(--t-title2-size); font-weight: var(--t-title2-weight); letter-spacing: var(--t-title2-track); }
.t-title3 { font-size: var(--t-title3-size); font-weight: var(--t-title3-weight); letter-spacing: var(--t-title3-track); }
.t-headline { font-size: var(--t-headline-size); font-weight: var(--t-headline-weight); letter-spacing: var(--t-headline-track); }
.t-body { font-size: var(--t-body-size); font-weight: var(--t-body-weight); letter-spacing: var(--t-body-track); }
.t-callout { font-size: var(--t-callout-size); }
.t-footnote { font-size: var(--t-footnote-size); }
.t-caption { font-size: var(--t-caption-size); }
.secondary { color: var(--label-2); }
.tertiary { color: var(--label-3); }

/* --- Icons: inline SVG, SF-Symbols-like stroke --------------------------- */
.icon {
  width: 20px; height: 20px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }

/* --- App icon tile -------------------------------------------------------
   A colored, rounded tile carrying an emoji — the iOS/macOS Settings idiom.
   Same component in the toolbar (small) and on landing cards (.lg). */
.app-icon {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: var(--r-md);
  font-size: 15px; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 3px rgba(0,0,0,.16);
}
.app-icon.lg { width: 46px; height: 46px; border-radius: var(--r-lg); font-size: 24px; }
.app-icon.map    { background: var(--c-map); }
.app-icon.dir    { background: var(--c-dir); }
.app-icon.people { background: var(--c-people); }
.app-icon.guide  { background: var(--c-guide); }
.app-icon.lists  { background: var(--c-lists); }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 7px 14px; min-height: 32px;
  font-family: inherit; font-size: var(--t-callout-size); font-weight: 500;
  letter-spacing: -.003em;
  color: var(--label); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--fill); }
.btn:active { background: var(--fill-hover); }
.btn:disabled { opacity: .45; cursor: default; }

.btn-primary {
  color: var(--on-accent); background: var(--accent); border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-hover); }

.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }

/* Quiet: chrome affordances (back, close, menu) — no border until hovered. */
.btn-quiet {
  border-color: transparent; background: transparent; color: var(--label);
  padding: 6px 10px;
}
.btn-quiet:hover { background: var(--fill); }

.btn-icon { padding: 6px; min-height: 32px; width: 32px; }

/* --- Toolbar -------------------------------------------------------------- */
.toolbar {
  display: flex; align-items: center; gap: var(--s-3);
  height: var(--toolbar-h); flex: 0 0 auto;
  padding: 0 var(--s-4);
  background: var(--surface);
  border-bottom: 1px solid var(--separator);
  box-shadow: 0 1px 0 rgba(0,0,0,.01);
  position: relative; z-index: 1200;
}
.toolbar h1 {
  margin: 0;
  font-size: var(--t-title3-size); font-weight: var(--t-title3-weight);
  letter-spacing: var(--t-title3-track);
  white-space: nowrap;
}
.toolbar .spacer { flex: 1; }
.toolbar .count {
  font-size: var(--t-footnote-size); color: var(--label-2);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.toolbar-divider { width: 1px; height: 22px; background: var(--separator); flex: 0 0 auto; }

/* Tinted toolbar: each page wears its destination colour. */
.toolbar.tinted { border-bottom-color: transparent; }
.toolbar.tinted h1 { color: #fff; }
.toolbar.tinted .count { color: rgba(255,255,255,.85); }
.toolbar.tinted .toolbar-divider { background: rgba(255,255,255,.3); }
.toolbar.tinted .btn-quiet { color: #fff; }
.toolbar.tinted .btn-quiet:hover { background: rgba(255,255,255,.2); }
.toolbar.tinted .btn-primary {
  background: #fff; color: var(--label); border-color: #fff;
}
.toolbar.tinted .btn-primary:hover { background: rgba(255,255,255,.88); border-color: rgba(255,255,255,.88); }
/* On a tinted bar the tile would vanish into the background — go translucent. */
.toolbar.tinted .app-icon { background: rgba(255,255,255,.22); box-shadow: none; }
.toolbar.tint-map    { background: var(--c-map-solid); }
.toolbar.tint-dir    { background: var(--c-dir-solid); }
.toolbar.tint-people { background: var(--c-people-solid); }
.toolbar.tint-guide  { background: var(--c-guide-solid); }
.toolbar.tint-lists  { background: var(--c-lists-solid); }

/* Read-only notice — amber because it carries meaning. */
.notice {
  display: none; align-items: center; gap: var(--s-2);
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: var(--t-caption-size); font-weight: 500;
  color: var(--amber); background: var(--amber-bg);
  white-space: nowrap;
}
.notice.show { display: inline-flex; }

/* --- App layout ----------------------------------------------------------- */
.layout { flex: 1; display: flex; min-height: 0; position: relative; }

/* --- Sidebar (macOS source list) ------------------------------------------ */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--separator);
  overflow-y: auto; padding: var(--s-5) var(--s-3) var(--s-6);
  z-index: 1100;
}
.sidebar h2 {
  margin: var(--s-6) 0 var(--s-2) 10px;
  font-size: var(--t-footnote-size); font-weight: 600;
  letter-spacing: -.003em; color: var(--label-2);
}
.sidebar h2:first-child { margin-top: 0; }

/* Search field */
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--label-3); }
.search input {
  padding-left: 33px; border-radius: var(--r-full);
  background: var(--fill); border-color: transparent;
}
.search input:focus { background: var(--surface); }

.field {
  width: 100%; padding: 9px 12px;
  font-family: inherit; font-size: var(--t-callout-size); letter-spacing: -.003em;
  color: var(--label); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field::placeholder { color: var(--label-3); }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--fill-hover); }
select.field { appearance: none; background-image: none; }
textarea.field { resize: vertical; min-height: 58px; }

/* Filter option list */
.options { max-height: 232px; overflow-y: auto; }
.options.short { max-height: 168px; }
.option {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-md);
  font-size: var(--t-callout-size); cursor: pointer; user-select: none;
}
.option:hover { background: var(--fill); }
.option:has(input:checked) { background: var(--selected); font-weight: 500; }
.option input { accent-color: var(--accent); margin: 0; }
.option .n {
  margin-left: auto; color: var(--label-2);
  font-size: var(--t-caption-size); font-variant-numeric: tabular-nums;
}

/* --- Slider --------------------------------------------------------------- */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; margin: var(--s-2) 0 0;
  border-radius: var(--r-full);
  background: var(--fill-hover);   /* JS paints the filled portion */
  outline: none; cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: .5px solid rgba(0,0,0,.14);
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: .5px solid rgba(0,0,0,.14);
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
  cursor: pointer;
}
.slider-val {
  margin-top: var(--s-2);
  font-size: var(--t-caption-size); color: var(--label-2);
  font-variant-numeric: tabular-nums;
}

/* --- List (Apple table) --------------------------------------------------- */
/* Content sits in an inset rounded card floating on the grey canvas —
   the defining macOS System Settings / iOS Settings arrangement.
   No overflow:hidden on the card, so the sticky header keeps working. */
/* No top padding: the card meets the scroll top so the sticky header has no
   gap for rows to show through. Sides/bottom keep the inset look. */
.list-wrap { flex: 1; min-width: 0; overflow: auto; background: var(--bg); padding: 0 var(--s-4) var(--s-4); }
.card-inset {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-top: 0;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  box-shadow: var(--shadow-sm);
}
table.list { width: 100%; border-collapse: separate; border-spacing: 0; }
table.list thead th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; white-space: nowrap; cursor: pointer; user-select: none;
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-footnote-size); font-weight: 500; color: var(--label-2);
  letter-spacing: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--separator);
}
table.list thead th:hover { color: var(--label); }
table.list thead th .arrow { margin-left: 4px; font-size: 9px; color: var(--label-2); }
table.list tbody td {
  height: var(--row-h);
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-body-size);
  border-bottom: 1px solid var(--separator);
  vertical-align: middle;
}
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tbody tr:last-child td:first-child { border-bottom-left-radius: var(--r-lg); }
table.list tbody tr:last-child td:last-child { border-bottom-right-radius: var(--r-lg); }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover { background: var(--fill); }
table.list tbody tr.active { background: var(--selected); }
table.list td.muted { color: var(--label-2); }
table.list td a { color: var(--label); text-decoration: none; border-bottom: 1px solid var(--label-3); }
table.list td a:hover { border-bottom-color: var(--label); }

.empty-state {
  padding: var(--s-7) var(--s-4); text-align: center;
  color: var(--label-2); font-size: var(--t-callout-size);
}

/* Monogram (neutral, replaces colored avatars) */
.monogram {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: var(--r-full);
  display: grid; place-items: center;
  background: var(--fill); color: var(--label-2);
  font-size: var(--t-caption-size); font-weight: 600;
}
.cell-lead { display: flex; align-items: center; gap: var(--s-3); }
.cell-lead b { font-weight: 500; }
.empty-state { background: var(--surface); border-radius: var(--r-lg); }

/* --- Pills ---------------------------------------------------------------- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-full);
  font-size: var(--t-caption-size); font-weight: 500;
  background: var(--fill); color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.pill.affirm { background: var(--green-bg); color: var(--green); }
/* Warning: a field that is thin or empty in the data, so a dimension built on
   it will score most companies zero. Amber's existing job, applied to data
   quality rather than to read-only mode. */
.pill.warn { background: var(--amber-bg); color: var(--amber); }

/* --- Meter ----------------------------------------------------------------
   A 0-100% bar for a score or a weight's share. Neutral by design: this is
   data, and data never carries hue. Set the width of .meter > i. */
.meter {
  display: block; width: 100%; height: 6px;
  border-radius: var(--r-full); background: var(--fill-hover);
  overflow: hidden;
}
.meter i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-full); }
.meter.sm { height: 4px; }

/* --- Chips ---------------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: var(--s-1); }
.chip {
  display: inline-block; padding: 3px 9px; border-radius: var(--r-full);
  font-size: var(--t-caption-size); color: var(--label-2);
  background: var(--fill);
}
a.chip { color: var(--label); text-decoration: none; transition: background .15s ease; }
a.chip:hover { background: var(--fill-hover); }

/* --- Scrim (modal backdrop) -----------------------------------------------
   The one place blur is allowed: it separates a modal sheet from the page
   behind it. Surfaces themselves stay opaque. */
.scrim {
  position: fixed; inset: 0; z-index: 1140;
  background: rgba(0,0,0,.22);
  -webkit-backdrop-filter: blur(12px) saturate(.85);
  backdrop-filter: blur(12px) saturate(.85);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.scrim.open { opacity: 1; pointer-events: auto; }

/* --- Inspector (detail panel) --------------------------------------------- */
.inspector {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: var(--inspector-w); flex: 0 0 var(--inspector-w);
  background: var(--surface);
  border-left: 1px solid var(--separator);
  overflow-y: auto; z-index: 1100;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.32,.72,0,1);
}
.inspector.open { transform: translateX(0); }

/* Sheet: used by the directories. Overrides the side-drawer geometry. */
.inspector.sheet {
  position: fixed; left: 50%; right: auto; top: auto; bottom: 0;
  width: min(820px, 94vw); height: min(84vh, 880px);
  flex-basis: auto;
  transform: translate(-50%, 100%);
  border: 1px solid var(--separator); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 1160;
  transition: transform .36s cubic-bezier(.32,.72,0,1);
}
.inspector.sheet.open { transform: translate(-50%, 0); }
/* Grabber, the iOS sheet affordance. */
.inspector.sheet .inspector-head::before {
  content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 38px; height: 5px; border-radius: var(--r-full); background: var(--label-3);
}
.inspector.sheet .inspector-head { padding-top: var(--s-5); border-radius: var(--r-xl) var(--r-xl) 0 0; }
/* Extra width earns two columns of fields. */
@media (min-width: 700px) {
  .inspector.sheet #view-fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-5); }
  .inspector.sheet .inspector-actions { max-width: 420px; }
  /* .kv:last-child clears one hairline, which is right in a single column but
     leaves a dangling line under the bottom of the LEFT column here. With two
     columns the final row holds the last two items, so both need clearing —
     and that holds for an odd count too, where the last item of the right
     column is the second-to-last child. */
  .inspector.sheet #view-fields .kv:nth-last-child(-n+2) { border-bottom: 0; }
}
.inspector-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-5) var(--s-4) var(--s-4);
  background: var(--surface);
  border-bottom: 1px solid var(--separator);
}
.inspector-head h3 {
  margin: 0;
  font-size: var(--t-title2-size); font-weight: var(--t-title2-weight);
  letter-spacing: var(--t-title2-track); line-height: 1.2;
}
.inspector-head .sub {
  margin-top: 2px; font-size: var(--t-footnote-size); color: var(--label-2);
}
.inspector-head .btn-quiet { margin-left: auto; }
.inspector-body { padding: var(--s-4); background: var(--bg); min-height: calc(100% - 76px); }
/* Field rows and the editor live in their own inset cards, like a
   Settings pane — grouping by card instead of by hairline. */
#view-fields, .editor {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: var(--r-lg);
  padding: var(--s-1) var(--s-4);
}
.editor { padding: var(--s-4); }
.inspector-actions { display: flex; gap: var(--s-2); margin-bottom: var(--s-4); }
.inspector-actions .btn { min-height: 34px; }
.inspector-actions .btn { flex: 1; }

/* Key/value rows — sentence case, never uppercase micro-labels. */
.kv { padding: 11px 0; border-bottom: 1px solid var(--separator); }
.kv:last-child { border-bottom: 0; }
.kv .k { font-size: var(--t-footnote-size); color: var(--label-2); }
.kv .v { margin-top: 3px; font-size: var(--t-body-size); word-break: break-word; }
.kv .v a { color: var(--label); text-decoration: none; border-bottom: 1px solid var(--label-3); }
.kv .v a:hover { border-bottom-color: var(--label); }

/* --- Revision history ------------------------------------------------------
   Sits at the bottom of the inspector's view side, below the last key/value
   row. Collapsed to a single button by default: the audit trail is something
   you go looking for, not something that should compete with the record. */
.history { margin-top: var(--s-4); }
.history .history-toggle { width: 100%; }
.history .history-body { display: none; margin-top: var(--s-3); }
.history.open .history-body { display: block; }
.history-empty { margin: 0; padding: var(--s-3) 0; color: var(--label-2); font-size: var(--t-footnote-size); }

.revision {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 10px 0; border-bottom: 1px solid var(--separator);
}
.revision:last-child { border-bottom: 0; }
.revision-main { flex: 1; min-width: 0; }
.revision-who { font-size: var(--t-callout-size); }
.revision-what { margin-top: 2px; font-size: var(--t-footnote-size); color: var(--label-2); }
.revision-when { margin-top: 2px; font-size: var(--t-caption-size); color: var(--label-3); }
/* A deletion is the one entry whose record no longer exists — worth marking. */
.revision.is-delete .revision-who b { color: var(--red); }
 /* A real bordered button, not a quiet one: it is the only thing in the row
    you can act on, and it should look like it. */
.revision-preview { flex: 0 0 auto; min-height: 28px; padding: 0 10px; font-size: var(--t-caption-size); }

/* Previewing an earlier state. Amber, like .notice, because it means "what
   you are reading is not the current record". */
.snapshot { display: none; }
.snapshot.open {
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  margin-bottom: var(--s-3); padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--amber); background: var(--amber-bg);
  font-size: var(--t-footnote-size);
}
.snapshot-text { flex: 1; min-width: 160px; }
.snapshot-back { flex: 0 0 auto; min-height: 30px; }
/* Editing or deleting from a historical view would act on the current record
   while showing an old one, so those buttons step aside until you come back. */
.inspector.previewing .inspector-actions { display: none; }
/* The fields that this revision actually changed. */
.kv.changed { position: relative; padding-left: 10px; }
.kv.changed::before {
  content: ''; position: absolute; left: 0; top: 11px; bottom: 11px;
  width: 2px; border-radius: var(--r-full); background: var(--amber);
}
.kv.changed .k { color: var(--amber); }

/* --- Edit form ------------------------------------------------------------ */
.editor { display: none; }
.editor.active { display: block; }
.view-mode.hidden { display: none; }
.editor label {
  display: block; margin: var(--s-4) 0 var(--s-1);
  font-size: var(--t-footnote-size); color: var(--label-2);
}
.editor > label:first-child, .editor .grid2:first-child label { margin-top: 0; }
.editor .field { width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.form-actions { display: flex; gap: var(--s-2); margin-top: var(--s-5); }
.form-actions .btn { flex: 1; }

/* --- Responsive ----------------------------------------------------------- */
.menu-toggle { display: none; }
@media (max-width: 820px) {
  .sidebar {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 1150;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.32,.72,0,1);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
  }
  .sidebar.open { transform: translateX(0); }
  .inspector { width: 100%; flex-basis: 100%; }
  .menu-toggle { display: inline-flex; }
  .toolbar .sub { display: none; }
  /* The toolbar runs out of room first; the notice is the least critical item. */
  .toolbar .notice { display: none !important; }
}
