/* ==========================================================================
   Hash Inc. Studio — the control panel, drawn as a drawing sheet.

   Deliberately the site's own language (bone paper, near-black ink, 0.5px
   hairlines, Source Code Pro, tiny letterspaced labels) pushed further
   towards the engineering end: everything is a ruled panel with a stamped
   header, numbers are tabular, corners are square, nothing casts a shadow.
   The site is the artefact; this is the sheet it was drawn on.

   The one place it deliberately DIVERGES from the site: targets are bigger
   and states are louder. This is a tool used for hours, not a page read once.
   ========================================================================== */

/* Self-hosted, same file the site uses — served from /public via /repo. */
@font-face {
  font-family: 'Source Code Pro';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/repo/fonts/source-code-pro-latin-var.woff2') format('woff2');
}

:root {
  /* palette — the site's tokens, verbatim */
  --bone: #f2efe7;
  --bone-bright: #f4efe3;
  --bone-dim: #e6e1d5;
  --ink: #1a1814;
  --ink-deep: #100e0a;
  --muted: #8a8375;
  --red: #b2401f;
  --teal: #2a5d68;
  --mustard: #e3b505;
  --green: #2f6b3a;

  /* surfaces */
  --paper: #f7f4ec;   /* raised panels — a shade above the sheet */
  --field: #fdfbf5;   /* input wells — the lightest thing on screen */
  --sunk: #eae5d9;    /* hover / inset */

  /* hairlines — the hash-grid motif */
  --rule: rgba(26, 24, 20, 0.28);
  --rule-strong: rgba(26, 24, 20, 0.55);
  --hairline: 0.5px solid var(--rule);
  --hairline-strong: 0.5px solid var(--rule-strong);

  --mono: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* the ruled backdrop, at the site's 35px pitch */
  --grid: linear-gradient(rgba(26, 24, 20, 0.045) 0.5px, transparent 0.5px),
          linear-gradient(90deg, rgba(26, 24, 20, 0.045) 0.5px, transparent 0.5px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bone);
  background-image: var(--grid);
  background-size: 35px 35px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

body { display: flex; flex-direction: column; }
button { font: inherit; color: inherit; font-variant-numeric: tabular-nums; }
::selection { background: var(--mustard); color: var(--ink-deep); }

:focus-visible {
  outline: 1.5px solid var(--teal);
  outline-offset: 1px;
}

/* the shared label voice — 8px, wide-tracked, muted */
.label,
.sidebar__section,
.fieldset > legend,
.field > label,
.prop-row--head,
.gprop-row--head,
.glitch-group__head,
.tab {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- top bar: the sheet's title block ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 9px 16px;
  border-bottom: var(--hairline-strong);
  background: var(--paper);
  flex-wrap: wrap;
}
.topbar__brand {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 11px;
  padding-right: 16px;
  border-right: var(--hairline);
}
.topbar__brand span { color: var(--red); }
.topbar__status { flex: 1; min-width: 240px; color: var(--muted); font-size: 11px; }
.topbar__status .dot {
  display: inline-block; width: 6px; height: 6px; margin-right: 7px;
  vertical-align: 1px; /* square, not round — this is a status lamp on a panel */
}
.topbar__status .dot--green { background: var(--green); }
.topbar__status .dot--grey { background: var(--muted); }
.topbar__status .dot--amber { background: var(--mustard); }
.topbar__status a { color: var(--teal); }
.topbar__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- buttons ---------- */

.btn {
  padding: 7px 13px;
  border: 0.5px solid var(--rule-strong);
  background: var(--paper);
  cursor: pointer;
  letter-spacing: 0.08em;
  font-size: 11px;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.btn:hover:not(:disabled) { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn--primary { background: var(--ink); color: var(--bone); border-color: var(--ink); font-weight: 700; }
.btn--primary:hover:not(:disabled) { background: var(--red); border-color: var(--red); }
.btn--danger { border-color: var(--red); color: var(--red); }
.btn--danger:hover:not(:disabled) { background: var(--red); border-color: var(--red); color: var(--bone); }
.btn--small { padding: 3px 8px; font-size: 10px; }
.btn--wide { display: block; width: calc(100% - 24px); margin: 12px; }
/* the top-bar Save, tinted while there are unsaved edits so it reads as the
   pending action next to Publish */
.btn--dirty { background: var(--mustard); color: var(--ink-deep); border-color: var(--mustard); font-weight: 700; }
.btn--dirty:hover:not(:disabled) { background: var(--ink); color: var(--bone); border-color: var(--ink); }

/* the ↑ ↓ reorder control — square, generous, obviously a pair.
   These replaced drag-and-drop outright, so they have to read as the
   primary way to move things, not a fallback. */
.move-btn {
  width: 26px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--rule-strong);
  background: var(--paper);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  transition: background-color 0.1s ease, color 0.1s ease;
}
.move-btn:hover:not(:disabled) { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.move-btn:active:not(:disabled) { background: var(--red); border-color: var(--red); color: var(--bone); }
.move-btn:disabled { opacity: 0.22; cursor: default; }

/* ---------- layout ---------- */

.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 268px;
  flex: none;
  border-right: var(--hairline-strong);
  background: var(--paper);
  overflow-y: auto;
  padding-bottom: 20px;
}
.sidebar__section {
  padding: 16px 12px 7px;
  border-bottom: var(--hairline);
}
.project-list, .nav-list { list-style: none; margin: 0; padding: 0; }

/* a project row = the button + its reorder arrows, side by side */
.project-row {
  display: flex;
  align-items: stretch;
  border-bottom: var(--hairline);
}
.project-row__move {
  display: flex;
  flex-direction: column;
  flex: none;
  border-left: var(--hairline);
}
.project-row__move .move-btn { border: 0; width: 24px; height: 50%; }
.project-row__move .move-btn:first-child { border-bottom: var(--hairline); }

.nav-item, .project-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}
.nav-item { border-bottom: var(--hairline); }
.project-item { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: baseline; }
.nav-item:hover, .project-item:hover { background: var(--sunk); }
.nav-item.is-active, .project-item.is-active { background: var(--ink); color: var(--bone); }

/* the position number is a gutter mark, not content */
.project-item__pos { flex: none; color: var(--muted); font-size: 10px; letter-spacing: 0.06em; }
.project-item.is-active .project-item__pos { color: var(--mustard); }
.project-item__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.project-item .meta {
  display: block; font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
}
.project-item.is-active .meta { color: rgba(242, 239, 231, 0.55); }
.project-item .badge-draft { color: var(--red); font-weight: 700; }
.project-item.is-active .badge-draft { color: var(--mustard); }

.main { flex: 1; overflow-y: auto; padding: 24px clamp(16px, 4vw, 48px) 72px; }
.empty-hint { color: var(--muted); padding: 32px 0; }

/* ---------- editor ---------- */

.editor-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 8px;
  /* Deliberately NOT sticky: a sticky header sat over the top of the page as
     it scrolled (worst on Site settings, hiding the sheet tabs and the first
     fieldset). Save moved to the always-visible top bar instead, so this
     header — title + the occasional Duplicate/Delete — is free to scroll away. */
}
.editor-head h1 {
  font-size: 15px; margin: 0; flex: 1;
  letter-spacing: 0.1em; text-transform: uppercase; font-weight: 800;
}
.editor-sub { color: var(--muted); margin: 0 0 20px; font-size: 11px; max-width: 78ch; }

