.portal-page {
  min-height: 100vh;
  padding-top: 72px;
  padding-bottom: 2rem;
}

.portal-page.dashboard-shell {
  padding-top: 72px;
  padding-bottom: 0;
}

.portal-card {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.portal-card-wide {
  max-width: 1080px;
}

.portal-card h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.portal-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.plan-options {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.plan-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.plan-option:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.plan-option input { accent-color: var(--accent); }
.plan-option-info strong { display: block; }
.plan-option-info span { font-size: 0.85rem; color: var(--text-muted); }

.alert {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
  animation: alertIn 0.35s ease;
}

@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--accent-bright);
}

.alert-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--green);
}

.alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

body.portal-modal-open {
  overflow: hidden;
}

.portal-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.portal-modal-root[hidden] {
  display: none !important;
}

.portal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px);
  animation: modalFadeIn 0.2s ease;
}

.portal-modal {
  position: relative;
  width: min(100%, 26rem);
  padding: 1.35rem 1.35rem 1.15rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  animation: modalSlideIn 0.24s ease;
}

.portal-modal-title {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.portal-modal-message {
  margin: 0 0 1.15rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.portal-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.portal-footer-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.portal-footer-link a { color: var(--accent-bright); }

/* ── Auth pages (register / login) ── */
.auth-page {
  min-height: calc(100vh - 72px);
  padding-top: 72px;
  background: var(--bg-dark);
}

.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 520px);
  min-height: calc(100vh - 72px);
}

.auth-split-narrow {
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 460px);
}

.auth-aside {
  padding: 3rem 2rem 3rem max(2rem, calc((100vw - 1440px) / 2 + 2rem));
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
}

.auth-aside h1 {
  font-size: clamp(1.85rem, 3.5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 1rem;
  max-width: 18ch;
}

.auth-aside .lead {
  max-width: 520px;
  margin-bottom: 1.5rem;
}

.auth-benefits {
  max-width: 480px;
  margin-bottom: 1.75rem;
}

.auth-aside-media {
  margin-top: auto;
  max-width: 520px;
}

.auth-aside-media img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.auth-aside-note {
  margin-top: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-aside-note a {
  color: var(--accent-bright);
  text-decoration: none;
}

.auth-aside-note a:hover {
  text-decoration: underline;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--bg-dark);
}

.auth-panel-inner {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}

.auth-panel-inner-sm {
  max-width: 420px;
}

.auth-panel-head {
  margin-bottom: 1.5rem;
}

.auth-panel-head h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.auth-panel-head p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.auth-form .form-group {
  margin-bottom: 1.1rem;
}

.auth-form .form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.auth-form .form-group input {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form .form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-section-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.plan-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.plan-picker-loading {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 1rem;
  text-align: center;
  background: var(--bg-dark);
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.plan-picker-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.85rem 0.9rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.plan-picker-card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.plan-picker-card:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(59, 130, 246, 0.12);
  background: rgba(59, 130, 246, 0.06);
}

.plan-picker-card.is-featured::before {
  content: 'Popular';
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: white;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.plan-picker-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.plan-picker-speed {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-bright);
}

.plan-picker-speed small {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.15rem;
}

.plan-picker-name {
  font-size: 0.88rem;
  font-weight: 600;
}

.plan-picker-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.auth-submit {
  margin-top: 0.5rem;
  padding: 0.85rem 1.25rem;
}

.auth-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

.auth-switch {
  text-align: center;
  margin-top: 1.35rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--accent-bright);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.auth-footer {
  padding: 0;
}

.auth-footer .footer-bottom {
  padding: 1rem 2rem;
}

.auth-footer .footer-bottom a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 0.35rem;
}

.auth-footer .footer-bottom a:hover {
  color: var(--accent-bright);
}

@media (max-width: 960px) {
  .auth-split,
  .auth-split-narrow {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    padding: 2rem 1.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .auth-aside-media {
    margin-top: 1.5rem;
  }

  .auth-panel {
    padding: 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .plan-picker {
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard ── */
.dash-page {
  padding-top: 72px;
  min-height: 100vh;
  background: var(--bg-dark);
  overflow-x: hidden;
  width: 100%;
}

.dash-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: 100%;
  min-height: calc(100vh - 72px);
}

.dash-sidebar {
  display: flex;
  flex-direction: column;
  padding: 2rem 1.35rem;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  min-width: 0;
  min-height: calc(100vh - 72px);
  position: sticky;
  top: 72px;
  align-self: start;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  overflow-x: hidden;
}

.dash-sidebar .eyebrow {
  margin-bottom: 0.65rem;
}

.dash-sidebar h1 {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 0.35rem;
  word-wrap: break-word;
}

.dash-user-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.45;
  margin: 0;
}

.dash-sidebar #activation-actions {
  margin: 1rem 0;
}

.dash-aside-links {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.dash-aside-links a {
  color: var(--accent-bright);
  text-decoration: none;
}

.dash-aside-links a:hover {
  text-decoration: underline;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 0 0;
  flex: 1;
  width: 100%;
}

.dash-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-dark);
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.15s;
}

.dash-nav-item[hidden] {
  display: none !important;
}

.dash-nav-item:hover {
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--text);
  transform: translateY(-1px);
}

