:root {
  color-scheme: light;
  --paper: #f3f0e9;
  --paper-deep: #e9e4da;
  --surface: #fbfaf7;
  --surface-strong: #ffffff;
  --ink: #202724;
  --ink-soft: #59615d;
  --ink-faint: #89908c;
  --line: #dcd8cf;
  --line-dark: #c9c4b9;
  --charcoal: #2c3531;
  --moss: #647b63;
  --moss-pale: #e2e9df;
  --amber: #d9913b;
  --amber-pale: #f7e8d2;
  --clay: #bd6752;
  --clay-pale: #f2dfda;
  --blue: #527a91;
  --blue-pale: #dce8ed;
  --sky: #6f95a2;
  --teal: #3f8b82;
  --violet: #756b89;
  --rose: #a86673;
  --shadow-sm: 0 1px 2px rgb(29 35 32 / 6%);
  --shadow-md: 0 18px 55px rgb(29 35 32 / 13%);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-width: 222px;
  --focus: 0 0 0 3px rgb(82 122 145 / 24%);
  font-family: "Avenir Next", Avenir, "Segoe UI", Inter, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 4%, rgb(217 145 59 / 8%), transparent 25rem),
    var(--paper);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 28px 18px 20px;
  color: #f8f7f2;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 3%), transparent 28%),
    var(--charcoal);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: var(--charcoal);
  background: #f0b467;
}

.brand-mark svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
  stroke: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: .01em;
}

.brand small {
  margin-top: 1px;
  color: #aeb7b2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}

.nav-list {
  display: grid;
  gap: 7px;
  margin-top: 56px;
}

.nav-item,
.quiet-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  cursor: pointer;
}

.nav-item {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: #b9c1bd;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  background: transparent;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgb(255 255 255 / 6%);
}

.nav-item.is-active {
  color: var(--charcoal);
  background: #f6f2e9;
  box-shadow: 0 8px 22px rgb(0 0 0 / 12%);
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

.sidebar-foot {
  display: grid;
  gap: 14px;
  margin-top: auto;
  padding: 16px 9px 0;
  border-top: 1px solid rgb(255 255 255 / 9%);
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #aeb7b2;
  font-size: 11px;
  font-weight: 600;
}

.sync-state span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d4a65f;
  box-shadow: 0 0 0 3px rgb(212 166 95 / 15%);
}

.sync-state.is-saved .sync-dot {
  background: #8fb68e;
  box-shadow: 0 0 0 3px rgb(143 182 142 / 15%);
}

.sync-state.is-error .sync-dot {
  background: #e47c68;
  box-shadow: 0 0 0 3px rgb(228 124 104 / 15%);
}

.quiet-button {
  padding: 0;
  color: #aeb7b2;
  font-size: 12px;
  font-weight: 650;
  background: transparent;
}

.quiet-button:hover {
  color: #fff;
}

.quiet-button svg {
  width: 16px;
  height: 16px;
}

.main-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 2vw, 34px);
  border-bottom: 1px solid rgb(201 196 185 / 65%);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 1.8vw, 28px);
  font-weight: 650;
  letter-spacing: -.035em;
}

h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.025em;
}

h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-find {
  position: relative;
  z-index: 80;
  width: min(380px, 34vw);
  margin-left: auto;
}

.quick-find .search-control {
  width: 100%;
}

.quick-find-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(470px, calc(100vw - 36px));
  max-height: min(520px, calc(100vh - 120px));
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line-dark);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: 0 20px 48px rgb(31 38 34 / 24%);
}

.quick-find-result {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.quick-find-result:hover,
.quick-find-result.is-active {
  background: var(--paper-deep);
}

.quick-find-kind {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--charcoal);
  font-size: 10px;
  font-weight: 850;
}

.quick-find-kind.kind-port { background: var(--blue); }
.quick-find-kind.kind-patch { background: var(--amber); }

.quick-find-copy {
  min-width: 0;
}

.quick-find-copy strong,
.quick-find-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-find-copy strong {
  font-size: 13px;
}

.quick-find-copy small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
}

