:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --border: #e6eaf3;
  --border-strong: #d7ddec;
  --text: #1b2233;
  --text-2: #5c657b;
  --text-3: #8f97aa;
  --primary: #3457d5;
  --primary-hover: #2a49bb;
  --primary-soft: #edf1ff;
  --baidu: #2b6cf6;
  --baidu-soft: #eaf1ff;
  --quark: #6d4aff;
  --quark-soft: #f0ecff;
  --green: #0f9d6e;
  --green-soft: #e5f7f0;
  --red: #d14343;
  --red-soft: #fdeeee;
  --amber: #b26a00;
  --amber-soft: #fdf3df;
  --shadow: 0 1px 2px rgba(24, 34, 63, 0.04), 0 14px 34px -20px rgba(24, 34, 63, 0.22);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1200px 480px at 8% -10%, rgba(79, 124, 255, 0.1), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(109, 74, 255, 0.07), transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px 72px;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: none;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 14px rgba(52, 87, 213, 0.28));
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.2px;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.3px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.browser-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-2);
  font-size: 12px;
}

.browser-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9c0d1;
}

.browser-chip.running {
  color: var(--green);
  border-color: #cdeee2;
  background: var(--green-soft);
}

.browser-chip.running .dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 157, 110, 0.12);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-2);
  transition: 0.16s ease;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: #c7d2f2;
  background: #fff;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- tabs ---------- */
.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 8px;
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 2px rgba(24, 34, 63, 0.03);
}

.tab {
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 0.16s ease;
}

.tab:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(52, 87, 213, 0.75);
}

