/*
 * Wardline — light, print-clean, data-dense.
 *
 * The artefacts this app produces get printed and handed to a board, a lender or a
 * surety underwriter, and the person reading them is at an office desk under
 * fluorescent light. So: light ground, no dark-dashboard look, and a @media print
 * counterpart at the end.
 *
 * Colour discipline, and it matters more here than usual. The brand colour is plum
 * and is used ONLY for navigation, links and primary actions. Green / amber / red
 * mean, and only ever mean, finding status — clear, not established, finding. A
 * badge's colour can therefore be trusted without reading it, which is the whole
 * point of a compliance screen.
 */

:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --surface-3: #e9e9ef;
  --border: #e4e2e9;
  --border-2: #cfccd8;
  --text: #17141c;
  --muted: #5e5767;
  --faint: #8a8394;

  --accent: #6d3d69;
  --accent-dark: #4e2a4b;
  --accent-soft: #f4ecf3;

  --good: #15803d;
  --good-soft: #e8f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --crit: #b91c1c;
  --crit-soft: #fdecec;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 20, 28, .06), 0 1px 3px rgba(23, 20, 28, .04);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font-sans);
  font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { letter-spacing: -.015em; line-height: 1.25; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; font-family: var(--font-sans);
  cursor: pointer; transition: background .13s, border-color .13s, color .13s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-2); box-shadow: var(--shadow); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-quiet { background: transparent; color: var(--muted); border-color: transparent; }
.btn-quiet:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Fields ---------- */

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label, .field > .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--faint); line-height: 1.5; }
.field .hint code { font-family: var(--font-mono); font-size: 11.5px; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], select {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 8px 11px; color: var(--text); font-size: 14px; font-family: var(--font-sans); width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="radio"] { width: auto; accent-color: var(--accent); }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card + .card { margin-top: 16px; }
.section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); margin-bottom: 12px;
}

/* ---------- Topbar ---------- */

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 1000px; margin: 0 auto; padding: 0 22px;
  display: flex; align-items: center; gap: 18px; min-height: 56px; flex-wrap: wrap;
}
.logo { font-size: 17px; font-weight: 800; letter-spacing: -.03em; display: inline-flex; align-items: center; gap: 8px; }
.logo-mark {
  width: 22px; height: 22px; border-radius: 6px; background: var(--accent);
  color: #fff; font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.spacer { flex: 1; }
.who { font-size: 12.5px; color: var(--faint); text-align: right; line-height: 1.3; }
.who strong { display: block; color: var(--text); font-size: 13px; font-weight: 600; }

.subbar { background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.subbar-inner { max-width: 1000px; margin: 0 auto; padding: 8px 22px; }

.page { max-width: 1000px; margin: 0 auto; padding: 26px 22px 70px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 21px; }
.page-head .sub { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.crumb { font-size: 12.5px; color: var(--faint); margin-bottom: 6px; }

/* ---------- Badges and alerts ---------- */

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 8px; border-radius: 5px; white-space: nowrap;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.quiet { background: var(--surface-3); color: var(--muted); }

.alert { border-radius: 8px; padding: 10px 13px; font-size: 13.5px; margin-top: 14px; }
.alert-error { background: var(--crit-soft); color: var(--crit); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-ok { background: var(--good-soft); color: var(--good); }
.alert-info { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- Auth ---------- */

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 22px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.auth-alt { margin-top: 18px; font-size: 13px; color: var(--faint); text-align: center; }
.auth-alt a, .auth-alt button { color: var(--accent); font-weight: 600; background: none; border: none;
  cursor: pointer; font-size: 13px; font-family: inherit; padding: 0; }
.demo-hint {
  margin-top: 16px; padding: 10px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; color: var(--muted);
}
.demo-hint code { font-family: var(--font-mono); color: var(--text); }
.auth-note { margin-top: 14px; font-size: 12px; color: var(--faint); line-height: 1.5; }

/* ---------- Dropzone and file list ---------- */

.drop {
  border: 1.5px dashed var(--border-2); border-radius: var(--radius); padding: 26px 18px;
  text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer;
  font-size: 13.5px;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.drop b { color: var(--text); }
.files { list-style: none; margin-top: 12px; font-size: 13.5px; }
.files li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.files li:last-child { border-bottom: none; }

/* ---------- Estimate ---------- */

.est { background: var(--accent-soft); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-top: 14px; }
.est .n { font-size: 21px; font-weight: 700; letter-spacing: -.02em; color: var(--accent-dark); }
.est .d { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

/* ---------- Findings ---------- */

.finding { border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; padding: 12px 15px; margin-bottom: 9px; background: var(--surface); }
.finding.pass { border-left-color: var(--good); }
.finding.fail { border-left-color: var(--crit); }
.finding.unknown { border-left-color: var(--warn); }
.finding .fh { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.finding h3 { font-size: 14.5px; font-weight: 650; }
.finding p { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.finding p.fix { color: var(--crit); }
.finding p.why { color: var(--warn); }

/* ---------- Share ---------- */

.share { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.share code {
  flex: 1; min-width: 15rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 11px; font-family: var(--font-mono); font-size: 12.5px;
  overflow-x: auto; white-space: nowrap;
}

/* ---------- Tables ---------- */

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 8px 10px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--faint); font-weight: 700;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data a { color: var(--accent); font-weight: 600; }

.empty { text-align: center; padding: 28px 18px; border: 1px dashed var(--border-2);
  border-radius: var(--radius); color: var(--muted); font-size: 13.5px; }

.foot-note { font-size: 12px; color: var(--faint); margin-top: 26px; line-height: 1.6; }
.spin {
  display: inline-block; width: .85em; height: .85em; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -.08em;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .topbar, .subbar, .no-print, .btn { display: none !important; }
  .page { padding: 0; }
  .card { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
}