.readout {
  padding: 7px 0;
  color: var(--teal);
  letter-spacing: 0.08em;
}

/* ---------- lab launcher ---------- */
/* the LAB sidebar items reuse .nav-item; their status badges sit inline
   rather than on their own line like the project-list meta */
.nav-item .meta {
  display: inline;
  margin-left: 8px;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-item.is-active .meta { color: rgba(242, 239, 231, 0.6); }

.lab-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0 22px;
}
.lab-param {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: var(--hairline);
  font-size: 11px;
}
.lab-param__key { color: var(--muted); letter-spacing: 0.04em; }
.lab-param__val { color: var(--ink); font-variant-numeric: tabular-nums; }

.issue-banner {
  border: 0.5px solid var(--red);
  border-left: 3px solid var(--red);
  background: rgba(178, 64, 31, 0.07);
  color: var(--red);
  padding: 10px 14px;
  margin: 0 0 18px;
}
.issue-banner ul { margin: 6px 0 0; padding-left: 18px; }

/* a fieldset is a titled panel on the sheet */
.fieldset {
  border: var(--hairline-strong);
  background: var(--paper);
  padding: 18px 16px 16px;
  margin: 0 0 20px;
}
.fieldset > legend {
  padding: 2px 8px;
  margin-left: -4px;
  border: var(--hairline);
  background: var(--bone);
  color: var(--ink);
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { display: block; }
.field > label .req { color: var(--red); }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="url"], .field textarea, .field select,
.chips, .modal input[type="text"], .modal select {
  font: inherit;
  font-variant-numeric: tabular-nums;
  padding: 7px 9px;
  border: 0.5px solid var(--rule-strong);
  background: var(--field);
  color: var(--ink);
  width: 100%;
  border-radius: 0;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--teal);
  background: #fff;
}
.field textarea { resize: vertical; min-height: 72px; line-height: 1.55; }
.field .hint { font-size: 10px; color: var(--muted); letter-spacing: 0.02em; }

