:root {
    --bs-primary: #006442;
    --bs-primary-rgb: 0, 100, 66;
    --bs-success: #006442;
    --bs-success-rgb: 0, 100, 66;
    --bs-warning: #F28D08;
    --bs-warning-rgb: 242, 141, 8;
    --bs-info: #1E50A2;
    --bs-info-rgb: 30, 80, 162;
    --bs-danger: #D62828;
    --bs-danger-rgb: 214, 40, 40;
    --bs-body-bg: #FAFAFA;
    --bs-body-color: #222222;
    --bs-secondary-color: #6C757D;
    --bs-link-color: #006442;
    --bs-link-hover-color: #004B31;
}

body {
    background-color: #FAFAFA;
    color: #222222;
}

.btn-primary, .btn-success {
    --bs-btn-bg: #006442;
    --bs-btn-border-color: #006442;
    --bs-btn-hover-bg: #004B31;
    --bs-btn-hover-border-color: #004B31;
    --bs-btn-active-bg: #004B31;
    --bs-btn-active-border-color: #004B31;
    --bs-btn-disabled-bg: #006442;
    --bs-btn-disabled-border-color: #006442;
}

.btn-warning {
    --bs-btn-bg: #F28D08;
    --bs-btn-border-color: #F28D08;
    --bs-btn-hover-bg: #D4A300;
    --bs-btn-hover-border-color: #D4A300;
    --bs-btn-active-bg: #D4A300;
    --bs-btn-active-border-color: #D4A300;
}

.btn-info {
    --bs-btn-bg: #1E50A2;
    --bs-btn-border-color: #1E50A2;
    --bs-btn-hover-bg: #1a4590;
    --bs-btn-hover-border-color: #1a4590;
    --bs-btn-active-bg: #1a4590;
    --bs-btn-active-border-color: #1a4590;
}

.btn-danger {
    --bs-btn-bg: #D62828;
    --bs-btn-border-color: #D62828;
    --bs-btn-hover-bg: #c02424;
    --bs-btn-hover-border-color: #c02424;
    --bs-btn-active-bg: #c02424;
    --bs-btn-active-border-color: #c02424;
}

.btn-outline-primary {
    --bs-btn-color: #006442;
    --bs-btn-border-color: #006442;
    --bs-btn-hover-bg: #006442;
    --bs-btn-hover-border-color: #006442;
    --bs-btn-active-bg: #006442;
    --bs-btn-active-border-color: #006442;
}

.btn-outline-success {
    --bs-btn-color: #006442;
    --bs-btn-border-color: #006442;
    --bs-btn-hover-bg: #006442;
    --bs-btn-hover-border-color: #006442;
    --bs-btn-active-bg: #006442;
    --bs-btn-active-border-color: #006442;
}

.btn-outline-warning {
    --bs-btn-color: #F28D08;
    --bs-btn-border-color: #F28D08;
    --bs-btn-hover-bg: #F28D08;
    --bs-btn-hover-border-color: #F28D08;
    --bs-btn-active-bg: #F28D08;
    --bs-btn-active-border-color: #F28D08;
}

.btn-outline-info {
    --bs-btn-color: #1E50A2;
    --bs-btn-border-color: #1E50A2;
    --bs-btn-hover-bg: #1E50A2;
    --bs-btn-hover-border-color: #1E50A2;
    --bs-btn-active-bg: #1E50A2;
    --bs-btn-active-border-color: #1E50A2;
}

.btn-outline-danger {
    --bs-btn-color: #D62828;
    --bs-btn-border-color: #D62828;
    --bs-btn-hover-bg: #D62828;
    --bs-btn-hover-border-color: #D62828;
    --bs-btn-active-bg: #D62828;
    --bs-btn-active-border-color: #D62828;
}

.bg-primary, .badge.bg-primary { background-color: #006442 !important; }
.bg-success, .badge.bg-success { background-color: #006442 !important; }
.bg-warning { background-color: #F28D08 !important; }
.bg-info { background-color: #1E50A2 !important; }
.bg-danger { background-color: #D62828 !important; }

.badge.bg-warning, .badge.bg-warning.bg-opacity-75 { color: #000; }

.badge.badge-completed { background-color: #D6F0E0 !important; color: #0D6832 !important; }
.badge.badge-missed    { background-color: #FDCDD5 !important; color: #AF233A !important; }
.badge.badge-pending   { background-color: #F8F9FA !important; color: #ADB5BD !important; border: 1px dashed #CED4DA; }
.badge.badge-future    { background-color: #F9F9F9 !important; color: #4F4F4F !important; }
.badge.badge-grade     { background-color: #C4D9FF !important; color: #1E50A2 !important; }
.badge.badge-total     { background-color: #E8E8E8 !important; color: #333333 !important; }

.text-primary { color: #006442 !important; }
.text-success { color: #006442 !important; }
.text-warning { color: #F28D08 !important; }
.text-info { color: #1E50A2 !important; }
.text-danger { color: #D62828 !important; }
.text-muted { color: #6C757D !important; }

a, .btn-link { color: #006442; }
a:hover, .btn-link:hover { color: #004B31; }

.border-primary { border-color: #006442 !important; }
.border-success { border-color: #006442 !important; }

/* ================= Mobile (login + student diary only) ================= */
@media (max-width: 767.98px) {
    /* --- Login --- */
    .mobile-login .navbar { display: none; }
    .mobile-login .container {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding-top: 1.5rem !important;
    }
    .mobile-login h2 { font-size: 1.4rem; }
    .mobile-login .form-control,
    .mobile-login .btn-primary {
        min-height: 48px;
        font-size: 1rem;
    }

    /* --- Student diary: table split in half — sticky Предмет (+ Всего) on the
       left, one slot per screen on the right, swipe left/right --- */
    .mobile-mode .navbar { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
    .mobile-mode .container { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
    .mobile-mode .table-responsive {
        -webkit-overflow-scrolling: touch;
        -webkit-scroll-snap-type: x mandatory;
        scroll-snap-type: x mandatory;
    }
    /* left half = sticky Предмет column, right half = exactly one slot.
       Table gets an explicit pixel width from JS: (slots + 1) x 50vw —
       without it max-content sizing ignores the fixed column widths.
       scroll-margin-left makes the snap land right after the sticky column. */
    .mobile-mode .table-fixed {
        table-layout: fixed;
        min-width: 100%;
    }
    .mobile-mode .table-fixed thead th[data-slot-index] {
        width: 50vw !important;
        scroll-snap-align: start;
        scroll-margin-left: 50vw;
    }
    .mobile-mode .table-fixed thead th:first-child,
    .mobile-mode .table-fixed tbody td:first-child {
        position: sticky;
        left: 0;
        width: 50vw !important;
        min-width: 50vw;
        max-width: 50vw;
        z-index: 3;
        background-color: #fff;
    }
    .mobile-mode .table-fixed thead th:first-child {
        background-color: #e9ecef;
        z-index: 4;
    }
    /* full subject name wraps onto as many lines as needed */
    .mobile-mode .table-fixed tbody td:first-child {
        white-space: normal !important;
        overflow: visible;
        text-overflow: clip;
        word-break: break-word;
    }
    /* "Всего" moved under the subject name in the template — hide the column */
    .mobile-mode .table-fixed thead th:last-child,
    .mobile-mode .table-fixed tbody td:last-child {
        display: none;
    }
    .mobile-mode .table-fixed tbody td {
        min-height: 3.5rem;
    }
}
