* {
    box-sizing: border-box;
}

:root {
    --orange: #f57c00;
    --orange-light: #ff9f1c;
    --dark-green: #0c3b2e;
    --dark-green-soft: #145a45;
    --cream: #fef7ea;
    --text-dark: #1b1b1b;
    --text-light: #f9f9f9;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: radial-gradient(circle at top left, #fff4df 0%, #f4f9f6 40%, #eaf4ef 100%);
    margin: 0;
    color: var(--text-dark);
    min-height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 40px;
    background: linear-gradient(120deg, var(--dark-green) 0%, #0f4d3b 60%, var(--orange) 100%);
    color: var(--text-light);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

.brand-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 12px;
}

/* MBill dropdown menu (Administration -> Masters) */
.menus .dropdown { position: relative; }
.menus .dropdown .dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: 36px;
    background: #fff;
    min-width: 240px;
    border: 1px solid #e6e6e6;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    border-radius: 6px;
    z-index: 2000;
    padding: 10px;
}
.menus .dropdown:hover .dropdown-content { display: block; }
.top-bar, .topbar { z-index: 1200; overflow: visible; }

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 8px 16px;
    border-radius: 25px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.user-profile-link:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.user-profile-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.user-profile-link:hover .user-profile-photo {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.brand-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo img {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.5);
    padding: 6px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.top-logo {
    display: flex;
    justify-content: center;
    padding: 16px 0 6px;
}

.top-logo img {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    box-shadow: 0 12px 24px rgba(12, 59, 46, 0.2);
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--orange-light);
    box-shadow: 0 0 8px rgba(255, 159, 28, 0.8);
}

.brand-title {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.6px;
}

.welcome-user {
    font-weight: 600;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.home-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.home-icon svg {
    width: 20px;
    height: 20px;
}

.brand-tag {
    font-weight: 700;
    font-size: 1rem;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    text-transform: uppercase;
    letter-spacing: 1px;
}


.page {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 50px 40px 100px;
    align-items: start;
}

.login-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 32px 30px;
    box-shadow: 0 16px 40px rgba(12, 59, 46, 0.18);
    border: 1px solid rgba(12, 59, 46, 0.12);
    order: 2;
}

.card-header h1 {
    margin: 0 0 6px;
    color: var(--dark-green);
}

.card-header p {
    margin: 0 0 20px;
    color: #4c625c;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.helper-row {
    display: flex;
    justify-content: flex-end;
}

.link-btn {
    background: none;
    border: none;
    color: var(--dark-green);
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
    font-size: 0.9rem;
}

.link-btn:hover {
    color: var(--orange);
}

.input-label {
    font-weight: 600;
    color: var(--dark-green-soft);
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
select {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(12, 59, 46, 0.2);
    font-size: 1rem;
    outline: none;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--dark-green-soft) 50%), linear-gradient(135deg, var(--dark-green-soft) 50%, transparent 50%);
    background-position: calc(100% - 20px) calc(1.2em), calc(100% - 14px) calc(1.2em);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
select:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(245, 124, 0, 0.2);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--dark-green-soft);
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toggle-btn:hover {
    color: var(--orange);
}

.toggle-btn svg {
    width: 20px;
    height: 20px;
}

.toggle-btn .icon-eye-off {
    display: none;
}

.toggle-btn.is-hidden .icon-eye {
    display: none;
}

.toggle-btn.is-hidden .icon-eye-off {
    display: inline-flex;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dark-green-soft);
}

.remember-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--orange);
}

