:root {
  --canvas: #f5f7f5;
  --surface: #ffffff;
  --surface-soft: #f0f3f1;
  --ink: #17211d;
  --ink-soft: #53605a;
  --ink-faint: #78837e;
  --line: #dce3df;
  --line-strong: #c9d2cd;
  --primary: #126b52;
  --primary-hover: #0d5843;
  --primary-soft: #e7f3ee;
  --accent: #246a9a;
  --warning: #9a650d;
  --warning-soft: #fff4d8;
  --danger: #b43a38;
  --danger-soft: #fae9e8;
  --success: #24704f;
  --success-soft: #e5f4eb;
  --shadow-modal: 0 24px 70px rgba(23, 33, 29, 0.22);
  --radius: 7px;
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
}

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

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(36, 106, 154, 0.24);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1220px, calc(100% - 48px));
  min-height: 64px;
  margin: 0 auto;
}

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

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #bed7cd;
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--primary-soft);
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

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

.brand strong {
  font-size: 15px;
  line-height: 1.35;
}

.brand small {
  margin-top: 1px;
  color: var(--ink-faint);
  font-size: 11px;
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logout {
  min-height: 32px;
  padding: 6px 9px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 3px rgba(120, 131, 126, 0.14);
}

.status-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(36, 112, 79, 0.14);
}

.status-dot.is-error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 58, 56, 0.14);
}

.status-dot.is-pending {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(154, 101, 13, 0.14);
}

.workspace {
  width: min(1220px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 80px;
}

.overview {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line-strong);
}

.overview-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow,
.modal-kicker {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.primary-actions,
.subscription-actions,
.row-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: border-color 130ms ease, background-color 130ms ease, color 130ms ease, opacity 130ms ease;
}

.button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

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

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

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

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

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

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

.button-danger:hover:not(:disabled) {
  border-color: #96302f;
  background: #96302f;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.is-loading {
  pointer-events: none;
}

.button.is-loading svg {
  animation: spin 900ms linear infinite;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 0.75fr)) minmax(220px, 1.25fr);
  margin-top: 30px;
  border: 1px solid var(--line);
  border-right: 0;
  border-left: 0;
  background: rgba(255, 255, 255, 0.46);
}

.metric {
  min-width: 0;
  padding: 17px 20px;
  border-right: 1px solid var(--line);
}

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

.metric span,
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 600;
}

.metric strong {
  display: block;
  overflow: hidden;
  font-size: 16px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subscription-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.subscription-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.subscription-copy code {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subscription-actions {
  flex: 0 0 auto;
}

.page-error {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 15px 16px;
  border: 1px solid #e6b8b7;
  border-radius: var(--radius);
  color: #762d2c;
  background: var(--danger-soft);
}

.page-error[hidden] {
  display: none;
}

.page-error > svg {
  width: 21px;
  height: 21px;
}

.page-error strong,
.page-error p {
  display: block;
  margin: 0;
  font-size: 13px;
}

.page-error p {
  margin-top: 3px;
  color: #8c4543;
}

.data-section {
  padding: 34px 0 30px;
  border-bottom: 1px solid var(--line-strong);
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
}

.table-shell {
  position: relative;
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th {
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-faint);
  background: #f8faf8;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
}

.data-table td {
  height: 62px;
  padding: 10px 14px;
  border-bottom: 1px solid #e9eeeb;
  color: var(--ink-soft);
  font-size: 13px;
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #fbfcfb;
}

.data-table th:first-child,
.data-table td:first-child {
  width: 20%;
}

#sources-table th:nth-child(2),
#sources-table td:nth-child(2) {
  width: 31%;
}

#sources-table th:last-child,
#sources-table td:last-child {
  width: 160px;
}

#exits-table th:first-child,
#exits-table td:first-child {
  width: 18%;
}

#exits-table th:last-child,
#exits-table td:last-child {
  width: 160px;
}

.align-right {
  text-align: right !important;
}

.cell-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.cell-title strong,
.truncate {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.truncate.monospace {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  font-weight: 500;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ink-faint);
  content: "";
}

