@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --bg: #f3efe5;
  --bg-deep: #12312c;
  --bg-panel: rgba(255, 250, 243, 0.9);
  --card: rgba(255, 252, 247, 0.94);
  --card-strong: #fffaf2;
  --text: #1f2a25;
  --muted: #66756d;
  --line: rgba(22, 49, 44, 0.12);
  --line-strong: rgba(22, 49, 44, 0.2);
  --accent: #b85c38;
  --accent-dark: #944526;
  --accent-soft: rgba(184, 92, 56, 0.12);
  --success: #268a62;
  --success-soft: rgba(38, 138, 98, 0.14);
  --warning-soft: rgba(184, 92, 56, 0.14);
  --shadow: 0 28px 90px rgba(23, 31, 29, 0.14);
  --shadow-soft: 0 20px 50px rgba(23, 31, 29, 0.1);
  --radius-xl: 36px;
  --radius-lg: 26px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(184, 92, 56, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(38, 138, 98, 0.16), transparent 26%),
    linear-gradient(180deg, #faf6ef 0%, var(--bg) 100%);
  font-family: "Manrope", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(18, 49, 44, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 49, 44, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 88%);
}

body.modal-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

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

.boot-shell {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  color: var(--bg-deep);
}

.auth-grid {
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
}

.auth-story,
.auth-card,
.card,
.modal-card,
.overview-tile {
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: var(--shadow);
}

.auth-story {
  padding: 36px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(184, 92, 56, 0.28), transparent 26%),
    radial-gradient(circle at bottom left, rgba(38, 138, 98, 0.18), transparent 24%),
    linear-gradient(145deg, #173b34 0%, #12312c 50%, #27453f 100%);
  color: #f9f5ef;
}

.auth-story h1,
.section-head h2,
.welcome-copy h1,
.auth-card h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.auth-story h1,
.welcome-copy h1 {
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 0.98;
}

.auth-copy,
.welcome-text,
.drop-copy,
.preview-copy,
.fine-print,
.empty-copy,
.pipeline-note p,
.summary-profile,
.recent-job-card p,
.stage-description,
.auth-form-copy,
.auth-highlight p,
.overview-tile p {
  color: var(--muted);
}

.auth-copy {
  max-width: 58ch;
  margin: 18px 0 0;
  color: rgba(249, 245, 239, 0.8);
  font-size: 1.04rem;
  line-height: 1.75;
}

.auth-highlights {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.auth-highlight {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 250, 243, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-highlight span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(184, 92, 56, 0.22);
  color: #fff8f1;
  font-weight: 800;
}

.auth-highlight strong {
  display: block;
  margin-bottom: 6px;
}

.auth-highlight p {
  margin: 0;
  color: rgba(249, 245, 239, 0.74);
  line-height: 1.55;
}

.auth-card {
  align-self: center;
  padding: 32px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.94) 0%, rgba(255, 247, 238, 0.94) 100%);
}

.auth-form-copy {
  margin: 10px 0 0;
  line-height: 1.6;
}

.auth-cta-copy {
  margin: 18px 0 0;
  color: var(--bg-deep);
  font-weight: 700;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.field span,
.meta-label,
.section-kicker,
.note-label,
.overview-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--muted);
}

.field input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: rgba(184, 92, 56, 0.46);
  box-shadow: 0 0 0 4px rgba(184, 92, 56, 0.12);
}

.auth-error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff0eb;
  color: #8f3d21;
  font-weight: 700;
}

.auth-button {
  width: 100%;
  margin-top: 18px;
}

.page-shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar,
.topbar-actions,
.brand-mark,
.user-chip,
.hero-actions,
.actions,
.stage-title-row,
.modal-head,
.recent-job-actions,
.summary-head,
.section-head {
  display: flex;
}

.topbar,
.section-head,
.summary-head,
.modal-head {
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  align-items: center;
  margin-bottom: 18px;
}

.brand-mark {
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, #d97c53 100%);
  box-shadow: 0 0 0 8px rgba(184, 92, 56, 0.16);
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--bg-deep);
}

.topbar-actions {
  align-items: center;
  gap: 14px;
}

.user-chip {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.84);
}

.user-name {
  font-weight: 800;
  color: var(--bg-deep);
}

.user-handle {
  color: var(--muted);
  font-size: 0.92rem;
}

.welcome-band {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  margin-bottom: 24px;
  padding: 34px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(184, 92, 56, 0.18), transparent 24%),
    radial-gradient(circle at bottom left, rgba(38, 138, 98, 0.14), transparent 28%),
    linear-gradient(145deg, rgba(255, 251, 245, 0.88) 0%, rgba(248, 242, 233, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow-soft);
}

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

.overview-tile {
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.92) 0%, rgba(255, 247, 238, 0.94) 100%);
}

.overview-tile strong {
  display: block;
  margin-top: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  color: var(--bg-deep);
}

.overview-tile p {
  margin: 8px 0 0;
  line-height: 1.6;
}

.cabinet-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: 24px;
}

.recent-card {
  grid-column: 1 / -1;
}

.card {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.95) 0%, rgba(250, 245, 236, 0.95) 100%);
}

.section-head > div,
.summary-head > div,
.job-meta > div,
.modal-meta > div,
.stage-title-row > span {
  min-width: 0;
}

.section-head h2 {
  font-size: 1.65rem;
  color: var(--bg-deep);
}

.section-pill,
.status-pill,
.mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 800;
}

.section-pill {
  color: var(--bg-deep);
  background: rgba(18, 49, 44, 0.07);
}

.status-pill,
.mini-status {
  color: var(--bg-deep);
}