.primary-btn {
    margin-top: 6px;
    background: linear-gradient(120deg, var(--orange) 0%, var(--orange-light) 100%);
    color: #fff;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(245, 124, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(245, 124, 0, 0.3);
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--dark-green);
    background: rgba(12, 59, 46, 0.08);
    border: 1px solid rgba(12, 59, 46, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.secondary-btn:hover {
    transform: translateY(-1px);
    background: rgba(12, 59, 46, 0.15);
    box-shadow: 0 8px 18px rgba(12, 59, 46, 0.15);
}

.helper-text {
    font-size: 0.9rem;
    color: #6b7c77;
    margin: 4px 0 0;
}

.error-message {
    margin-top: 12px;
    color: #b00020;
    font-weight: 600;
}

.side-panel {
    background: var(--dark-green);
    color: var(--text-light);
    border-radius: 22px;
    padding: 32px;
    box-shadow: 0 18px 36px rgba(12, 59, 46, 0.3);
    order: 1;
}

.side-panel-header {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.side-logo {
    width: 260px;
    height: 260px;
    border-radius: 28px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.12);
    padding: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.side-panel h2 {
    margin: 0 0 6px;
    color: #ffd9b0;
}

.side-panel p {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
}

.side-highlights {
    margin-top: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
}


.home-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 26px;
    align-items: start;
}

.home-logo-wrap {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.home-logo {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    box-shadow: 0 12px 24px rgba(12, 59, 46, 0.2);
}

.home-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 24px;
    border-left: 6px solid var(--orange);
    box-shadow: 0 10px 24px rgba(12, 59, 46, 0.18);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.5);
    /* Partner select enhanced appearance */
    .partner-select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        display: inline-block;
        width: 100%;
        max-width: 720px;
        padding: 10px 44px 10px 16px;
        height: 46px;
        line-height: 1.2;
        border-radius: 12px;
        border: 1px solid rgba(12, 59, 46, 0.14);
        background: linear-gradient(180deg, #ffffff, #fbfbfb) no-repeat right 12px center/18px 18px, linear-gradient(180deg, #ffffff, #fbfbfb);
        /* custom caret svg */
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><polyline points='6 9 12 15 18 9' fill='none' stroke='%230c3b2e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>"), linear-gradient(180deg, #ffffff, #fbfbfb);
        background-position: right 14px center, 0 0;
        background-repeat: no-repeat, repeat;
        box-shadow: 0 8px 26px rgba(12,59,46,0.06);
        font-weight: 700;
        color: var(--dark-green);
        font-size: 0.98rem;
        transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    }
    .partner-select:focus {
        outline: none;
        border-color: var(--orange);
        box-shadow: 0 12px 30px rgba(245,124,0,0.14);
        transform: translateY(-1px);
    }

    /* Make the partner select visually consistent on small screens */
    @media (max-width: 640px) {
        .partner-select { max-width: 100%; }
    }
}

.admin-panel-btn {
    display: none;
    background: rgba(255, 159, 28, 0.3);
    color: var(--text-light);
    border: 1px solid rgba(255, 159, 28, 0.5);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.admin-panel-btn svg {
    width: 18px;
    height: 18px;
}

.admin-panel-btn:hover {
    background: rgba(255, 159, 28, 0.5);
    border-color: rgba(255, 159, 28, 0.7);
}

#mobile-admin-panel-btn {
    display: none;
}

.home-btn-admin {
    background: rgba(255, 255, 255, 0.3);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    margin-right: 10px;
}

.home-btn-admin svg {
    width: 18px;
    height: 18px;
}

.home-btn-admin:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

.footer {
    padding: 20px 40px 30px;
    text-align: center;
    color: #51615c;
    position: static;
    background: #f5f5f5;
    margin-top: 40px;
    border-top: 1px solid #e0e0e0;
}

/* Mobile Menu Styles */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu.active {
    display: block;
    opacity: 1;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(120deg, var(--dark-green) 0%, #0f4d3b 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-menu-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.mobile-menu-close svg {
    width: 24px;
    height: 24px;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-content {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    z-index: 10000;
}

.mobile-menu.active .mobile-menu-content {
    left: 0;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 20px;
    color: var(--dark-green);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-item svg {
    width: 22px;
    height: 22px;
    stroke: var(--dark-green);
}

.mobile-menu-item:hover {
    background: #f8f8f8;
}

.mobile-menu-item.mobile-logout {
    color: #d32f2f;
}

.mobile-menu-item.mobile-logout svg {
    stroke: #d32f2f;
}

@media (max-width: 720px) {
    .mobile-menu-toggle {
        display: block;
    }

    .top-bar {
        padding: 16px 20px;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 12px;
    }

    .brand-left {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    .header-center {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-start;
    }

    .header-logo {
        position: absolute;
        top: 16px;
        right: 20px;
    }

    .header-logo img {
        width: 45px;
        height: 45px;
    }

    .brand-right {
        display: none !important;
    }

    .welcome-user {
        font-size: 0.9rem;
    }

    .page {
        padding: 30px 20px;
    }

    .login-card,
    .side-panel {
        order: initial;
    }
}