/* ═══════════════════════════════════════════════
   ChatGPT Batch Registration - Apple Glass Theme
   v3.0 — Clean, tested, no layout issues
═══════════════════════════════════════════════ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Fira Code", ui-monospace, monospace;

  --bg: #0d0d18;
  --surface: rgba(22, 22, 40, 0.72);
  --surface-hover: rgba(30, 30, 55, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.18);

  --accent: #0a84ff;
  --accent-glow: rgba(10, 132, 255, 0.25);
  --green: #32d74b;
  --red: #ff453a;
  --orange: #ff9f0a;
  --purple: #bf5af2;

  --text: #f2f2f7;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --text-placeholder: rgba(235, 235, 245, 0.28);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 5px;

  --blur: saturate(180%) blur(28px);
  --shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 3px 16px rgba(0, 0, 0, 0.25);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Animated Background ── */
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 10% 10%, rgba(90, 40, 160, 0.28), transparent),
    radial-gradient(ellipse 70% 70% at 90% 20%, rgba(10, 80, 170, 0.22), transparent),
    radial-gradient(ellipse 60% 80% at 50% 90%, rgba(10, 132, 255, 0.10), transparent),
    #0d0d18;
  animation: bgShift 18s ease-in-out infinite alternate;
}
@keyframes bgShift {
  0%   { filter: hue-rotate(0deg);   }
  100% { filter: hue-rotate(20deg);  }
}

/* ── Header ── */
.header {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 56px;
  background: rgba(13, 13, 24, 0.8);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-brand h1 {
  font-size: 1.05rem; font-weight: 600;
  background: linear-gradient(120deg, #fff 30%, #a29bfe);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.status-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 14px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 500;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  user-select: none;
}
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-secondary);
  transition: background 0.4s;
}
.status-pill.running .dot {
  background: var(--green);
  box-shadow: 0 0 7px var(--green);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }

