/* Tenura — UI styles
   Palette: brand blue (the logo's gradient) + severity colours (red/amber/blue). */

:root {
  --brand: #2f5cf6;
  --brand-dark: #1e3fc9;
  --brand-soft: #eef2fe;
  --brand-ring: rgba(47, 92, 246, 0.18);
  --brand-2: #6a35f0; /* the violet end of the logo gradient */

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e6eaf2;
  --line-strong: #d4dae6;

  --high: #c0392b;
  --high-soft: #fdeceb;
  --medium: #b9770a;
  --medium-soft: #fdf4e6;
  --low: #2f6fb0;
  --low-soft: #eaf2fb;
  --ai: #6b7280;
  --rule: #6d47d9;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.12);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1060px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 78% -8%, rgba(47, 92, 246, 0.10), transparent 60%),
    radial-gradient(900px 420px at 8% -12%, rgba(106, 53, 240, 0.07), transparent 55%);
  background-repeat: no-repeat;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); }

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(1.4) blur(10px);
  background: rgba(245, 247, 251, 0.82);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }
.nav-spacer { flex: 1; }
.nav-tag {
  font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 5px 11px; background: var(--surface);
  white-space: nowrap;
}
@media (max-width: 620px) { .nav-tag { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 26px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand-dark);
  background: var(--brand-soft); border: 1px solid #d7e1fd;
  padding: 6px 12px; border-radius: 999px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3.15rem);
  line-height: 1.05; letter-spacing: -0.03em;
  margin: 18px 0 0; max-width: 20ch;
}
.hero p.lede {
  margin: 16px 0 0; max-width: 62ch;
  font-size: 1.06rem; color: var(--ink-soft);
}
.hero-points {
  list-style: none; margin: 22px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 10px 18px;
}
.hero-points li {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9rem; color: var(--ink-soft);
}
.hero-points svg { width: 16px; height: 16px; color: var(--brand); flex: none; }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.input-panel { padding: 8px; margin-top: 26px; }

.tabs {
  display: flex; gap: 6px; padding: 6px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.tab {
  flex: 1; appearance: none; border: 0; cursor: pointer;
  padding: 10px 14px; border-radius: 8px;
  font: inherit; font-weight: 600; color: var(--muted);
  background: transparent; transition: background .15s, color .15s, box-shadow .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.tab svg { width: 16px; height: 16px; }
.tab[aria-selected="true"] {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.tabpanel { padding: 16px 14px 6px; }

textarea#agreementText {
  width: 100%; min-height: 230px; resize: vertical;
  padding: 14px 15px; font: inherit; font-size: 0.95rem; line-height: 1.6;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea#agreementText:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.meta-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 10px; font-size: 0.83rem; color: var(--muted);
}
.link-btn {
  appearance: none; border: 0; background: none; cursor: pointer;
  color: var(--brand-dark); font: inherit; font-weight: 600; padding: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--brand); }

/* ---------- Dropzone ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 220px; box-sizing: border-box;
  padding: 32px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone:focus-visible {
  outline: none; border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
.dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 4px var(--brand-ring); }
.dropzone.has-file { cursor: default; }

.dz-input { display: none; }

/* Empty state */
.dz-empty { display: flex; flex-direction: column; align-items: center; }
.dz-icon {
  width: 52px; height: 52px; margin-bottom: 14px; border-radius: 14px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark);
}
.dz-icon svg { width: 26px; height: 26px; }
.dz-title { display: block; font-weight: 700; font-size: 1.02rem; }
.dz-hint { display: block; margin-top: 6px; font-size: 0.85rem; color: var(--muted); }

