:root {
  --bg: #0a0e17;
  --bg-accent: #111827;
  --ink: #e2e8f0;
  --panel: rgba(17, 24, 39, 0.88);
  --line: rgba(99, 179, 237, 0.12);
  --brand: #00d4ff;
  --brand-strong: #0ea5e9;
  --brand-glow: rgba(0, 212, 255, 0.15);
  --muted: #94a3b8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --input-bg: rgba(15, 23, 42, 0.9);
  --input-border: rgba(99, 179, 237, 0.2);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(0, 212, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(14, 165, 233, 0.04) 0%, transparent 50%);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.page-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 20px auto 48px;
}

/* ─── Hero ─── */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(15, 23, 42, 0.9));
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 60px rgba(0, 212, 255, 0.03);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 600;
}

.hero h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  background: linear-gradient(135deg, #fff, var(--brand));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-badge {
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-badge.running {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.1); }
  50% { box-shadow: 0 0 16px rgba(245, 158, 11, 0.25); }
}

/* ─── Notice ─── */
.notice {
  display: none;
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}

.notice.show { display: block; }

.notice.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--success);
}

.notice.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
}

/* ─── Grid ─── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 20px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel-wide { grid-column: span 2; }

.panel-head { margin-bottom: 16px; }

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.panel-desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ─── Forms ─── */
.form-row {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
}

.form-row-sm {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

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

.config-grid .full { grid-column: span 3; }
.config-grid .span2 { grid-column: span 2; }

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

label span { font-weight: 600; color: var(--ink); }

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-glow);
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 12px;
}

.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* ─── Buttons ─── */
.btn-primary {
  border: 0;
  padding: 10px 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #0a0e17;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  transition: box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(0, 212, 255, 0.2);
}

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

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.2s;
}

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

.btn-accent {
  border: 1px solid rgba(0, 212, 255, 0.3);
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.08);
  color: var(--brand);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.2s;
}

.btn-accent:hover { background: rgba(0, 212, 255, 0.15); }

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

/* ─── Proxy section ─── */
.proxy-section { margin-bottom: 12px; }
.proxy-section label { margin-bottom: 8px; }

.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}

/* ─── Task list ─── */
.task-list, .account-grid {
  display: grid;
  gap: 10px;
}

.task-card, .account-card, .kv-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.6);
}

.task-top, .account-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status.running, .status.queued {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status.completed {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status.failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ─── Log / JSON box ─── */
.log-box, .json-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(99, 179, 237, 0.08);
  color: #a5d6ff;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow: auto;
}

/* ─── KV list ─── */
.kv-list { display: grid; gap: 8px; }

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.kv-row code, .account-meta code {
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 11px;
  color: var(--brand);
}

.empty { color: var(--muted); font-style: italic; }

/* ─── Account ─── */
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.account-meta {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* ─── Details / Advanced ─── */
details { margin-top: 14px; }

summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
  font-size: 13px;
  padding: 6px 0;
}

.advanced-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.5);
}

.advanced-box .config-grid { margin-top: 12px; }

/* ─── Pagination ─── */
.pagination-info {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pg-btn {
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
  min-width: 36px;
  text-align: center;
}

.pg-btn:hover:not(.disabled):not(.active) {
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.25);
}

.pg-btn.active {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--brand);
  color: var(--brand);
}

.pg-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99, 179, 237, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99, 179, 237, 0.35); }

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .grid, .config-grid { grid-template-columns: 1fr; }
  .panel-wide, .config-grid .full, .config-grid .span2 { grid-column: auto; }
  .form-row { flex-direction: column; align-items: stretch; }
  .hero { flex-direction: column; align-items: start; gap: 12px; }
}
