﻿:root {
  color-scheme: dark;
  --bg: #070b16;
  --panel: #0d1426;
  --panel-2: #111a31;
  --line: rgba(130, 150, 200, 0.16);
  --text: #e8eefc;
  --muted: #8b99b8;
  --purple: #7c6cff;
  --purple-2: #5b4dff;
  --cyan: #49d6c6;
  --blue: #4f8cff;
  --green: #3ddc97;
  --yellow: #f0c35a;
  --red: #ff6b88;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(91, 77, 255, 0.25), transparent 34rem),
    radial-gradient(circle at 90% 10%, rgba(73, 214, 198, 0.12), transparent 28rem),
    var(--bg);
}

.app {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
}

.panel {
  background: linear-gradient(180deg, rgba(18, 26, 48, 0.92), rgba(10, 15, 28, 0.96));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.left-panel { display: grid; gap: 16px; align-content: start; }
.right-panel { display: grid; gap: 14px; align-content: start; }

.title-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(124, 108, 255, 0.55);
  background: linear-gradient(180deg, rgba(40, 32, 90, 0.35), rgba(15, 20, 40, 0.2));
  box-shadow: inset 0 0 0 1px rgba(124, 108, 255, 0.12);
}
.title-card h1 { margin: 0; font-size: 28px; letter-spacing: 0.02em; }
.title-card p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.server-pill {
  align-self: flex-start;
  white-space: nowrap;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255,255,255,0.03);
}
.server-pill.ok { color: var(--green); border-color: rgba(61, 220, 151, 0.35); }
.server-pill.bad { color: var(--red); border-color: rgba(255, 107, 136, 0.35); }

