/* SSO → Auth — standalone styles, no CDN dependency */
:root { color-scheme: light; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
body {
  min-height: 100vh; background: #f8fafc; color: #1e293b;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  padding: 2rem 1.5rem;
}
.hidden { display: none !important; }
.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* --------- gate --------- */
.gate {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.gate.hidden { display: none; }
.gate-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.55); }
.gate-card {
  position: relative; width: 100%; max-width: 28rem;
  border-radius: 1rem; border: 1px solid #e2e8f0; background: #fff;
  padding: 1.5rem; box-shadow: 0 20px 40px rgba(15,23,42,.18);
}
.gate-card h2 { font-size: 1rem; font-weight: 600; color: #1e293b; }
.gate-sub { margin-top: .25rem; font-size: .75rem; color: #94a3b8; }
.gate-card label { display: block; margin-top: 1rem; font-size: .875rem; font-weight: 500; color: #334155; }
.gate-input {
  width: 100%; margin-top: .4rem; border-radius: .75rem; border: 1px solid #e2e8f0;
  background: #f8fafc; padding: .65rem .75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875rem;
}
.gate-error { margin: .5rem 0 0; font-size: .875rem; color: #e11d48; }
.gate-btns { display: flex; gap: .5rem; margin-top: 1rem; }
.gate-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center;
  border-radius: .75rem; padding: .65rem 1rem; font-size: .875rem; font-weight: 600;
  cursor: pointer; border: 1px solid #e2e8f0; background: #fff; color: #334155;
}
.gate-btn-primary { border-color: #2563eb; background: #2563eb; color: #fff; }

/* --------- modal --------- */
.modal { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.4); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative; max-height: 80vh; width: 100%; max-width: 36rem;
  border-radius: 1rem; border: 1px solid #e2e8f0; background: #fff;
  box-shadow: 0 20px 40px rgba(15,23,42,.18); display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; border-bottom: 1px solid #f1f5f9; padding: 1rem 1.25rem; }
.modal-head h3 { font-size: .875rem; font-weight: 600; color: #1e293b; }
.modal-sub { font-size: .75rem; color: #94a3b8; margin-top: .125rem; }
.modal-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; min-height: 0; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: .5rem; border: none; background: transparent;
  font-size: 1.25rem; color: #94a3b8; cursor: pointer;
}
.btn-icon:hover { background: #f1f5f9; color: #334155; }

/* --------- multi banner --------- */
.banner-warn {
  margin-bottom: 1.5rem; border-radius: 1rem; border: 1px solid #fde68a;
  background: #fffbeb; padding: 1rem 1.25rem; display: flex; gap: .75rem; align-items: flex-start;
}
.banner-icon {
  flex-shrink: 0; width: 2rem; height: 2rem; border-radius: .5rem;
  background: #fef3c7; color: #d97706; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .875rem;
}
.banner-title { font-size: .875rem; font-weight: 600; color: #92400e; }
.banner-text { margin-top: .125rem; font-size: .875rem; color: #a16207; }
.banner-acts { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.banner-acts button {
  border-radius: .5rem; padding: .375rem .75rem; font-size: .75rem; font-weight: 600; cursor: pointer;
}
.banner-acts button:first-child { background: #d97706; color: #fff; border: none; }
.banner-acts button:nth-child(2) { background: #fff; color: #be123c; border: 1px solid #fda4af; }
.banner-acts button:last-child { background: #fff; color: #92400e; border: 1px solid #fde68a; }

/* --------- header --------- */
header {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem; max-width: 96rem; margin-inline: auto;
}
.hd-left { min-width: 0; flex: 1; }
.hd-logo { font-size: .75rem; font-weight: 500; color: #2563eb; }
.hd-left h1 { margin-top: .25rem; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; color: #0f172a; }
.hd-sub { margin-top: .5rem; font-size: .875rem; color: #64748b; }
.hd-right { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex-shrink: 0; }
.hd-badge {
  display: inline-flex; align-items: center; gap: .5rem; height: 2.5rem;
  padding: 0 .875rem; border-radius: .75rem; border: 1px solid #e2e8f0; background: #fff;
  font-size: .875rem; font-weight: 500; color: #334155; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.hd-right > button {
  display: inline-flex; align-items: center; gap: .375rem; height: 2.5rem;
  padding: 0 .875rem; border-radius: .75rem; border: 1px solid #e2e8f0; background: #fff;
  font-size: .875rem; font-weight: 500; color: #334155; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.hd-right > button:hover { background: #f8fafc; }
.hd-history-btn svg { color: #94a3b8; }
#historyBadge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; border-radius: 9999px; background: #f1f5f9;
  font-size: .6875rem; font-weight: 600; color: #475569;
}

/* --------- stats --------- */
.stats-row { max-width: 96rem; margin-inline: auto; margin-bottom: 1.5rem; }
.stats-label { margin-bottom: .5rem; font-size: .75rem; font-weight: 500; color: #94a3b8; display: flex; align-items: center; gap: .5rem; }
#taskBadge {
  border-radius: 9999px; background: #dbeafe; padding: .25rem .625rem;
  font-size: .75rem; font-weight: 500; color: #1d4ed8;
}
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .stats-grid { grid-template-columns: repeat(5, 1fr); } }
.stats-grid article {
  border-radius: 1rem; border: 1px solid #e2e8f0; background: #fff;
  padding: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.stats-grid .st-span { grid-column: span 2; }
@media (min-width: 640px) { .stats-grid .st-span { grid-column: span 1; } }
.st-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: .5rem; font-size: .875rem;
}
.st-cyan { background: #dbeafe; color: #2563eb; }
.st-purple { background: #ede9fe; color: #7c3aed; }
.st-amber { background: #fef3c7; color: #d97706; }
.st-emerald { background: #d1fae5; color: #059669; }
.st-sky { background: #e0f2fe; color: #0284c7; }
.st-label { margin-left: .625rem; font-size: .75rem; font-weight: 500; color: #64748b; vertical-align: middle; }
.st-num {
  margin-top: .75rem; font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em;
  color: #0f172a; font-variant-numeric: tabular-nums; transition: color .2s, transform .2s;
}
.st-num.tick { color: #2563eb; transform: scale(1.04); }
.st-of { font-size: .875rem; font-weight: 500; color: #94a3b8; }
.st-row { margin-top: .75rem; display: flex; align-items: baseline; gap: .25rem; }
.st-row .st-num { margin-top: 0; }
.st-sub { margin-top: .125rem; font-size: .6875rem; color: #94a3b8; }

/* --------- main grid --------- */
.main-grid {
  display: grid; grid-template-columns: 1fr; gap: 1rem;
  max-width: 96rem; margin-inline: auto;
}
@media (min-width: 1280px) { .main-grid { grid-template-columns: 4fr 1fr; align-items: stretch; } }

.panel-left {
  border-radius: 1rem; border: 1px solid #e2e8f0; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); display: flex; flex-direction: column; overflow: hidden;
}
.panel-left > label:first-child {
  padding: 1.25rem 1.25rem 0; display: block; font-size: .875rem; font-weight: 500; color: #334155;
}
.label-hint { font-weight: 400; color: #94a3b8; }
.panel-left textarea {
  display: block; margin: .5rem 1.25rem 0; width: calc(100% - 2.5rem); min-height: 20rem; max-height: 26rem;
  resize: vertical; overflow-y: auto; border-radius: .75rem; border: 1px solid #e2e8f0;
  background: #f8fafc; padding: .625rem .75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .75rem; line-height: 1.625; color: #1e293b; outline: none;
}
.panel-left textarea:focus { background: #fff; box-shadow: 0 0 0 2px #2563eb; }
.line-info { padding: .5rem 1.25rem 0; font-size: .75rem; color: #94a3b8; }

/* ops bar */
.ops { border-top: 1px solid #f1f5f9; background: #f8fafc; padding: 1rem 1.25rem; }
.ops-btns { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

.btn-primary, .btn-ghost, .btn-retry, .btn-dl-primary, .btn-dl-ghost {
  display: inline-flex; align-items: center; justify-content: center; height: 2.5rem;
  padding: 0 1rem; border-radius: .75rem; font-size: .875rem; font-weight: 600; cursor: pointer;
}
.btn-primary { background: #2563eb; color: #fff; border: none; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { cursor: not-allowed; opacity: .5; }
.btn-ghost { background: #fff; color: #334155; border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: #f8fafc; }
.btn-ghost:disabled { cursor: not-allowed; opacity: .5; }
.btn-retry { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.btn-retry:hover { background: #fef3c7; }
.btn-retry:disabled { cursor: not-allowed; opacity: .5; }
.status-tag {
  margin-left: auto; font-size: .75rem; font-weight: 500; padding: .25rem .5rem; border-radius: 9999px; white-space: nowrap;
}
.s-amber { color: #d97706; background: #fef3c7; }
.s-blue { color: #2563eb; background: #dbeafe; }
.s-orange { color: #ea580c; background: #ffedd5; }
.s-green { color: #059669; background: #d1fae5; }
.s-teal { color: #0f766e; background: #ccfbf1; }
.s-red { color: #e11d48; background: #ffe4e6; }
.s-slate { color: #64748b; background: #f1f5f9; }

.progress-row { margin-top: .75rem; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.progress-bar { flex: 1; min-width: 0; height: .5rem; border-radius: 9999px; background: #e2e8f0; overflow: hidden; }
.progress-bar div { height: 100%; border-radius: 9999px; background: #2563eb; width: 0%; transition: width .35s ease; }
.progress-stats { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .75rem; color: #64748b; flex-shrink: 0; }
.progress-stats b { color: #1e293b; }
.c-green { color: #059669 !important; }
.c-red { color: #e11d48 !important; }
.err-msg { margin-top: .5rem; font-size: .875rem; color: #e11d48; }
.dl-btns { margin-top: .75rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-dl-primary { background: #059669; color: #fff; border: none; }
.btn-dl-primary:hover { background: #047857; }
.btn-dl-primary:disabled { cursor: not-allowed; opacity: .5; }
.btn-dl-ghost { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.btn-dl-ghost:hover { background: #d1fae5; }
.btn-dl-ghost:disabled { cursor: not-allowed; opacity: .5; }

/* --------- log panel --------- */
.panel-right {
  border-radius: 1rem; border: 1px solid #e2e8f0; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); display: flex; flex-direction: column;
  min-height: 32rem; overflow: hidden;
}
.log-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #f1f5f9; padding: .75rem 1rem;
}
.log-head span:first-child { font-size: .75rem; font-weight: 600; color: #334155; }
.log-sub { font-size: .6875rem; color: #94a3b8; }
.log-body { flex: 1; overflow-y: auto; position: relative; min-height: 0; }
.log-body > ul { padding: .5rem .75rem; }
.log-body > p {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; color: #94a3b8; text-align: center; padding: .75rem;
}

.log-card {
  list-style: none; border-radius: .5rem; border: 1px solid #f1f5f9;
  background: #f8fafc; padding: .375rem .5rem; margin-bottom: .5rem;
}
.log-card-hd { display: flex; gap: .375rem; color: #334155; }
.log-idx { flex-shrink: 0; font-variant-numeric: tabular-nums; color: #94a3b8; }
.log-preview { min-width: 0; word-break: break-all; }
.log-steps { margin-top: .25rem; padding-top: .25rem; border-top: 1px solid #f1f5f9; }
.log-step-bold { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: #2563eb; font-size: .6875rem; }
.log-step-dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #94a3b8; font-size: .6875rem; }

/* --------- history --------- */
.history-item { border-radius: .75rem; border: 1px solid #f1f5f9; background: #f8fafc; padding: .625rem .75rem; margin-bottom: .5rem; }
.history-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.history-item-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; color: #334155; }
.history-item-time { margin-top: .125rem; font-size: .6875rem; color: #94a3b8; }
.history-item-status { border-radius: 9999px; padding: .125rem .5rem; font-size: .6875rem; font-weight: 500; white-space: nowrap; }
.history-item-acts { margin-top: .375rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .6875rem; color: #64748b; }
.history-item-acts button { font-size: .6875rem; color: #2563eb; background: none; border: none; cursor: pointer; }
.history-item-acts button:hover { text-decoration: underline; }
.history-item-acts button:last-child { color: #94a3b8; }

/* --------- footer --------- */
footer { margin-top: 2.5rem; padding-bottom: .5rem; text-align: center; font-size: .75rem; color: #94a3b8; max-width: 96rem; margin-inline: auto; }