:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2430;
  --blue: #0b86f7;
  --blue-soft: #eaf4ff;
  --green: #00c896;
  --green-soft: #e9fbf5;
  --ink: #1f2430;
  --muted: #8a95a4;
  --line: #e8edf3;
  --surface: #ffffff;
  --danger: #f06464;
  --shadow: 0 10px 24px rgba(36, 48, 68, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(245, 247, 251, 0.92)),
    #f5f7fb;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

button:hover {
  border-color: rgba(11, 134, 247, 0.42);
  box-shadow: 0 6px 14px rgba(11, 134, 247, 0.12);
}

button:active {
  transform: translateY(1px);
}

input,
select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(11, 134, 247, 0.1);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.app-shell {
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 4px 22px;
}

.app-header h1 {
  margin: 2px 0 0;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.05;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.subline,
.section-head p,
.panel-card p,
.hero-card p,
#detailFile {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.header-actions,
.compact-actions,
.upload-actions,
.run-row,
.token-row,
.batch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-btn {
  min-width: 58px;
  background: rgba(255, 255, 255, 0.78);
}

.connection-card,
.hero-card,
.status-card,
.accounts-card,
.panel-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(207, 232, 224, 0.88);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.connection-card {
  display: none;
  margin-bottom: 16px;
}

.connection-card.open {
  display: block;
}

.token-row {
  margin-top: 14px;
}

.token-row input {
  flex: 1 1 260px;
}

[hidden],
.auth-card[hidden] {
  display: none;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.auth-grid label {
  display: grid;
  gap: 8px;
  color: #4d5a68;
  font-size: 14px;
  font-weight: 800;
}

.auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.token-row button,
#saveProfileBtn,
#saveAccountBtn,
#runBtn,
#uploadBtn,
#loginBtn,
#applyProfileBtn {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
}

.primary-column,
.side-column {
  display: grid;
  gap: 18px;
  align-content: start;
}

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  overflow: hidden;
}

.hero-card h2,
.section-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.big-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 172px;
  min-height: 70px;
  border: 0;
  border-radius: 20px;
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(11, 134, 247, 0.2);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.big-action.secondary {
  background: var(--blue-soft);
  color: #0974d7;
  box-shadow: none;
}

.big-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.soft-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
}

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

.alive-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #02a77e;
  font-weight: 800;
  white-space: nowrap;
}

.alive-pill span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.timeline {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #fbfcfe;
}

.timeline > div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.timeline > div:last-child {
  border-bottom: 0;
}

.timeline span {
  color: var(--muted);
  font-weight: 700;
}

.timeline strong {
  min-width: 0;
  font-size: 16px;
}

.run-row select {
  flex: 1 1 150px;
}

pre {
  margin: 16px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7fbff;
  color: #536172;
  border: 1px solid #e5f0fb;
  border-radius: 18px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
}

.batch-bar {
  margin-bottom: 16px;
}

.batch-bar select {
  min-width: 160px;
}

#enableSelectedBtn {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

#disableSelectedBtn {
  color: #be4b4b;
}

.account-list {
  display: grid;
  gap: 14px;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #edf1f6;
  border-radius: 18px;
  background: #ffffff;
}

.user-card strong {
  display: block;
  font-size: 17px;
}

.user-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.user-edit {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 78px;
  gap: 8px;
}

.user-edit .toggle-line,
.user-edit button {
  min-height: 40px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  color: var(--muted);
  border: 1px dashed #d5dde7;
  border-radius: 22px;
  background: #fbfcff;
}

.account-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 96px;
  padding: 16px;
  border: 1px solid #edf1f6;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(31, 36, 48, 0.05);
  cursor: pointer;
}

.account-card.active {
  border-color: rgba(11, 134, 247, 0.55);
  background: #f6fbff;
}

.file-icon {
  width: 34px;
  height: 42px;
  border: 3px solid var(--blue);
  border-radius: 6px;
  position: relative;
}

.file-icon::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -3px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-left: 3px solid var(--blue);
  border-bottom: 3px solid var(--blue);
  border-bottom-left-radius: 4px;
}

.account-main {
  min-width: 0;
}

.account-name {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.account-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.account-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #02a77e;
  font-size: 13px;
  font-weight: 800;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.status.off {
  background: #fff0f0;
  color: var(--danger);
}

.status.off::before {
  background: var(--danger);
}

.select-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.full-input {
  width: 100%;
  margin-bottom: 14px;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.task-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: #f7f9fc;
  color: #3b4654;
  font-weight: 700;
}

.task-grid.compact {
  margin-top: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: #4d5a68;
  font-size: 14px;
  font-weight: 800;
}

.toggle-line {
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row;
  align-items: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 16px;
  background: #1f2430;
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  z-index: 20;
}

@media (max-width: 1040px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .app-header {
    align-items: flex-start;
  }

  .connection-card,
  .hero-card,
  .status-card,
  .accounts-card,
  .panel-card {
    border-radius: 20px;
    padding: 16px;
  }

  .hero-card,
  .side-column {
    grid-template-columns: 1fr;
  }

  .upload-actions,
  .auth-grid,
  .batch-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .big-action {
    min-width: 0;
    min-height: 64px;
    font-size: 17px;
  }

  .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .timeline > div {
    grid-template-columns: 54px minmax(0, 1fr);
    padding: 13px;
  }

  .account-card {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .account-side {
    grid-column: 2;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

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

@media (max-width: 420px) {
  .app-shell {
    padding: 12px 10px;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-actions,
  .auth-grid,
  .batch-bar,
  .token-row,
  .run-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .compact-actions {
    width: 100%;
  }

  .compact-actions button {
    flex: 1;
  }
}
