:root {
  --app-footer-height: 54px;
  --app-change-dock-height: 0px;
  --app-admin-prompt-height: 0px;
  --change-row-count: 1;
  --app-header-row-height: 0px;
  --app-tab-height: 46px;
  --app-header-height: calc(var(--app-header-row-height) + var(--app-tab-height));
  --motion-fast: 120ms;
  --motion-standard: 180ms;
  --motion-panel: 220ms;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-standard: cubic-bezier(0.22, 0.72, 0.18, 1);
  --busy-ring-thickness: 2px;
  --busy-ring-speed: 1.6s;
  --busy-ring-long: 108px;
  --busy-ring-short: 64px;
  --surface-canvas: #101216;
  --surface-panel: #131720;
  --surface-raised: #151923;
  --surface-control: #242a35;
  --surface-inset: #0d1016;
  --border-soft: #2b3342;
  --border-strong: #343b49;
  --focus-ring: #3b82f6;
  font-family:
    "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas,
    "Liberation Mono", monospace;
  color: #e5e7eb;
  background: #101216;
  font-synthesis: none;
  height: 100%;
  overflow: hidden;
  scrollbar-color: #4b5568 #101216;
  scrollbar-width: thin;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

::-webkit-scrollbar-track {
  background: #101216;
}

::-webkit-scrollbar-thumb {
  min-height: 36px;
  border: 2px solid #101216;
  border-radius: 999px;
  background: #4b5568;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

::-webkit-scrollbar-corner {
  background: #101216;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  background: #101216;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

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

.ui-button,
.ui-icon-button {
  appearance: none;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-control);
  color: #eef2ff;
  cursor: pointer;
  font-weight: 750;
  line-height: 1;
  overflow: visible;
  text-decoration: none;
  transition:
    background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out),
    opacity var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
}

.ui-button:hover,
.ui-icon-button:hover {
  background: #2d3543;
}

.ui-button:active,
.ui-icon-button:active {
  transform: scale(0.98);
}

.ui-button:focus-visible,
.ui-icon-button:focus-visible,
.ui-details-popover-trigger:focus-visible,
.ui-details-popover-close:focus-visible,
.ui-hover-details:focus-visible,
.ui-tab:focus-visible,
.server-select-button:focus-visible,
.ui-action-menu-popover button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.72);
}

.ui-button:disabled,
.ui-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.ui-button.is-loading:disabled,
.ui-icon-button.is-loading:disabled {
  cursor: progress;
  opacity: 1;
}

.ui-button > :not(.ui-busy-ring),
.ui-icon-button > :not(.ui-busy-ring) {
  position: relative;
  z-index: 1;
}

.ui-button--sm {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.ui-button--md {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 14px;
}

.ui-button--lg {
  min-height: 46px;
  padding: 10px 14px;
  font-size: 14px;
}

.ui-button--primary {
  border-color: #16a34a;
  background: #22c55e;
  color: #04130a;
}

.ui-button--primary:hover {
  background: #4ade80;
}

.ui-button--add,
.ui-icon-button--add {
  border-color: #2b3342;
  background: #202633;
  color: #dbeafe;
}

.ui-button--add:hover,
.ui-icon-button--add:hover {
  border-color: var(--focus-ring);
  background: #182033;
}

.ui-button--danger,
.ui-icon-button--danger {
  color: #fecaca;
}

.ui-button--danger:hover,
.ui-icon-button--danger:hover {
  border-color: rgba(239, 68, 68, 0.52);
  background: rgba(127, 29, 29, 0.34);
}

.ui-icon-button {
  position: relative;
  width: 42px;
  min-width: 42px;
  min-height: 38px;
  overflow: visible;
  padding: 0;
}

.ui-hover-details {
  position: relative;
  outline: none;
  cursor: help;
}

.ui-details-popover-trigger {
  appearance: none;
  font: inherit;
  outline: none;
  text-align: left;
}

.ui-details-popover {
  position: fixed;
  z-index: 90;
  display: grid;
  gap: 8px;
  border: 1px solid #334155;
  border-radius: 5px;
  background: #0d1118;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46);
  color: #e5e7eb;
  padding: 10px;
  animation: ui-popover-in 130ms var(--ease-out);
}

.ui-details-popover::before {
  position: absolute;
  top: -5px;
  left: var(--details-popover-arrow-left);
  width: 8px;
  height: 8px;
  border-top: 1px solid #334155;
  border-left: 1px solid #334155;
  background: #0d1118;
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.ui-details-popover[data-placement="top"]::before {
  top: auto;
  bottom: -5px;
  border: 0;
  border-right: 1px solid #334155;
  border-bottom: 1px solid #334155;
}

.ui-details-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.ui-details-popover-head strong {
  min-width: 0;
  color: #f8fafc;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-details-popover-close {
  display: grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  border: 1px solid #263040;
  border-radius: 4px;
  background: #131923;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.ui-details-popover-close:hover {
  border-color: #3b82f6;
  background: #182033;
  color: #f8fafc;
}

.ui-details-popover-body {
  display: grid;
  gap: 5px;
  color: #a9b4c5;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.ui-details-popover-body p {
  margin: 0;
  overflow-wrap: anywhere;
}

.ui-details-popover-body p:first-child {
  color: #e5e7eb;
}

.ui-button-icon,
.ui-button-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.ui-busy-ring {
  position: absolute;
  display: block;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.ui-busy-ring-segment {
  position: absolute;
  display: block;
  background: #93c5fd;
  box-shadow:
    0 0 8px rgba(96, 165, 250, 0.95),
    0 0 16px rgba(34, 197, 94, 0.36);
  opacity: 0;
}

.ui-busy-ring-segment.top,
.ui-busy-ring-segment.bottom {
  width: var(--busy-ring-long);
  height: var(--busy-ring-thickness);
  background: linear-gradient(90deg, transparent, #60a5fa 24%, #bbf7d0 54%, transparent);
}

.ui-busy-ring-segment.right,
.ui-busy-ring-segment.left {
  width: var(--busy-ring-thickness);
  height: var(--busy-ring-short);
  background: linear-gradient(180deg, transparent, #60a5fa 24%, #bbf7d0 54%, transparent);
}

.ui-busy-ring-segment.top {
  top: 0;
  animation: finder-border-top var(--busy-ring-speed) linear infinite;
}

.ui-busy-ring-segment.right {
  right: 0;
  animation: finder-border-right var(--busy-ring-speed) linear infinite;
}

.ui-busy-ring-segment.bottom {
  bottom: 0;
  animation: finder-border-bottom var(--busy-ring-speed) linear infinite;
}

.ui-busy-ring-segment.left {
  left: 0;
  animation: finder-border-left var(--busy-ring-speed) linear infinite;
}

.ui-tabs {
  position: fixed;
  top: var(--app-header-row-height);
  right: 0;
  left: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: var(--app-tab-height);
  overflow-x: auto;
  border-top: 1px solid #242a35;
  border-bottom: 1px solid var(--border-soft);
  background: #181b22;
  scrollbar-width: none;
  margin: 0;
  padding: 0 18px;
}

.ui-tabs::-webkit-scrollbar {
  display: none;
}

.ui-tab {
  appearance: none;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--app-tab-height);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9aa8bd;
  cursor: pointer;
  font-weight: 750;
  margin: 0;
  padding: 10px 12px 12px;
  transition:
    background-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out);
  white-space: nowrap;
}

.ui-tab:hover {
  background: #1c212b;
  color: #eef2ff;
}

.ui-tab.is-active {
  color: #eff6ff;
}

.ui-tab.is-active::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--focus-ring);
  box-shadow: 0 -6px 18px rgba(59, 130, 246, 0.34);
  content: "";
}

.ui-status-pill {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #1a202b;
  color: #cbd5e1;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 750;
}

.ui-status-pill > :not(.ui-busy-ring) {
  position: relative;
  z-index: 1;
}

.ui-status-pill--ok {
  border-color: rgba(34, 197, 94, 0.38);
  color: #86efac;
}

.ui-status-pill--warning {
  border-color: rgba(245, 158, 11, 0.46);
  color: #fcd34d;
}

.ui-status-pill--error {
  border-color: rgba(239, 68, 68, 0.46);
  color: #fecaca;
}

.ui-status-pill--checking {
  border-color: rgba(59, 130, 246, 0.46);
  color: #bfdbfe;
}

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

.ui-field-label {
  color: #8d99ae;
}

.ui-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.ui-field input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-inset);
  color: #f8fafc;
  outline: none;
  padding: 9px 11px;
}

