﻿/* ===================================================== TOKENS ========= */

:root {
    --brand: #0b1e75;
    --brand-dark: #2743c4;
    --brand-soft: #fdeaea;
    --ok: #52a72c;
    --dormant: #f5a623;
    --ink: #212529;
    --page-bg: #f4f5f7;
}

body {
    background: var(--page-bg);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--ink);
}

/* ===================================================== LOGIN ========== */

.login-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #e8392f 0%, #f2a24a 45%, #f7dd8f 100%);
    background-attachment: fixed;
}

    /* The server form wraps the whole card, so it must stretch to allow centering. */
    .login-body form {
        width: 100%;
        display: flex;
        justify-content: center;
    }

.login-card {
    width: 100%;
    max-width: 530px;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .18);
}

.login-card__head {
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
    color: #fff;
    text-align: center;
    padding: 1.75rem 1.5rem 1.5rem;
}

    .login-card__head img {
        max-width: 330px;
        width: 75%;
        margin-bottom: .75rem;
    }

    .login-card__head h1 {
        font-weight: 600;
        letter-spacing: .2px;
    }

.login-card__body {
    padding: 2rem 1.75rem 1.75rem;
}

    .login-card__body .form-label {
        color: #2b2b2b;
        margin-bottom: .4rem;
    }

    .login-card__body .input-group-text {
        background: var(--brand-soft);
        border-color: #e3e3e3;
        border-right: 0;
        color: var(--brand);
        width: 48px;
        justify-content: center;
    }

    .login-card__body .form-control {
        border-color: #e3e3e3;
        border-left: 0;
        padding: .7rem .9rem;
    }

        .login-card__body .form-control:focus {
            border-color: var(--brand);
            box-shadow: none;
        }

    /* Keep the icon box outlined in brand colour while the field has focus. */
    .login-card__body .input-group:focus-within .input-group-text {
        border-color: var(--brand);
    }

    .login-card__body .form-check-input:checked {
        background-color: var(--brand);
        border-color: var(--brand);
    }

    .login-card__body .form-check-input:focus {
        border-color: var(--brand);
        box-shadow: none;
    }

.btn-brand {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: .8rem 1rem;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease-in-out;
}

    .btn-brand:hover,
    .btn-brand:focus {
        background: var(--brand-dark);
        color: #fff;
        text-decoration: none;
    }

/* ===================================================== DASHBOARD ====== */

/* ---------- Header ---------- */

.app-header {
    background: var(--brand);
    padding: 1rem 1.25rem 1.75rem;
    margin-bottom: -1rem;
}

.app-header__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-header__brand {
    display: flex;
    align-items: center;
    gap: .9rem;
}

    .app-header__brand .logo {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        border-radius: 12px;
        padding: .45rem .7rem;
    }

        .app-header__brand .logo img {
            max-height: 34px;
            width: auto;
        }

    .app-header__brand h1 {
        color: #fff;
        font-size: 1.5rem;
        font-weight: 700;
        margin: 0;
    }

.app-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
}

/* ---------- Pill buttons ---------- */

.btn-pill-light {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    background: #fff;
    color: var(--brand);
    font-weight: 600;
    font-size: .9rem;
    border-radius: 999px;
    padding: .55rem 1.2rem;
    text-decoration: none;
    white-space: nowrap;
}

    .btn-pill-light:hover,
    .btn-pill-light:focus {
        background: #fff5f5;
        color: var(--brand-dark);
        text-decoration: none;
    }

/* ---------- Tabs (CSS only, driven by the radios) ---------- */

.tab-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.app-tabs {
    display: flex;
    gap: .6rem;
    margin-top: 1rem;
}

    .app-tabs label {
        background: var(--brand-dark);
        color: #fff;
        font-weight: 600;
        font-size: .95rem;
        border-radius: 8px;
        padding: .6rem 1.4rem;
        cursor: pointer;
        user-select: none;
        margin: 0;
    }

#tab-branch:checked ~ .app-header .app-tabs label[for="tab-branch"],
#tab-slab:checked ~ .app-header .app-tabs label[for="tab-slab"] {
    background: #fff;
    color: var(--brand);
}

.tab-pane {
    display: none;
}

#tab-branch:checked ~ .app-main #pane-branch,
#tab-slab:checked ~ .app-main #pane-slab {
    display: block;
}

/* ---------- Main ---------- */

.app-main {
    padding: 0 1.25rem 2rem;
}

.card-box,
.panel {
    background: #fff;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    height: 100%;
}

