@font-face {
  font-family: "Crimson Pro";
  src: url("./fonts/crimson-pro-roman.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Crimson Pro";
  src: url("./fonts/crimson-pro-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Crimson Fallback";
  src: local("Georgia");
  size-adjust: 94%;
  ascent-override: 96%;
  descent-override: 24%;
}

@font-face {
  font-family: "Mono Fallback";
  src: local("Courier New");
  size-adjust: 98%;
}

:root,
[data-theme="light"] {
  color-scheme: light;
  --paper: #f0f2f0;
  --panel: #e7eae7;
  --card: #e9ebe9;
  --dim-card: #edefed;
  --well: #dfe1df;
  --ink: #232822;
  --t2: #5c615c;
  --t3: #8d918d;
  --rule: #929591;
  --hair: #c3c6c3;
  --soft: #e6e8e6;
  --dot: #d7dad7;
  --moss: #40623e;
  --moss-ink: #f1f7f1;
  --off: #446142;
  --off-deep: #20341f;
  --forest: #20341f;
  --wash: #d9dfd9;
  --stem: #505d4f;
  --stem-dim: #c0c5c0;
  --amber: #845a0f;
  --danger: #902920;
  --modal-dim: rgba(35, 40, 34, 0.30);
  --serif: "Crimson Pro", "Crimson Fallback", Georgia, serif;
  --mono: "IBM Plex Mono", "Mono Fallback", ui-monospace, "SF Mono", monospace;
  --ground: radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 1.4px) 0 0 / 22px 22px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #13181a;
  --panel: #20272c;
  --card: #20252b;
  --dim-card: #181e22;
  --well: #111517;
  --ink: #dee7e0;
  --t2: #a5ada9;
  --t3: #777f7f;
  --rule: #707775;
  --hair: #444a4d;
  --soft: #1d2224;
  --dot: #2b3132;
  --moss: #82c795;
  --moss-ink: #0a0f0b;
  --off: #233f2b;
  --off-deep: #496d52;
  --forest: #020803;
  --wash: #212f2a;
  --stem: #9fb9a7;
  --stem-dim: #3d4844;
  --amber: #e6bd77;
  --danger: #eb8375;
  --modal-dim: rgba(0, 0, 0, 0.64);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--paper);
  background-image: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--moss);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.mobile-only {
  display: none !important;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
  line-height: 1.4;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--rule);
  white-space: nowrap;
  transition: background-color 110ms ease, transform 90ms ease, box-shadow 90ms ease;
}

.btn:hover {
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 3px 3px 0 var(--moss), inset 0 0 0 1px var(--moss);
}

.btn-sm {
  min-height: 28px;
  padding: 0 10px;
  font-size: 10.5px;
}

.btn-lg {
  min-height: 44px;
  width: 100%;
  padding: 0 16px;
}

.btn-primary {
  background: var(--moss);
  color: var(--moss-ink);
  box-shadow: 3px 3px 0 var(--off-deep), inset 0 0 0 1px var(--forest);
}

.btn-primary:hover {
  background: var(--moss);
  color: var(--moss-ink);
  box-shadow: 3px 3px 0 var(--off-deep), inset 0 0 0 1px var(--ink);
}

.btn-primary:active {
  transform: translate(3px, 3px);
  box-shadow: inset 0 0 0 1px var(--forest);
}

.btn-active {
  background: var(--wash);
  color: var(--moss);
  box-shadow: inset 0 0 0 1px var(--moss);
}

.btn-danger {
  color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}

.btn-danger:hover {
  background: var(--soft);
  box-shadow: inset 3px 0 0 var(--danger), inset 0 0 0 1px var(--danger);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
}

.input,
.select {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--rule);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.35;
  transition: box-shadow 110ms ease;
}

.input-serif {
  font-family: var(--serif);
  font-size: 18px;
}

.input-mono {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums lining-nums;
}

.input-area {
  resize: vertical;
  min-height: 88px;
  line-height: 1.5;
}

.input:focus,
.select:focus {
  outline: none;
  box-shadow: 4px 4px 0 var(--moss), inset 0 0 0 1px var(--moss);
}

.input::placeholder {
  color: var(--t2);
  opacity: 0.72;
}