.ui-field input:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 1px var(--focus-ring);
}

.ui-field-help {
  color: #8d99ae;
  font-size: 12px;
}

.ui-field-help.is-error {
  color: #fcd34d;
}

.ui-action-menu {
  position: relative;
  display: flex;
}

.ui-action-menu-popover {
  position: fixed;
  z-index: 80;
  min-width: 172px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #171c26;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
  padding: 5px;
  transform-origin: top right;
  animation: ui-popover-in var(--motion-standard) var(--ease-out);
}

.ui-action-menu-popover[data-placement="top"] {
  transform-origin: bottom right;
}

.ui-action-menu-popover button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #e5e7eb;
  cursor: pointer;
  font: inherit;
  padding: 7px 9px;
  text-align: left;
}

.ui-action-menu-popover button:hover {
  background: #242a35;
}

.ui-action-menu-popover button.is-danger {
  color: #fecaca;
}

.ui-action-menu-popover button.is-danger:hover {
  background: rgba(127, 29, 29, 0.42);
}

.ui-service-row {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  justify-content: stretch;
  min-height: 56px;
  overflow: visible;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: var(--surface-raised);
  padding: 12px;
}

.ui-service-row > :not(.ui-service-border-glow) {
  position: relative;
  z-index: 1;
}

.ui-service-border-glow {
  position: absolute;
  display: none;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
  contain: layout paint;
  pointer-events: none;
  transition: opacity var(--motion-panel) var(--ease-out);
}

.ui-service-row--checking .ui-service-border-glow,
.ui-service-row--working .ui-service-border-glow {
  display: block;
  opacity: 0.78;
}

.ui-service-row--settling .ui-service-border-glow {
  display: block;
  opacity: 0;
  transition-duration: 0.7s;
}

.ui-service-border-glow-segment {
  position: absolute;
  display: block;
  background: #93c5fd;
  box-shadow:
    0 0 8px rgba(96, 165, 250, 0.95),
    0 0 16px rgba(34, 197, 94, 0.36);
  opacity: 0;
}

.ui-service-border-glow-segment.top,
.ui-service-border-glow-segment.bottom {
  width: var(--busy-ring-long);
  height: var(--busy-ring-thickness);
  background: linear-gradient(90deg, transparent, #60a5fa 24%, #bbf7d0 54%, transparent);
}

.ui-service-border-glow-segment.right,
.ui-service-border-glow-segment.left {
  width: var(--busy-ring-thickness);
  height: var(--busy-ring-short);
  background: linear-gradient(180deg, transparent, #60a5fa 24%, #bbf7d0 54%, transparent);
}

.ui-service-border-glow-segment.top {
  top: 0;
  animation: finder-border-top var(--busy-ring-speed) linear infinite;
}

.ui-service-border-glow-segment.right {
  right: 0;
  animation: finder-border-right var(--busy-ring-speed) linear infinite;
}

.ui-service-border-glow-segment.bottom {
  bottom: 0;
  animation: finder-border-bottom var(--busy-ring-speed) linear infinite;
}

.ui-service-border-glow-segment.left {
  left: 0;
  animation: finder-border-left var(--busy-ring-speed) linear infinite;
}

.ui-service-dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.ui-service-row--running .ui-service-dot,
.ui-service-row--installed .ui-service-dot {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.ui-service-row--stopped .ui-service-dot,
.ui-service-row--missing .ui-service-dot {
  background: #f59e0b;
}

.ui-service-row--error .ui-service-dot {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.ui-service-row--checking .ui-service-dot {
  background: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14);
}

.ui-service-text {
  min-width: 0;
}

.ui-service-title-line > strong,
.ui-service-text > span {
  display: block;
  overflow-wrap: anywhere;
}

.ui-service-text > span {
  color: #8d99ae;
}

.ui-service-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ui-service-title-line > strong {
  min-width: 0;
}

.ui-service-inline-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
}

.ui-service-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ui-service-row > .singbox-workspace {
  grid-column: 1 / -1;
}

.log-raw-detail {
  color: #7d8aa0;
  margin-top: 3px;
}

@keyframes ui-popover-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.simple-shell {
  display: block;
  height: 100vh;
  overflow: hidden;
  background: #101216;
  padding: var(--app-header-height) 0 calc(var(--app-footer-height) + var(--app-change-dock-height) + var(--app-admin-prompt-height));
}

.simple-shell.has-change-dock {
  --app-change-dock-height: clamp(60px, calc(20px + (var(--change-row-count) * 26px)), 220px);
}

.simple-shell.has-admin-prompt {
  --app-admin-prompt-height: 56px;
}

.simple-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  min-height: 0;
  height: calc(100vh - var(--app-header-height) - var(--app-footer-height) - var(--app-change-dock-height) - var(--app-admin-prompt-height));
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #101216;
  box-shadow: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 18px 20px;
}

.simple-header,
.section-head,
.add-toolbar,
.process-add-line,
.app-row,
.route-switch,
.singbox-workspace-actions,
.panel-tabs,
.server-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.simple-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 40;
  min-height: var(--app-header-row-height);
  margin: 0;
  background: #181b22;
  padding: 7px 14px;
}

