:root {
  color-scheme: light;
  --background: #f5f7fb;
  --foreground: #172033;
  --surface: #ffffff;
  --surface-muted: #fafbfc;
  --border: #e7eaf0;
  --muted: #667085;
  --brand: #b45309;
  --brand-bright: #d97706;
  --brand-dark: #92400e;
  --brand-muted: #fff7e8;
  --navy: #091321;
  --success: #0f9f6e;
  --danger: #b42318;
  --ring: rgb(217 119 6 / 0.42);
  font-family: Inter, "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--foreground);
  background: var(--background);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: clip; background: var(--background); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
svg { display: block; }
::selection { color: var(--brand-dark); background: #ffedbd; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  z-index: 20;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  color: var(--foreground);
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(9 19 33 / 0.16);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }

.brand-lockup {
  position: relative;
  display: block;
  width: 11rem;
  height: 3.3125rem;
  flex: none;
  overflow: hidden;
}
.brand-lockup img { position: absolute; inset-inline-start: -3.4375rem; inset-block-start: -7.125rem; width: 17.5rem; height: auto; max-width: none; }
.brand-lockup-dark img { inset-inline-start: -4.0625rem; inset-block-start: -7.4375rem; width: 18.125rem; }

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--brand);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.eyebrow-on-dark { color: #fbbf24; }

/* Branded sign-in */
.auth-page { background: var(--surface); }
.auth-shell { display: grid; min-height: 100vh; }
.auth-story {
  position: relative;
  display: none;
  min-width: 0;
  overflow: hidden;
  padding: 3rem clamp(2.5rem, 5vw, 5rem);
  color: white;
  background: var(--navy);
}
.auth-grid {
  position: absolute;
  inset: 0;
  opacity: 0.42;
  background-image: linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}
.auth-orb {
  position: absolute;
  inset-block-start: -10rem;
  inset-inline-end: -8rem;
  width: 25rem;
  height: 25rem;
  border-radius: 999px;
  opacity: 0.66;
  background: radial-gradient(circle at 35% 35%, #fbbf24, #d97706 35%, transparent 71%);
}
.economics-chart { position: absolute; inset-inline-end: 5%; inset-block-start: 31%; width: 14.5rem; color: white; opacity: 0.055; }
.auth-story-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.workspace-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 999px;
  color: rgb(255 255 255 / 0.78);
  background: rgb(255 255 255 / 0.06);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.auth-story-copy { position: relative; z-index: 2; max-width: 36rem; margin-block-start: auto; }
.feature-icon, .lock-icon, .card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: linear-gradient(145deg, var(--brand-bright), var(--brand-dark));
  box-shadow: 0 7px 18px -2px rgb(180 83 9 / 0.38);
}
.feature-icon { width: 3rem; height: 3rem; margin-block-end: 1.5rem; border-radius: 1rem; }
.feature-icon svg, .lock-icon svg, .card-icon svg { width: 1.35rem; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-story h1 { margin: 0; font-size: clamp(2.25rem, 4vw, 3.5rem); line-height: 1.06; letter-spacing: -0.045em; text-wrap: balance; }
.auth-story h1 span { color: #fbbf24; }
.auth-story-copy > p:not(.eyebrow) { max-width: 31rem; margin: 1.4rem 0 0; color: rgb(255 255 255 / 0.7); font-size: 1.05rem; line-height: 1.65; text-wrap: pretty; }
.auth-benefits { display: flex; flex-wrap: wrap; gap: 0.75rem 1.1rem; margin: 1.8rem 0 0; padding: 0; list-style: none; color: rgb(255 255 255 / 0.78); font-size: 0.82rem; }
.auth-benefits li { display: flex; align-items: center; gap: 0.45rem; }
.auth-benefits li > span { display: inline-grid; width: 1.15rem; height: 1.15rem; place-items: center; border-radius: 999px; color: var(--navy); background: #fbbf24; font-size: 0.7rem; font-weight: 900; }
.auth-form-panel { display: flex; min-width: 0; align-items: center; justify-content: center; padding: max(1.5rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left)); background: white; }
.auth-form-wrap { width: 100%; max-width: 24rem; }
.auth-mobile-logo { margin-block-end: 3.5rem; }
.lock-icon { width: 2.875rem; height: 2.875rem; margin-block-end: 1.35rem; border-radius: 0.8125rem; color: var(--brand); background: #fff3dc; box-shadow: none; }
.lock-icon svg { width: 1.25rem; }
.auth-form-wrap h2 { margin: 0; font-size: clamp(1.9rem, 7vw, 2.2rem); line-height: 1.12; letter-spacing: -0.035em; }
.auth-intro { margin: 0.5rem 0 1.75rem; color: var(--muted); font-size: 0.925rem; line-height: 1.55; text-wrap: pretty; }
.login-form { display: grid; gap: 1rem; }
.field-group { display: grid; gap: 0.45rem; }
.field-group label { color: #465267; font-size: 0.8rem; font-weight: 750; }
input {
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid #d9dee8;
  border-radius: 0.625rem;
  color: var(--foreground);
  background: var(--surface);
  font-size: 1rem;
  transition-property: border-color, box-shadow, background-color;
  transition-duration: 150ms;
}
input:hover { border-color: #b8c0ce; }
input:focus { border-color: var(--brand-bright); box-shadow: 0 0 0 3px rgb(217 119 6 / 0.12); }
input[aria-invalid="true"] { border-color: var(--danger); }
.primary-button, .secondary-button, .sign-out-button {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 0.625rem;
  font-size: 0.9rem;
  font-weight: 800;
  transition-property: transform, filter, background-color, color, box-shadow;
  transition-duration: 150ms;
}
.primary-button { color: white; background: linear-gradient(145deg, var(--brand-bright), var(--brand-dark)); box-shadow: 0 7px 16px rgb(180 83 9 / 0.2); }
.primary-button:hover { filter: brightness(1.05); }
.primary-button:active, .secondary-button:active, .sign-out-button:active { transform: scale(0.96); }
.primary-button:disabled { cursor: wait; opacity: 0.6; }
.primary-button svg { width: 1.1rem; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-button { width: 100%; min-height: 3rem; margin-block-start: 0.5rem; }
.login-button svg { margin-inline-start: auto; }
.form-message { margin: 0; padding: 0.75rem 0.875rem; border-radius: 0.625rem; font-size: 0.875rem; line-height: 1.45; }
.form-message-error { color: #8f1d14; background: #fff0ee; }
.security-note { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin: 1.5rem 0 0; color: var(--muted); font-size: 0.75rem; }
.security-note svg { width: 1rem; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Authenticated uploader */
.site-header { display: flex; min-height: 4.5rem; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem max(1rem, calc((100vw - 72rem) / 2)); border-block-end: 1px solid var(--border); background: rgb(255 255 255 / 0.95); }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.header-actions form { margin: 0; }
.workspace-chip-light { border-color: var(--border); color: #526174; background: var(--surface-muted); }
.sign-out-button { min-height: 2.5rem; border: 1px solid var(--border); color: #465267; background: white; }
.sign-out-button:hover { color: var(--brand-dark); background: var(--brand-muted); }
.upload-main { width: min(100%, 74rem); margin-inline: auto; padding: clamp(1.5rem, 4vw, 3rem) max(1rem, env(safe-area-inset-left)) max(3rem, env(safe-area-inset-bottom)); }
.upload-hero { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-block-end: 2rem; }
.upload-hero-copy { max-width: 42rem; }
.upload-hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.15rem); line-height: 1.07; letter-spacing: -0.045em; text-wrap: balance; }
.intro { max-width: 39rem; margin: 0.9rem 0 0; color: var(--muted); line-height: 1.6; text-wrap: pretty; }
.hero-status { display: inline-flex; min-height: 2.25rem; align-items: center; gap: 0.5rem; padding: 0.45rem 0.75rem; border: 1px solid #d9f0e7; border-radius: 999px; color: #087452; background: #f0fbf7; font-size: 0.78rem; font-weight: 750; white-space: nowrap; }
.status-dot { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 3px rgb(15 159 110 / 0.13); }
.upload-layout { display: grid; gap: 1.25rem; }
.card { min-width: 0; border: 1px solid var(--border); border-radius: 1.25rem; background: white; box-shadow: 0 7px 26px rgb(20 34 60 / 0.04); }
.upload-card { padding: clamp(1.25rem, 4vw, 2rem); }
.card-heading { display: flex; align-items: flex-start; gap: 0.9rem; margin-block-end: 1.75rem; }
.card-icon { width: 2.75rem; height: 2.75rem; flex: none; border-radius: 0.75rem; }
.card-heading h2, .progress-heading h2 { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.card-heading p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
#upload-form { display: grid; gap: 1.25rem; }
#upload-form .primary-button { width: 100%; min-height: 3rem; margin-block-start: 0.25rem; }
input::placeholder { color: #98a2b3; }
input[type="file"] { padding: 0.5rem; background: var(--surface-muted); }
input[type="file"]::file-selector-button { min-height: 2.25rem; margin-inline-end: 0.75rem; padding: 0.45rem 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; color: #465267; background: white; font: inherit; font-size: 0.82rem; font-weight: 750; cursor: pointer; }
.help, .field-error { margin: 0; font-size: 0.8rem; line-height: 1.45; }
.help { color: var(--muted); }
.field-error { color: var(--danger); font-weight: 650; }
.progress-panel { margin-block-start: 1.5rem; padding: 1rem; border-radius: 0.875rem; background: var(--surface-muted); }
.progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-block-end: 0.75rem; }
.progress-value { color: var(--brand); font-size: 0.85rem; font-weight: 850; font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 0.7rem; border: 0; border-radius: 999px; overflow: hidden; accent-color: var(--brand-bright); }
progress::-webkit-progress-bar { background: #e8ebf0; }
progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--brand-bright), var(--brand-dark)); }
.progress-panel #status { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.secondary-button { margin-block-start: 0.75rem; border: 1px solid var(--border); color: #465267; background: white; }
#error { margin-block-start: 1rem; }
.upload-guide { position: relative; min-width: 0; overflow: hidden; padding: clamp(1.5rem, 4vw, 2rem); border-radius: 1.25rem; color: white; background: var(--navy); box-shadow: 0 14px 36px rgb(9 19 33 / 0.12); }
.upload-guide::after { content: ""; position: absolute; inset-inline-end: -5rem; inset-block-start: -6rem; width: 15rem; height: 15rem; border-radius: 999px; background: radial-gradient(circle, rgb(217 119 6 / 0.3), transparent 70%); pointer-events: none; }
.upload-guide h2 { position: relative; z-index: 1; margin: 0; font-size: 1.45rem; line-height: 1.18; letter-spacing: -0.025em; }
.upload-guide ol { position: relative; z-index: 1; display: grid; gap: 1.35rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.upload-guide li { display: grid; grid-template-columns: 2rem 1fr; gap: 0.8rem; }
.upload-guide li > span { display: grid; width: 2rem; height: 2rem; place-items: center; border: 1px solid rgb(251 191 36 / 0.35); border-radius: 0.625rem; color: #fbbf24; background: rgb(251 191 36 / 0.08); font-size: 0.78rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.upload-guide strong { font-size: 0.88rem; }
.upload-guide li p { margin: 0.3rem 0 0; color: rgb(255 255 255 / 0.62); font-size: 0.8rem; line-height: 1.5; text-wrap: pretty; }
.guide-note { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 0.6rem; margin-block-start: 1.75rem; padding: 0.8rem; border: 1px solid rgb(255 255 255 / 0.08); border-radius: 0.75rem; color: rgb(255 255 255 / 0.74); background: rgb(255 255 255 / 0.05); font-size: 0.78rem; line-height: 1.45; }
.guide-note svg { width: 1.1rem; flex: none; stroke: #fbbf24; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 58rem) {
  .auth-shell { grid-template-columns: minmax(0, 1fr) minmax(26rem, 0.78fr); }
  .auth-story { display: flex; flex-direction: column; }
  .auth-mobile-logo { display: none; }
  .upload-layout { grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 0.75fr); align-items: start; }
  .upload-guide { position: sticky; inset-block-start: 1.25rem; }
}

@media (max-width: 40rem) {
  .auth-form-panel { width: 100vw; justify-content: flex-start; padding-inline: 1rem; }
  .auth-form-wrap { width: calc(100vw - 2rem); max-width: none; }
  .auth-intro { overflow-wrap: anywhere; }
  .security-note { flex-wrap: wrap; text-align: center; }
  .site-header { min-height: 4rem; }
  .site-header .brand-lockup { width: 8.25rem; height: 2.6rem; }
  .site-header .brand-lockup img { inset-inline-start: -2.6rem; inset-block-start: -5.45rem; width: 13.6rem; }
  .workspace-chip-light { display: none; }
  .sign-out-button { min-height: 2.5rem; padding-inline: 0.8rem; }
  .upload-hero { display: grid; gap: 1rem; margin-block-end: 1.35rem; }
  .hero-status { justify-self: start; }
  .upload-card, .upload-guide { border-radius: 1rem; }
  .auth-mobile-logo { margin-block-end: 2.5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .skip-link { transition: transform 120ms ease-out; }
}

@media (forced-colors: active) {
  input, button, .card, .upload-guide, .workspace-chip { border: 1px solid ButtonText; }
  .status-dot { forced-color-adjust: none; }
}