.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 8px; }
.field-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.field-head label, .field-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.hint-right { color: var(--muted); font-size: 12px; }
.field-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(5, 10, 22, 0.78);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  font: inherit;
  font-size: 14px;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(124, 108, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(124, 108, 255, 0.12);
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-desc {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 10, 22, 0.55);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.proxy-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
}
.proxy-actions { display: flex; gap: 8px; align-items: center; }
.chip {
  border: 1px solid rgba(124, 108, 255, 0.45);
  background: rgba(124, 108, 255, 0.12);
  color: #d8d2ff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.inline-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.check { display: inline-flex; gap: 8px; align-items: center; }
.check input { width: 15px; height: 15px; }
.check.small { font-size: 12px; }
.mini { display: inline-flex; gap: 8px; align-items: center; }
.mini input { width: 72px; padding: 8px 10px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary {
  background: linear-gradient(135deg, var(--purple-2), #8a5cff 55%, #4f8cff);
  box-shadow: 0 10px 28px rgba(91, 77, 255, 0.28);
}
.ghost {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.tiny { padding: 8px 12px; border-radius: 12px; font-size: 12px; }

.jobs-wrap h2 { font-size: 15px; }
.jobs-list { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.job-item {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}
.job-item.active {
  border-color: rgba(124, 108, 255, 0.85);
  background: rgba(124, 108, 255, 0.1);
}
.job-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.job-id { font-weight: 800; }
.job-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  text-transform: uppercase;
}
.badge.running, .badge.queued { color: var(--blue); }
.badge.awaiting_otp { color: var(--yellow); }
.badge.completed, .badge.success { color: var(--green); }
.badge.failed, .badge.error { color: var(--red); }
.badge.idle { color: var(--muted); }

.progress-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
}
.ring-wrap { position: relative; width: 132px; height: 132px; }
.ring { width: 132px; height: 132px; transform: rotate(-90deg); }
.ring-bg, .ring-fg {
  fill: none;
  stroke-width: 10;
}
.ring-bg { stroke: rgba(255,255,255,0.08); }
.ring-fg {
  stroke: url(# progressive);
  stroke: #7c6cff;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset .35s ease, stroke .2s ease;
}
.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
#progressValue { font-size: 28px; font-weight: 800; }
.ring-status { color: var(--muted); font-size: 12px; margin-top: 2px; }
.progress-meta { display: grid; gap: 8px; }
.bar-label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b4dff, #49d6c6);
  transition: width .35s ease;
}
.stage-text { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); font-size: 12px; }

.log-card, .result-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255,255,255,0.02);
  display: grid;
  gap: 10px;
}
.logs-box, .json-box {
  margin: 0;
  border: 1px solid var(--line);
  background: rgba(2, 6, 16, 0.78);
  border-radius: 14px;
  padding: 12px;
  overflow: auto;
  font-family: Consolas, "SF Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.logs-box { height: 240px; }
.json-box { height: 180px; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-grid h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 700; }

.otp-panel {
  border: 1px solid rgba(240, 195, 90, 0.55);
  background: linear-gradient(180deg, rgba(240, 195, 90, 0.16), rgba(240, 195, 90, 0.06));
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 0 0 1px rgba(240, 195, 90, 0.12), 0 12px 36px rgba(240, 195, 90, 0.08);
  animation: otpPulse 1.6s ease-in-out infinite;
}
@keyframes otpPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(240, 195, 90, 0.12), 0 12px 36px rgba(240, 195, 90, 0.08); }
  50% { box-shadow: 0 0 0 2px rgba(240, 195, 90, 0.35), 0 14px 40px rgba(240, 195, 90, 0.18); }
}
.otp-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.otp-title { font-size: 16px; font-weight: 800; color: #ffe7a8; margin-bottom: 6px; }
.otp-tips { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.otp-tips code { color: #d8d2ff; }
.otp-idle {
  border: 1px dashed rgba(124, 108, 255, 0.35);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(124, 108, 255, 0.06);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.otp-idle strong { display: block; color: var(--text); margin-bottom: 4px; }
.otp-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.hidden { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #17213a;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: var(--shadow);
  z-index: 30;
}

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .two-col, .result-grid, .progress-card { grid-template-columns: 1fr; }
}


.wizard-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.step-tab {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
}
.step-tab.active {
  color: var(--text);
  border-color: rgba(124, 108, 255, 0.75);
  background: linear-gradient(135deg, rgba(91, 77, 255, 0.28), rgba(79, 140, 255, 0.12));
  box-shadow: 0 8px 24px rgba(91, 77, 255, 0.18);
}
.step-panel.hidden { display: none !important; }
.extract-result {
  border: 1px solid rgba(61, 220, 151, 0.35);
  background: rgba(61, 220, 151, 0.08);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.json-box.short { height: 110px; }





/* ---- section cards ---- */
.section-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(8, 12, 24, 0.55);
  padding: 14px;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #d7def0;
}
.field-note.strong-note {
  color: #f0c35a;
  border-left: 3px solid rgba(240, 195, 90, 0.7);
  padding-left: 10px;
}


/* keep two-col notes aligned height */
.two-col > .field {
  min-width: 0;
}
.two-col .field-note {
  min-height: 34px;
}



/* Token inspect: one horizontal row, only when token present */
.token-inspect {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(10, 14, 26, 0.96);
  padding: 10px 12px;
  min-height: 42px;
}
.token-inspect.hidden,
.token-inspect[hidden] {
  display: none !important;
}
.token-inspect-line {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  color: #cfd8ea;
  font-size: 12.5px;
  line-height: 1.35;
  white-space: nowrap;
}
.token-inspect-line .ti-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.token-inspect-line .ti-k {
  color: #93a0b8;
  font-weight: 500;
  flex: 0 0 auto;
}
.token-inspect-line .ti-v {
  color: #eef3ff;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}
.token-inspect-line .ti-sep {
  color: #6f7c96;
  flex: 0 0 auto;
}
.token-inspect.ok {
  border-color: rgba(61, 220, 151, 0.35);
}
.token-inspect.ok .ti-v { color: #b9ffd8; }
.token-inspect.warn {
  border-color: rgba(240, 195, 90, 0.4);
}
.token-inspect.warn .ti-v { color: #ffe6a8; }
.token-inspect.bad {
  border-color: rgba(255, 107, 136, 0.4);
}
.token-inspect.bad .ti-v { color: #ffb3c2; }
.token-inspect.loading .ti-v { color: #9fb0cc; font-weight: 500; }
.token-refresh {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: #9fb0cc;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.token-refresh:hover {
  color: #fff;
  border-color: rgba(124, 108, 255, 0.55);
}
.token-refresh:disabled {
  opacity: 0.5;
  cursor: wait;
}

.mode-row {
  align-items: start;
}
.mode-row .mode-desc {
  display: flex;
  align-items: center;
  min-height: 46px;
}
.mode-row #modeProtocolTag {
  color: #9fb0cc;
}


/* aligned controls */
input, select, textarea, .control, .mode-desc {
  box-sizing: border-box;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.two-col > .field {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  align-content: start;
}
.two-col .field-head {
  min-height: 20px;
}
.two-col select.control,
.two-col input.control,
.two-col .mode-desc.control {
  width: 100%;
  min-height: 48px;
  height: 48px;
  border-radius: 14px;
  padding: 0 14px;
  display: flex;
  align-items: center;
}
.two-col select.control {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9fb0cc 50%), linear-gradient(135deg, #9fb0cc 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.two-col .mode-desc.control {
  height: auto;
  min-height: 48px;
  padding: 12px 14px;
  line-height: 1.45;
  white-space: normal;
}
.two-col .field-notes {
  min-height: 52px;
  display: grid;
  gap: 4px;
  align-content: start;
}
.two-col .field-note {
  margin: 0;
  line-height: 1.4;
}
.two-col #countryNotes,
.two-col #phoneHint {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mode-row > .field:first-child {
  /* select only, no notes row — keep control baseline */
}
