/* ════════════════════════════════════════════════════════════ */
/* VisaFlow — Base Styles                                         */
/* VooVa brand: Blue #1c55a6, Gray #a2a2a2, Light Blue #d4ecfa    */
/* Headings: Archivo Black · Body: Roboto                         */
/* Status colours: green=done, amber=waiting, red=at-risk, grey=not started */
/* ════════════════════════════════════════════════════════════ */

:root {
    --voova-blue:       #1c55a6;
    --voova-blue-dark:  #16447f;
    --voova-gray:       #a2a2a2;
    --voova-light-blue: #d4ecfa;

    --status-green: #2e9e5b;
    --status-amber: #e0a008;
    --status-red:   #cf3a4b;
    --status-grey:  #a2a2a2;

    --ink:    #1f2733;
    --muted:  #5d6b7a;
    --bg:     #f5f8fc;
    --card:   #ffffff;
    --border: #dbe4ef;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
}

h1, h2, h3, .display {
    font-family: 'Archivo Black', system-ui, sans-serif;
    font-weight: 400;
    color: var(--voova-blue);
    line-height: 1.2;
}

a { color: var(--voova-blue); }

.container { max-width: 1080px; margin: 0 auto; padding: 24px; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 14px; }

/* ── Top app bar (internal) ── */
.appbar {
    background: var(--voova-blue);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.appbar .brand { font-family: 'Archivo Black', sans-serif; font-size: 20px; color: #fff; }
.appbar a { color: #fff; text-decoration: none; }

/* ── Cards ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 2px rgba(28, 85, 166, 0.05);
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    cursor: pointer;
    font: 500 15px 'Roboto', sans-serif;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s ease;
}
.btn-primary { background: var(--voova-blue); color: #fff; }
.btn-primary:hover { background: var(--voova-blue-dark); }
.btn-light { background: var(--voova-light-blue); color: var(--voova-blue); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-block { display: block; width: 100%; }

/* ── Status pills ── */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-green { background: rgba(46, 158, 91, 0.14);  color: var(--status-green); }
.pill-amber { background: rgba(224, 160, 8, 0.16);  color: #9a6c00; }
.pill-red   { background: rgba(207, 58, 75, 0.14);  color: var(--status-red); }
.pill-grey  { background: rgba(162, 162, 162, 0.18); color: #6b6b6b; }

/* ── Centred card (landing, login, errors) ── */
.centerwrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.centerwrap .card { width: 100%; max-width: 440px; text-align: center; }

/* ── Forms ── */
label { display: block; font-weight: 500; font-size: 14px; }
input[type=text], input[type=email], input[type=date], input[type=password], input[type=tel],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: 15px 'Roboto', sans-serif;
    background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--voova-light-blue); border-color: var(--voova-blue); }

/* ── Tables ── */
table th { font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px; }
table td { padding: 8px; vertical-align: top; }

/* ── Candidate portal (mobile-first) ── */
.portal-bar {
    background: var(--voova-blue);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.portal-bar .brand { font-family: 'Archivo Black', sans-serif; font-size: 18px; color: #fff; }
.portal-bar form { margin: 0; }
.portal-main { max-width: 560px; margin: 0 auto; padding: 18px; }
.portal-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}
.consent-body {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    background: #fbfdff;
}
/* Comfortable touch targets on phones */
.portal-card .btn { padding: 13px 18px; font-size: 16px; }
.portal-card input[type=file] { font-size: 15px; }

/* ════════════════════════════════════════════════════════════ */
/* Dashboard KPI strip — HR / Exec "onboarding insights"          */
/* Dependency-free: pure CSS, no charting library (CSP stays tight)*/
/* ════════════════════════════════════════════════════════════ */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}
.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(28, 85, 166, 0.05);
}
.kpi-span-3  { grid-column: span 3; }
.kpi-span-6  { grid-column: span 6; }
.kpi-span-12 { grid-column: span 12; }
/* Reflow the strip on smaller screens */
@media (max-width: 820px) {
    .kpi-span-3 { grid-column: span 6; }
    .kpi-span-6 { grid-column: span 12; }
}
@media (max-width: 520px) {
    .kpi-span-3 { grid-column: span 12; }
}

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.kpi-label-soft { font-weight: 400; text-transform: none; }
.kpi-num {
    font-family: 'Archivo Black', sans-serif;
    font-size: 34px;
    color: var(--voova-blue);
    line-height: 1.15;
    margin-top: 6px;
}
.kpi-num.is-alert { color: var(--status-red); }
.kpi-unit { font-family: 'Roboto', sans-serif; font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi-sub  { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-empty { font-size: 13px; color: var(--muted); margin-top: 10px; }

/* Time-split stacked bar (candidate / HR / BOI) */
.kpi-splitbar {
    display: flex;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--bg);
    margin: 12px 0 10px;
}
.kpi-splitbar > span { display: block; height: 100%; }
.kpi-seg-candidate { background: var(--voova-blue); }
.kpi-seg-hr        { background: var(--status-amber); }
.kpi-seg-external  { background: var(--voova-gray); }
.kpi-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.kpi-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* Monthly completions trend (vertical bars) */
.kpi-trend { display: flex; align-items: flex-end; gap: 6px; margin-top: 10px; }
.kpi-col   { flex: 1; text-align: center; min-width: 0; }
.kpi-cnt   { font-size: 11px; font-weight: 700; color: var(--ink); height: 14px; line-height: 14px; }
.kpi-barwrap { height: 80px; display: flex; align-items: flex-end; justify-content: center; }
.kpi-bar {
    width: 62%;
    min-height: 2px;
    background: var(--voova-light-blue);
    border-radius: 4px 4px 0 0;
}
.kpi-bar.has-val { background: var(--voova-blue); }
.kpi-mo { font-size: 10px; color: var(--muted); margin-top: 5px; }

/* ════════════════════════════════════════════════════════════ */
/* Document checklist — status tints + upload progress feedback   */
/* Progressive enhancement; JS in public/assets/js/upload-feedback.js */
/* ════════════════════════════════════════════════════════════ */

/* Status tint on a checklist card: a light wash plus a coloured left
   accent. Used on BOTH the HR case page (.doc-card) and the candidate
   portal (.portal-card). The status PILL is always kept too — colour is
   never the only signal (accessibility), and the accent helps if the wash
   is hard to perceive. Two-class selectors win over the base card rule. */
.doc-card.is-approved,
.portal-card.is-approved {
    background-color: rgba(46, 158, 91, 0.09);   /* --status-green, very light */
    box-shadow: inset 3px 0 0 var(--status-green);
}
.doc-card.is-under-review,
.portal-card.is-under-review {
    background-color: rgba(224, 160, 8, 0.11);    /* --status-amber, very light */
    box-shadow: inset 3px 0 0 var(--status-amber);
}
.doc-card.is-rejected,
.portal-card.is-rejected {
    background-color: rgba(207, 58, 75, 0.09);    /* --status-red, very light */
    box-shadow: inset 3px 0 0 var(--status-red);
}

/* The "it's working" indicator. Deliberately INDETERMINATE — a moving
   sweep, never a fake percentage — because the slow part (server → Google
   Drive) is invisible to the browser, so any number would be a lie. Hidden
   in the markup until the JS reveals it on submit; :not([hidden]) keeps the
   native `hidden` attribute working despite the display rule. */
.upload-progress:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-top: 8px;
}
.upload-progress__bar {
    position: relative;
    flex: 1;
    height: 8px;
    min-width: 120px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--voova-light-blue);
}
.upload-progress__bar::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    border-radius: 999px;
    background: var(--voova-blue);
    transform: translateX(-110%);
}
.upload-progress__text {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}
/* Animate only when the user hasn't asked the OS for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
    .upload-progress__bar::after { animation: upload-sweep 1.15s ease-in-out infinite; }
}
@keyframes upload-sweep {
    0%   { transform: translateX(-110%); }
    100% { transform: translateX(360%); }
}
/* Reduced-motion fallback: a calm, static half-fill instead of movement. */
@media (prefers-reduced-motion: reduce) {
    .upload-progress__bar::after {
        inset: 0;
        width: 100%;
        transform: none;
        opacity: 0.5;
        animation: none;
    }
}
/* The submit button while its own upload is in flight (greyed, not clickable). */
.btn.is-busy,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Admin: drag-and-drop reorder (Document types) ── */
/* The move cursor only appears once the JS has enabled dragging. */
table[data-reorder].js-drag tbody tr { cursor: move; }
table[data-reorder] tbody tr.dragging { opacity: 0.45; background: rgba(28, 85, 166, 0.06); }
.reorder-handle { color: #9aa3af; text-align: center; user-select: none; }
table[data-reorder].js-drag .reorder-handle { cursor: grab; }
.btn-arrow {
    background: #fff;
    border: 1px solid var(--border, #d7dbe0);
    border-radius: 6px;
    padding: 2px 9px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}
.btn-arrow:hover { background: rgba(0, 0, 0, 0.04); }

/* ── Card grid (reusable) ──
   A responsive grid of equal-width cards that collapses by screen width:
   4 across on a wide desktop → 3 → 2 → 1 on a phone. Explicit breakpoints
   (not auto-fit) so the column COUNT is exact at each size, matching the
   product spec. minmax(0,1fr) lets long words wrap instead of forcing a
   track wider than its share (which would overflow the row). */
.card-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1000px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .card-grid { grid-template-columns: 1fr; } }

/* ── Hub card (the tile used inside .card-grid) ──
   A flex column so the action button can be pinned to the bottom — that makes
   every button in a row line up even when the descriptions differ in length.
   Scoped to .hub-card (NOT .card-grid .btn) on purpose: the generic grid must
   stay safe for future cards that carry their own multi-button layouts. */
.hub-card { display: flex; flex-direction: column; gap: 10px; }
.hub-card h2 { margin: 0; font-size: 18px; }
.hub-card p  { margin: 0; }
.hub-card .btn { margin-top: auto; align-self: flex-start; }

/* The icon "chip": a soft tinted square holding the line icon. inline-flex +
   fixed size + centred so the 24px SVG sits straight (no baseline wobble). */
.hub-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--voova-light-blue);
    color: var(--voova-blue);
    flex: 0 0 auto;
}
.hub-card-icon-svg { display: block; }

/* Keyboard focus ring for buttons/links styled as buttons. There was no visible
   focus state before; a card hub is tabbed through heavily, so make the focused
   control obvious. :focus-visible shows it for keyboard users without drawing a
   ring on mouse clicks. (Applies app-wide — a small accessibility win.) */
.btn:focus-visible {
    outline: 2px solid var(--voova-blue);
    outline-offset: 2px;
}

/* On a phone the cards are full width, so make their buttons full width too:
   easier to tap and stops a longer (e.g. Thai) label wrapping awkwardly. */
@media (max-width: 480px) {
    .card-grid .hub-card { padding: 18px; }
    .hub-card .btn { align-self: stretch; width: 100%; }
}