/* ---------- hover-help: the ⓘ mark + its floating tooltip ----------
   Standing help text was pulled behind these marks to keep every screen
   clean. The tooltip is mounted once on <body> and positioned in viewport
   space (app.js) so a scrolling panel can never clip it. */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 6px; flex: none;
  border: 0.5px solid var(--rule-strong); border-radius: 50%;
  font-size: 9px; line-height: 1; letter-spacing: 0; text-transform: none;
  color: var(--muted); background: var(--field); cursor: help;
  vertical-align: middle; user-select: none;
  transition: background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}
.info:hover, .info:focus-visible {
  background: var(--ink); color: var(--bone); border-color: var(--ink); outline: none;
}
/* legends/titles are tiny + tracked; keep the mark from inheriting that */
legend .info, .glitch-target__title .info, .editor-head h1 .info { vertical-align: middle; }
.editor-head h1 .info { width: 15px; height: 15px; font-size: 10px; }

.tooltip {
  position: fixed; z-index: 200; max-width: 262px;
  background: var(--ink); color: var(--bone);
  padding: 8px 11px; font-size: 11px; line-height: 1.5;
  letter-spacing: normal; text-transform: none; text-align: left;
  border-left: 2px solid var(--mustard); pointer-events: none;
}
.field--row { flex-direction: row; align-items: center; gap: 8px; }

/* colour picker: a square swatch beside its hex box */
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 30px; height: 30px; flex: none; padding: 0;
  border: 0.5px solid var(--rule-strong); background: var(--field); cursor: pointer;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; }

/* model view-background swatches (accent palette + a "none" chip) */
.model-swatch {
  width: 24px; height: 24px; flex: none; padding: 0;
  border: 0.5px solid var(--rule-strong); background: var(--field);
  cursor: pointer; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.model-swatch.is-on { outline: 2px solid var(--ink); outline-offset: 1px; }
.model-swatch--none { background: var(--field); }
.field--row > label { order: 2; letter-spacing: normal; font-size: 12px; text-transform: none; color: var(--ink); }

.field input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px; background: transparent; cursor: pointer;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 2px; background: var(--rule-strong);
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 11px; height: 15px; margin-top: -6px;
  background: var(--ink); border: 0;
}
.field input[type="range"]:hover::-webkit-slider-thumb { background: var(--red); }

/* ---------- site settings: the five sheets ---------- */

