/* MGP Contractor Portal — B2B, desktop-first, light-only. Calibrated to MGP.Admin.Portal/DESIGN.md:
   Technicolor Blue #021EFF (primary), Almost Black #2D2D2D (text/nav), Relaxy Tealy #00B794 (success
   only), Illuminated Grey #E8E8E8 (cards/dividers), muted red #D64545 (error), amber #F2A93B (warning
   band). Outfit for headings, Nunito Sans for body. 8px spacing base. */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;600;700&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
    --blue: #021EFF;
    --blue-dark: #0014BF;
    --ink: #2D2D2D;
    --tealy: #00B794;
    --grey: #E8E8E8;
    --red: #D64545;
    --amber: #F2A93B;
    --muted: #6b6b6b;
    --line: #e2e2e2;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Nunito Sans', system-ui, sans-serif;
    color: var(--ink);
    background: #fff;
    line-height: 1.5;
}

h1, h2, h3 { font-family: 'Outfit', sans-serif; font-weight: 700; margin: 0 0 8px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.appbar {
    display: flex; align-items: center; gap: 24px;
    padding: 0 24px; height: 60px;
    background: var(--ink); color: #fff;
    position: sticky; top: 0; z-index: 10;
}
.logo { display: inline-flex; align-items: center; }
.logo img { height: 34px; width: auto; display: block; }
.appbar__nav { display: flex; gap: 4px; margin-left: 8px; }
.appbar__nav a {
    color: #cfcfcf; padding: 8px 12px; border-radius: var(--radius-md); font-weight: 600; font-size: .92rem;
}
.appbar__nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.appbar__nav a.active { color: #fff; background: rgba(255,255,255,.12); }
.appbar__spacer { flex: 1; }
.appbar__user { color: #cfcfcf; font-size: .9rem; }

.page { max-width: 1120px; margin: 0 auto; padding: 32px 24px; }
.page__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page__head p { color: var(--muted); margin: 4px 0 0; }

/* ── Auth ──────────────────────────────────────────────────────────────── */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
/* Brand logo anchored top-left; the value block sits centred below it; a footer anchors the base — the
   panel reads as intentional at any size. A faint, whitened logo-mark motif gives the solid blue depth
   without a gradient (DESIGN.md: color-block over gradients; the repeated logo-mark surface pattern is
   the brand-sanctioned texture for a login background). */
.auth-hero {
    position: relative; overflow: hidden;
    background: var(--blue); color: #fff; padding: 56px 64px; display: flex; flex-direction: column;
}
.auth-hero::before {
    content: ""; position: absolute; inset: -20%;
    background: url('../img/MGP-Logo-white.png') repeat; background-size: 132px;
    filter: brightness(0) invert(1);            /* recolour the blue brand mark to white */
    opacity: .06; transform: rotate(-8deg); pointer-events: none;
}
.auth-hero > * { position: relative; z-index: 1; }   /* content sits above the motif */
.auth-hero__logo img { height: 60px; width: auto; display: block; }
.auth-hero__body { margin: auto 0; max-width: 34ch; }
.auth-hero h2 { font-size: 2.6rem; line-height: 1.1; color: #fff; margin: 0 0 16px; }
.auth-hero p { opacity: .85; line-height: 1.6; margin: 0; }
.auth-hero__points { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.auth-hero__points li { position: relative; padding-left: 30px; line-height: 1.4; font-weight: 600; }
.auth-hero__points li::before {
    content: "✓"; position: absolute; left: 0; top: -1px;
    width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.18);
    display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700;
}
.auth-hero__foot { margin-top: 32px; font-size: .82rem; opacity: .6; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-main__brand { display: none; margin-bottom: 28px; }   /* shown only when the hero is hidden (mobile) */
.auth-main__brand img { height: 46px; width: auto; display: block; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card__title { margin-bottom: 4px; }
.auth-card__sub { color: var(--muted); margin: 0 0 24px; }
.auth-card__foot { margin-top: 20px; color: var(--muted); font-size: .92rem; }

/* ── Cards / grid ──────────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; background: #fff; }
.card h3 { margin-bottom: 4px; }
.card__muted { color: var(--muted); font-size: .9rem; }

/* Checklist */
.checklist { display: grid; gap: 12px; }
.check { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.check__dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: 0 0 auto; }
.check--done .check__dot { background: var(--tealy); border-color: var(--tealy); }
.check__body { flex: 1; }
.check__body strong { font-family: 'Outfit', sans-serif; }
.check__body span { display: block; color: var(--muted); font-size: .9rem; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field__label { font-weight: 600; font-size: .9rem; }
.field__hint { color: var(--muted); font-size: .8rem; }
.field__input, select.field__input {
    height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-md);
    font: inherit; color: var(--ink); background: #fff;
}
.field__input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
textarea.field__input { height: auto; padding: 10px 12px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 18px; border-radius: var(--radius-md); border: 1px solid transparent;
    font: inherit; font-weight: 700; cursor: pointer; min-width: 44px;
}
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); text-decoration: none; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { background: var(--grey); text-decoration: none; }
.btn--block { width: 100%; }
.btn--sm { height: 32px; padding: 0 12px; font-size: .88rem; }

/* Busy state (site.js) — spinner + disabled while a form submits, so slow actions give feedback and can't
   be double-clicked. currentColor keeps the spinner legible on primary (white) and ghost (ink) buttons. */
.btn-spinner {
    display: inline-block; width: 14px; height: 14px; margin-inline-end: 8px; vertical-align: -2px;
    border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
    animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn.is-busy, button.is-busy { cursor: progress; opacity: .9; }
[aria-busy="true"] { cursor: progress; }

/* ── Banners / pills ───────────────────────────────────────────────────── */
.banner { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: .92rem; }
.banner--error { background: #fdecec; color: var(--red); border: 1px solid #f6cccc; }
.banner--success { background: #e6f7f2; color: #06795f; border: 1px solid #b7e8dc; }
.banner--info { background: #eef0ff; color: var(--blue-dark); border: 1px solid #cfd5ff; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill--ok { background: #e6f7f2; color: #06795f; }
.pill--warn { background: #fdf1dd; color: #8a5a12; }
.pill--bad { background: #fdecec; color: var(--red); }
.pill--neutral { background: var(--grey); color: var(--ink); }

/* ── Tables / lists ────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th { font-family: 'Outfit', sans-serif; font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .5px; }
.table tbody tr:hover { background: #fafafa; }
/* PR7 worker picker: not-yet-verified workers are shown but not selectable (design decision 1B). */
.table tbody tr.is-ineligible { opacity: .55; }
.table tbody tr.is-ineligible:hover { background: transparent; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius-lg); }
.empty strong { display: block; font-family: 'Outfit', sans-serif; color: var(--ink); margin-bottom: 4px; }

.row-actions { display: flex; gap: 8px; }
.section { margin-top: 28px; }
.section__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

/* Work-order rows (invite inbox) */
.workorder { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.workorder__body { flex: 1; }
.workorder__body strong { font-family: 'Outfit', sans-serif; }
.workorder__body span { display: block; color: var(--muted); font-size: .88rem; }

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-main__brand { display: block; }   /* keep the brand present once the hero is gone */
    .grid-2 { grid-template-columns: 1fr; }
    .appbar__nav { display: none; }
}

/* ── Readiness strip (Company page at-a-glance status) ─────────────────────── */
.readiness { display: flex; flex-wrap: wrap; gap: 24px; padding: 14px 18px; margin-bottom: 20px;
    border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fafafa; }
.readiness__group { display: flex; align-items: center; gap: 8px; }
.readiness__label { font-family: 'Outfit', sans-serif; font-weight: 600; text-transform: uppercase;
    font-size: .72rem; letter-spacing: .5px; color: var(--muted); }

/* ── Destructive button (DESIGN.md muted red) ─────────────────────────────── */
.btn--danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn--danger:hover { background: var(--red); color: #fff; text-decoration: none; }

/* ── Modal (add forms + delete confirm) ───────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,20,30,.45); display: flex;
    align-items: center; justify-content: center; padding: 20px; z-index: 60; }
.modal-overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal__head h3 { margin: 0; font-family: 'Outfit', sans-serif; }
.modal__close { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--muted);
    cursor: pointer; padding: 0 4px; }
.modal__close:hover { color: var(--ink); }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal p { color: var(--ink); line-height: 1.5; }

@media (max-width: 640px) {
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
    .modal__foot .btn { flex: 1; }
    .readiness { gap: 12px; }
}
