:root {
  color-scheme: dark;
  --bg-0: #071019;
  --bg-1: #0a1520;
  --surface-0: rgba(14, 27, 39, 0.78);
  --surface-1: rgba(20, 36, 50, 0.86);
  --surface-2: rgba(31, 49, 63, 0.78);
  --surface-solid: #101d29;
  --line: rgba(174, 203, 222, 0.14);
  --line-strong: rgba(174, 203, 222, 0.24);
  --text: #f5f9fc;
  --text-soft: #c8d5df;
  --muted: #8ea2b1;
  --accent: #69e6c5;
  --accent-strong: #30c8a2;
  --accent-soft: rgba(105, 230, 197, 0.12);
  --blue: #82a8ff;
  --violet: #b69cff;
  --success: #5fe0a4;
  --warning: #f5c76b;
  --danger: #ff7b88;
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.34);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --sidebar-width: 266px;
  --header-height: 74px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-0);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(64, 165, 143, 0.11), transparent 42%),
    linear-gradient(180deg, #071019 0%, #09131d 52%, #071019 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

button {
  border: 0;
}

button:not(:disabled),
a[href] {
  cursor: pointer;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: -.025em;
}

p:last-child {
  margin-bottom: 0;
}

[hidden],
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ui-icon {
  flex: 0 0 auto;
}

.ambient-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.ambient-background::before {
  content: "";
  position: absolute;
  inset: -24%;
  background:
    radial-gradient(circle at 24% 26%, rgba(67, 212, 177, .11), transparent 20%),
    radial-gradient(circle at 79% 23%, rgba(100, 135, 255, .10), transparent 22%),
    radial-gradient(circle at 63% 78%, rgba(171, 118, 255, .08), transparent 24%);
  filter: blur(42px);
  animation: ambientDrift 22s var(--ease) infinite alternate;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  opacity: .12;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.9), transparent 78%);
}

.ambient-orb {
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .12;
}

.ambient-orb.one {
  top: 8%;
  left: -120px;
  background: var(--accent);
  animation: orbFloat 19s var(--ease) infinite alternate;
}

.ambient-orb.two {
  right: -160px;
  bottom: 6%;
  background: var(--violet);
  animation: orbFloat 25s var(--ease) infinite alternate-reverse;
}

@keyframes ambientDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.05); }
}

@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(80px, -40px, 0) scale(1.08); }
}

#appLoader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #071019;
  transition: opacity .34s var(--ease), visibility .34s var(--ease);
}

#appLoader.is-done {
  opacity: 0;
  visibility: hidden;
}

.app-loader-card {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(320px, calc(100vw - 40px));
  padding: 30px;
  text-align: center;
}

.brand-mark-large,
.brand-mark {
  display: grid;
  place-items: center;
  color: #04110e;
  background: linear-gradient(145deg, #8df2d7, #45cfab);
  box-shadow: 0 14px 34px rgba(69, 207, 171, .23);
  font-weight: 900;
  letter-spacing: -.05em;
}

.brand-mark-large {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  font-size: 22px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 14px;
}

.loader-line {
  position: relative;
  width: 180px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}

.loader-line::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loaderSweep 1.15s linear infinite;
}

@keyframes loaderSweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(330%); }
}

.glass-panel,
.surface-card,
.modal-card {
  background: linear-gradient(180deg, rgba(23, 40, 54, .84), rgba(12, 25, 36, .78));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.035);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.surface-card {
  border-radius: var(--radius-md);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  color: var(--text);
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 760;
  line-height: 1;
  transition: transform .16s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease), opacity .18s;
}

.button:hover:not(:disabled) {
  background: rgba(255,255,255,.085);
  border-color: var(--line-strong);
}

.button:active:not(:disabled) {
  transform: translateY(1px) scale(.985);
}

.button:focus-visible,
.icon-button:focus-visible,
.nav-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(105, 230, 197, .22);
  outline-offset: 2px;
}

.button-primary {
  color: #061410;
  background: linear-gradient(135deg, #86edd2, #4cd1ae);
  border-color: rgba(105,230,197,.6);
  box-shadow: 0 12px 28px rgba(64, 211, 173, .16);
}

.button-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #98f3dc, #58ddb9);
  border-color: rgba(128,245,214,.9);
  box-shadow: 0 14px 34px rgba(64, 211, 173, .22);
}

.button-secondary {
  color: var(--text-soft);
  background: rgba(255,255,255,.04);
}

.button-danger {
  color: #ffdce0;
  background: rgba(255, 85, 105, .13);
  border-color: rgba(255, 123, 136, .28);
}

.button-danger:hover:not(:disabled) {
  background: rgba(255, 85, 105, .2);
  border-color: rgba(255, 123, 136, .46);
}

.button-small {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.button-block {
  width: 100%;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  color: var(--text-soft);
  background: rgba(255,255,255,.045);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: background .18s, color .18s, transform .16s var(--ease), border-color .18s;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255,255,255,.08);
  border-color: var(--line-strong);
}

.icon-button:active {
  transform: scale(.96);
}

.button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.field,
.field-row {
  display: grid;
  gap: 8px;
}

.field > span,
.field-label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.input-wrap {
  position: relative;
}