.dash-nav-item.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(59, 130, 246, 0.12);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

.dash-nav-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.dash-nav-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.dash-nav-item.is-active .dash-nav-desc {
  color: var(--accent-bright);
}

.dash-main {
  padding: 2rem;
  background: var(--bg-dark);
  min-width: 0;
  min-height: calc(100vh - 72px);
  overflow-x: hidden;
}

.dash-main-inner {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}

.dash-main > #alert:not([hidden]),
.dash-main-inner > #alert:not([hidden]) {
  margin: 0 0 1rem;
  border-radius: 8px;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.dash-stats .stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  transition: border-color 0.2s, transform 0.15s;
}

.dash-stats .stat-chip:hover {
  border-color: rgba(59, 130, 246, 0.25);
}

.dash-stats .stat-chip .label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.dash-stats .stat-chip .value {
  font-size: 0.9rem;
  font-weight: 600;
}

.dash-stats .stat-chip code {
  font-size: 0.78rem;
  color: var(--accent-bright);
}

.dash-panels {
  display: flex;
  flex-direction: column;
}

.dash-panel {
  display: none;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  animation: dashPanelIn 0.35s ease;
}

.dash-panel.is-active {
  display: flex;
}

@keyframes dashPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.panel-heading h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}

.panel-heading p {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.panel-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.content-block {
  margin-bottom: 1.75rem;
}

.content-block:last-child {
  margin-bottom: 0;
}

.block-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
}

.table-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-dark);
}

.table-panel.flush {
  margin-left: 0;
  margin-right: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.form-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem;
  background: var(--bg-dark);
}

.form-field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
  text-transform: none;
  font-weight: 400;
  letter-spacing: normal;
}

.form-field input,
.form-field select,
.port-tool-row input,
.port-tool-row select,
.port-assign-row select {
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input:focus,
.form-field select:focus,
.port-tool-row input:focus,
.port-tool-row select:focus,
.port-assign-row select:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.empty-state {
  background: var(--bg-dark);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 2.5rem 1.5rem;
}

.services-collapse .block-title {
  cursor: pointer;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.services-collapse summary {
  list-style: none;
  cursor: pointer;
}

.services-collapse summary::-webkit-details-marker {
  display: none;
}

.services-collapse summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.2s;
}

.services-collapse[open] summary::before {
  transform: rotate(90deg);
}

/* Tables & forms */
.data-table,
.port-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td,
.port-table th,
.port-table td {
  text-align: left;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td,
.port-table tr:last-child td {
  border-bottom: none;
}

.data-table th,
.port-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-label {
  width: 140px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.data-table code,
.port-table code {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--accent-bright);
  word-break: break-all;
}

.empty-cell {
  color: var(--text-muted);
  text-align: center;
  padding: 1.25rem !important;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.form-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: var(--bg-dark);
}

.form-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-field input,
.form-field select,
.port-tool-row input,
.port-tool-row select,
.port-assign-row select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.form-field input:focus,
.form-field select:focus,
.port-tool-row input:focus,
.port-tool-row select:focus,
.port-assign-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-field-grow {
  flex: 1;
  min-width: 0;
}

.form-field-action {
  flex-shrink: 0;
}

.port-tool-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  align-items: end;
}

.port-assign-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.port-forward-panel {
  padding: 1.1rem 1.15rem;
}

.port-forward-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr) auto;
  gap: 0.75rem 1rem;
  align-items: end;
}

.port-forward-grid .form-field {
  margin: 0;
  min-width: 0;
}

.port-forward-grid .form-field label,
.port-forward-action-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.port-forward-control,
.port-forward-grid select {
  width: 100%;
  min-height: 2.5rem;
  box-sizing: border-box;
}

.port-forward-action {
  min-width: 11.5rem;
}

.port-forward-action-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.5rem;
}

