:root {
  --bg: #04110f;
  --bg-soft: #071a17;
  --surface: #0a201c;
  --surface-2: #0e2924;
  --surface-3: #11322c;
  --line: rgba(145, 255, 214, 0.14);
  --line-strong: rgba(145, 255, 214, 0.28);
  --text: #f4fffb;
  --text-soft: #a9beb7;
  --text-muted: #748f87;
  --accent: #4ff2a8;
  --accent-2: #35cbe8;
  --danger: #ff6b6b;
  --warning: #ffc857;
  --success: #4ff2a8;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 13px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(79, 242, 168, 0.08), transparent 28%),
    linear-gradient(145deg, #03100e 0%, #061713 55%, #03100e 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.hidden {
  display: none !important;
}

.view {
  min-height: 100vh;
}

.login-view {
  display: grid;
  place-items: center;
  padding: 30px;
}

.login-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 58px;
  align-items: center;
}

.brand-panel {
  display: flex;
  align-items: center;
  gap: 26px;
}

.brand-panel h1 {
  margin: 4px 0 4px;
  font-size: clamp(3rem, 7vw, 6rem);
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.brand-subtitle,
.muted {
  color: var(--text-soft);
}

.brand-subtitle {
  max-width: 540px;
  margin: 10px 0 0;
  font-size: 1.08rem;
  line-height: 1.6;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.brand-mark {
  position: relative;
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 32%, rgba(79, 242, 168, 0.96), rgba(53, 203, 232, 0.22) 35%, rgba(6, 31, 27, 0.94) 68%);
  box-shadow:
    0 0 0 1px rgba(79, 242, 168, 0.25),
    0 0 50px rgba(79, 242, 168, 0.16);
}

.brand-core {
  position: absolute;
  inset: 39%;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px rgba(79, 242, 168, 0.9);
}

.brand-orbit {
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(79, 242, 168, 0.48);
  border-radius: 50%;
  transform: rotate(22deg) scaleY(0.42);
}

.orbit-b {
  inset: 10px -18px;
  transform: rotate(-31deg) scaleY(0.58);
  border-color: rgba(53, 203, 232, 0.54);
}

.login-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(14, 39, 34, 0.96), rgba(7, 25, 21, 0.96));
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 8px 0 5px;
  font-size: 2rem;
}

.login-card > .muted {
  margin: 0 0 26px;
}

.field {
  display: block;
  margin-bottom: 17px;
}