.seg-control {
  display: inline-flex;
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.seg-btn {
  min-height: 30px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
  background: transparent;
}

.seg-btn:hover {
  background: var(--soft);
  color: var(--ink);
}

.seg-btn.on {
  background: var(--moss);
  color: var(--moss-ink);
}

.inline-err {
  padding: 9px 12px;
  background: var(--card);
  color: var(--danger);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  box-shadow: inset 3px 0 0 var(--danger), inset 0 0 0 1px var(--danger);
}

.lock-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--paper);
  background-image: var(--ground);
  transition: opacity 160ms ease;
  z-index: 50;
}

.lock-screen.leaving {
  opacity: 0;
}

.lock-frame {
  position: relative;
  width: 100%;
  max-width: 440px;
}

.crop {
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.crop-tl {
  top: -16px;
  left: -16px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.crop-tr {
  top: -16px;
  right: -16px;
  border-left: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.crop-bl {
  bottom: -16px;
  left: -16px;
  border-right: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
}

.crop-br {
  bottom: -16px;
  right: -16px;
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
}

.lock-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 30px 26px;
  background: var(--card);
  box-shadow:
    4px 4px 0 var(--off),
    inset 3px 0 0 var(--moss),
    inset 0 0 0 1px var(--ink);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.lock-screen.leaving .lock-card {
  transform: translate(4px, 4px);
  box-shadow:
    0 0 0 var(--off),
    inset 3px 0 0 var(--moss),
    inset 0 0 0 1px var(--ink);
}

.lock-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t2);
}

.lock-mark {
  color: var(--ink);
  margin: 2px 0 -4px;
}

.lock-title {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 600;
  line-height: 44px;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.lock-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 24px;
  color: var(--t2);
  margin-top: -10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}

.lock-foot {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t2);
  text-align: center;
  line-height: 1.5;
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

.masthead {
  flex: 0 0 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  background: var(--panel);
  box-shadow: inset 0 -1px 0 var(--rule);
  z-index: 20;
}

.masthead-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-btn {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
  padding: 4px 2px;
}

.brand-btn:hover {
  color: var(--moss);
}

.masthead-rule {
  width: 1px;
  height: 18px;
  background: var(--rule);
}

.masthead-stats {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
  white-space: nowrap;
}

.index-trigger {
  flex: 0 1 360px;
  width: 360px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--rule);
  color: var(--t2);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.index-trigger:hover {
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.kbd {
  padding: 2px 5px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--hair);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t2);
}

.masthead-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--hair);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t2);
  white-space: nowrap;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--moss);
}

.live-dot.offline {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

.menu-trigger {
  min-width: 32px;
  padding: 0 9px;
  font-size: 15px;
  letter-spacing: 0;
}

.menu-popover {
  position: fixed;
  top: 50px;
  right: 12px;
  width: 264px;
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--off), inset 0 0 0 1px var(--ink);
  z-index: 40;
}

.menu-row {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: left;
}

.menu-row:hover {
  background: var(--soft);
  box-shadow: inset 2px 0 0 var(--moss);
}

.menu-row-danger {
  color: var(--danger);
}

.menu-row-danger:hover {
  box-shadow: inset 2px 0 0 var(--danger);
}

.menu-hint {
  color: var(--t2);
  font-size: 10px;
}

.menu-val {
  color: var(--moss);
  font-weight: 500;
}

.menu-sep {
  height: 1px;
  background: var(--hair);
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  position: relative;
}

.plate-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#canvas.dragging {
  cursor: grabbing;
}

#canvas.pointer {
  cursor: pointer;
}

.gen-register {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 64px;
  pointer-events: none;
  border-right: 1px solid var(--hair);
  background: var(--paper);
  opacity: 0.92;
  overflow: hidden;
  z-index: 4;
}

.gen-mark {
  position: absolute;
  left: 0;
  right: 0;
  padding: 2px 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
  border-top: 1px solid var(--hair);
  line-height: 1.3;
}

.gen-decade {
  display: block;
  font-size: 9px;
  color: var(--t3);
  letter-spacing: 0.08em;
}

.me-banner {
  position: absolute;
  top: 12px;
  left: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--off), inset 3px 0 0 var(--moss), inset 0 0 0 1px var(--ink);
  z-index: 12;
}