.tab-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(27, 34, 51, 0.07);
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab.active .tab-count {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- layout ---------- */
.tab-panel {
  display: none;
  animation: fade-in 0.22s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 6px 0 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -0.2px;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
  max-width: 720px;
}

.section-head .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.notice {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #dbe4ff;
  border-radius: 14px;
  background: linear-gradient(180deg, #f5f7ff, #fbfcff);
  margin-bottom: 20px;
}

.notice-icon {
  width: 32px;
  height: 32px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
}

.notice-icon svg {
  width: 18px;
  height: 18px;
}

.notice strong {
  font-size: 13px;
}

.notice p {
  margin: 3px 0 0;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------- buttons & fields ---------- */
.btn {
  height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: 0.16s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover:not(:disabled) {
  border-color: #bcc7df;
  background: #fbfcff;
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: none;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px -12px rgba(52, 87, 213, 0.85);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn.large {
  height: 46px;
  padding: 0 26px;
  font-size: 14px;
  border-radius: 12px;
}

.btn.danger {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 20px -12px rgba(209, 67, 67, 0.85);
}

.btn.danger:hover:not(:disabled) {
  background: #b93a3a;
  border-color: #b93a3a;
}

.btn.danger-outline {
  color: var(--red);
  border-color: #efc9c9;
  background: #fff;
}

.btn.danger-outline:hover:not(:disabled) {
  background: var(--red-soft);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
}

.link-btn:hover {
  background: var(--primary-soft);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.field em {
  font-style: normal;
  color: var(--text-3);
  font-size: 11.5px;
}

.field input,
.field select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  outline: none;
  transition: 0.16s ease;
}

.field input:focus,
.field select:focus,
.links-input:focus {
  border-color: #97aaf0;
  box-shadow: 0 0 0 3px rgba(52, 87, 213, 0.12);
}

.field input::placeholder {
  color: #b3bacb;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: 1fr 1fr;
}

.hint {
  margin: 12px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

/* ---------- accounts ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 14px;
}

.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(24, 34, 63, 0.03);
  transition: 0.16s ease;
}

.account-card:hover {
  border-color: #d0d8eb;
  box-shadow: 0 12px 28px -22px rgba(24, 34, 63, 0.45);
}

.account-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.mini-avatar,
.avatar {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.avatar.baidu,
.mini-avatar.baidu,
.platform-logo.baidu {
  background: linear-gradient(145deg, #4f86ff, #2258d6);
}

.avatar.quark,
.mini-avatar.quark,
.platform-logo.quark {
  background: linear-gradient(145deg, #8a6bff, #5a36e0);
}

.account-info {
  min-width: 0;
  flex: 1;
}

.account-label {
  font-weight: 650;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-pill {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.status-pill.active {
  color: var(--green);
  background: var(--green-soft);
}

.status-pill.login_required {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.risk {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.disabled {
  color: var(--text-3);
  background: #f0f2f7;
}

.status-pill.pending {
  color: var(--text-2, #5b6478);
  background: #f0f2f7;
}

.status-pill.running {
  color: var(--primary);
  background: var(--primary-soft);
}

.status-pill.done {
  color: var(--green);
  background: var(--green-soft);
}

.status-pill.failed {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.stopped,
.status-pill.skipped {
  color: var(--amber);
  background: var(--amber-soft);
}

.account-meta {
  margin: 12px 0 2px;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.account-meta .err {
  color: var(--red);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.account-actions button {
  flex: 1;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  transition: 0.14s ease;
}

.account-actions button:hover {
  border-color: #c6d0e8;
  color: var(--text);
  background: var(--surface-2);
}

.account-actions button.danger:hover {
  color: var(--red);
  border-color: #efc9c9;
  background: var(--red-soft);
}

/* ---------- empty ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 54px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.42);
}

.empty.hidden {
  display: none;
}

.empty.small {
  padding: 26px 12px;
  border-radius: 12px;
  font-size: 12.5px;
}

.empty-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  color: #aeb8d2;
}

.empty-mark svg {
  width: 100%;
  height: 100%;
}

.empty h3 {
  margin: 0 0 5px;
  font-size: 15px;
  color: var(--text);
}

.empty p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 380px;
}

/* ---------- tasks ---------- */
.task-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.task-grid > .card:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.task-grid > .card:nth-child(2) {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.task-grid > .card:nth-child(3) {
  grid-column: 1;
  grid-row: 2;
}

.pack-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-color: #cfdbff;
  background: linear-gradient(135deg, #f5f8ff, #fbfcff 72%);
}

.pack-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.pack-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 10px 20px -12px rgba(52, 87, 213, 0.9);
}

.pack-info {
  min-width: 0;
}

.pack-info h3 {
  margin: 0;
  font-size: 14.5px;
}

.pack-meta {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-2);
}

.pack-hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}

.pack-hint.warn {
  color: var(--amber);
}

.pack-actions {
  flex: none;
  display: flex;
  gap: 8px;
}

.pack-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pack-tools .btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12px;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 650;
  margin-bottom: 13px;
}

.step-label > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10.5px;
  letter-spacing: 0.4px;
}

.step-label .link-btn {
  margin-left: auto;
}

.links-input {
  width: 100%;
  min-height: 186px;
  padding: 12px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  resize: vertical;
  outline: none;
  transition: 0.16s ease;
}

.links-input::placeholder {
  color: #a9b1c5;
}

.parse-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  min-height: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 550;
}

.chip.baidu {
  color: var(--baidu);
  background: var(--baidu-soft);
  border-color: #d6e3ff;
}

.chip.quark {
  color: var(--quark);
  background: var(--quark-soft);
  border-color: #e0d8ff;
}

.chip.ok {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cdeee2;
}

.parse-problems {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--amber);
  line-height: 1.7;
}

.parse-problems div {
  display: flex;
  gap: 6px;
}

.parse-problems div::before {
  content: "!";
  font-weight: 800;
}

.account-picker {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.account-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: 0.14s ease;
  background: #fff;
}

.account-option:hover {
  border-color: #ccd6ec;
  background: var(--surface-2);
}

.account-option.selected {
  border-color: #b9c6f5;
  background: #f7f9ff;
}

.account-option.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.account-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex: none;
}

.account-option .mini-avatar {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  font-size: 12.5px;
}

