﻿/*
 * HITL_BATCH_067_CREW_PORTAL_V1_START
 * 905WOOD Crew Portal V1 - Carhartt-Dark + Construction-Orange
 *
 * Design constraints honored from Mike's brand state:
 *   - Carhartt red #B91C1C on charcoal #0A0A0A backbone (matches sitewide V3 dark theme)
 *   - NEW: Construction-orange #FF6B00 reserved for status-pills + primary CTAs
 *   - 56px minimum tap targets (gloved-hand discipline)
 *   - Monospace job IDs (instant pattern-match at a glance)
 *   - Mobile-first 320-428px, gracefully scales to desktop dispatcher console
 *   - Pure CSS - no Tailwind build, no PostCSS dependency, no compile step (works on
 *     Magento static-content deploy day one).  Atomic utility class layer mirrors
 *     Tailwind v4 naming for legibility.
 * HITL_BATCH_067_CREW_PORTAL_V1_END
 */

:root {
    --bg-0: #0A0A0A;
    --bg-1: #141414;
    --bg-2: #1F1F1F;
    --bg-3: #2A2A2A;
    --line: #333333;
    --line-2: #444444;
    --ink-0: #FFFFFF;
    --ink-1: #E5E5E5;
    --ink-2: #A3A3A3;
    --ink-3: #6B6B6B;
    --red: #B91C1C;
    --red-2: #DC2626;
    --orange: #FF6B00;
    --orange-2: #FF8533;
    --orange-glow: rgba(255, 107, 0, 0.35);
    --green: #16A34A;
    --green-2: #22C55E;
    --amber: #F59E0B;
    --blue: #3B82F6;
    --tap: 56px;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-lift: 0 10px 30px rgba(0,0,0,0.55);
    --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Courier New', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

body.crew-portal {
    background: var(--bg-0);
    color: var(--ink-0);
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
    min-height: 100vh;
    min-height: 100svh;
}

.crew-portal a { color: var(--orange); text-decoration: none; }
.crew-portal a:active, .crew-portal a:focus { color: var(--orange-2); }

.crew-shell { max-width: 720px; margin: 0 auto; padding: 0 16px 96px; }

/* ===== Top bar ===== */
.crew-topbar {
    position: sticky; top: 0; z-index: 30;
    background: linear-gradient(180deg, #0A0A0A 0%, rgba(10,10,10,0.95) 100%);
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    backdrop-filter: saturate(150%) blur(10px);
}
.crew-topbar .brand {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 14px;
    color: var(--ink-0);
}
.crew-topbar .brand .mark {
    color: var(--orange);
}
.crew-topbar .who {
    font-size: 12px;
    color: var(--ink-2);
    display: flex; align-items: center; gap: 8px;
}
.crew-topbar .role-pill {
    background: var(--bg-3);
    color: var(--ink-1);
    border: 1px solid var(--line-2);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
}

/* ===== Tab nav ===== */
.crew-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.crew-tabs::-webkit-scrollbar { display: none; }
.crew-tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    color: var(--ink-1);
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.crew-tab.is-active {
    background: var(--orange);
    color: #1A0F00;
    border-color: var(--orange);
    box-shadow: 0 0 0 4px var(--orange-glow);
}

/* ===== Cards / Job Board ===== */
.crew-card {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-lift);
}
.crew-card-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; margin-bottom: 12px;
}
.crew-card-code {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--ink-2);
    letter-spacing: 0.04em;
}
.crew-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink-0);
    line-height: 1.2;
    margin-top: 4px;
}
.crew-card-sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