.tabstrip {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 14px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 0.5px solid var(--rule);
  border-bottom: 0;
  margin-right: -0.5px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.tab:hover { background: var(--sunk); color: var(--ink); }
.tab.is-on { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.tab__count {
  font-size: 9px;
  padding: 0 4px;
  border: 0.5px solid currentColor;
  opacity: 0.6;
}
.tabpanel > .fieldset:last-child { margin-bottom: 0; }

/* ---------- media schematic ---------- */

.media-list { display: flex; flex-direction: column; gap: 8px; }

.media-card {
  border: 0.5px solid var(--rule-strong);
  background: var(--field);
  padding: 10px 12px;
}
.media-card__top { display: flex; gap: 12px; align-items: flex-start; }

/* the reorder control: index over a flush pair of arrows */
.media-card__move {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: none;
  padding-top: 1px;
}
.media-card__index {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
}
.move-pair { display: flex; flex-direction: column; }
.move-pair .move-btn:first-child { border-bottom: 0; }

/* the layout diagram: a page-width bar; FULL fills it, LEFT fills the left half */
.schematic {
  width: 118px;
  flex: none;
  border: 0.5px solid var(--rule-strong);
  height: 36px;
  position: relative;
  background:
    linear-gradient(rgba(26, 24, 20, 0.07) 0.5px, transparent 0.5px),
    linear-gradient(90deg, rgba(26, 24, 20, 0.07) 0.5px, transparent 0.5px),
    var(--bone);
  background-size: 6px 6px;
}
.schematic__fill { position: absolute; top: 3px; bottom: 3px; left: 3px; background: var(--ink); opacity: 0.85; }
.schematic--full .schematic__fill { right: 3px; }
.schematic--left .schematic__fill { width: 46%; }
.schematic--right .schematic__fill { left: auto; right: 3px; width: 46%; }
.schematic--titleblock {
  display: flex; align-items: center; justify-content: center;
  border-style: dashed; background: var(--bone-dim);
}
.schematic--titleblock .schematic__tag {
  position: static; font-size: 9px; letter-spacing: 0.14em; color: var(--ink); font-weight: 700;
}
.schematic__tag {
  position: absolute; right: 0; bottom: -15px;
  font-size: 8px; letter-spacing: 0.16em; color: var(--muted);
}

.media-card__thumbwrap {
  position: relative; width: 88px; height: 64px; flex: none;
  border: 0.5px solid var(--rule); background: var(--bone-dim); overflow: hidden;
}
.media-card__thumbwrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-card__thumbwrap .typeicon {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 20px; color: var(--muted);
}
.media-card__thumbwrap.is-focal { cursor: crosshair; }
/* the focal mark is a crosshair target, not a dot */
.focal-dot {
  position: absolute; width: 13px; height: 13px; margin: -7px 0 0 -7px;
  border: 1px solid var(--red); background: rgba(242, 239, 231, 0.35);
  pointer-events: none;
}
.focal-dot::before, .focal-dot::after {
  content: ''; position: absolute; background: var(--red);
}
.focal-dot::before { left: 50%; top: -4px; bottom: -4px; width: 1px; }
.focal-dot::after { top: 50%; left: -4px; right: -4px; height: 1px; }

.media-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.media-card__row1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.type-badge {
  font-size: 9px; letter-spacing: 0.18em; border: 0.5px solid var(--ink);
  padding: 2px 7px; font-weight: 700;
}
.media-card__src {
  font-size: 10px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px;
}

.toggle { display: inline-flex; border: 0.5px solid var(--rule-strong); }
.toggle button {
  border: 0; background: transparent; padding: 5px 11px; cursor: pointer;
  font-size: 10px; letter-spacing: 0.12em;
}
.toggle button:not(:last-child) { border-right: 0.5px solid var(--rule-strong); }
.toggle button:hover:not(.is-on) { background: var(--sunk); }
.toggle button.is-on { background: var(--ink); color: var(--bone); font-weight: 700; }

.hero-pick {
  font-size: 10px; letter-spacing: 0.1em; cursor: pointer;
  border: 0.5px dashed var(--rule-strong); background: transparent; padding: 4px 9px;
}
.hero-pick:hover { background: var(--sunk); }
.hero-pick.is-hero {
  border: 0.5px solid var(--mustard); background: rgba(227, 181, 5, 0.14);
  color: var(--ink); font-weight: 700;
}

.media-card__actions { display: flex; gap: 6px; margin-left: auto; }

/* ---------- hero media list (site settings → front page) ---------- */

.hero-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0.5px solid var(--rule-strong);
  background: var(--field);
  padding: 8px 12px;
  margin-bottom: 8px;
}
.hero-row--broken { border-color: var(--red); background: rgba(178, 64, 31, 0.06); }
.hero-row .media-card__thumbwrap { width: 74px; height: 46px; }
.hero-row__body { flex: 1; min-width: 0; }
.hero-row__title { letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-row__body .hint { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- R4 property system: properties table ---------- */

.prop-table { display: flex; flex-direction: column; gap: 5px; }
.prop-row {
  display: grid;
  grid-template-columns: 34px minmax(160px, 1fr) 90px minmax(220px, 1.6fr) auto;
  gap: 10px;
  align-items: start;
  border: 0.5px solid var(--rule-strong);
  background: var(--field);
  padding: 8px 10px;
}
.prop-row--head {
  border: 0;
  background: transparent;
  padding: 0 10px 2px;
}
.prop-row--orphan { border-color: var(--red); background: rgba(178, 64, 31, 0.06); }
.prop-row__show { display: flex; align-items: center; justify-content: center; padding-top: 6px; }
.prop-row__label { display: flex; flex-direction: column; gap: 4px; }
.prop-row__static { display: flex; align-items: center; gap: 6px; padding: 7px 0; }
.prop-row__badge {
  font-size: 8px; letter-spacing: 0.16em; color: var(--muted);
  border: 0.5px solid var(--rule); padding: 1px 5px;
}
.prop-row__kind { font-size: 9px; letter-spacing: 0.14em; color: var(--teal); text-transform: uppercase; }
.prop-row__width select { width: 100%; }
.prop-row__value { min-width: 0; }
.prop-row__value input, .prop-row__value textarea, .prop-row__value select { width: 100%; }
.prop-row__actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* chips (tags kind) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bone-dim); border: 0.5px solid var(--rule);
  padding: 2px 4px 2px 8px; font-size: 11px;
}
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1; padding: 0 2px; }
.chip button:hover { color: var(--red); }
.chip-input { border: 0 !important; background: transparent !important; padding: 3px 4px !important; flex: 1; min-width: 110px; }

