/* ============================================================================
   FullView Safety Portal — customer-facing UI
   Rodgers-orange accent · light + dark (data-theme + prefers-color-scheme).
   ========================================================================== */

:root, html[data-theme="light"] {
  --pf-orange:      #F26A1B;
  --pf-orange-600:  #E2590F;
  --pf-orange-700:  #C44D0C;
  --pf-orange-300:  #FBB57E;
  --pf-tint:        #FFF3EA;

  --pf-bg:        #F4F6F8;
  --pf-surface:   #FFFFFF;
  --pf-sunken:    #F7F8FA;
  --pf-text:      #14181E;
  --pf-muted:     #5A6573;
  --pf-faint:     #8B95A4;
  --pf-border:    #E5E8EC;
  --pf-hairline:  #EEF1F4;
  --pf-accent:    var(--pf-orange-700);   /* orange as text/link */
  --pf-cta:       var(--pf-orange);
  --pf-cta-hover: var(--pf-orange-600);
  --pf-row-hover: var(--pf-tint);

  --pf-ok-fg:#067647; --pf-ok-bg:#ECFDF3; --pf-ok-bd:#A6E9C5;
  --pf-warn-fg:#B54708; --pf-warn-bg:#FFFAEB; --pf-warn-bd:#FEDF89;
  --pf-bad-fg:#B42318; --pf-bad-bg:#FEF3F2; --pf-bad-bd:#FECDCA;
  --pf-neu-fg:#475467; --pf-neu-bg:#F2F4F7; --pf-neu-bd:#E1E5EB;

  --pf-radius: 14px;
  --pf-shadow: 0 1px 2px rgba(16,24,40,.04), 0 10px 28px -14px rgba(16,24,40,.16);
  --pf-shadow-lg: 0 28px 60px -22px rgba(16,24,40,.30);
  --pf-ring: 0 0 0 4px rgba(242,106,27,.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --pf-bg:#0D1014; --pf-surface:#161A20; --pf-sunken:#11151B;
    --pf-text:#E7EAEE; --pf-muted:#97A2B0; --pf-faint:#7A8493;
    --pf-border:#262C36; --pf-hairline:#20262F;
    --pf-accent:var(--pf-orange-300); --pf-row-hover:#241608; --pf-tint:#241608;
    --pf-ok-bg:#0B2C18; --pf-ok-bd:#13502E; --pf-ok-fg:#6CE9A6;
    --pf-warn-bg:#2E2406; --pf-warn-bd:#5A4708; --pf-warn-fg:#FEC84B;
    --pf-bad-bg:#2E1212; --pf-bad-bd:#5A2222; --pf-bad-fg:#FDA29B;
    --pf-neu-bg:#1C212A; --pf-neu-bd:#2A313C; --pf-neu-fg:#AEB7C4;
    --pf-shadow: 0 1px 2px rgba(0,0,0,.5), 0 12px 30px -16px rgba(0,0,0,.7);
    --pf-shadow-lg: 0 30px 64px -22px rgba(0,0,0,.8);
  }
}
html[data-theme="dark"] {
  --pf-bg:#0D1014; --pf-surface:#161A20; --pf-sunken:#11151B;
  --pf-text:#E7EAEE; --pf-muted:#97A2B0; --pf-faint:#7A8493;
  --pf-border:#262C36; --pf-hairline:#20262F;
  --pf-accent:var(--pf-orange-300); --pf-row-hover:#241608; --pf-tint:#241608;
  --pf-ok-bg:#0B2C18; --pf-ok-bd:#13502E; --pf-ok-fg:#6CE9A6;
  --pf-warn-bg:#2E2406; --pf-warn-bd:#5A4708; --pf-warn-fg:#FEC84B;
  --pf-bad-bg:#2E1212; --pf-bad-bd:#5A2222; --pf-bad-fg:#FDA29B;
  --pf-neu-bg:#1C212A; --pf-neu-bd:#2A313C; --pf-neu-fg:#AEB7C4;
  --pf-shadow: 0 1px 2px rgba(0,0,0,.5), 0 12px 30px -16px rgba(0,0,0,.7);
  --pf-shadow-lg: 0 30px 64px -22px rgba(0,0,0,.8);
}

* { box-sizing: border-box; }
/* No horizontal scroll, page-wide. `clip` (not `hidden`) so the sticky topbar
   keeps working — `hidden` would turn the body into a scroll container. */
