/* ============================================================
   HIC Driver App — design system
   Brand palette + typography from the Home Ice Cream style guide.
   Loaded by inc/header.php on every driver page.
   ============================================================ */

:root {
    /* Brand */
    --hic-navy:    #0B3D91;
    --hic-navy-2:  #1454B8;
    --hic-blue:    #32ABDF;
    --hic-orange:  #EB5E1F;
    --hic-yellow:  #FFC02E;
    --hic-green:   #CBDD5E;

    /* Neutrals */
    --ink:         #0F1928;
    --ink-soft:    #4A5568;
    --ink-muted:   #8593A8;
    --surface:     #FFFFFF;
    --bg:          #EEF2F8;
    --bg-2:        #F7F9FC;
    --border:      #E3E9F2;

    /* Effects */
    --shadow-sm:   0 1px 2px rgba(11,61,145,.06), 0 1px 3px rgba(11,61,145,.08);
    --shadow-md:   0 4px 12px rgba(11,61,145,.08), 0 2px 4px rgba(11,61,145,.06);
    --shadow-lg:   0 20px 40px -12px rgba(11,61,145,.25);

    --radius-sm:   10px;
    --radius:      16px;
    --radius-lg:   22px;

    --bottom-nav-h: 70px;
}

/* Bootstrap colour overrides — keeps existing .btn-primary, .text-primary, etc. on-brand */
.btn-primary, .bg-primary { background-color: var(--hic-navy) !important; border-color: var(--hic-navy) !important; }
.btn-primary:hover, .btn-primary:focus { background-color: var(--hic-navy-2) !important; border-color: var(--hic-navy-2) !important; }
.text-primary { color: var(--hic-navy) !important; }
.btn-success, .bg-success { background-color: #2F855A !important; border-color: #2F855A !important; }
.btn-warning, .bg-warning { background-color: var(--hic-yellow) !important; border-color: var(--hic-yellow) !important; color: var(--ink) !important; }
.btn-danger,  .bg-danger  { background-color: var(--hic-orange) !important; border-color: var(--hic-orange) !important; }
.btn-info,    .bg-info    { background-color: var(--hic-blue) !important; border-color: var(--hic-blue) !important; }

/* ── Base ─────────────────────────────────────────────────── */
html, body { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--bg-2);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
}
h1, h2, h3, h4, h5 { font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.btn { font-weight: 800; letter-spacing: .01em; }

/* ── Branded top header (used on every page) ────────────── */
.hic-header {
    background: linear-gradient(180deg, var(--hic-navy) 0%, var(--hic-navy-2) 100%);
    color: #fff;
    padding: 0 18px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
}
.hic-header-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0 14px;
}
.hic-brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: #fff;
}
.hic-brand-mark {
    height: 36px;
    width: auto;
    border-radius: 6px;
    display: block;
    background: #fff;
    padding: 2px 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.hic-brand-name { font-weight: 800; font-size: 14px; letter-spacing: .01em; line-height: 1.1; }
.hic-brand-name small {
    display: block; font-size: 10px; font-weight: 600; color: rgba(255,255,255,.7);
    letter-spacing: .08em; text-transform: uppercase; margin-top: 2px;
}

.hic-header-actions { display: flex; gap: 8px; align-items: center; }
.hic-icon-btn {
    width: 38px; height: 38px; border-radius: 12px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    display: grid; place-items: center;
    color: #fff; text-decoration: none;
    position: relative;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.hic-icon-btn:hover, .hic-icon-btn:focus { color: var(--hic-yellow); }
.hic-icon-btn .hic-dot {
    position: absolute; top: 6px; right: 7px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--hic-yellow);
    border: 2px solid var(--hic-navy);
}

/* Greeting block (only on the dashboard) */
.hic-greet { padding: 4px 0 20px; }
.hic-greet .hi {
    font-size: 13px; font-weight: 600; color: rgba(255,255,255,.75); letter-spacing: .02em;
}
.hic-greet h1 {
    color: #fff;
    font-size: 26px; font-weight: 900; letter-spacing: -.02em;
    margin: 2px 0 0;
}
.hic-van {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 10px;
    padding: 6px 12px; border-radius: 999px;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
    font-size: 12px; font-weight: 700; color: #fff;
}
.hic-van .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--hic-green);
    box-shadow: 0 0 0 3px rgba(203,221,94,.3);
}

