/* ═══════════════════════════════════════════════════════════════════════════
   CertLogIQ — UI System
   ───────────────────────────────────────────────────────────────────────────
   One palette, one radius scale, one type scale. Every colour in the app
   should resolve to a token in this file. If a screen needs a colour that
   isn't here, the answer is almost always that it should reuse one that is.

   DESIGN THESIS
   This is a compliance instrument, not a consumer app. A technician reads it
   one-handed, in a corridor, often in gloves, often in bad light, and the
   thing they need to know in under a second is: is this asset compliant.

   Therefore RED IS A SIGNAL, NOT A DECORATION. Today red is the brand colour,
   the header colour, the button colour AND the fail colour — so it carries no
   information. Here it is reserved for exactly three things: a failed test,
   an overdue compliance date, and the single primary action on a screen.
   Everything else is graphite and paper. Restraint is what reads as "built by
   a developer who knew what they were doing".
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tokens live in fireassistiq-tokens.css, which must load BEFORE this file
   on index.html. Every var() below resolves from there — shared with the
   admin dashboard, so the two apps can no longer drift apart. */

/* ═══ Base ═══════════════════════════════════════════════════════════════ */

.fa-screen {
    font-family: var(--fa-font);
    color: var(--fa-ink);
    background: var(--fa-paper-sunk);
    -webkit-font-smoothing: antialiased;
}

/* ═══ Native app chrome ══════════════════════════════════════════════════
   A large title that collapses on scroll is what makes a PWA stop feeling
   like a website in a phone frame. Pair with position:sticky on .fa-navbar. */

.fa-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--fa-chrome);
    color: #fff;
    padding: calc(var(--fa-3) + env(safe-area-inset-top)) var(--fa-4) var(--fa-3);
    display: flex;
    align-items: center;
    gap: var(--fa-3);
}

.fa-navbar__title {
    font-size: var(--fa-t-lead);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.fa-navbar__action {
    margin-left: auto;
    font-size: var(--fa-t-body);
    font-weight: 500;
    color: #fff;
    background: none;
    border: 0;
    padding: var(--fa-2);
    cursor: pointer;
}

/* Large title block sitting under the navbar, iOS-style. */
.fa-largetitle {
    background: var(--fa-chrome);
    color: #fff;
    padding: 0 var(--fa-4) var(--fa-5);
}

.fa-largetitle h1 {
    font-size: var(--fa-t-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.fa-largetitle p {
    font-size: var(--fa-t-meta);
    color: #8B95A1;
    margin: var(--fa-1) 0 0;
}

/* ═══ Section eyebrow ════════════════════════════════════════════════════
   Replaces the "big bold heading with an icon" pattern. Quieter, and it
   groups the list below it the way a log book groups entries. */

.fa-eyebrow {
    font-size: var(--fa-t-micro);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fa-ink-3);
    padding: var(--fa-5) var(--fa-4) var(--fa-2);
}

/* ═══ SIGNATURE ELEMENT: the status spine ════════════════════════════════
   A 3px bar on the leading edge of every asset and job row, colour-coded to
   compliance state. Borrowed from the margin rules of a paper log book and
   the colour bands on an asset tag.

   Why this and not a badge or a coloured card: it is readable in peripheral
   vision while scrolling fast, it costs no horizontal space on a phone, and
   because it's the only place colour appears in a list, a single red spine
   in a screen of green ones is impossible to miss. It's also the one thing
   in the app that will be recognisably ours in a screenshot.  */

.fa-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--fa-3);
    background: var(--fa-paper);
    padding: var(--fa-3) var(--fa-4) var(--fa-3) calc(var(--fa-4) + 3px);
    border-bottom: 1px solid var(--fa-hairline);
    min-height: 60px;              /* comfortable glove-sized tap target */
    cursor: pointer;
}

.fa-row:active { background: var(--fa-paper-sunk); }
.fa-row:last-child { border-bottom: 0; }

.fa-row::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--spine, transparent);
}

.fa-row--pass    { --spine: var(--fa-pass); }
.fa-row--fail    { --spine: var(--fa-fail); }
.fa-row--due     { --spine: var(--fa-due); }
.fa-row--info    { --spine: var(--fa-info); }
.fa-row--untested{ --spine: var(--fa-hairline); }

.fa-row__body { flex: 1; min-width: 0; }

