/* =============================================================
   AlopeciaDB — screening pages (vsw_7250)
   Extends the global design system in style.css. No new fonts,
   no new colour hues: status colours reuse --danger / --success
   and two amber/slate tones derived from the same palette.
   ============================================================= */

:root {
    --stat-usable:     #16a34a;
    --stat-usable-bg:  #e7f6ec;
    --stat-geom:       #b45309;
    --stat-geom-bg:    #fdf1e0;
    --stat-site:       #be123c;
    --stat-site-bg:    #fdeaef;
    --stat-class:      #4f46e5;
    --stat-class-bg:   #ecebfb;
    --flagged:         #8a4b12;
    --flagged-bg:      #fdf0e3;
}

/* ---------- page shell ---------- */
.scr-wrap { max-width: 1240px; margin: 0 auto; padding: 28px 5% 72px; }
.scr-wrap .page-header { margin-bottom: 20px; }
.scr-wrap h1 { font-size: 1.75rem; color: var(--primary-darker); margin-bottom: 6px; }
.scr-wrap .page-subtitle { color: var(--text-muted); max-width: 72ch; font-size: .95rem; }
.scr-wrap h2 { font-size: 1.12rem; color: var(--primary-dark); margin: 0 0 12px; }
.scr-wrap a { color: var(--primary); }

.scr-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

/* ---------- the caveat banner: must not be missable ---------- */
.scr-caveat {
    border-left: 4px solid var(--stat-site);
    background: var(--stat-site-bg);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 18px;
}
.scr-caveat h3 { font-size: .98rem; margin: 0 0 6px; color: #7f1030; font-family: var(--font-heading); }
.scr-caveat p  { margin: 0 0 6px; font-size: .9rem; color: #5c0c23; }
.scr-caveat p:last-child { margin-bottom: 0; }

/* ---------- stat strip ---------- */
.scr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.scr-stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 14px;
}
.scr-stat .n { font-size: 1.45rem; font-weight: 700; font-family: var(--font-heading); color: var(--primary-dark); line-height: 1.2; }
.scr-stat .l { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.scr-stat.is-flagged .n { color: var(--flagged); }

/* ---------- status badges ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.5;
}
.badge-usable { background: var(--stat-usable-bg); color: var(--stat-usable); }
.badge-geom   { background: var(--stat-geom-bg);   color: var(--stat-geom); }
.badge-site   { background: var(--stat-site-bg);   color: var(--stat-site); }
.badge-class  { background: var(--stat-class-bg);  color: var(--stat-class); }
.badge-muted  { background: #eef2f7; color: var(--text-muted); }
.badge-flag   { background: var(--flagged-bg); color: var(--flagged); }
.badge-nonhuman { background: #fff4e5; color: #92400e; }

/* ---------- tables ---------- */
.scr-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.scr-table th {
    text-align: left; padding: 9px 10px; border-bottom: 2px solid var(--border);
    color: var(--primary-dark); font-weight: 600; font-family: var(--font-heading);
    font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.scr-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.scr-table tbody tr:hover { background: var(--primary-light); }
.scr-table tr.is-flagged { background: #fffaf4; }
.scr-table tr.is-flagged:hover { background: #fdf2e4; }
.scr-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* scientific names are italic wherever they appear, not only inside tables */
.sci { font-style: italic; }
.scr-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- key/value ---------- */
.kv { width: 100%; border-collapse: collapse; font-size: .9rem; }
.kv th { text-align: left; width: 230px; padding: 7px 12px 7px 0; vertical-align: top; color: var(--text-muted); font-weight: 600; }
.kv td { padding: 7px 0; vertical-align: top; word-break: break-word; }

/* ---------- filters ---------- */
.scr-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.scr-filters .fl-label { font-size: .8rem; color: var(--text-muted); margin-right: 2px; }
.fl-chip {
    display: inline-block; padding: 6px 13px; border-radius: 999px; font-size: .8rem;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    text-decoration: none; cursor: pointer; transition: var(--transition);
}
.fl-chip:hover { border-color: var(--primary); color: var(--primary); }
.fl-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- misc ---------- */
code.mono { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: .84rem; word-break: break-all; }
.muted { color: var(--text-muted); }
.small { font-size: .82rem; }
.note-inline { font-size: .82rem; color: var(--flagged); display: block; margin-top: 3px; }
.scr-empty { padding: 28px; text-align: center; color: var(--text-muted); }
.back-link { display: inline-block; margin-bottom: 14px; font-size: .88rem; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--text-muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 640px) {
    .scr-wrap { padding: 20px 16px 56px; }
    .kv th { width: auto; display: block; padding-bottom: 0; }
    .kv td { display: block; padding-top: 2px; padding-bottom: 10px; }
}

/* ---------- column sizing -----------------------------------------------
   Two fixes found by looking at the rendered pages rather than the markup:
   long caveat notes were squeezing the target column into a narrow ribbon,
   and a long artefact-class badge overflowed the last column because badges
   are nowrap by default. Badges inside a table cell may wrap; elsewhere
   (status column, inline chips) they stay on one line. */
.scr-table td:nth-child(2) { min-width: 230px; }
.scr-table .badge-flag { white-space: normal; display: inline-block; max-width: 100%; }
.scr-table td:last-child { max-width: 360px; }
.scr-table .note-inline { max-width: 340px; }