.me-banner-text {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}

.me-banner-actions {
  display: flex;
  gap: 6px;
}

.plate-key {
  position: absolute;
  left: 76px;
  bottom: 12px;
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--off), inset 0 0 0 1px var(--ink);
  z-index: 10;
}

.key-toggle {
  width: 100%;
  min-height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.key-scale {
  color: var(--t2);
  font-weight: 400;
}

.key-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--hair);
}

.plate-key.collapsed .key-body {
  display: none;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t2);
}

.key-swatch {
  display: inline-block;
  width: 18px;
  position: relative;
}

.key-ribbon {
  height: 3px;
  background: var(--stem);
}

.key-hair {
  height: 1px;
  background: var(--t2);
}

.key-knot {
  height: 6px;
  background: linear-gradient(to bottom, transparent 2.5px, var(--ink) 2.5px, var(--ink) 3.5px, transparent 3.5px);
}

.key-knot::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  width: 8px;
  height: 6px;
  background: var(--stem);
  clip-path: polygon(0 50%, 50% 0, 100% 50%, 50% 100%);
}

.key-seed {
  height: 6px;
}

.key-seed::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  width: 6px;
  height: 6px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.zoom-group {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--off), inset 0 0 0 1px var(--ink);
  z-index: 10;
}

.zoom-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.zoom-btn + .zoom-btn {
  border-left: 1px solid var(--hair);
}

.zoom-btn:hover {
  background: var(--soft);
  color: var(--moss);
}

.folio {
  flex: 0 0 400px;
  width: 400px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--ink);
  z-index: 15;
  min-height: 0;
}

.folio-tabs {
  flex: 0 0 38px;
  display: flex;
  align-items: stretch;
  background: var(--well);
  border-bottom: 1px solid var(--rule);
}

.folio-tab {
  flex: 1 1 0;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t2);
  border-right: 1px solid var(--hair);
}

.folio-tab:hover {
  background: var(--soft);
  color: var(--ink);
}

.folio-tab.on {
  background: var(--panel);
  color: var(--ink);
  box-shadow: inset 0 3px 0 var(--moss);
}

.folio-close {
  flex: 0 0 38px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--t2);
}

.folio-close:hover {
  background: var(--soft);
  color: var(--ink);
}

.folio-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-head-block {
  flex: 0 0 auto;
  padding: 18px 20px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--hair);
}

.sheet-name {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 34px;
  color: var(--ink);
  margin-top: 4px;
}

.sheet-nick {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--t2);
  margin-top: 2px;
}

.sheet-kin {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.kin-desi {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--moss);
}

.kin-eng {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--t2);
}

.sheet-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sheet-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sheet-empty {
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 26px;
  color: var(--ink);
}

.fact-table {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--card);
}

.fact-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  padding: 8px 12px;
  align-items: baseline;
}

.fact-row + .fact-row {
  border-top: 1px solid var(--hair);
}

.fact-row dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
}

.fact-row dd {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}

.sheet-sec {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sec-head {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: var(--ink);
  padding-bottom: 7px;
  background-image:
    radial-gradient(circle, var(--moss) 1px, transparent 1.3px),
    linear-gradient(var(--rule), var(--rule));
  background-size: 9px 3px, 100% 1px;
  background-position: left bottom 3px, left bottom;
  background-repeat: repeat-x, no-repeat;
}

.reg-group {
  display: flex;
  flex-direction: column;
}

.reg-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t2);
  padding: 6px 0 4px;
}

.reg-row {
  display: flex;
  align-items: stretch;
  min-height: 44px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--hair);
  margin-top: -1px;
}

.reg-link {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.reg-link:hover {
  background: var(--soft);
  box-shadow: inset 2px 0 0 var(--moss);
}

.reg-name {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}

.reg-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
  white-space: nowrap;
}

.reg-rm {
  flex: 0 0 38px;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--t2);
  border-left: 1px solid var(--hair);
}

.reg-rm:hover {
  color: var(--danger);
  background: var(--soft);
}

.reg-slot {
  min-height: 36px;
  padding: 0 12px;
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--hair);
  margin-top: -1px;
}