.opt-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.opt-label {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opt-sub {
  font-size: 10.8px;
  color: var(--text-3);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: #b9c0d1;
}

.status-dot.active {
  background: var(--green);
}

.status-dot.login_required {
  background: #e0a432;
}

.status-dot.risk {
  background: var(--red);
}

.run-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  position: sticky;
  bottom: 16px;
  z-index: 12;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.run-bar-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.run-bar-info strong {
  font-size: 13.5px;
}

.run-bar-info span {
  font-size: 11.8px;
  color: var(--text-3);
}

.active-run {
  margin-top: 16px;
}

.active-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.active-head h3 {
  margin: 0;
  font-size: 15px;
}

.active-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.progress {
  height: 8px;
  margin: 15px 0 14px;
  border-radius: 999px;
  background: #edf0f7;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f7cff, #6d4aff);
  transition: width 0.4s ease;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat {
  flex: 1;
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.stat b {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.stat span {
  font-size: 11px;
  color: var(--text-3);
}

.stat.green b { color: var(--green); }
.stat.red b { color: var(--red); }
.stat.blue b { color: var(--primary); }

.run-items {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.run-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 12.3px;
}

.run-item:last-child {
  border-bottom: 0;
}

.run-item .ri-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-item .ri-sub {
  color: var(--text-3);
  font-size: 11px;
  margin-left: 6px;
}

.run-item .ri-error {
  color: var(--red);
  font-size: 11px;
  margin-left: 6px;
}

/* ---------- results ---------- */
.run-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.run-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  cursor: pointer;
  transition: 0.15s ease;
}

.run-card:hover {
  border-color: #ccd6ec;
  transform: translateY(-1px);
}

.run-card.active {
  border-color: #aebcf2;
  box-shadow: 0 0 0 3px rgba(52, 87, 213, 0.08);
}

.run-card-main {
  flex: 1;
  min-width: 0;
}

.run-card-title {
  font-size: 13px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.run-card-sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-3);
}

.run-card-stats {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--text-2);
  flex: none;
}

.run-card-stats b {
  font-weight: 700;
}

.run-card-stats .ok { color: var(--green); }
.run-card-stats .bad { color: var(--red); }

.run-detail {
  margin-top: 6px;
}

.run-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.run-detail-head h3 {
  margin: 0;
  font-size: 15px;
}

.run-detail-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.run-detail-head .actions {
  display: flex;
  gap: 8px;
}

.filter-row {
  display: flex;
  gap: 6px;
  margin: 16px 0 12px;
  flex-wrap: wrap;
}

.filter {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
}

.filter:hover {
  background: var(--surface-2);
}

.filter.active {
  color: var(--primary);
  border-color: #c3cff7;
  background: var(--primary-soft);
  font-weight: 650;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
  font-size: 12px;
}

.result-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 10px 12px;
  background: #f7f8fc;
  color: var(--text-2);
  font-weight: 650;
  font-size: 11.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef1f7;
  vertical-align: top;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table tbody tr:hover {
  background: #fafbff;
}

.cell-link {
  max-width: 250px;
}

.cell-link a {
  display: block;
  color: var(--primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-link a:hover {
  text-decoration: underline;
}

.cell-sub {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10.8px;
}

.pwd-code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.copy-btn {
  margin-left: 4px;
  height: 22px;
  padding: 0 7px;
  font-size: 10.5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-2);
}

.copy-btn:hover {
  color: var(--primary);
  border-color: #c3cff7;
  background: var(--primary-soft);
}

.cell-error {
  max-width: 240px;
  color: var(--red);
  font-size: 11px;
  line-height: 1.5;
  word-break: break-word;
}

.cell-error.muted {
  color: var(--text-3);
}

.stage-text {
  color: var(--text-3);
  font-size: 10.5px;
  margin-top: 2px;
}

/* ---------- settings ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-grid > .card:nth-child(3) {
  grid-column: 1 / -1;
}

.card-title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 650;
}

.settings-note {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.65;
}

.browser-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
}

.switch-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.switch-row input {
  display: none;
}

.switch {
  width: 38px;
  height: 22px;
  flex: none;
  border-radius: 999px;
  background: #d3d8e5;
  position: relative;
  transition: 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: 0.2s ease;
  box-shadow: 0 1px 3px rgba(20, 27, 46, 0.2);
}

.switch-row input:checked + .switch {
  background: var(--primary);
}

.switch-row input:checked + .switch::after {
  transform: translateX(16px);
}

.switch-row strong {
  display: block;
  font-size: 12.5px;
  margin-bottom: 2px;
}

.switch-row em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.55;
}

.data-path {
  margin: 14px 0 0;
}

.data-path code {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  word-break: break-all;
}

.logs-card {
  margin-top: 16px;
}

.logs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.logs-head .card-title {
  margin: 0;
}

.logs {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.8;
  color: var(--text-2);
}

.log-line {
  display: flex;
  gap: 10px;
}

.log-line .time {
  color: #a3aabb;
  flex: none;
}

.log-line.error {
  color: var(--red);
}

.log-line.warn {
  color: var(--amber);
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 25, 45, 0.46);
  backdrop-filter: blur(4px);
  animation: fade-in 0.16s ease;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.45);
  animation: modal-pop 0.2s ease;
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.platform-picker {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 16px;
}

.platform-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  transition: 0.15s ease;
}

.platform-option:hover {
  border-color: #c1ccef;
  background: #fbfcff;
}

.platform-option.active {
  border-color: #9db0f0;
  background: #f6f8ff;
  box-shadow: 0 0 0 3px rgba(52, 87, 213, 0.08);
}

.platform-logo {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
}

.platform-option > span:nth-child(2) {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.platform-option strong {
  font-size: 13.5px;
}

.platform-option em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
}

.radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #c6cddd;
  flex: none;
  position: relative;
}

.platform-option.active .radio-dot {
  border-color: var(--primary);
}

.platform-option.active .radio-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

.qr-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0 2px;
}

.qr-frame {
  width: 232px;
  height: 232px;
  padding: 9px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 5px var(--surface-2);
}

.qr-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  display: none;
}

.qr-frame img.ready {
  display: block;
}

.qr-placeholder {
  position: absolute;
  inset: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
}

.qr-placeholder.hidden {
  display: none;
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid #d9e0f3;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  font-weight: 600;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0c7d7;
}

.state-dot.waiting {
  background: #e0a432;
  box-shadow: 0 0 0 3px rgba(224, 164, 50, 0.14);
}

.state-dot.confirming {
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 87, 213, 0.14);
}

.state-dot.success {
  background: var(--green);
}

.state-dot.error {
  background: var(--red);
}

.login-success {
  text-align: center;
  padding: 16px 0 4px;
}

.success-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-mark svg {
  width: 40px;
  height: 40px;
}

.login-success h4 {
  margin: 0 0 5px;
  font-size: 17px;
}

.login-success p {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
}

.confirm-card {
  max-width: 400px;
}

.confirm-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.confirm-card p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
}

/* ---------- toasts ---------- */
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 380px;
  padding: 11px 14px;
  border-radius: 11px;
  background: #1d2537;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.55;
  box-shadow: 0 16px 36px -16px rgba(15, 23, 42, 0.6);
  animation: toast-in 0.22s ease;
  pointer-events: auto;
}

.toast.success {
  background: #0e7a57;
}

.toast.error {
  background: #a93535;
}

.toast.warn {
  background: #8a5a12;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .task-grid {
    grid-template-columns: 1fr;
  }

  .task-grid > .card:nth-child(1),
  .task-grid > .card:nth-child(2),
  .task-grid > .card:nth-child(3) {
    grid-column: auto;
    grid-row: auto;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid > .card:nth-child(3) {
    grid-column: auto;
  }

  .run-card {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0 16px 60px;
  }

  .topbar {
    padding: 16px 0 12px;
  }

  .brand-text p {
    display: none;
  }

  .browser-chip {
    display: none;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    padding: 0 13px;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head > .btn {
    align-self: flex-start;
  }

  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .run-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .run-bar .btn {
    width: 100%;
  }

  .modal-card {
    padding: 18px;
  }

  .qr-frame {
    width: 208px;
    height: 208px;
  }

  .run-card-stats {
    width: 100%;
    justify-content: flex-start;
  }

  .pack-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .pack-actions {
    width: 100%;
  }

  .pack-actions .btn {
    flex: 1;
  }
}

/* ---------- login ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 34px 30px 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-brand .brand-mark {
  width: 40px;
  height: 40px;
}

.login-brand strong {
  display: block;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.login-brand span {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.login-card > p {
  margin: 0 0 22px;
  color: var(--text-2);
  line-height: 1.7;
}

.login-card .btn {
  width: 100%;
  margin-top: 18px;
}

.login-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  line-height: 1.5;
}

.login-foot {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

.login-card .field span {
  font-size: 12px;
  color: var(--text-2);
}

@media (max-width: 640px) {
  .section-head .actions {
    width: 100%;
  }

  .section-head .actions .btn {
    flex: 1;
  }
}
