:root {
  color-scheme: dark;
  --bg: #090c0a;
  --surface: #101512;
  --raised: #182019;
  --border: #304033;
  --text: #d7dec9;
  --muted: #7f8c7d;
  --green: #9fc47f;
  --cyan: #6fa5a1;
  --amber: #d2a45f;
  --red: #cc6868;
  --sidebar: 232px;
  --gap: 16px;
  --radius: 2px;
  font-family: "IBM Plex Mono", "Cascadia Mono", "Liberation Mono", ui-monospace, monospace;
  font-size: 14px;
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(48, 64, 51, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 64, 51, 0.09) 1px, transparent 1px),
    radial-gradient(circle at 18% 11%, rgba(111, 165, 161, 0.035), transparent 32%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
  line-height: 1.5;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.025;
  background: repeating-linear-gradient(0deg, transparent 0 3px, var(--green) 4px);
  animation: scanline 14s linear infinite;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button,
.button-link {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled),
.button-link:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--raised);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

button.primary,
.primary {
  border-color: var(--green);
  color: var(--bg);
  background: var(--green);
  font-weight: 800;
}

.danger-button {
  border-color: rgba(204, 104, 104, 0.72);
  color: var(--red);
}

.full {
  width: 100%;
}

a {
  color: var(--cyan);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--green);
}

input,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: 0;
  background: #0b100d;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  border-color: var(--green);
  outline: 1px solid var(--green);
  outline-offset: 2px;
}

label,
.select-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.custom-select {
  position: relative;
  min-width: 0;
}

.select-trigger {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0b100d;
  text-align: left;
}

.select-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-caret {
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--green);
  border-bottom: 1px solid var(--green);
  flex: 0 0 auto;
  transform: rotate(45deg) translate(-2px, 2px);
  transition: transform 140ms ease;
}

.custom-select.open {
  z-index: 80;
}

.custom-select.open .select-trigger {
  border-color: var(--green);
  color: var(--green);
  outline: 1px solid rgba(159, 196, 127, 0.3);
}

.custom-select.open .select-caret {
  transform: rotate(225deg) translate(-2px, 2px);
}

.select-options {
  position: absolute;
  z-index: 81;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  display: grid;
  max-height: min(320px, 52vh);
  border: 1px solid var(--green);
  background: #0b100d;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
}

.select-options[hidden] {
  display: none;
}

.select-option {
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 10px 34px 10px 12px;
  border: 0;
  border-bottom: 1px solid rgba(48, 64, 51, 0.72);
  border-radius: 0;
  background: #0b100d;
  text-align: left;
}

.select-option:last-child {
  border-bottom: 0;
}

.select-option:hover,
.select-option:focus-visible {
  color: var(--green);
  background: var(--raised);
}

.select-option.selected {
  color: var(--green);
  background: rgba(159, 196, 127, 0.08);
  box-shadow: inset 3px 0 var(--green);
}

.select-option.selected::after {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  background: var(--green);
  content: "";
  transform: translateY(-50%);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 0.9rem;
  letter-spacing: 0.045em;
}

h3 {
  margin-bottom: 5px;
  font-size: 1rem;
}

small {
  font-size: 0.76rem;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: var(--bg);
  background: var(--green);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.ok {
  color: var(--green) !important;
}

.cyan {
  color: var(--cyan) !important;
}

.pending {
  color: var(--amber) !important;
}

.warning {
  color: var(--amber) !important;
}

.danger {
  color: var(--red) !important;
}

.muted {
  color: var(--muted) !important;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.cursor {
  display: inline-block;
  color: var(--green);
  animation: cursor-step 900ms steps(1, end) infinite;
}

.gate {
  display: grid;
  min-height: 100vh;
  padding: 40px 20px 76px;
  place-items: center;
}

.gate-terminal {
  width: min(620px, 100%);
  border: 1px solid var(--border);
  background: rgba(16, 21, 18, 0.98);
  box-shadow: 0 0 0 1px rgba(159, 196, 127, 0.05);
  animation: route-reveal 220ms ease both;
}

.terminal-head,
.route-bar,
.command-line,
.mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
}

.terminal-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--raised);
}

