:root {
  color-scheme: dark;
  --page-bg: #060914;
  --page-bg-alt: #0b1224;
  --surface: rgba(10, 15, 29, 0.84);
  --surface-strong: rgba(13, 18, 34, 0.96);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-inset: rgba(4, 8, 18, 0.88);
  --surface-elevated: rgba(18, 25, 45, 0.92);
  --text: #eef3ff;
  --text-soft: #c8d3f4;
  --muted: #8e9cc0;
  --border: rgba(152, 170, 255, 0.14);
  --border-strong: rgba(152, 170, 255, 0.24);
  --line: rgba(255, 255, 255, 0.08);
  --accent: #5d8bff;
  --accent-strong: #7d5cff;
  --accent-cyan: #48d4ff;
  --accent-soft: rgba(93, 139, 255, 0.16);
  --success: #4fe0ac;
  --success-soft: rgba(79, 224, 172, 0.16);
  --danger: #ff8da1;
  --danger-soft: rgba(255, 141, 161, 0.16);
  --warning: #ffd977;
  --warning-soft: rgba(255, 217, 119, 0.16);
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.28);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 12px;
  --mono: "JetBrains Mono", "SFMono-Regular", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  font-family: "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 10% 12%, rgba(125, 92, 255, 0.22), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(72, 212, 255, 0.18), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(93, 139, 255, 0.12), transparent 40%),
    linear-gradient(180deg, #050812 0%, #070b15 42%, #060913 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 78%);
  opacity: 0.3;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.28) 100%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 16px 0 22px;
}

.glass-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 28, 49, 0.94) 0%, rgba(10, 15, 28, 0.94) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 22%, transparent 72%, rgba(93, 139, 255, 0.05));
  pointer-events: none;
}

.toolbar {
  margin-bottom: 12px;
}

.hero-card {
  min-height: 0;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -70px;
  top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(93, 139, 255, 0.16) 0%, rgba(93, 139, 255, 0.05) 42%, transparent 72%);
  filter: blur(20px);
  pointer-events: none;
}

.toolbar-meta,
.panel,
.auth-panel,
.auth-showcase {
  position: relative;
  z-index: 1;
}

.toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.compact-toolbar {
  min-height: 58px;
}

.toolbar-brand {
  min-width: 0;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.section-kicker,
.auth-kicker,
.log-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: #9bb8ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-kicker::before,
.auth-kicker::before,
.log-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent));
  box-shadow: 0 0 16px rgba(72, 212, 255, 0.46);
}

.toolbar h1 {
  margin: 0;
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.08;
  letter-spacing: -0.05em;
  font-weight: 760;
}

.auth-showcase h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.04;
  letter-spacing: -0.045em;
  font-weight: 760;
}

.muted,
.panel-copy,
.hero-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.auth-points span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font-size: 11px;
}

.dashboard-layout {
  display: grid;
  gap: 14px;
}

.workspace-columns {
  display: grid;
  grid-template-columns: minmax(560px, 1.08fr) minmax(500px, 0.92fr);
  gap: 14px;
  align-items: start;
}

.workspace-column {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.panel {
  padding: 18px;
  min-width: 0;
}

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

.panel-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-head h2,
.auth-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.045em;
  font-weight: 720;
}

.panel-actions,
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-head-actions {
  align-items: center;
  justify-content: flex-end;
}

button,
a.ghost-button,
.file-trigger {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  overflow: hidden;
  border-radius: 13px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

button::before,
a.ghost-button::before,
.file-trigger::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 52%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
  pointer-events: none;
  opacity: 0.72;
}

button:hover:not(:disabled),
a.ghost-button:hover,
.file-trigger:hover {
  transform: translateY(-1px);
}

button:disabled,
a.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.primary-button {
  color: #fdfdff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 42%),
    linear-gradient(135deg, #7ea2ff 0%, #6279ff 44%, #8766ff 100%);
  border-color: rgba(133, 155, 255, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 14px 26px rgba(78, 109, 255, 0.24),
    0 6px 14px rgba(6, 10, 22, 0.26);
}

.primary-button:hover:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 18px 32px rgba(78, 109, 255, 0.28),
    0 10px 18px rgba(6, 10, 22, 0.28);
}

.cancel-button {
  color: #fff6f8;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 42%),
    linear-gradient(135deg, #ff8fa1 0%, #ff6f88 46%, #ff9478 100%);
  border-color: rgba(255, 153, 169, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 14px 26px rgba(255, 111, 136, 0.22),
    0 6px 14px rgba(6, 10, 22, 0.26);
}

.cancel-button:hover:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 18px 32px rgba(255, 111, 136, 0.26),
    0 10px 18px rgba(6, 10, 22, 0.28);
}

.ghost-button,
.file-trigger {
  color: #e9efff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 6px 14px rgba(5, 8, 18, 0.18);
}

.ghost-button:hover:not(:disabled),
.file-trigger:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.05);
  border-color: rgba(152, 170, 255, 0.3);
}

.danger-button {
  color: #ffc3d0;
  border-color: rgba(255, 141, 161, 0.18);
  background: rgba(255, 141, 161, 0.08);
}

