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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --accent: #5b6af5;
  --accent-hover: #4a57e8;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --gray: #64748b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --radius: 10px;
  --radius-sm: 6px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

.layout {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.yt-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .2s;
}
.yt-badge:hover { border-color: var(--accent); }
.yt-badge .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gray);
}
.yt-badge.ok .dot { background: var(--green); }
.yt-badge.error .dot { background: var(--red); }
.yt-badge.checking .dot { background: var(--yellow); animation: pulse 1s infinite; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* Textarea */
textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: "SF Mono", "Cascadia Code", monospace;
  padding: 10px 12px;
  resize: vertical;
  min-height: 100px;
  transition: border-color .2s;
  outline: none;
}
textarea:focus { border-color: var(--accent); }
textarea::placeholder { color: var(--gray); }

/* Networks */
.network-section { display: flex; flex-direction: column; gap: 12px; }
.network-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.network-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.network-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 24px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.chip input[type=checkbox] { display: none; }
.chip.selected {
  border-color: var(--accent);
  background: rgba(91,106,245,.12);
}
.chip .chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gray);
}
.chip.selected .chip-dot { background: var(--accent); }

label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  justify-content: center;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

/* Jobs */
.jobs-section { margin-top: 8px; }
.jobs-section h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 12px;
}

.concept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
}
.concept-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface2);
  cursor: pointer;
  user-select: none;
}
.concept-header:hover { background: #252945; }
.concept-name { font-weight: 600; font-size: 13px; }
.concept-meta { display: flex; align-items: center; gap: 10px; }

.badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-queued  { background: #1e2533; color: var(--gray); }
.badge-scanning{ background: #1a2535; color: #60a5fa; }
.badge-uploading{background: #1a2535; color: #60a5fa; }
.badge-done    { background: #14261e; color: var(--green); }
.badge-error   { background: #2a1515; color: var(--red); }
.badge-running { background: #1a2535; color: #60a5fa; }

.video-table { width: 100%; border-collapse: collapse; }
.video-table th, .video-table td {
  padding: 9px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.video-table th {
  color: var(--text-dim);
  font-weight: 600;
  background: var(--surface);
}
.video-table tr:last-child td { border-bottom: none; }
.video-table tr:hover td { background: rgba(255,255,255,.02); }

.status-icon { font-size: 14px; }
.yt-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.yt-link:hover { text-decoration: underline; }
.copy-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 13px;
}
.copy-btn:hover { color: var(--text); background: var(--surface2); }

.err-text {
  color: var(--red);
  font-size: 11px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  z-index: 1000;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin .8s linear infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

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

/* Alert banner */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.alert.error { background: #2a1515; border: 1px solid #7f1d1d; color: #fca5a5; display: block; }
.alert.warn  { background: #2a2010; border: 1px solid #78350f; color: #fde68a; display: block; }

.link-count {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}