.input-wrap .input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.input-wrap.has-icon input {
  padding-left: 44px;
}

.input-wrap.has-action input {
  padding-right: 48px;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
  transform: translateY(-50%);
}

.input-action:hover {
  color: var(--text);
  background: rgba(255,255,255,.06);
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: rgba(2, 11, 18, .46);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .18s, background .18s, box-shadow .18s;
}

input,
select {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #657b8a;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  background: rgba(3, 14, 22, .7);
  border-color: rgba(105, 230, 197, .54);
  box-shadow: 0 0 0 4px rgba(105, 230, 197, .08);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

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

.form-grid .full-span {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.badge,
.status-pill,
.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(255,255,255,.045);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent);
}

.status-active,
.status-success {
  color: var(--success);
  background: rgba(95,224,164,.08);
  border-color: rgba(95,224,164,.22);
}

.status-warning {
  color: var(--warning);
  background: rgba(245,199,107,.08);
  border-color: rgba(245,199,107,.22);
}

.status-danger,
.status-blocked,
.status-disabled {
  color: var(--danger);
  background: rgba(255,123,136,.08);
  border-color: rgba(255,123,136,.22);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-heading h2,
.section-heading h3 {
  margin-bottom: 7px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.page-title {
  margin-bottom: 6px;
  font-size: clamp(26px, 3vw, 38px);
}

.page-subtitle {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
}

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

.metric-card {
  position: relative;
  min-height: 132px;
  padding: 19px;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -58px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(105,230,197,.10), transparent 68%);
}

.metric-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 18px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(105,230,197,.15);
  border-radius: 12px;
}

.metric-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.metric-value {
  margin: 0;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -.04em;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 280px;
  padding: 46px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.018);
}

.empty-state-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(105,230,197,.16);
  border-radius: 20px;
}

.empty-state h3 {
  margin: 4px 0 0;
}

.empty-state p {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
}

.skeleton {
  position: relative;
  overflow: hidden;
  color: transparent !important;
  background: rgba(255,255,255,.055) !important;
  border-color: transparent !important;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 15px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(11, 24, 35, .96);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

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

.data-table tbody tr {
  transition: background .18s;
}

.data-table tbody tr:hover {
  background: rgba(255,255,255,.025);
}

.table-primary {
  color: var(--text);
  font-weight: 760;
}

.table-secondary {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10000;
  display: grid;
  width: min(390px, calc(100vw - 36px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  color: var(--text-soft);
  background: rgba(14, 27, 39, .96);
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-8px) scale(.98);
  transition: opacity .2s, transform .2s var(--ease);
  pointer-events: auto;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-success { border-color: rgba(95,224,164,.3); }
.toast-success .ui-icon { color: var(--success); }
.toast-error { border-color: rgba(255,123,136,.35); }
.toast-error .ui-icon { color: var(--danger); }
.toast-info .ui-icon { color: var(--blue); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
  background: rgba(1, 8, 13, .72);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .18s;
}

.modal-backdrop.is-open {
  opacity: 1;
}

.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius-lg);
  opacity: 0;
  transform: translateY(14px) scale(.985);
  transition: opacity .2s, transform .2s var(--ease);
}

.modal-backdrop.is-open .modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal-card.modal-wide {
  width: min(860px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.modal-header h2,
.modal-header h3 {
  margin-bottom: 7px;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: rgba(255,255,255,.07);
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), #8cebd3);
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(105,230,197,.28);
  transition: width .5s linear;
}

.split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.stack {
  display: grid;
  gap: 14px;
}

.divider {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.page-view {
  animation: pageIn .28s var(--ease) both;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

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

@media (max-width: 720px) {
  body { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-span { grid-column: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 118px; padding: 16px; }
  .metric-value { font-size: 24px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading > .button { width: 100%; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal-card { width: 100%; max-height: calc(100dvh - 20px); padding: 20px; border-radius: 22px 22px 14px 14px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
  .toast-region { top: 10px; right: 10px; width: calc(100vw - 20px); }
}

@media (max-width: 440px) {
  .metric-grid { grid-template-columns: 1fr; }
  .split-row { align-items: stretch; flex-direction: column; }
  .inline-actions { width: 100%; }
  .inline-actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

html.low-power .ambient-background::before,
html.low-power .ambient-orb {
  animation: none;
  filter: blur(100px);
  opacity: .07;
}

html.low-power .ambient-grid {
  opacity: .06;
}

/* Lightweight live network background inspired by the supplied motion reference. */
.particle-network {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: .82;
  filter: drop-shadow(0 0 9px rgba(73, 224, 184, .16));
}

.ambient-background::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(circle at 50% 42%, transparent 0, rgba(4, 12, 18, .08) 45%, rgba(4, 12, 18, .44) 100%),
    linear-gradient(180deg, rgba(3, 10, 15, .08), rgba(3, 10, 15, .28));
}

.ambient-grid,
.ambient-orb {
  z-index: 0;
}

html.low-power .particle-network {
  opacity: .48;
  filter: none;
}

@media (prefers-reduced-motion: reduce) {
  .particle-network { opacity: .36; }
}

.particle-network.is-paused {
  opacity: 0;
}