.simple-header small,
.simple-field span,
.app-row-main > div > span,
.config-path,
.finder-card span {
  color: #8d99ae;
}

.simple-header h1,
.section-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.simple-header h1 {
  margin-top: 0;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 650;
}

.simple-header .ghost-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.section-head h2 {
  font-size: 16px;
}

.panel-tabs {
  position: fixed;
  top: var(--app-header-row-height);
  right: 0;
  left: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: var(--app-tab-height);
  overflow-x: auto;
  border-top: 1px solid #242a35;
  border-bottom: 1px solid #2b3342;
  background: #181b22;
  scrollbar-width: none;
  margin: 0;
  padding: 0 18px;
}

.panel-tabs::-webkit-scrollbar {
  display: none;
}

.panel-tabs button {
  appearance: none;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--app-tab-height);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9aa8bd;
  font-weight: 750;
  cursor: pointer;
  margin: 0;
  padding: 10px 12px 12px;
  white-space: nowrap;
}

.panel-tabs button:hover {
  background: #1c212b;
  color: #eef2ff;
}

.panel-tabs button.active {
  background: #181b22;
  color: #eff6ff;
  box-shadow: none;
}

.panel-tabs button.active::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: #3b82f6;
  box-shadow: 0 -6px 18px rgba(59, 130, 246, 0.34);
  content: "";
}

.admin-prompt {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  height: var(--app-admin-prompt-height);
  min-width: 0;
  border-top: 1px solid rgba(245, 158, 11, 0.38);
  background: #17150f;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
  margin: 0;
  padding: 5px 14px;
}

.admin-prompt-icon {
  display: grid;
  place-items: center;
  width: 26px;
  min-width: 26px;
  height: 26px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.42);
  color: #fcd34d;
}

.admin-prompt-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.admin-prompt-copy strong {
  color: #f8fafc;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
}

.admin-prompt-copy span {
  display: -webkit-box;
  color: #c7b489;
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.admin-prompt-action {
  min-width: 190px;
  white-space: nowrap;
}

.tab-panel-frame {
  min-width: 0;
  min-height: 100%;
  height: 100%;
  will-change: opacity, transform;
}

.tab-panel-frame.swipe-right {
  animation: panel-swipe-right 0.24s cubic-bezier(0.22, 0.72, 0.18, 1);
}

.tab-panel-frame.swipe-left {
  animation: panel-swipe-left 0.24s cubic-bezier(0.22, 0.72, 0.18, 1);
}

.tab-panel {
  display: grid;
  gap: 10px;
}

.panel-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #131720;
  padding: 11px 12px;
}

.panel-section-head span {
  display: block;
  color: #8d99ae;
  font-size: 12px;
}

.panel-section-head h2 {
  margin: 2px 0 0;
  color: #eef2ff;
  font-size: 17px;
  letter-spacing: 0;
}

.panel-section-head > strong {
  min-width: 0;
  color: #bfdbfe;
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: right;
}

.proxy-overview {
  position: relative;
  isolation: isolate;
  display: block;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #111720;
  padding: 8px 10px;
}

.proxy-overview > :not(.ui-busy-ring) {
  position: relative;
  z-index: 1;
}

.proxy-overview.ok {
  border-color: rgba(34, 197, 94, 0.36);
}

.proxy-overview.warning {
  border-color: rgba(245, 158, 11, 0.42);
}

.proxy-overview.error {
  border-color: rgba(239, 68, 68, 0.42);
}

.proxy-overview.checking {
  border-color: rgba(59, 130, 246, 0.42);
}

.summary-panel {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  justify-items: center;
  gap: 0;
  min-height: 100%;
  height: 100%;
  width: 100%;
  padding-top: clamp(12px, 3vh, 28px);
}

.summary-brand-title {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
}

.summary-main {
  align-self: stretch;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 288px);
  gap: clamp(22px, 5vw, 54px);
  align-items: center;
  width: min(100%, 760px);
  min-height: 0;
  padding: 0 18px clamp(34px, 10vh, 92px);
}

.summary-status-control {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  align-self: center;
  justify-items: center;
  gap: 14px;
  width: 100%;
  overflow: visible;
  padding: 0;
  text-align: center;
}

.summary-card-label {
  color: #8d99ae;
  font-size: 12px;
  font-weight: 700;
}

.summary-toggle-button {
  appearance: none;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: clamp(180px, 30vw, 268px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.48),
    0 0 38px rgba(59, 130, 246, 0.1);
  cursor: pointer;
  padding: 0;
  transition:
    border-color var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out),
    opacity var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
}

.summary-toggle-button:hover:not(:disabled) {
  box-shadow:
    0 26px 62px rgba(0, 0, 0, 0.54),
    0 0 52px rgba(59, 130, 246, 0.18);
  transform: translateY(-2px);
}

.summary-toggle-button:active:not(:disabled) {
  transform: scale(0.97);
}

.summary-toggle-button:focus-visible {
  outline: 0;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.72),
    0 22px 54px rgba(0, 0, 0, 0.48);
}

.summary-toggle-button > :not(.ui-busy-ring) {
  position: relative;
  z-index: 1;
}

.summary-toggle-button img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
  transform: scale(1.18);
  user-select: none;
}