/* Compact sub-page nav: back arrow + title + optional action */
.hic-subnav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 0 14px;
}
.hic-subnav .back, .hic-subnav .action {
    width: 38px; height: 38px; border-radius: 12px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    display: grid; place-items: center;
    color: #fff; text-decoration: none;
}
.hic-subnav .title {
    font-size: 15px; font-weight: 800; letter-spacing: -.01em; color: #fff;
    flex: 1; text-align: center; padding: 0 8px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Signature wave divider — sits between the navy header and the body */
.hic-wave {
    display: block; width: 100%; height: 24px;
    margin-top: -1px;
}

/* ── Main content + greeting alert cards ──────────────── */
.hic-content { padding: 14px 16px 24px; }

.hic-alert {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(135deg, #FFF5E0 0%, #FFEDC7 100%);
    border: 1.5px solid rgba(255,192,46,.55);
    padding: 12px 14px; border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    color: var(--ink); text-decoration: none;
}
.hic-alert.urgent {
    background: linear-gradient(135deg, #FDECE2 0%, #FAD8C4 100%);
    border-color: rgba(235,94,31,.5);
}
.hic-alert.info {
    background: linear-gradient(135deg, #DEF1FA 0%, #C0E5F4 100%);
    border-color: rgba(50,171,223,.5);
}
.hic-alert .ico {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--hic-orange); color: #fff;
    display: grid; place-items: center; flex-shrink: 0;
    box-shadow: 0 4px 10px -2px rgba(235,94,31,.45);
}
.hic-alert.info .ico { background: var(--hic-blue); box-shadow: 0 4px 10px -2px rgba(50,171,223,.45); }
.hic-alert .text { flex: 1; line-height: 1.25; }
.hic-alert .text strong { font-size: 14px; font-weight: 800; display: block; letter-spacing: -.01em; }
.hic-alert .text span { font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-top: 1px; display: block; }
.hic-alert .chev { color: var(--ink-muted); font-weight: 900; font-size: 18px; padding-right: 4px; }

/* Section labels above tool grids */
.hic-section-label {
    font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-muted);
    padding: 14px 4px 8px;
}

/* ── Tool grid (the dashboard cards) ──────────────────── */
.hic-tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.hic-tool {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
    min-height: 110px;
    padding: 14px 14px 16px;
    display: flex; flex-direction: column; justify-content: space-between;
    color: var(--ink);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.hic-tool:active { transform: scale(.98); }
.hic-tool:hover, .hic-tool:focus { color: var(--ink); box-shadow: var(--shadow-md); }
.hic-tool::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--accent, var(--hic-navy));
}
.hic-tool .tool-ico {
    width: 38px; height: 38px; border-radius: 11px;
    background: var(--accent-soft, rgba(11,61,145,.1));
    color: var(--accent, var(--hic-navy));
    display: grid; place-items: center;
    font-size: 18px;
}
.hic-tool .tool-name {
    font-size: 14px; font-weight: 800; color: var(--ink);
    margin-top: 10px; letter-spacing: -.01em; line-height: 1.15;
}
.hic-tool .tool-meta {
    font-size: 11px; font-weight: 700; color: var(--ink-muted); margin-top: 3px;
}
.hic-tool .tool-badge {
    position: absolute; top: 10px; right: 10px;
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px;
    background: var(--hic-orange); color: #fff;
    font-size: 11px; font-weight: 800;
    display: grid; place-items: center;
    box-shadow: 0 2px 6px rgba(235,94,31,.4);
}
.hic-tool .tool-badge.red {
    background: #E53E3E;
    box-shadow: 0 2px 6px rgba(229,62,62,.4);
}

/* Per-tool accent colours (matches the design proposal) */
.hic-tool[data-key="orders"]          { --accent: var(--hic-orange); --accent-soft: #FDECE2; }
.hic-tool[data-key="notices"]         { --accent: var(--hic-navy);   --accent-soft: #E3EAF7; }
.hic-tool[data-key="daily_stocktake"] { --accent: var(--hic-blue);   --accent-soft: #DEF1FA; }
.hic-tool[data-key="stocktake"]       { --accent: var(--hic-blue);   --accent-soft: #DEF1FA; }
.hic-tool[data-key="templog"]         { --accent: #805AD5;            --accent-soft: #EDE5F7; }
.hic-tool[data-key="place_order"]     { --accent: #2F855A;            --accent-soft: #E0F2E9; }
.hic-tool[data-key="previous_orders"] { --accent: var(--hic-navy);   --accent-soft: #E3EAF7; }
.hic-tool[data-key="upload_receipt"]  { --accent: var(--hic-orange); --accent-soft: #FDECE2; }
.hic-tool[data-key="my_receipts"]     { --accent: var(--hic-orange); --accent-soft: #FDECE2; }
.hic-tool[data-key="banking"]         { --accent: #2F855A;            --accent-soft: #E0F2E9; }
.hic-tool[data-key="sales_reports"]   { --accent: var(--hic-blue);   --accent-soft: #DEF1FA; }
.hic-tool[data-key="franchise_sales"] { --accent: var(--hic-blue);   --accent-soft: #DEF1FA; }
.hic-tool[data-key="contacts"]        { --accent: var(--hic-navy);   --accent-soft: #E3EAF7; }
.hic-tool[data-key="coverage"]        { --accent: var(--hic-blue);   --accent-soft: #DEF1FA; }
.hic-tool[data-key="policies"]        { --accent: var(--hic-orange); --accent-soft: #FDECE2; }
.hic-tool[data-key="vehicle_issues"]  { --accent: #E53E3E;            --accent-soft: #FDE4E4; }

/* ── Bottom tab bar (4 tabs) ────────────────────────── */
.hic-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 1040;
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    background: rgba(255,255,255,.96);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--border);
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
.hic-bottom-nav .tab {
    background: transparent; border: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 4px 0;
    color: var(--ink-muted);
    font-size: 10px; font-weight: 800; letter-spacing: .02em;
    text-decoration: none; position: relative; min-height: 48px;
    cursor: pointer;
}
.hic-bottom-nav .tab svg { opacity: .7; }
.hic-bottom-nav .tab.active { color: var(--hic-navy); }
.hic-bottom-nav .tab.active svg { opacity: 1; }
.hic-bottom-nav .tab .tab-badge {
    position: absolute; top: -2px;
    left: 50%; transform: translateX(2px);
    background: var(--hic-orange);
    color: #fff;
    border-radius: 999px;
    min-width: 18px; height: 18px; padding: 0 5px;
    font-size: 10px; font-weight: 800; line-height: 18px;
    border: 2px solid #fff;
    text-align: center;
}

/* ── Bottom-sheet (offcanvas) ─────────────────────── */
.offcanvas.hic-sheet {
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    height: auto; max-height: 85vh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
}
.offcanvas.hic-sheet .offcanvas-header {
    padding: 14px 18px 8px;
    flex-direction: column; align-items: stretch;
}
.offcanvas.hic-sheet .grabber {
    width: 40px; height: 4px; border-radius: 2px;
    background: #d0d4da;
    margin: 0 auto 12px;
}
.offcanvas.hic-sheet .sheet-row {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
}
.offcanvas.hic-sheet .offcanvas-title {
    font-weight: 900; font-size: 18px; letter-spacing: -.01em;
    color: var(--hic-navy); margin: 0;
}
.offcanvas.hic-sheet .sheet-list {
    list-style: none; padding: 0 8px 8px; margin: 0;
}
.offcanvas.hic-sheet .sheet-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 12px;
    color: var(--ink); text-decoration: none;
    border-radius: 12px;
    min-height: 60px;
}
.offcanvas.hic-sheet .sheet-item:active { background: #f1f5fb; }
.offcanvas.hic-sheet .sheet-item .sheet-icon {
    width: 40px; height: 40px; border-radius: 11px;
    background: rgba(11,61,145,.08);
    color: var(--hic-navy);
    display: grid; place-items: center;
    flex-shrink: 0; font-size: 18px;
}
.offcanvas.hic-sheet .sheet-item .sheet-label {
    font-weight: 700; flex: 1; font-size: 15px;
}
.offcanvas.hic-sheet .sheet-item .sheet-meta {
    font-size: 11px; font-weight: 700; color: var(--ink-muted); display: block; margin-top: 1px;
}
.offcanvas.hic-sheet .sheet-item .sheet-badge {
    background: var(--hic-orange); color: #fff;
    border-radius: 999px;
    min-width: 24px; text-align: center;
    padding: 2px 9px;
    font-weight: 800; font-size: .8rem;
}
.offcanvas.hic-sheet .sheet-item.danger { color: #E53E3E; }
.offcanvas.hic-sheet .sheet-item.danger .sheet-icon {
    background: rgba(229,62,62,.08); color: #E53E3E;
}

/* ── Stocktake-style freezer accordion polish ───────────── */
.freezer-card {
    background: #fff; border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px; overflow: hidden;
}

/* ── Sign-in screen polish ──────────────────────── */
.signin-bg {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--hic-navy) 0%, var(--hic-navy-2) 55%, var(--hic-navy) 100%);
    position: relative; overflow: hidden;
    display: flex; flex-direction: column;
    padding-bottom: 0 !important;
}
.signin-bg::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 10%, rgba(50,171,223,.3), transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 80%, rgba(235,94,31,.15), transparent 60%);
    pointer-events: none;
}
.signin-top {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 40px 28px; position: relative; z-index: 2;
    color: #fff;
}
.signin-logo {
    width: auto;
    height: 140px;
    max-width: 80%;
    border-radius: 18px;
    background: #fff;
    padding: 14px 22px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,.4);
    display: block;
}
.signin-title {
    color: #fff; font-weight: 800; font-size: 22px; margin-top: 36px;
    letter-spacing: -.01em; text-align: center;
}
.signin-sub { color: rgba(255,255,255,.75); font-size: 14px; font-weight: 600; margin-top: 6px; text-align: center; }
.signin-form {
    background: #fff;
    border-radius: 32px 32px 0 0;
    padding: 32px 24px 32px;
    box-shadow: 0 -10px 40px rgba(0,0,0,.1);
    position: relative; z-index: 2;
}
.signin-form::before {
    content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 6px;
    background: linear-gradient(90deg, var(--hic-blue) 0%, var(--hic-navy) 33%, var(--hic-orange) 66%, var(--hic-yellow) 100%);
    border-radius: 32px 32px 0 0;
}
.signin-form .form-label {
    font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-muted); margin-bottom: 6px; padding-left: 4px;
}
.signin-form .form-control {
    padding: 14px 16px; border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--bg-2);
    font-size: 15px; font-weight: 600;
    min-height: 50px;
}
.signin-form .form-control:focus {
    border-color: var(--hic-navy);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(11,61,145,.08);
}
.signin-form .btn-primary {
    width: 100%; padding: 16px; margin-top: 10px;
    border-radius: 16px; border: none;
    background: linear-gradient(180deg, var(--hic-navy-2) 0%, var(--hic-navy) 100%);
    color: #fff; font-size: 16px; font-weight: 800;
    box-shadow: 0 8px 20px -6px rgba(11,61,145,.5), inset 0 1px 0 rgba(255,255,255,.2);
}
.signin-help { text-align: center; margin-top: 16px; font-size: 13px; color: var(--ink-muted); font-weight: 600; }
.signin-help a { color: var(--hic-navy); font-weight: 800; text-decoration: none; }

/* Touch-target safety net for any older button outside our system */
.btn { min-height: 44px; }