/* Selected-file state */
.dz-file {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  width: 100%; text-align: left;
}
.file-icon {
  flex: none; width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark);
}
.file-icon svg { width: 20px; height: 20px; }
.file-meta { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; }
.file-name {
  font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-size { font-size: 0.82rem; color: var(--muted); }
.file-actions { flex: none; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.file-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--brand-dark); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 9px; padding: 8px 13px;
}
.file-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.file-remove {
  appearance: none; cursor: pointer; flex: none;
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line-strong);
}
.file-remove:hover { color: var(--high); border-color: #e6b8b3; background: var(--high-soft); }
.file-remove svg { width: 16px; height: 16px; }
.file-btn:focus-visible, .file-remove:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Inline validation error */
.dz-error {
  margin: 10px 2px 0; padding: 10px 13px; font-size: 0.88rem;
  color: #7c231b; background: var(--high-soft);
  border: 1px solid #f3c9c4; border-radius: var(--radius-sm);
}

/* ---------- Actions ---------- */
.actions {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 20px 14px 12px; text-align: center;
}
@media (max-width: 560px) {
  .actions .btn-primary { width: 100%; justify-content: center; }
  .dropzone { padding: 24px 18px; }
}
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  padding: 12px 22px; border-radius: 11px; transition: transform .05s, background .15s, box-shadow .15s;
  display: inline-flex; align-items: center; gap: 9px;
}
.btn svg { width: 17px; height: 17px; }
.btn-icon { display: inline-flex; }
.btn-spinner {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 18px rgba(47, 92, 246, 0.28); }
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-dark), #5a28e0); }
.btn-primary:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: default; box-shadow: none; }
.btn:disabled:active { transform: none; }
.btn:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 2px; }
.privacy-note { font-size: 0.82rem; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.privacy-note svg { width: 15px; height: 15px; flex: none; }

/* ---------- Loading ---------- */
.loading { margin-top: 22px; }
.loading-card {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px;
}
.spinner {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-steps { font-size: 0.92rem; color: var(--ink-soft); }
.loading-steps strong { display: block; color: var(--ink); }
.step-dots { display: inline-flex; gap: 6px; margin-top: 8px; }
.step-dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong);
  animation: pulse 1.2s ease-in-out infinite;
}
.step-dots i:nth-child(2) { animation-delay: .18s; }
.step-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes pulse { 0%,100% { background: var(--line-strong); } 50% { background: var(--brand); } }

/* ---------- Error ---------- */
.error {
  margin-top: 22px; padding: 15px 17px; border-radius: var(--radius-sm);
  background: var(--high-soft); border: 1px solid #f3c9c4; color: #7c231b;
  display: flex; gap: 12px; align-items: flex-start;
}
.error svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.error strong { display: block; }
.error span { font-size: 0.9rem; }

/* ---------- Not-a-tenancy notice (distinct from the error banner) ---------- */
.notice { margin-top: 26px; }
.notice-card {
  display: flex; gap: 20px; align-items: flex-start;
  padding: 26px 24px; border-left: 5px solid var(--brand);
  background: linear-gradient(180deg, var(--brand-soft), var(--surface) 55%);
}
@media (max-width: 640px) { .notice-card { flex-direction: column; gap: 14px; } }
.notice-icon {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; color: var(--brand-dark);
  background: #fff; border: 1px solid #d7e1fd; box-shadow: var(--shadow-sm);
}
.notice-icon svg { width: 26px; height: 26px; }
.notice-body { min-width: 0; }
.notice-body h2 { margin: 2px 0 8px; font-size: 1.2rem; letter-spacing: -0.01em; }
.notice-body p { margin: 0 0 16px; color: var(--ink-soft); max-width: 60ch; }
.notice-body .btn { font-size: 0.95rem; padding: 11px 18px; }

/* ---------- Results ---------- */
.results { margin-top: 26px; }

