:root {
  color-scheme: dark;
  --bg: #0a1018;
  --bg-2: #0f1722;
  --surface: rgba(15, 23, 34, 0.92);
  --surface-2: rgba(20, 31, 46, 0.88);
  --surface-3: rgba(11, 19, 31, 0.94);
  --line: rgba(122, 145, 175, 0.18);
  --line-strong: rgba(122, 145, 175, 0.28);
  --text: #edf3fb;
  --muted: #92a3ba;
  --accent: #3dd2ff;
  --accent-2: #3cd786;
  --danger: #fb7185;
  --warning: #fbbf24;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(61, 210, 255, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(60, 215, 134, 0.08), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}

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

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

.eyebrow,
.section-kicker,
.meta-label,
.stat-label,
.stat-hint,
.mini-muted {
  letter-spacing: 0;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.layout {
  display: grid;
  gap: 22px;
}

.hero-surface,
.section-surface,
.stat-card,
.auth-card,
.sheet {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-surface,
.section-surface,
.stat-card,
.auth-card {
  border-radius: 8px;
}

.hero-surface {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 24px;
}

.hero-copy h1,
.section-heading h2,
.sheet h2,
.auth-card h1 {
  margin: 6px 0 0;
}

.hero-copy h1 {
  font-size: 34px;
}

.hero-text {
  margin: 14px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

.hero-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
  min-width: 340px;
}

.hero-user {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
}

.action-cluster,
.actions-row,
.sheet-footer,
.path-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stats-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 18px;
  display: grid;
  gap: 8px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 700;
}

.stat-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.main-column,
.side-column {
  display: grid;
  gap: 22px;
}

.section-surface {
  padding: 20px;
}

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

.section-heading h2 {
  font-size: 22px;
}

.section-note {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(61, 210, 255, 0.08);
  border: 1px solid rgba(61, 210, 255, 0.12);
  color: var(--muted);
  font-size: 13px;
}

.preset-grid,
.row-list,
.artifact-list,
.browser-listing {
  display: grid;
  gap: 12px;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 2px;
}

.pagination-summary,
.pagination-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.preset-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.preset-card,
.data-row,
.artifact-item,
.browser-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.preset-card,
.data-row,
.artifact-item {
  padding: 16px;
}

.preset-card {
  display: grid;
  gap: 12px;
}

.preset-card h3,
.data-row h3 {
  margin: 0;
  font-size: 18px;
}

.preset-card p,
.row-description {
  margin: 8px 0 0;
}

.preset-card-top,
.row-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.meta-line,
.row-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 13px;
}

.status-pill {
  background: rgba(122, 145, 175, 0.16);
  color: var(--muted);
}

.status-pill.success,
.status-pill.ready {
  background: rgba(60, 215, 134, 0.16);
  color: #c6f6db;
}

.status-pill.failed {
  background: rgba(251, 113, 133, 0.16);
  color: #ffd1d8;
}

.status-pill.running {
  background: rgba(251, 191, 36, 0.16);
  color: #fde9a8;
}

.status-pill.missing {
  background: rgba(122, 145, 175, 0.12);
  color: #ccd8ea;
}

.info-pill {
  background: rgba(122, 145, 175, 0.1);
  color: #c9d8ed;
  border: 1px solid rgba(122, 145, 175, 0.12);
}

.info-pill.schedule {
  background: rgba(61, 210, 255, 0.1);
  border-color: rgba(61, 210, 255, 0.14);
  color: #c5f3ff;
}

.info-pill.remote {
  background: rgba(60, 215, 134, 0.1);
  border-color: rgba(60, 215, 134, 0.14);
  color: #cbf6de;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.data-row.active {
  border-color: rgba(61, 210, 255, 0.32);
  box-shadow: inset 0 0 0 1px rgba(61, 210, 255, 0.12);
}

.row-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

.compact-detail-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.45fr);
}

.detail-block,
.path-pair > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.meta-label,
.mini-muted {
  color: var(--muted);
  font-size: 12px;
}

.detail-block strong,
.path-pair strong {
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.path-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-3);
  border: 1px solid rgba(122, 145, 175, 0.12);
}