.danger-button:hover:not(:disabled) {
  background: rgba(255, 141, 161, 0.14);
  border-color: rgba(255, 141, 161, 0.3);
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

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

label span,
.field-label {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(4, 8, 18, 0.74);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  min-height: 96px;
  padding: 12px 13px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(172, 184, 220, 0.5);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(93, 139, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(93, 139, 255, 0.14);
  background: rgba(6, 10, 22, 0.92);
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: rgba(4, 8, 18, 0.72);
}

.file-name {
  min-width: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name.is-placeholder {
  color: rgba(172, 184, 220, 0.58);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

code,
.hint,
.log-panel,
.file-name {
  font-family: var(--mono);
}

.hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.notice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.04);
}

.notice.warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(255, 217, 119, 0.22);
}

.notice.danger {
  color: #ffd4dc;
  background: var(--danger-soft);
  border-color: rgba(255, 141, 161, 0.24);
}

.table-shell {
  width: 100%;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(4, 8, 18, 0.52);
}

.account-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
  table-layout: fixed;
}

.account-table th:nth-child(1),
.account-table td:nth-child(1) {
  width: 40%;
}

.account-table th:nth-child(2),
.account-table td:nth-child(2) {
  width: 24%;
}

.account-table th:nth-child(3),
.account-table td:nth-child(3) {
  width: 14%;
}

.account-table th:nth-child(4),
.account-table td:nth-child(4) {
  width: 22%;
}

.account-table td:nth-child(1),
.account-table td:nth-child(2) {
  overflow-wrap: anywhere;
  word-break: break-word;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
  font-size: 13px;
}

th {
  color: rgba(187, 201, 241, 0.72);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.03);
}

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

tbody tr {
  transition: background 0.18s ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}

.table-actions {
  display: flex;
  gap: 6px;
}

.inline-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.account-table .table-actions {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.account-table .inline-button {
  width: auto;
  min-width: 54px;
  font-size: 11px;
  border-radius: 11px;
}

.account-status-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.status-pill.ok {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(79, 224, 172, 0.18);
}

.status-pill.bad {
  color: #ffc3d0;
  background: rgba(255, 141, 161, 0.12);
  border-color: rgba(255, 141, 161, 0.18);
}

.status-pill.neutral {
  color: #d9e4ff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.status-pill.warn {
  color: #ffd790;
  background: rgba(255, 194, 89, 0.12);
  border-color: rgba(255, 194, 89, 0.2);
}

.task-panel,
.task-log-panel {
  min-height: 0;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(72, 212, 255, 0.18);
  background: rgba(72, 212, 255, 0.08);
  color: #b7f1ff;
  font-size: 12px;
  font-weight: 700;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(72, 212, 255, 0.8);
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 14px 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(6, 10, 22, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto 14px 0 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(93, 139, 255, 0.28), transparent);
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: rgba(187, 201, 241, 0.68);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  font-size: clamp(22px, 1.9vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.05em;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.accent-card {
  background: linear-gradient(135deg, rgba(93, 139, 255, 0.22), rgba(125, 92, 255, 0.14) 48%, rgba(6, 10, 22, 0.9));
  border-color: rgba(93, 139, 255, 0.18);
}

.status-value[data-status="idle"] {
  color: #d9e4ff;
}

.status-value[data-status="running"] {
  color: #8dd7ff;
}

.status-value[data-status="succeeded"] {
  color: var(--success);
}

.status-value[data-status="failed"] {
  color: #ffb8c6;
}

.status-value[data-status="cancelled"] {
  color: #ffd790;
}

.progress-block {
  margin-bottom: 12px;
  padding: 12px 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  background: rgba(4, 8, 18, 0.56);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent), var(--accent-strong));
  box-shadow: 0 0 18px rgba(93, 139, 255, 0.34);
  transition: width 0.24s ease;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  table-layout: fixed;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) {
  width: 36%;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
  width: 16%;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
  width: 12%;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) {
  width: 20%;
}

.history-table th:nth-child(5),
.history-table td:nth-child(5) {
  width: 16%;
}

.history-dash {
  color: var(--muted);
}

.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -18px -18px 0;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
}

.log-head strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.log-meta {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.log-panel {
  min-height: 220px;
  max-height: 360px;
  margin: 0 -18px -18px;
  padding: 14px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(4, 8, 18, 0.98), rgba(8, 11, 22, 0.94));
  color: #dce7ff;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-panel {
  margin-top: 14px;
}

.history-panel-head {
  margin-bottom: 10px;
}

.history-table-shell {
  margin: 0;
}

.auth-screen {
  min-height: calc(100vh - 28px);
  display: grid;
  place-items: center;
}

.auth-stage {
  width: min(440px, calc(100vw - 28px));
}

.auth-panel {
  padding: 22px;
}

.auth-panel-single {
  min-height: 0;
}

.auth-header {
  margin-bottom: 16px;
}

.auth-header-compact .panel-copy {
  margin-top: 8px;
}

.auth-form .primary-button {
  width: 100%;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  min-width: 240px;
  max-width: 400px;
  padding: 12px 14px;
  border: 1px solid rgba(93, 139, 255, 0.26);
  border-radius: 14px;
  background: rgba(12, 17, 31, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.5;
}

.toast.error {
  border-color: rgba(255, 141, 161, 0.28);
  color: #ffd4dc;
}

@media (max-width: 1240px) {
  .workspace-columns,
  .auth-stage {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: calc(100vw - 16px);
    padding-top: 8px;
  }

  .toolbar-meta,
  .panel,
  .auth-showcase,
  .auth-panel {
    padding: 14px;
  }

  .toolbar-meta,
  .panel-head,
  .progress-meta,
  .log-head {
    flex-direction: column;
    align-items: stretch;
  }

  .config-grid,
  .config-grid.compact,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .panel-actions,
  .task-actions {
    width: 100%;
  }

  .panel-actions > *,
  .task-actions > * {
    flex: 1 1 auto;
  }

  .file-picker {
    flex-direction: column;
    align-items: stretch;
  }

  .account-table {
    min-width: 620px;
  }

  .toast {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-width: none;
  }
}
