:root {
  color-scheme: light;
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-soft: #eef3f3;
  --surface-strong: #e4ebed;
  --ink: #172125;
  --ink-soft: #38464b;
  --muted: #66757a;
  --line: #d8e0e2;
  --line-strong: #bbc8cb;
  --primary: #006b5f;
  --primary-hover: #00574e;
  --primary-soft: #d9eeea;
  --blue: #2d6384;
  --blue-soft: #dfedf5;
  --amber: #9a5b00;
  --amber-soft: #fff0d1;
  --danger: #b3261e;
  --danger-hover: #8f1d18;
  --danger-soft: #fde2df;
  --success: #177245;
  --success-soft: #dcefe4;
  --sidebar: #202b2e;
  --sidebar-muted: #aebbbd;
  --shadow: 0 1px 2px rgba(20, 34, 38, 0.08), 0 8px 24px rgba(20, 34, 38, 0.05);
  --radius: 6px;
  --sidebar-width: 272px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

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

a {
  color: var(--primary);
  text-decoration: none;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  color: #ffffff;
  background: var(--primary);
  border-radius: 4px;
  transform: translateY(-160%);
  transition: transform 120ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.auth-body {
  overflow-x: hidden;
  background: var(--surface);
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(380px, 46%) minmax(420px, 54%);
}

.auth-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  background: #e7eeee;
  border-right: 1px solid var(--line);
}

.cloud-mark-large {
  position: absolute;
  top: 9%;
  left: 10%;
  width: 82px;
  height: 82px;
  color: #6e8d91;
  opacity: 0.34;
}

.cloud-mark-large svg {
  width: 58px;
  height: 58px;
}

.storage-scene {
  width: min(72%, 520px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid #c9d5d7;
  border-radius: 8px;
  box-shadow: 0 22px 50px rgba(35, 60, 64, 0.14);
  transform: translateY(-2%);
}

.storage-scene-head {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 16px;
  background: #f7f9f9;
  border-bottom: 1px solid var(--line);
}

.storage-scene-dot {
  width: 8px;
  height: 8px;
  background: #aab9bb;
  border-radius: 50%;
}

.storage-scene-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 12% 9%;
}

.storage-folder {
  display: grid;
  min-width: 0;
  aspect-ratio: 1 / 0.9;
  place-items: center;
  color: var(--primary);
  background: #edf5f3;
  border: 1px solid #d4e5e2;
  border-radius: 6px;
}

.storage-folder:nth-child(2) {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #cfdee7;
}

.storage-folder:nth-child(3) {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ebdab6;
}

.storage-folder svg {
  width: 34px;
  height: 34px;
}

.storage-folder span {
  width: 48%;
  height: 5px;
  background: currentColor;
  border-radius: 4px;
  opacity: 0.26;
}

.storage-meter {
  grid-column: 1 / -1;
  height: 7px;
  margin-top: 4%;
  overflow: hidden;
  background: #e4eaeb;
  border-radius: 5px;
}

.storage-meter span {
  display: block;
  width: 62%;
  height: 100%;
  background: var(--primary);
}

.auth-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 48px 32px;
  background: var(--surface);
}

.auth-box {
  width: min(100%, 390px);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 52px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.cloud-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  border-radius: 6px;
}

.auth-heading {
  margin-bottom: 26px;
}

.auth-heading h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 680;
  line-height: 1.2;
}

.auth-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 32px;
  color: var(--muted);
  font-size: 12px;
}

.auth-footer svg {
  width: 14px;
  height: 14px;
}

