/* Chilimba Manager - flat, two-color design. No gradients, no box-shadows. */

:root {
    --primary: #1FA463;      /* fresh green - the system's main color */
    --primary-dark: #0C3D26; /* deep green - hover/accent shade */
    --secondary: #F4F1EA;    /* off-white - background color */
    --text: #1E1E1E;
    --white: #FFFFFF;
    --field: #EEEEEE;        /* flat fill for inputs */
    --border: #CFCABE;
    --danger: #A9312A;       /* used only for overdue/late status text */
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--secondary);
    color: var(--text);
}

a {
    color: inherit;
}

/* Layout */

.topbar {
    background: var(--primary);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
}

.brand-logo {
    width: 26px;
    height: 26px;
    flex: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.layout {
    display: flex;
    min-height: calc(100vh - 55px);
}

.sidenav {
    width: 210px;
    background: var(--white);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidenav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    font-weight: bold;
    border-radius: var(--radius);
}

.sidenav a .nav-icon {
    width: 18px;
    height: 18px;
    flex: none;
    color: var(--primary);
}

.sidenav a:hover {
    background: var(--secondary);
}

.sidenav a.active {
    background: var(--primary);
    color: var(--white);
}

.sidenav a.active .nav-icon {
    color: var(--white);
}

.content {
    flex: 1;
    padding: 24px;
}

/* Mobile bottom nav — hidden by default, shown only under the mobile breakpoint below */

.bottomnav {
    display: none;
}

/* Typography */

h1, h2, h3 {
    color: var(--primary);
}

/* Buttons */

.btn {
    display: inline-block;
    padding: 9px 18px;
    border: none;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    border-radius: var(--radius);
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
}

.btn-outline:hover {
    background: var(--white);
    color: var(--primary-dark);
}

.btn-danger {
    background: #FBEAE8;
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: var(--white);
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Cards / panels */

.card {
    background: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--primary);
    color: var(--white);
    padding: 18px;
    border: none;
    border-radius: var(--radius);
}

.stat-box .stat-icon {
    width: 26px;
    height: 26px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-box .stat-value {
    font-size: 28px;
    font-weight: bold;
}

.stat-box .stat-label {
    font-size: 13px;
    text-transform: uppercase;
}

/* Forms */

form .field {
    margin-bottom: 14px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="tel"],
select {
    width: 100%;
    max-width: 420px;
    padding: 9px 10px;
    border: none;
    border-radius: var(--radius);
    background: var(--field);
    color: var(--text);
    font-size: 14px;
}

input:focus, select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 0;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row .field {
    flex: 1;
    min-width: 200px;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
}

th, td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 10px;
    text-align: left;
    font-size: 14px;
}

th {
    background: var(--primary);
    color: var(--white);
}

tr:nth-child(even) {
    background: var(--secondary);
}

/* Status text */

.status-ok {
    color: var(--primary);
    font-weight: bold;
}

.status-late {
    color: var(--danger);
    font-weight: bold;
}

/* Mobile view (phones) — bottom nav replaces the sidebar. Tablet and desktop are untouched above this width. */

@media (max-width: 640px) {
    .topbar {
        padding: 12px 16px;
    }

    .topbar .brand {
        font-size: 17px;
    }

    .user-info span {
        display: none;
    }

    .layout {
        min-height: 0;
    }

    .sidenav {
        display: none;
    }

    .content {
        padding: 16px;
        padding-bottom: 88px;
        overflow-x: auto;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .bottomnav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
        background: var(--white);
        border-top: 1px solid var(--border);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bottomnav a {
        flex: 1 0 auto;
        min-width: 64px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 6px 10px;
        text-decoration: none;
        color: var(--text);
        font-size: 10.5px;
        font-weight: bold;
    }

    .bottomnav a .nav-icon {
        width: 20px;
        height: 20px;
        color: var(--text);
    }

    .bottomnav a.active {
        color: var(--primary);
    }

    .bottomnav a.active .nav-icon {
        color: var(--primary);
    }
}

/* Login page — split layout with icons, using the app's shared primary/primary-dark greens. */

body.login-page {
    background: var(--primary-dark);
}

.login-split {
    min-height: 100vh;
    display: flex;
}

.login-brand {
    flex: 1 1 46%;
    background: var(--primary-dark);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.login-brand-inner {
    max-width: 420px;
}

.brand-mark {
    width: 56px;
    height: 56px;
    color: var(--white);
    margin-bottom: 20px;
}

.brand-mark svg {
    width: 100%;
    height: 100%;
}

.login-brand h1 {
    color: var(--white);
    font-size: 30px;
    margin: 0 0 12px;
}

.brand-tagline {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 36px;
}

.brand-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand-features li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.brand-features strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

.brand-features span {
    display: block;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
}

.feature-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon svg {
    width: 21px;
    height: 21px;
}

.login-form-panel {
    flex: 1 1 54%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-box {
    background: none;
    border: none;
    padding: 0;
    width: 100%;
    max-width: 360px;
}

.login-box h2 {
    color: var(--text);
    margin: 0 0 6px;
    font-size: 22px;
}

.login-sub {
    color: #666;
    font-size: 13.5px;
    margin: 0 0 24px;
}

.input-icon-field .input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrap .input-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: #9AA59C;
    pointer-events: none;
}

.input-icon-field input {
    max-width: none;
    padding-left: 40px;
    padding-right: 40px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: #eee;
}

.input-icon-field input:focus {
    outline: 2px solid var(--primary);
    outline-offset: 0;
}

.input-icon-field input:-webkit-autofill,
.input-icon-field input:-webkit-autofill:hover,
.input-icon-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0px 1000px #eee inset;
    box-shadow: 0 0 0px 1000px #eee inset;
    transition: background-color 9999s ease-in-out 0s;
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 6px;
    color: #9AA59C;
    cursor: pointer;
    display: flex;
}

.toggle-password .icon-eye {
    width: 19px;
    height: 19px;
}

.toggle-password:hover {
    color: var(--primary);
}

.toggle-password.is-showing {
    color: var(--primary);
}

.btn-login {
    width: 100%;
    background: var(--primary);
    border-color: var(--primary);
    height: 42px;
    font-size: 15px;
    margin-top: 6px;
}

.btn-login:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.login-footnote {
    text-align: center;
    font-size: 12.5px;
    color: #888;
    margin: 22px 0 0;
}

@media (max-width: 860px) {
    .login-split {
        flex-direction: column;
    }
    .login-brand {
        padding: 36px 28px;
    }
    .login-form-panel {
        padding: 28px;
    }
}

/* Flash / alerts */

.flash {
    background: #E6F5ED;
    border: none;
    border-radius: var(--radius);
    color: var(--primary-dark);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-weight: bold;
}

.error {
    background: #FBEAE8;
    border: none;
    border-radius: var(--radius);
    color: var(--danger);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-weight: bold;
}

.muted {
    color: #555;
    font-size: 13px;
}