.fa-row__title {
    font-size: var(--fa-t-lead);
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fa-row__meta {
    font-size: var(--fa-t-meta);
    color: var(--fa-ink-2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Asset refs, job numbers, dates — always the data face, always tabular. */
.fa-data {
    font-family: var(--fa-font-data);
    font-variant-numeric: tabular-nums;
    font-size: var(--fa-t-meta);
    letter-spacing: -0.02em;
    color: var(--fa-ink-2);
}

/* Disclosure chevron. Pure CSS — no icon font needed for the commonest
   glyph in the entire app. */
.fa-chevron {
    flex: none;
    width: 7px; height: 7px;
    border-right: 2px solid var(--fa-ink-3);
    border-bottom: 2px solid var(--fa-ink-3);
    transform: rotate(-45deg);
    opacity: 0.7;
}

/* ═══ Status text ════════════════════════════════════════════════════════
   Result states are set in colour + weight, not in a filled pastel box.
   The filled-pastel-box look is the single strongest "template" signal in
   the current build. */

.fa-status {
    font-size: var(--fa-t-micro);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex: none;
}
.fa-status--pass { color: var(--fa-pass); }
.fa-status--fail { color: var(--fa-fail); }
.fa-status--due  { color: var(--fa-due); }
.fa-status--none { color: var(--fa-ink-3); }

/* ═══ Result selector (pass / fail / n/a) ════════════════════════════════
   A segmented control, not three chunky coloured buttons. Only the chosen
   segment takes colour, so an untouched asset never looks like a result. */

.fa-segment {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    background: var(--fa-hairline);
    border: 1px solid var(--fa-hairline);
    border-radius: var(--fa-r-sm);
    padding: 2px;
}

.fa-segment button {
    font-family: inherit;
    font-size: var(--fa-t-body);
    font-weight: 600;
    padding: var(--fa-3) var(--fa-2);
    border: 0;
    border-radius: 4px;
    background: var(--fa-paper);
    color: var(--fa-ink-2);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.fa-segment button[aria-pressed="true"] { color: #fff; }
.fa-segment button[data-r="pass"][aria-pressed="true"] { background: var(--fa-pass); }
.fa-segment button[data-r="fail"][aria-pressed="true"] { background: var(--fa-fail); }
.fa-segment button[data-r="na"][aria-pressed="true"]   { background: var(--fa-ink-2); }

/* ═══ Buttons ════════════════════════════════════════════════════════════
   Flat. No gradients — a gradient on a button is a 2014 tell and there are
   33 of them in the app today. One primary action per screen. */

.fa-btn {
    font-family: inherit;
    font-size: var(--fa-t-body);
    font-weight: 600;
    padding: var(--fa-3) var(--fa-5);
    border-radius: var(--fa-r-md);
    border: 1px solid transparent;
    min-height: 48px;
    cursor: pointer;
}
.fa-btn--primary   { background: var(--fa-fail); color: #fff; }
.fa-btn--secondary { background: var(--fa-paper); color: var(--fa-ink); border-color: var(--fa-hairline); }
.fa-btn--ghost     { background: transparent; color: var(--fa-ink-2); }
.fa-btn:active     { transform: scale(0.985); }

/* ═══ Tab bar ════════════════════════════════════════════════════════════ */

.fa-tabbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: var(--fa-chrome);
    border-top: 1px solid var(--fa-chrome-line);
    padding-bottom: env(safe-area-inset-bottom);
}

.fa-tabbar button {
    background: none;
    border: 0;
    padding: var(--fa-3) 0 var(--fa-2);
    color: #6B7684;
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
}
.fa-tabbar button[aria-current="page"] { color: #fff; }

/* ═══ Empty state ════════════════════════════════════════════════════════
   An empty screen is an instruction, not a shrug. */

.fa-empty {
    text-align: center;
    padding: var(--fa-10) var(--fa-6);
    color: var(--fa-ink-2);
}
.fa-empty h3 { font-size: var(--fa-t-lead); font-weight: 600; color: var(--fa-ink); margin: 0 0 var(--fa-2); }
.fa-empty p  { font-size: var(--fa-t-body); margin: 0 0 var(--fa-5); }

/* ═══ Quality floor ══════════════════════════════════════════════════════ */

.fa-screen :focus-visible {
    outline: 2px solid var(--fa-info);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .fa-screen *, .fa-screen *::before, .fa-screen *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