.status-badge.is-success {
  border-color: #bfdecf;
  color: var(--success);
  background: var(--success-soft);
}

.status-badge.is-success::before {
  background: var(--success);
}

.status-badge.is-warning {
  border-color: #ead49b;
  color: var(--warning);
  background: var(--warning-soft);
}

.status-badge.is-warning::before {
  background: var(--warning);
}

.status-badge.is-error {
  border-color: #e6b8b7;
  color: var(--danger);
  background: var(--danger-soft);
}

.status-badge.is-error::before {
  background: var(--danger);
}

.status-stack {
  min-width: 0;
}

.status-note {
  display: block;
  max-width: 220px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enabled-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.enabled-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}

.row-actions {
  justify-content: flex-end;
}

.row-action {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
}

.row-action:hover {
  border-color: var(--line);
  color: var(--ink);
  background: var(--surface-soft);
}

.row-action.is-danger:hover {
  border-color: #e6b8b7;
  color: var(--danger);
  background: var(--danger-soft);
}

.row-action:disabled {
  cursor: wait;
  opacity: 0.45;
}

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

.row-action.is-loading svg {
  animation: spin 900ms linear infinite;
}

.empty-state {
  display: flex;
  min-height: 126px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state svg {
  width: 22px;
  height: 22px;
}

.empty-state strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.empty-state.compact {
  min-height: 90px;
}

.text-button {
  padding: 2px 4px;
  border: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.table-loading {
  position: absolute;
  inset: 43px 0 0;
  display: grid;
  align-content: center;
  gap: 9px;
  padding: 20px 14px;
  background: var(--surface);
}

.table-loading[hidden] {
  display: none;
}

.table-loading span {
  display: block;
  width: min(520px, 78%);
  height: 9px;
  border-radius: 4px;
  background: #e9eeeb;
  animation: pulse 1.1s ease-in-out infinite alternate;
}

.table-loading span:nth-child(2) {
  width: min(380px, 58%);
  animation-delay: 130ms;
}

.table-loading span:nth-child(3) {
  width: min(450px, 68%);
  animation-delay: 260ms;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border-top: 1px solid var(--line);
}

.history-item:last-child {
  border-bottom: 1px solid var(--line);
}

.history-symbol {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  color: var(--success);
  background: var(--success-soft);
}

.history-symbol.is-error {
  color: var(--danger);
  background: var(--danger-soft);
}

.history-symbol svg {
  width: 14px;
  height: 14px;
}

.history-copy {
  min-width: 0;
}

.history-copy strong,
.history-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.history-copy span,
.history-time {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 11px;
}

.history-time {
  margin: 0;
  white-space: nowrap;
}

.modal,
.confirm-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.modal::backdrop,
.confirm-dialog::backdrop {
  background: rgba(23, 33, 29, 0.45);
  backdrop-filter: blur(2px);
}

.modal-form {
  padding: 24px;
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-heading h2 {
  font-size: 20px;
}

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

.form-field {
  display: block;
  min-width: 0;
}

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

.form-field > span:first-child {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.form-field input,
.form-field select {
  height: 40px;
}

.form-field textarea {
  min-height: 94px;
  padding-top: 10px;
  padding-bottom: 10px;
  resize: vertical;
  line-height: 1.55;
}

.form-field input::placeholder {
  color: #9aa49f;
}

.form-field textarea::placeholder {
  color: #9aa49f;
}

.form-field > small:not(.field-error) {
  display: block;
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.5;
}

.form-field input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  display: block;
  min-height: 0;
  margin-top: 5px;
  color: var(--danger);
  font-size: 11px;
}

.field-error:empty {
  display: none;
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.check-field input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.password-input {
  position: relative;
  display: block !important;
  margin: 0 !important;
}

.password-input input {
  padding-right: 42px;
}

.input-icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: var(--ink-faint);
  background: transparent;
  cursor: pointer;
}

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

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

.modal-actions {
  justify-content: flex-end;
  margin-top: 26px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.confirm-dialog {
  width: min(410px, calc(100% - 28px));
  padding: 26px;
  text-align: center;
}

.confirm-dialog h2 {
  margin: 12px 0 8px;
  font-size: 19px;
}

.confirm-dialog p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.confirm-icon {
  display: grid;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--warning);
  background: var(--warning-soft);
}

.confirm-icon svg {
  width: 20px;
  height: 20px;
}

.modal-actions.centered {
  justify-content: center;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(370px, calc(100% - 40px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(23, 33, 29, 0.14);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
}

.toast > svg {
  width: 18px;
  height: 18px;
  color: var(--success);
}

.toast.is-error > svg {
  color: var(--danger);
}

.toast.is-warning > svg {
  color: var(--warning);
}

.toast-message {
  min-width: 0;
  font-size: 12px;
  line-height: 1.45;
}

.toast-close {
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 5px;
  color: var(--ink-faint);
  background: transparent;
  cursor: pointer;
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #762d2c;
  background: var(--danger-soft);
  font-weight: 650;
}

.clipboard-helper {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.section-footnote {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 12px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.55;
}

.section-footnote svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.segmented-control button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  border: 0;
  border-radius: 5px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.segmented-control button:hover:not(:disabled) {
  color: var(--ink);
}

.segmented-control button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(23, 33, 29, 0.1);
}

.segmented-control button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.segmented-control svg {
  width: 14px;
  height: 14px;
}

.import-mode-tabs {
  margin: -6px 0 20px;
}

.import-panel[hidden] {
  display: none;
}

.inline-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.import-preview {
  margin-top: 17px;
  padding: 15px;
  border: 1px solid #bfd8ce;
  border-radius: 6px;
  background: #f6fbf8;
}

.import-preview[hidden] {
  display: none;
}

.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid #d9e8e1;
}

.preview-heading span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  font-size: 12px;
  font-weight: 650;
}

.preview-heading svg {
  width: 16px;
  height: 16px;
}

.preview-heading strong {
  font-size: 11px;
}

.import-preview dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 10px 0 0;
}

.import-preview dl div {
  min-width: 0;
  padding: 7px 10px 7px 0;
}

.import-preview dt {
  margin-bottom: 3px;
  color: var(--ink-faint);
  font-size: 10px;
}

.import-preview dd {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-ip-field {
  margin-top: 11px;
  padding-top: 12px;
  border-top: 1px solid #d9e8e1;
}

.modal-wide {
  width: min(1120px, calc(100% - 28px));
}

.node-manager {
  min-height: min(700px, calc(100vh - 38px));
}

.node-manager-heading {
  margin-bottom: 18px;
}

.node-manager-heading p {
  margin: 5px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
}

.node-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.5fr);
  align-items: end;
  gap: 16px;
}

.compact-field {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.compact-field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
}

.node-filters {
  justify-self: end;
  max-width: 100%;
  overflow-x: auto;
}

.node-filters button span {
  min-width: 19px;
  padding: 1px 5px;
  border-radius: 8px;
  color: var(--ink-faint);
  background: #e4e9e6;
  font-size: 10px;
}

.node-filters button.is-active span {
  color: var(--primary);
  background: var(--primary-soft);
}

.node-batch-bar {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 14px;
  margin-top: 17px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.node-batch-bar > span {
  flex: 1 1 auto;
  color: var(--ink-faint);
  font-size: 11px;
}

.node-batch-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.node-table-shell {
  position: relative;
  min-height: 260px;
  max-height: calc(100vh - 390px);
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.node-table {
  min-width: 820px;
}

.node-table thead {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--surface);
}

.node-table th:first-child,
.node-table th:nth-child(2),
.node-table td:first-child,
.node-table td:nth-child(2) {
  width: 58px;
  text-align: center;
}

.node-table input[type="checkbox"],
.node-table input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}

.node-name-cell {
  min-width: 140px;
}

.node-name-cell strong,
.node-name-cell span {
  display: block;
  overflow: hidden;
  max-width: 280px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-name-cell span {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 10px;
}

.node-manager-actions {
  margin-top: 0;
}

.node-manager-actions p {
  flex: 1 1 auto;
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.45;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--canvas);
}

.login-shell {
  width: min(410px, 100%);
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 54px rgba(23, 33, 29, 0.1);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

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

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

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

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

.login-panel h1 {
  margin: 0 0 3px;
  font-size: 22px;
}

.login-error {
  margin: -3px 0 0;
  padding: 9px 10px;
  border-left: 3px solid var(--danger);
  color: #762d2c;
  background: var(--danger-soft);
  font-size: 12px;
  line-height: 1.5;
}

.login-error[hidden] {
  display: none;
}

.login-submit {
  width: 100%;
  margin-top: 3px;
}

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

@keyframes pulse {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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

  .subscription-actions {
    flex-wrap: wrap;
  }

  .node-toolbar {
    grid-template-columns: 1fr;
  }

  .node-filters {
    justify-self: stretch;
  }

  .node-batch-bar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .node-batch-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .workspace {
    width: min(100% - 28px, 1220px);
  }

  .header-inner {
    min-height: 58px;
  }

  .brand small {
    display: none;
  }

  .workspace {
    padding-top: 28px;
  }

  .overview-heading {
    align-items: flex-end;
  }

  h1 {
    font-size: 25px;
  }

  .metrics {
    margin-top: 24px;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100% !important;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }

  .data-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 13px;
    border-bottom: 1px solid var(--line);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    min-width: 0;
    height: auto;
    padding: 7px 6px;
    border: 0;
  }

  .data-table td::before {
    display: block;
    margin-bottom: 5px;
    color: var(--ink-faint);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 650;
  }

  .data-table td:first-child,
  .data-table td:nth-child(2),
  .data-table td:last-child {
    grid-column: 1 / -1;
  }

  .data-table td:first-child {
    padding-bottom: 9px;
  }

  .data-table td:last-child {
    margin-top: 5px;
    padding-top: 9px;
    border-top: 1px solid #e9eeeb;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .table-loading {
    inset: 0;
  }

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

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

  .node-table {
    min-width: 0;
  }

  .node-table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .node-table td:first-child,
  .node-table td:nth-child(2) {
    grid-column: auto;
    text-align: left;
  }

  .node-table td:nth-child(3),
  .node-table td:last-child {
    grid-column: 1 / -1;
  }

  .node-table td:last-child {
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid #e9eeeb;
  }

  .node-name-cell strong,
  .node-name-cell span {
    max-width: 100%;
  }

  .node-table-shell {
    max-height: 300px;
    overflow-x: hidden;
  }
}

@media (max-width: 520px) {
  .header-status #header-status-text {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-tools {
    gap: 5px;
  }

  .header-logout span {
    display: none;
  }

  .header-logout {
    width: 32px;
    padding: 6px;
  }

  .overview-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 15px;
  }

  .primary-actions {
    justify-content: space-between;
  }

  .primary-actions .button-primary {
    flex: 1 1 auto;
  }

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

  .metric,
  .metric:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .subscription-actions .button {
    flex: 1 1 calc(50% - 8px);
  }

  .subscription-actions .button span {
    white-space: nowrap;
  }

  .section-heading .button {
    align-self: flex-start;
  }

  .page-error {
    grid-template-columns: auto 1fr;
  }

  .page-error .button {
    grid-column: 1 / -1;
  }

  .history-item {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 8px 0;
  }

  .history-time {
    grid-column: 2;
  }

  .modal-form {
    padding: 18px;
  }

  .import-mode-tabs {
    display: flex;
  }

  .import-mode-tabs button {
    flex: 1 1 50%;
  }

  .import-preview dl {
    grid-template-columns: 1fr;
  }

  .node-manager {
    min-height: calc(100vh - 28px);
  }

  .node-filters button {
    padding-inline: 8px;
  }

  .node-batch-actions .button {
    flex: 1 1 calc(50% - 7px);
  }

  .node-manager-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .node-manager-actions p {
    width: 100%;
    flex-basis: 100%;
  }

  .node-manager-actions .button {
    flex: 1 1 calc(50% - 8px);
  }

  .toast-region {
    right: 14px;
    bottom: 14px;
    width: calc(100% - 28px);
  }

  .login-page {
    padding: 14px;
  }

  .login-panel {
    padding: 22px 18px;
  }
}

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