.summary-state-label {
  color: #e5e7eb;
  font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.summary-state-label.ok {
  color: #bbf7d0;
}

.summary-state-label.warning,
.summary-state-label.checking {
  color: #fcd34d;
}

.summary-state-label.error {
  color: #fecaca;
}

.summary-readout {
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #131720;
  padding: 13px 14px;
}

.summary-readout-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.summary-readout-head span {
  display: block;
  color: #8d99ae;
  font-size: 12px;
  font-weight: 700;
}

.summary-readout-head strong {
  display: block;
  color: #f8fafc;
  font-size: 18px;
  line-height: 1.2;
  margin-top: 2px;
}

.summary-lines {
  display: grid;
  gap: 0;
  margin: 12px 0 0;
}

.summary-lines.compact {
  margin-top: 10px;
}

.summary-lines div {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid #242b38;
  padding: 9px 0;
}

.summary-lines dt,
.summary-lines dd {
  margin: 0;
}

.summary-lines dt {
  color: #8d99ae;
  font-size: 12px;
  font-weight: 750;
}

.summary-lines dd {
  color: #dbe4f0;
  overflow-wrap: anywhere;
}

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

.summary-card {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 5px;
  align-content: start;
  min-height: 104px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #131720;
  color: #dbeafe;
  padding: 11px 12px;
  text-align: left;
}

.summary-card > :not(.ui-busy-ring) {
  position: relative;
  z-index: 1;
}

button.summary-card {
  cursor: pointer;
}

button.summary-card:hover {
  border-color: #3b82f6;
  background: #172033;
}

.summary-card.ok {
  border-color: rgba(34, 197, 94, 0.36);
}

.summary-card.warning {
  border-color: rgba(245, 158, 11, 0.42);
}

.summary-card.error {
  border-color: rgba(239, 68, 68, 0.42);
}

.summary-card.checking {
  border-color: rgba(59, 130, 246, 0.42);
}

.summary-card strong,
.summary-card span {
  overflow-wrap: anywhere;
}

.summary-card strong {
  color: #f8fafc;
  font-size: 15px;
  line-height: 1.25;
}

.summary-card > span:not(.summary-card-label) {
  color: #9aa8bd;
  font-size: 13px;
}

.summary-card.readout {
  cursor: default;
}

.ghost-button,
.add-toolbar button,
.process-add-line button,
.app-row button,
.open-config-button,
.service-button,
.service-menu-button,
.subscription-line button,
.route-switch button,
.singbox-workspace-actions button,
.server-row {
  min-height: 36px;
  border: 1px solid #343b49;
  border-radius: 4px;
  background: #242a35;
  color: #eef2ff;
  padding: 8px 12px;
  cursor: pointer;
}

.ghost-button:hover,
.add-toolbar button:hover,
.process-add-line button:hover,
.app-row button:hover,
.open-config-button:hover,
.service-button:hover,
.service-menu-button:hover,
.subscription-line button:hover,
.route-switch button:hover,
.singbox-workspace-actions button:hover,
.server-row:hover {
  background: #2d3543;
}

.finder-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  justify-content: stretch;
  min-height: 56px;
  overflow: visible;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #151923;
  padding: 12px;
}

.singbox-card {
  margin-top: 10px;
}

.finder-card .finder-border-glow {
  position: absolute;
  display: none;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  opacity: 0;
  contain: layout paint;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.finder-card > :not(.finder-border-glow) {
  position: relative;
  z-index: 1;
}

.finder-card.checking .finder-border-glow,
.finder-card.working .finder-border-glow {
  display: block;
  opacity: 1;
}

.finder-card.checking .finder-border-glow {
  opacity: 0.78;
}

.finder-card.settling .finder-border-glow {
  display: block;
  opacity: 0;
  transition-duration: 0.7s;
}

.finder-border-glow-segment {
  position: absolute;
  display: block;
  background: #93c5fd;
  box-shadow:
    0 0 8px rgba(96, 165, 250, 0.95),
    0 0 16px rgba(34, 197, 94, 0.36);
  opacity: 0;
}

.finder-border-glow-segment.top,
.finder-border-glow-segment.bottom {
  width: var(--busy-ring-long);
  height: var(--busy-ring-thickness);
  background: linear-gradient(90deg, transparent, #60a5fa 24%, #bbf7d0 54%, transparent);
}

.finder-border-glow-segment.right,
.finder-border-glow-segment.left {
  width: var(--busy-ring-thickness);
  height: var(--busy-ring-short);
  background: linear-gradient(180deg, transparent, #60a5fa 24%, #bbf7d0 54%, transparent);
}

.finder-border-glow-segment.top {
  top: 0;
  animation: finder-border-top var(--busy-ring-speed) linear infinite;
}

.finder-border-glow-segment.right {
  right: 0;
  animation: finder-border-right var(--busy-ring-speed) linear infinite;
}

.finder-border-glow-segment.bottom {
  bottom: 0;
  animation: finder-border-bottom var(--busy-ring-speed) linear infinite;
}

.finder-border-glow-segment.left {
  left: 0;
  animation: finder-border-left var(--busy-ring-speed) linear infinite;
}

.finder-text,
.app-row > div,
.app-row-main > div {
  min-width: 0;
}

.finder-text > strong,
.finder-text > span,
.app-row-main strong,
.app-row-main > div > span {
  display: block;
  overflow-wrap: anywhere;
}

.finder-text > strong {
  max-width: 520px;
}

.finder-text > span {
  max-width: 760px;
}

.finder-card .subscription-icon,
.finder-card .server-icon {
  display: grid;
}

.status-light {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #ef4444;
}

.finder-card.found .status-light {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.finder-card.missing .status-light {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12);
}

.finder-card.checking .status-light {
  background: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14);
}

.setup-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #111720;
  padding: 7px 10px;
}

.setup-strip-title {
  color: #8d99ae;
  font-size: 12px;
  font-weight: 800;
}

.setup-strip-items {
  display: flex;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.setup-strip-item {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
  align-items: center;
  min-height: 28px;
  border: 1px solid #2b3342;
  border-radius: 999px;
  background: #151b25;
  color: #dbeafe;
  padding: 5px 9px;
}

.setup-strip-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.11);
}

.setup-strip-item.installed .setup-strip-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.11);
}

.setup-strip-item strong {
  font-size: 12px;
  white-space: nowrap;
}

