@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --bg: #0a0b10;
  --panel: #11131d;
  --panel-2: #151828;
  --text: #e8ecff;
  --muted: #9aa3c7;
  --accent: #00f5d4;
  --accent-2: #1f7cff;
  --warning: #ff5c8a;
  --border: #232845;
  --glow: rgba(0, 245, 212, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #101525, #0a0b10 55%);
  min-height: 100vh;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 36px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 11, 16, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 20px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav a:hover {
  color: var(--text);
}

.nav .ghost {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.hero-actions input {
  background: #0d1020;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  min-width: 240px;
}

.eyebrow {
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
}

h1 {
  margin: 8px 0 6px;
  font-size: 34px;
}

.muted {
  color: var(--muted);
}

.pulse {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), transparent 60%);
  box-shadow: 0 0 40px var(--glow);
  animation: pulse 2.6s ease-in-out infinite;
  display: grid;
  place-items: center;
  position: relative;
}

.pulse.is-online {
  background: radial-gradient(circle, #2ee67d 0%, rgba(46, 230, 125, 0.18) 58%, transparent 70%);
  box-shadow: 0 0 40px rgba(46, 230, 125, 0.22);
}

.pulse.is-offline {
  background: radial-gradient(circle, #ff5c8a 0%, rgba(255, 92, 138, 0.16) 58%, transparent 70%);
  box-shadow: 0 0 40px rgba(255, 92, 138, 0.2);
}

.pulse-core-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #0a0b10;
}

.pulse-status-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pulse-status-copy {
  display: grid;
  gap: 6px;
}

.pulse-status-title {
  font-size: 18px;
  font-weight: 700;
}

.pulse-status-text {
  font-size: 14px;
  color: var(--text);
}

.pulse-status-sub {
  font-size: 12px;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(0.9);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.grid.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.grid.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.card {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.card-label {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.card-value {
  font-size: 28px;
  margin-top: 8px;
}

.panel {
  margin-top: 24px;
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  padding: 22px;
  border-radius: 16px;
}

.panel-title {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--muted);
}

.panel-actions {
  display: flex;
  gap: 12px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.meta-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
}

.meta-value {
  font-size: 16px;
  margin-top: 6px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.action-card {
  background: rgba(10, 11, 16, 0.6);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 14px;
  display: grid;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0a0b10;
  border: none;
  font-weight: 600;
}

.btn.warning {
  background: linear-gradient(120deg, #ffb347, #ff7a18);
  color: #0a0b10;
  border: none;
  font-weight: 600;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.audit-actions {
  display: grid;
  gap: 8px;
}

.partial-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.partial-wrap input {
  background: #0d1020;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
}

.table-wrap {
  overflow: auto;
  max-height: 360px;
}

.table-wrap.limit-5 {
  max-height: 240px;
}

.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(31, 124, 255, 0.35);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.settings-layout {
  display: grid;
  gap: 22px;
}

.settings-section {
  border: 1px solid rgba(31, 124, 255, 0.22);
  background: linear-gradient(180deg, rgba(31, 124, 255, 0.08), rgba(10, 11, 16, 0.35));
  border-radius: 14px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 8px 20px rgba(0, 0, 0, 0.2);
}

.settings-head {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.settings-head .panel-title {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.settings-head .muted {
  margin: 0;
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.settings-grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.settings-grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

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

.network-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.network-card {
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(0, 245, 212, 0.07), rgba(13, 16, 32, 0.8));
  padding: 12px;
  display: grid;
  gap: 10px;
}

.network-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.1px;
  color: var(--accent);
  text-transform: uppercase;
}

.sticky-save {
  position: sticky;
  bottom: 14px;
  z-index: 2;
  padding: 10px;
  border-radius: 12px;
  background: rgba(10, 11, 16, 0.82);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  justify-content: flex-end;
}

.form-section {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.field input {
  background: #0d1020;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
}

.field select {
  background: #0d1020;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
}

.field textarea {
  background: #0d1020;
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  resize: vertical;
}

.rtl-field {
  direction: rtl;
  text-align: right;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #0d1020;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .slider {
  background: rgba(0, 245, 212, 0.18);
  border-color: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(22px);
  background: var(--accent);
}

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

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

.cycle-card {
  border: 1px solid rgba(31, 124, 255, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31, 124, 255, 0.08), rgba(10, 11, 16, 0.35));
  overflow: hidden;
}

.cycle-card.history-card {
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(10, 11, 16, 0.35));
}

.cycle-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
}

.cycle-summary::-webkit-details-marker {
  display: none;
}

.cycle-title {
  font-size: 16px;
  font-weight: 700;
}

.cycle-subtitle {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.cycle-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.metric-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.status-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-pill.open {
  color: var(--accent);
  border-color: rgba(0, 245, 212, 0.28);
}

.status-pill.ready {
  color: #8bd3ff;
  border-color: rgba(31, 124, 255, 0.3);
}

.status-pill.closed {
  color: #ffb3c7;
  border-color: rgba(255, 92, 138, 0.28);
}

.metric-pill {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.cycle-body {
  padding: 0 18px 18px;
  display: grid;
  gap: 16px;
}

.cycle-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.proxy-health-live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  min-height: 20px;
}

.proxy-health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(154, 163, 199, 0.12);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.proxy-health-dot.is-ok {
  background: #2ee67d;
  box-shadow: 0 0 0 4px rgba(46, 230, 125, 0.14);
}

.proxy-health-dot.is-down {
  background: #ff5c8a;
  box-shadow: 0 0 0 4px rgba(255, 92, 138, 0.14);
}

.proxy-health-dot.is-pending {
  background: #f5c451;
  box-shadow: 0 0 0 4px rgba(245, 196, 81, 0.14);
}

.proxy-health-dot.is-disabled {
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(154, 163, 199, 0.12);
}

.proxy-health-text {
  font-size: 12px;
  color: var(--muted);
}

.actions {
  grid-column: 1 / -1;
}

.panel-stack {
  display: grid;
  gap: 18px;
}

.account-cards {
  margin-bottom: 24px;
}

.backup-details {
  gap: 18px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.status-badge.success {
  border-color: rgba(0, 245, 212, 0.35);
  color: var(--accent);
  background: rgba(0, 245, 212, 0.08);
}

.status-badge.warning {
  border-color: rgba(255, 184, 77, 0.35);
  color: #ffb84d;
  background: rgba(255, 184, 77, 0.08);
}

.status-badge.error {
  border-color: rgba(255, 92, 138, 0.35);
  color: var(--warning);
  background: rgba(255, 92, 138, 0.08);
}

.status-badge.neutral {
  color: var(--muted);
}

.field-toggle {
  grid-column: 1 / -1;
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.backup-run-row {
  align-items: center;
}

.env-hint {
  margin-top: -4px;
}

.form-section-head {
  grid-column: 1 / -1;
  margin-bottom: -2px;
}

.flash-wrap {
  margin-bottom: 16px;
}

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(31, 124, 255, 0.2);
  border: 1px solid rgba(31, 124, 255, 0.4);
}

.flash.error {
  background: rgba(255, 92, 138, 0.15);
  border-color: rgba(255, 92, 138, 0.4);
}

.global-loading {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 16, 0.55);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: start center;
  padding-top: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 60;
}

.global-loading.active {
  opacity: 1;
  pointer-events: auto;
}

.job-progress-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 90;
}

.job-progress-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.job-progress-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 16, 0.72);
  backdrop-filter: blur(6px);
}

.job-progress-card {
  position: relative;
  width: min(560px, calc(100vw - 28px));
  border-radius: 18px;
  border: 1px solid rgba(31, 124, 255, 0.24);
  background: linear-gradient(180deg, rgba(15, 20, 34, 0.96), rgba(10, 11, 16, 0.98));
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.job-progress-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(0, 245, 212, 0.08);
  border: 1px solid rgba(0, 245, 212, 0.22);
}

.job-progress-title {
  font-size: 24px;
  font-weight: 700;
}

.job-progress-message {
  color: var(--muted);
  line-height: 1.6;
  min-height: 44px;
}

.job-progress-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.job-progress-metric {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.job-progress-metric span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.job-progress-metric strong {
  font-size: 22px;
}

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

.job-progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.job-progress-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.job-progress-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #8bd3ff;
  background: rgba(31, 124, 255, 0.12);
  border: 1px solid rgba(31, 124, 255, 0.24);
}

.job-progress-status-pill[data-status="success"] {
  color: var(--accent);
  background: rgba(0, 245, 212, 0.08);
  border-color: rgba(0, 245, 212, 0.24);
}

.job-progress-status-pill[data-status="failed"] {
  color: var(--warning);
  background: rgba(255, 92, 138, 0.08);
  border-color: rgba(255, 92, 138, 0.24);
}

.global-loading-card {
  width: min(520px, calc(100vw - 24px));
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.global-loading-title {
  font-weight: 700;
  letter-spacing: 0.4px;
}

.global-loading-sub {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}

.global-loading-track {
  margin-top: 10px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.global-loading-bar {
  height: 100%;
  width: 38%;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  animation: globalLoadingSlide 1.05s ease-in-out infinite;
}

@keyframes globalLoadingSlide {
  0% {
    transform: translateX(-120%);
  }
  60% {
    transform: translateX(185%);
  }
  100% {
    transform: translateX(185%);
  }
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-card {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: 18px;
  width: min(420px, 90vw);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
}

.login-sub {
  color: var(--muted);
  margin-bottom: 18px;
}

.form label span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form input {
  margin-top: 6px;
  width: 100%;
  margin-bottom: 14px;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .nav a {
    margin-left: 0;
  }

  .container {
    padding: 20px;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .pulse-status-wrap {
    width: 100%;
  }

  .panel {
    padding: 16px;
  }

  .panel-actions {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .hero-actions input {
    min-width: 0;
    width: 100%;
  }

  .partial-wrap {
    grid-template-columns: 1fr;
  }

  .action-row .btn,
  .actions .btn {
    width: 100%;
  }

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

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

  .cycle-summary,
  .cycle-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cycle-badges {
    justify-content: flex-start;
  }

  table {
    font-size: 13px;
    min-width: 760px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 26px;
  }

  .brand {
    font-size: 14px;
    letter-spacing: 1px;
  }

  .card-value {
    font-size: 24px;
  }

  .btn {
    padding: 10px 12px;
  }

  .login-card {
    padding: 22px;
  }
}
