:root {
    --primary: #7b2d26;
    --primary2: #a63d32;
    --gold: #c7962d;
    --bg: #f7f4ef;
    --card: #fff;
    --text: #292522;
    --muted: #756e68;
    --border: #e5ded5;
    --green: #2e7d52;
    --red: #b33a3a;
    --shadow: 0 8px 25px rgba(65,45,30,.08);
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    min-height: 76px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
}

.brand,
.userbox {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand h1 {
    font-size: 21px;
    font-weight: 800;
    margin: 0;
}

.brand small {
    font-size: 14px;
    opacity: .82;
}

.logo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    background: #fff3;
    display: grid;
    place-items: center;
}

.role {
    background: #fff2;
    padding: 7px 11px;
    border-radius: 18px;
    font-size: 13px;
}

.userbox {
    font-size: 15px;
}

.logout {
    border: 1px solid #ffffff66;
    border-radius: 8px;
    padding: 8px 12px;
}

.layout {
    display: flex;
    min-height: calc(100vh - 76px);
}

.sidebar {
    width: 245px;
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 18px 12px;
}

.nav {
    display: block;
    padding: 12px 14px;
    border-radius: 9px;
    color: #504944;
    margin: 3px 0;
    font-size: 16px;
    font-weight: 500;
}

.nav:hover {
    background: #f3e8e5;
    color: var(--primary);
    font-weight: 700;
}

.main {
    flex: 1;
    padding: 28px;
    max-width: 1500px;
    margin: auto;
    width: 100%;
    min-width: 0;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.page-title h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 800;
}

.page-title p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 16px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 13px;
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid2 {
    grid-template-columns: 1fr 1fr;
}

.kpis {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 15px;
}

.kpi {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 17px;
}

.kpi .label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.kpi .value {
    font-size: 28px;
    font-weight: 800;
    margin-top: 6px;
}

label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 7px;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d8d0c7;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 16px;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.btn {
    display: inline-block;
    border: 0;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.primary {
    background: var(--primary);
    color: #fff;
}

.secondary {
    background: #f0e9e4;
    color: var(--primary);
}

.actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 17px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.table-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

th {
    background: #faf7f3;
    font-size: 14px;
    font-weight: 800;
}

td {
    font-size: 15px;
}

.notice {
    padding: 11px 13px;
    border-radius: 8px;
    background: #fff8e5;
    border: 1px solid #f0dfab;
    color: #70591e;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 7px 10px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
}

.locked {
    background: #eeeae6;
    color: #665f59;
}

.paid {
    background: #e8f5ed;
    color: var(--green);
}

.danger {
    background: #fae5e5;
    color: var(--red);
}

.danger-text {
    color: var(--red);
    font-size: 13px;
    margin-top: 5px;
}

.delete-user-btn {
    background: #b33a3a;
    color: #fff;
}

.delete-user-btn:hover {
    background: #922f2f;
}

.delete-user-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.user-row-removing {
    opacity: 0;
    transition: opacity .25s ease;
}

.total-box {
    background: #f6eee9;
    border: 1px solid #ead7ce;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 17px;
    font-size: 16px;
}

.total-box strong {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

.seva-row {
    display: grid;
    grid-template-columns: 1.4fr .65fr .8fr 40px;
    gap: 9px;
    align-items: end;
    padding: 10px;
    background: #faf8f5;
    border: 1px solid var(--border);
    border-radius: 9px;
    margin-bottom: 9px;
}

.remove {
    height: 40px;
    border: 0;
    border-radius: 7px;
    background: #f8e5e5;
    color: var(--red);
    cursor: pointer;
}

.spaced {
    margin-top: 18px;
}

.full {
    grid-column: 1 / -1;
}

.small {
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
}

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(
        135deg,
        #f7f0e9,
        #eee3d7
    );
    padding: 16px;
}

.login-card {
    width: min(430px,92vw);
    background: #fff;
    border-radius: 17px;
    padding: 35px;
    box-shadow: 0 20px 60px #4d32221c;
    text-align: center;
}

.login-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #f3e2d8;
    margin: auto;
    display: grid;
    place-items: center;
    font-size: 35px;
}

.login-card .field {
    text-align: left;
    margin-top: 15px;
}

.login-card button {
    width: 100%;
    margin-top: 18px;
}


/* =========================================================
   CUSTOM MESSAGE POPUP
   ========================================================= */