.status-pill {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.status-pill[data-status="assigned"]   { background: rgba(59,130,246,0.18); color: #93C5FD; border-color: rgba(59,130,246,0.35); }
.status-pill[data-status="enroute"]    { background: rgba(255,107,0,0.18);  color: var(--orange-2); border-color: rgba(255,107,0,0.4); }
.status-pill[data-status="onsite"]     { background: rgba(245,158,11,0.18); color: #FBBF24; border-color: rgba(245,158,11,0.35); }
.status-pill[data-status="picked_up"]  { background: rgba(34,197,94,0.18);  color: var(--green-2); border-color: rgba(34,197,94,0.35); }
.status-pill[data-status="delivered"]  { background: rgba(34,197,94,0.28);  color: var(--green-2); border-color: rgba(34,197,94,0.55); }
.status-pill[data-status="closed"]     { background: var(--bg-3); color: var(--ink-2); border-color: var(--line-2); }
.status-pill[data-status="cancelled"]  { background: rgba(185,28,28,0.18);  color: #FCA5A5; border-color: rgba(185,28,28,0.4); }

.crew-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--ink-1);
}
.crew-card-meta b { color: var(--ink-0); font-weight: 600; }
.crew-card-meta .label {
    color: var(--ink-3);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2px;
    display: block;
}

.crew-card-actions {
    display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
    min-height: var(--tap);
    min-width: 96px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    border: 1px solid var(--line-2);
    background: var(--bg-3);
    color: var(--ink-0);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.08s ease-out, background 0.15s, border-color 0.15s;
    touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
/* 2026-05-26 design tweak: primary CTA flipped from orange to Carhartt red
   to match sitewide spikebins.ca branding. Orange accent system retained
   on status pills, focus rings, hold-to-seal progress, tab actives. */
.btn-primary {
    background: var(--red);
    color: #FFFFFF;
    border-color: var(--red-2);
    box-shadow: 0 0 24px rgba(185, 28, 28, 0.45);
}
.btn-primary:active { background: var(--red-2); }
.btn-danger {
    background: var(--red);
    color: #FFFFFF;
    border-color: var(--red-2);
}
.btn-ghost {
    background: transparent;
    border-color: var(--line-2);
    color: var(--ink-1);
}
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ===== Login screen ===== */
.login-shell {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
}
.login-mark {
    text-align: center;
    margin-bottom: 36px;
}
.login-mark .logo {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 28px;
    letter-spacing: 0.06em;
    color: var(--ink-0);
}
.login-mark .logo .accent { color: var(--red); }
.login-mark .sub {
    color: var(--ink-2);
    font-size: 13px;
    margin-top: 8px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-card {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px 20px;
    box-shadow: var(--shadow-lift);
    max-width: 420px;
    margin: 0 auto;
    width: 100%;
}

.field-group { margin-bottom: 16px; }
.field-label {
    display: block;
    font-size: 11px;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.field-input {
    width: 100%;
    min-height: var(--tap);
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line-2);
    background: var(--bg-2);
    color: var(--ink-0);
    font-size: 18px;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    outline: none;
}
.field-input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

/* OTP boxes */
.otp-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.otp-cell {
    height: 64px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--bg-2);
    color: var(--ink-0);
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    text-align: center;
    outline: none;
}
.otp-cell:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

/* ===== Hold-to-Seal ===== */
.classify-stage {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
}
.classify-camera {
    background: #000;
    border-radius: var(--radius);
    aspect-ratio: 3 / 4;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--line);
}
.classify-camera video, .classify-camera img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.classify-camera .live-dot {
    position: absolute; top: 12px; right: 12px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--red-2);
    box-shadow: 0 0 0 4px rgba(220,38,38,0.25);
    animation: pulse 1.4s infinite;
}
@keyframes pulse {
    0%   { transform: scale(1);   opacity: 1; }
    70%  { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(1.4); opacity: 0; }
}

.band-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.band-btn {
    min-height: 64px;
    border-radius: 12px;
    border: 2px solid var(--line-2);
    background: var(--bg-2);
    color: var(--ink-0);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
}
.band-btn[data-band="clean"]   { border-color: var(--green); }
.band-btn[data-band="amber"]   { border-color: var(--amber); }
.band-btn[data-band="mixed"]   { border-color: var(--red); }
.band-btn[data-band="suspect"] { border-color: var(--orange); }
.band-btn.is-selected[data-band="clean"]   { background: var(--green);   color: #06250D; }
.band-btn.is-selected[data-band="amber"]   { background: var(--amber);   color: #2A1B00; }
.band-btn.is-selected[data-band="mixed"]   { background: var(--red);     color: #FFF; }
.band-btn.is-selected[data-band="suspect"] { background: var(--orange);  color: #1A0F00; }

.hold-button-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    padding: 12px 0 24px;
}
.hold-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle at center, var(--red-2), var(--red));
    color: #FFF;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 4px solid var(--red);
    box-shadow: 0 0 0 8px rgba(185,28,28,0.18), 0 14px 30px rgba(0,0,0,0.7);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    position: relative;
    z-index: 1;
}
.hold-button.is-holding {
    background: radial-gradient(circle at center, var(--orange-2), var(--orange));
    border-color: var(--orange);
    box-shadow: 0 0 0 12px var(--orange-glow), 0 14px 30px rgba(0,0,0,0.7);
}
.hold-ring {
    position: absolute;
    top: 50%; left: 50%;
    width: 230px; height: 230px;
    transform: translate(-50%, -50%) rotate(-90deg);
    pointer-events: none;
}
.hold-ring circle {
    fill: none;
    stroke: var(--orange);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 720;
    stroke-dashoffset: 720;
    transition: stroke-dashoffset 50ms linear;
    filter: drop-shadow(0 0 12px var(--orange-glow));
}

/* ===== Comms console ===== */
.comms-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px 0;
}
@media (min-width: 900px) {
    .comms-shell { grid-template-columns: 320px 1fr; }
}

.comms-list {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-height: 60vh;
    overflow-y: auto;
}
.comms-list-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    display: flex; flex-direction: column; gap: 4px;
}
.comms-list-item:hover { background: var(--bg-2); }
.comms-list-item.is-active { background: var(--bg-3); border-left: 3px solid var(--orange); padding-left: 11px; }
.comms-list-item .name { color: var(--ink-0); font-weight: 700; font-size: 14px; }
.comms-list-item .meta { color: var(--ink-3); font-size: 11px; font-family: var(--font-mono); }