.status-idle,
.status-queued {
  background: rgba(18, 49, 44, 0.08);
}

.status-processing {
  color: #7c351b;
  background: rgba(184, 92, 56, 0.14);
}

.status-completed {
  color: var(--success);
  background: var(--success-soft);
}

.status-failed {
  color: #8b3521;
  background: #ffe6de;
}

.upload-form {
  display: grid;
  gap: 18px;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 230px;
  padding: 24px;
  text-align: center;
  border: 1.5px dashed rgba(18, 49, 44, 0.16);
  border-radius: 26px;
  cursor: pointer;
  background:
    radial-gradient(circle at top, rgba(184, 92, 56, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 252, 247, 0.88) 0%, rgba(248, 241, 231, 0.96) 100%);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  transform: translateY(-2px);
  border-color: rgba(184, 92, 56, 0.32);
  box-shadow: 0 18px 32px rgba(25, 34, 31, 0.08);
}

.drop-title,
.preview-title,
.empty-title,
.recent-job-card h3,
.stage-title,
.meta-value {
  color: var(--bg-deep);
  overflow-wrap: anywhere;
}

.drop-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.32rem;
}

.file-preview,
.pipeline-note,
.job-summary,
.empty-state,
.recent-job-card,
.stage-item {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(250, 244, 236, 0.92) 100%);
}

.file-preview,
.pipeline-note,
.job-summary,
.empty-state,
.recent-job-card {
  padding: 18px 20px;
}

.preview-title,
.empty-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 800;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
}

.actions {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.primary-button,
.download-link,
.secondary-button,
.ghost-link,
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border-radius: 16px;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button,
.download-link {
  border: 0;
  padding: 0 22px;
  color: #fff9f3;
}

.primary-button {
  background: linear-gradient(180deg, #c96b45 0%, var(--accent) 100%);
  box-shadow: 0 18px 34px rgba(184, 92, 56, 0.22);
}

.download-link {
  width: 100%;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #215347 0%, var(--bg-deep) 100%);
  box-shadow: 0 18px 34px rgba(18, 49, 44, 0.18);
}

.primary-button:hover:not(:disabled),
.download-link:hover,
.secondary-button:hover,
.ghost-link:hover,
.modal-close:hover {
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-button,
.ghost-link,
.modal-close {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
  color: var(--bg-deep);
  padding: 0 14px;
  cursor: pointer;
}

.logout-button {
  min-height: 48px;
}

.job-panel.hidden,
.job-summary.hidden,
.download-link.hidden {
  display: none;
}

.job-meta,
.modal-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.meta-value {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  word-break: break-word;
}

.pipeline-note,
.job-summary {
  margin-bottom: 18px;
}

.pipeline-note p,
.summary-profile {
  margin: 0;
  line-height: 1.6;
}

.summary-head {
  flex-wrap: wrap;
  gap: 18px;
}

.summary-totals {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.summary-totals > div {
  min-width: 120px;
}

.danger-button {
  width: 100%;
  margin-bottom: 18px;
  border-color: rgba(184, 92, 56, 0.24);
  background: #fff2ec;
  color: #9a4c2d;
}

.danger-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.ghost-link {
  background: rgba(18, 49, 44, 0.04);
}

.stage-list {
  display: grid;
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.stage-item {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 16px 18px 16px 58px;
}

.stage-item::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 21px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid rgba(18, 49, 44, 0.18);
  background: rgba(255, 255, 255, 0.96);
}

.stage-current {
  border-color: rgba(184, 92, 56, 0.24);
  box-shadow: inset 0 0 0 1px rgba(184, 92, 56, 0.04);
}

.stage-current::before {
  border-color: rgba(184, 92, 56, 0.34);
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(184, 92, 56, 0.12);
}

.stage-completed::before {
  border-color: rgba(38, 138, 98, 0.26);
  background: var(--success);
}

.stage-failed::before {
  border-color: rgba(184, 92, 56, 0.34);
  background: #f29d7c;
}

.stage-title-row {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stage-title {
  font-weight: 800;
}

.stage-state {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 800;
}

.recent-jobs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.recent-job-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.recent-job-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.recent-job-card h3 {
  margin: 0;
  font-size: 1rem;
}

.recent-job-summary {
  margin: 0 0 10px;
  min-height: 2.8em;
}

.recent-job-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 700;
}

.recent-job-meta {
  margin: 0;
}

.recent-job-actions {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 14px;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-shell.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 22, 0.54);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.98) 0%, rgba(248, 241, 231, 0.98) 100%);
}

.modal-close {
  margin-left: auto;
  margin-bottom: 20px;
}

.modal-summary,
.modal-note {
  margin-bottom: 18px;
}

@media (max-width: 980px) {
  .auth-grid,
  .welcome-band,
  .cabinet-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid,
  .modal-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 1220px);
    padding-top: 18px;
  }

  .auth-story,
  .auth-card,
  .welcome-band,
  .card,
  .modal-card {
    padding: 22px;
  }

  .topbar,
  .topbar-actions,
  .section-head,
  .actions,
  .summary-head,
  .modal-head,
  .recent-job-top {
    flex-direction: column;
    align-items: stretch;
  }

  .status-pill,
  .section-pill {
    align-self: start;
  }

  .job-meta,
  .modal-meta {
    grid-template-columns: 1fr;
  }

  .summary-totals {
    gap: 18px;
  }

  .recent-job-actions {
    align-items: stretch;
  }

  .secondary-button,
  .ghost-link,
  .modal-close,
  .logout-button {
    width: 100%;
  }
}