.score-panel { padding: 22px; display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
@media (max-width: 640px) { .score-panel { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.ring-wrap { position: relative; width: 148px; height: 148px; }
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 1s ease, stroke .3s; }
.ring-center {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.ring-center .score-value { font-size: 2.5rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.ring-center small { color: var(--muted); font-size: 0.78rem; }
.risk-level { font-weight: 700; margin: 0 0 4px; font-size: 1.05rem; display: inline-flex; align-items: center; gap: 9px; }
.risk-dot { width: 10px; height: 10px; border-radius: 50%; }
.risk-high .risk-dot { background: var(--high); }
.risk-medium .risk-dot { background: var(--medium); }
.risk-low .risk-dot { background: var(--brand); }
.score-summary { color: var(--ink-soft); font-size: 0.98rem; margin: 0; }
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px; min-width: 128px;
}
.stat b { font-size: 1.35rem; display: block; line-height: 1.15; }
.stat span { font-size: 0.78rem; color: var(--muted); }
.stat.is-high b { color: var(--high); }
.stat.is-medium b { color: var(--medium); }
.stat.is-low b { color: var(--brand); }

.result-section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 1.2rem; margin: 0; letter-spacing: -0.01em; }
.section-head .count {
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
}
.section-head .sub { color: var(--muted); font-size: 0.88rem; margin-left: auto; }

.finding {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--line-strong);
  border-radius: 12px; padding: 15px 17px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.finding.sev-high { border-left-color: var(--high); }
.finding.sev-medium { border-left-color: var(--medium); }
.finding.sev-low { border-left-color: var(--low); }
.finding-top { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 8px; }
.finding-title { font-weight: 700; text-transform: capitalize; }
.badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; text-transform: uppercase;
}
.badge.sev-high { color: var(--high); background: var(--high-soft); border-color: #f3c9c4; }
.badge.sev-medium { color: var(--medium); background: var(--medium-soft); border-color: #f0dcb6; }
.badge.sev-low { color: var(--low); background: var(--low-soft); border-color: #cfe2f6; }
.badge.src-rule { color: var(--rule); background: #f1ecfd; border-color: #ddd2f7; }
.badge.src-ai { color: var(--ai); background: #f1f2f4; border-color: #e2e4e8; }
.finding .reason { margin: 0 0 10px; color: var(--ink-soft); }
.finding .evidence {
  font-size: 0.86rem; color: var(--ink-soft); background: var(--surface-2);
  border: 1px dashed var(--line-strong); border-radius: 8px; padding: 8px 11px; margin-bottom: 10px;
}
.finding .evidence b { color: var(--ink); }
.finding details { margin-top: 4px; }
.finding summary {
  cursor: pointer; font-size: 0.83rem; color: var(--muted); font-weight: 600;
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
.finding summary::-webkit-details-marker { display: none; }
.finding summary svg { width: 13px; height: 13px; transition: transform .15s; }
.finding details[open] summary svg { transform: rotate(90deg); }
.finding blockquote {
  margin: 8px 0 0; padding: 10px 13px; background: var(--surface-2);
  border-left: 3px solid var(--line-strong); border-radius: 6px;
  font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word;
}

.empty {
  padding: 18px 20px; border-radius: 12px; background: var(--surface);
  border: 1px dashed var(--line-strong); color: var(--muted); font-size: 0.94rem;
}

.missing-item {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--medium); border-radius: 12px;
  padding: 14px 17px; margin-bottom: 12px;
}
.missing-item .m-title { font-weight: 700; }
.missing-item .m-why { color: var(--ink-soft); font-size: 0.92rem; margin-top: 3px; }
.missing-item .m-tag {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--medium); background: var(--medium-soft); border: 1px solid #f0dcb6;
  padding: 2px 8px; border-radius: 999px; margin-left: 8px;
}

.questions-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.questions-head h2 { margin: 0; font-size: 1.2rem; }
.copy-btn {
  margin-left: auto; appearance: none; cursor: pointer; font: inherit; font-size: 0.84rem; font-weight: 600;
  color: var(--brand-dark); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 7px;
}
.copy-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.copy-btn svg { width: 15px; height: 15px; }
.questions-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.questions-list li {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px;
}
.q-check {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-dark);
  font-size: 0.75rem; font-weight: 800; margin-top: 1px;
}
.questions-list li p { margin: 0; }

/* ---------- How it works ---------- */
.how { margin: 54px 0 10px; }
.how h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 760px) { .how-grid { grid-template-columns: 1fr; } }
.how-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.how-card .num {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 0.85rem; margin-bottom: 10px;
}
.how-card h3 { margin: 0 0 5px; font-size: 1rem; }
.how-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 48px; border-top: 1px solid var(--line);
  padding: 26px 0 44px; color: var(--muted); font-size: 0.86rem;
}
.footer .disclaimer {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 16px; color: var(--ink-soft);
}
.footer .disclaimer strong { color: var(--ink); }
.footer-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.footer-links a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- Legal pages (privacy, terms) ---------- */
/* Generated from docs/legal/*.md by scripts/build_legal_pages.py */
.nav-links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.nav-links a { color: var(--ink-soft); font-size: 0.92rem; font-weight: 600; text-decoration: none; }
.nav-links a:hover { color: var(--brand-dark); text-decoration: underline; }
@media (max-width: 620px) { .nav-links a:not(:last-child) { display: none; } }

.legal { max-width: 780px; padding: 34px 0 20px; }
.legal article { color: var(--ink-soft); font-size: 1rem; line-height: 1.72; }
.legal h1 { margin: 0 0 18px; font-size: clamp(1.7rem, 4vw, 2.25rem); color: var(--ink); letter-spacing: -0.02em; line-height: 1.15; }
.legal h2 { margin: 40px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 1.2rem; color: var(--ink); }
.legal h3 { margin: 26px 0 8px; font-size: 1.02rem; color: var(--ink); }
.legal p { margin: 0 0 14px; }
.legal ul, .legal ol { margin: 0 0 16px; padding-left: 22px; }
.legal li { margin-bottom: 8px; }
.legal strong { color: var(--ink); font-weight: 650; }
.legal a { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.legal code { font-family: var(--mono); font-size: 0.88em; background: var(--brand-soft); padding: 1px 5px; border-radius: 5px; }
.legal hr { margin: 30px 0; border: 0; border-top: 1px solid var(--line); }
.legal blockquote { margin: 0 0 16px; padding: 12px 16px; background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.legal-table { margin: 0 0 18px; overflow-x: auto; }
.legal table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.legal th, .legal td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.legal th { background: var(--brand-soft); color: var(--ink); font-weight: 650; }
.legal tbody tr:last-child td { border-bottom: 0; }

/* ---------- Accounts: header state, auth pages, history ---------- */
.auth-slot { display: flex; align-items: center; gap: 10px; }
.auth-link {
  appearance: none; font-family: inherit; cursor: pointer;
  font-size: 0.9rem; font-weight: 650; color: var(--ink-soft);
  text-decoration: none; padding: 7px 12px; border-radius: 9px;
  border: 1px solid transparent; background: none; white-space: nowrap;
}
.auth-link:hover { color: var(--brand-dark); background: var(--brand-soft); }
.auth-cta { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; }
.auth-cta:hover { background: linear-gradient(135deg, var(--brand-dark), #5a28e0); border-color: transparent; color: #fff; }
.auth-user {
  font-size: 0.85rem; color: var(--muted); max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 620px) { .auth-user { display: none; } }

.auth { display: flex; justify-content: center; padding: 44px 0 10px; }
.auth-card { width: min(460px, 100%); padding: 30px 28px; }
.auth-card h1 { margin: 0 0 6px; font-size: clamp(1.5rem, 4vw, 1.9rem); letter-spacing: -0.02em; }
.auth-sub { margin: 0 0 22px; color: var(--muted); font-size: 0.95rem; }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 0.85rem; font-weight: 650; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 13px; font: inherit; font-size: 0.97rem;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.field-hint { display: block; margin-top: 5px; font-size: 0.8rem; color: var(--muted); }
.field input.otp-input {
  letter-spacing: 0.42em; font-size: 1.28rem; font-weight: 700; text-align: center;
}
.form-error {
  margin: 0 0 16px; padding: 10px 13px; font-size: 0.88rem;
  color: #7c231b; background: var(--high-soft);
  border: 1px solid #f3c9c4; border-radius: var(--radius-sm);
}
.auth-submit { width: 100%; justify-content: center; }
.auth-alt { margin: 16px 0 0; font-size: 0.9rem; color: var(--muted); }
.auth-legal { margin: 20px 0 0; font-size: 0.78rem; color: var(--muted); }

/* "Continue with Google". White with a border, per Google's neutral button
 * style: it must not take the brand colour, or it stops reading as Google's. */
.auth-google { margin: 0; }
.btn-google {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); font-weight: 650;
}
.btn-google:hover { border-color: var(--muted); background: var(--surface-2); }
.btn-google:disabled:hover { border-color: var(--line-strong); background: var(--surface); }
.google-mark { display: inline-flex; flex: none; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0 18px; color: var(--muted); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.resend-hint { margin-left: 6px; font-size: 0.85rem; color: var(--muted); }
.verify-prompt { margin: 14px 0 0; }

.btn-ghost {
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line-strong); font-weight: 650;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.ghost-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 0.85rem; font-weight: 650;
  color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 13px;
}
.ghost-btn:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.ghost-btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; }
.ghost-btn.danger:hover { border-color: #e6b8b3; color: var(--high); background: var(--high-soft); }

/* "Keep this analysis?" / "Saved" banner on the analyser. */
.save-banner { margin-top: 26px; }
.save-card {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  justify-content: space-between; padding: 20px 22px;
}
.save-body { min-width: 0; }
.save-body strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.save-body p { margin: 0; color: var(--muted); font-size: 0.9rem; max-width: 60ch; }
.save-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Transient status, used by common.js for cold-start retries. */
.tenura-status {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 90; max-width: min(560px, calc(100% - 32px));
  padding: 11px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 0.88rem; font-weight: 600;
  box-shadow: var(--shadow-lg); text-align: center;
}

.history { padding: 38px 0 10px; max-width: 780px; }
.history-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.history-head h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.1rem); letter-spacing: -0.02em; }
.history-head .auth-sub { margin: 4px 0 0; }
.privacy-banner {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 20px 0 22px; padding: 13px 16px;
  background: var(--brand-soft); border: 1px solid #d7e1fd; border-radius: 12px;
  font-size: 0.88rem; color: var(--ink-soft);
}
.privacy-banner svg { width: 17px; height: 17px; flex: none; margin-top: 2px; color: var(--brand-dark); }
.history-item {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 16px 18px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.history-item:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.history-item:active { transform: translateY(1px); }
.hi-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hi-title { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hi-meta { font-size: 0.8rem; color: var(--muted); }
.hi-reco { font-size: 0.88rem; color: var(--ink-soft); }
.hi-risk {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 78px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.hi-risk b { font-size: 1.15rem; }
.hi-risk small { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }
.hi-risk.risk-high b { color: var(--high); }
.hi-risk.risk-medium b { color: var(--medium); }
.hi-risk.risk-low b { color: var(--brand); }
@media (max-width: 560px) {
  .history-item { flex-direction: column; align-items: flex-start; }
  .hi-risk { flex-direction: row; gap: 8px; align-items: center; }
  .hi-title { white-space: normal; }
}
.history-loading { display: flex; align-items: center; gap: 12px; padding: 30px 0; color: var(--muted); }
.empty-state { padding: 30px 26px; text-align: center; }
.empty-state h2 { margin: 0 0 8px; font-size: 1.15rem; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }

.back-btn { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px; }
.back-btn svg { width: 15px; height: 15px; }
.detail-title-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.detail-title-row h1 { margin: 0; font-size: clamp(1.4rem, 3.6vw, 1.9rem); letter-spacing: -0.02em; }
.detail-actions { display: flex; gap: 8px; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  margin: 10px 0 20px; font-size: 0.88rem; color: var(--muted);
}
.detail-meta .risk-level { margin: 0; font-size: 0.88rem; }
.detail-meta .risk-level b { color: var(--ink); font-weight: 700; }
.detail-score { padding: 20px 22px; margin-bottom: 26px; }
.detail-score .stat-row { margin-bottom: 14px; }
.detail-reco { margin: 0; font-weight: 650; color: var(--ink); }
.rename-input {
  flex: 1 1 260px; min-width: 0;
  padding: 10px 13px; font: inherit; font-size: 1.1rem; font-weight: 700;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--brand); border-radius: var(--radius-sm);
}
.rename-input:focus { outline: none; box-shadow: 0 0 0 4px var(--brand-ring); }
.agreement-preview { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 6px; }
.agreement-preview summary { cursor: pointer; font-weight: 650; color: var(--brand-dark); padding: 8px 0; }
.agreement-preview pre {
  margin: 8px 0 0; padding: 14px; max-height: 340px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: 0.82rem;
  white-space: pre-wrap; word-break: break-word;
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