/* links (links kind) */
.links-editor { display: flex; flex-direction: column; gap: 6px; }
.links-editor__row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; }

/* cta (cta kind) */
.cta-editor { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cta-editor input { flex: 1; min-width: 140px; }

/* ---------- title block media item: property picker ---------- */

.tb-list { display: flex; flex-direction: column; gap: 8px; }
.tb-entry { border: 0.5px dashed var(--rule-strong); background: var(--paper); padding: 9px 10px; }
.tb-entry__row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tb-entry__row1 select { flex: 1; max-width: 260px; }

/* ---------- site settings: global properties manager ---------- */

.gprop-list { display: flex; flex-direction: column; gap: 5px; }
.gprop-row {
  display: grid;
  grid-template-columns: 56px minmax(160px, 1fr) 110px 90px auto;
  gap: 10px;
  align-items: center;
  border: 0.5px solid var(--rule-strong);
  background: var(--field);
  padding: 8px 10px;
}
.gprop-row--head { border: 0; background: transparent; padding: 0 10px 2px; }
.gprop-row__actions { display: flex; gap: 2px; }
.gprop-row__kind { font-size: 10px; letter-spacing: 0.12em; color: var(--teal); text-transform: uppercase; }
.gprop-row select { width: 100%; }

/* ---------- logo preview ---------- */

.logo-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo-preview img {
  height: 46px; max-width: 190px; object-fit: contain;
  border: 0.5px solid var(--rule); background: var(--field); padding: 5px 8px;
}

/* ---------- glitch / printed tuning groups ---------- */

.glitch-target {
  border: 0.5px solid var(--rule);
  padding: 14px 12px 12px;
  margin-bottom: 12px;
  background: var(--bone);
}
.glitch-target__title {
  font-size: 10px; letter-spacing: 0.2em; font-weight: 700;
  text-transform: uppercase; margin-bottom: 12px;
  padding-bottom: 6px; border-bottom: var(--hairline);
}
.glitch-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(236px, 1fr)); gap: 14px; }
.glitch-group { border: 0.5px solid var(--rule); background: var(--field); padding: 11px 12px; }
.glitch-group__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.glitch-group .field { margin-bottom: 8px; }

/* ---------- SEO preview card ---------- */

.share-preview {
  border: 0.5px dashed var(--rule-strong);
  padding: 12px 14px;
  background: var(--field);
  max-width: 480px;
}
.share-preview .sp-title { font-weight: 700; }
.share-preview .sp-desc { color: var(--muted); font-size: 11px; }
.share-preview .sp-img { font-size: 10px; color: var(--teal); margin-top: 4px; }

/* ---------- log panel ---------- */

.logpanel { border-top: var(--hairline-strong); background: var(--paper); flex: none; }
.logpanel__bar {
  display: flex; align-items: center; gap: 14px; padding: 6px 16px;
  font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase;
  cursor: pointer; flex-wrap: wrap;
}
.logpanel__hint { color: var(--muted); letter-spacing: normal; text-transform: none; font-size: 11px; flex: 1; }
.logpanel__buttons { display: flex; gap: 6px; }
.logpanel__badge { color: var(--red); font-weight: 800; }
.logpanel__body {
  margin: 0; padding: 10px 16px; max-height: 220px; overflow-y: auto;
  font-size: 11px; line-height: 1.55; border-top: var(--hairline);
  white-space: pre-wrap; word-break: break-word;
  background: var(--bone); color: var(--muted);
}
.logpanel__body .err { color: var(--red); }

/* ---------- toast + modal ---------- */

