* { box-sizing: border-box; }
:root{
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  --primary: #2563eb;
  --primary2: #1d4ed8;
  --ring: rgba(37, 99, 235, 0.25);
  --code: #0b1224;
  --codeBg: #f1f5ff;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap { max-width: 1080px; margin: 18px auto; padding: 0 16px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(37,99,235,1), rgba(14,165,233,1));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 18px rgba(37,99,235,0.28);
  user-select: none;
}
.title { font-weight: 800; font-size: 16px; line-height: 1.1; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
@media (min-width: 920px) {
  .grid { grid-template-columns: 380px 1fr; align-items: start; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.cardTitle { margin: 0; font-size: 16px; font-weight: 800; }
.cardSub { margin: 6px 0 12px; color: var(--muted); font-size: 13px; }
.cardHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.dropzone{
  position: relative;
  border: 2px dashed rgba(37, 99, 235, 0.35);
  border-radius: 16px;
  padding: 14px;
  background: #f7f9ff;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
  cursor: pointer;
  outline: none;
}
.dropzone:focus { box-shadow: 0 0 0 4px var(--ring); }
.dropzone:hover { border-color: rgba(37, 99, 235, 0.55); transform: translateY(-1px); }
.dropzone.isDrag { border-color: rgba(14,165,233,0.65); box-shadow: 0 0 0 4px rgba(14,165,233,0.18); }
.dzFile { font-size: 13px; color: var(--code); background: #ffffff; border: 1px solid rgba(37,99,235,0.18); padding: 10px 12px; border-radius: 12px; }
.fileInput { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.form { margin-top: 12px; }
.label { display: block; color: var(--text); font-weight: 700; font-size: 13px; }
.labelHint { display: block; margin-top: 6px; color: var(--muted); font-weight: 500; font-size: 12px; }

input[type="number"] {
  display: block;
  margin-top: 8px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  outline: none;
}
input[type="number"]:focus { box-shadow: 0 0 0 4px var(--ring); border-color: rgba(37, 99, 235, 0.5); }

.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.rowTight { margin-top: 0; }

.btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(37,99,235,0.22);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.btn:hover { background: var(--primary2); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(37,99,235,0.22); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn2 { background: transparent; color: var(--text); border-color: var(--border); font-weight: 700; }
.btn2:hover { background: rgba(15,23,42,0.04); box-shadow: none; }

.spinner{
  width: 14px; height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: rgba(255,255,255,1);
  display: none;
  animation: spin 900ms linear infinite;
}
.isLoading .spinner{ display: inline-block; }
.isLoading .btnText{ opacity: 0.9; }
@keyframes spin { from{ transform: rotate(0deg);} to{ transform: rotate(360deg);} }

.status { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.small { margin-top: 10px; color: var(--muted); font-size: 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; color: var(--code); background: var(--codeBg); padding: 2px 6px; border-radius: 8px; border: 1px solid rgba(37,99,235,0.18); }

.tabs { display: flex; gap: 8px; margin-top: 12px; }
.tab {
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.02);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}
.tab.isActive { border-color: rgba(37,99,235,0.35); background: rgba(37,99,235,0.12); color: #0b1224; }
.panel { margin-top: 12px; }
.panel.isHidden { display: none; }
.history { display: grid; gap: 10px; margin-top: 10px; }
.historyItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.historyMeta { min-width: 0; }
.historyName { font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.historySub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.isHidden { display: none; }
.authBox{
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.02);
  border-radius: 14px;
  padding: 12px;
}
.authRow{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.authTitle{ font-weight: 900; font-size: 13px; }
.authState{ color: var(--muted); font-size: 12px; }
.authForm{ display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }
.authInput{
  flex: 1 1 180px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  outline: none;
}
.authInput:focus { box-shadow: 0 0 0 4px var(--ring); border-color: rgba(37, 99, 235, 0.5); }
.pre {
  background: #fbfcff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  overflow: auto;
  max-height: 520px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #0b1224;
}
