:root {
  --blue: #2b6cb0;
  --blue-dark: #1a3a5c;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --green: #38a169;
  --red: #e53e3e;
  --yellow: #d69e2e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.center { text-align: center; }
.mono { font-family: "SF Mono", Consolas, Monaco, "Courier New", monospace; }

/* ============== Login ============== */
.screen { min-height: 100vh; }
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2b6cb0 0%, #1a3a5c 100%);
}
.login-card {
  background: white;
  border-radius: 12px;
  padding: 36px 40px;
  width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.logo-row { margin-bottom: 4px; }
.brand { font-size: 22px; font-weight: 700; color: var(--blue-dark); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 18px 0 6px;
}
.email-row, .code-row { display: flex; gap: 0; align-items: center; }
.email-row input { border-radius: 6px 0 0 6px; flex: 1; }
.email-suffix {
  display: inline-block;
  padding: 9px 12px;
  background: #edf2f7;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-size: 13px;
}
.code-row input { border-radius: 6px 0 0 6px; flex: 1; }
.code-row button { border-radius: 0 6px 6px 0; }

.msg { min-height: 18px; margin: 10px 0; font-size: 12px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }
.msg.warn { color: var(--yellow); }

.full { width: 100%; }
.btn-success.full { margin-top: 10px; }

/* ============== Inputs ============== */
input[type="text"], textarea {
  padding: 9px 11px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
input[type="text"]:focus, textarea:focus {
  border-color: var(--blue);
}
input.mono, textarea.mono { font-family: "SF Mono", Consolas, Monaco, monospace; font-size: 12px; }
input:disabled, textarea:disabled { background: #f7fafc; color: var(--muted); cursor: not-allowed; }
textarea { resize: vertical; min-height: 100px; width: 100%; }

/* ============== Buttons ============== */
button {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  font-family: inherit;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover:not(:disabled) { background: #3182ce; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover:not(:disabled) { background: #2f855a; }
.btn-secondary { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: #edf2f7; }
.btn-link { background: transparent; color: var(--blue); padding: 4px 8px; }
.btn-link:hover { text-decoration: underline; }

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill-red { background: #fff5f5; color: var(--red); border: 1px solid #fed7d7; }
.pill-green { background: #f0fff4; color: var(--green); border: 1px solid #c6f6d5; }
.pill-yellow { background: #fffff0; color: var(--yellow); border: 1px solid #faf089; }

/* ============== Topbar ============== */
.topbar {
  background: var(--blue-dark);
  color: white;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar-logo { font-size: 17px; font-weight: 700; }
.topbar-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-right .muted { color: #a0c4e8; font-size: 12px; }

/* ============== Main ============== */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.form-row:last-child { margin-bottom: 0; }
.lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 110px;
}
.form-row input[type="text"] { flex: 1; min-width: 200px; }
.btn-row { gap: 8px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ============== Tabs ============== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px;
}
.tab {
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}
.tab-content { padding-top: 4px; }

/* ============== Tables ============== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
th {
  background: #f7fafc;
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}
tbody tr:hover { background: #f7fafc; }
td.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; }
td.status-ok { color: var(--green); font-weight: 600; }
td.status-fail { color: var(--red); font-weight: 600; }
td.status-pending { color: var(--muted); }
td.status-running { color: var(--yellow); font-weight: 600; }

.batch-results { margin-top: 14px; }
#batch-table tbody tr.selected { background: #ebf8ff; }

/* ============== Info ============== */
.info-card { background: #f7fafc; }
.info-line {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--blue-dark);
  margin-bottom: 10px;
}

/* ============== Progress + Log ============== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width 0.3s;
}
.status-line { font-size: 12px; margin-bottom: 12px; }
.log {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  background: #1a202c;
  color: #cbd5e0;
  padding: 12px;
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