.gate-body {
  padding: clamp(24px, 5vw, 42px);
}

.gate-body > p:not(.eyebrow) {
  color: var(--muted);
}

.diagnostics {
  margin: 28px 0;
  border-top: 1px solid var(--border);
}

.diagnostics div,
.dossier dl div {
  display: grid;
  grid-template-columns: minmax(110px, 0.34fr) minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(48, 64, 51, 0.65);
}

.diagnostics dt,
.dossier dt {
  color: var(--muted);
  font-size: 0.76rem;
}

.diagnostics dd,
.dossier dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.gate-form {
  display: grid;
  gap: 13px;
}

.diagnostic-line {
  min-height: 42px;
  margin-top: 22px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: #0b100d;
}

.gate-footer {
  position: absolute;
  bottom: 22px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-align: center;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  border-right: 1px solid var(--border);
  background: rgba(16, 21, 18, 0.98);
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 400;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  border: 1px solid var(--green);
  color: var(--green);
  place-items: center;
}

.sidebar nav {
  display: grid;
  padding: 18px 10px;
  gap: 4px;
}

.sidebar nav a {
  display: flex;
  min-height: 44px;
  padding: 11px 10px;
  border: 1px solid transparent;
  color: var(--muted);
  justify-content: space-between;
  text-decoration: none;
}

.sidebar nav a.active {
  border-color: var(--border);
  color: var(--green);
  background: var(--raised);
}

.sidebar nav b {
  font-size: 0.78rem;
  font-weight: 400;
}

.sidebar-meta {
  display: grid;
  margin-top: auto;
  padding: 14px 18px 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  gap: 4px;
}

.main-column {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding-bottom: 40px;
}

.route-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 42px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 12, 10, 0.96);
}

.route-bar span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mobile-head {
  display: none;
}

.workspace {
  width: min(100%, 1600px);
  min-width: 0;
  margin: 0 auto;
  padding: 24px;
  animation: route-reveal 220ms ease both;
}

.command-line {
  position: fixed;
  z-index: 15;
  right: 0;
  bottom: 0;
  left: var(--sidebar);
  min-height: 34px;
  padding: 6px 18px;
  border-top: 1px solid var(--border);
  background: rgba(9, 12, 10, 0.98);
}

.page-head {
  display: flex;
  min-width: 0;
  margin-bottom: 20px;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.page-head p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.big-count {
  font-size: 2.1rem;
}

.panel,
.metric-ledger,
.filter-console,
.batch-bar,
.batch-idle,
.buyer-identity,
.watch-controls {
  border: 1px solid var(--border);
  background: rgba(16, 21, 18, 0.96);
}

.panel {
  min-width: 0;
}

.panel > header,
.recent > header,
.buyer-identity > header {
  display: flex;
  min-height: 45px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.panel > header p {
  margin: 3px 0 0;
  font-size: 0.78rem;
}

.metric-ledger {
  display: grid;
  margin-bottom: var(--gap);
}

.metric-ledger.five {
  grid-template-columns: repeat(5, 1fr);
}

.metric-ledger.four {
  grid-template-columns: repeat(4, 1fr);
}

.metric {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--border);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: inherit;
  font-size: clamp(1.55rem, 2.6vw, 2.45rem);
  font-weight: 500;
  line-height: 1;
}

.console-grid {
  display: grid;
  margin-bottom: var(--gap);
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.85fr) minmax(260px, 0.75fr);
  gap: var(--gap);
}

.distribution,
.channels {
  min-height: 230px;
}

.census {
  padding: 10px 14px 14px;
}