html, body { margin: 0; overflow-x: clip; max-width: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--pf-bg); color: var(--pf-text);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--pf-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin: 2px 0 0; }
h2 { font-size: 15px; font-weight: 700; margin: 0; }
.pf-muted { color: var(--pf-muted); }
.pf-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---- Top bar ---- */
.pf-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px; min-height: 64px;
  background: color-mix(in srgb, var(--pf-surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(8px); backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--pf-border);
  box-shadow: 0 1px 0 rgba(242,106,27,.35);
}
.pf-brand { display: inline-flex; align-items: center; gap: 12px; }
.pf-brand:hover { text-decoration: none; }
.pf-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(140deg,#FF9A4D 0%,#F26A1B 55%,#D8470A 100%);
  box-shadow: 0 6px 16px -4px rgba(242,106,27,.6), inset 0 1px 0 rgba(255,255,255,.35);
  position: relative;
}
.pf-mark::before { content:""; position:absolute; left:9px; top:13px; width:18px; height:10px; border-radius:10px; background:rgba(255,255,255,.95); }
.pf-mark::after { content:""; position:absolute; left:15px; top:15px; width:6px; height:6px; border-radius:50%; background:#D8470A; }
.pf-brandtext { display: flex; flex-direction: column; line-height: 1.05; }
.pf-word { font-size: 18px; font-weight: 800; letter-spacing: -.3px; color: var(--pf-text); }
.pf-acc { color: var(--pf-orange); }
.pf-sub { font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--pf-faint); margin-top: 2px; }

.pf-top-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.pf-org {
  font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px;
  background: var(--pf-tint); color: var(--pf-accent);
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pf-acct-email { color: var(--pf-muted); font-size: 13px; }
.pf-logout {
  font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 9px;
  border: 1px solid var(--pf-border); color: var(--pf-text);
}
.pf-logout:hover { background: var(--pf-row-hover); border-color: var(--pf-accent); color: var(--pf-accent); text-decoration: none; }

.pf-theme-toggle {
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--pf-border); background: var(--pf-surface); color: var(--pf-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.pf-theme-toggle:hover { background: var(--pf-row-hover); color: var(--pf-accent); border-color: var(--pf-accent); }
.pf-theme-toggle svg { width: 18px; height: 18px; }
.pf-i-sun { display: none; } .pf-i-moon { display: block; }
html[data-theme="dark"] .pf-i-sun { display: block; } html[data-theme="dark"] .pf-i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .pf-i-sun { display: block; }
  html:not([data-theme="light"]) .pf-i-moon { display: none; }
}

/* ---- Layout ---- */
.pf-main { min-height: calc(100vh - 64px); }
.pf-container { max-width: 1160px; margin: 0 auto; padding: 30px 28px 64px; }
.pf-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.pf-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pf-accent); }
.pf-back { display: inline-block; margin-bottom: 16px; font-weight: 600; color: var(--pf-muted); }
.pf-back:hover { color: var(--pf-accent); text-decoration: none; }
.pf-head-badges { display: flex; gap: 8px; }

/* ---- Stat cards ---- */
.pf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.pf-stat {
  background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: var(--pf-radius);
  box-shadow: var(--pf-shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
}
.pf-stat-n { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.pf-stat-l { font-size: 12px; font-weight: 600; color: var(--pf-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---- Table ---- */
.pf-table-card { background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: var(--pf-radius); box-shadow: var(--pf-shadow); overflow: hidden; }
.pf-table { width: 100%; border-collapse: collapse; }
.pf-table thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--pf-muted); padding: 14px 16px; background: var(--pf-sunken); border-bottom: 1px solid var(--pf-border);
}
.pf-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--pf-hairline); vertical-align: middle; }
.pf-table tbody tr { cursor: pointer; transition: background .1s ease; }
.pf-table tbody tr:hover { background: var(--pf-row-hover); }
.pf-table tbody tr:last-child td { border-bottom: 0; }
.pf-rowlink { display: flex; flex-direction: column; }
.pf-rowlink strong { color: var(--pf-text); font-weight: 700; }
.pf-rowlink:hover { text-decoration: none; }
/* Secondary line under the bold primary (time under date, slug under site).
   Block so it drops to its own line instead of colliding inline. */
.pf-slug { display: block; margin-top: 3px; font-size: 12px; font-weight: 500;
           color: var(--pf-faint); line-height: 1.25; }
/* The bold primary in stacked cells (date / site name) sits on its own line. */
.pf-table tbody td > strong { display: block; line-height: 1.3; }
.pf-evidence { display: flex; gap: 6px; }
.pf-row-cta { text-align: right; }

