* {
  box-sizing: border-box;
}

.is-hidden {
  display: none !important;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #18212f;
  font-family: Arial, sans-serif;
}

header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d9e0ea;
  display: flex;
  justify-content: space-between;
  padding: 20px 28px;
}

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

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

h3 {
  font-size: 15px;
  margin: 18px 0 8px;
}

header p {
  color: #657184;
  margin-top: 4px;
}

.muted {
  color: #657184;
  margin-bottom: 12px;
}

main {
  margin: 0 auto;
  max-width: 1320px;
  padding: 24px;
}

.login {
  max-width: 420px;
  padding-top: 80px;
}

.panel {
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  margin-bottom: 20px;
  padding: 18px;
}

.nodes-toolbar {
  align-items: flex-start;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.nodes-toolbar h2 {
  margin-bottom: 6px;
}

.nodes-toolbar .muted {
  margin-bottom: 0;
}

.nodes-toolbar > button {
  flex: 0 0 auto;
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.operation-result h3:first-child {
  margin-top: 0;
}

.control-update-content {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.control-update-summary {
  display: grid;
  gap: 14px 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.control-update-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.control-update-summary .span-2 {
  grid-column: 1 / -1;
}

.control-update-summary span {
  color: #64748b;
  font-size: 12px;
}

.control-update-summary strong,
.control-update-summary code {
  color: #0f172a;
  overflow-wrap: anywhere;
}

.control-update-summary code {
  background: #f1f5f9;
  border-radius: 4px;
  padding: 7px 8px;
}

.control-update-form {
  display: grid;
  gap: 16px;
}

.control-update-server-path {
  border: 1px solid #d9e0ea;
  border-radius: 6px;
  padding: 12px 14px;
}

.control-update-server-path summary {
  color: #42526a;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.control-update-server-path label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.control-update-upload-progress {
  background: #f4f7fb;
  border: 1px solid #d9e0ea;
  border-radius: 6px;
  display: grid;
  gap: 9px;
  padding: 12px 14px;
}

.control-update-upload-progress > div {
  display: flex;
  justify-content: space-between;
}

.control-update-upload-progress progress {
  accent-color: #2166d5;
  height: 8px;
  width: 100%;
}

.node-wizard {
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  color: #18212f;
  max-height: calc(100vh - 48px);
  max-width: min(760px, calc(100vw - 32px));
  overflow-y: auto;
  padding: 0;
  width: 100%;
}

.node-wizard::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

body:has(.node-wizard[open]),
body:has(.node-settings-dialog[open]),
body:has(.wg-ipam-dialog[open]),
body:has(.cloudflare-dialog[open]),
body:has(.traffic-chart-dialog[open]) {
  overflow: hidden;
}

.wizard-head {
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 20px 22px;
}

.wizard-head h2 {
  margin-bottom: 5px;
}

.wizard-head p {
  color: #64748b;
  font-size: 13px;
}

.icon-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d7dfeb;
  color: #42526a;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 22px;
  height: 34px;
  justify-content: center;
  line-height: 1;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.wizard-progress {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px 22px;
}

.wizard-progress div {
  align-items: center;
  color: #64748b;
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.wizard-progress div + div::before {
  background: #cbd5e1;
  content: "";
  height: 1px;
  margin-right: 12px;
  width: 100%;
}

.wizard-progress div:only-child {
  grid-column: 1 / -1;
}

.wizard-progress span {
  align-items: center;
  background: #e2e8f0;
  border-radius: 50%;
  color: #475569;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 700;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.wizard-progress .active {
  color: #1756b2;
  font-weight: 700;
}

.wizard-progress .active span,
.wizard-progress .complete span {
  background: #1664d9;
  color: #ffffff;
}

.wizard-step {
  padding: 22px;
}

.wizard-step[hidden] {
  display: none;
}

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

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

.wizard-actions {
  align-items: center;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
}

.wizard-install-progress {
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: grid;
  gap: 12px;
  grid-template-columns: 120px minmax(0, 1fr);
  margin-top: 20px;
  padding: 14px;
}

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

.wizard-install-progress progress {
  height: 8px;
  width: 120px;
}

.wizard-install-progress div {
  display: grid;
  gap: 4px;
}

.wizard-install-progress span {
  color: #64748b;
  font-size: 12px;
}

.grid {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(180px, 1fr) 180px auto;
}

.remote-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

label {
  color: #4c5868;
  display: grid;
  font-size: 13px;
  gap: 6px;
}

label.check {
  align-items: center;
  display: flex;
  gap: 8px;
}

label.check input {
  width: auto;
}

input {
  border: 1px solid #c9d2df;
  border-radius: 6px;
  color: #18212f;
  font: inherit;
  padding: 10px 12px;
}

select {
  border: 1px solid #c9d2df;
  border-radius: 6px;
  color: #18212f;
  font: inherit;
  padding: 10px 12px;
}

button {
  background: #1664d9;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  min-height: 39px;
  padding: 9px 14px;
}

button.secondary {
  background: #eef2f7;
  color: #263244;
}

button.danger {
  background: #b42318;
}

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

.alert {
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.alert.ok {
  background: #e8f7ef;
  color: #17633a;
}

.alert.error {
  background: #fdecec;
  color: #9a1b1b;
}

pre {
  background: #101827;
  border-radius: 8px;
  color: #e7edf7;
  overflow-x: auto;
  padding: 14px;
  white-space: pre-wrap;
}

small {
  color: #657184;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
}

.status.healthy {
  background: #e8f7ef;
  color: #17633a;
}

.status.suspect,
.status.recovering {
  background: #fff5db;
  color: #7a5300;
}

.status.degraded {
  background: #fff0d6;
  color: #8a3f00;
}

.status.flapping {
  background: #fce7f3;
  color: #9d174d;
}

.status.offline,
.status.unhealthy,
.status.disabled {
  background: #fdecec;
  color: #9a1b1b;
}

.status.server {
  background: #e8f0ff;
  color: #174ea6;
}

.status.reserved,
.status.network,
.status.broadcast {
  background: #f1f5f9;
  color: #475569;
}

.wg-ipam-dialog,
.cloudflare-dialog {
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  color: #18212f;
  max-height: calc(100vh - 40px);
  max-width: min(1120px, calc(100vw - 40px));
  overflow-y: auto;
  padding: 0;
  width: 100%;
}

.wg-ipam-dialog::backdrop,
.cloudflare-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
}

.wg-ipam-content,
.cloudflare-content {
  display: grid;
  gap: 26px;
  padding: 22px;
}

.wg-settings-section {
  border-bottom: 1px solid #e2e8f0;
  display: grid;
  gap: 16px;
  padding-bottom: 24px;
}

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

.wg-settings-grid label {
  color: #475569;
  display: grid;
  font-size: 13px;
  gap: 6px;
}

.field-help {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.wg-settings-grid .span-2,
.wg-settings-grid .settings-form-action {
  grid-column: 1 / -1;
}

.wg-settings-grid input[readonly] {
  background: #f8fafc;
  color: #64748b;
}

.wg-settings-grid input.secret-ready {
  color: #067647;
}

.wg-settings-grid input.secret-missing {
  color: #b42318;
}

.field-help.secret-ready {
  color: #067647;
}

.field-help.secret-missing {
  color: #b42318;
}

.cloudflare-entity-list {
  display: grid;
  gap: 10px;
}

.cloudflare-entity {
  border: 1px solid #d9e0ea;
  border-radius: 6px;
  overflow: hidden;
}

.cloudflare-entity > summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 14px;
}

.cloudflare-inline-form {
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.cloudflare-inline-form label {
  color: #475569;
  display: grid;
  font-size: 13px;
  gap: 6px;
}

.cloudflare-inline-form .span-2 {
  grid-column: 1 / -1;
}

.cloudflare-node-picker {
  border: 1px solid #d9e0ea;
  border-radius: 6px;
  margin: 0;
  padding: 10px 12px 12px;
}

.cloudflare-node-picker legend {
  color: #475569;
  font-size: 13px;
  padding: 0 5px;
}

.cloudflare-node-picker > div {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cloudflare-node-picker label {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
}

.cloudflare-node-picker input {
  margin: 0;
  width: auto;
}

.cloudflare-node-picker small {
  color: #64748b;
}

.certificate-status {
  align-items: center;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 8px 14px;
  padding: 12px 14px 0;
}

.certificate-action {
  display: flex;
  justify-content: flex-end;
  padding: 0 14px 14px;
}

.legacy-migration-action {
  padding: 14px 0;
}

.wg-ipam-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wg-ipam-summary > div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: grid;
  gap: 7px;
  padding: 14px;
}

.wg-ipam-summary span {
  color: #64748b;
  font-size: 12px;
}

.wg-ipam-summary strong {
  color: #0f172a;
  font-size: 20px;
}

.wg-ipam-section {
  display: grid;
  gap: 12px;
}

.wg-ipam-section-head {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.wg-ipam-section-head h3 {
  margin: 0 0 5px;
}

.wg-ipam-section-head p {
  color: #64748b;
  font-size: 12px;
}

.wg-ipam-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  max-height: 270px;
  overflow: auto;
}

.wg-ipam-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

.wg-ipam-table th,
.wg-ipam-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.wg-ipam-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.wg-ipam-table tr:last-child td {
  border-bottom: 0;
}

.wg-ipam-table code {
  color: #1756b2;
}

.wg-ipam-assignment {
  display: grid;
  gap: 3px;
}

.wg-ipam-assignment small {
  font-size: 11px;
}

.wg-ipam-legend {
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 12px;
}

.wg-ipam-legend span::before {
  background: #e2e8f0;
  border-radius: 3px;
  content: "";
  display: inline-block;
  height: 10px;
  margin-right: 5px;
  width: 10px;
}

.wg-ipam-legend .server::before,
.wg-ipam-cell.server {
  background: #2563eb;
  color: #ffffff;
}

.wg-ipam-legend .allocated::before,
.wg-ipam-cell.allocated {
  background: #10b981;
  color: #ffffff;
}

.wg-ipam-legend .reserved::before,
.wg-ipam-cell.reserved {
  background: #f59e0b;
  color: #3b2a05;
}

.wg-ipam-legend .free::before,
.wg-ipam-cell.free {
  background: #edf1f6;
  color: #64748b;
}

.wg-ipam-map {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(16, minmax(24px, 1fr));
}

.wg-ipam-cell {
  align-items: center;
  aspect-ratio: 1;
  background: #475569;
  border-radius: 4px;
  color: #ffffff;
  display: flex;
  font-size: 11px;
  justify-content: center;
  min-width: 0;
}

.wg-ipam-cell.broadcast {
  background: #e11d48;
}

.wg-ipam-warnings {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #9a3412;
  font-size: 13px;
  padding: 12px;
}

.url {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.empty {
  grid-column: 1 / -1;
  color: #657184;
  text-align: center;
}

.version-bad {
  color: #b42318;
  font-weight: 700;
}

details {
  padding: 4px 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.node-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

.audit-section {
  margin-top: 24px;
}

.audit-table-wrap {
  background: #fff;
  border: 1px solid #d8e0eb;
  border-radius: 8px;
  overflow-x: auto;
}

.audit-table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

.audit-table th,
.audit-table td {
  border-bottom: 1px solid #e5eaf1;
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  color: #607089;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.audit-table td {
  font-size: 13px;
}

.audit-table td:first-child {
  white-space: nowrap;
}

.audit-table code {
  background: transparent;
  color: #52627a;
  overflow-wrap: anywhere;
  white-space: normal;
}

.node-card {
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.09);
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  position: relative;
}

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

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

.node-title strong {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.node-title code {
  background: #edf4ff;
  border-radius: 4px;
  color: #2563eb;
  display: inline-block;
  font-size: 12px;
  margin-top: 6px;
  max-width: 220px;
  overflow-wrap: anywhere;
  padding: 3px 6px;
}

.status-dot {
  border: 3px solid #d9f7eb;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  height: 15px;
  width: 15px;
}

.status-dot.healthy {
  background: #24c486;
}

.status-dot.suspect,
.status-dot.recovering {
  background: #f59e0b;
  border-color: #fff1c2;
}

.status-dot.degraded {
  background: #f97316;
  border-color: #ffedd5;
}

.status-dot.flapping {
  background: #db2777;
  border-color: #fce7f3;
}

.status-dot.offline,
.status-dot.unhealthy,
.status-dot.disabled {
  background: #ef4444;
  border-color: #fee2e2;
}

.node-settings-dialog {
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  color: #18212f;
  max-height: calc(100vh - 48px);
  max-width: min(780px, calc(100vw - 32px));
  overflow-y: auto;
  padding: 0;
  width: 100%;
}

.node-settings-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.settings-head {
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 20px 22px;
}

.settings-head h2 {
  margin-bottom: 6px;
}

.settings-head p {
  color: #64748b;
  font-size: 13px;
}

.settings-head code {
  background: #edf4ff;
  border-radius: 4px;
  color: #2563eb;
  padding: 2px 5px;
}

.settings-tabs {
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 22px;
}

.settings-tabs button {
  background: transparent;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: #64748b;
  flex: 0 0 auto;
  font-size: 13px;
  min-height: 44px;
  padding: 10px 12px 8px;
}

.settings-tabs button.active {
  border-bottom-color: #1664d9;
  color: #1756b2;
  font-weight: 700;
}

.settings-content {
  padding: 22px;
}

.settings-content [data-settings-panel][hidden] {
  display: none;
}

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

.settings-grid label:has(input[name="health_url"]),
.settings-form-action {
  grid-column: 1 / -1;
}

.settings-form-action {
  display: flex;
  justify-content: flex-end;
}

.settings-grid input[readonly] {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

.settings-action-row {
  align-items: center;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 18px;
}

.settings-action-row > div,
.danger-zone > div,
.settings-section-title > div {
  display: grid;
  gap: 5px;
}

.settings-action-row small,
.danger-zone small {
  display: block;
}

.settings-section-title {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.settings-section-title h3 {
  margin: 0;
}

.credential-state {
  background: #f1f5f9;
  border-radius: 999px;
  color: #64748b;
  font-size: 12px;
  padding: 5px 9px;
}

.credential-state.saved {
  background: #e8f7ef;
  color: #17633a;
}

.settings-service-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.remote-operation-progress {
  background: #f8fafc;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding: 13px 14px;
}

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

.remote-progress-head {
  align-items: center;
  display: flex;
  font-size: 13px;
  gap: 14px;
  justify-content: space-between;
}

.remote-progress-head time,
.remote-operation-progress small {
  color: #64748b;
}

.remote-progress-track {
  background: #e2e8f0;
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
  position: relative;
}

.remote-progress-track span {
  animation: remote-progress-slide 1.25s ease-in-out infinite;
  background: #1664d9;
  border-radius: inherit;
  height: 100%;
  left: 0;
  position: absolute;
  width: 38%;
}

@keyframes remote-progress-slide {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(290%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .remote-progress-track span {
    animation-duration: 2.5s;
  }
}

.settings-note {
  color: #9a6700;
  font-size: 13px;
  margin-top: 12px;
}

.danger-zone {
  align-items: end;
  border-top: 1px solid #fecaca;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.2fr);
  margin-top: 26px;
  padding-top: 20px;
}

.danger-zone strong {
  color: #9f1239;
}

.danger-zone form {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(190px, 1fr) auto;
}

.node-meta {
  align-items: center;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
}

.wg-peer-state {
  align-items: center;
  display: inline-flex;
  gap: 5px;
}

.wg-peer-state::before {
  background: #94a3b8;
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.wg-peer-state.active {
  color: #17633a;
}

.wg-peer-state.active::before {
  background: #10b981;
}

.wg-peer-state.inactive {
  color: #64748b;
}

.wg-probe-state {
  align-items: center;
  color: #64748b;
  display: inline-flex;
  gap: 5px;
}

.wg-probe-state::before {
  background: #94a3b8;
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.wg-probe-state.healthy {
  color: #17633a;
}

.wg-probe-state.healthy::before {
  background: #10b981;
}

.wg-probe-state.suspect,
.wg-probe-state.degraded {
  color: #9a6700;
}

.wg-probe-state.suspect::before,
.wg-probe-state.degraded::before {
  background: #f59e0b;
}

.wg-probe-state.unhealthy {
  color: #b42318;
}

.wg-probe-state.unhealthy::before {
  background: #ef4444;
}

.metric-line {
  display: grid;
  gap: 6px;
}

.metric-top {
  align-items: center;
  color: #50617a;
  display: flex;
  font-size: 14px;
  justify-content: space-between;
}

.metric-top strong {
  color: #0f172a;
}

.bar {
  background: #edf1f6;
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}

.bar span {
  background: #3b82f6;
  border-radius: inherit;
  display: block;
  height: 100%;
}

.bar.green span {
  background: #14b8a6;
}

.bar.purple span {
  background: #8b5cf6;
}

.bar.orange span {
  background: #f59e0b;
}

.traffic-row {
  border-bottom: 1px solid #e2e8f0;
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  padding: 13px 0;
}

.traffic-row div {
  display: grid;
  gap: 4px;
}

.traffic-row div + div {
  border-left: 1px solid #e2e8f0;
  padding-left: 16px;
}

.traffic-row span {
  color: #64748b;
  font-size: 13px;
}

.traffic-row strong {
  color: #0f172a;
  font-size: 15px;
}

.traffic-row small {
  color: #64748b;
  font-size: 12px;
}

.nginx-metrics {
  border-bottom: 1px solid #e2e8f0;
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: 14px;
}

.nginx-metrics div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.nginx-metrics span,
.nginx-metrics small {
  color: #64748b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.nginx-metrics strong {
  color: #0f172a;
  font-size: 14px;
}

.traffic-chart {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.chart-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.chart-head > strong {
  color: #334155;
  font-size: 14px;
}

.chart-ranges {
  background: #edf1f6;
  border-radius: 6px;
  display: inline-flex;
  padding: 2px;
}

.chart-ranges button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: #64748b;
  font-size: 12px;
  min-height: 28px;
  padding: 4px 8px;
}

.chart-ranges button.active {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  color: #0f172a;
}

.traffic-chart canvas {
  cursor: pointer;
  display: block;
  height: 140px;
  max-width: 100%;
  width: 100%;
}

.traffic-chart canvas:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.traffic-chart-dialog {
  background: #ffffff;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  color: #18212f;
  max-height: calc(100vh - 40px);
  max-width: min(1120px, calc(100vw - 40px));
  padding: 0;
  width: 100%;
}

.traffic-chart-dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
}

.expanded-chart-head {
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 20px 22px;
}

.expanded-chart-head h2 {
  font-size: 20px;
  margin: 0;
}

.expanded-chart-head p {
  color: #64748b;
  margin: 5px 0 0;
}

.traffic-chart-expanded {
  padding: 20px 22px 22px;
}

.traffic-chart-expanded canvas {
  cursor: default;
  min-height: 280px;
}

.chart-legend {
  color: #64748b;
  display: flex;
  font-size: 12px;
  gap: 16px;
  justify-content: flex-end;
}

.chart-legend span::before {
  border-radius: 50%;
  content: "";
  display: inline-block;
  height: 8px;
  margin-right: 5px;
  width: 8px;
}

.chart-legend .rx::before {
  background: #10b981;
}

.chart-legend .tx::before {
  background: #3b82f6;
}

.node-foot {
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 10px;
  justify-content: space-between;
}

.node-error {
  background: #fff1f2;
  border-radius: 6px;
  color: #9f1239;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 8px 10px;
}

@media (max-width: 760px) {
  header,
  .grid {
    display: block;
  }

  header form,
  .grid label,
  .grid button {
    margin-top: 12px;
  }

  main {
    padding: 16px;
  }

  .nodes-toolbar {
    align-items: stretch;
    display: grid;
  }

  .nodes-toolbar > button {
    width: 100%;
  }

  .toolbar-actions {
    display: grid;
  }

  .toolbar-actions button {
    width: 100%;
  }

  .wg-ipam-dialog,
  .cloudflare-dialog {
    max-height: calc(100vh - 20px);
    max-width: calc(100vw - 20px);
  }

  .wg-ipam-content,
  .cloudflare-content {
    padding: 16px;
  }

  .wg-ipam-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wg-settings-grid {
    grid-template-columns: 1fr;
  }

  .wg-settings-grid .span-2,
  .wg-settings-grid .settings-form-action {
    grid-column: auto;
  }

  .wg-settings-grid .settings-form-action button {
    width: 100%;
  }

  .cloudflare-inline-form.two-columns,
  .cloudflare-node-picker > div {
    grid-template-columns: 1fr;
  }

  .cloudflare-inline-form .span-2 {
    grid-column: auto;
  }

  .wg-ipam-section-head {
    align-items: start;
    display: grid;
  }

  .wg-ipam-table {
    min-width: 780px;
  }

  .wg-ipam-map {
    grid-template-columns: repeat(8, minmax(24px, 1fr));
  }

  .node-wizard {
    max-height: calc(100vh - 20px);
    max-width: calc(100vw - 20px);
  }

  .wizard-head,
  .wizard-step {
    padding: 16px;
  }

  .wizard-progress {
    padding: 12px 16px;
  }

  .wizard-progress div + div::before {
    margin-right: 6px;
  }

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

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

  .wizard-actions {
    align-items: stretch;
    display: grid;
  }

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

  .node-card {
    padding: 16px;
  }

  .node-settings-dialog {
    max-height: calc(100vh - 20px);
    max-width: calc(100vw - 20px);
  }

  .traffic-chart-dialog {
    max-height: calc(100vh - 20px);
    max-width: calc(100vw - 20px);
  }

  .expanded-chart-head,
  .traffic-chart-expanded {
    padding: 16px;
  }

  .traffic-chart-expanded .chart-head {
    align-items: flex-start;
    display: grid;
  }

  .settings-head,
  .settings-content {
    padding: 16px;
  }

  .settings-tabs {
    padding: 0 10px;
  }

  .settings-tabs button {
    padding-left: 9px;
    padding-right: 9px;
  }

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

  .settings-grid label:has(input[name="health_url"]),
  .settings-form-action {
    grid-column: auto;
  }

  .settings-form-action button,
  .settings-service-actions form,
  .settings-service-actions button {
    width: 100%;
  }

  .settings-action-row,
  .settings-section-title {
    align-items: stretch;
    display: grid;
  }

  .settings-action-row button {
    width: 100%;
  }

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

  .danger-zone button {
    width: 100%;
  }
}