.setup-strip-item span:not(.setup-strip-dot) {
  color: #9aa8bd;
  font-size: 12px;
  white-space: nowrap;
}

.service-actions {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
}

.service-button {
  min-width: 102px;
  white-space: nowrap;
}

.service-button.stop {
  color: #fecaca;
}

.service-button.install {
  border-color: #166534;
  background: #14532d;
  color: #dcfce7;
  font-weight: 700;
}

.service-button.install:hover {
  background: #166534;
}

.service-menu {
  position: relative;
  display: flex;
}

.service-menu-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
}

.service-menu-button svg {
  display: block;
}

.service-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 6;
  min-width: 172px;
  border: 1px solid #343b49;
  border-radius: 4px;
  background: #171c26;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
  padding: 5px;
}

.service-menu-popover button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #fecaca;
  text-align: left;
  padding: 7px 9px;
  cursor: pointer;
}

.service-menu-popover button:hover {
  background: rgba(127, 29, 29, 0.42);
}

.route-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #151923;
  padding: 10px;
}

.connection-check {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(220px, auto) minmax(132px, auto) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.connection-check-status {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.connection-check-status strong,
.connection-endpoint strong {
  min-width: 0;
  color: #eef2ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-check-status > span {
  color: #8d99ae;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.connection-check-status p {
  color: #9aa8bd;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-probes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
}

.connection-probe {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 24px;
  max-width: 210px;
  border: 1px solid #263040;
  border-radius: 4px;
  background: #0d1016;
  padding: 3px 7px;
  color: #b6c2d4;
  font-size: 12px;
}

.connection-probe.ok {
  border-color: rgba(34, 197, 94, 0.28);
}

.connection-probe.warning {
  border-color: rgba(245, 158, 11, 0.34);
}

.connection-probe.error {
  border-color: rgba(239, 68, 68, 0.34);
}

.connection-probe strong,
.connection-probe span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-probe strong {
  color: #eef2ff;
  font-weight: 800;
}

.connection-probe.ok strong {
  color: #86efac;
}

.connection-probe.error strong {
  color: #fca5a5;
}

.connection-endpoint {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 132px;
  max-width: 260px;
  min-height: 34px;
  border: 1px solid #263040;
  border-radius: 4px;
  background: #0d1016;
  cursor: pointer;
  padding: 0 10px;
}

.connection-endpoint:hover {
  border-color: #3b82f6;
  background: #101827;
}

.connection-check .ui-button {
  width: auto;
  min-width: 104px;
  white-space: nowrap;
}

.external-proxy-card {
  display: grid;
  gap: 9px;
}

.simple-field {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

.route-proxy-field {
  margin: 0;
}

.field-error {
  color: #fcd34d;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.simple-field input,
.process-add-line input,
.subscription-line input {
  min-height: 42px;
  width: 100%;
  border: 1px solid #343b49;
  border-radius: 4px;
  background: #0d1016;
  color: #f8fafc;
  outline: none;
  padding: 9px 11px;
}

.simple-field input:focus,
.process-add-line input:focus,
.subscription-line input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

.singbox-workspace {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  border-top: 1px solid #2b3342;
  margin-top: 2px;
  padding-top: 10px;
}

.setup-summary {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  border: 1px solid #263040;
  border-radius: 999px;
  background: #111720;
  color: #bfdbfe;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.setup-summary:hover {
  border-color: #3b82f6;
  background: #162033;
}

.setup-summary-glyph {
  color: #dbeafe;
  transform: translateY(-0.5px);
}

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

.route-switch button {
  min-height: 38px;
  width: 100%;
  color: #cbd5e1;
  font-weight: 700;
}

.route-switch button.active {
  border-color: #2563eb;
  background: #1d4ed8;
  color: #eff6ff;
}

.route-switch .ui-button--primary {
  border-color: #2563eb;
  background: #1d4ed8;
  color: #eff6ff;
}

.subscription-line {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 112px 42px;
  gap: 7px;
  align-items: center;
}

.subscription-icon,
.server-icon {
  display: grid;
  place-items: center;
  color: #bfdbfe;
}

.subscription-icon {
  width: 38px;
  height: 42px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #0d1016;
}

.subscription-line button {
  min-height: 42px;
  white-space: nowrap;
}

.subscription-line .ui-icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  color: #fecaca;
}

.singbox-workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.singbox-workspace-head > span {
  color: #8d99ae;
  font-size: 12px;
  font-weight: 800;
}

.singbox-workspace-actions {
  justify-content: flex-end;
  gap: 6px;
}

.singbox-workspace-actions .ui-icon-button {
  width: 36px;
  min-width: 36px;
  min-height: 32px;
  padding: 0;
  color: #dbeafe;
}

.server-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 7px;
}

.server-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  justify-content: stretch;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  text-align: left;
  padding: 7px 9px;
}

.server-row .ui-icon-button {
  width: 34px;
  min-width: 34px;
  min-height: 30px;
  padding: 0;
}

.server-row.selected {
  border-color: #2563eb;
  background: #17213a;
}

.server-row.ok {
  border-color: rgba(34, 197, 94, 0.42);
}

.server-row.error {
  border-color: rgba(239, 68, 68, 0.42);
}

.server-select-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.server-select-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  text-align: left;
}

.server-select-dot {
  width: 10px;
  height: 10px;
  border: 1px solid #64748b;
  border-radius: 999px;
  background: #0d1016;
}

