:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #657282;
  --line: #d9e0e7;
  --accent: #0b6bcb;
  --accent-dark: #084d92;
  --ok: #087f5b;
  --warn: #b26a00;
  --fail: #c92a2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar,
.section-head,
.upload-panel,
.brand-lockup,
.metric-row,
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 18px;
}

.brand-lockup {
  justify-content: flex-start;
}

.brand-lockup img {
  width: 138px;
  height: auto;
  display: block;
}

.eyebrow {
  margin: 0 0 4px;
  color: #ff7900;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.upload-panel {
  margin-bottom: 18px;
}

.mode-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
}

.mode-tab {
  min-width: 108px;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
}

.mode-tab:hover {
  background: #f3f5f7;
}

.mode-tab.active {
  background: #111827;
  color: #ffffff;
}

.demo-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.demo-files {
  max-width: 820px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.file-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfd;
  padding: 8px 10px;
  text-decoration: none;
}

.file-chip:hover {
  border-color: #1f8f55;
  background: #f1fbf5;
}

.file-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-icon {
  flex: 0 0 auto;
  border-radius: 4px;
  background: #107c41;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  padding: 5px 4px;
}

form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notes-box {
  min-width: 340px;
}

.notes-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.notes-box textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  line-height: 1.35;
  padding: 11px 12px;
}

.notes-box textarea:focus {
  border-color: var(--accent);
  outline: 2px solid #dbeafe;
}

.auth-panel {
  margin-bottom: 18px;
}

.auth-panel input {
  min-width: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  padding: 12px 14px;
}

.dropzone {
  min-width: 300px;
  border: 1px dashed #9fb0c3;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
}

.dropzone input {
  display: none;
}

.dropzone span {
  display: block;
  color: var(--accent);
  font-weight: 800;
}

.dropzone strong {
  display: block;
  max-width: 360px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button,
.download {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 12px 16px;
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button:hover,
.download:hover {
  background: var(--accent-dark);
}

.ghost {
  background: #eef4fb;
  color: var(--accent);
  padding: 9px 12px;
}

.ghost:hover {
  background: #dceaf8;
}

.status-pill,
.badge {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.status-pill {
  background: #e7f5ff;
  color: var(--accent-dark);
}

.badge.done,
.check-pass {
  background: #d3f9d8;
  color: var(--ok);
}

.badge.processing,
.badge.queued {
  background: #e7f5ff;
  color: var(--accent-dark);
}

.badge.failed,
.check-fail {
  background: #ffe3e3;
  color: var(--fail);
}

.check-warn {
  background: #fff3bf;
  color: var(--warn);
}

.hidden {
  display: none;
}

.empty-state {
  color: var(--muted);
  padding: 28px 0;
}

.loading-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #cfe2ff;
  border-radius: 8px;
  background: #f8fbff;
  padding: 18px;
}

.loading-card strong {
  display: block;
  font-size: 18px;
}

.loading-card p {
  margin: 5px 0 8px;
}

.loading-card code {
  color: var(--accent-dark);
  font-weight: 800;
}

.loading-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  place-items: center;
}

.loading-mark img {
  width: 48px;
  height: auto;
}

.loading-mark span {
  position: absolute;
  inset: 0;
  border: 3px solid #dbeafe;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.ai-brief {
  border: 1px solid #fde7c6;
  border-radius: 8px;
  background: #fffaf3;
  padding: 16px;
}

.ai-brief h2 {
  margin-bottom: 6px;
}

.finding-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.finding {
  border: 1px solid #f3d8ae;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.finding strong,
.finding span {
  display: block;
}

.finding span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 3px;
}

.finding-info {
  border-color: #cfe2ff;
}

.finding-warn {
  border-color: #f3d8ae;
}

.finding-fail {
  border-color: #ffc9c9;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.subhead {
  margin: 18px 0 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.check-list {
  display: grid;
  gap: 10px;
}

.action-list {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.action-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
}

.action-row strong {
  display: block;
}

.action-row p {
  margin-top: 3px;
  font-size: 13px;
}

.action-row code {
  color: var(--accent-dark);
  font-weight: 800;
}

.check-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.check-row strong {
  display: block;
}

.check-row p {
  margin-top: 3px;
  font-size: 13px;
}

.check-row code {
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar,
  .brand-lockup,
  .upload-panel,
  .demo-panel,
  form,
  .detail-panel {
    display: block;
  }

  form,
  .dropzone,
  .notes-box,
  .auth-panel input,
  button {
    width: 100%;
  }

  .notes-box {
    margin-top: 12px;
  }

  button {
    margin-top: 12px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .brand-lockup img {
    width: 118px;
    margin-bottom: 10px;
  }

  .mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

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

  .file-chip {
    max-width: 100%;
    width: 100%;
  }

  .loading-card {
    align-items: flex-start;
  }
}