.app-message-overlay {
    position: fixed;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(0, 0, 0, .58);

    z-index: 10000;
}

.app-message-overlay.show {
    display: flex;
}

.app-message-box {
    width: min(520px, 92vw);

    border-radius: 16px;

    padding: 26px;

    box-shadow:
        0 22px 65px rgba(0, 0, 0, .32);

    border: 2px solid transparent;

    background: #fff;
}

.app-message-header h3 {
    margin: 0 0 13px;

    font-size: 25px;

    line-height: 1.2;

    font-weight: 800;
}

.app-message-text {
    font-size: 18px;

    line-height: 1.5;

    font-weight: 600;

    margin-bottom: 23px;
}

.app-message-actions {
    display: flex;

    justify-content: flex-end;
}

.app-message-actions .btn {
    min-width: 100px;
}


/* RED ERROR POPUP */

.app-message-box.error {
    background: #fff0f0;

    border-color: #c62828;
}

.app-message-box.error
.app-message-header h3 {
    color: #b71c1c;
}

.app-message-box.error
.app-message-text {
    color: #8f1f1f;
}

.app-message-box.error
.app-message-actions .btn {
    background: #c62828;

    color: #fff;
}

.app-message-box.error
.app-message-actions .btn:hover {
    background: #a91f1f;
}


/* GREEN SUCCESS POPUP */

.app-message-box.success {
    background: #eefaf1;

    border-color: #2e7d32;
}

.app-message-box.success
.app-message-header h3 {
    color: #1b5e20;
}

.app-message-box.success
.app-message-text {
    color: #255f2a;
}

.app-message-box.success
.app-message-actions .btn {
    background: #2e7d32;

    color: #fff;
}

.app-message-box.success
.app-message-actions .btn:hover {
    background: #256628;
}


/* NEUTRAL POPUP */

.app-message-box.info {
    background: #fff;

    border-color: var(--primary);
}

.app-message-box.info
.app-message-header h3 {
    color: var(--primary);
}

.app-message-box.info
.app-message-text {
    color: var(--text);
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

    .topbar {
        min-height: 64px;
        padding: 8px 12px;
    }

    .brand {
        gap: 8px;
    }

    .brand h1 {
        font-size: 16px;
        line-height: 1.2;
    }

    .brand small {
        font-size: 11px;
    }

    .logo {
        width: 35px;
        height: 35px;
        min-width: 35px;
    }

    .role {
        display: none;
    }

    .userbox > span:not(.role) {
        display: none;
    }

    .logout {
        font-size: 13px;
        padding: 7px 9px;
    }

    .layout {
        min-height: calc(100vh - 64px);
    }

    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;

        width: 100%;
        height: 68px;

        display: flex;
        justify-content: space-around;

        z-index: 100;

        background: #fff;

        border-right: 0;
        border-top: 1px solid var(--border);

        padding: 6px;

        overflow-x: auto;
    }

    .nav {
        min-width: 48px;
        padding: 12px;
        text-align: center;
        font-size: 18px;
    }

    .nav span {
        display: none;
    }

    .main {
        padding:
            14px
            12px
            calc(
                88px
                +
                env(safe-area-inset-bottom)
            );
    }

    .grid2 {
        grid-template-columns: 1fr;
    }

    .kpis {
        grid-template-columns: 1fr 1fr;
    }

    .seva-row {
        grid-template-columns: 1fr;
    }

    .remove {
        width: 100%;
    }

    .page-title {
        align-items: flex-start;
        gap: 10px;
        flex-direction: column;
    }

    .page-title h2 {
        font-size: 25px;
    }

    .section-title {
        font-size: 18px;
    }

    .card {
        padding: 16px;
    }

    input,
    select,
    textarea,
    button {
        font-size: 16px;
    }

    .actions .btn {
        flex: 1 1 150px;
    }

    .app-message-box {
        width: 94vw;

        padding: 21px;

        border-radius: 14px;
    }

    .app-message-header h3 {
        font-size: 22px;
    }

    .app-message-text {
        font-size: 17px;
    }

    .app-message-actions .btn {
        width: 100%;
    }

}


@media (max-width: 390px) {

    .kpis {
        grid-template-columns: 1fr;
    }

    .brand small {
        display: none;
    }

}

/* =========================================================
   MOBILE SLIDE-OUT SIDEBAR - 2026
   Desktop sidebar behaviour is not changed.
   ========================================================= */