.server-row.selected .server-select-dot {
  border-color: #93c5fd;
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

.server-row strong {
  min-width: 0;
  overflow: hidden;
  color: #dbeafe;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.server-ping-badge {
  flex: 0 0 auto;
  border: 1px solid #263040;
  border-radius: 4px;
  color: #bfdbfe;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: 800;
}

.route-chain {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.route-chain--vertical {
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  max-width: 288px;
  margin-top: 0;
}

.route-chain-rail {
  position: absolute;
  z-index: 0;
  top: 28px;
  bottom: 28px;
  left: 13px;
  width: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(96, 165, 250, 0.08),
    rgba(96, 165, 250, 0.34) 28%,
    rgba(34, 197, 94, 0.28) 72%,
    rgba(96, 165, 250, 0.08)
  );
  pointer-events: none;
}

.route-chain--direct .route-chain-rail {
  background: linear-gradient(
    180deg,
    rgba(245, 158, 11, 0.08),
    rgba(245, 158, 11, 0.38) 32%,
    rgba(245, 158, 11, 0.3) 68%,
    rgba(245, 158, 11, 0.08)
  );
}

.route-chain--idle .route-chain-rail {
  background: linear-gradient(
    180deg,
    rgba(100, 116, 139, 0.06),
    rgba(100, 116, 139, 0.24) 48%,
    rgba(100, 116, 139, 0.06)
  );
}

.route-chain-packet {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #93c5fd;
  box-shadow:
    0 0 8px rgba(96, 165, 250, 0.95),
    0 0 16px rgba(34, 197, 94, 0.35);
  transform: translateX(-50%);
  animation: route-packet-flow 2.7s linear infinite;
  animation-delay: -0.15s;
}

.route-chain--direct .route-chain-packet {
  background: #fcd34d;
  box-shadow:
    0 0 8px rgba(245, 158, 11, 0.9),
    0 0 16px rgba(245, 158, 11, 0.28);
}

.route-chain-packet--two {
  animation-delay: -1.05s;
}

.route-chain-packet--three {
  animation-delay: -1.95s;
}

.route-chain-segment {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "dot label arrow"
    "dot value arrow";
  gap: 2px 8px;
  align-items: center;
  min-width: 0;
  min-height: 48px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #111720;
  color: #dbeafe;
  cursor: pointer;
  padding: 8px 9px;
  width: 100%;
}

.route-chain--vertical .route-chain-segment {
  z-index: 1;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "dot label"
    "dot value";
  min-height: 58px;
  background: rgba(17, 23, 32, 0.94);
  padding: 9px 10px 9px 9px;
}

.route-chain-segment > :not(.ui-busy-ring) {
  position: relative;
  z-index: 1;
}

.route-chain-segment:hover {
  border-color: #3b82f6;
  background: #141d2b;
}

.route-chain-segment > span:not(.route-chain-dot):not(.route-chain-arrow) {
  grid-area: label;
  color: #8d99ae;
  font-size: 11px;
  font-weight: 800;
}

.route-chain-segment strong {
  grid-area: value;
  min-width: 0;
  overflow: hidden;
  color: #eef2ff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-chain-dot {
  grid-area: dot;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.12);
}

.route-chain-arrow {
  grid-area: arrow;
  color: #64748b;
  font-weight: 800;
}

.route-chain--vertical .route-chain-arrow {
  position: absolute;
  z-index: 2;
  bottom: -17px;
  left: 9px;
  color: #60a5fa;
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 0 8px rgba(96, 165, 250, 0.52);
}

.route-chain--direct .route-chain-arrow {
  color: #f59e0b;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.42);
}

.route-chain-segment.ok .route-chain-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.route-chain-segment.warning .route-chain-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.route-chain-segment.error .route-chain-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.route-chain-segment.checking .route-chain-dot {
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.14);
}

.apps-section {
  display: grid;
  gap: 9px;
  margin-top: 8px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #10141c;
  padding: 12px;
}

.apps-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 48px;
}

.apps-title {
  min-height: 48px;
  align-items: center;
  justify-content: flex-start;
}

.changes-dock {
  position: fixed;
  right: 0;
  bottom: calc(var(--app-footer-height) + var(--app-admin-prompt-height));
  left: 0;
  z-index: 38;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  height: var(--app-change-dock-height);
  overflow: hidden;
  border-top: 1px solid #2b3342;
  background: #141820;
  box-shadow: 0 -18px 36px rgba(0, 0, 0, 0.22);
  padding: 8px 18px;
}

.changes-dock-main {
  display: grid;
  align-items: center;
  min-width: 0;
  min-height: 0;
}

.change-label {
  color: #8d99ae;
  font-size: 12px;
  font-weight: 750;
}

.changes-list {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}

.change-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 21px;
  padding: 1px 2px;
}

.change-values {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #a9b4c5;
}

.change-values span:not(.change-arrow),
.change-values strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-values strong {
  color: #eef2ff;
}

.change-row.added .change-values strong {
  color: #bbf7d0;
}

.change-row.removed .change-values strong {
  color: #fecaca;
}

.change-arrow {
  flex: 0 0 auto;
  color: #64748b;
  font-weight: 800;
}

.changes-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  justify-items: end;
}

.changes-actions .ui-button {
  width: auto;
  min-width: 178px;
  max-width: 220px;
  min-height: 36px;
  padding-inline: 14px;
  white-space: nowrap;
}

.changes-actions .ui-button-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-head span {
  min-width: 28px;
  height: 30px;
  border: 1px solid #343b49;
  border-radius: 4px;
  background: #1b202b;
  color: #dbeafe;
  padding: 0 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 28px;
}

.add-toolbar {
  justify-content: flex-end;
  padding: 0;
}

.add-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 44px;
  height: 38px;
  border-color: #2b3342;
  background: #202633;
  color: #dbeafe;
  line-height: 0;
  padding: 0;
}

.add-tile svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
  transform: translate(0.5px, 0.5px);
}

.add-tile:hover {
  border-color: #3b82f6;
  background: #182033;
}

.ui-icon-button[data-tooltip]::before,
.ui-icon-button[data-tooltip]::after,
.ui-hover-details[data-tooltip]::before,
.ui-hover-details[data-tooltip]::after,
.server-select-button[data-tooltip]::before,
.server-select-button[data-tooltip]::after,
.add-tile[data-tooltip]::before,
.add-tile[data-tooltip]::after {
  position: absolute;
  left: 50%;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 90ms var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
  transition-delay: 55ms;
}

.ui-icon-button[data-tooltip]::before,
.ui-hover-details[data-tooltip]::before,
.server-select-button[data-tooltip]::before,
.add-tile[data-tooltip]::before {
  bottom: calc(100% + 3px);
  width: 8px;
  height: 8px;
  background: #0d1118;
  border-right: 1px solid #334155;
  border-bottom: 1px solid #334155;
  content: "";
  transform: translate(-50%, 2px) rotate(45deg);
}

.ui-icon-button[data-tooltip]::after,
.ui-hover-details[data-tooltip]::after,
.server-select-button[data-tooltip]::after,
.add-tile[data-tooltip]::after {
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(360px, calc(100vw - 32px));
  border: 1px solid #334155;
  border-radius: 4px;
  background: #0d1118;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
  color: #e5e7eb;
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: break-word;
  padding: 7px 8px;
  transform: translate(-50%, 4px);
  white-space: pre-line;
}