.reg-slot:hover {
  background: var(--wash);
  box-shadow: inset 0 0 0 1px var(--moss);
}

.sheet-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--hair);
}

.inline-confirm {
  padding: 10px 12px;
  background: var(--card);
  box-shadow: inset 3px 0 0 var(--moss), inset 0 0 0 1px var(--ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-confirm-text {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}

.inline-confirm-actions {
  display: flex;
  gap: 8px;
}

.sheet-edit-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.edit-fields {
  gap: 12px;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--moss);
}

.sticky-save-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--well);
  border-top: 1px solid var(--rule);
}

.trace-pickers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.trace-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.trace-swap-btn {
  height: 36px;
  min-width: 36px;
  padding: 0;
}

.trace-hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.trace-empty {
  color: var(--t2);
}

.route-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.route-card,
.route-mini {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--hair);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.route-card:hover,
.route-mini:hover {
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--moss);
}

.route-card.on {
  background: var(--wash);
  box-shadow: 4px 4px 0 var(--off), inset 3px 0 0 var(--moss), inset 0 0 0 1px var(--moss);
}

.route-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
}

.route-desi {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 28px;
  color: var(--moss);
}

.route-eng {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--t2);
}

.route-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.route-desi-sm {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--moss);
}

.route-eng-sm {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--t2);
}

.route-profile {
  padding: 4px 0;
}

.gen-profile-svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.route-chain {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--t2);
  word-break: break-word;
}

.ledger-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.ledger-list,
.diag-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ledger-row {
  padding: 10px 12px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--hair);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ledger-row.current {
  box-shadow: inset 3px 0 0 var(--moss), inset 0 0 0 1px var(--rule);
}

.ledger-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t2);
}

.ledger-rev {
  color: var(--ink);
  font-weight: 500;
}

.ledger-summary {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}

.ledger-cur-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--moss);
}

.ledger-actions {
  margin-top: 2px;
}

.diag-card {
  padding: 10px 12px;
  background: var(--card);
  box-shadow: inset 3px 0 0 var(--moss), inset 0 0 0 1px var(--hair);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.diag-card.warn {
  box-shadow: inset 3px 0 0 var(--danger), inset 0 0 0 1px var(--danger);
}

.diag-msg {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 22px;
  color: var(--ink);
}

.diag-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sprout-popover {
  position: fixed;
  width: 296px;
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--off), inset 3px 0 0 var(--moss), inset 0 0 0 1px var(--ink);
  z-index: 45;
}

.sprout-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
}

.sprout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hair);
}

.sprout-title {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--moss);
}

.sprout-close {
  width: 28px;
  height: 28px;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--t2);
}

.sprout-suggestions {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--moss);
  background: var(--card);
}

.sprout-sugg-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 7px 10px;
  text-align: left;
  border-top: 1px solid var(--hair);
}

.sprout-sugg-row:first-child {
  border-top: none;
}

.sprout-sugg-row:hover {
  background: var(--wash);
}

.sprout-sugg-k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--moss);
}

.sprout-sugg-v {
  font-family: var(--serif);
  font-size: 15.5px;
  color: var(--ink);
}

.sprout-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: end;
}

.sprout-year-field {
  min-width: 0;
}

.sprout-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.index-dialog {
  margin: 12vh auto auto;
  width: min(640px, calc(100vw - 24px));
  max-height: 76vh;
  padding: 0;
  border: none;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--off), inset 0 0 0 1px var(--ink);
  overflow: hidden;
}

.index-dialog::backdrop {
  background: var(--modal-dim);
}

.index-card {
  display: flex;
  flex-direction: column;
  max-height: 76vh;
}

.index-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--ink);
}

.index-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 28px;
  color: var(--ink);
}

.index-input:focus {
  outline: none;
}

.index-results {
  overflow-y: auto;
  max-height: 58vh;
}

.idx-group-head {
  padding: 7px 14px 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t2);
  background: var(--well);
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}

.idx-row {
  width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border-bottom: 1px solid var(--hair);
}

.idx-row:hover,
.idx-row.on {
  background: var(--wash);
  box-shadow: inset 3px 0 0 var(--moss);
}

.idx-title {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
}