.quick-find-signal {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.quick-find-empty {
  margin: 0;
  padding: 18px 14px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.primary-button,
.secondary-button,
.icon-button,
.segmented button,
.chip-button {
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .01em;
}

.primary-button {
  color: #fff;
  background: var(--charcoal);
  box-shadow: 0 6px 16px rgb(44 53 49 / 16%);
}

.primary-button:hover {
  background: #1f2723;
}

.primary-button svg {
  width: 16px;
  height: 16px;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--surface);
}

.secondary-button:hover {
  border-color: var(--line-dark);
  color: var(--ink);
  background: var(--surface-strong);
}

.search-control {
  display: flex;
  width: min(260px, 28vw);
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 52%);
}

.search-control[hidden] {
  display: none;
}

.search-control:focus-within {
  border-color: #92a9b3;
  box-shadow: var(--focus);
}

.search-control svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--ink-faint);
}

.search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
}

.search-control input::placeholder {
  color: var(--ink-faint);
}

.view {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 38px clamp(24px, 4vw, 64px) 72px;
}

.loading-state,
.empty-state {
  display: grid;
  min-height: 54vh;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--ink-faint);
  font-size: 13px;
}

.loading-mark {
  width: 34px;
  height: 34px;
  border: 2px solid var(--line);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.view-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.view-intro-copy {
  max-width: 590px;
}

.view-intro h2 {
  margin-bottom: 8px;
  font-size: clamp(22px, 2.2vw, 30px);
}

.view-intro p,
.section-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgb(255 255 255 / 45%);
  font-size: 11px;
  font-weight: 650;
}

.summary-chip strong {
  color: var(--ink);
  font-size: 12px;
}

.section-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(251 250 247 / 82%);
  box-shadow: var(--shadow-sm);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.section-head > div:first-child {
  min-width: 0;
}

.section-head h3 {
  margin-bottom: 3px;
}

.section-head p {
  font-size: 11px;
}

.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
}

.segmented button {
  min-height: 31px;
  padding: 0 11px;
  border-radius: 8px;
  color: var(--ink-faint);
  background: transparent;
  font-size: 10px;
  font-weight: 750;
}

.segmented button.is-active {
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 1px 4px rgb(30 37 33 / 10%);
}

.patch-card {
  overflow: hidden;
}

.patch-scroll {
  overflow-x: auto;
  padding: 34px 24px 26px;
  scrollbar-color: var(--line-dark) transparent;
  scrollbar-width: thin;
}

.patch-panel {
  position: relative;
  display: grid;
  min-width: 1100px;
  grid-template-columns: repeat(var(--patch-positions, 24), minmax(38px, 1fr));
  gap: 3px;
  padding: 20px 12px 16px;
  border: 1px solid #161b19;
  border-radius: 13px;
  color: #f7f4ed;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 6%), transparent 22%),
    #303734;
  box-shadow: 0 16px 34px rgb(35 42 38 / 16%);
}

.patch-panel::before,
.patch-panel::after {
  position: absolute;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 99px;
  background: rgb(255 255 255 / 9%);
  content: "";
}

.patch-panel::before { left: 5px; }
.patch-panel::after { right: 5px; }

.patch-point {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-rows: 38px 25px 14px 25px 38px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease;
}

.patch-point:hover {
  background: rgb(255 255 255 / 7%);
}

.patch-point:hover .jack {
  border-color: #f5bd71;
}

.port-label {
  display: grid;
  width: 100%;
  align-self: stretch;
  place-items: end center;
  overflow: hidden;
  color: #d9ddda;
  font-size: 8px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.port-label.bottom {
  place-items: start center;
}

.port-label strong,
.port-label small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.port-label small {
  margin-top: 2px;
  color: #89928e;
  font-size: 7px;
  font-weight: 600;
}

.port-label.bottom small {
  order: -1;
  margin: 0 0 2px;
}

.jack {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid #7b837f;
  border-radius: 50%;
  background: #171c1a;
  box-shadow: inset 0 0 0 3px #272e2b;
  transition: border-color 140ms ease, transform 140ms ease;
}

.jack::after {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #070908;
  content: "";
}

.patch-point.is-connected .jack.top {
  border-color: #d59c55;
}

.patch-point.is-connected .jack.bottom {
  border-color: #7898a5;
}

.patch-number {
  color: #7f8884;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 7px;
  font-weight: 700;
}

.normalled-line {
  position: absolute;
  top: 83px;
  width: 1px;
  height: 13px;
  background: #9b8e73;
  opacity: .7;
}

.patch-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px 18px;
  color: var(--ink-faint);
  font-size: 10px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.legend-dot.input { background: var(--blue); }
.legend-dot.empty { border: 1px solid var(--line-dark); background: transparent; }

.gear-strip {
  margin-top: 28px;
}

.gear-strip-head,
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.gear-strip-head p,
.library-head p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
}

