:root {
    --ink: #102b14;
    --muted: #4f6b53;
    --line: #d7e4d7;
    --panel: #ffffff;
    --bg: #e9f2ea;
    --brand: #136c3d;
    --accent: #1f9a5a;
    --brand-dark: #0d4f2d;
    --brand-soft: #dbeadb;
    --warn: #b6331a;
}

* {
    letter-spacing: 0;
}

body {
    background:
        linear-gradient(180deg, rgba(19, 108, 61, 0.14) 0, rgba(19, 108, 61, 0.06) 210px, var(--bg) 211px);
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.86rem;
    line-height: 1.45;
}

label,
.form-label {
    font-size: 0.80rem;
}

.form-control,
.form-select,
.btn,
.table {
    font-size: 0.80rem;
}

.table,
.table th,
.table td {
    white-space: nowrap;
}

.table-sm th,
.table-sm td {
    padding: 0.35rem 0.55rem;
}

.table-responsive {
    overflow-x: auto;
}

.admin-theme {
    --brand: #0d6efd;
    --accent: #0b5ed7;
    --brand-dark: #084298;
    --brand-soft: #eaf2ff;
    background:
        linear-gradient(180deg, rgba(19, 108, 61, 0.13) 0, rgba(19, 108, 61, 0.05) 210px, var(--bg) 211px);
}

.user-theme {
    --brand: #198754;
    --accent: #157347;
    --brand-dark: #146c43;
    --brand-soft: #eaf7f0;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border-bottom: 0;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.navbar-brand {
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand::before {
    content: none;
}

.navbar-brand-icon {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
}

.navbar-brand-title {
    display: inline-block;
    font-size: 0.95rem;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

@media (max-width: 991.98px) {
    .navbar-brand-title {
        display: none;
    }
}

.public-theme {
    --brand: #136c3d;
    --accent: #1f9a5a;
    --brand-dark: #0d4f2d;
    --brand-soft: #dbeadb;
    background: linear-gradient(135deg, #edf5ed 0%, #ffffff 52%, #e7f0e7 100%);
}

.user-login-theme {
    --brand: #0f8f43;
    --accent: #22c55e;
    --brand-dark: #0a5f2d;
    --brand-soft: rgba(255, 255, 255, 0.88);
    background: radial-gradient(circle at top left, rgba(34, 197, 94, 0.28), transparent 24%),
                linear-gradient(135deg, #0f8f43 0%, #22c55e 40%, #d9f3e2 100%);
    color: #ffffff;
    background-attachment: fixed;
    background-size: cover;
}

.admin-login-theme {
    --brand: #228be6;
    --accent: #60a5fa;
    --brand-dark: #0b6ed4;
    --brand-soft: rgba(255, 255, 255, 0.88);
    background: radial-gradient(circle at top right, rgba(96, 165, 250, 0.28), transparent 24%),
                linear-gradient(135deg, #1669f2 0%, #60a5fa 45%, #dbeefb 100%);
    color: #ffffff;
    background-attachment: fixed;
    background-size: cover;
}

.user-login-theme .auth-login-brand,
.admin-login-theme .auth-login-brand {
    color: #ffffff;
}

.user-login-theme .panel,
.admin-login-theme .panel {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 36px 92px rgba(15, 23, 42, 0.18);
    color: #0f172a;
}

.user-login-theme .panel h1,
.admin-login-theme .panel h1,
.user-login-theme .panel h2,
.admin-login-theme .panel h2,
.user-login-theme .panel h3,
.admin-login-theme .panel h3,
.user-login-theme .panel label,
.admin-login-theme .panel label {
    color: #0f172a;
}

.user-login-theme .btn-primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: transparent;
    box-shadow: 0 14px 30px rgba(34, 197, 94, 0.28);
}

.admin-login-theme .btn-primary {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    border-color: transparent;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
}

.auth-login-brand {
    display: inline-block;
    padding: 1.75rem 2rem;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(16px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.auth-login-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.9rem;
}

.auth-shell {
    min-height: calc(100vh - 64px);
    display: grid;
    align-items: center;
    padding: 2rem 0;
}

.navbar-brand-title {
    letter-spacing: 0.05em;
}

.navbar-brand-icon {
    background: rgba(255, 255, 255, 0.22);
}

.navbar-brand,
.navbar-brand:hover,
.navbar-brand:focus {
    color: #fff;
}

.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.38);
    background: rgba(255, 255, 255, 0.12);
}

.navbar-toggler-icon {
    filter: invert(1) grayscale(1) brightness(1.8);
}

.nav-link {
    border-radius: 8px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.82);
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover,
.nav-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
    color: var(--brand-dark) !important;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.admin-theme .nav-link.active {
    color: var(--brand-dark) !important;
    background: #fff;
}

.app-main {
    padding-bottom: 92px;
    padding-top: 0.35rem;
}

.page-header-row {
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.page-header-row .btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
}

.page-header-row .group-pill-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    min-width: 0;
    max-width: 100%;
}

.page-header-row .group-pill-row a,
.page-header-row .group-pill-row span {
    white-space: nowrap;
}

.page-header-row .me-2 {
    min-width: 0;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
    overflow: hidden;
    padding: 0.5rem;
}

.compact-filter {
    padding: 0.65rem 0.75rem;
}

.compact-filter .form-label {
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
}

.compact-filter .form-control,
.compact-filter .form-select,
.compact-filter .btn {
    min-height: 34px;
    padding: 0.35rem 0.6rem;
    font-size: 0.84rem;
}

.compact-filter .row.g-2 > * {
    margin-bottom: 0.25rem;
}


.app-card {
    border-left: 4px solid var(--brand);
}

.metric {
    min-height: 96px;
    position: relative;
    padding: 0.8rem;
}

.metric::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 14px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--brand-soft);
    z-index: 0;
}

