@import url('tokens.css');

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans);
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--navy); }
a:hover { color: var(--red); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.hidden { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(26px, 3.6vw, 36px); line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13.5px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); width: 100%; }
.grow { flex: 1 0 auto; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* ===== Header + tabs ===== */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(251,250,248,0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--hairline); }
.header-inner { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); height: 64px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--navy); }
.brand img { height: 30px; width: auto; display: block; }
.brand .wordmark { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; padding-left: 12px; border-left: 1px solid var(--hairline); line-height: 1; }
.brand .wordmark small { display: block; font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.tabs { display: flex; gap: 4px; margin-left: 16px; height: 100%; }
.tabs a { display: flex; align-items: center; padding: 0 14px; height: 64px; text-decoration: none; color: var(--text-2); font-weight: 500; font-size: 15px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--navy); }
.tabs a.active { color: var(--navy); border-bottom-color: var(--red); font-weight: 600; }
.tabs a.admin { margin-left: 8px; color: var(--muted); }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.user-menu .who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.user-menu .org { color: var(--muted); }
.user-menu a { color: var(--navy); font-weight: 600; text-decoration: none; }
@media (max-width: 760px) {
  .header-inner { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 0; row-gap: 0; }
  .brand .wordmark small { display: none; }
  .user-menu { margin-left: auto; }
  .user-menu .org { display: none; }
  .tabs { order: 3; width: 100%; margin-left: 0; height: 48px; overflow-x: auto; }
  .tabs a { height: 48px; padding: 0 12px; font-size: 14px; }
}

/* ===== Page header ===== */
.page-head { padding: 36px 0 22px; }
.page-head p.lede { font-size: 17px; color: var(--text-2); max-width: 70ch; text-wrap: pretty; margin: 10px 0 0; }

/* ===== Cards & layout ===== */
.card { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 24px; }
.card + .card { margin-top: 20px; }
.cols { display: grid; grid-template-columns: 11fr 9fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 16px; }

/* ===== Dropzones ===== */
.dz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.dz-grid.with-swap { grid-template-columns: 1fr auto 1fr; }
@media (max-width: 640px) { .dz-grid, .dz-grid.with-swap { grid-template-columns: 1fr; } }
.dropzone {
  border: 2px dashed var(--input-border); background: #FDFCFA; border-radius: var(--r-lg);
  padding: 26px 18px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; min-height: 118px;
  display: flex; flex-direction: column; justify-content: center;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--navy); background: var(--surface-2); }