.ui-icon-button[data-tooltip]:hover::before,
.ui-icon-button[data-tooltip]:hover::after,
.ui-icon-button[data-tooltip]:focus-visible::before,
.ui-icon-button[data-tooltip]:focus-visible::after,
.ui-hover-details[data-tooltip]:hover::before,
.ui-hover-details[data-tooltip]:hover::after,
.ui-hover-details[data-tooltip]:focus-visible::before,
.ui-hover-details[data-tooltip]:focus-visible::after,
.server-select-button[data-tooltip]:hover::before,
.server-select-button[data-tooltip]:hover::after,
.server-select-button[data-tooltip]:focus-visible::before,
.server-select-button[data-tooltip]:focus-visible::after,
.add-tile[data-tooltip]:hover::before,
.add-tile[data-tooltip]:hover::after,
.add-tile[data-tooltip]:focus-visible::before,
.add-tile[data-tooltip]:focus-visible::after {
  opacity: 1;
}

.ui-icon-button[data-tooltip]:hover::before,
.ui-icon-button[data-tooltip]:focus-visible::before,
.ui-hover-details[data-tooltip]:hover::before,
.ui-hover-details[data-tooltip]:focus-visible::before,
.server-select-button[data-tooltip]:hover::before,
.server-select-button[data-tooltip]:focus-visible::before,
.add-tile[data-tooltip]:hover::before,
.add-tile[data-tooltip]:focus-visible::before {
  transform: translate(-50%, 0) rotate(45deg);
}

.ui-icon-button[data-tooltip]:hover::after,
.ui-icon-button[data-tooltip]:focus-visible::after,
.ui-hover-details[data-tooltip]:hover::after,
.ui-hover-details[data-tooltip]:focus-visible::after,
.server-select-button[data-tooltip]:hover::after,
.server-select-button[data-tooltip]:focus-visible::after,
.add-tile[data-tooltip]:hover::after,
.add-tile[data-tooltip]:focus-visible::after {
  transform: translate(-50%, 0);
}

.add-tile[aria-pressed="true"] {
  border-color: #3b82f6;
  background: #1e3a8a;
}

.tile-loading {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(59, 130, 246, 0.42);
  border-radius: 4px;
  background: #111720;
  color: #dbeafe;
  font-weight: 800;
  padding: 6px 9px;
}

.app-add-skeleton {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border: 1px dashed #334155;
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.08), transparent),
    #121722;
  background-size: 220% 100%;
  color: #94a3b8;
  padding: 9px 12px;
}

.app-add-main {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.app-add-main strong,
.app-add-main span {
  display: block;
}

.app-add-main strong {
  color: #cbd5e1;
}

.app-add-main span {
  color: #7d8aa0;
  font-size: 13px;
}

.process-add-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 88px;
}

.process-add-line button {
  border-color: #166534;
  background: #14532d;
  font-weight: 700;
}

.process-add-line .process-cancel-button {
  border-color: #343b49;
  background: #242a35;
  color: #cbd5e1;
  font-weight: 600;
}

.process-add-line button:hover {
  background: #166534;
}

.process-add-line .process-cancel-button:hover {
  background: #2d3543;
}

.app-list {
  display: grid;
  gap: 6px;
  margin-top: 1px;
}

.app-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-row .item-icon,
.app-add-main .item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
  width: 34px;
  height: 34px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #0d1016;
  color: #dbeafe;
  line-height: 0;
}

.app-add-main .app-add-icon {
  color: #64748b;
}

.app-row .item-icon svg,
.app-add-main .item-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

.app-row {
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #131720;
  padding: 10px 12px;
}

.app-row button {
  color: #fecaca;
}

.empty-state {
  color: #8d99ae;
  min-height: 30px;
  padding: 6px 2px 2px;
}

.list-skeleton {
  display: grid;
  gap: 8px;
}

.list-skeleton span {
  position: relative;
  isolation: isolate;
  min-height: 56px;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #131720;
}

.subscription-line .ui-button {
  width: 100%;
}

.open-config-button {
  min-height: 46px;
  width: 100%;
}

