@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-gradient: radial-gradient(circle at top right, #0f172a, #020617);
  --panel-bg: rgba(30, 41, 59, 0.4);
  --panel-border: rgba(255, 255, 255, 0.08);
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-success: #10b981;
  --accent-success-hover: #059669;
  --accent-failed: #ef4444;
  --accent-warning: #f59e0b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-gradient);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
  line-height: 1.5;
  overflow-x: hidden;
}

.shell {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Hero Section */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand .mark {
  background: linear-gradient(135deg, var(--accent-primary), #a855f7);
  color: #fff;
  font-weight: 700;
  font-size: 1.5rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.brand h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #f8fafc, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand .sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.hero-badges {
  display: flex;
  gap: 0.75rem;
}

.hero-badges span {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

/* Notice Bar */
.notice {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.notice-icon {
  background: var(--accent-success);
  color: #0f172a;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.notice div {
  display: flex;
  flex-direction: column;
}

.notice strong {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.notice span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Workbench Layout */
.layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.panel-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.panel-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Fields & Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field label .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.grow {
  flex-grow: 1;
}

input[type="text"], textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  width: 100%;
}

input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea {
  min-height: 160px;
  resize: vertical;
}

.status-line {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Buttons */
button {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

button:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

button.primary {
  width: 100%;
  padding: 0.9rem;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

/* Summary Grid */
.batch-summary {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}

.batch-summary div {
  display: flex;
  flex-direction: column;
}

.batch-summary b {
  font-size: 1.2rem;
  color: var(--text-primary);
}

.batch-summary span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Account Preview List */
.account-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.account-chip {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.account-chip b {
  color: var(--accent-primary);
}

.account-chip span {
  color: var(--text-secondary);
  font-family: monospace;
}

.account-chip.muted span {
  color: var(--text-muted);
  font-family: var(--font-family);
}

/* Workflow Steps */
.workflow {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.6rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  transition: all 0.3s ease;
}

.step b {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: var(--text-secondary);
}

.step span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.step small {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.step.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.step.active b {
  background: var(--accent-primary);
  color: #fff;
}

.step.done {
  border-color: var(--accent-success);
}

.step.done b {
  background: var(--accent-success);
  color: #0f172a;
}

.step.fail {
  border-color: var(--accent-failed);
}

.step.fail b {
  background: var(--accent-failed);
  color: #fff;
}

/* Metrics Grid */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric b {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* Result facts */
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.fact {
  display: flex;
  flex-direction: column;
}

.fact span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.fact strong {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Result card view */
.result {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result.ok {
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.2);
}

.result.err {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.2);
}

.result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.result-body {
  word-break: break-all;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* QR Code presentation */
.qr-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.qr-image {
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  width: 180px;
  height: 180px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.button-link {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.button-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Error tip box */
.error-tip {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.error-tip b {
  font-size: 0.9rem;
  color: var(--accent-failed);
}

.error-tip span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Live process updates table */
.batch-live {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
  max-height: 300px;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--panel-border);
}

th {
  background: rgba(255, 255, 255, 0.02);
  font-weight: 600;
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

.email-cell {
  font-family: monospace;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-status {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.item-status.waiting {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.item-status.running {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.item-status.success {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.item-status.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.item-status.skipped {
  background: rgba(245, 158, 11, 0.15);
  color: #fde047;
}

.mini-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 6px;
  background: var(--accent-primary);
  margin-left: 0.5rem;
}

/* API Docs Section */
.api-docs {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.api-docs-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.api-docs-head h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.api-docs-head p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.api-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
}

.api-tab {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.api-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  transform: none;
}

.api-tab.active {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
}

.api-paged {
  position: relative;
}

.api-page {
  display: none;
}

.api-page.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.api-method {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.api-method b {
  background: #2563eb;
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}

.api-method code {
  color: var(--text-primary);
  font-weight: 600;
  font-family: monospace;
}

.api-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.api-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.api-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.param-table {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

.param-table div {
  font-size: 0.85rem;
  display: flex;
  gap: 0.5rem;
}

.param-table b {
  color: var(--accent-primary);
  font-family: monospace;
}

.param-table span {
  color: var(--text-secondary);
}

pre {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--panel-border);
  padding: 1rem;
  border-radius: 10px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #cbd5e1;
  overflow-x: auto;
}

.error-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.error-list div {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.1);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
}

.error-list b {
  font-size: 0.85rem;
  color: var(--accent-failed);
  font-family: monospace;
}

.error-list span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.api-footer-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
  padding-top: 0.75rem;
}

/* Float Stats Widget */
.float-stats {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  padding: 0.6rem 1rem;
  border-radius: 9999px;
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transition: all 0.3s ease;
}

.float-stats span {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.float-stats b {
  color: var(--text-primary);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #111827;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Real-time bulk links list items */
.payment-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.payment-item:last-child {
  margin-bottom: 0;
}

.item-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-success);
}

.item-head.fail {
  color: var(--accent-failed);
}

.item-head span:last-child {
  color: var(--text-secondary);
  font-family: monospace;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem;
  font-style: italic;
  font-size: 0.85rem;
}