/* ── Page Layout ── */
.page {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 1100px) {
  .page { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
}

/* ── Sidebar ── */
.sidebar {
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 8px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ── Glass Card ── */
.card {
  background: var(--surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: visible; /* must NOT be hidden — team textareas must fully expand */
  transition: border-color 0.3s;
  position: relative;
}
.card:focus-within { border-color: rgba(10,132,255,0.35); }
.card-inner-clip {
  /* used only for rounding the card content — NOT .card itself */
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Card Header (collapsible) ── */
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px;
  font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  background: rgba(0,0,0,0.12);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.card-head:hover { background: rgba(255,255,255,0.04); }
.card-head .title { display: flex; align-items: center; gap: 8px; }
.card-head .chevron {
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: transform 0.3s cubic-bezier(.16,1,.3,1);
}
.card-head.collapsed .chevron { transform: rotate(-90deg); }

.card-body {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 18px;
  transition: opacity 0.3s;
  opacity: 1;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: visible; /* must be visible so team card textareas don't clip */
}
.card-body.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

/* ── Form ── */
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding-left: 2px;
}

.inp {
  width: 100%;
  padding: 9px 13px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
.inp::placeholder { color: var(--text-placeholder); }
.inp:focus {
  background: rgba(0,0,0,0.3);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), inset 0 1px 3px rgba(0,0,0,0.2);
}

textarea.inp {
  resize: vertical; min-height: 48px; line-height: 1.45;
  font-family: var(--mono); font-size: 0.78rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 20px;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: all 0.18s cubic-bezier(.16,1,.3,1);
  white-space: nowrap;
}
.btn:active { transform: scale(0.96) !important; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-blue   { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(10,132,255,.3); }
.btn-blue:hover:not(:disabled)   { filter: brightness(1.1); box-shadow: 0 4px 14px rgba(10,132,255,.4); }

.btn-green  { background: var(--green);  color: #000; box-shadow: 0 2px 8px rgba(50,215,75,.2); }
.btn-green:hover:not(:disabled)  { filter: brightness(1.08); }

.btn-red    { background: var(--red);    color: #fff; }
.btn-red:hover:not(:disabled)    { filter: brightness(1.1); }

.btn-ghost  {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled)  { background: rgba(255,255,255,0.1); border-color: var(--border-bright); }

.btn-ghost-danger {
  background: rgba(255,69,58,0.08);
  border: 1px solid rgba(255,69,58,0.25);
  color: var(--red);
}
.btn-ghost-danger:hover { background: rgba(255,69,58,0.18); }

.icon-btn {
  padding: 6px;
  background: transparent;
  border: none; border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center;
  transition: all 0.18s;
}
.icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.icon-btn.danger:hover { background: rgba(255,69,58,0.18); color: var(--red); }

/* ── Toggle ── */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; }
.toggle-wrap label.label { font-size: 0.88rem; color: var(--text); }
.toggle {
  position: relative; width: 44px; height: 24px;
  cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.2);
  border-radius: 12px;
  transition: background 0.3s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked + .track { background: var(--green); }
.track::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: transform 0.3s cubic-bezier(.16,1,.3,1);
}
.toggle input:checked + .track::after { transform: translateX(20px); }

/* ── Checkbox ── */
.chk {
  appearance: none;
  width: 16px; height: 16px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: rgba(0,0,0,0.25);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  transition: all 0.18s;
}
.chk:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.chk:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

/* ── Team Card ── */
.team-card {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.2s;
}
.team-card:focus-within { border-color: rgba(10,132,255,0.3); }
.team-card-top {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.team-card-top .team-lbl {
  font-size: 0.82rem; font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--mono);
}

/* ── Main Content ── */
.main { display: flex; flex-direction: column; gap: 20px; }

/* ── Terminal ── */
.terminal {
  background: #000;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 14px 16px;
  height: 340px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
}
.terminal::-webkit-scrollbar { width: 6px; }
.terminal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 4px; }
.log { color: #8b97b0; white-space: pre-wrap; word-break: break-all; }
.log.ok  { color: #32d74b; }
.log.err { color: #ff453a; }
.log.wrn { color: #ff9f0a; }
.log.inf { color: #0a84ff; }
.log.hi  { color: #fff; font-weight: 600; }

/* ── Table ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.84rem; }
thead th {
  padding: 10px 16px; text-align: left;
  font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-secondary);
  background: rgba(0,0,0,0.12);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
tbody tr:hover td { background: rgba(255,255,255,0.03); }
tbody tr:last-child td { border-bottom: none; }

.tag {
  display: inline-flex; padding: 2px 9px;
  border-radius: 12px; font-size: 0.74rem; font-weight: 600;
}
.tag.ok  { background: rgba(50,215,75,0.14); color: var(--green); border: 1px solid rgba(50,215,75,.2); }
.tag.err { background: rgba(255,69,58,0.14); color: var(--red);   border: 1px solid rgba(255,69,58,.2); }

.empty { text-align: center; padding: 32px; color: var(--text-secondary); font-style: italic; }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; padding: 16px 18px 0;
}
.toolbar-spacer { flex: 1; }

/* ── Toast ── */
.toast-wrap {
  position: fixed; bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 9px;
  z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: rgba(25,25,40,0.9);
  backdrop-filter: var(--blur);
  border: 1px solid var(--border-bright);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  font-size: 0.88rem;
  animation: toastIn 0.35s cubic-bezier(.16,1,.3,1) forwards;
  transform: translateY(20px); opacity: 0;
}
@keyframes toastIn { to { transform: none; opacity: 1; } }
.toast.out { animation: toastOut 0.25s ease-in forwards; }
@keyframes toastOut { to { transform: scale(.9); opacity: 0; } }
.toast-ico { font-size: 1rem; line-height: 1; }
.toast.ok  .toast-ico { color: var(--green); }
.toast.err .toast-ico { color: var(--red);   }