.census > div {
  display: grid;
  grid-template-columns: 82px minmax(40px, 1fr) 38px;
  gap: 10px;
  min-height: 29px;
  align-items: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.census progress {
  width: 100%;
  height: 5px;
  border: 0;
  appearance: none;
  background: var(--raised);
  color: currentColor;
}

.census progress::-webkit-progress-bar {
  background: var(--raised);
}

.census progress::-webkit-progress-value {
  background: currentColor;
}

.census progress::-moz-progress-bar {
  background: currentColor;
}

.manual-census {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.manual-census .metric {
  padding-inline: 12px;
}

.manual-census .metric strong {
  font-size: 1.5rem;
}

.rule-note {
  margin: 12px 14px;
  color: var(--muted);
  font-size: 0.78rem;
}

.channel {
  display: flex;
  min-height: 40px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(48, 64, 51, 0.64);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.76rem;
}

.channel strong {
  font-weight: 600;
  text-align: right;
}

.recent > header a {
  text-decoration: none;
}

.filter-console {
  display: grid;
  min-width: 0;
  margin-bottom: var(--gap);
  padding: 12px;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.38fr) auto;
  align-items: end;
  gap: 10px;
}

.ledger-filters {
  grid-template-columns: minmax(200px, 1fr) 160px 180px minmax(150px, 0.38fr) auto;
}

.registry-filters {
  grid-template-columns: minmax(190px, 1fr) repeat(4, minmax(130px, 0.38fr)) auto;
}

.filter-console details {
  position: relative;
  min-height: 42px;
  padding: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.filter-console summary {
  cursor: pointer;
  font-size: 0.76rem;
}

.date-fields {
  position: absolute;
  z-index: 10;
  top: calc(100% + 5px);
  right: 0;
  display: grid;
  width: 330px;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.workspace-split {
  display: grid;
  min-width: 0;
  align-items: start;
  gap: var(--gap);
}

.inbox-split {
  grid-template-columns: minmax(0, 58fr) minmax(340px, 42fr);
}

.ledger-split {
  grid-template-columns: minmax(0, 66fr) minmax(320px, 34fr);
}

.batch-idle,
.batch-bar {
  min-height: 42px;
  margin-bottom: var(--gap);
  padding: 9px 13px;
  color: var(--muted);
  font-size: 0.76rem;
}

.batch-bar {
  display: flex;
  align-items: center;
  gap: 9px;
}

.batch-bar strong {
  margin-right: auto;
  color: var(--amber);
}

.queue-panel {
  overflow: hidden;
}

.queue-row {
  display: grid;
  min-width: 0;
  border-bottom: 1px solid rgba(48, 64, 51, 0.75);
  grid-template-columns: 48px minmax(0, 1fr);
  transition: background 140ms ease;
}

.queue-row.selected {
  box-shadow: inset 3px 0 var(--green);
  background: var(--raised);
}

.record-check {
  position: relative;
  display: grid;
  min-width: 44px;
  min-height: 54px;
  border-right: 1px solid var(--border);
  place-items: center;
  cursor: pointer;
}

.record-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.record-check span {
  width: 15px;
  height: 15px;
  border: 1px solid var(--muted);
}

.record-check input:checked + span {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.record-check:focus-within span {
  outline: 1px solid var(--green);
  outline-offset: 3px;
}

.row-core {
  display: grid;
  min-width: 0;
  min-height: 62px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 0.8fr) minmax(140px, 0.8fr) auto 54px;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.row-core:hover:not(:disabled) {
  border: 0;
  background: rgba(24, 32, 25, 0.7);
}

.record-id {
  color: var(--cyan);
}

.row-arrow {
  color: var(--muted);
  font-size: 0.72rem;
}

.inspector {
  position: sticky;
  top: 58px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  animation: inspector-in 180ms ease both;
}

.inspector-empty {
  display: grid;
  min-height: 400px;
  color: var(--muted);
  place-items: center;
}

.dossier {
  padding: 15px;
  border-bottom: 1px solid var(--border);
}

.dossier h3 {
  font-size: 1.12rem;
}

.dossier .badge {
  float: right;
}

.dossier dl {
  margin: 13px 0 0;
}

.seal-row {
  display: flex;
  min-width: 0;
  margin: 14px 0 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.seal-row.large .seal {
  padding: 9px 14px;
}

.seal {
  display: inline-grid;
  min-width: 94px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.15;
}

.seal small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.58rem;
}

.rating-normal,
.manual-goodlist {
  border-color: rgba(159, 196, 127, 0.65);
  color: var(--green);
}

.rating-low {
  border-color: rgba(111, 165, 161, 0.65);
  color: var(--cyan);
}

.rating-medium,
.rating-high {
  border-color: rgba(210, 164, 95, 0.65);
  color: var(--amber);
}

.rating-critical,
.manual-blacklist {
  border-color: rgba(204, 104, 104, 0.65);
  color: var(--red);
}

.count-grid {
  display: grid;
  border: 1px solid var(--border);
  grid-template-columns: repeat(3, 1fr);
}

.count-grid span {
  display: grid;
  min-width: 0;
  padding: 8px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.count-grid span:last-child {
  border: 0;
}

.count-grid small {
  color: var(--muted);
  font-size: 0.62rem;
}

.count-grid b {
  font-size: 1.05rem;
  font-weight: 500;
}

blockquote {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 2px solid var(--border);
  color: var(--muted);
  background: #0b100d;
  white-space: pre-wrap;
}

.terminal-actions {
  padding: 14px;
}

.terminal-actions > p {
  color: var(--amber);
  font-size: 0.74rem;
}

.terminal-actions > button,
.terminal-actions > .button-link {
  width: calc(50% - 5px);
}

.final-stamp {
  padding: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
}

.confirmation {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--amber);
  background: rgba(210, 164, 95, 0.07);
}

.confirmation p {
  margin: 6px 0 12px;
  color: var(--muted);
}

.confirmation button {
  margin-right: 6px;
}

.confirmation-panel {
  margin-bottom: var(--gap);
  padding: 12px;
}

.badge {
  display: inline-block;
  width: fit-content;
  padding: 4px 7px;
  border: 1px solid var(--border);
  font-size: 0.68rem;
  line-height: 1;
  letter-spacing: 0.04em;
}

.status-pending {
  border-color: rgba(210, 164, 95, 0.62);
  color: var(--amber);
}

.status-approved {
  border-color: rgba(159, 196, 127, 0.62);
  color: var(--green);
}

.status-unsatisfied {
  border-color: rgba(204, 104, 104, 0.62);
  color: var(--red);
}

.data-table {
  min-width: 0;
  overflow-x: auto;
}

.table-head,
.table-row {
  display: grid;
  min-width: 760px;
  border-bottom: 1px solid rgba(48, 64, 51, 0.74);
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) 165px 115px 165px;
  align-items: center;
}

.table-head {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: #0b100d;
  font-size: 0.68rem;
}

.table-row {
  width: 100%;
  min-height: 58px;
  padding: 7px 12px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  gap: 10px;
  text-align: left;
  text-decoration: none;
}

.table-row:hover,
.table-row.selected {
  color: var(--text);
  background: var(--raised);
}

.static-row:hover {
  background: transparent;
}

.table-row.selected {
  box-shadow: inset 3px 0 var(--green);
}

.table-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-row b,
.table-row small {
  display: block;
}

.table-row small {
  margin-top: 3px;
  color: var(--muted);
}

.buyer-table .table-head,
.buyer-table .table-row {
  min-width: 980px;
  grid-template-columns: minmax(190px, 1.3fr) 105px 110px 75px 85px 75px 170px;
}

.pager {
  display: flex;
  min-height: 52px;
  padding: 8px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.72rem;
}

.census-strip {
  margin-bottom: var(--gap);
}

.census-strip > p {
  display: flex;
  margin: 0;
  padding: 10px 14px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

.buyer-identity {
  display: grid;
  margin-bottom: var(--gap);
  padding: 18px;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 30px;
}

.buyer-identity h2 {
  margin: 0 0 7px;
  font-size: 1.2rem;
}

.buyer-identity dl {
  margin: 15px 0 0;
}

.buyer-identity dl div {
  display: flex;
  padding: 5px 0;
  color: var(--muted);
  gap: 10px;
}

.buyer-identity dd {
  margin: 0;
  color: var(--text);
}

.buyer-detail-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.78fr) minmax(0, 1.22fr);
  align-items: start;
  gap: var(--gap);
}

.metadata-form {
  display: grid;
  padding-bottom: 14px;
  gap: 13px;
}

.metadata-form > label,
.metadata-form > .select-field,
.metadata-form > .form-actions {
  margin-inline: 14px;
}

.char-count {
  color: var(--muted);
  text-align: right;
}

.form-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
}

.history-row {
  display: grid;
  min-height: 58px;
  padding: 8px 13px;
  border-bottom: 1px solid rgba(48, 64, 51, 0.7);
  color: var(--text);
  grid-template-columns: minmax(180px, 1fr) 110px 110px;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.history-row small {
  display: block;
  color: var(--muted);
}

.watch-controls {
  display: flex;
  min-height: 52px;
  margin-bottom: var(--gap);
  padding: 7px 12px;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.72rem;
}

.watch-add {
  margin-bottom: var(--gap);
  padding-bottom: 12px;
}

.watch-add form {
  display: grid;
  padding: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.search-results {
  margin: 0 12px;
  border: 1px solid var(--border);
}

.search-results article {
  display: grid;
  min-height: 58px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  grid-template-columns: minmax(140px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
}

.search-results small {
  display: block;
  color: var(--muted);
}

.watch-grid {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(320px, 42fr);
  align-items: start;
  gap: var(--gap);
}

.watch-row {
  display: grid;
  min-width: 0;
  padding: 13px;
  border-bottom: 1px solid rgba(48, 64, 51, 0.75);
  grid-template-columns: minmax(150px, 1fr) auto minmax(190px, 0.85fr);
  gap: 12px;
}

.watch-row p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.watch-row .seal-row {
  margin: 0;
}

.watch-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: end;
  gap: 7px;
}

.watch-actions a {
  display: inline-flex;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  align-items: center;
  text-decoration: none;
}

.register-end {
  padding: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.system-grid {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(340px, 42fr);
  gap: var(--gap);
}

.preference-panel {
  display: grid;
  padding-bottom: 14px;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.preference-panel > header,
.preference-panel > button {
  grid-column: 1 / -1;
}

.preference-panel > label,
.preference-panel > .select-field,
.preference-panel > button {
  margin-inline: 14px;
}

.origin-block {
  display: grid;
  margin: 14px;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.origin-block code {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  color: var(--cyan);
  background: #0b100d;
  overflow-wrap: anywhere;
  white-space: normal;
}

.session-actions {
  display: flex;
  padding: 0 14px 14px;
  gap: 8px;
}

.session-actions button {
  flex: 1;
}

.shortcuts,
.request-channel {
  min-height: 190px;
}

.shortcut-grid {
  display: grid;
  padding: 14px;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

kbd {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--raised);
  place-items: center;
}

.channel-state {
  display: flex;
  min-height: 42px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid currentColor;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  font-size: 0.78rem;
}

.channel-state.success {
  color: var(--green);
}

.channel-state button {
  min-height: 30px;
  padding-block: 4px;
}

.empty-state {
  display: grid;
  min-height: 180px;
  padding: 30px;
  color: var(--muted);
  place-content: center;
  text-align: center;
}

.empty-state h2,
.empty-state h3 {
  color: var(--text);
}

.mobile-only,
.mobile-scroll-cue,
.watch-tabs {
  display: none;
}

body[data-density="standard"] .table-row,
body[data-density="standard"] .queue-row .row-core,
body[data-density="standard"] .history-row {
  min-height: 68px;
}

html[data-contrast="high"] {
  --border: #526958;
  --muted: #9fac9b;
}

@keyframes route-reveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes inspector-in {
  from { opacity: 0; transform: translateX(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes cursor-step {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0.25; }
}

@keyframes scanline {
  from { transform: translateY(-24px); }
  to { transform: translateY(24px); }
}

@media (max-width: 1180px) {
  .workspace {
    padding: 18px;
  }

  .console-grid {
    grid-template-columns: 1fr 1fr;
  }

  .channels {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .registry-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .registry-filters label:first-child {
    grid-column: span 2;
  }

  .ledger-filters {
    grid-template-columns: minmax(190px, 1fr) repeat(3, minmax(145px, 0.5fr));
  }

  .ledger-filters > button {
    grid-column: 1 / -1;
  }

  .inbox-split,
  .ledger-split {
    grid-template-columns: minmax(0, 60fr) minmax(310px, 40fr);
  }

  .row-core {
    grid-template-columns: minmax(130px, 1fr) minmax(105px, 0.8fr) auto 45px;
  }

  .row-core > span:nth-child(3) {
    display: none;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar: 205px;
  }

  .metric-ledger.five {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric-ledger.five .metric:nth-child(3) {
    border-right: 0;
  }

  .metric-ledger.five .metric:nth-child(n + 4) {
    border-top: 1px solid var(--border);
  }

  .buyer-detail-grid,
  .system-grid {
    grid-template-columns: 1fr;
  }

  .buyer-identity {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --gap: 12px;
    font-size: 14px;
  }

  body::before {
    animation: none;
  }

  .sidebar {
    width: min(86vw, 320px);
    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 180ms ease, visibility 0s linear 180ms;
  }

  .sidebar.open {
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .menu-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    min-height: 100vh;
    border: 0;
    background: rgba(0, 0, 0, 0.68);
  }

  .main-column {
    margin-left: 0;
    padding-bottom: 0;
  }

  .mobile-head {
    position: sticky;
    z-index: 22;
    top: 0;
    display: flex;
    min-height: 50px;
    padding: 6px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(9, 12, 10, 0.98);
  }

  .mobile-head button {
    min-height: 44px;
  }

  button,
  .button-link,
  input,
  .select-trigger {
    min-height: 44px;
  }

  .custom-select.open::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background: rgba(0, 0, 0, 0.66);
    content: "";
    pointer-events: none;
  }

  .select-options {
    position: fixed;
    z-index: 91;
    top: auto;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 14px;
    max-height: min(420px, 62dvh);
    border-color: var(--green);
  }

  .route-bar {
    position: relative;
    top: auto;
    min-height: 62px;
    padding: 8px 16px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }

  .workspace {
    padding: 16px 16px 28px;
  }

  .command-line {
    display: none;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .page-meta {
    width: 100%;
    justify-content: space-between;
  }

  .metric-ledger.five,
  .metric-ledger.four {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-ledger.five .metric:nth-child(2n),
  .metric-ledger.four .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric-ledger.five .metric:nth-child(n + 3),
  .metric-ledger.four .metric:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .metric-ledger.five .metric:last-child {
    grid-column: 1 / -1;
  }

  .metric strong {
    font-size: clamp(1.45rem, 9vw, 2.2rem);
  }

  .console-grid,
  .workspace-split,
  .buyer-detail-grid,
  .system-grid,
  .buyer-identity {
    display: flex;
    flex-direction: column;
  }

  .distribution,
  .channels {
    min-height: 0;
  }

  .filter-console,
  .ledger-filters,
  .registry-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-console > label:first-child,
  .registry-filters label:first-child,
  .filter-console > button,
  .filter-console > details {
    grid-column: 1 / -1;
  }

  .date-fields {
    position: static;
    width: 100%;
    margin-top: 10px;
  }

  .batch-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .batch-bar strong {
    margin: 0;
  }

  .queue-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .row-core {
    min-height: 132px;
    padding: 11px;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
  }

  .row-core > span:nth-child(3) {
    display: block;
  }

  .row-core strong,
  .row-core > span:nth-child(3) {
    grid-column: 1 / -1;
  }

  .row-arrow {
    justify-self: end;
  }

  .inspector {
    position: fixed;
    z-index: 60;
    inset: 0;
    max-height: none;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto;
    background: var(--bg);
  }

  .inspector-empty {
    display: none;
  }

  .inspector:not(.open) {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .data-table {
    overflow: visible;
  }

  .table-head {
    display: none;
  }

  .jobs-table .table-row,
  .buyer-table .table-row {
    display: grid;
    min-width: 0;
    min-height: 150px;
    padding: 13px;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
  }

  .jobs-table .table-row > span:first-child,
  .jobs-table .table-row > span:nth-child(2),
  .buyer-table .table-row > span:first-child,
  .buyer-table .table-row > span:last-child {
    grid-column: 1 / -1;
  }

  .buyer-table .table-row {
    min-height: 190px;
    grid-template-columns: repeat(3, 1fr);
  }

  .buyer-table .seal {
    min-width: 0;
    width: 100%;
  }

  .pager {
    min-height: 64px;
    flex-wrap: wrap;
  }

  .pager span {
    width: 100%;
    order: -1;
    text-align: center;
  }

  .census-strip > p {
    align-items: flex-start;
    flex-direction: column;
  }

  .buyer-identity {
    gap: 12px;
  }

  .history-row {
    min-height: 92px;
    grid-template-columns: 1fr auto;
  }

  .history-row > span:last-child {
    grid-column: 1 / -1;
    color: var(--cyan);
  }

  .watch-grid {
    display: block;
  }

  .watch-tabs {
    display: grid;
    margin-bottom: 10px;
    grid-template-columns: 1fr 1fr;
  }

  .watch-tabs button.active {
    border-color: var(--green);
    color: var(--green);
    background: var(--raised);
  }

  .watch-grid.goodlist .watch-panel.blacklist,
  .watch-grid.blacklist .watch-panel.goodlist {
    display: none;
  }

  .watch-row {
    display: flex;
    flex-direction: column;
  }

  .watch-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .watch-actions > * {
    min-width: 0;
  }

  .watch-add form,
  .search-results article {
    grid-template-columns: 1fr;
  }

  .system-ledger {
    order: 0;
  }

  .system-grid .session-panel {
    order: 1;
  }

  .system-grid .preference-panel {
    order: 2;
  }

  .system-grid .shortcuts {
    order: 3;
  }

  .system-grid .request-channel {
    order: 4;
  }

  .mobile-scroll-cue {
    display: block;
    margin-top: 14px;
    padding: 10px;
    color: var(--muted);
    text-align: center;
    font-size: 0.72rem;
  }

  .gate {
    min-height: 100dvh;
    padding: 18px 16px 70px;
    align-items: start;
  }

  .gate-terminal {
    margin-top: max(10px, env(safe-area-inset-top));
  }

  .gate-body {
    padding: 24px 18px;
  }

  .diagnostics div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .gate-footer {
    position: fixed;
    right: 10px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 10px;
  }
}

@media (max-width: 480px) {
  .workspace {
    padding-inline: 14px;
  }

  .terminal-head span:first-child {
    max-width: 220px;
  }

  .manual-census,
  .preference-panel {
    grid-template-columns: 1fr;
  }

  .preference-panel > * {
    grid-column: 1 !important;
  }

  .shortcut-grid {
    grid-template-columns: 1fr;
  }

  .session-actions,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .watch-actions {
    grid-template-columns: 1fr;
  }

  .channel {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .channel strong {
    max-width: 100%;
    text-align: left;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .workspace {
    padding-inline: 12px;
  }

  .mobile-head strong {
    font-size: 0.76rem;
  }

  .filter-console,
  .ledger-filters,
  .registry-filters,
  .date-fields {
    grid-template-columns: 1fr;
  }

  .filter-console > *,
  .registry-filters > * {
    grid-column: 1 !important;
  }

  .metric-ledger.five,
  .metric-ledger.four {
    grid-template-columns: 1fr 1fr;
  }

  .session-actions {
    flex-direction: column;
  }

  .page-meta {
    align-items: stretch;
    flex-direction: column;
  }
}

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

html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