.path-pair.single {
  grid-template-columns: 1fr;
}

.row-actions {
  display: grid;
  gap: 8px;
  align-content: start;
  justify-items: stretch;
  min-width: 138px;
}

.compact-list .data-row {
  grid-template-columns: 1fr;
}

.compact-list .row-actions {
  display: flex;
  flex-wrap: wrap;
  min-width: auto;
}

.artifact-item,
.browser-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.artifact-meta,
.browser-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.compact-artifact-item {
  padding: 12px 14px;
  gap: 10px;
  align-items: center;
}

.artifact-name {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.artifact-path {
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.artifact-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
}

.artifact-actions .small-button {
  min-width: 96px;
}

.browser-item {
  width: 100%;
  padding: 12px;
  text-align: left;
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 1200;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(8, 15, 24, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(60, 215, 134, 0.24);
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.24);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
}

.auth-card .muted {
  margin: 10px 0 0;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button {
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  padding: 10px 14px;
}

.primary-button {
  background: linear-gradient(135deg, #16b7f4 0%, #2d73ff 100%);
  color: white;
}

.ghost-button {
  background: rgba(122, 145, 175, 0.06);
  color: var(--text);
  border-color: var(--line);
}

.danger-button {
  background: rgba(251, 113, 133, 0.08);
  color: #ffd4dc;
  border-color: rgba(251, 113, 133, 0.22);
}

.icon-button {
  width: 38px;
  height: 38px;
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.small-button {
  min-width: 88px;
  min-height: 38px;
  padding: 8px 12px;
}

.small-button.is-running {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  animation: spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled,
.icon-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

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

.sheet-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.sheet-dialog::backdrop {
  background: rgba(4, 8, 14, 0.76);
}

.sheet {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.medium-sheet {
  width: min(760px, calc(100vw - 32px));
}

.confirm-sheet {
  width: min(520px, calc(100vw - 32px));
}

.sheet-header,
.sheet-footer {
  padding: 18px 20px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.sheet-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.sheet-body {
  padding: 20px;
  overflow: auto;
  display: grid;
  gap: 22px;
}

.empty-state strong {
  color: var(--text);
}

.confirm-copy {
  display: grid;
  gap: 10px;
}

.confirm-lead {
  margin: 0;
  color: var(--muted);
}

.confirm-name {
  display: block;
  font-size: 20px;
  line-height: 1.4;
  color: #ffd4dc;
  overflow-wrap: anywhere;
}

.form-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(122, 145, 175, 0.14);
  border-radius: 8px;
  background: var(--surface-2);
}

.form-section h3 {
  margin: 0;
}

.field-grid {
  display: grid;
  gap: 16px;
}

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

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.help-dot {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(61, 210, 255, 0.24);
  border-radius: 999px;
  background: rgba(61, 210, 255, 0.08);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.help-dot:hover {
  background: rgba(61, 210, 255, 0.12);
  border-color: rgba(61, 210, 255, 0.36);
}

.field input,
.field select,
.field textarea,
.path-toolbar input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(7, 15, 26, 0.95);
  color: var(--text);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.path-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.hidden {
  display: none !important;
}

.error-text {
  margin: 0;
  color: var(--danger);
}

.empty-state {
  min-height: 120px;
  padding: 18px;
  border: 1px dashed rgba(61, 210, 255, 0.22);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: rgba(9, 16, 25, 0.42);
}

.code-block {
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(7, 15, 26, 0.95);
  color: #dbeafe;
  overflow: auto;
}

@media (max-width: 1220px) {
  .content-grid,
  .stats-band,
  .detail-grid,
  .field-grid.two,
  .field-grid.three,
  .field-grid.four,
  .path-pair {
    grid-template-columns: 1fr;
  }

  .hero-surface,
  .preset-card-top,
  .row-header,
  .section-heading {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-actions {
    justify-items: start;
    min-width: 0;
  }

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

  .row-actions {
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
  }
}

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

  .hero-copy h1 {
    font-size: 28px;
  }

  .action-cluster,
  .path-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .artifact-item,
  .browser-item {
    grid-template-columns: 1fr;
  }

  .artifact-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .toast-host {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}