.connected-gear {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 10px;
}

.gear-pill {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(255 255 255 / 42%);
}

.device-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper-deep);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .04em;
}

.device-avatar[data-accent="amber"] { background: #f0dfc4; }
.device-avatar[data-accent="clay"] { background: #ecd6d0; }
.device-avatar[data-accent="moss"] { background: #dbe4d7; }
.device-avatar[data-accent="blue"],
.device-avatar[data-accent="sky"] { background: #d8e5e9; }
.device-avatar[data-accent="violet"] { background: #e1dce8; }
.device-avatar[data-accent="rose"] { background: #ead9dd; }

.gear-pill strong,
.gear-pill small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gear-pill strong {
  font-size: 11px;
}

.gear-pill small {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 9px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-faint);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: var(--paper-deep);
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.route-side-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

.channel-card {
  position: sticky;
  top: 24px;
  overflow: hidden;
}

.channel-list {
  display: grid;
  padding: 8px 18px 14px;
}

.channel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.channel-row:last-child {
  border-bottom: 0;
}

.channel-row strong,
.channel-row small {
  display: block;
}

.channel-row strong {
  font-size: 11px;
}

.channel-row small {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 8px;
  line-height: 1.4;
}

.channel-number {
  display: grid;
  min-width: 34px;
  height: 30px;
  place-items: center;
  padding: 0 7px;
  border-radius: 9px;
  color: #466b7d;
  background: var(--blue-pale);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 800;
}

.hardware-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 42%);
}

.stat-card strong,
.stat-card small {
  display: block;
}

.stat-card strong {
  margin-bottom: 3px;
  font-size: 21px;
  letter-spacing: -.035em;
}

.stat-card small {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.hardware-groups {
  display: grid;
  gap: 34px;
}

.hardware-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.hardware-card {
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-align: left;
  background: rgb(251 250 247 / 85%);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.hardware-card:hover {
  border-color: var(--line-dark);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgb(35 42 38 / 9%);
}

.hardware-face {
  position: relative;
  height: 76px;
  overflow: hidden;
  padding: 14px;
  color: #f7f4ed;
  background: var(--charcoal);
}

.hardware-face[data-accent="amber"] { background: #7a603f; }
.hardware-face[data-accent="clay"] { background: #755047; }
.hardware-face[data-accent="moss"] { background: #4f6150; }
.hardware-face[data-accent="blue"] { background: #466372; }
.hardware-face[data-accent="sky"] { background: #4d6972; }
.hardware-face[data-accent="violet"] { background: #585064; }
.hardware-face[data-accent="rose"] { background: #6f4d55; }

.hardware-face::after {
  position: absolute;
  inset: auto -10% -60% 35%;
  height: 120px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 50%;
  content: "";
}

.face-brand {
  position: relative;
  z-index: 1;
  color: rgb(255 255 255 / 55%);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.face-controls {
  position: absolute;
  right: 14px;
  bottom: 13px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
}

.face-controls i {
  display: block;
  width: 7px;
  height: 7px;
  border: 1px solid rgb(255 255 255 / 50%);
  border-radius: 50%;
}

.face-controls i:last-child {
  width: 26px;
  height: 3px;
  border: 0;
  border-radius: 2px;
  background: rgb(255 255 255 / 32%);
}

.hardware-copy {
  padding: 16px;
}

.hardware-copy h3 {
  margin-bottom: 3px;
}

.hardware-make {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.hardware-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}

.meta-tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-size: 8px;
  font-weight: 700;
}

.dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: 20px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.dialog::backdrop {
  background: rgb(30 36 33 / 48%);
  backdrop-filter: blur(3px);
}

.dialog form {
  display: flex;
  max-height: inherit;
  flex-direction: column;
}

.dialog-head,
.dialog-foot {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
}

.dialog-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-size: 20px;
}

.dialog-body {
  display: grid;
  gap: 17px;
  padding: 22px;
  overflow-y: auto;
}

.dialog-foot {
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.dialog-spacer {
  flex: 1;
}

.danger-link {
  padding: 8px 0;
  border: 0;
  color: #a84d42;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.is-wide {
  grid-column: 1 / -1;
}

.field label,
.field > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: var(--surface-strong);
  font-size: 12px;
}

.field input,
.field select {
  height: 42px;
  padding: 0 12px;
}

.field textarea {
  min-height: 84px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #92a9b3;
  box-shadow: var(--focus);
}

.field-note {
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.45;
}

.derived-field-value {
  display: flex;
  min-height: 42px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 15px;
  border-radius: 11px;
  color: #fff;
  background: var(--charcoal);
  box-shadow: var(--shadow-md);
  font-size: 11px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: #873f37;
}

noscript {
  position: fixed;
  inset: 20px;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 30px;
  border-radius: 16px;
  background: var(--surface);
}

@media (max-width: 1050px) {
  :root { --sidebar-width: 82px; }

  .sidebar {
    align-items: center;
    padding-inline: 12px;
  }

  .brand {
    padding: 0;
  }

  .brand > span:last-child,
  .nav-item span,
  .sidebar-foot {
    display: none;
  }

  .nav-list {
    width: 100%;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .route-side-grid {
    grid-template-columns: 1fr;
  }

  .channel-card {
    position: static;
  }
}

@media (max-width: 760px) {
  :root { --sidebar-width: 0px; }

  body {
    padding-bottom: 72px;
  }

  .sidebar {
    inset: auto 10px 10px;
    width: auto;
    height: 58px;
    padding: 6px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 17px;
    box-shadow: 0 14px 35px rgb(22 27 24 / 24%);
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  .nav-list {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    margin: 0;
  }

  .nav-item {
    display: grid;
    min-height: 44px;
    place-items: center;
    align-content: center;
    gap: 2px;
    border-radius: 12px;
  }

  .nav-item span {
    display: block;
    font-size: 8px;
  }

  .nav-item svg {
    width: 17px;
    height: 17px;
  }

  .main-shell {
    margin-left: 0;
  }

  .topbar {
    flex-wrap: wrap;
    min-height: 88px;
    padding: 18px 18px 14px;
  }

  .eyebrow {
    font-size: 8px;
  }

  h1 {
    font-size: 23px;
  }

  .topbar-actions {
    margin-left: auto;
    gap: 6px;
  }

  .quick-find {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .primary-button,
  .secondary-button {
    min-height: 38px;
    padding-inline: 12px;
  }

  .topbar .primary-button span {
    display: none;
  }

  .search-control {
    width: 100%;
    height: 38px;
  }

  .quick-find-results {
    right: auto;
    left: 0;
    width: 100%;
  }

  .view {
    padding: 26px 16px 50px;
  }

  .view-intro {
    display: grid;
    gap: 16px;
    margin-bottom: 22px;
  }

  .view-intro h2 {
    font-size: 23px;
  }

  .section-head {
    align-items: flex-start;
    padding: 18px;
  }

  .section-head .segmented {
    max-width: 48%;
    overflow-x: auto;
  }

  .patch-scroll {
    padding-inline: 14px;
  }

  .patch-foot {
    align-items: flex-start;
    flex-direction: column;
    padding-inline: 18px;
  }

  .hardware-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-card {
    padding: 13px;
  }

  .stat-card strong {
    font-size: 18px;
  }

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

  .field.is-wide {
    grid-column: auto;
  }

  .dialog-head,
  .dialog-body,
  .dialog-foot {
    padding: 17px;
  }
}

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