.field > span {
  display: block;
  margin-bottom: 8px;
  color: #d9ebe5;
  font-size: 0.9rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.form-control,
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input,
.field select,
.form-control,
.search-input {
  height: 48px;
  padding: 0 14px;
}

.field textarea,
textarea.form-control {
  min-height: 112px;
  padding: 13px 14px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.form-control:focus,
.search-input:focus {
  border-color: rgba(79, 242, 168, 0.62);
  box-shadow: 0 0 0 4px rgba(79, 242, 168, 0.08);
  background: rgba(255, 255, 255, 0.055);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 50px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 1px 0 20px;
  color: var(--text-soft);
  font-size: 0.9rem;
  cursor: pointer;
}

.remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.primary-btn,
.secondary-btn,
.quick-btn {
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn {
  min-height: 48px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #032018;
  background: linear-gradient(135deg, var(--accent), #7df7c1);
  box-shadow: 0 12px 28px rgba(79, 242, 168, 0.12);
}

.primary-btn.small {
  width: auto;
  min-height: 42px;
  padding: 0 16px;
}

.primary-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.secondary-btn {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.danger-outline {
  border-color: rgba(255, 107, 107, 0.22);
}

.message {
  margin-top: 15px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 0.88rem;
}

.message.error {
  color: #ffd3d3;
  background: rgba(255, 107, 107, 0.10);
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.message.success {
  color: #d5ffec;
  background: rgba(79, 242, 168, 0.08);
  border: 1px solid rgba(79, 242, 168, 0.18);
}

.connection-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(255, 200, 87, 0.08);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(79, 242, 168, 0.08);
}

.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.08);
}

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(3, 32, 24, 0.24);
  border-top-color: #032018;
  border-radius: 50%;
  animation: spin 0.78s linear infinite;
}

.spinner.large {
  width: 32px;
  height: 32px;
  border-width: 3px;
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
}

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

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 16, 14, 0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

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

.topbar-brand small {
  margin-top: 2px;
  color: var(--text-muted);
}

.mini-mark {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, var(--accent), rgba(53, 203, 232, 0.28) 35%, rgba(8, 35, 30, 0.96) 70%);
  border: 1px solid rgba(79, 242, 168, 0.3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.network-badge {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.83rem;
}

.admin-layout {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(4, 18, 15, 0.72);
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}

.nav-item span {
  width: 22px;
  display: inline-grid;
  place-items: center;
  color: var(--text-muted);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.active {
  color: var(--text);
  border-color: rgba(79, 242, 168, 0.16);
  background: rgba(79, 242, 168, 0.07);
}

.nav-item.active span {
  color: var(--accent);
}

.sidebar-footer {
  padding: 13px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.76rem;
}

.sidebar-footer strong {
  display: block;
  margin-top: 3px;
  color: var(--text-soft);
}

.content {
  min-width: 0;
  padding: 30px clamp(24px, 4vw, 52px) 22px;
}

.content-section {
  max-width: 1480px;
  margin: 0 auto;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading h2 {
  margin: 7px 0 4px;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  letter-spacing: -0.035em;
}

.page-heading p:last-child {
  margin: 0;
}

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

.metric-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(13, 37, 32, 0.9), rgba(8, 26, 22, 0.9));
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--text-muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin-top: 16px;
}

.panel-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(12, 35, 31, 0.9), rgba(7, 24, 21, 0.9));
}

.panel-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-card h3 {
  margin: 7px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.pill.success {
  color: #cffff0;
  background: rgba(79, 242, 168, 0.09);
  border: 1px solid rgba(79, 242, 168, 0.17);
}

.pill.danger {
  color: #ffd3d3;
  background: rgba(255, 107, 107, 0.09);
  border: 1px solid rgba(255, 107, 107, 0.17);
}

.pill.warning {
  color: #ffe9ab;
  background: rgba(255, 200, 87, 0.09);
  border: 1px solid rgba(255, 200, 87, 0.17);
}

.pill.neutral {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.info-list {
  display: grid;
  gap: 11px;
}

.info-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.info-list > div:last-child {
  border-bottom: 0;
}

.info-list span {
  color: var(--text-muted);
}

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

.quick-btn {
  min-height: 76px;
  padding: 14px;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.quick-btn:hover {
  border-color: var(--line-strong);
  background: rgba(79, 242, 168, 0.05);
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.search-input {
  max-width: 420px;
}

.table-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(7, 25, 21, 0.76);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

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

th {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.018);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td {
  color: var(--text-soft);
  font-size: 0.88rem;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

.cell-primary {
  color: var(--text);
  font-weight: 750;
}

.cell-secondary {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.75rem;
}

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

.action-btn {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.empty-state {
  padding: 34px 18px;
  text-align: center;
  color: var(--text-muted);
}

.admin-footer {
  max-width: 1480px;
  margin: 34px auto 0;
  padding: 18px 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.73rem;
}

.admin-footer strong {
  color: var(--text-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(4px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: auto;
}

.modal-card {
  width: min(860px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #08201b;
  box-shadow: var(--shadow);
}

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

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

.modal-header h3 {
  margin: 7px 0 0;
  font-size: 1.5rem;
}

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

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

.form-field label {
  display: block;
  margin-bottom: 7px;
  color: #d9ebe5;
  font-size: 0.84rem;
  font-weight: 700;
}

.form-help {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

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

.modal-actions .primary-btn {
  width: auto;
}

.global-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(3, 16, 14, 0.72);
  backdrop-filter: blur(10px);
}

.loading-card {
  min-width: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #0a211d;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  border: 1px solid rgba(79, 242, 168, 0.18);
  border-radius: 13px;
  background: #0b2822;
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
}

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

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

@media (max-width: 860px) {
  .login-shell {
    grid-template-columns: 1fr;
    max-width: 620px;
    gap: 34px;
  }

  .brand-panel {
    justify-content: center;
  }

  .brand-mark {
    width: 96px;
    height: 96px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 72px;
    z-index: 20;
    width: 100%;
    height: auto;
    display: block;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .nav-list {
    display: flex;
    min-width: max-content;
  }

  .nav-item {
    width: auto;
    padding: 0 12px;
  }

  .sidebar-footer {
    display: none;
  }

  .content {
    padding: 24px 18px 20px;
  }
}

@media (max-width: 680px) {
  .login-view {
    padding: 18px;
  }

  .brand-panel {
    gap: 17px;
  }

  .brand-mark {
    width: 68px;
    height: 68px;
  }

  .brand-panel h1 {
    font-size: 3rem;
  }

  .brand-subtitle {
    font-size: 0.94rem;
  }

  .login-card {
    padding: 24px 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 11px 14px;
  }

  .topbar-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .network-badge,
  .secondary-btn.compact {
    flex: 0 0 auto;
  }

  .sidebar {
    top: 117px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading .primary-btn.small {
    align-self: flex-start;
  }

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

  .metric-card {
    padding: 16px;
  }

  .metric-card strong {
    font-size: 1.65rem;
  }

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

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

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    padding: 19px;
  }
}