/* ---- Pills + tags ---- */
.pf-pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid; }
.pf-pill-lg { font-size: 13px; padding: 6px 13px; }
.pf-pill-ok { color: var(--pf-ok-fg); background: var(--pf-ok-bg); border-color: var(--pf-ok-bd); }
.pf-pill-warn { color: var(--pf-warn-fg); background: var(--pf-warn-bg); border-color: var(--pf-warn-bd); }
.pf-pill-bad { color: var(--pf-bad-fg); background: var(--pf-bad-bg); border-color: var(--pf-bad-bd); }
.pf-pill-neutral { color: var(--pf-neu-fg); background: var(--pf-neu-bg); border-color: var(--pf-neu-bd); }
.pf-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 7px; background: var(--pf-tint); color: var(--pf-accent); }

/* ---- Buttons ---- */
.pf-btn-primary, .pf-btn-ghost, .pf-btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; border-radius: 10px; cursor: pointer; transition: all .14s ease; text-decoration: none;
}
.pf-btn-primary { background: var(--pf-cta); color: #fff; padding: 9px 16px; border: 0; box-shadow: 0 1px 2px rgba(16,24,40,.1); }
.pf-btn-primary:hover { background: var(--pf-cta-hover); transform: translateY(-1px); text-decoration: none; color: #fff; }
.pf-btn-ghost { background: var(--pf-surface); color: var(--pf-text); padding: 9px 16px; border: 1px solid var(--pf-border); }
.pf-btn-ghost:hover { background: var(--pf-row-hover); border-color: var(--pf-accent); color: var(--pf-accent); text-decoration: none; }
.pf-btn-sm { font-size: 13px; font-weight: 700; color: var(--pf-accent); padding: 4px 0; }
.pf-btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* ---- Record detail grid ---- */
.pf-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 20px; align-items: start; }
.pf-card { background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: var(--pf-radius); box-shadow: var(--pf-shadow); margin-bottom: 20px; overflow: hidden; }
.pf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--pf-hairline); }
.pf-card-actions { display: flex; gap: 8px; }
.pf-dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; padding: 16px 18px; }
.pf-dl dt { color: var(--pf-muted); font-size: 12.5px; font-weight: 600; }
.pf-dl dd { margin: 0; font-size: 13.5px; font-weight: 600; text-align: right; }

/* ---- PDF embed ---- */
.fv-pdf-embed { padding: 0; }
.fv-pdf-stage { max-height: 820px; overflow: auto; padding: 16px; background: var(--pf-sunken); }
.pf-loading { text-align: center; color: var(--pf-muted); padding: 40px 16px; }

/* ---- Audio ---- */
.pf-audio { width: 100%; margin: 16px 18px 6px; max-width: calc(100% - 36px); }
.pf-audio-note { padding: 0 18px 16px; font-size: 12.5px; }