.mobile-menu-button {
    display: none;
}

.mobile-sidebar-overlay {
    display: none;
}


/* ---------------------------------------------------------
   PHONE / MOBILE
   --------------------------------------------------------- */

@media (max-width: 700px) {

    .topbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 1300 !important;
    }


    .mobile-menu-button {

        display: inline-flex !important;

        align-items: center;
        justify-content: center;

        min-height: 38px;

        padding: 7px 11px;

        margin-right: 8px;

        border:
            1px solid
            rgba(255,255,255,0.55);

        border-radius: 8px;

        background:
            rgba(255,255,255,0.08);

        color: #ffffff;

        font-size: 14px;
        font-weight: 700;

        cursor: pointer;

        flex: 0 0 auto;

    }


    /*
       Override old mobile rules that hid the sidebar
       or converted it into a bottom icon bar.
    */

    #mobileSidebar.sidebar {

        display: block !important;

        position: fixed !important;

        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        bottom: 0 !important;

        width: min(82vw, 290px) !important;
        height: 100dvh !important;
        min-height: 100vh !important;

        padding:
            calc(86px + env(safe-area-inset-top))
            14px
            calc(20px + env(safe-area-inset-bottom))
            14px !important;

        overflow-y: auto !important;
        overflow-x: hidden !important;

        background: #ffffff !important;

        border-right:
            1px solid
            var(--border) !important;

        border-top: 0 !important;

        box-shadow:
            8px 0 28px
            rgba(0,0,0,0.18);

        z-index: 1250 !important;

        transform:
            translateX(-105%);

        transition:
            transform 0.24s ease;

    }


    body.mobile-sidebar-open
    #mobileSidebar.sidebar {

        transform:
            translateX(0);

    }


    /*
       Restore normal sidebar links on mobile.
    */

    #mobileSidebar.sidebar .nav {

        display: flex !important;

        align-items: center !important;

        justify-content: flex-start !important;

        position: relative !important;

        width: 100% !important;
        height: auto !important;
        min-width: 0 !important;
        min-height: 46px !important;

        margin: 0 0 4px 0 !important;

        padding:
            11px
            12px !important;

        text-align: left !important;

        font-size: 16px !important;

        border-radius: 8px !important;

    }


    #mobileSidebar.sidebar
    .nav span:not(.nav-tip) {

        display: inline !important;

    }


    /*
       Tooltip is not useful in the mobile drawer.
    */

    #mobileSidebar.sidebar
    .nav .nav-tip {

        display: none !important;

    }


    .mobile-sidebar-overlay {

        display: block !important;

        position: fixed;

        inset: 0;

        z-index: 1200;

        background:
            rgba(0,0,0,0.42);

        opacity: 0;

        visibility: hidden;

        pointer-events: none;

        transition:
            opacity 0.2s ease,
            visibility 0.2s ease;

    }


    body.mobile-sidebar-open
    .mobile-sidebar-overlay {

        opacity: 1;

        visibility: visible;

        pointer-events: auto;

    }


    body.mobile-sidebar-open {

        overflow: hidden;

    }


    /*
       Remove old bottom-navigation spacing because
       navigation is now a drawer.
    */

    .main {

        width: 100% !important;

        margin-left: 0 !important;

        padding-bottom:
            calc(
                18px
                +
                env(safe-area-inset-bottom)
            ) !important;

    }

}


/* ---------------------------------------------------------
   DESKTOP / TABLET
   --------------------------------------------------------- */

@media (min-width: 701px) {

    .mobile-menu-button {
        display: none !important;
    }

    .mobile-sidebar-overlay {
        display: none !important;
    }

    #mobileSidebar.sidebar {
        transform: none !important;
    }

}



/* =========================================================
   MOBILE FULL WIDTH FIX - 2026
   ========================================================= */

@media (max-width: 700px) {

    html,
    body {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow-x: hidden !important;
    }

    body {
        position: relative !important;
    }

    .topbar {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .layout {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
    }

    .main {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        margin: 0 !important;

        padding-left: 12px !important;
        padding-right: 12px !important;

        box-sizing: border-box !important;
    }

    .page-title,
    .card,
    .grid,
    .grid2,
    .grid3,
    .kpis,
    form,
    section {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .brand {
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .brand > div:last-child {
        min-width: 0 !important;
    }

    .brand h1,
    .brand small {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    .userbox {
        flex: 0 0 auto !important;
    }

}