.enroll-layout {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.qr-wrap {
  display: grid;
  width: 210px;
  height: 210px;
  place-items: center;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.qr-wrap img {
  display: block;
}

.manual-key {
  display: grid;
  gap: 5px;
  text-align: center;
}

.manual-key span {
  color: var(--muted);
  font-size: 12px;
}

.manual-key code {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.recovery-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}

.recovery-list code {
  padding: 10px;
  text-align: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.app-body {
  background: var(--bg);
}

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

.sidebar {
  position: fixed;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 20px 14px 16px;
  color: #ffffff;
  background: var(--sidebar);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  padding: 0 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-symbol {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  color: #ffffff;
  background: var(--primary);
  border-radius: 5px;
}

.sidebar-brand > span:last-child {
  display: grid;
  min-width: 0;
}

.sidebar-brand strong {
  font-size: 15px;
}

.sidebar-brand small {
  overflow: hidden;
  color: var(--sidebar-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav {
  display: block;
  margin-top: 18px;
  overflow-y: auto;
}

.nav-group {
  display: grid;
  gap: 3px;
  margin-bottom: 15px;
}

.nav-group-label {
  padding: 0 12px 5px;
  color: #809093;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  color: var(--sidebar-muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: color 120ms ease, background 120ms ease;
}

.nav-link svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.nav-link.active {
  color: #ffffff;
  background: #334246;
  box-shadow: inset 3px 0 0 #50b8a8;
}

.nav-button {
  font: inherit;
}

.sidebar-footer {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-footer form {
  margin: 0;
}

.sidebar-scrim {
  display: none;
}

.app-column {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  padding: 0 30px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.icon-button.mobile-menu {
  display: none;
  margin-right: auto;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.state-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--success-soft);
}

.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-weight: 700;
}

.user-name {
  color: var(--ink);
  font-weight: 600;
}

.content {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 28px 30px 54px;
}

.page-heading {
  display: flex;
  min-height: 50px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 680;
  line-height: 1.3;
}

.page-actions {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
}

.page-actions:empty {
  display: none;
}

.last-refresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.last-refresh svg {
  width: 15px;
  height: 15px;
}

.last-refresh.is-stale {
  color: var(--amber);
}

.async-status {
  position: fixed;
  z-index: 80;
  top: 76px;
  right: 24px;
  display: flex;
  max-width: min(380px, calc(100vw - 48px));
  min-height: 42px;
  align-items: center;
  padding: 10px 14px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 650;
}

.app-body.has-async-status .content {
  padding-top: 84px;
}

.async-status.is-pending {
  color: var(--blue);
  border-color: #c9dee9;
}

.async-status.is-success {
  color: var(--success);
  border-color: #c1dfcc;
}

.async-status.is-error {
  color: var(--danger);
  border-color: #efc6c2;
}

form[aria-busy="true"] button[type="submit"] {
  cursor: wait;
}

form[aria-busy="true"] button[type="submit"] svg {
  animation: async-spin 900ms linear infinite;
}

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

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-tile {
  display: grid;
  min-height: 82px;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 1px rgba(20, 34, 38, 0.03);
}

.status-tile-icon,
.health-icon,
.check-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 5px;
}

.status-tile > div:nth-child(2) {
  display: grid;
  min-width: 0;
}

.status-tile-empty {
  grid-template-columns: 1fr;
}

.status-tile-empty > div {
  display: grid;
  min-width: 0;
}

.status-tile-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tile strong {
  margin-top: 2px;
  font-size: 15px;
}

.state-inactive,
.state-down,
.state-failed,
.state-denied,
.state-blocked {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.state-degraded {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.state-unknown {
  background: #899699;
  box-shadow: 0 0 0 3px #e6ebec;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 1px rgba(20, 34, 38, 0.025);
}

.panel-heading {
  display: flex;
  min-height: 42px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.panel-heading > div:first-child {
  min-width: 0;
}

.panel-heading h2 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 680;
  line-height: 1.35;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-heading > svg {
  color: var(--muted);
}

.panel-span-2 {
  grid-column: auto;
}

.text-action {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
}

.text-action svg {
  width: 15px;
  height: 15px;
}

.panel-heading-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.presence-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.presence-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.presence-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #899699;
}

.presence-online {
  color: var(--success);
  background: var(--success-soft);
  border-color: #c1dfcc;
}

.presence-online .presence-dot,
.presence-dot.presence-online {
  background: var(--success);
}

.presence-offline {
  color: var(--muted);
  background: var(--surface-soft);
}

.presence-dot.presence-offline {
  background: #899699;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f8fafa;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fafcfc;
}

td strong {
  font-weight: 650;
}

.cell-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.warning-text {
  color: var(--warning, #8a4f00);
}

.usage-cell {
  min-width: 150px;
}

.usage-cell > strong,
.usage-cell > small {
  display: block;
}

.usage-cell > small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.usage-track {
  display: block;
  width: 116px;
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  background: var(--line);
  border-radius: 2px;
  border: 0;
  accent-color: var(--primary);
}

.usage-track::-webkit-progress-bar {
  background: var(--line);
  border-radius: 2px;
}

.usage-track::-webkit-progress-value {
  background: var(--primary);
  border-radius: 2px;
}

.usage-track::-moz-progress-bar {
  background: var(--primary);
  border-radius: 2px;
}

.users-table .row-actions {
  min-width: 264px;
}

.empty-cell {
  height: 84px;
  color: var(--muted);
  text-align: center;
}

.routing-error {
  align-items: center;
  flex-wrap: wrap;
}

.routing-error > span {
  flex: 1 1 260px;
}

.routing-unavailable-panel .empty-state,
.unavailable-panel .empty-state {
  min-height: 170px;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

.routing-unavailable-panel .empty-state > span,
.unavailable-panel .empty-state > span {
  max-width: 420px;
  color: var(--muted);
  white-space: normal;
}

.table-empty-state {
  min-height: 142px;
  gap: 9px;
  padding: 20px 16px;
  text-align: center;
}

.table-empty-state strong {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.actions-column {
  position: relative;
  width: 1%;
  overflow: hidden;
  text-align: right;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 3px;
}

.table-actions form {
  display: inline-flex;
  margin: 0;
}

.stack-list {
  display: grid;
  gap: 0;
}

.compact-inline {
  min-height: 52px;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.compact-inline:last-child {
  border-bottom: 0;
}

.compact-inline strong {
  min-width: 150px;
}

.compact-inline select {
  min-width: 180px;
  min-height: 36px;
  padding: 6px 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.protocol-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
}

.health-list {
  display: grid;
  gap: 2px;
}

.health-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

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

.health-row > div {
  display: grid;
  min-width: 0;
}

.health-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-row span:not(.health-icon, .state-dot) {
  color: var(--muted);
  font-size: 11px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.quick-action {
  display: grid;
  min-height: 76px;
  grid-template-columns: 36px 1fr 18px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.quick-action:hover,
.quick-action:focus-visible {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  outline: none;
}

.quick-action > svg:first-child {
  color: var(--primary);
}

.quick-action > svg:last-child {
  width: 17px;
  color: var(--muted);
}

.quick-action > span {
  display: grid;
  min-width: 0;
}

.quick-action strong,
.quick-action small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action small {
  color: var(--muted);
}

.button,
.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 650;
  line-height: 1;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(0, 107, 95, 0.22);
  outline-offset: 2px;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.button-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

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

.button-secondary:hover,
.button-quiet:hover {
  background: var(--surface-soft);
}

.button-danger {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.button-danger:hover {
  background: var(--danger-hover);
}

.button-quiet {
  color: var(--ink-soft);
  background: transparent;
}

.button-full {
  width: 100%;
}

.button-small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border-color: transparent;
}

.icon-button:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.icon-button-danger {
  color: var(--danger);
}

.message-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.message {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #c9dee9;
  border-radius: 5px;
}

.message svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.message-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #c1dfcc;
}

.message-warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ebd6ac;
}

.message-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc6c2;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.field label,
.route-editor > label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.field input:not([type="checkbox"], [type="file"], [type="radio"]),
.field select,
.field textarea,
.route-editor textarea,
.compact-field input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field textarea,
.route-editor textarea {
  min-height: 190px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.route-editor textarea:focus,
.compact-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 107, 95, 0.12);
}

.field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.field input[type="file"] {
  width: 100%;
  padding: 8px;
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
}

.field-help,
.field-errors {
  color: var(--muted);
  font-size: 11px;
}

.field-errors,
.field-error label,
.errorlist {
  color: var(--danger);
}

.errorlist {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
}

.form-errors {
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 5px;
}

.form-panel {
  display: grid;
  gap: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.validation-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.validation-note svg {
  width: 17px;
  color: var(--success);
}

.compact-field {
  width: 220px;
}

.dialog {
  width: min(92vw, 520px);
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: 0 24px 80px rgba(14, 27, 31, 0.28);
}

.dialog::backdrop {
  background: rgba(14, 25, 29, 0.56);
}

.dialog-form {
  display: grid;
  gap: 17px;
  padding: 22px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading h2 {
  margin: 0 0 3px;
  font-size: 18px;
}

.dialog-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 4px;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.status-badge > span {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.status-inactive,
.status-down,
.status-failed,
.status-denied,
.status-blocked {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-degraded {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-info {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-unknown {
  color: var(--muted);
  background: var(--surface-strong);
}

.status-success,
.status-active,
.status-healthy {
  color: var(--success);
  background: var(--success-soft);
}

.segmented {
  display: inline-flex;
  height: 36px;
  padding: 3px;
  background: var(--surface-strong);
  border-radius: 5px;
}

.segmented button {
  min-width: 54px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.segmented button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(25, 42, 46, 0.12);
}

.chart-panel {
  margin-bottom: 18px;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 310px;
}

.route-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.route-tabs button {
  display: grid;
  min-height: 58px;
  grid-template-columns: 20px auto 24px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  font-weight: 650;
}

.route-tabs button.active {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #a9d1ca;
}

.route-tabs small {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border-radius: 50%;
  font-size: 10px;
}

.route-editor {
  display: none;
  gap: 8px;
}

.route-editor.active {
  display: grid;
}

.relay-overview,
.tunnel-flow {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.7fr) minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.relay-node,
.flow-node {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.relay-node-icon,
.flow-node > svg {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 5px;
}

.relay-node-icon.accent {
  color: var(--primary);
  background: var(--primary-soft);
}

.relay-node > div,
.flow-node > div {
  display: grid;
  min-width: 0;
}

.relay-node small,
.flow-node small {
  color: var(--muted);
}

.relay-node strong,
.flow-node strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relay-link,
.flow-connection {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
}

.relay-link span,
.flow-connection > span {
  height: 1px;
  flex: 1;
  background: var(--line-strong);
}

.flow-connection > div {
  display: grid;
  place-items: center;
  gap: 3px;
}

.flow-connection small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.check-item {
  display: grid;
  min-width: 0;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface-soft);
  border-radius: 5px;
}

.check-item > div {
  display: grid;
  min-width: 0;
}

.check-item strong,
.check-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-item span {
  color: var(--muted);
  font-size: 11px;
}

.detail-list,
.credential-fields {
  display: grid;
  margin: 0 0 18px;
}

.detail-list > div,
.credential-fields > div {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt,
.credential-fields dt {
  min-width: 0;
  color: var(--muted);
}

.detail-list dd,
.credential-fields dd {
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  font-weight: 650;
  text-align: right;
}

.hash-code {
  color: var(--muted);
  font-size: 11px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.pagination a {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: var(--surface-soft);
  border-radius: 5px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
}

.masking-workspace,
.masking-preview-panel,
.masking-reality-row {
  width: 100%;
  max-width: 980px;
}

.camouflage-panel,
.camouflage-result {
  max-width: 760px;
}

.camouflage-panel + .camouflage-result {
  margin-top: 16px;
}

.camouflage-heading {
  align-items: start;
}

.camouflage-heading h2 {
  overflow-wrap: anywhere;
}

.camouflage-services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  margin: 4px 0 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.camouflage-service {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 11px 13px;
  appearance: none;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.camouflage-service:last-child {
  border-right: 0;
}

.camouflage-service strong {
  font-size: 12px;
}

.camouflage-service span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camouflage-service:hover {
  background: var(--surface);
}

.camouflage-service:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.camouflage-service.is-selected {
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.camouflage-guidance,
.camouflage-selection-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.camouflage-guidance {
  margin: -8px 0 18px;
}

.camouflage-selection-hint {
  margin-top: 6px;
}

.camouflage-form,
.camouflage-apply {
  display: flex;
  align-items: end;
  gap: 10px;
}

.camouflage-form .field {
  flex: 1 1 300px;
  margin: 0;
}

.camouflage-progress {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.camouflage-progress[hidden] {
  display: none;
}

.camouflage-progress span {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: camouflage-spin 700ms linear infinite;
}

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

.camouflage-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 2px 0 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.camouflage-facts > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 11px 13px;
  border-right: 1px solid var(--line);
}

.camouflage-facts > div:last-child {
  border-right: 0;
}

.camouflage-facts dt,
.camouflage-plan span {
  color: var(--muted);
  font-size: 11px;
}

.camouflage-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.camouflage-findings {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.camouflage-findings .message {
  margin: 0;
}

.camouflage-plan {
  display: grid;
  gap: 2px;
  margin-bottom: 14px;
}

.camouflage-plan strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

@media (max-width: 640px) {
  .camouflage-services,
  .camouflage-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .camouflage-service:nth-child(2n),
  .camouflage-facts > div:nth-child(2n) {
    border-right: 0;
  }

  .camouflage-service:nth-child(n + 3),
  .camouflage-facts > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .camouflage-form,
  .camouflage-apply {
    align-items: stretch;
    flex-direction: column;
  }

  .camouflage-form .field {
    flex: 0 0 auto;
    width: 100%;
  }

  .camouflage-form .button,
  .camouflage-apply .button {
    width: 100%;
  }
}

.masking-workspace {
  margin-bottom: 14px;
}

.masking-current {
  display: grid;
  min-height: 66px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px 0 15px;
  border-bottom: 1px solid var(--line);
}

.masking-current-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 5px;
}

.masking-current-icon.reality-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.masking-current > div {
  display: grid;
  min-width: 0;
}

.masking-current small {
  color: var(--muted);
  font-size: 11px;
}

.masking-current strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.masking-site-form {
  display: grid;
  gap: 17px;
  padding-top: 16px;
}

.masking-site-form > .field,
.masking-domain-options,
.masking-domain-rules,
.masking-content-fieldset,
.masking-upload {
  width: 100%;
  max-width: 640px;
}

.masking-domain-options {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.masking-domain-options-heading {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 12px;
}

.masking-domain-options-heading small {
  color: var(--muted);
  text-align: right;
}

.masking-domain-list {
  display: grid;
}

.masking-domain-option {
  display: grid;
  width: 100%;
  min-height: 52px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  text-align: left;
}

.masking-domain-option > span:first-child {
  display: grid;
  min-width: 0;
}

.masking-domain-option strong,
.masking-domain-option small {
  overflow-wrap: anywhere;
}

.masking-domain-option small {
  color: var(--muted);
  font-size: 11px;
}

.masking-domain-option:hover:not(:disabled),
.masking-domain-option[aria-pressed="true"] {
  color: var(--primary);
  background: var(--primary-soft);
}

.masking-domain-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.masking-domain-option:disabled {
  cursor: not-allowed;
  opacity: 0.66;
}

.masking-domain-state {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.masking-domain-option-current .masking-domain-state,
.masking-domain-option-available .masking-domain-state {
  color: var(--success);
}

.masking-domain-rules {
  color: var(--ink-soft);
  font-size: 12px;
}

.masking-domain-rules summary {
  min-height: 32px;
  cursor: pointer;
  font-weight: 650;
}

.masking-domain-rules ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
  padding: 0 0 0 18px;
  margin: 4px 0 0;
  color: var(--muted);
}

.masking-content-fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.masking-content-fieldset legend {
  padding: 0;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.masking-content-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  background: var(--surface-strong);
  border-radius: 5px;
}

.masking-content-switch label {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.masking-content-switch label:has(input:checked) {
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 34, 38, 0.12);
}

.masking-content-switch label:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.masking-content-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.masking-content-switch svg {
  width: 17px;
  height: 17px;
}

.masking-upload-target {
  position: relative;
  display: grid;
  min-height: 72px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  cursor: pointer;
}

.masking-upload-target:hover,
.masking-upload-target:has(input:focus-visible),
.masking-upload-target.is-dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.masking-upload-target:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(0, 107, 95, 0.12);
}

.masking-upload-target input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.masking-upload-target > svg {
  color: var(--primary);
}

.masking-upload-target > span {
  display: grid;
  min-width: 0;
}

.masking-upload-target strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.masking-upload-target small {
  color: var(--muted);
  font-size: 11px;
}

.masking-upload > .field-errors {
  margin-top: 5px;
}

.masking-form-actions {
  display: flex;
  justify-content: flex-end;
  max-width: 640px;
  padding-top: 1px;
}

.masking-form-actions .button,
.masking-preview-actions .button {
  min-height: 44px;
}

.masking-checks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.masking-checks > div {
  min-width: 0;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.masking-checks > div:last-child {
  border-right: 0;
}

.masking-checks dt {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.masking-checks dt svg {
  width: 15px;
  height: 15px;
}

.masking-checks dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.masking-recommendation {
  display: grid;
  min-width: 0;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  max-width: 640px;
  margin-bottom: 13px;
  padding: 10px 12px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #c1dfcc;
  border-radius: 5px;
}

.masking-recommendation svg {
  width: 18px;
  height: 18px;
}

.masking-recommendation > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.masking-recommendation small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.masking-recommendation-limited {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #ebd6ac;
}

.masking-recommendation-unsuitable {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc6c2;
}

.masking-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
}

.masking-preview-panel {
  margin-bottom: 14px;
}

.masking-reality-row {
  display: grid;
  min-height: 64px;
  grid-template-columns: 40px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--ink);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.masking-reality-row:hover {
  background: var(--surface-soft);
}

.masking-reality-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 5px;
}

.masking-reality-row > span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.masking-reality-row small {
  color: var(--muted);
  font-size: 11px;
}

.masking-reality-row > svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.reality-site-editor {
  max-width: 980px;
  margin-top: 18px;
}

.reality-site-current {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
}

.reality-site-current > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 5px;
}

.reality-site-current > div {
  display: grid;
  min-width: 0;
}

.reality-site-current small {
  color: var(--muted);
  font-size: 11px;
}

.reality-site-current strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.reality-site-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding-top: 16px;
}

.reality-site-form .form-errors {
  grid-column: 1 / -1;
}

.reality-site-criteria {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  padding: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.reality-site-criteria strong {
  color: var(--text);
}

.reality-site-criteria span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 7px 2px 0;
  background: var(--muted);
  border-radius: 50%;
}

.reality-site-result {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.reality-site-result-heading,
.reality-site-link,
.reality-site-apply {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reality-site-result-heading > div {
  display: grid;
  min-width: 0;
}

.reality-site-result-heading small,
.reality-site-fact dt {
  color: var(--muted);
  font-size: 11px;
}

.reality-site-result-heading strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.reality-site-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 14px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.reality-site-fact {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.reality-site-fact:last-child {
  border-right: 0;
}

.reality-site-fact dd {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

.reality-site-fact svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.reality-site-fact-healthy svg {
  color: var(--success);
}

.reality-site-fact-degraded svg {
  color: var(--amber);
}

.reality-site-fact-unknown svg {
  color: var(--muted);
}

.reality-site-findings {
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.reality-site-apply,
.reality-site-link {
  justify-content: flex-end;
  padding-top: 14px;
}

.reality-site-form .button,
.reality-site-apply .button,
.reality-site-link .button {
  min-height: 44px;
}

.credential-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  margin-bottom: 18px;
}

.secret-block {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.secret-label {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 650;
}

.secret-block > code,
.secret-block > pre {
  display: block;
  max-height: 270px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 12px;
}

.qr-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
}

.qr-panel img {
  width: min(100%, 240px);
  height: auto;
  border: 1px solid var(--line);
}

.qr-panel span {
  color: var(--muted);
  font-size: 12px;
}

.release-summary {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.6fr);
  gap: 18px;
  margin-bottom: 18px;
}

.release-current,
.metric-strip {
  min-height: 112px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.release-current {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.release-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 6px;
}

.release-current > div {
  display: grid;
}

.release-current small,
.release-current span:not(.release-icon, .status-badge) {
  color: var(--muted);
  font-size: 11px;
}

.release-current strong {
  font-size: 20px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  padding: 12px;
}

.metric-strip > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 9px 14px;
  border-right: 1px solid var(--line);
}

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

.metric-strip small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-strip strong {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.upload-progress span {
  position: relative;
  display: block;
  height: 5px;
  overflow: hidden;
  background: var(--surface-strong);
  border-radius: 4px;
}

.upload-progress span::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 35%;
  background: var(--primary);
  content: "";
  animation: upload-progress 1.2s ease-in-out infinite;
}

@keyframes upload-progress {
  from { transform: translateX(-100%); }
  to { transform: translateX(390%); }
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  min-height: 90px;
  place-items: center;
  color: var(--muted);
}

.filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.filter-bar .compact-field:first-child {
  width: min(420px, 100%);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-actions select {
  min-width: 170px;
}

.bulk-actions input[type="number"] {
  width: 92px;
}

.select-column {
  width: 44px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-panel > .panel-heading {
  margin: 0;
  padding: 18px 20px 12px;
}

.clickable-row {
  cursor: pointer;
}

.status-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
}

.status-text svg {
  width: 15px;
  height: 15px;
}

.success-text {
  color: var(--success);
}

.eyebrow-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.eyebrow-link svg {
  width: 14px;
  height: 14px;
}

.entity-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.entity-summary > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

.entity-summary > div:last-child {
  border-right: 0;
}

.entity-summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-summary strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.section-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line-strong);
}

.section-tabs a {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-weight: 650;
}

.section-tabs a:hover,
.section-tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.section-tabs a span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  color: var(--ink-soft);
  background: var(--surface-strong);
  border-radius: 4px;
  font-size: 10px;
}

.section-tabs-top {
  margin-top: -8px;
}

.usage-hero {
  display: grid;
  max-width: 620px;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 5px 12px;
}

.usage-hero strong {
  font-size: 30px;
}

.usage-hero span {
  color: var(--muted);
}

.usage-hero progress {
  width: 100%;
  height: 8px;
  grid-column: 1 / -1;
  accent-color: var(--primary);
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-form input {
  width: 110px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

.provision-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 270px;
  align-items: start;
  gap: 18px;
}

.provision-full {
  grid-column: 1 / -1;
}

.step-list {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 2px;
}

.step-item {
  display: grid;
  min-height: 55px;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px;
  color: var(--muted);
  border-left: 2px solid var(--line);
}

.step-item > span,
.section-heading > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface-strong);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.step-item.active {
  color: var(--ink);
  border-left-color: var(--primary);
}

.step-item.active > span,
.section-heading > span {
  color: #fff;
  background: var(--primary);
}

.step-item > div {
  display: grid;
}

.step-item small {
  font-size: 10px;
}

.provision-main {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-section {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
}

.section-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.form-grid.four-columns {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.template-checklist ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.template-checklist label {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.template-checklist input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.sticky-footer {
  position: sticky;
  z-index: 5;
  bottom: 0;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.98);
}

.impact-panel {
  position: sticky;
  top: 84px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.impact-panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
}

.impact-panel .message {
  align-items: flex-start;
  margin-top: 12px;
  font-size: 11px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
}

.sensitive-result,
.qr-result {
  display: grid;
  align-content: start;
  gap: 18px;
}

.result-state {
  display: flex;
  align-items: center;
  gap: 14px;
}

.result-state > span {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 50%;
}

.result-state h2,
.result-state p {
  margin: 0;
}

.result-state p {
  color: var(--muted);
  font-size: 12px;
}

.secret-value {
  max-height: 260px;
  padding: 14px;
  overflow: auto;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.panel-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.telemt-profile-list,
.profile-qr-list {
  display: grid;
  gap: 18px;
}

.telemt-profile {
  display: grid;
  gap: 10px;
}

.telemt-profile + .telemt-profile,
.profile-qr + .profile-qr {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.telemt-profile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.telemt-profile-heading h3 {
  margin: 0;
  font-size: 14px;
}

.telemt-profile .button {
  justify-self: start;
}

.profile-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.profile-qr img {
  width: min(100%, 224px);
  height: auto;
  border: 1px solid var(--line);
}

.profile-qr small {
  color: var(--muted);
}

.result-actions,
.card-actions,
.title-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.qr-result {
  justify-items: center;
  text-align: center;
}

.qr-result img {
  width: min(100%, 224px);
  height: auto;
  border: 1px solid var(--line);
}

.qr-result small {
  color: var(--muted);
}

.pool-section {
  margin-bottom: 26px;
}

.pool-review-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pool-review-bar > div,
.connection-review-title {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.pool-review-bar small,
.connection-review-title small,
.connection-review-reason,
.connection-review-limits {
  color: var(--muted);
  font-size: 11px;
}

.pool-review-bar .button {
  min-height: 44px;
}

.connection-review-panel {
  margin-bottom: 20px;
}

.review-read-only {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
}

.review-read-only svg {
  width: 14px;
  height: 14px;
}

.connection-review-grid {
  display: grid;
  gap: 8px;
}

.connection-review-dimensions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.connection-review-dimensions > div {
  min-width: 0;
  padding: 9px 11px;
  border-right: 1px solid var(--line);
}

.connection-review-dimensions > div:last-child {
  border-right: 0;
}

.connection-review-dimensions dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.connection-review-dimensions dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
}

.review-state-healthy {
  color: var(--success);
}

.review-state-degraded {
  color: var(--amber);
}

.review-state-failed {
  color: var(--danger);
}

.connection-review-row {
  display: grid;
  grid-template-columns: minmax(145px, 1.2fr) auto minmax(250px, 1.6fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--success);
  border-radius: 4px;
}

.connection-review-limited {
  border-left-color: var(--amber);
}

.connection-review-needs_review {
  border-left-color: var(--danger);
}

.connection-review-facts {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 12px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.connection-review-reason {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.connection-review-limits {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.connection-review-limits li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.connection-review-limits svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
}

.section-toolbar h2,
.section-toolbar p {
  margin: 0;
}

.section-toolbar h2 {
  font-size: 18px;
}

.section-toolbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.section-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  gap: 12px;
}

.template-card {
  display: grid;
  min-width: 0;
  align-content: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.template-card-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.template-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 5px;
}

.template-card h3,
.template-card p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card h3 {
  font-size: 14px;
}

.template-card p {
  color: var(--muted);
  font-size: 11px;
}

.template-card .detail-list {
  margin-bottom: 12px;
}

.template-card .detail-list > div {
  min-height: 34px;
  font-size: 11px;
}

.technical-details {
  margin: 0 0 12px;
  border-top: 1px solid var(--line);
}

.technical-details summary {
  display: grid;
  min-height: 36px;
  grid-template-columns: 16px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  list-style: none;
}

.technical-details summary::-webkit-details-marker {
  display: none;
}

.technical-details summary svg {
  width: 15px;
  height: 15px;
}

.technical-details summary svg:last-child {
  justify-self: end;
  transition: transform 120ms ease;
}

.technical-details[open] summary svg:last-child {
  transform: rotate(180deg);
}

.technical-details .detail-list {
  margin-bottom: 4px;
}

.technical-details .detail-list > div {
  min-height: 30px;
}

.card-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.card-actions form {
  margin: 0;
}

.template-card-actions {
  align-items: stretch;
}

.connection-create-aside {
  align-self: start;
}

.connection-catalog-list {
  display: grid;
  gap: 0;
  margin: -4px 0 14px;
}

.connection-catalog-item {
  display: grid;
  gap: 5px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.connection-catalog-item:last-child {
  border-bottom: 0;
}

.connection-catalog-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.connection-catalog-item strong {
  min-width: 0;
  font-size: 12px;
}

.connection-catalog-item p,
.connection-catalog-item small,
.empty-copy {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.connection-catalog-item-unavailable {
  opacity: .72;
}

.page-empty {
  min-height: 260px;
  gap: 12px;
}

.wide-dialog {
  width: min(94vw, 820px);
}

.routing-summary,
.preview-summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.routing-summary > div,
.preview-summary > div {
  display: grid;
  min-width: 0;
  min-height: 66px;
  align-content: center;
  gap: 2px;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
}

.routing-summary > div:last-child,
.preview-summary > div:last-child {
  border-right: 0;
}

.routing-summary small,
.preview-summary small {
  color: var(--muted);
  font-size: 11px;
}

.routing-summary strong,
.preview-summary strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
}

.routing-summary code,
.preview-summary code {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
}

.routing-tabs {
  overflow-x: auto;
}

.warning-disclosure {
  margin-bottom: 14px;
  background: var(--amber-soft);
  border: 1px solid #e8c98e;
  border-radius: var(--radius);
}

.warning-disclosure summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  color: var(--amber);
  cursor: pointer;
  font-weight: 650;
}

.warning-disclosure summary svg {
  width: 18px;
  height: 18px;
}

.warning-disclosure > div {
  display: grid;
  gap: 5px;
  padding: 0 14px 13px 41px;
}

.warning-disclosure code {
  overflow-wrap: anywhere;
  white-space: normal;
}

.effective-route {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) 44px minmax(420px, 1.15fr);
  align-items: start;
  gap: 12px;
}

.route-stage {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.compact-stage {
  grid-column: 1 / -1;
}

.route-stage-heading {
  display: grid;
  min-height: 68px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  background: #f8fafa;
  border-bottom: 1px solid var(--line);
}

.route-stage-heading h2 {
  margin: 0 0 2px;
  font-size: 15px;
}

.route-stage-heading code {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 5px;
}

.service-icon.xray {
  color: var(--blue);
  background: var(--blue-soft);
}

.service-icon.dns {
  color: var(--amber);
  background: var(--amber-soft);
}

.effective-rule-list,
.trace-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.effective-rule-list li,
.trace-list li {
  display: grid;
  min-height: 54px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
}

.effective-rule-list li:last-child,
.trace-list li:last-child {
  border-bottom: 0;
}

.effective-rule-list li > div,
.trace-list li > div {
  display: grid;
  min-width: 0;
}

.effective-rule-list strong,
.effective-rule-list small,
.trace-list strong,
.trace-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.effective-rule-list small,
.trace-list small {
  color: var(--muted);
  font-size: 11px;
}

.route-final {
  background: var(--primary-soft);
}

.route-final > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--primary);
  border: 1px solid #abd2cb;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.route-stage-connector {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.route-stage-connector span {
  width: 9px;
  height: 1px;
  background: var(--line-strong);
}

.route-stage-connector svg {
  width: 18px;
  height: 18px;
  transform: rotate(-90deg);
}

.routing-table {
  min-width: 920px;
}

.ruleset-table {
  min-width: 1180px;
}

.routing-table td:nth-child(2) {
  width: 30%;
  white-space: normal;
}

.routing-table td:nth-child(4) {
  width: 36%;
  max-width: 520px;
}

.rule-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.route-outcome,
.consumer-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #c6dce9;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
}

.consumer-chip {
  margin: 2px 3px 2px 0;
}

.rule-preview {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-cell {
  max-width: 330px;
  white-space: normal;
}

.path-cell code,
.field-type-list {
  overflow-wrap: anywhere;
  white-space: normal;
}

.hash-code {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.icon-form {
  display: inline-flex;
  margin: 0;
}

.routing-dialog {
  width: min(96vw, 980px);
  max-height: 92vh;
}

.structured-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.advanced-json {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.advanced-json summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 650;
}

.advanced-json summary svg {
  width: 17px;
  height: 17px;
}

.advanced-json .field {
  padding: 0 12px 12px;
}

.compact-tabs a > svg {
  width: 17px;
  height: 17px;
}

.compact-tabs a > b {
  display: inline-grid;
  min-width: 21px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  color: var(--ink-soft);
  background: var(--surface-strong);
  border-radius: 4px;
  font-size: 10px;
}

.friendly-rulesets {
  min-width: 640px;
}

.friendly-rulesets td:first-child {
  min-width: 210px;
}

.route-choice,
.source-kind,
.dns-path-label {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.route-choice svg,
.source-kind svg {
  width: 14px;
  height: 14px;
}

.route-direct {
  color: #17624e;
  background: #e9f6f1;
  border-color: #b9dfd1;
}

.route-relay {
  color: #1d5d85;
  background: #edf6fb;
  border-color: #c4ddec;
}

.route-block {
  color: #9b3737;
  background: #fff0f0;
  border-color: #efc5c5;
}

.route-unknown,
.dns-path-label.muted,
.source-kind {
  color: var(--muted);
  background: var(--surface-soft);
}

.dns-path-label {
  color: var(--ink-soft);
  background: #f7f9f9;
}

.routing-set-dialog {
  width: min(96vw, 940px);
  max-height: 94vh;
}

.routing-set-primary {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(420px, 1.2fr);
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.route-action-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.route-action-field legend {
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.route-action-options {
  display: grid;
  min-height: 44px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.route-action-options > div,
.route-action-options label {
  min-width: 0;
  height: 100%;
}

.route-action-options label {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.route-action-options label:has(input:checked) {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #8fc8bd;
  box-shadow: inset 0 0 0 1px #8fc8bd;
}

.route-action-options input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}

.set-entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.set-entry-grid textarea {
  min-height: 126px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.set-extra-fields {
  grid-column: 1 / -1;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.set-extra-fields > summary {
  display: grid;
  min-height: 44px;
  grid-template-columns: 19px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}

.set-extra-fields > summary::-webkit-details-marker {
  display: none;
}

.set-extra-fields > summary svg {
  width: 17px;
  height: 17px;
}

.set-extra-fields[open] > summary svg:last-child {
  transform: rotate(180deg);
}

.set-extra-fields > .set-entry-grid {
  padding: 0 13px 13px;
}

.dns-routing-form {
  margin: 0;
}

.dns-lanes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dns-lane {
  min-width: 0;
  padding: 20px;
}

.dns-lane + .dns-lane {
  border-left: 1px solid var(--line);
}

.dns-lane-heading {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.dns-lane-heading > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #17624e;
  background: #e9f6f1;
  border-radius: 5px;
}

.relay-lane .dns-lane-heading > span {
  color: #1d5d85;
  background: #edf6fb;
}

.dns-lane-heading svg {
  width: 19px;
  height: 19px;
}

.dns-lane-heading h3,
.dns-lane-heading p {
  margin: 0;
}

.dns-lane-heading h3 {
  font-size: 15px;
}

.dns-lane-heading p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.dns-fields {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(190px, 1.4fr) 90px;
  gap: 10px;
}

.dns-strategy-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 0;
}

.dns-strategy-row .field {
  width: min(100%, 320px);
}

.danger-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  background: var(--danger-soft);
  border-top: 1px solid #efbcb7;
}

.confirm-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
}

.confirm-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--danger);
}

.simulator-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(400px, 1.1fr);
  align-items: start;
  gap: 16px;
}

.simulation-result {
  padding-bottom: 0;
  overflow: hidden;
}

.simulation-outcome {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px 16px;
  margin: 0 -20px;
  padding: 15px 20px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.simulation-outcome small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.simulation-outcome strong {
  font-size: 19px;
}

.trace-list {
  margin: 0 -20px;
}

.trace-list li {
  grid-template-columns: 34px minmax(0, 1fr);
}

.trace-list .trace-matched {
  background: var(--success-soft);
}

.trace-list .trace-unknown {
  background: var(--amber-soft);
}

.preview-summary {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.diff-panel {
  padding-bottom: 0;
  overflow: hidden;
}

.config-diff {
  max-height: 58vh;
  margin: 0 -20px;
  overflow: auto;
  padding: 17px 20px;
  color: #dbe7e8;
  background: #1d282b;
  border-top: 1px solid #10191b;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

.compact-empty {
  min-height: 130px;
}

.preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.preview-actions form {
  margin: 0;
}

.status-pending,
.status-syncing,
.status-running,
.status-ready,
.status-unconfigured {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-error,
.status-rolled_back,
.status-disabled {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-succeeded {
  color: var(--success);
  background: var(--success-soft);
}

.status-canary_required,
.status-stale {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-verifying,
.status-queued,
.status-recovering,
.status-transport_only {
  color: var(--blue);
  background: var(--blue-soft);
}

.state-recovering,
.state-transport_only {
  background: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.tunnel-state-band {
  display: grid;
  min-height: 72px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 12px 18px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tunnel-state-band > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.tunnel-state-band small {
  color: var(--muted);
  font-size: 11px;
}

.tunnel-state-band strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tunnel-state-band > svg {
  width: 18px;
  color: var(--muted);
}

.tunnel-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.tunnel-controls form {
  margin: 0;
}

.tool-command {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.tool-command:hover {
  color: var(--primary);
  border-color: #8dbfb6;
}

.tool-command-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #e3b6b1;
}

.tool-command svg {
  width: 17px;
  height: 17px;
}

.operation-progress-panel {
  margin-top: 18px;
}

.section-tabs-secondary {
  min-height: 38px;
  margin-top: -10px;
  border-bottom-color: var(--line);
}

.section-tabs-secondary a {
  min-height: 38px;
  font-size: 12px;
  font-weight: 620;
}

.update-channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.update-channel-panel {
  display: flex;
  min-height: 300px;
  flex-direction: column;
}

.channel-version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface-soft);
  border-radius: 5px;
}

.channel-version-row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.channel-version-row small {
  color: var(--muted);
  font-size: 11px;
}

.channel-version-row strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-version-row > svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.compact-detail-list {
  margin-bottom: 12px;
}

.panel-action-row {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.update-metrics {
  min-height: 92px;
  border: 0;
}

.channel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.channel-tags span {
  padding: 2px 6px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 680;
}

.channel-tags .muted-tag {
  color: var(--muted);
  background: transparent;
}

.signature-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  text-transform: uppercase;
}

.signature-state::before {
  width: 7px;
  height: 7px;
  background: #899699;
  border-radius: 50%;
  content: "";
}

.signature-verified {
  color: var(--success);
}

.signature-verified::before {
  background: var(--success);
}

.signature-legacy {
  color: var(--amber);
}

.signature-legacy::before,
.signature-pending::before {
  background: var(--amber);
}

.update-release-actions {
  min-width: 116px;
}

.danger-icon-button {
  color: var(--danger);
}

.danger-icon-button:hover {
  color: var(--danger-hover);
  background: var(--danger-soft);
}

.status-draft,
.status-validating,
.status-canary {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-stable,
.status-legacy {
  color: var(--success);
  background: var(--success-soft);
}

.status-superseded,
.status-empty {
  color: var(--muted);
  background: var(--surface-strong);
}

.status-untracked {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-drift,
.status-rejected {
  color: var(--danger);
  background: var(--danger-soft);
}

.progress-track,
.mini-progress {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  appearance: none;
  border: 0;
  background: var(--surface-strong);
  border-radius: 4px;
  accent-color: var(--primary);
}

.progress-track::-webkit-progress-bar,
.mini-progress::-webkit-progress-bar {
  background: var(--surface-strong);
  border-radius: inherit;
}

.progress-track::-webkit-progress-value,
.mini-progress::-webkit-progress-value,
.progress-track::-moz-progress-bar,
.mini-progress::-moz-progress-bar {
  background: var(--primary);
  border-radius: inherit;
}

.operation-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.mini-progress {
  width: 110px;
  height: 5px;
  margin-bottom: 5px;
}

.relay-tabs {
  margin-bottom: 14px;
}

.relay-primary-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.relay-primary-tabs a,
.relay-advanced-nav summary {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  list-style: none;
}

.relay-primary-tabs a svg,
.relay-advanced-nav summary svg {
  width: 16px;
  height: 16px;
}

.relay-primary-tabs a:hover,
.relay-advanced-nav summary:hover,
.relay-advanced-nav a:hover {
  color: var(--primary);
  background: var(--surface-soft);
}

.relay-primary-tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.relay-advanced-nav {
  display: inline-block;
  margin-bottom: 16px;
}

.relay-advanced-nav summary::-webkit-details-marker {
  display: none;
}

.relay-advanced-nav summary::after {
  margin-left: 2px;
  content: "▾";
  font-size: 12px;
}

.relay-advanced-nav[open] summary::after {
  content: "▴";
}

.relay-advanced-nav nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: var(--shadow);
}

.relay-advanced-nav a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 10px;
  color: var(--ink-soft);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 620;
}

.relay-advanced-nav a.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.relay-welcome {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding: 4px 2px 0;
}

.relay-welcome-icon {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #b8ddd5;
  border-radius: 6px;
}

.relay-welcome-icon svg {
  width: 23px;
  height: 23px;
}

.eyebrow-label {
  display: block;
  margin-bottom: 3px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.relay-welcome h2,
.relay-section-heading h2 {
  margin: 0 0 4px;
  font-size: 20px;
  line-height: 1.25;
}

.relay-welcome p,
.relay-section-heading p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.relay-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.relay-step {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 14px;
  background: var(--surface);
}

.relay-step > span {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 750;
}

.relay-step.active > span {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.relay-step > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.relay-step strong {
  font-size: 13px;
}

.relay-step small {
  color: var(--muted);
  font-size: 11px;
}

.relay-import-panel,
.relay-current-panel {
  margin-bottom: 16px;
}

.relay-import-panel .panel-heading,
.relay-current-panel .panel-heading {
  align-items: center;
}

.step-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 750;
}

.relay-import-form .form-footer {
  margin-top: 14px;
}

.relay-current-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.relay-current-main {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 2px;
}

.relay-current-main strong,
.relay-current-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relay-current-main span,
.relay-current-meta small {
  color: var(--muted);
  font-size: 11px;
}

.relay-current-meta {
  display: grid;
  flex: 0 0 auto;
  min-width: 72px;
  gap: 2px;
  text-align: right;
}

.relay-current-meta strong {
  font-size: 13px;
}

.relay-empty-current,
.relay-source-empty,
.relay-no-sources {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.relay-empty-current > svg,
.relay-source-empty > svg,
.relay-no-sources > svg {
  flex: 0 0 auto;
  color: var(--blue);
}

.relay-empty-current > div,
.relay-source-empty > span,
.relay-no-sources > span {
  display: grid;
  gap: 2px;
}

.relay-empty-current strong,
.relay-no-sources strong {
  color: var(--ink);
}

.relay-empty-current form {
  margin-left: auto;
}

.relay-choices-section {
  margin-bottom: 18px;
}

.relay-section-heading,
.relay-source-block-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.relay-section-heading {
  margin-bottom: 14px;
}

.relay-count,
.source-ready-count {
  flex: 0 0 auto;
  color: var(--success);
  font-size: 12px;
}

.relay-count-muted {
  color: var(--muted);
}

.relay-source-block {
  margin-bottom: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.relay-source-block:last-child {
  margin-bottom: 0;
}

.relay-source-block-heading {
  align-items: center;
  margin-bottom: 12px;
}

.relay-source-block-heading h3 {
  margin: 0 0 2px;
  font-size: 15px;
}

.relay-source-block-heading span {
  color: var(--muted);
  font-size: 11px;
}

.relay-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.relay-choice-card {
  display: flex;
  min-width: 0;
  min-height: 190px;
  flex-direction: column;
  padding: 14px;
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.relay-choice-card.is-current {
  background: var(--success-soft);
  border-color: #a8d2ba;
  box-shadow: inset 3px 0 var(--success);
}

.relay-choice-card.is-unsupported {
  opacity: .7;
}

.relay-choice-card.needs-probe {
  background: #fffdf8;
}

.relay-choice-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 9px;
}

.relay-choice-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.relay-choice-head h4 {
  overflow: hidden;
  margin: 1px 0 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.relay-choice-head > div > span {
  color: var(--muted);
  font-size: 11px;
}

.protocol-avatar.large {
  width: 42px;
  height: 42px;
  font-size: 12px;
}

.relay-choice-details {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0 0 10px;
}

.relay-choice-technical {
  margin: 18px 0 4px;
  border-top: 1px solid var(--line);
}

.relay-choice-technical summary {
  display: grid;
  min-height: 36px;
  grid-template-columns: 16px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  list-style: none;
}

.relay-choice-technical summary::-webkit-details-marker {
  display: none;
}

.relay-choice-technical summary svg {
  width: 15px;
  height: 15px;
}

.relay-choice-technical summary svg:last-child {
  justify-self: end;
  transition: transform 120ms ease;
}

.relay-choice-technical[open] summary svg:last-child {
  transform: rotate(180deg);
}

.relay-choice-details div {
  min-width: 0;
}

.relay-choice-details dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.relay-choice-details dd {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.relay-choice-footer {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.choice-note {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.choice-note svg {
  width: 15px;
  height: 15px;
}

.relay-unsupported-note {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.relay-unsupported-note a,
.relay-source-empty a {
  margin-left: 4px;
  font-weight: 650;
}

.relay-advanced-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.relay-advanced-strip > div:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
}

.relay-advanced-strip > div:first-child > svg {
  color: var(--primary);
}

.relay-advanced-strip > div:first-child > div {
  display: grid;
  gap: 2px;
}

.relay-advanced-strip strong {
  color: var(--ink);
  font-size: 12px;
}

.relay-advanced-strip span {
  font-size: 11px;
}

.relay-advanced-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  font-weight: 650;
}

.relay-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.relay-metrics > div {
  display: grid;
  min-height: 78px;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 11px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-icon {
  display: grid;
  width: 40px;
  height: 40px;
  grid-row: 1 / 3;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 5px;
}

.metric-icon.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.metric-icon.green {
  color: var(--success);
  background: var(--success-soft);
}

.metric-icon.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.relay-metrics small {
  align-self: end;
  color: var(--muted);
  font-size: 11px;
}

.relay-metrics strong {
  align-self: start;
  font-size: 18px;
}

.relay-source-table,
.relay-profile-table {
  min-width: 1040px;
}

.diff-count {
  display: inline-grid;
  min-width: 28px;
  height: 24px;
  margin-right: 3px;
  place-items: center;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.diff-count.added {
  color: var(--success);
  background: var(--success-soft);
}

.diff-count.changed {
  color: var(--amber);
  background: var(--amber-soft);
}

.diff-count.removed {
  color: var(--danger);
  background: var(--danger-soft);
}

.relay-filter {
  margin-bottom: 14px;
}

.relay-health {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 4px;
}

.relay-health-detail {
  max-width: 32ch;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.relay-profile-identity {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.relay-profile-identity > strong {
  overflow-wrap: anywhere;
}

.relay-profile-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.relay-profile-meta > span + span::before {
  margin-right: 8px;
  color: var(--line-strong);
  content: "\00b7";
}

.relay-profile-table th:nth-child(2),
.relay-profile-table td:nth-child(2) {
  width: 240px;
}

.relay-profile-table th:last-child,
.relay-profile-table td:last-child {
  width: 144px;
}

.relay-profile-table tr.is-probing .status-badge > span {
  animation: relay-probe-pulse 1.2s ease-in-out infinite;
}

@keyframes relay-probe-pulse {
  0%,
  100% { opacity: .45; }
  50% { opacity: 1; }
}

.relay-live-panel {
  margin-bottom: 16px;
}

.relay-live-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.relay-live-grid > div {
  display: grid;
  min-height: 68px;
  align-content: center;
  justify-items: start;
  gap: 7px;
  padding: 12px 14px;
  background: var(--surface);
}

.relay-live-grid small,
.health-line small {
  color: var(--muted);
  font-size: 11px;
}

.relay-live-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.health-stack {
  display: grid;
  gap: 6px;
}

.health-line {
  display: grid;
  justify-items: start;
  gap: 3px;
}

.relay-group-summary {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  margin-bottom: 16px;
}

.relay-group-layout {
  display: grid;
  grid-template-columns: minmax(480px, 1.35fr) minmax(330px, 0.65fr);
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.group-switch-panel {
  padding-bottom: 0;
  overflow: hidden;
}

.switch-choice-form {
  margin: 0 -20px;
}

.switch-profile-list {
  display: grid;
}

.switch-profile {
  display: grid;
  min-height: 62px;
  grid-template-columns: 18px 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.switch-profile:hover,
.switch-profile:has(input:checked) {
  background: var(--primary-soft);
}

.switch-profile.current {
  box-shadow: inset 3px 0 var(--primary);
}

.switch-profile.unavailable {
  cursor: not-allowed;
  opacity: 0.58;
}

.switch-profile input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.switch-profile > span:nth-of-type(2) {
  display: grid;
  min-width: 0;
}

.switch-profile > span:nth-of-type(2) strong,
.switch-profile > span:nth-of-type(2) small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-profile > span:nth-of-type(2) small {
  color: var(--muted);
  font-size: 11px;
}

.protocol-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid #c5dae7;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 750;
}

.switch-choice-form .form-footer {
  margin: 0;
  padding: 13px 20px;
  background: #f8fafa;
  border-top: 1px solid var(--line);
}

.auto-switch-banner {
  display: grid;
  min-height: 82px;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.auto-switch-banner > div {
  display: grid;
}

.auto-switch-banner small {
  color: var(--muted);
}

.field-control > .segmented-radio {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  background: var(--surface-strong);
  border-radius: 5px;
}

.field-control > .segmented-radio > div {
  min-width: 0;
}

.field-control > .segmented-radio label {
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  white-space: normal;
  text-align: center;
}

.field-control > .segmented-radio label:has(input:checked) {
  color: var(--primary);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 34, 38, 0.12);
}

.field-control > .segmented-radio input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.member-add-form {
  display: grid;
  grid-template-columns: 76px 70px 36px;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.member-add-form input {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.danger-icon {
  color: var(--danger);
}

.success-text {
  color: var(--success);
}

.switch-impact-header {
  display: grid;
  min-height: 82px;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.switch-impact-header > div {
  display: grid;
  min-width: 0;
}

.switch-impact-header > div:last-child {
  text-align: right;
}

.switch-impact-header small {
  color: var(--muted);
}

.switch-impact-header strong,
.switch-impact-header code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-impact-header > svg {
  color: var(--muted);
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

.definition-list {
  display: grid;
  margin: 0;
}

.definition-list > div {
  display: grid;
  min-height: 38px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.definition-list > div:last-child {
  border-bottom: 0;
}

.definition-list dt {
  color: var(--muted);
  font-size: 12px;
}

.definition-list dd {
  margin: 0;
  font-weight: 650;
}

.impact-paths {
  display: grid;
  gap: 8px;
}

.impact-paths > span {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.impact-paths svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 1280px) {
  .routing-summary {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .routing-summary > div:nth-child(4) {
    border-right: 0;
  }

  .routing-summary > div:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .provision-layout {
    grid-template-columns: 160px minmax(0, 1fr);
  }

  .impact-panel {
    position: static;
    grid-column: 2;
  }

  .form-grid.four-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .template-grid {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }
}

@media (max-width: 1180px) {
  .relay-group-layout {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .release-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .tunnel-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .relay-metrics {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .relay-steps {
    grid-template-columns: 1fr;
  }

  .relay-step {
    min-height: 52px;
  }

  .relay-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .relay-live-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .panel-heading-actions {
    width: 100%;
    justify-content: flex-start;
  }

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

  .effective-route,
  .simulator-layout {
    grid-template-columns: 1fr;
  }

  .route-stage-connector {
    min-height: 36px;
    flex-direction: column;
  }

  .route-stage-connector span {
    width: 1px;
    height: 8px;
  }

  .route-stage-connector svg {
    transform: none;
  }

  .compact-stage {
    grid-column: 1;
  }

  .structured-rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgba(14, 25, 29, 0.48);
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  .sidebar.open + .sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .app-column {
    width: 100%;
    margin-left: 0;
  }

  .icon-button.mobile-menu {
    display: inline-flex;
  }

  .topbar {
    padding: 0 18px;
  }

  .content {
    padding: 24px 18px 48px;
  }

  .dashboard-grid,
  .settings-grid,
  .masking-grid,
  .credential-layout,
  .update-channel-grid {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .auth-panel {
    padding: 34px 22px;
  }

  .auth-brand {
    margin-bottom: 44px;
  }

  .entity-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entity-summary > div {
    border-bottom: 1px solid var(--line);
  }

  .entity-summary > div:nth-child(2n) {
    border-right: 0;
  }

  .provision-layout {
    grid-template-columns: 1fr;
  }

  .step-list {
    position: static;
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    overflow-x: auto;
  }

  .step-item {
    border-left: 0;
    border-bottom: 2px solid var(--line);
  }

  .step-item.active {
    border-bottom-color: var(--primary);
  }

  .impact-panel {
    grid-column: 1;
  }

  .result-layout,
  .template-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .section-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .section-toolbar-actions {
    justify-content: flex-start;
  }

  .section-toolbar .button {
    align-self: auto;
  }

  .detail-list > div {
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  .detail-list dd {
    max-width: 100%;
    margin-left: auto;
  }

  .card-actions {
    justify-content: flex-start;
  }

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

.pool-review-bar form,
.pool-review-bar .button {
  width: 100%;
}

  .connection-review-dimensions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .connection-review-dimensions > div:nth-child(2n) {
    border-right: 0;
  }

  .connection-review-dimensions > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .connection-review-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .connection-review-facts {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .relay-primary-tabs a,
  .relay-advanced-nav summary {
    min-height: 36px;
    padding: 0 8px;
    font-size: 12px;
  }

  .relay-welcome h2,
  .relay-section-heading h2 {
    font-size: 18px;
  }

  .relay-welcome {
    gap: 10px;
  }

  .relay-welcome-icon {
    width: 38px;
    height: 38px;
  }

  .relay-current-row {
    flex-wrap: wrap;
  }

  .relay-current-meta {
    margin-left: auto;
  }

  .relay-current-row > .button {
    width: 100%;
  }

  .relay-empty-current {
    flex-wrap: wrap;
  }

  .relay-empty-current form {
    width: 100%;
    margin-left: 0;
  }

  .relay-empty-current form .button {
    width: 100%;
  }

  .relay-section-heading,
  .relay-source-block-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .relay-choice-grid {
    grid-template-columns: 1fr;
  }

  .relay-source-block {
    padding: 12px;
  }

  .relay-advanced-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .relay-advanced-links {
    gap: 8px 12px;
  }

  .relay-live-grid {
    grid-template-columns: 1fr;
  }

  .tunnel-controls {
    grid-template-columns: 1fr;
  }

  .tunnel-state-band {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .tunnel-state-band > svg {
    display: none;
  }

  .relay-metrics,
  .relay-group-summary {
    grid-template-columns: 1fr;
  }

  .relay-group-summary > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .switch-profile {
    grid-template-columns: 18px 34px minmax(0, 1fr);
    padding: 10px 14px;
  }

  .switch-profile .status-badge {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .field-control > .segmented-radio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .switch-impact-header {
    grid-template-columns: 1fr;
  }

  .switch-impact-header > svg {
    transform: rotate(90deg);
  }

  .switch-impact-header > div:last-child {
    text-align: left;
  }

  .routing-summary,
  .preview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .routing-summary > div,
  .preview-summary > div {
    min-height: 58px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .routing-summary > div:nth-child(2n),
  .preview-summary > div:nth-child(2n) {
    border-right: 0;
  }

  .routing-summary > div:last-child,
  .preview-summary > div:last-child {
    border-bottom: 0;
  }

  .structured-rule-grid {
    grid-template-columns: 1fr;
  }

  .danger-strip,
  .preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .danger-strip .button,
  .preview-actions .button,
  .preview-actions form {
    width: 100%;
  }

  .user-name {
    display: none;
  }

  .page-heading {
    align-items: center;
  }

  .page-heading h1 {
    font-size: 21px;
  }

  .page-actions .button span {
    display: none;
  }

  .page-actions .button {
    width: 40px;
    padding: 0;
  }

  .status-grid,
  .form-grid,
  .masking-site-form,
  .reality-site-form,
  .masking-checks {
    grid-template-columns: 1fr;
  }

  .reality-site-facts {
    grid-template-columns: 1fr 1fr;
  }

  .reality-site-result-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .reality-site-fact {
    border-bottom: 1px solid var(--line);
  }

  .reality-site-fact:nth-child(2n) {
    border-right: 0;
  }

  .reality-site-fact:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .masking-preview-panel .panel-heading {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .masking-content-switch {
    grid-template-columns: 1fr;
  }

  .masking-domain-options-heading {
    display: grid;
    gap: 2px;
    padding: 7px 0;
  }

  .masking-domain-options-heading small {
    text-align: left;
  }

  .masking-domain-option {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .masking-domain-rules ul {
    grid-template-columns: 1fr;
  }

  .masking-site-form .button,
  .reality-site-form .button,
  .masking-preview-actions form,
  .masking-preview-actions .button {
    width: 100%;
  }

  .masking-form-actions {
    display: block;
  }

  .masking-checks > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .masking-checks > div:last-child {
    border-bottom: 0;
  }

  .masking-reality-row {
    grid-template-columns: 40px minmax(0, 1fr) 20px;
  }

  .masking-reality-row .status-badge {
    grid-column: 2;
  }

  .masking-reality-row > svg {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .panel {
    padding: 16px;
  }

  .route-tabs button {
    min-width: 0;
    grid-template-columns: 20px;
  }

  .route-tabs button span,
  .route-tabs button small {
    display: none;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .form-footer .button,
  .compact-field {
    width: 100%;
  }

  .relay-overview,
  .tunnel-flow {
    grid-template-columns: 1fr;
  }

  .relay-link,
  .flow-connection {
    min-height: 36px;
    flex-direction: column;
  }

  .relay-link span,
  .flow-connection > span {
    width: 1px;
    min-height: 12px;
    flex: 1;
  }

  .metric-strip {
    grid-template-columns: 1fr 1fr;
  }

  .metric-strip > div:nth-child(2) {
    border-right: 0;
  }

  .metric-strip > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .release-current {
    grid-template-columns: 44px 1fr;
  }

  .release-current .status-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .recovery-list {
    grid-template-columns: 1fr;
  }

  .dialog-form {
    padding: 18px;
  }

  .filter-bar,
  .result-actions,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar .compact-field,
  .inline-form input,
  .compact-inline select,
  .compact-inline strong,
  .result-actions .button {
    width: 100%;
  }

  .entity-summary,
  .form-grid.two-columns,
  .form-grid.three-columns,
  .form-grid.four-columns,
  .template-checklist ul {
    grid-template-columns: 1fr;
  }

  .entity-summary > div {
    border-right: 0;
  }

  .span-2 {
    grid-column: auto;
  }

  .form-section {
    padding: 17px;
  }

  .section-tabs a {
    min-height: 39px;
    padding: 0 10px;
    font-size: 12px;
  }

  .template-card-head {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .template-card-head .status-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .routing-set-primary,
  .set-entry-grid,
  .set-extra-fields > .set-entry-grid,
  .dns-lanes,
  .dns-fields {
    grid-template-columns: 1fr;
  }

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

  .dns-lane {
    padding: 16px;
  }

  .dns-lane + .dns-lane {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .dns-strategy-row {
    align-items: stretch;
    flex-direction: column;
    padding: 16px 16px 0;
  }

  .dns-strategy-row .field {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .reality-site-facts {
    grid-template-columns: 1fr;
  }

  .reality-site-fact,
  .reality-site-fact:nth-child(2n) {
    border-right: 0;
  }

  .reality-site-fact:last-child {
    grid-column: auto;
  }
}

@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;
  }
}

/* Focus the three high-frequency workflows on task content. */
:root {
  --sidebar-width: 248px;
}

.nav-link {
  gap: 0;
  padding-right: 12px;
  padding-left: 12px;
}

.nav-link svg {
  display: none;
}

.panel {
  box-shadow: none;
}

.routing-set-dialog {
  width: min(94vw, 900px);
}

.routing-set-primary {
  grid-template-columns: minmax(220px, .72fr) minmax(360px, 1.28fr);
  gap: 22px;
  margin-bottom: 24px;
}

.routing-match-section {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.routing-form-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.routing-form-heading h3 {
  margin: 0;
  font-size: 14px;
}

.routing-form-heading > span {
  color: var(--muted);
  font-size: 11px;
}

.routing-row-actions {
  min-width: 180px;
  gap: 8px;
}

.routing-danger-action {
  color: var(--danger);
}

.set-entry-grid-primary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.set-entry-grid-primary .field-match-primary {
  grid-column: 1 / -1;
}

.set-entry-grid textarea {
  min-height: 112px;
}

.set-entry-grid-primary .field-match-primary textarea {
  min-height: 92px;
}

.set-extra-fields {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.set-extra-fields > summary {
  min-height: 42px;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 10px;
  padding: 0;
  color: var(--ink-soft);
}

.set-extra-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.set-extra-fields > .set-entry-grid {
  padding: 4px 0 0;
}

.route-choice {
  gap: 0;
  padding-right: 9px;
  padding-left: 9px;
}

.relay-page {
  width: min(100%, 1120px);
}

.relay-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.relay-tabs a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
}

.relay-tabs a:hover,
.relay-tabs a:focus-visible {
  color: var(--primary);
  background: var(--surface-soft);
  outline: none;
}

.relay-tabs a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.relay-current-panel {
  margin-bottom: 28px;
}

.relay-current-panel .panel-heading {
  align-items: center;
  margin-bottom: 4px;
}

.relay-current-row {
  padding: 16px 0 2px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.relay-current-main strong {
  font-size: 15px;
}

.relay-empty-current {
  min-height: 52px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.relay-section-heading {
  align-items: baseline;
  margin-bottom: 4px;
}

.relay-section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.relay-source-block {
  margin: 18px 0 0;
  padding: 16px 0 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.relay-source-block-heading {
  margin-bottom: 10px;
}

.relay-source-block-heading h3 {
  font-size: 14px;
}

.relay-choice-table {
  min-width: 720px;
}

.relay-choice-table th,
.relay-choice-table td {
  padding: 12px 10px;
}

.relay-choice-table th:first-child,
.relay-choice-table td:first-child {
  padding-left: 0;
}

.relay-choice-table th:last-child,
.relay-choice-table td:last-child {
  padding-right: 0;
}

.relay-choice-table tbody tr.is-current td {
  background: var(--success-soft);
}

.relay-choice-table tbody tr.is-current td:first-child {
  border-left: 3px solid var(--success);
  padding-left: 7px;
}

.relay-choice-table tbody tr.is-unsupported {
  color: var(--muted);
}

.relay-choice-table tbody tr.needs-probe {
  background: #fffaf0;
}

.relay-choice-table code {
  color: var(--ink-soft);
  font-size: 12px;
}

.relay-choice-table .row-actions {
  min-width: 120px;
  align-items: center;
  white-space: normal;
}

.relay-choice-table .row-actions form {
  margin: 0;
}

.relay-source-empty,
.relay-no-sources {
  min-height: 46px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.relay-unsupported-note {
  margin-top: 8px;
}

.relay-import-panel {
  margin-top: 28px;
}

.relay-import-panel .panel-heading {
  margin-bottom: 12px;
}

.masking-workspace,
.masking-preview-panel,
.masking-reality-row {
  max-width: 840px;
}

.masking-workspace {
  margin-bottom: 20px;
}

.masking-current {
  display: flex;
  min-height: 56px;
  align-items: center;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--line);
}

.masking-current > div {
  gap: 2px;
}

.masking-current small {
  font-size: 11px;
}

.masking-current strong {
  font-size: 16px;
}

.masking-site-form {
  gap: 22px;
  padding-top: 20px;
}

.masking-site-form > .field,
.masking-domain-options,
.masking-content-fieldset,
.masking-upload,
.masking-form-actions {
  max-width: 640px;
}

.masking-domain-options {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.masking-domain-options-heading {
  min-height: 36px;
  justify-content: flex-start;
}

.masking-domain-option {
  min-height: 50px;
}

.masking-domain-option:hover:not(:disabled),
.masking-domain-option[aria-pressed="true"] {
  padding-right: 8px;
  padding-left: 8px;
}

.masking-content-switch {
  gap: 1px;
}

.masking-content-switch label {
  min-height: 42px;
  justify-content: flex-start;
  padding-right: 14px;
  padding-left: 14px;
}

.masking-upload-target {
  min-height: 60px;
  grid-template-columns: minmax(0, 1fr);
}

.masking-form-actions {
  justify-content: flex-start;
}

.masking-checks {
  border-top: 1px solid var(--line);
  border-right: 0;
  border-bottom: 1px solid var(--line);
  border-left: 0;
  border-radius: 0;
}

.masking-checks dt {
  margin-bottom: 5px;
}

.masking-recommendation {
  grid-template-columns: minmax(0, 1fr);
  max-width: 640px;
  margin-bottom: 12px;
  padding: 10px 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.masking-recommendation-limited,
.masking-recommendation-unsuitable {
  background: transparent;
}

.masking-preview-actions {
  justify-content: flex-start;
}

.masking-reality-row {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.masking-reality-row > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.masking-reality-row:hover {
  background: transparent;
}

.masking-reality-row small {
  font-size: 11px;
}

@media (max-width: 640px) {
  .routing-set-primary,
  .set-entry-grid-primary {
    grid-template-columns: 1fr;
  }

  .set-entry-grid-primary .field-match-primary {
    grid-column: auto;
  }

  .routing-form-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .relay-tabs {
    flex-wrap: wrap;
    margin-right: 0;
    padding-right: 0;
    overflow-x: visible;
  }

  .relay-choice-table {
    min-width: 0;
  }

  .relay-choice-table thead {
    display: none;
  }

  .relay-choice-table,
  .relay-choice-table tbody,
  .relay-choice-table tr,
  .relay-choice-table td {
    display: block;
    width: 100%;
  }

  .relay-choice-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }

  .relay-choice-table td,
  .relay-choice-table td:first-child,
  .relay-choice-table td:last-child {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 8px;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .relay-choice-table td::before {
    flex: 0 0 auto;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
  }

  .relay-choice-table td:first-child {
    grid-column: 1 / -1;
  }

  .relay-choice-table td:first-child::before {
    display: none;
  }

  .relay-choice-table td:last-child {
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-start;
    margin-top: 2px;
  }

  .relay-choice-table tbody tr.is-current td:first-child {
    padding-left: 8px;
  }

  .masking-checks {
    grid-template-columns: 1fr 1fr;
  }

  .masking-checks > div:nth-child(2n) {
    border-right: 0;
  }

  .masking-checks > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .masking-checks > div:last-child {
    border-bottom: 0;
  }

  .friendly-rulesets {
    min-width: 0;
  }

  .friendly-rulesets thead {
    display: none;
  }

  .friendly-rulesets,
  .friendly-rulesets tbody,
  .friendly-rulesets tr,
  .friendly-rulesets td {
    display: block;
    width: 100%;
  }

  .friendly-rulesets tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }

  .friendly-rulesets td,
  .friendly-rulesets td:first-child {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 8px;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .friendly-rulesets td::before {
    flex: 0 0 auto;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
  }

  .friendly-rulesets td:first-child {
    grid-column: 1 / -1;
  }

  .friendly-rulesets td:first-child::before {
    display: none;
  }

  .friendly-rulesets td:nth-child(3) {
    justify-content: flex-end;
  }

  .friendly-rulesets td.row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .friendly-rulesets td.row-actions::before {
    display: none;
  }

  .relay-profile-table {
    min-width: 0;
  }

  .relay-profile-table thead {
    display: none;
  }

  .relay-profile-table,
  .relay-profile-table tbody,
  .relay-profile-table tr,
  .relay-profile-table td {
    display: block;
    width: 100%;
  }

  .relay-profile-table tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }

  .relay-profile-table td,
  .relay-profile-table td:first-child,
  .relay-profile-table td:last-child {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 8px;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .relay-profile-table td::before {
    flex: 0 0 auto;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
  }

  .relay-profile-table td:first-child {
    grid-column: 1 / -1;
  }

  .relay-profile-table td:first-child::before {
    display: none;
  }

  .relay-profile-table td:last-child {
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-start;
  }

  .relay-profile-table td:nth-child(2) {
    align-items: flex-start;
  }

  .relay-profile-table td:nth-child(2)::before {
    margin-top: 2px;
  }

  .relay-profile-table strong,
  .relay-profile-table code {
    overflow-wrap: break-word;
    word-break: normal;
  }
}

@media (max-width: 420px) {
  .masking-checks {
    grid-template-columns: 1fr;
  }

  .masking-checks > div,
  .masking-checks > div:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .masking-checks > div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .relay-choice-table tr {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }

  .relay-choice-table td:nth-child(2),
  .relay-choice-table td:nth-child(3),
  .relay-choice-table td:nth-child(4) {
    display: flex;
    align-items: center;
    padding: 0;
  }

  .relay-choice-table td:nth-child(2) {
    grid-column: 1;
    justify-self: start;
  }

  .relay-choice-table td:nth-child(3) {
    grid-column: 2;
    justify-self: end;
  }

  .relay-choice-table td:nth-child(4) {
    grid-column: 1 / -1;
  }

  .relay-choice-table td:nth-child(n + 2)::before,
  .relay-choice-table .row-actions::before {
    display: none;
  }

  .relay-choice-latency {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
  }
}

/* Relay and Reality task surfaces */
.relay-workspace,
.relay-group-panel,
.relay-history-panel,
.relay-selection-panel,
.relay-manual-selection-panel,
.relay-policy-panel,
.relay-members-panel,
.relay-available-panel,
.relay-confirm-panel,
.relay-connection-form {
  width: min(100%, 1080px);
}

.relay-now-panel,
.relay-selection-panel,
.relay-manual-selection-panel,
.relay-policy-panel,
.relay-members-panel,
.relay-available-panel {
  margin-bottom: 16px;
}

.relay-now-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, auto) auto;
  align-items: center;
  gap: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.relay-now-main,
.relay-now-latency,
.relay-selected-connection > div,
.relay-profile-choice {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.relay-now-main small,
.relay-now-latency small,
.relay-selected-connection small,
.relay-confirm-change small {
  color: var(--muted);
  font-size: 11px;
}

.relay-now-main strong,
.relay-now-main span,
.relay-profile-choice strong,
.relay-profile-choice small,
.relay-selected-connection strong,
.relay-selected-connection span {
  overflow-wrap: anywhere;
}

.relay-now-main span,
.relay-profile-choice small,
.relay-selected-connection span {
  color: var(--muted);
  font-size: 12px;
}

.relay-now-empty {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.relay-catalog-section {
  padding-top: 10px;
}

.relay-section-heading {
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 12px;
}

.relay-section-heading > div:first-child {
  display: grid;
  gap: 3px;
}

.relay-section-heading > div:first-child > span {
  color: var(--muted);
  font-size: 12px;
}

.relay-section-actions,
.relay-text-actions,
.relay-footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.relay-section-actions {
  justify-content: flex-end;
  font-size: 12px;
  font-weight: 650;
}

.relay-source-block {
  margin-top: 14px;
}

.relay-endpoint {
  display: inline-block;
  max-width: 360px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.relay-choice-table,
.relay-source-table,
.relay-profile-table,
.relay-group-table,
.relay-history-table,
.relay-member-table,
.relay-available-table {
  min-width: 720px;
}

.relay-choice-table td,
.relay-source-table td,
.relay-profile-table td,
.relay-group-table td,
.relay-history-table td,
.relay-member-table td,
.relay-available-table td {
  white-space: normal;
}

.relay-text-actions {
  min-width: 250px;
  justify-content: flex-end;
}

.relay-text-actions form,
.relay-text-actions .button,
.relay-selection-panel form,
.relay-confirm-panel form {
  margin: 0;
}

.relay-danger-link {
  color: var(--danger);
}

.relay-simple-form {
  width: min(100%, 680px);
}

.relay-simple-form > form {
  display: grid;
  gap: 18px;
}

.relay-selected-connection {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.relay-selected-connection > div:last-child {
  flex: 0 0 auto;
  text-align: right;
}

.relay-selection-form {
  margin: 18px 0 0;
}

.relay-selection-form .switch-profile-list {
  border-top: 1px solid var(--line);
}

.relay-selection-form .switch-profile {
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
}

.relay-selection-form .switch-profile.current {
  padding-left: 10px;
}

.relay-apply-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.relay-policy-panel {
  max-width: 760px;
}

.relay-policy-panel .panel-heading > div {
  display: grid;
  gap: 4px;
}

.relay-policy-panel .panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.relay-selection-settings {
  display: grid;
}

.relay-policy-panel .field-control > .segmented-radio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.relay-policy-panel .field-control > .segmented-radio label {
  min-height: 44px;
  font-size: 12px;
}

.relay-policy-panel .field-control > .segmented-radio input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
}

.relay-policy-panel .field-control > .segmented-radio label:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.relay-mode-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.relay-manual-selection-panel {
  max-width: 760px;
}

.relay-members-panel {
  padding: 0;
  overflow: hidden;
}

.relay-members-panel > .panel-heading {
  padding: 20px 20px 14px;
}

.relay-members-panel > .panel-heading > div {
  display: grid;
  gap: 4px;
}

.relay-members-panel > .panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.relay-member-list {
  display: grid;
  margin: 0;
  padding: 0 20px;
  list-style: none;
}

.relay-member-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px 16px;
  min-width: 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.relay-member-order {
  display: grid;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  background: var(--surface-strong);
  border-radius: 4px;
}

.relay-member-profile {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.relay-member-profile strong,
.relay-member-profile small {
  overflow-wrap: anywhere;
}

.relay-member-profile small {
  color: var(--muted);
  font-size: 12px;
}

.relay-member-status {
  min-width: 0;
}

.relay-member-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.relay-member-actions form {
  margin: 0;
}

.relay-add-dialog {
  width: min(92vw, 680px);
}

.relay-add-search {
  margin: 0;
}

.relay-add-list {
  display: grid;
  max-height: min(56vh, 520px);
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.relay-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.relay-add-row:first-child {
  border-top: 0;
}

.relay-add-profile {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.relay-add-profile strong,
.relay-add-profile small {
  overflow-wrap: anywhere;
}

.relay-add-profile small {
  color: var(--muted);
  font-size: 12px;
}

.relay-add-row form {
  margin: 0;
}

.relay-add-empty {
  padding: 20px 0;
  color: var(--muted);
  text-align: center;
}

.relay-members-empty {
  min-height: 76px;
  padding: 0 20px 20px;
  color: var(--muted);
}

.relay-change-arrow {
  display: inline-block;
  margin: 0 8px;
  color: var(--muted);
}

.relay-confirm-panel {
  max-width: 760px;
}

.relay-confirm-change {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.relay-confirm-change > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.relay-confirm-change > div:last-child {
  text-align: right;
}

.relay-confirm-change strong {
  overflow-wrap: anywhere;
}

.reality-site-editor-standalone {
  width: min(100%, 760px);
}

.reality-site-current {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 14px 0 16px;
}

.reality-site-form {
  gap: 12px;
  padding-top: 18px;
}

.reality-site-facts {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.reality-site-fact dd {
  display: block;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .page-heading {
    flex-wrap: wrap;
  }

  .page-actions .button {
    width: auto;
    min-height: 44px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .panel-heading-actions .button {
    min-height: 44px;
    white-space: nowrap;
  }

  .page-actions .button span {
    display: inline;
  }

  .async-status {
    top: 76px;
    right: 18px;
    left: 18px;
    justify-content: center;
    max-width: none;
    text-align: center;
  }

  .routing-row-actions {
    min-width: 0;
  }

  .routing-row-actions .button,
  .relay-workspace .button,
  .relay-selection-panel .button,
  .relay-policy-panel .button,
  .relay-simple-form .button,
  .relay-confirm-panel .button,
  .relay-filter .button {
    min-height: 44px;
  }

  .relay-now-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .relay-now-row > .button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .relay-choice-table,
  .relay-source-table,
  .relay-profile-table,
  .relay-group-table,
  .relay-history-table,
  .relay-member-table,
  .relay-available-table {
    min-width: 0;
  }

  .relay-choice-table thead,
  .relay-source-table thead,
  .relay-profile-table thead,
  .relay-group-table thead,
  .relay-history-table thead,
  .relay-member-table thead,
  .relay-available-table thead {
    display: none;
  }

  .relay-choice-table,
  .relay-choice-table tbody,
  .relay-choice-table tr,
  .relay-choice-table td,
  .relay-source-table,
  .relay-source-table tbody,
  .relay-source-table tr,
  .relay-source-table td,
  .relay-profile-table,
  .relay-profile-table tbody,
  .relay-profile-table tr,
  .relay-profile-table td,
  .relay-group-table,
  .relay-group-table tbody,
  .relay-group-table tr,
  .relay-group-table td,
  .relay-history-table,
  .relay-history-table tbody,
  .relay-history-table tr,
  .relay-history-table td,
  .relay-member-table,
  .relay-member-table tbody,
  .relay-member-table tr,
  .relay-member-table td,
  .relay-available-table,
  .relay-available-table tbody,
  .relay-available-table tr,
  .relay-available-table td {
    display: block;
    width: 100%;
  }

  .relay-choice-table tr,
  .relay-source-table tr,
  .relay-profile-table tr,
  .relay-group-table tr,
  .relay-history-table tr,
  .relay-member-table tr,
  .relay-available-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
  }

  .relay-choice-table td,
  .relay-choice-table td:first-child,
  .relay-choice-table td:last-child,
  .relay-source-table td,
  .relay-source-table td:first-child,
  .relay-source-table td:last-child,
  .relay-profile-table td,
  .relay-profile-table td:first-child,
  .relay-profile-table td:last-child,
  .relay-group-table td,
  .relay-group-table td:first-child,
  .relay-group-table td:last-child,
  .relay-history-table td,
  .relay-history-table td:first-child,
  .relay-history-table td:last-child,
  .relay-member-table td,
  .relay-member-table td:first-child,
  .relay-member-table td:last-child,
  .relay-available-table td,
  .relay-available-table td:first-child,
  .relay-available-table td:last-child {
    display: grid;
    grid-template-columns: minmax(88px, .34fr) minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 0;
    border: 0;
  }

  .relay-choice-table td::before,
  .relay-source-table td::before,
  .relay-profile-table td::before,
  .relay-group-table td::before,
  .relay-history-table td::before,
  .relay-member-table td::before,
  .relay-available-table td::before {
    display: block;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
  }

  .relay-choice-table .row-actions,
  .relay-source-table .row-actions,
  .relay-profile-table .row-actions,
  .relay-group-table .row-actions,
  .relay-history-table .row-actions,
  .relay-member-table .row-actions,
  .relay-available-table .row-actions {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  .relay-choice-table .row-actions::before,
  .relay-source-table .row-actions::before,
  .relay-profile-table .row-actions::before,
  .relay-group-table .row-actions::before,
  .relay-history-table .row-actions::before,
  .relay-member-table .row-actions::before,
  .relay-available-table .row-actions::before {
    width: 100%;
  }

  .relay-text-actions {
    min-width: 0;
  }

  .relay-text-actions .button,
  .relay-choice-table .button,
  .relay-source-table .button,
  .relay-profile-table .button,
  .relay-group-table .button,
  .relay-history-table .button,
  .relay-member-table .button,
  .relay-available-table .button {
    min-height: 44px;
  }

  .relay-choice-table .status-badge,
  .relay-source-table .status-badge,
  .relay-profile-table .status-badge,
  .relay-group-table .status-badge,
  .relay-member-table .status-badge,
  .relay-available-table .status-badge {
    max-width: 100%;
    white-space: normal;
  }

  .relay-member-list {
    padding: 0 16px;
  }

  .relay-member-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas:
      "order profile"
      ". status"
      "actions actions";
    align-items: start;
    gap: 12px;
    padding: 16px 0;
  }

  .relay-member-order {
    grid-area: order;
  }

  .relay-member-profile {
    grid-area: profile;
  }

  .relay-member-status {
    grid-area: status;
    justify-self: start;
  }

  .relay-member-actions {
    display: grid;
    grid-area: actions;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .relay-member-actions form,
  .relay-member-actions .button {
    width: 100%;
  }

  .relay-member-actions .button {
    min-height: 44px;
    justify-content: center;
  }

  .relay-add-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "profile status"
      "profile action";
    align-items: start;
  }

  .relay-add-profile {
    grid-area: profile;
  }

  .relay-add-status {
    grid-area: status;
    justify-self: end;
  }

  .relay-add-row form {
    grid-area: action;
    justify-self: end;
  }

  .relay-add-row .button {
    min-height: 44px;
  }

  .relay-confirm-change {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .relay-confirm-change > span {
    transform: rotate(90deg);
  }

  .relay-confirm-change > div:last-child {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .relay-section-heading,
  .relay-now-empty,
  .relay-selected-connection,
  .reality-site-result-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .relay-section-actions {
    justify-content: flex-start;
  }

  .relay-now-row {
    grid-template-columns: 1fr;
  }

  .relay-now-latency,
  .relay-selected-connection > div:last-child {
    text-align: left;
  }

  .relay-selection-form .switch-profile {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .relay-selection-form .switch-profile .status-badge {
    grid-column: 2;
    justify-self: start;
  }

  .relay-policy-panel .field-control > .segmented-radio {
    grid-template-columns: minmax(0, 1fr);
  }

  .reality-site-form {
    grid-template-columns: 1fr;
  }

  .reality-site-form .button,
  .reality-site-apply .button {
    width: 100%;
    justify-content: center;
  }

  .reality-site-facts {
    grid-template-columns: 1fr;
  }

  .reality-site-fact {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reality-site-fact:last-child {
    border-bottom: 0;
  }
}

/* Keep high-frequency data readable on narrow screens instead of clipping a wide grid. */
@media (max-width: 760px) {
  .dashboard-grid .table-wrap {
    overflow: visible;
  }

  .dashboard-subscription-table,
  .dashboard-subscription-table tbody,
  .dashboard-subscription-table tr,
  .dashboard-subscription-table td,
  .subscription-catalog-table,
  .subscription-catalog-table tbody,
  .subscription-catalog-table tr,
  .subscription-catalog-table td {
    display: block;
    width: 100%;
  }

  .dashboard-subscription-table thead,
  .subscription-catalog-table thead {
    display: none;
  }

  .dashboard-subscription-table tr,
  .subscription-catalog-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-subscription-table td,
  .subscription-catalog-table td:not(.subscription-select-cell) {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(92px, .38fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .dashboard-subscription-table td::before,
  .subscription-catalog-table td[data-label]::before {
    display: block;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.35;
    text-transform: uppercase;
  }

  .dashboard-subscription-table td:first-child,
  .subscription-catalog-table td[data-label="Абонент"] {
    grid-column: 1 / -1;
  }

  .dashboard-subscription-table td:first-child::before,
  .subscription-catalog-table td[data-label="Абонент"]::before {
    display: block;
  }

  .relay-choice-table td:first-child,
  .relay-source-table td:first-child,
  .relay-profile-table td:first-child,
  .relay-group-table td:first-child,
  .relay-history-table td:first-child,
  .relay-member-table td:first-child,
  .relay-available-table td:first-child {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .relay-profile-table td:nth-child(2) {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .relay-profile-table td:nth-child(2)::before {
    display: none;
  }

  .relay-profile-table .row-actions::before {
    display: none;
  }

  .relay-choice-table td:first-child::before,
  .relay-source-table td:first-child::before,
  .relay-profile-table td:first-child::before,
  .relay-group-table td:first-child::before,
  .relay-history-table td:first-child::before,
  .relay-member-table td:first-child::before,
  .relay-available-table td:first-child::before {
    display: none;
  }

  .dashboard-subscription-table td strong,
  .subscription-catalog-table td strong {
    overflow-wrap: break-word;
    word-break: normal;
  }

  .subscription-catalog-table td.subscription-select-cell {
    display: flex;
    min-height: 24px;
    align-items: center;
    padding: 0;
    border: 0;
  }

  .subscription-catalog-table td.subscription-select-cell::before {
    display: none;
  }

  .dashboard-subscription-table td.empty-cell,
  .subscription-catalog-table td.empty-cell {
    display: block;
    padding: 14px 0;
  }

  .subscription-panel-heading {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .subscription-panel-heading .bulk-actions {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 84px;
    gap: 8px;
  }

  .subscription-panel-heading .bulk-actions select,
  .subscription-panel-heading .bulk-actions input[type="number"] {
    width: 100%;
    min-width: 0;
  }

  .subscription-panel-heading .bulk-actions .button {
    width: 100%;
    grid-column: 1 / -1;
    justify-content: center;
  }

  main .table-wrap:has(table[data-mobile-table]) {
    overflow: visible;
  }

  main .table-wrap table[data-mobile-table],
  main .table-wrap table[data-mobile-table] tbody,
  main .table-wrap table[data-mobile-table] tr,
  main .table-wrap table[data-mobile-table] td {
    display: block;
    width: 100%;
  }

  main .table-wrap table[data-mobile-table] thead {
    display: none;
  }

  main .table-wrap table[data-mobile-table] tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
  }

  main .table-wrap table[data-mobile-table] td {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(92px, .38fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  main .table-wrap table[data-mobile-table] td,
  main .table-wrap table[data-mobile-table] td > * {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  main .table-wrap table[data-mobile-table] td[data-label]::before {
    display: block;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.35;
    text-transform: uppercase;
  }

  main .table-wrap table[data-mobile-table] td.row-actions {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  main .table-wrap table[data-mobile-table] td.row-actions::before {
    width: 100%;
  }

  main .table-wrap table[data-mobile-table] td.empty-cell {
    display: block;
    padding: 14px 0;
  }
}

@media (max-width: 420px) {
  .section-tabs,
  .relay-tabs,
  .routing-tabs {
    align-content: stretch;
    flex-wrap: wrap;
    overflow: visible;
  }

  .section-tabs a,
  .relay-tabs a {
    min-width: 0;
    min-height: 42px;
    flex: 1 1 auto;
    justify-content: center;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  .section-tabs-secondary a {
    flex-basis: calc(50% - 2px);
  }

  .quick-action strong,
  .quick-action small,
  .health-row strong,
  .check-item strong,
  .check-item span,
  .relay-node strong,
  .flow-node strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .channel-version-row strong,
  .metric-strip small,
  .metric-strip strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }
}
