:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212b;
  --border: #2a2f3a;
  --text: #e7ebf0;
  --muted: #97a1b0;
  --primary: #4f7cff;
  --primary-hover: #3f6bf0;
  --danger: #e5484d;
  --danger-bg: #2a1416;
  --warning-bg: #2a2410;
  --warning-border: #5a4d18;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ---------- Auth ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.brand {
  font-size: 1.6rem;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 0.95rem;
}

/* ---------- Layout ---------- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-sm {
  font-weight: 600;
}

.content {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- Card ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.title {
  font-size: 1.3rem;
  margin: 0 0 6px;
}

/* ---------- Form ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--primary);
}

input[type="file"] {
  background: var(--panel-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 0.9rem;
  width: 100%;
}

input[type="file"]::file-selector-button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  margin-right: 12px;
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #242935;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-top: 16px;
  text-align: left;
}

.alert-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: #ffb4b6;
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #e9d98a;
}

code {
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ---------- Loading ---------- */
.loading-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 26px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 8px;
}

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

.loading-text {
  font-weight: 600;
  margin: 0;
}

.loading-sub {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ---------- Per-file upload progress ---------- */
.progress-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.progress-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.88rem;
}

.progress-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-status {
  flex: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.progress-status.uploading {
  color: var(--primary);
}

.progress-status.done {
  color: #3fb950;
}

.progress-status.error {
  color: var(--danger);
}

/* ---------- Result ---------- */
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.result-head .title {
  margin: 0;
}

.report {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* ---------- Prose (rendered markdown) ---------- */
.prose {
  font-size: 0.96rem;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  line-height: 1.3;
  margin: 1.2em 0 0.5em;
}

.prose h1 {
  font-size: 1.4rem;
}
.prose h2 {
  font-size: 1.2rem;
}
.prose h3 {
  font-size: 1.05rem;
}

.prose p {
  margin: 0.6em 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
  margin: 0.6em 0;
}

.prose li {
  margin: 0.25em 0;
}

.prose code {
  font-size: 0.85em;
}

.prose pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
}

.prose pre code {
  background: transparent;
  padding: 0;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.8em 0;
  font-size: 0.9rem;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.prose th {
  background: var(--panel-2);
}

.prose blockquote {
  border-left: 3px solid var(--border);
  margin: 0.8em 0;
  padding-left: 14px;
  color: var(--muted);
}

.prose a {
  color: var(--primary);
}

/* ---------- Bid sheet emphasis (light / print-style callout) ---------- */
/* The bid sheet is a light card so its print-safe colours read correctly:
   black body text, dark-red / dark-amber labels and keyword chips on light
   tints. The same palette is used in the PDF export. */
.bid-sheet {
  background: #ffffff;
  color: #111111;
  border: 1px solid #d8dce4;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 0 0 22px;
}

.bid-sheet p {
  margin: 0 0 8px;
  color: #111111;
}
.bid-sheet > :last-child {
  margin-bottom: 0;
}

.bid-sheet .bid-bullets {
  margin: 4px 0 12px;
  padding-left: 22px;
}
.bid-sheet .bid-bullets li {
  color: #111111;
  margin: 3px 0;
}

/* Section labels: bold, in their bucket colour. */
.bid-sheet .hd-red {
  color: #c0392b;
  font-weight: 700;
}
.bid-sheet .hd-amber {
  color: #9a6700;
  font-weight: 700;
}
.bid-sheet .b-green {
  color: #1e7e34;
  font-weight: 700;
}

/* Keyword highlight chips — bold coloured text on a light tint. */
.kw-red,
.kw-amber {
  font-weight: 700;
  padding: 0 4px;
  border-radius: 4px;
}
.kw-red {
  color: #c0392b;
  background: #fde2e2;
}
.kw-amber {
  color: #9a6700;
  background: #fff3cd;
}

/* On-screen report becomes a print-style white sheet so the bid-sheet chips
   read correctly and the FULL REVIEW is plain black, mirroring the PDF. */
#report.report {
  background: #ffffff;
  border: 1px solid #d8dce4;
  border-radius: 12px;
  padding: 22px 24px;
}

/* FULL REVIEW: plain black text, no highlights; light code/table surfaces. */
#report .full-review {
  color: #111111;
}
#report .full-review a {
  color: #1a5fb4;
}
#report .full-review blockquote {
  border-left-color: #d8dce4;
  color: #555555;
}
#report .full-review pre {
  background: #f4f6f8;
  border-color: #d8dce4;
  color: #111111;
}
#report .full-review code {
  background: #f4f6f8;
  color: #111111;
}
#report .full-review pre code {
  background: transparent;
  color: #111111;
}
#report .full-review th,
#report .full-review td {
  border-color: #d8dce4;
}
#report .full-review th {
  background: #f4f6f8;
}
