:root {
  --purple-950: #24102b;
  --purple-900: #34143e;
  --purple-800: #4b1d59;
  --purple-700: #682a78;
  --purple-600: #7b368c;
  --green-500: #6db51e;
  --green-400: #83ca32;
  --ink: #201e22;
  --muted: #6e6871;
  --line: #e7e2e9;
  --paper: #ffffff;
  --wash: #f7f5f8;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(45, 19, 53, .12);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--wash); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 92% 0%, rgba(109, 181, 30, .11), transparent 28rem),
    linear-gradient(180deg, #fff 0, var(--wash) 32rem);
}

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

.site-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  width: min(1180px, calc(100% - 48px));
  min-height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand img { display: block; width: 200px; height: auto; }

nav { display: flex; align-items: center; gap: 8px; }
nav a, .nav-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
nav a:hover, .nav-button:hover, nav a[aria-current="page"] {
  color: var(--purple-700);
  background: #f3edf5;
}
nav form { margin: 0; }

.content {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 80px;
  flex: 1;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 40px;
  padding: 22px 0 44px;
}
.hero-compact { padding-bottom: 30px; }

.eyebrow {
  display: block;
  color: var(--green-500);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 760px;
  margin: 10px 0 14px;
  color: var(--purple-950);
  font-size: clamp(42px, 7vw, 72px);
  line-height: .98;
  letter-spacing: -.055em;
}
h2 { color: var(--purple-950); letter-spacing: -.025em; }
.hero p { max-width: 680px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.6; }

.metric-card {
  min-width: 210px;
  padding: 24px;
  border: 1px solid rgba(104, 42, 120, .14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .8);
  box-shadow: var(--shadow);
}
.metric-card strong { display: block; color: var(--purple-700); font-size: 36px; }
.metric-card span { color: var(--muted); font-weight: 700; }

.search-panel, .results-section, .missing-panel {
  margin-top: 22px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 12px 40px rgba(45, 19, 53, .06);
}

.search-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
input, textarea {
  width: 100%;
  border: 1px solid #d9d2dc;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: 0;
  transition: border-color .2s, box-shadow .2s;
}
input { min-height: 58px; padding: 0 18px; }
textarea { resize: vertical; padding: 16px 18px; line-height: 1.55; }
input:focus, textarea:focus {
  border-color: var(--purple-600);
  box-shadow: 0 0 0 4px rgba(123, 54, 140, .12);
}

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { background: var(--purple-700); color: white; box-shadow: 0 10px 24px rgba(104, 42, 120, .24); }
.primary-button:hover { background: var(--purple-800); }
.secondary-button { border-color: var(--line); background: white; color: var(--purple-700); }
.secondary-button:hover { border-color: var(--purple-600); }
.helper-text { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 34px;
}
.feature-grid article {
  min-height: 210px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
}
.feature-number { color: var(--green-500); font-weight: 900; }
.feature-grid h2 { margin: 42px 0 10px; }
.feature-grid p { margin: 0; color: var(--muted); line-height: 1.6; }

.tools-hero { align-items: center; padding-bottom: 34px; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.tool-card {
  position: relative;
  min-height: 300px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, .9);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 12px 40px rgba(45, 19, 53, .06);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(104, 42, 120, .35);
  box-shadow: 0 22px 56px rgba(45, 19, 53, .12);
}
.tool-card-featured {
  background:
    radial-gradient(circle at 100% 0%, rgba(131, 202, 50, .22), transparent 18rem),
    linear-gradient(145deg, #32143b, #542061);
  color: white;
  border-color: transparent;
}
.tool-card-featured h2 { color: white; }
.tool-card-featured p { color: rgba(255,255,255,.76); }
.tool-card-featured .tool-icon { background: rgba(255,255,255,.13); color: white; }
.tool-card-featured .tool-link { color: #a8e566; }
.tool-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 44px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: #f2eaf4;
  color: var(--purple-700);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -.03em;
}
.tool-card h2 { margin: 9px 0 10px; font-size: 30px; }
.tool-card p { max-width: 560px; margin: 0 0 28px; color: var(--muted); line-height: 1.65; }
.tool-card.tool-card-featured p { color: rgba(255,255,255,.76); }
.tool-link {
  position: absolute;
  left: 30px;
  bottom: 28px;
  color: var(--purple-700);
  font-weight: 900;
}
.tool-link b { margin-left: 4px; font-size: 18px; }

.quick-access {
  margin-top: 22px;
  padding: 28px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
}
.quick-access h2 { margin: 6px 0 8px; }
.quick-access p { margin: 0; color: var(--muted); }
.quick-actions { display: flex; gap: 10px; flex: 0 0 auto; }

.tool-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}
.upload-card, .requirements-card, .result-card {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 14px 44px rgba(45, 19, 53, .07);
}
.upload-heading {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 24px;
}
.upload-heading h2 { margin: 0 0 7px; }
.upload-heading p { margin: 0; color: var(--muted); line-height: 1.55; }
.step-badge {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--purple-700);
  color: white;
  font-weight: 900;
}
.file-drop {
  min-height: 150px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1.5px dashed #c9bdce;
  border-radius: 18px;
  background: #faf8fb;
  cursor: pointer;
}
.file-drop:hover { border-color: var(--purple-600); background: #f8f3fa; }
.file-drop-icon {
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: #edf8e3;
  color: #3f7608;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}
.file-drop strong, .file-drop small { display: block; }
.file-drop strong { margin-bottom: 5px; color: var(--purple-950); }
.file-drop small { color: var(--muted); }
.file-drop input {
  width: auto;
  min-height: 0;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.file-drop input:focus { box-shadow: none; }
.pricing-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.pricing-fields label span {
  display: block;
  margin-bottom: 7px;
  color: var(--purple-950);
  font-size: 12px;
  font-weight: 800;
}
.process-button { width: 100%; margin-top: 20px; }
.requirements-card h2 { margin: 8px 0 18px; }
.requirements-card ul { margin: 0 0 26px; padding: 0; list-style: none; }
.requirements-card li {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.5;
}
.requirements-card li span { color: var(--green-500); font-weight: 900; }
.requirements-card a, .text-link { color: var(--purple-700); font-weight: 800; text-decoration: none; }

.result-card { max-width: 900px; margin: 20px auto; text-align: center; }
.result-card h1 { margin: 12px auto 28px; font-size: clamp(38px, 6vw, 62px); }
.result-mark {
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: #edf8e3;
  color: #3f7608;
  font-size: 34px;
  font-weight: 900;
}
.result-card-error .result-mark { background: #ffedf0; color: #9b2338; }
.process-log {
  max-width: 690px;
  margin: 0 auto 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
}
.process-log > div { display: grid; grid-template-columns: 52px 1fr; border-bottom: 1px solid var(--line); }
.process-log > div:last-child { border-bottom: 0; }
.process-log span {
  padding: 15px;
  background: #f8f6f9;
  color: var(--green-500);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
}
.process-log p { margin: 0; padding: 15px 17px; color: var(--muted); line-height: 1.5; }
.result-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; }
.result-actions .text-link { padding: 14px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.section-heading h2 { margin: 6px 0 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 18px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #f8f6f9; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbf9fc; }
code {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 8px;
  background: #f3eff5;
  color: var(--purple-800);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}
.inventory-code { background: #edf8e3; color: #3b6f06; }

.empty-state { padding: 48px 22px; text-align: center; }
.empty-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: #f2eaf4;
  color: var(--purple-700);
  font-weight: 900;
}
.empty-state p { color: var(--muted); }
.error-page { margin: 70px auto; }

.bulk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: start; }
.bulk-form, .bulk-summary {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 12px 40px rgba(45, 19, 53, .06);
}
.bulk-form label { display: block; margin-bottom: 10px; color: var(--purple-950); font-weight: 800; }
.form-actions { display: flex; gap: 10px; margin-top: 14px; }
.summary-row { display: flex; align-items: end; justify-content: space-between; padding: 18px 0; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-row strong { color: var(--purple-700); font-size: 34px; }
.summary-row span { color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }

.login-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background:
    linear-gradient(120deg, rgba(36,16,43,.96), rgba(75,29,89,.93)),
    radial-gradient(circle at 80% 20%, rgba(109,181,30,.4), transparent 20rem);
}
.login-card {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  overflow: hidden;
  border-radius: 28px;
  background: white;
  box-shadow: 0 30px 100px rgba(0, 0, 0, .3);
}
.login-brand { padding: 56px; background: linear-gradient(145deg, #fff, #f7f2f8); }
.login-brand img { width: min(330px, 100%); margin-bottom: 68px; }
.login-brand h1 { margin-top: 12px; font-size: 50px; }
.login-brand p { color: var(--muted); line-height: 1.6; }
.login-form { padding: 56px 42px; display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.login-form label { color: var(--purple-950); font-size: 13px; font-weight: 800; }
.login-form input { margin-top: 8px; }
.login-form .primary-button { margin-top: 6px; }

.flash { width: min(900px, 100%); margin: 0 auto 18px; padding: 14px 18px; border-radius: 12px; }
.flash-error { background: #ffedf0; color: #9b2338; }

footer {
  width: min(1180px, calc(100% - 48px));
  margin: auto auto 0;
  padding: 26px 0;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.login-stage + footer { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 800px) {
  .topbar { width: min(100% - 28px, 1180px); min-height: 74px; }
  .brand img { width: 150px; }
  nav { gap: 0; }
  nav a, .nav-button { padding: 0 9px; font-size: 13px; }
  .content { width: min(100% - 28px, 1180px); padding-top: 36px; }
  .hero { align-items: stretch; flex-direction: column; }
  .metric-card { min-width: 0; }
  .feature-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-workspace { grid-template-columns: 1fr; }
  .quick-access { align-items: flex-start; flex-direction: column; }
  .pricing-fields { grid-template-columns: 1fr; }
  .file-drop { align-items: flex-start; flex-wrap: wrap; }
  .file-drop input { width: 100%; margin: 10px 0 0; }
  .bulk-layout { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; }
  .login-brand { padding: 34px 30px 24px; }
  .login-brand img { width: 230px; margin-bottom: 36px; }
  .login-brand h1 { font-size: 38px; }
  .login-form { padding: 24px 30px 36px; }
}

@media (max-width: 560px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 16px 0; gap: 10px; }
  nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .search-form { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .search-panel, .results-section, .missing-panel { padding: 20px; }
  .form-actions { flex-direction: column; }
  footer { width: calc(100% - 28px); flex-direction: column; gap: 6px; }
}