.metric-icon {
    position: relative;
    z-index: 1;
    font-size: 1.15rem;
    color: var(--brand);
    min-width: 1.2rem;
}

.metric h3,
.metric .h3 {
    position: relative;
    z-index: 1;
    font-weight: 800;
}

.muted {
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-red {
    color: #991b1b;
    background: #fee2e2;
}

.status-blue {
    color: #1d4ed8;
    background: #dbeafe;
}

.status-winner {
    color: #166534;
    background: #dcfce7;
}

.status-defaulter {
    color: #9a3412;
    background: #ffedd5;
}

.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    min-height: 68px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border-top: 0;
    box-shadow: 0 -14px 32px rgba(15, 23, 42, 0.22);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    gap: 6px;
}

.mobile-bottom-nav::-webkit-scrollbar {
    display: none;
}

.mobile-bottom-nav a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 700;
    flex: 0 0 auto;
    min-width: 64px;
    padding: 6px 10px;
    border-radius: 14px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.mobile-bottom-nav a i {
    font-size: 1.15rem;
}

.mobile-bottom-nav i {
    font-size: 1.22rem;
    line-height: 1;
}

.mobile-bottom-nav a.active {
    color: var(--brand-dark);
    background: #fff;
    transform: translateY(-2px);
}

.admin-theme .mobile-bottom-nav a.active {
    color: var(--brand-dark);
    background: #fff;
}

.mobile-bottom-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.auth-shell {
    min-height: calc(100vh - 64px);
    display: grid;
    align-items: center;
}

.table-mobile th {
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    padding: 0.45rem 0.4rem;
}

.table-mobile td {
    padding: 0.45rem 0.4rem;
    font-size: 0.9rem;
    vertical-align: middle;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-success {
    background: var(--accent);
    border-color: var(--accent);
}

@media (min-width: 992px) {
    .app-main {
        padding-bottom: 0;
    }

    .mobile-bottom-nav {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .mobile-bottom-nav {
        left: 50%;
        transform: translateX(-50%);
        max-width: 760px;
        grid-auto-columns: minmax(96px, 1fr);
        border-bottom: 0;
        border-radius: 18px 18px 0 0;
    }

    .mobile-bottom-nav a {
        min-width: 96px;
    }
}

@media (max-width: 991.98px) {
    .app-topbar .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .navbar-brand {
        gap: 8px;
    }

    .navbar-collapse {
        margin-top: 12px;
        padding: 10px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.12);
    }

    .navbar-nav {
        gap: 4px;
    }

    .nav-link {
        display: flex;
        width: 100%;
        padding: 10px 12px;
    }
}

@media (max-width: 575.98px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    h1.h3,
    .h3 {
        font-size: 1.25rem;
    }

    .panel {
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
        padding: 0.6rem;
    }

    .table-mobile,
    .table-mobile tbody,
    .table-mobile tr,
    .table-mobile td {
        display: block;
        width: 100%;
    }

    .table-mobile thead {
        display: none;
    }

    .table-mobile tr {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 8px;
        margin-bottom: 8px;
        padding: 8px;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    }

    .table-mobile td {
        border: 0;
        padding: 4px 2px;
        font-size: 0.82rem;
    }

    .table-mobile td::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
    }
}