/* ---------- Stat tiles ---------- */

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.35rem;
    flex-shrink: 0;
}

    .stat-icon.orange {
        background: linear-gradient(135deg, #f0563f, #d93b25);
    }

    .stat-icon.green {
        background: linear-gradient(135deg, #6cc04a, #4e9c2f);
    }

    .stat-icon.red {
        background: linear-gradient(135deg, #f4796d, #e8503f);
    }

    .stat-icon.yellow {
        background: linear-gradient(135deg, #ffc861, #f5a623);
    }

.stat-label {
    color: #6c757d;
    font-size: .9rem;
    line-height: 1.3;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

/* ---------- Gauge ---------- */

.gauge {
    width: 118px;
    height: 66px;
    flex-shrink: 0;
}

.gauge__track,
.gauge__fill {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
}

.gauge__track {
    stroke: #e4e6ea;
}

/* Semicircle path length is about 125.6, so 1 percent is about 1.256 units. */
.gauge__fill {
    stroke: var(--brand);
    stroke-dasharray: calc(var(--p, 0) * 1.256) 400;
}

.gauge__fill--green {
    stroke: var(--ok);
}

.gauge__fill--yellow {
    stroke: var(--dormant);
}

.gauge__text {
    fill: var(--ink);
    font-size: 13px;
    font-weight: 700;
    text-anchor: middle;
}

/* ---------- Legend ---------- */

.legend-box {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}

/* ---------- Branch / slab cards ---------- */

.branch-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    height: 100%;
}

.branch-header {
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    padding: .8rem 1.1rem;
}

.ds-bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #e4e6ea;
}

    .ds-bar span {
        display: block;
        height: 100%;
    }

.btn-red {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    border: 0;
    border-radius: 8px;
    padding: .55rem 1.4rem;
    text-decoration: none;
    cursor: pointer;
}

    .btn-red:hover,
    .btn-red:focus {
        background: var(--brand-dark);
        color: #fff;
        text-decoration: none;
    }
/* ---------- Scope pill (branch / WD context) ---------- */

.scope-pill-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

.scope-pill {
    background: var(--brand-dark);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    border-radius: 999px;
    padding: .55rem 1.5rem;
}

/* ---------- Breadcrumb bar ---------- */

.crumb-bar {
    background: #fff;
    border-radius: 12px;
    padding: .85rem 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    font-size: .95rem;
}

    .crumb-bar a {
        color: var(--brand);
        font-weight: 600;
        text-decoration: none;
    }

        .crumb-bar a:hover {
            text-decoration: underline;
        }

.crumb-sep {
    color: #adb5bd;
    margin: 0 .5rem;
}

.crumb-current {
    color: #6c757d;
}
/* ---------- Search box ---------- */

.search-box {
    display: flex;
    align-items: stretch;
    gap: .5rem;
}

    .search-box .form-control {
        width: 280px;
        border-color: #dee2e6;
        border-radius: 8px;
        padding: .5rem .85rem;
    }

        .search-box .form-control:focus {
            border-color: var(--brand);
            box-shadow: none;
        }

.search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    background: var(--brand);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
}

    .search-btn:hover,
    .search-btn:focus {
        background: var(--brand-dark);
        color: #fff;
    }

/* ---------- Outlet table ---------- */

.outlet-table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

    .outlet-table th {
        background: var(--brand);
        color: #fff;
        font-weight: 600;
        font-size: .92rem;
        padding: .85rem 1rem;
        white-space: nowrap;
        border: 0;
    }

        .outlet-table th:first-child {
            border-top-left-radius: 8px;
        }

        .outlet-table th:last-child {
            border-top-right-radius: 8px;
        }

    .outlet-table td {
        padding: .8rem 1rem;
        border-bottom: 1px solid #eceef1;
        border-top: 0;
        vertical-align: middle;
        font-size: .92rem;
    }

    .outlet-table tbody tr:hover td {
        background: #fdf6f6;
    }

/* ---------- Status badges ---------- */

.status-badge {
    display: inline-block;
    border-radius: 6px;
    padding: .25rem .7rem;
    font-size: .78rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.status-badge--done {
    background: #6cb33f;
}

.status-badge--pending {
    background: var(--brand);
}

.status-badge--no {
    background: #6c757d;
}

/* ---------- View button ---------- */

.btn-view {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: #1e7a34;
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    border-radius: 6px;
    padding: .4rem .9rem;
    text-decoration: none;
    white-space: nowrap;
}

    .btn-view:hover,
    .btn-view:focus {
        background: #165c27;
        color: #fff;
        text-decoration: none;
    }

.btn-view--disabled,
.btn-view--disabled:hover {
    background: #adb5bd;
    color: #fff;
    cursor: default;
    pointer-events: none;
}

/* ---------- Grid pager ---------- */

.outlet-pager td {
    padding-top: 1.25rem;
    border-bottom: 0;
}

.outlet-pager table {
    margin: 0 auto;
}

.outlet-pager td td {
    padding: 0;
    border: 0;
}

.outlet-pager a,
.outlet-pager span {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    padding: .35rem .6rem;
    margin: 0 2px;
    border-radius: 6px;
    font-size: .88rem;
    text-decoration: none;
}

.outlet-pager a {
    background: #f1f3f5;
    color: var(--brand);
}

    .outlet-pager a:hover {
        background: #e9ecef;
    }

/* The current page is rendered as a span by the GridView pager. */
.outlet-pager span {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}
/* ---------- Outlet detail card ---------- */

.detail-wrap {
    display: flex;
    justify-content: center;
}

.detail-card {
    width: 100%;
    max-width: 780px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .1);
}

.detail-card__head {
    background: linear-gradient(180deg, #6cb33f 0%, #4e9c2f 100%);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    padding: .95rem 1.4rem;
}

/* A pending outlet keeps the brand colour instead of the enrolled green. */
.detail-wrap:not(.detail-wrap--done) .detail-card__head {
    background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

    .detail-table th,
    .detail-table td {
        padding: .85rem 1.4rem;
        border-bottom: 1px solid #f0f1f3;
        font-size: .95rem;
        vertical-align: middle;
    }

    .detail-table th {
        width: 38%;
        background: #fdf7f2;
        font-weight: 700;
        text-align: left;
        color: #2b2b2b;
    }

    .detail-table tr:last-child th,
    .detail-table tr:last-child td {
        border-bottom: 0;
    }

.detail-card__foot {
    padding: 1.5rem 1.4rem;
    text-align: center;
}

.gift-image {
    margin-bottom: 1.25rem;
}

    .gift-image img {
        max-height: 180px;
        border-radius: 8px;
    }
/* Logo doubles as the back control on scoped pages. */
.app-header__brand a.logo {
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease;
}

    .app-header__brand a.logo:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
    }