.toast {
  position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bone); padding: 11px 18px; z-index: 60;
  max-width: 80vw; border-left: 3px solid var(--mustard);
}
.toast.toast--error { background: var(--red); border-left-color: var(--ink); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 14, 10, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--bone); border: 1px solid var(--ink); padding: 22px;
  width: min(720px, 94vw); max-height: 90vh; overflow-y: auto;
  background-image: var(--grid); background-size: 35px 35px;
}
.modal h2 {
  margin: 0 0 16px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  padding-bottom: 8px; border-bottom: 1px solid var(--ink);
}
.modal .field { margin-bottom: 12px; }
.modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---------- framing viewer ---------- */

.viewer-wrap { display: flex; gap: 20px; flex-wrap: wrap; }
.viewer-cell {
  width: 320px; height: 320px; flex: none;
  border: 0.5px solid var(--ink); position: relative;
  background:
    linear-gradient(rgba(26, 24, 20, 0.12) 0.5px, transparent 0.5px),
    linear-gradient(90deg, rgba(26, 24, 20, 0.12) 0.5px, transparent 0.5px),
    var(--field);
  background-size: 40px 40px;
}
.viewer-cell canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.viewer-cell .celltag {
  position: absolute; left: 6px; bottom: 4px;
  font-size: 8px; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase;
}
.viewer-controls { flex: 1; min-width: 250px; display: flex; flex-direction: column; gap: 10px; }
.viewer-controls .val { color: var(--teal); }

/* ---------- help ---------- */

.help { max-width: 84ch; }
.help h2 {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  margin: 26px 0 10px; padding-bottom: 6px; border-bottom: var(--hairline);
}
.help ol, .help ul { padding-left: 20px; }
.help li { margin-bottom: 7px; }
.help code { background: var(--bone-dim); padding: 1px 5px; border: 0.5px solid var(--rule); }
.help .callout { border-left: 3px solid var(--teal); padding: 10px 14px; background: var(--paper); margin: 12px 0; }

/* ---------- desktop grid-layout tool (Site Settings → Front page) ---------- */

.gridlayout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 420px;
}
.gridlayout__tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border: var(--hairline-strong);
  background: var(--paper);
  cursor: grab;
  user-select: none;
}
.gridlayout__tile.is-dragging { opacity: 0.4; }
.gridlayout__tile.is-dropzone { outline: 2px solid var(--red); outline-offset: -2px; }
.gridlayout__pos {
  position: absolute; top: 5px; left: 6px;
  font-size: 9px; letter-spacing: 0.08em; color: var(--muted);
  background: var(--paper); padding: 0 3px;
}
.gridlayout__img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  background: var(--sunk); pointer-events: none;
}
.gridlayout__img--none {
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.gridlayout__name {
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gridlayout__move { display: flex; gap: 4px; justify-content: center; }
.type-badge--warn { color: var(--red); border-color: var(--red); cursor: help; }
.topbar__user { font-size: 10px; letter-spacing: 0.08em; color: var(--muted); margin-left: 12px; white-space: nowrap; }
.topbar__user a { color: inherit; }

/* ---------- phones (the online studio is meant to work from one) ---------- */

.btn--menu { display: none; }

@media (max-width: 760px) {
  .topbar { gap: 8px 10px; padding: 8px 12px; }
  .topbar__brand { border-right: 0; padding-right: 0; }
  .topbar__status { order: 3; flex-basis: 100%; min-width: 0; }
  .topbar__actions { order: 2; gap: 4px; }
  .topbar__actions .btn { padding: 7px 9px; }
  .btn--menu { display: inline-block; }

  .layout { position: relative; }
  /* the project list slides over the editor; ☰ toggles it */
  .sidebar {
    position: absolute; inset: 0 auto 0 0; z-index: 50;
    width: min(320px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.18s ease;
    box-shadow: 8px 0 24px rgba(16, 14, 10, 0.18);
  }
  body.sidebar-open .sidebar { transform: none; }

  .main { padding: 16px 12px 72px; }
  .media-card__top { flex-wrap: wrap; }
  .schematic { display: none; }
  .media-card__thumbwrap { width: 120px; height: 90px; }
  .media-card__src { max-width: 60vw; }
  .modal { padding: 16px; }

  /* property rows: stack the columns instead of a 5-column table */
  .prop-row { grid-template-columns: 34px 1fr; }
  .prop-row > :nth-child(n + 3) { grid-column: 1 / -1; }
  .prop-row--head { display: none; }

  /* activity log: one slim line until opened */
  .logpanel__hint { display: none; }
  .logpanel__bar { padding: 4px 12px; justify-content: space-between; }
}