/* ---- Timeline ---- */
.pf-timeline { list-style: none; margin: 0; padding: 8px 18px 16px; }
.pf-timeline li { padding: 12px 0; border-bottom: 1px solid var(--pf-hairline); }
.pf-timeline li:last-child { border-bottom: 0; }
.pf-tl-main { display: flex; justify-content: space-between; gap: 10px; }
.pf-tl-title { font-weight: 700; }
.pf-tl-date { font-size: 12px; color: var(--pf-faint); white-space: nowrap; }
.pf-tl-meta { font-size: 12.5px; color: var(--pf-muted); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Empty / alert ---- */
.pf-empty { padding: 28px 18px; color: var(--pf-muted); text-align: center; }
.pf-empty-lg { background: var(--pf-surface); border: 1px dashed var(--pf-border); border-radius: var(--pf-radius); padding: 48px 24px; display: flex; flex-direction: column; gap: 6px; }
.pf-empty-lg strong { font-size: 16px; color: var(--pf-text); }
.pf-alert { background: var(--pf-bad-bg); color: var(--pf-bad-fg); border: 1px solid var(--pf-bad-bd); border-radius: 10px; padding: 11px 14px; font-weight: 600; font-size: 13.5px; margin-bottom: 16px; }

/* ---- Login ---- */
body.pf-login {
  background:
    radial-gradient(900px 480px at 88% -8%, rgba(242,106,27,.20), transparent 60%),
    radial-gradient(700px 480px at -6% 108%, rgba(242,106,27,.12), transparent 55%),
    var(--pf-bg);
}
.pf-login-wrap { display: flex; align-items: center; justify-content: center; padding: 64px 20px; min-height: calc(100vh - 64px); }
.pf-login-card { width: 420px; max-width: 100%; background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: 20px; box-shadow: var(--pf-shadow-lg); padding: 36px 34px 28px; }
.pf-login-mark { display: block; width: 52px; height: 52px; border-radius: 15px; margin-bottom: 18px; background: linear-gradient(140deg,#FF9A4D 0%,#F26A1B 55%,#D8470A 100%); box-shadow: 0 10px 24px -8px rgba(242,106,27,.6); position: relative; }
.pf-login-mark::before { content:""; position:absolute; left:14px; top:20px; width:24px; height:13px; border-radius:12px; background:rgba(255,255,255,.95); }
.pf-login-mark::after { content:""; position:absolute; left:22px; top:23px; width:8px; height:8px; border-radius:50%; background:#D8470A; }
.pf-login-card h1 { font-size: 22px; margin-bottom: 6px; }
.pf-login-lede { margin: 0 0 20px; font-size: 13.5px; }
.pf-form { display: flex; flex-direction: column; gap: 14px; }
.pf-field { display: flex; flex-direction: column; gap: 6px; }
.pf-label { font-size: 12.5px; font-weight: 600; color: var(--pf-muted); }
.pf-field input {
  font: inherit; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--pf-border);
  background: var(--pf-surface); color: var(--pf-text); transition: border-color .12s, box-shadow .12s;
}
.pf-field input:focus { outline: none; border-color: var(--pf-orange); box-shadow: var(--pf-ring); }
.pf-login-foot { margin: 18px 0 0; text-align: center; font-size: 12.5px; color: var(--pf-faint); }

/* ---- Responsive ---- */
@media (max-width: 920px) {
  .pf-grid { grid-template-columns: 1fr; }
  .pf-stats { grid-template-columns: repeat(2, 1fr); }
  .pf-acct-email { display: none; }
}
@media (max-width: 560px) {
  .pf-container { padding: 22px 16px 48px; }
  .pf-top { padding: 0 16px; }
  .pf-org { max-width: 130px; }
  .pf-sub { display: none; }
}

/* ---- Site filter chips ---- */
.pf-filterbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pf-chip {
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--pf-border); background: var(--pf-surface); color: var(--pf-muted);
}
.pf-chip:hover { border-color: var(--pf-accent); color: var(--pf-accent); background: var(--pf-row-hover); text-decoration: none; }
.pf-chip-on { background: var(--pf-cta); border-color: var(--pf-cta); color: #fff; }
.pf-chip-on:hover { background: var(--pf-cta-hover); color: #fff; }

/* Long content never forces the table wider than its container. */
.pf-table td { overflow-wrap: anywhere; }

/* ---- Records: stacked cards on narrow screens (no horizontal scroll) ----
   Below 900px a 6-column table can't fit, so each row becomes a clean,
   tappable card: date · time, site · slug, the record title, then the
   certified + evidence badges. The whole card links through (tr onclick). */
@media (max-width: 900px) {
  .pf-table thead { display: none; }
  .pf-table, .pf-table tbody, .pf-table tr, .pf-table td { display: block; width: auto; }
  .pf-table tr { padding: 15px 16px; border-bottom: 1px solid var(--pf-hairline); }
  .pf-table tbody tr:last-child { border-bottom: 0; }
  .pf-table td { padding: 0; border: 0; line-height: 1.45; }
  .pf-row-cta { display: none; }                       /* whole card is tappable */

  /* Date + site collapse to single compact lines (primary · secondary). */
  .pf-table tbody td > strong { display: inline; }
  .pf-table td .pf-slug { display: inline; margin: 0; font-weight: 500; }
  .pf-table td .pf-slug::before { content: " · "; color: var(--pf-faint); }

  .pf-table td:nth-child(1) { font-size: 14px; font-weight: 700; }   /* date line */
  .pf-table td:nth-child(2) { margin-top: 3px; }                     /* site line */
  .pf-table td:nth-child(3) { margin-top: 4px; color: var(--pf-muted); font-size: 13px; } /* title */
  .pf-table td:nth-child(4),
  .pf-table td.pf-evidence { display: inline-block; vertical-align: middle; margin: 10px 8px 0 0; }
  /* hide the bare "—" placeholders so the badge row stays clean */
  .pf-table td:nth-child(4) > .pf-muted,
  .pf-table td.pf-evidence > .pf-muted { display: none; }
}