.idx-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
  white-space: nowrap;
}

.idx-empty {
  padding: 24px 16px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--t2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--off), inset 3px 0 0 var(--moss), inset 0 0 0 1px var(--ink);
  z-index: 60;
}

.toast.error {
  color: var(--danger);
  box-shadow: 4px 4px 0 var(--off), inset 3px 0 0 var(--danger), inset 0 0 0 1px var(--danger);
}

@media (max-width: 760px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .btn {
    min-height: 44px;
    padding: 0 14px;
    font-size: 11px;
  }

  .btn-sm {
    min-height: 44px;
    padding: 0 12px;
    font-size: 10.5px;
  }

  .masthead {
    flex: 0 0 auto;
    height: auto;
    min-height: calc(48px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
    gap: 8px;
  }

  .brand-btn {
    min-height: 44px;
    font-size: 20px;
    padding: 0 4px;
  }

  .index-trigger {
    flex: 1 1 auto;
    width: auto;
    min-height: 44px;
    font-size: 10.5px;
  }

  .menu-trigger {
    min-width: 44px;
    min-height: 44px;
  }

  .menu-popover {
    top: calc(52px + env(safe-area-inset-top));
    right: 8px;
    left: 8px;
    width: auto;
  }

  .menu-row {
    min-height: 46px;
    font-size: 11px;
  }

  .gen-register {
    width: 28px;
  }

  .gen-mark {
    padding: 2px 2px;
    font-size: 10px;
    text-align: center;
  }

  .gen-decade {
    display: none;
  }

  .me-banner {
    left: 34px;
    right: 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .zoom-group {
    right: 8px;
    bottom: 10px;
  }

  .zoom-btn {
    min-width: 44px;
    height: 44px;
  }

  .folio {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    width: 100%;
    flex: none;
    border-left: none;
    border-top: 3px solid var(--moss);
    box-shadow: 0 -1px 0 var(--ink);
    transition: height 180ms cubic-bezier(0.22, 1, 0.36, 1);
    height: 52dvh;
    z-index: 25;
  }

  .folio[data-detent="peek"] {
    height: 156px;
  }

  .folio[data-detent="half"] {
    height: 52dvh;
  }

  .folio[data-detent="full"] {
    height: calc(100dvh - 48px - env(safe-area-inset-top) - 56px - env(safe-area-inset-bottom));
  }

  .folio-drag {
    flex: 0 0 22px;
    align-items: center;
    justify-content: center;
    background: var(--well);
    touch-action: none;
    cursor: ns-resize;
  }

  .folio-grip {
    width: 36px;
    height: 3px;
    background: var(--rule);
  }

  .folio-tabs {
    flex: 0 0 44px;
  }

  .folio-tab,
  .folio-close {
    min-height: 44px;
    min-width: 44px;
  }

  .sheet-name {
    font-size: 26px;
    line-height: 30px;
  }

  .sheet-head-block {
    padding: 12px 14px 10px;
  }

  .sheet-scroll-body {
    padding: 12px 14px 20px;
  }

  .reg-rm {
    flex: 0 0 44px;
  }

  .reg-slot {
    min-height: 44px;
  }

  .mobile-dock {
    flex: 0 0 auto;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--panel);
    border-top: 1px solid var(--ink);
    z-index: 30;
  }

  .dock-btn {
    flex: 1 1 0;
    min-height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--t2);
    border-right: 1px solid var(--hair);
  }

  .dock-btn:last-child {
    border-right: none;
  }

  .dock-btn.on {
    color: var(--ink);
    background: var(--card);
    box-shadow: inset 0 3px 0 var(--moss);
  }

  .dock-add {
    background: var(--moss);
    color: var(--moss-ink);
  }

  .sprout-popover {
    left: 0;
    right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom));
    top: auto;
    width: 100%;
    box-shadow: inset 0 3px 0 var(--moss), 0 -1px 0 var(--ink);
  }

  .sprout-close,
  .trace-swap-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .index-dialog {
    margin: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
  }

  .index-card {
    height: 100dvh;
    max-height: 100dvh;
  }

  .index-results {
    flex: 1 1 auto;
    max-height: none;
  }

  .toast {
    bottom: calc(68px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}
