/* ================= GLOBAL RESET ================= */
*{
    box-sizing:border-box;
    margin:0;
    padding:0;
}

body{
    font-family: Arial, Helvetica, sans-serif;
    background:#f2f4f7;
    overflow-x:hidden;
}

/* ================= LOGIN ================= */
body.login-body{
    background:linear-gradient(135deg,#ffcccc,#ffe0e0);
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
    padding:15px;
}

.login-box{
    width:800px;
    max-width:100%;
    min-height:280px;
    background:#fff;
    border-radius:10px;
    box-shadow:0 0 30px rgba(0,0,0,0.3);
    display:flex;
    overflow:hidden;
}

.login-left{
    width:50%;
    padding:30px 20px;
    display:flex;
    flex-direction:column;
    justify-content:center;
}

.login-left h2{
    margin-bottom:20px;
    color:#1e3c72;
    font-size:22px;
}

.login-left input{
    width:100%;
    padding:12px;
    margin-bottom:15px;
    border:1px solid #ccc;
    border-radius:5px;
    font-size:14px;
}

.login-left button{
    width:100%;
    padding:12px;
    background:#1e3c72;
    border:none;
    color:#fff;
    font-size:16px;
    border-radius:5px;
    cursor:pointer;
    font-weight:bold;
}

.login-left button:hover{
    background:#16305d;
}

.login-right{
    width:50%;
    background:#f2f2f2;
}

.login-right img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.error{
    color:red;
    margin-bottom:10px;
    font-weight:bold;
}

/* ================= SIDEBAR (DESKTOP) ================= */
.mobile-top-bar {
    display: none;
}

.sidebar{
    width:220px;
    position:fixed;
    top:0;
    left:0;
    height:100vh;
    background:#f2a3a3;
    color:#fff;
    padding:18px 12px;
    z-index:1000;
}

.sidebar h2{
    text-align:center;
    margin-bottom:20px;
    color:#0b5ed7;
    font-size:20px;
}

.sidebar a{
    display:block;
    padding:10px;
    margin-bottom:6px;
    text-decoration:none;
    color:#fff;
    background:#0b5ed7;
    border-radius:5px;
    font-size:14px;
    font-weight:bold;
}

.sidebar a:hover,
.sidebar a.active{
    background:#094db5;
}

/* ================= MAIN (DESKTOP FIT) ================= */
.main{
    margin-left:230px;
    padding:15px;
    width: calc(100% - 240px) !important;
    max-width: calc(100% - 240px) !important;
    box-sizing: border-box !important;
}

/* ================= CARDS (GENERIC) ================= */
.cards{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:20px;
    margin-top:20px;
}

.card{
    background:#ffffff;
    border-radius:10px;
    box-shadow:0 4px 12px rgba(0,0,0,0.08);
    padding:20px;
    margin-bottom:20px;
}

/* ================= DASHBOARD SPECIFIC CONTROLLED WIDTH GRID ================= */
.dash-grid-4 {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin-top: 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.dash-box-item {
    flex: 0 0 calc(25% - 10px) !important;
    max-width: calc(25% - 10px) !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06) !important;
    padding: 12px 14px !important;
    margin-bottom: 0 !important;
    border: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.dash-box-item h2 {
    margin: 0 0 4px 0 !important;
    color: #1e293b !important;
    font-size: 19px !important;
}

.dash-box-item p {
    margin: 0 0 6px 0 !important;
    color: #64748b !important;
    font-weight: bold !important;
    font-size: 12px !important;
}

.dash-download {
    color: #146c43 !important;
    text-decoration: none !important;
    font-size: 11px !important;
    font-weight: bold !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
}
.dash-download:hover {
    text-decoration: underline !important;
}

/* ================= STAFF & ERP FORMS (DESKTOP) ================= */
.staff-form,
.erp-form {
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:10px;
}

.staff-form input,
.staff-form select,
.erp-form input,
.erp-form select,
.erp-form textarea {
    width:100%;
    padding:10px;
    border:1px solid #ccc;
    border-radius:5px;
    font-size:14px;
}

.erp-form textarea{
    grid-column:span 4;
    resize:vertical;
}

.staff-form button,
.erp-form button {
    grid-column:span 4;
    background:#f2a3a3;
    color:#000;
    border:none;
    padding:12px;
    border-radius:5px;
    cursor:pointer;
    font-weight:bold;
}

/* ================= TABLE ================= */
table{
    width:100%;
    border-collapse:collapse;
    background:#fff;
}

th,td{
    padding:10px;
    border:1px solid #ddd;
    font-size:14px;
    text-align:left;
}

th{
    background:#f1f5f9;
    font-weight:600;
}

/* ================= BUTTON ================= */
button{
    background:#f2a3a3;
    color:#000;
    border:none;
    padding:10px 16px;
    border-radius:5px;
    cursor:pointer;
    font-size:14px;
}

button:hover{
    opacity:.9;
}

/* ================= MOBILE & TABLET RESPONSIVE (UP TO 1024px) ================= */
@media(max-width:1024px){
    .login-box {
        flex-direction: column-reverse;
        width: 100%;
        max-width: 400px;
        height: auto;
    }

    .login-left, .login-right {
        width: 100%;
    }

    .login-right {
        height: 180px;
    }

    .login-left {
        padding: 25px 20px;
    }

    .main{
        margin-left:0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding:12px;
    }

    .mobile-top-bar {
        display:flex !important;
        background:#0b5ed7;
        color:#fff;
        padding:12px 15px;
        justify-content:space-between;
        align-items:center;
        position:sticky;
        top:0;
        z-index:99999;
        box-shadow:0 2px 5px rgba(0,0,0,0.2);
    }

    .mobile-top-bar h2 {
        margin:0;
        font-size:18px;
        color:#fff;
    }

    .hamburger-btn {
        background:none;
        border:none;
        color:#fff;
        font-size:26px;
        cursor:pointer;
        padding:0 5px;
        line-height:1;
    }

    .sidebar {
        display:none;
        position:fixed;
        width:100%;
        height:auto;
        top:48px;
        left:0;
        right:0;
        bottom:auto;
        background:#ffffff;
        border-bottom:4px solid #0b5ed7;
        padding:12px;
        box-shadow:0 8px 15px rgba(0,0,0,0.2);
        z-index:99998;
    }

    .sidebar.active,
    .sidebar.show {
        display:block !important;
    }

    .sidebar h2 {
        display:none;
    }

    .sidebar a {
        background:#eef7ff;
        color:#0b5ed7;
        margin-bottom:8px;
        padding:12px;
        border-radius:6px;
        border:1px solid #b6d4fe;
        text-align:left;
    }

    .cards{
        grid-template-columns:repeat(2,1fr);
    }
    .dash-box-item{
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .staff-form,
    .erp-form {
        grid-template-columns: 1fr !important;
    }

    .staff-form input,
    .staff-form select,
    .staff-form button,
    .erp-form input,
    .erp-form select,
    .erp-form textarea,
    .erp-form button {
        grid-column: span 1 !important;
        height: 42px;
        font-size: 14px;
        margin-bottom: 2px;
    }
}

@media(max-width:500px){
    .cards{grid-template-columns:1fr;}
}