.config-path {
  margin: 10px 0 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.log-dock {
  position: fixed;
  right: 0;
  bottom: var(--app-admin-prompt-height);
  left: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: var(--app-footer-height);
  border-top: 1px solid #2b3342;
  background: #151923;
  box-shadow: none;
  margin: 0;
  padding: 8px 14px;
}

.log-dock.error {
  border-top-color: rgba(239, 68, 68, 0.58);
}

.log-dock.success {
  border-top-color: rgba(34, 197, 94, 0.58);
}

.log-dock.info {
  border-top-color: rgba(59, 130, 246, 0.58);
}

.log-current {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: baseline;
  padding: 0 8px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.log-current.hidden {
  color: #8d99ae;
  opacity: 0.72;
}

.log-current.visible {
  opacity: 1;
}

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

.log-current strong {
  flex: 0 1 auto;
  min-width: 0;
}

.log-current span {
  min-width: 0;
}

.log-muted {
  color: #8d99ae;
}

.log-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  border: 1px solid #343b49;
  border-radius: 4px;
  background: #242a35;
  color: #eef2ff;
  padding: 6px 10px;
  cursor: pointer;
}

.log-toggle:hover {
  background: #2d3543;
}

.log-toggle .log-count {
  min-width: 22px;
  border-radius: 4px;
  background: #1b202b;
  color: #dbeafe;
  padding: 2px 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.log-history {
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
  max-height: 230px;
  overflow: auto;
  border: 1px solid #2b3342;
  border-bottom: 0;
  background: #151923;
  padding: 7px 14px;
}

.log-history-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid #2b3342;
  border-radius: 4px;
  background: #0d1016;
  padding: 8px;
}

.log-history-row.error {
  border-color: rgba(239, 68, 68, 0.42);
}

.log-history-row.success {
  border-color: rgba(34, 197, 94, 0.36);
}

.log-history-row.info {
  border-color: rgba(59, 130, 246, 0.36);
}

.log-history-row time {
  color: #8d99ae;
  font-size: 12px;
}

.log-history-row strong,
.log-history-row span {
  display: block;
  overflow-wrap: anywhere;
}

.log-history-row span {
  color: #b6c2d4;
}

@keyframes finder-border-top {
  0% {
    left: -116px;
    opacity: 0;
  }

  4%,
  23% {
    opacity: 1;
  }

  25%,
  100% {
    left: calc(100% + 8px);
    opacity: 0;
  }
}

@keyframes finder-border-right {
  0%,
  25% {
    top: -72px;
    opacity: 0;
  }

  29%,
  48% {
    opacity: 1;
  }

  50%,
  100% {
    top: calc(100% + 8px);
    opacity: 0;
  }
}

@keyframes finder-border-bottom {
  0%,
  50% {
    right: -116px;
    opacity: 0;
  }

  54%,
  73% {
    opacity: 1;
  }

  75%,
  100% {
    right: calc(100% + 8px);
    opacity: 0;
  }
}

@keyframes finder-border-left {
  0%,
  75% {
    bottom: -72px;
    opacity: 0;
  }

  79%,
  98% {
    opacity: 1;
  }

  100% {
    bottom: calc(100% + 8px);
    opacity: 0;
  }
}

@keyframes panel-swipe-right {
  from {
    opacity: 0;
    transform: translateX(34px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes panel-swipe-left {
  from {
    opacity: 0;
    transform: translateX(-34px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes route-packet-flow {
  0% {
    top: -8px;
    opacity: 0;
  }

  8%,
  88% {
    opacity: 1;
  }

  100% {
    top: calc(100% + 8px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tab-panel-frame,
  .tab-panel,
  .ui-busy-ring,
  .ui-busy-ring-segment,
  .ui-service-border-glow,
  .finder-card .finder-border-glow,
  .finder-border-glow-segment,
  .ui-service-border-glow-segment,
  .status-light,
  .summary-toggle-button,
  .route-chain-packet {
    animation: none;
    transition: none;
  }
}

@media (max-width: 680px) {
  .simple-shell {
    padding: var(--app-header-height) 0 calc(var(--app-footer-height) + var(--app-change-dock-height) + var(--app-admin-prompt-height));
  }

  .simple-shell.has-change-dock {
    --app-change-dock-height: clamp(104px, calc(82px + (var(--change-row-count) * 25px)), 260px);
  }

  .simple-shell.has-admin-prompt {
    --app-admin-prompt-height: 92px;
  }

  .simple-panel {
    height: calc(100vh - var(--app-header-height) - var(--app-footer-height) - var(--app-change-dock-height) - var(--app-admin-prompt-height));
    padding: 12px 12px 16px;
  }

  .admin-prompt {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    padding: 8px 10px;
  }

  .admin-prompt-copy span {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .admin-prompt-action {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .app-row {
    align-items: stretch;
    flex-direction: column;
  }

  .simple-header {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    margin: 0;
    padding: 7px 10px;
  }

  .simple-header h1 {
    font-size: 16px;
  }

  .simple-header .ghost-button {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .panel-tabs {
    gap: 1px;
    padding: 0 10px;
  }

  .ui-tabs {
    gap: 1px;
    padding: 0 10px;
  }

  .panel-tabs button {
    flex: 1 0 110px;
    min-height: var(--app-tab-height);
    padding: 8px 10px 9px;
    font-size: 13px;
  }

  .ui-tab {
    flex: 1 0 110px;
    min-height: var(--app-tab-height);
    padding: 8px 10px 9px;
    font-size: 13px;
  }

  .panel-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .proxy-overview,
  .panel-section-head > strong {
    text-align: left;
  }

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

  .summary-readout-head {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-lines div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .summary-main {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    gap: 22px;
    padding: 0 10px clamp(24px, 8vh, 64px);
  }

  .summary-status-control {
    width: 100%;
  }

  .summary-toggle-button {
    width: min(202px, 64vw);
  }

  .setup-strip {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .apps-header {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .apps-title {
    min-height: 34px;
  }

  .app-add-skeleton {
    grid-template-columns: 1fr;
  }

  .connection-check {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .connection-probes {
    justify-content: stretch;
  }

  .connection-probe {
    max-width: none;
  }

  .connection-check-status p {
    white-space: normal;
  }

  .connection-endpoint {
    width: 100%;
    max-width: none;
    justify-content: center;
  }

  .connection-check .ui-button {
    width: 100%;
  }

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

  .route-chain--vertical {
    grid-template-columns: 1fr;
    width: min(100%, 300px);
  }

  .add-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .add-toolbar .ui-icon-button,
  .add-tile {
    width: 100%;
  }

  .process-add-line {
    grid-template-columns: 1fr;
  }

  .subscription-line {
    grid-template-columns: 38px minmax(0, 1fr) 42px;
  }

  .subscription-line input {
    grid-column: 2 / 4;
  }

  .subscription-line button:not(.ui-icon-button) {
    grid-column: 1 / 3;
  }

  .subscription-line .ui-icon-button {
    grid-column: 3;
    width: 42px;
  }

  .finder-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ui-service-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .service-actions {
    grid-column: 1 / -1;
  }

  .ui-service-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    width: 100%;
  }

  .ui-service-actions > .ui-button {
    width: 100%;
  }

  .ui-service-actions > .ui-button:only-child {
    grid-column: 1 / -1;
  }

  .setup-strip-items {
    flex-wrap: wrap;
    overflow: visible;
  }

  .service-button {
    flex: 1;
  }

  .singbox-workspace-head {
    align-items: stretch;
    flex-direction: column;
  }

  .singbox-workspace-actions {
    justify-content: flex-end;
    width: 100%;
  }

  .singbox-workspace-actions .ui-icon-button {
    width: 36px;
    min-width: 36px;
  }

  .server-list {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .changes-dock {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px 10px;
  }

  .changes-dock-main {
    grid-template-columns: 1fr;
  }

  .changes-list {
    max-height: none;
  }

  .change-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .change-values {
    min-width: 0;
  }

  .log-dock {
    position: fixed;
    right: 0;
    bottom: var(--app-admin-prompt-height);
    left: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0;
    padding: 7px 10px;
  }

  .log-current {
    align-items: baseline;
    flex-direction: row;
    gap: 8px;
    padding: 0 4px;
  }

  .log-current strong {
    white-space: nowrap;
  }

  .log-current span:not(.log-muted) {
    display: none;
  }

  .log-history {
    max-height: 220px;
    padding: 7px 10px;
  }

  .log-history-row {
    grid-template-columns: 1fr;
  }
}