.dropzone.attached { border-style: solid; border-color: var(--navy); background: #fff; }
.dropzone.accent-blue.attached { border-color: #1A6BDB; }
.dropzone.accent-green.attached { border-color: #15984A; }
.dropzone .dz-step { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.dropzone .dz-title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.dropzone .dz-hint { font-size: 13px; color: var(--muted); margin-top: 3px; }
.dropzone.attached .dz-hint { color: var(--ok); }
.dropzone.disabled { opacity: .6; pointer-events: none; }
.swap-btn { align-self: center; background: none; border: 1px solid var(--input-border); border-radius: 50%; width: 38px; height: 38px; cursor: pointer; color: var(--text-2); font-size: 18px; line-height: 1; }
.swap-btn:hover { border-color: var(--navy); color: var(--navy); }

/* ===== Form controls ===== */
.options { display: flex; gap: 22px 32px; flex-wrap: wrap; margin: 20px 0 6px; }
.opt-group .label { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--text-2); cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.seg { display: inline-flex; border: 1px solid var(--navy); border-radius: var(--r-sm); overflow: hidden; }
.seg button { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 16px; border: 0; background: #fff; color: var(--navy); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--navy); }
.seg button.active { background: var(--navy); color: #fff; }
.field label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=email], .field input[type=number], .field select, .field textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: #fff; border: 1px solid var(--input-border); border-radius: var(--r-sm); padding: 9px 12px;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: var(--navy); }
.field textarea { resize: vertical; min-height: 110px; }
.field + .field { margin-top: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.help { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 15px; font-weight: 600; padding: 12px 24px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, color .15s; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-primary:disabled { background: var(--input-border); color: var(--muted); cursor: not-allowed; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-dark); color: #fff; }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--input-border); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-sm { font-size: 13.5px; padding: 7px 14px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--red); }

/* ===== Progress ===== */
.progress { margin-top: 22px; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14.5px; font-weight: 600; }
.progress-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0 8px; }
.progress-fill { height: 100%; width: 0; background: var(--navy); border-radius: 999px; transition: width .6s ease; }
.progress-fill.pulse { background: linear-gradient(90deg, var(--navy) 0%, #4A5A68 50%, var(--navy) 100%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.progress-note { font-size: 13px; color: var(--muted); }

/* ===== Banners ===== */
.banner { border-radius: var(--r-md); padding: 14px 16px; display: flex; gap: 12px; margin-bottom: 18px; font-size: 14.5px; }
.banner .badge { width: 22px; height: 22px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.banner-error { background: var(--err-bg); border: 1px solid var(--err-border); color: #7A4A41; }
.banner-error .badge { background: var(--err); }
.banner-error .title { font-weight: 700; color: var(--err); }
.banner-ok { background: var(--ok-bg); border: 1px solid #CFE5D6; color: #24543A; }
.banner-ok .badge { background: var(--ok); }
.banner-ok .title { font-weight: 700; color: var(--ok); }
.banner-info { background: var(--surface-2); border: 1px solid var(--hairline); color: var(--text-2); }
.banner-info .badge { background: var(--navy); }
.privacy-note { font-size: 13px; color: var(--muted); margin-top: 18px; }

/* ===== Findings panel (Defined Terms) ===== */
.fp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.fp-steps .step { display: flex; gap: 12px; margin-bottom: 12px; font-size: 14.5px; color: var(--text-2); }
.fp-steps .num { width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; border: 1px solid transparent; }
.pill-pink { background: #FFE9F8; color: #9A1C70; border-color: #F5C2E5; }
.pill-red { background: #FDECEC; color: #8F1F1F; border-color: #F2C8C8; }
.pill-green { background: var(--ok-bg); color: var(--ok); border-color: #CFE5D6; }
.top-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.top-list .row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--hairline); font-size: 14px; align-items: start; }
.top-list .pg { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.top-list .dim { color: var(--muted); }
.fp-full-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
textarea.report { width: 100%; min-height: 260px; font-family: var(--mono); font-size: 12.5px; line-height: 1.45; color: var(--text); background: #FDFCFA; border: 1px solid var(--input-border); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 13.5px; color: var(--text-2); }
.legend .item { display: flex; align-items: center; gap: 8px; }
.legend .swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); flex: none; }
.ignore-link { font-size: 14px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(26,40,51,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: var(--r-lg); max-width: 520px; width: 100%; padding: 24px; box-shadow: var(--shadow-md); }
.modal h2 { margin-bottom: 6px; }
.modal .m-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ===== Tables (admin, jobs) ===== */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--hairline); }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.data tr:hover td { background: #FDFCFA; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.status.succeeded { background: var(--ok-bg); color: var(--ok); }
.status.failed { background: var(--err-bg); color: var(--err); }
.status.running, .status.queued { background: var(--warn-bg); color: #7A5A00; }
.status.active { background: var(--ok-bg); color: var(--ok); }
.status.suspended, .status.disabled { background: var(--err-bg); color: var(--err); }
.table-wrap { overflow-x: auto; }
.cap-boxes { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin-bottom: 22px; }
.admin-nav a { padding: 10px 14px; text-decoration: none; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.admin-nav a.active { color: var(--navy); border-bottom-color: var(--red); font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* ===== Home / login ===== */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-card { display: block; text-decoration: none; color: inherit; }
.tool-card:hover { border-color: var(--navy); color: inherit; }
.tool-card .sq { width: 10px; height: 10px; background: var(--red); display: inline-block; margin-bottom: 14px; }
.tool-card h2 { margin-bottom: 6px; }
.login-wrap { max-width: 440px; margin: 10vh auto; padding: 0 var(--gutter); }
.login-card { text-align: center; padding: 36px 28px; }
.login-card img { height: 36px; margin-bottom: 18px; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--hairline); margin-top: 48px; padding: 20px 0; font-size: 13px; color: var(--muted); }
.site-footer .inner { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; margin-left: 16px; }
.site-footer a:hover { color: var(--navy); }

/* Checkbox labels inside a field keep sentence case */
.field label.check { display: inline-flex; font-size: 14.5px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-2); margin: 0 14px 0 0; }
