* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #1f2937;
}

.is-hidden {
  display: none !important;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.14), transparent 32%),
    #f4f7fb;
}

.auth-card {
  width: min(560px, 100%);
  padding: 32px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

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

.auth-copy {
  margin-top: 22px;
}

.auth-form {
  margin-top: 24px;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 28px 20px;
  background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

.brand h1,
.hero h2,
.panel h3 {
  margin: 0;
}

.brand p,
.muted,
.panel-header p,
.side-card p,
.stat-card small,
.message,
.eyebrow {
  margin: 0;
}

.side-card {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.side-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.side-card p {
  margin-top: 8px;
  line-height: 1.6;
  color: #d1d5db;
}

.main {
  padding: 28px;
}

.hero,
.panel,
.stat-card {
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.hero {
  padding: 24px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6366f1;
}

.muted,
.panel-header p,
.message {
  color: #6b7280;
}

.hero-actions,
.token-actions {
  display: flex;
  gap: 12px;
  align-items: end;
}

.token-panel,
.panel {
  padding: 22px;
  margin-top: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.status-chip {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-warn {
  background: #fff7ed;
  color: #c2410c;
}

.status-ok {
  background: #ecfdf5;
  color: #047857;
}

.status-error {
  background: #fef2f2;
  color: #b91c1c;
}

.token-grid,
.form-grid,
.content-grid,
.stats-grid {
  display: grid;
  gap: 16px;
}

.token-grid {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.stats-grid {
  margin-top: 22px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  padding: 20px;
}

.stat-card .label {
  display: block;
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 10px;
}

.stat-card strong {
  display: block;
  font-size: 24px;
  margin-bottom: 10px;
}

.content-grid {
  grid-template-columns: 1.25fr 1fr;
  margin-top: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  padding: 0 14px;
  background: #f9fbff;
  font-size: 14px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: #4f46e5;
  background: #fff;
}

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

.field-span-2 {
  grid-column: span 2;
}

.btn {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
}

.btn-light {
  background: #eef2ff;
  color: #4338ca;
}

.runtime-list,
.task-list {
  display: grid;
  gap: 12px;
}

.task-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.task-summary-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8faff 0%, #eef4ff 100%);
  border: 1px solid #dbe7ff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.test-box {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #fafcff;
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.test-header h4 {
  margin: 0;
  font-size: 16px;
}

.panel-header-compact {
  margin-top: 20px;
  margin-bottom: 12px;
}

.test-result {
  display: grid;
  gap: 14px;
}

.test-result-empty,
.test-result-card {
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  background: #fafcff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.test-result-empty {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #6b7280;
  font-size: 14px;
}

.test-result-card {
  padding: 16px;
}

.test-result-card.is-highlight {
  background: linear-gradient(180deg, #f8faff 0%, #eef4ff 100%);
  border-color: #dbe7ff;
}

.test-result-card.is-error {
  background: linear-gradient(180deg, #fff8f8 0%, #fff2f2 100%);
  border-color: #fecaca;
}

.test-result-card.is-raw {
  background: #0f172a;
  border-color: #1e293b;
  color: #e2e8f0;
}

.test-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.test-result-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: inherit;
}

.result-card-subtitle {
  margin: -4px 0 12px;
  font-size: 13px;
  line-height: 1.7;
  color: #64748b;
}

.test-result-card.is-raw .result-card-subtitle {
  color: #94a3b8;
}

.test-result-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.test-result-card.is-error .test-result-badge {
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.result-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.test-result-card.is-raw .result-section-title {
  color: #cbd5e1;
}

.result-metric {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #edf2fb;
}

.test-result-card.is-raw .result-metric {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.result-metric-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.test-result-card.is-raw .result-metric-label {
  color: #94a3b8;
}

.result-metric-value {
  display: block;
  font-size: 14px;
  line-height: 1.7;
  color: #111827;
  word-break: break-word;
  white-space: pre-wrap;
}

.test-result-card.is-raw .result-metric-value {
  color: #e2e8f0;
}

.result-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}

.test-result-card.is-error .result-text {
  color: #991b1b;
}

.test-result-card.is-raw .result-text {
  color: #e2e8f0;
}

.result-links-list {
  display: grid;
  gap: 10px;
}

.result-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #edf2fb;
}

.result-link-main {
  min-width: 0;
}

.result-link-index {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #4338ca;
}

.result-link-url {
  display: block;
  font-size: 13px;
  line-height: 1.7;
  color: #475569;
  word-break: break-all;
}

.result-link-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.result-link-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.result-link-action:hover {
  background: #e0e7ff;
}

.result-link-action.is-button {
  cursor: pointer;
}

.result-raw {
  margin-top: 4px;
}

.result-raw summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 700;
  color: #c7d2fe;
}

.result-raw summary::-webkit-details-marker {
  display: none;
}

.result-raw-body {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 12px;
  line-height: 1.7;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
}

.runtime-item,
.task-item {
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fafcff;
}

.runtime-item strong,
.task-item strong {
  display: block;
  margin-bottom: 8px;
}

.runtime-item p,
.task-item p {
  margin: 4px 0 0;
  color: #6b7280;
  line-height: 1.6;
}

.task-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.task-card {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.task-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.task-card-title-group {
  min-width: 0;
}

.task-card-title {
  display: block;
  font-size: 15px;
  line-height: 1.5;
  color: #111827;
}

.task-card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.task-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.type-badge {
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
}

.status-success {
  background: #ecfdf5;
  color: #047857;
}

.status-failed {
  background: #fef2f2;
  color: #b91c1c;
}

.status-queued {
  background: #fff7ed;
  color: #c2410c;
}

.status-running {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-default {
  background: #f3f4f6;
  color: #4b5563;
}

.task-card-time {
  flex-shrink: 0;
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
}

.task-card-detail {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.8;
  color: #475569;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.task-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  color: #64748b;
}

.task-meta-item b {
  color: #334155;
}

.task-empty {
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
}

.task-empty strong {
  display: block;
  margin-bottom: 8px;
  color: #111827;
}

.task-empty p {
  margin: 0;
  color: #64748b;
  line-height: 1.7;
}

.message {
  min-height: 22px;
  margin-top: 14px;
}

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

  .sidebar {
    padding-bottom: 0;
  }
}

@media (max-width: 900px) {
  .stats-grid,
  .content-grid,
  .form-grid,
  .token-grid,
  .task-toolbar {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: span 1;
  }

  .main {
    padding: 16px;
  }

  .hero,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .task-card-head {
    flex-direction: column;
  }

  .task-card-time {
    white-space: normal;
  }

  .result-link-row {
    grid-template-columns: 1fr;
  }

  .result-link-actions {
    justify-content: flex-start;
  }
}
