:root {
  --navy: #061c31;
  --navy-deep: #020d18;
  --blue: #0b5bc5;
  --blue-soft: #eaf3ff;
  --teal: #0c7c78;
  --teal-soft: #e3f5f3;
  --red: #ef4054;
  --ink: #172b31;
  --muted: #66777c;
  --canvas: #f2f6f6;
  --surface: #fff;
  --line: #d8e3e4;
  --success: #18734e;
  --success-soft: #e8f6ef;
  --danger: #aa3f3f;
  --danger-soft: #fceaea;
  --shadow: 0 16px 48px rgba(6,28,49,.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { position: relative; min-height: 100vh; margin: 0; overflow-x: hidden; background: radial-gradient(circle at 8% 8%, rgba(11,91,197,.055), transparent 26rem), radial-gradient(circle at 92% 20%, rgba(239,64,84,.035), transparent 22rem), var(--canvas); color: var(--ink); font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.03em; }
h1 { margin-bottom: 14px; color: var(--navy); font-size: clamp(2.2rem, 5vw, 3.55rem); line-height: 1.05; }
h2 { margin-bottom: 9px; color: var(--navy); font-size: 1.5rem; }
h3 { margin-bottom: 12px; color: var(--navy); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(11,91,197,.25); outline-offset: 3px; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--navy); color: #fff; }
.skip-link:focus { top: 12px; }

.app-header { position: sticky; top: 0; z-index: 30; min-height: 70px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(12px); }
.header-inner { width: min(1180px, calc(100% - 40px)); min-height: 70px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--navy); text-decoration: none; line-height: 1.05; }
.brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 6px 16px rgba(6,28,49,.14); }
.brand strong { display: block; color: var(--blue); font-size: 1rem; font-style: italic; letter-spacing: .035em; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: .68rem; font-weight: 700; }
nav { display: flex; align-items: center; gap: 20px; }
nav a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .75rem; font-weight: 750; text-decoration: none; }
nav a:hover { color: var(--navy); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #76ad31; box-shadow: 0 0 0 4px rgba(118,173,49,.13); }

.brand-atmosphere { position: fixed; inset: 70px 0 auto; z-index: -1; height: min(620px,72vh); pointer-events: none; overflow: hidden; }
.brand-atmosphere i { position: absolute; display: block; border: 1px solid rgba(11,91,197,.09); border-radius: 22px; rotate: 45deg; animation: brand-float 9s ease-in-out infinite; }
.brand-atmosphere i:nth-child(1) { width: 72px; height: 72px; left: 4%; top: 20%; }
.brand-atmosphere i:nth-child(2) { width: 38px; height: 38px; right: 8%; top: 12%; border-color: rgba(239,64,84,.12); animation-delay: -2.5s; }
.brand-atmosphere i:nth-child(3) { width: 110px; height: 110px; right: -52px; bottom: 2%; animation-delay: -5s; }
@keyframes brand-float { 0%,100% { translate: 0 0; } 50% { translate: 0 -14px; } }

.page-shell { width: min(980px, calc(100% - 40px)); min-height: calc(100vh - 146px); margin: auto; padding: 58px 0 86px; }
.hero { max-width: 820px; margin: 0 auto 30px; text-align: center; }
.hero > p:last-child { max-width: 700px; margin: auto; color: var(--muted); font-size: 1.04rem; }
.eyebrow { margin-bottom: 10px; color: var(--blue); font-size: .68rem; font-weight: 850; letter-spacing: .15em; }
.muted { color: var(--muted); }
.hero-chip { width: fit-content; display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 16px; padding: 7px 11px; border: 1px solid #c9dbee; border-radius: 999px; background: rgba(255,255,255,.82); color: var(--navy); font-size: .68rem; font-weight: 800; box-shadow: 0 5px 18px rgba(6,28,49,.05); }
.hero-chip span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px rgba(239,64,84,.1); animation: chip-pulse 2.2s ease-out infinite; }
@keyframes chip-pulse { 0%,100% { box-shadow: 0 0 0 4px rgba(239,64,84,.08); } 50% { box-shadow: 0 0 0 7px rgba(239,64,84,.02); } }

.portal-shell { width: min(1180px, calc(100% - 40px)); }
.portal-hero { max-width: 760px; margin: 8px auto 38px; text-align: center; }
.portal-hero > p:last-child { margin-bottom: 0; color: var(--muted); font-size: 1.05rem; }
.processor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.processor-card { --card-accent: var(--teal); position: relative; min-height: 390px; display: flex; flex-direction: column; padding: 27px; overflow: hidden; border: 1px solid var(--line); border-top: 5px solid var(--card-accent); border-radius: 16px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); transition: translate .22s ease, box-shadow .22s ease, border-color .22s ease; animation: card-arrive .48s both; }
.processor-card:nth-child(2) { animation-delay: 80ms; }
.processor-card:nth-child(3) { animation-delay: 160ms; }
.processor-card::after { content: ""; position: absolute; width: 150px; height: 150px; right: -95px; top: -95px; border: 1px solid color-mix(in srgb, var(--card-accent) 25%, transparent); border-radius: 38px; rotate: 45deg; transition: rotate .3s ease, scale .3s ease; }
.processor-card:hover { translate: 0 -5px; border-color: color-mix(in srgb, var(--card-accent) 38%, var(--line)); box-shadow: 0 22px 54px rgba(6,28,49,.13); }
.processor-card:hover::after { rotate: 55deg; scale: 1.06; }
@keyframes card-arrive { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
.processor-card.accent-blue { --card-accent: #286da8; }
.processor-card.accent-green { --card-accent: #55952f; }
.processor-card.accent-teal { --card-accent: var(--teal); }
.processor-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; }
.processor-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--card-accent) 11%, #fff); color: var(--card-accent); font-size: 1rem; font-weight: 900; letter-spacing: -.05em; }
.processor-top em { padding: 4px 8px; border-radius: 99px; background: var(--success-soft); color: var(--success); font-size: .58rem; font-style: normal; font-weight: 900; letter-spacing: .08em; }
.processor-top em.pending { background: #f1f4f4; color: var(--muted); }
.processor-top em i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: currentColor; }
.mission-label { color: var(--card-accent); font-size: .62rem; font-weight: 900; letter-spacing: .12em; }
.processor-card h2 { margin-bottom: 9px; color: var(--navy); font-size: 1.55rem; }
.processor-card > p { min-height: 68px; color: var(--muted); }
.processor-card dl { margin: 8px 0 24px; }
.processor-card dl > div { padding: 11px 0; border-top: 1px solid var(--line); }
.processor-card dt { color: var(--muted); font-size: .62rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.processor-card dd { margin: 3px 0 0; font-size: .78rem; font-weight: 700; }
.processor-action { min-height: 48px; display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 11px 14px; border-radius: 9px; background: var(--navy); color: #fff; font-size: .78rem; font-weight: 850; text-decoration: none; transition: background .18s ease, translate .18s ease; }
.processor-action:hover { background: var(--navy-deep); }
.processor-action span { font-size: 1.1rem; transition: translate .18s ease; }
.processor-action:hover span { translate: 4px 0; }
.processor-action.unavailable { background: #e8eeee; color: var(--muted); cursor: not-allowed; }
.portal-guide { max-width: 900px; display: grid; grid-template-columns: 43px 1fr; gap: 15px; margin: 26px auto 0; padding: 19px 22px; }
.portal-guide > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--teal-soft); color: var(--teal); font-weight: 900; }
.portal-guide strong { color: var(--navy); }
.portal-guide p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; }

.journey { margin: 0 auto 20px; padding: 0; display: grid; grid-template-columns: repeat(3,1fr); list-style: none; }
.journey li { min-height: 68px; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: 1fr 1fr; align-items: end; padding: 11px 20px; border: 1px solid var(--line); border-left: 0; background: #edf2f2; color: var(--muted); }
.journey li:first-child { border-left: 1px solid var(--line); border-radius: 13px 0 0 13px; }
.journey li:last-child { border-radius: 0 13px 13px 0; }
.journey li.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.journey li.completed { border-color: #bedfcb; background: var(--success-soft); color: var(--success); }
.journey span, .processing-steps span { grid-row: 1/3; align-self: center; width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: .75rem; font-weight: 800; }
.journey strong { font-size: .82rem; }
.journey small { align-self: start; font-size: .68rem; opacity: .75; }

.screen { animation: screen-arrive .4s ease both; }
@keyframes screen-arrive { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.upload-card { padding: 30px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.panel-heading h2 { margin: 0; }
.ready-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: .62rem; font-weight: 850; text-transform: uppercase; }
.ready-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.upload-area { position: relative; min-height: 260px; display: grid; place-items: center; align-content: center; gap: 8px; overflow: hidden; padding: 34px; border: 2px dashed #a8c9cd; border-radius: 15px; background-color: #f7fbfb; background-image: linear-gradient(rgba(11,91,197,.028) 1px,transparent 1px),linear-gradient(90deg,rgba(11,91,197,.028) 1px,transparent 1px); background-size: 24px 24px; text-align: center; cursor: pointer; transition: border-color .18s, background-color .18s, translate .18s; }
.upload-area:hover, .upload-area.dragover { border-color: var(--blue); background-color: var(--blue-soft); translate: 0 -2px; }
.upload-area.has-file { border-style: solid; border-color: #a9d2b8; background: var(--success-soft); }
.upload-icon { position: relative; width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 6px; border-radius: 17px; background: var(--navy); color: #fff; font-size: 1.8rem; }
.upload-icon::after { content: ""; position: absolute; inset: -8px; border: 1px solid rgba(11,91,197,.16); border-radius: 23px; animation: upload-breathe 2.6s ease-out infinite; }
@keyframes upload-breathe { 0% { opacity: .8; scale: .8; } 75%,100% { opacity: 0; scale: 1.2; } }
.upload-area h3 { margin: 0; font-size: 1.15rem; }
.upload-area p { margin: 0; color: var(--muted); }
.browse-link { color: var(--blue); font-weight: 800; }
.file-info { width: min(100%,620px); display: grid; grid-template-columns: 45px 1fr 34px; align-items: center; gap: 12px; margin-top: 8px; padding: 12px; border: 1px solid #b8dec8; border-radius: 11px; background: #fff; color: var(--success); text-align: left; }
.file-info > span:nth-child(2) { overflow-wrap: anywhere; font-size: .78rem; font-weight: 750; }
.file-type { width: 42px; height: 35px; display: grid; place-items: center; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-size: .57rem; font-weight: 900; }
.remove-file { width: 32px; height: 32px; border: 0; border-radius: 8px; background: #f3f6f6; color: var(--muted); cursor: pointer; }
.primary-button, .quiet-button, .download-btn { border: 0; cursor: pointer; }
.primary-button { width: 100%; min-height: 53px; display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; padding: 11px 18px; border-radius: 11px; background: linear-gradient(100deg,var(--navy),var(--blue)); color: #fff; font-weight: 850; box-shadow: 0 8px 20px rgba(11,91,197,.14); transition: translate .18s, box-shadow .18s; }
.primary-button:not(:disabled):hover { translate: 0 -2px; box-shadow: 0 12px 26px rgba(11,91,197,.2); }
.primary-button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.primary-button span { transition: translate .18s; }
.primary-button:hover span { translate: 4px 0; }
.trust-row { margin-top: 14px; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.trust-row > div { display: grid; grid-template-columns: 30px 1fr; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.72); }
.trust-row > div > span { grid-row: 1/3; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--success); color: #fff; font-size: .7rem; }
.trust-row strong { font-size: .76rem; }
.trust-row small { color: var(--muted); font-size: .66rem; }

.processing-card { padding: 54px; text-align: center; }
.processing-card h2 { font-size: clamp(1.7rem,4vw,2.5rem); }
.processing-orbit { position: relative; width: 72px; height: 72px; margin: 0 auto 27px; border: 2px solid #d8e8ea; border-top-color: var(--blue); border-radius: 50%; animation: spin 1.1s linear infinite; }
.processing-orbit i { position: absolute; inset: 15px; border-radius: 14px; background: var(--navy); rotate: 45deg; }
@keyframes spin { to { rotate: 360deg; } }
.progress-bar { height: 10px; margin: 30px 0 9px; overflow: hidden; border-radius: 999px; background: #e1e9ea; box-shadow: inset 0 1px 2px rgba(6,28,49,.06); }
.progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--navy),var(--blue) 75%,#76ad31); transition: width .35s ease; }
.progress-copy { display: flex; justify-content: space-between; color: var(--muted); font-size: .74rem; }
.processing-steps { position: relative; margin: 34px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3,1fr); list-style: none; }
.processing-steps::before { content: ""; position: absolute; top: 14px; left: 16%; right: 16%; height: 1px; background: var(--line); }
.step { position: relative; z-index: 1; display: grid; justify-items: center; gap: 8px; color: var(--muted); }
.step span { grid-row: auto; background: #fff; }
.step.active span { border-color: var(--blue); background: var(--blue); color: #fff; box-shadow: 0 0 0 5px rgba(11,91,197,.1); }
.step.completed { color: var(--success); }
.step.completed span { border-color: var(--success); background: var(--success); color: #fff; }

.results-card { padding: 30px; }
.results-header { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.results-header > div { display: grid; grid-template-columns: 48px 1fr; }
.results-header .eyebrow, .results-header h2 { grid-column: 2; }
.completion-mark { grid-row: 1/3; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--success); color: #fff; font-weight: 900; animation: completion-pop .5s cubic-bezier(.2,.9,.2,1.2); }
@keyframes completion-pop { from { opacity: 0; scale: .5; rotate: -18deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
.quiet-button { min-height: 42px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--navy); font-size: .72rem; font-weight: 800; }
.results-content { display: grid; grid-template-columns: minmax(280px,.8fr) minmax(340px,1.2fr); gap: 26px; padding-top: 25px; }
.download-buttons { display: grid; gap: 9px; }
.download-btn { width: 100%; display: grid; grid-template-columns: 48px 1fr 18px; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); text-align: left; transition: border-color .18s, translate .18s, box-shadow .18s; }
.download-btn:hover { border-color: var(--blue); translate: 0 -1px; box-shadow: 0 8px 18px rgba(6,28,49,.07); }
.download-btn strong, .download-btn small { display: block; }
.download-btn strong { font-size: .75rem; }
.download-btn small { color: var(--muted); font-size: .64rem; }
.download-btn b { color: var(--blue); font-size: 1rem; }
.preview-container { max-height: 430px; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #f7fafa; }
.preview-container pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #42555a; font: .7rem/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }
.error-card { padding: 46px; text-align: center; }
.error-card > span { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); font-size: 1.35rem; font-weight: 900; }
.error-card > p:not(.eyebrow) { color: var(--muted); }
.error-card .primary-button { max-width: 260px; margin-inline: auto; }

footer { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 15px max(20px,calc((100% - 1180px)/2)); border-top: 1px solid var(--line); background: #eaf0f0; color: var(--muted); font-size: .72rem; }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(100%,430px); position: relative; z-index: 1; }
.login-brand { display: flex; justify-content: center; margin-bottom: 20px; }
.login-card { padding: 36px; text-align: center; }
.login-card h1 { margin-bottom: 7px; font-size: 2rem; }
.login-card > p { margin-bottom: 26px; color: var(--muted); }
.login-card form { text-align: left; }
.login-card label { display: grid; gap: 6px; margin: 13px 0; color: var(--ink); font-size: .72rem; font-weight: 800; }
.login-card input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #bdcdcf; border-radius: 9px; background: #fff; }
.login-card .primary-button { margin-top: 18px; }
.portal-link { display: block; margin-top: 18px; color: var(--blue); font-size: .72rem; font-weight: 750; text-align: center; text-decoration: none; }
.login-error { margin-bottom: 16px; padding: 11px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: .72rem; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px,980px); padding-top: 38px; }
  nav a:first-child { display: none; }
  .journey li { grid-template-columns: 28px 1fr; padding: 8px; }
  .journey small { display: none; }
  .upload-card, .results-card { padding: 19px; }
  .trust-row, .results-content { grid-template-columns: 1fr; }
  .processing-card { padding: 38px 20px; }
  .results-header { align-items: stretch; flex-direction: column; }
  footer { align-items: start; flex-direction: column; gap: 4px; }
  .processor-grid { grid-template-columns: 1fr; }
  .processor-card { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* Durable previous-run history */
.run-history { margin: 34px 0 10px; }
.history-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.history-heading h2 { margin: 3px 0 0; }
.history-heading > small { color: var(--muted); }
.history-list { display: grid; gap: 9px; }
.history-list a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.92); color: inherit; text-decoration: none; box-shadow: 0 8px 24px rgba(4,31,54,.06); transition: transform .18s ease, border-color .18s ease; }
.history-list a:hover { transform: translateY(-2px); border-color: var(--blue); }
.history-list strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list small { color: var(--muted); }
.history-list b { color: var(--blue); font-size: 1.2rem; }
.history-status { min-width: 78px; padding: 6px 8px; border-radius: 999px; background: #e9f1f7; color: #31516a; font-size: .69rem; font-weight: 800; text-align: center; letter-spacing: .04em; }
.history-status.status-completed { background: #dff5e9; color: #147044; }
.history-status.status-error { background: #fee8e8; color: #a42828; }
.history-status.status-processing { background: #e5f0fb; color: #185b94; }
@media (max-width: 680px) { .history-heading { align-items: start; flex-direction: column; } .history-list a { grid-template-columns: auto minmax(0, 1fr) auto; } .history-list a > small { display: none; } }