.port-forward-hint {
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.service-port-preview {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 2.5rem;
  text-align: center;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.port-forward-action-row .btn-generate-port {
  flex: 1;
  white-space: nowrap;
}

.port-assign-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.port-assign-actions .service-port-preview {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  min-width: auto;
  padding: 0;
  border: none;
  background: transparent;
}

.data-table .col-actions,
.port-table .col-actions {
  width: 170px;
  min-width: 170px;
  text-align: right;
  padding-right: 1rem;
}

.data-table th.col-actions,
.port-table th.col-actions {
  text-align: right;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.data-table tbody tr.row-new,
.port-table tbody tr.row-new {
  animation: rowSlideIn 0.45s ease;
  background: rgba(16, 185, 129, 0.06);
}

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateX(-12px); background: rgba(16, 185, 129, 0.12); }
  to { opacity: 1; transform: translateX(0); }
}

/* Legacy section styles removed — dash-panel replaces accordion */

.btn-copy {
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 5px;
  padding: 0.15rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.btn-copy:hover { color: var(--accent-bright); border-color: var(--accent); }
.btn-copy.copied { color: var(--green); border-color: rgba(16, 185, 129, 0.4); }

.endpoint-cell { min-width: 0; max-width: 280px; }

.endpoint-text {
  display: block;
  font-size: 0.78rem;
  color: var(--accent-bright);
  word-break: break-all;
  line-height: 1.35;
}

.col-service { min-width: 90px; }
.col-local { min-width: 100px; }

.btn-copy-endpoint {
  padding: 0.32rem 0.65rem;
  font-size: 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, transform 0.12s, box-shadow 0.12s;
}

.row-actions .btn-remove,
.row-actions .btn-copy,
.row-actions .btn {
  min-height: 30px;
}

.btn-copy-endpoint:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.btn-copy-endpoint:active { transform: translateY(0); }

.local-target {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  user-select: none;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pending { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.status-active { background: rgba(16, 185, 129, 0.2); color: var(--green); }
.status-requested { background: rgba(59, 130, 246, 0.2); color: var(--accent-bright); }

.port-assign-card {
  display: contents;
}

.btn-generate-port {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn-generate-port.is-generating {
  pointer-events: none;
  opacity: 0.85;
}

.btn-generate-port.is-generating::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: shimmer 1s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.port-gen-result {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  display: none;
  animation: resultPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.port-gen-result.is-visible { display: block; }

.port-gen-result.is-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

@keyframes resultPop {
  0% { opacity: 0; transform: scale(0.92) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.port-gen-result .result-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.port-gen-rolling {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: ui-monospace, monospace;
  color: var(--accent-bright);
  letter-spacing: 0.05em;
  animation: portPulse 0.6s ease infinite;
}

.port-gen-final {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: ui-monospace, monospace;
  color: var(--green);
  animation: portReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes portPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes portReveal {
  0% { opacity: 0; transform: scale(0.5); filter: blur(4px); }
  60% { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

.port-gen-meta {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.port-gen-meta code { color: var(--accent-bright); font-size: 0.78rem; }

.gen-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.gen-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: dotBounce 1.2s ease infinite;
}

.gen-dots span:nth-child(2) { animation-delay: 0.15s; }
.gen-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.port-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.35rem;
  margin-left: -2rem;
  margin-right: -2rem;
  width: calc(100% + 4rem);
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.port-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 480px;
}

.port-table th,
.port-table td {
  text-align: left;
  padding: 0.65rem 2rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.port-table .col-actions {
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  white-space: nowrap;
  text-align: right;
  padding-right: 0.85rem;
}

.port-table th.col-actions {
  text-align: right;
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

.port-table tr:last-child td { border-bottom: none; }

.port-table th {
  background: var(--bg-dark);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.port-table tbody tr {
  transition: background 0.2s;
}

.port-table tbody tr.row-new {
  animation: rowSlideIn 0.45s ease;
  background: rgba(16, 185, 129, 0.06);
}

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateX(-12px); background: rgba(16, 185, 129, 0.12); }
  to { opacity: 1; transform: translateX(0); }
}

.services-collapse {
  margin-top: 0.65rem;
}

.services-collapse summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0;
  list-style: none;
}

.services-collapse summary::-webkit-details-marker { display: none; }

.services-collapse summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.2s;
}

.services-collapse[open] summary::before {
  transform: rotate(90deg);
}

.port-tool-row .btn {
  justify-self: end;
  white-space: nowrap;
}

.live-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: livePulse 1.8s ease infinite;
  vertical-align: middle;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.dash-nav-traffic:not([hidden]) {
  border-color: rgba(34, 197, 94, 0.35);
}

.traffic-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.traffic-live-badge::before {
  content: '';
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #22c55e;
  animation: livePulse 1.8s ease infinite;
}

.traffic-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.traffic-stat-card {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}

.traffic-stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.traffic-stat-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.traffic-stat-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.traffic-stat-down .traffic-stat-value { color: #60a5fa; }
.traffic-stat-up .traffic-stat-value { color: #34d399; }

.traffic-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.traffic-meter-labels {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.traffic-meter {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  overflow: hidden;
}

.traffic-meter-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 0.6s ease;
}

.traffic-meter-fill-down {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.traffic-meter-fill-up {
  background: linear-gradient(90deg, #059669, #34d399);
}

.traffic-offline {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.35);
}

.traffic-offline-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: var(--text-muted);
}

.traffic-offline h3 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.traffic-offline p {
  margin: 0 auto;
  max-width: 34rem;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .dash-layout {
    grid-template-columns: 1fr;
  }

  .dash-sidebar {
    position: static;
    max-height: none;
    min-height: 0;
    padding: 1.5rem 1.25rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .dash-aside-links {
    display: none;
  }

  .dash-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-top: 0.75rem;
    gap: 0.5rem;
  }

  .dash-nav-item {
    flex-shrink: 0;
    min-width: 140px;
  }

  .dash-nav-desc {
    display: none;
  }

  .dash-main {
    padding: 1.25rem;
    min-height: 0;
  }

  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .traffic-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-header {
    padding: 1.15rem 1.25rem;
  }

  .panel-body {
    padding: 1.15rem 1.25rem 1.5rem;
  }

  .port-tool-row {
    grid-template-columns: 1fr;
  }

  .port-tool-row .btn {
    width: 100%;
    justify-self: stretch;
  }

  .port-forward-grid {
    grid-template-columns: 1fr;
  }

  .port-assign-row {
    flex-direction: column;
    align-items: stretch;
  }

  .port-forward-action {
    min-width: 0;
  }

  .port-forward-action-row {
    width: 100%;
  }

  .port-forward-action-row .btn-generate-port {
    flex: 1;
  }

  .port-assign-actions {
    width: 100%;
    justify-content: space-between;
  }

  .data-table .col-actions,
  .port-table .col-actions {
    min-width: 130px;
  }
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}

.btn-remove:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.55);
  color: #fecaca;
  transform: translateY(-1px);
}

.btn-remove:active {
  transform: translateY(0);
}

.btn-remove-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-warn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}

.btn-warn:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.6);
  color: #fcd34d;
  transform: translateY(-1px);
}

.btn-warn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.speedtest-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1rem 1rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.18), rgba(15, 23, 42, 0.0) 60%), rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
}

.speedtest-gauge-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.speedtest-gauge-stage {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
}

.speedtest-gauge-value {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1.05;
  background: linear-gradient(180deg, #f8fafc, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.speedtest-gauge-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.speedtest-progress {
  width: min(100%, 28rem);
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.speedtest-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa, #34d399);
  transition: width 0.2s ease;
}

.speedtest-note {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.speedtest-note code {
  color: var(--accent-bright);
  font-size: 0.82rem;
}

.troubleshoot-toolbar {
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
}

.troubleshoot-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.troubleshoot-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.75rem 0.95rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.troubleshoot-tab:hover {
  color: var(--text);
}

.troubleshoot-tab.is-active {
  color: var(--accent-bright);
  border-bottom-color: var(--accent);
}

.troubleshoot-target {
  margin-bottom: 1rem;
}

.troubleshoot-target-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.troubleshoot-target-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.troubleshoot-host-input {
  flex: 1 1 14rem;
  min-width: 12rem;
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.troubleshoot-host-input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.troubleshoot-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.troubleshoot-target-note {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.troubleshoot-target-note code {
  color: var(--accent-bright);
  font-size: 0.76rem;
}

.troubleshoot-pane {
  display: none;
}

.troubleshoot-pane.is-active {
  display: block;
}

.troubleshoot-pane-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.troubleshoot-output {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.75);
  border: 1px solid var(--border);
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 18rem;
  overflow: auto;
}

.traceroute-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 24rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.subnet-empty-state {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.subnet-setup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.subnet-setup-header .block-title {
  margin: 0;
}

.subnet-setup-lead {
  margin: 0 0 0.85rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.subnet-route-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.55);
}

.subnet-route-badge.is-active {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(22, 101, 52, 0.22);
}

.subnet-route-badge.is-pending {
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(120, 53, 15, 0.22);
}

.routeros-cmd {
  font-size: 0.78rem;
  white-space: normal;
  word-break: break-word;
}

.instructions-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.instructions-list li { margin-bottom: 0.2rem; }

.nav-portal {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-portal a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-portal a:hover { color: var(--text); }

.btn-sm {