.comms-composer {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}
.channel-picker {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.channel-btn {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    color: var(--ink-1);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
}
.channel-btn .ico { font-size: 16px; }
.channel-btn.is-active {
    background: var(--bg-3);
    border-color: var(--orange);
    color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

.composer-input, .composer-textarea {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    color: var(--ink-0);
    font-size: 15px;
    padding: 12px 14px;
    outline: none;
    font-family: var(--font-sans);
}
.composer-textarea { min-height: 140px; resize: vertical; }
.composer-input:focus, .composer-textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

.comms-log {
    margin-top: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.comms-log table { width: 100%; border-collapse: collapse; }
.comms-log th, .comms-log td {
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-1);
}
.comms-log th {
    background: var(--bg-2);
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
}
.comms-log td.mono { font-family: var(--font-mono); }

/* ===== Toast / feedback ===== */
.crew-toast-host {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 16px; right: 16px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 999;
    pointer-events: none;
}
.crew-toast {
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    color: var(--ink-0);
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-lift);
    font-size: 14px;
    pointer-events: auto;
}
.crew-toast.is-success { border-color: var(--green); }
.crew-toast.is-error { border-color: var(--red); }
.crew-toast.is-info { border-color: var(--orange); }

/* ===== Skeletons ===== */
.skel {
    background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
    background-size: 200% 100%;
    animation: skelShift 1.2s linear infinite;
    border-radius: 8px;
}
@keyframes skelShift {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Empty states ===== */
.empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--ink-2);
}
.empty .ico { font-size: 40px; margin-bottom: 12px; opacity: 0.6; }

/* ===== Bottom nav (mobile) ===== */
.crew-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(10,10,10,0.94);
    backdrop-filter: blur(12px) saturate(160%);
    border-top: 1px solid var(--line);
    display: flex; justify-content: space-around;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
    z-index: 50;
}
.crew-bottom-nav a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.crew-bottom-nav a.is-active { color: var(--orange); }
.crew-bottom-nav a .ico { font-size: 22px; }

/* ===== A11y focus ===== */
.crew-portal button:focus-visible,
.crew-portal a:focus-visible,
.crew-portal input:focus-visible,
.crew-portal textarea:focus-visible {
    outline: 3px solid var(--orange);
    outline-offset: 2px;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* HITL_BATCH_068_CREW_BG_V1_START + V2_SELECTOR_FIX
 * Polished_Fenders_Cowl_Tanks background, scoped to /crew login screen ONLY.
 * Dispatch board + comms console remain solid black for legibility under work conditions.
 * APPROVE-ALL #14 candidate.
 *
 * Filename-versioning: crew-bg-v1.jpg defeats 1-year browser max-age cache (per HITL_BATCH_065).
 * Sentinel brackets allow surgical removal/iteration without touching surrounding rules.
 * HITL_BATCH_068_CREW_BG_V1_END
 */

body.crewportal-index-index {
    background-color: var(--bg-0);
    background-image:
        linear-gradient(rgba(10, 10, 10, 0.70), rgba(10, 10, 10, 0.70)),
        url("../images/crew-bg-v1.jpg");
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* iOS Safari fixed-bg bug avoidance + shift focal to the chrome on narrow viewports */
@media (max-width: 768px) {
    body.crewportal-index-index {
        background-attachment: scroll;
        background-position: 65% center;
    }
}

/* Lift the login card off the truck so it reads as a hovering panel, not a flat card */
body.crewportal-index-index .login-card {
    background: rgba(20, 20, 20, 0.92);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Slight text-shadow on the wordmark so it sits cleanly on the busy backdrop */
body.crewportal-index-index .login-mark .logo,
body.crewportal-index-index .login-mark .sub {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
/* HITL_BATCH_068_CREW_BG_V2_START + V1_LEGACY_END_OF_BLOCK */
