/* ==========================================================================
   Cash Memo - traditional billing/ledger application stylesheet
   Simple, no external frameworks.
   ========================================================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #e8eaed;
    color: #333;
    font-size: 14px;
}

a {
    color: #2d5f8b;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* ==========================================================================
   Top bar
   ========================================================================== */

.topbar {
    background: #2d5f8b;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar .brand {
    font-size: 18px;
    font-weight: bold;
}

.topbar .user {
    font-size: 13px;
}

.topbar a {
    color: #fff;
}


/* ==========================================================================
   Mobile menu button
   Hidden on desktop.
   ========================================================================== */

.menu-toggle {
    display: none;
}


/* ==========================================================================
   Mobile navigation
   Hidden on desktop.
   ========================================================================== */

.mobile-nav {
    display: none;
}


/* ==========================================================================
   Wrapper / layout
   ========================================================================== */

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


/* ==========================================================================
   Sidebar menu
   ========================================================================== */

.sidebar {
    width: 220px;
    background: #f4f6f8;
    border-right: 1px solid #ccc;
    flex-shrink: 0;
    padding: 10px 0;
}

.sidebar ul {
    list-style: none;
}

.sidebar .menu-head {
    padding: 10px 18px;
    font-size: 12px;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
}

.sidebar a.menu-link {
    display: block;
    padding: 9px 18px;
    color: #333;
    border-left: 3px solid transparent;
    font-size: 13px;
}

.sidebar a.menu-link:hover {
    background: #e3e8ee;
    text-decoration: none;
}

.sidebar a.menu-link.active {
    background: #dce6f0;
    border-left-color: #2d5f8b;
    color: #1f4a6e;
    font-weight: bold;
}


/* ==========================================================================
   Main content
   ========================================================================== */

.content {
    flex: 1;
    padding: 20px;
    min-width: 0;
}

h1.page-title {
    font-size: 20px;
    color: #1f3b57;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2d5f8b;
}


/* ==========================================================================
   Panels / cards
   ========================================================================== */

.panel {
    background: #fff;
    border: 1px solid #cfd6dd;
    margin-bottom: 18px;
}

.panel .panel-head {
    background: #f0f3f6;
    border-bottom: 1px solid #cfd6dd;
    padding: 10px 14px;
    font-weight: bold;
    color: #1f3b57;
}

.panel .panel-body {
    padding: 14px;
}


/* ==========================================================================
   Tables
   ========================================================================== */

table.data {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

table.data th {
    background: #2d5f8b;
    color: #fff;
    text-align: left;
    padding: 8px 10px;
    font-weight: bold;
    font-size: 13px;
    border: 1px solid #25507a;
}

table.data td {
    padding: 7px 10px;
    border: 1px solid #d5dbe1;
    font-size: 13px;
}

table.data tr:nth-child(even) {
    background: #f7f9fb;
}

table.data .num {
    text-align: right;
}

table.data .total-row td {
    font-weight: bold;
    background: #eef3f8;
}


/* ==========================================================================
   Forms
   ========================================================================== */

fieldset {
    border: 1px solid #cfd6dd;
    padding: 14px;
    margin-bottom: 18px;
    background: #fff;
}

legend {
    font-weight: bold;
    color: #1f3b57;
    padding: 0 8px;
    font-size: 14px;
}

label {
    display: block;
    margin: 8px 0 4px;
    font-weight: bold;
    font-size: 13px;
}

input[type=text],
input[type=password],
input[type=number],
input[type=date],
select,
textarea {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid #b8c1c9;
    font-size: 14px;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2d5f8b;
    outline: none;
}

.form-row {
    margin-bottom: 10px;
}

.form-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-inline .field {
    flex: 1;
    min-width: 140px;
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-block;
    background: #2d5f8b;
    color: #fff;
    border: 1px solid #25507a;
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;
}

.btn:hover {
    background: #234a6d;
    text-decoration: none;
}

.btn-green {
    background: #2e7d32;
    border-color: #256229;
}

.btn-green:hover {
    background: #246128;
}

.btn-red {
    background: #c62828;
    border-color: #a51f1f;
}

.btn-red:hover {
    background: #9e2020;
}

.btn-orange {
    background: #e65100;
    border-color: #c04400;
}

.btn-orange:hover {
    background: #b94300;
}

.btn-gray {
    background: #757575;
    border-color: #616161;
}

.btn-gray:hover {
    background: #5c5c5c;
}

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


/* ==========================================================================
   Alerts / messages
   ========================================================================== */

.msg-ok {
    background: #e9f7ec;
    color: #1b7d2b;
    border: 1px solid #b6e0bd;
    padding: 10px;
    margin-bottom: 14px;
}

.msg-err {
    background: #fdecec;
    color: #a02020;
    border: 1px solid #f0b9b9;
    padding: 10px;
    margin-bottom: 14px;
}


/* ==========================================================================
   Summary boxes
   ========================================================================== */

.summary-boxes {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.summary-box {
    background: #fff;
    border: 1px solid #cfd6dd;
    padding: 14px;
    min-width: 180px;
    flex: 1;
}

.summary-box .label {
    font-size: 12px;
    color: #777;
    font-weight: bold;
    text-transform: uppercase;
}

.summary-box .value {
    font-size: 22px;
    font-weight: bold;
    color: #1f3b57;
    margin-top: 4px;
}


/* ==========================================================================
   Login
   ========================================================================== */

.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-box {
    width: 360px;
    background: #fff;
    border: 1px solid #cfd6dd;
    padding: 24px;
}

.login-box h1 {
    font-size: 20px;
    color: #1f3b57;
    margin-bottom: 18px;
    text-align: center;
}


/* ==========================================================================
   Filters bar
   ========================================================================== */

.filter-bar {
    background: #fff;
    border: 1px solid #cfd6dd;
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-bar label {
    margin: 0;
    font-weight: normal;
    font-size: 12px;
}

.filter-bar .field {
    min-width: 150px;
}


/* ==========================================================================
   Utility
   ========================================================================== */

.text-right {
    text-align: right;
}

.mt {
    margin-top: 12px;
}

.mb {
    margin-bottom: 12px;
}

.muted {
    color: #777;
}

.clearfix::after {
    content: "";
    display: block;
    clear: both;
}


/* ==========================================================================
   Wide tables
   ========================================================================== */

.table-scroll,
.panel-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table.data,
.panel-body table.data {
    min-width: 560px;
}

.table-scroll table.data {
    min-width: 600px;
}


/* ==========================================================================
   MOBILE NAVIGATION
   Phones: up to 767px
   ========================================================================== */

@media (max-width: 767px) {

    /* ---------------------------------------------------------
       Top bar
       --------------------------------------------------------- */

    .topbar {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        min-height: 56px;
    }

    .topbar .brand {
        flex: 1;
        font-size: 16px;
        min-width: 0;
    }

    .topbar .user {
        font-size: 11px;
        white-space: nowrap;
    }


    /* ---------------------------------------------------------
       Three-line hamburger
       --------------------------------------------------------- */

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        width: 38px;
        height: 38px;

        padding: 4px;
        margin: 0;

        background: transparent;
        border: none;

        cursor: pointer;
        color: #fff;

        flex-shrink: 0;
    }

    .menu-toggle:focus {
        outline: 1px solid rgba(255, 255, 255, 0.7);
        outline-offset: 2px;
    }

    .menu-toggle .hamburger {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
    }

    .menu-toggle .hamburger .bar {
        display: block;
        width: 23px;
        height: 3px;
        background: #fff;
        border-radius: 2px;
    }


    /* ---------------------------------------------------------
       IMPORTANT:
       Hide desktop sidebar completely on mobile.
       --------------------------------------------------------- */

    .wrapper {
        display: block;
        min-height: auto;
    }

    .sidebar {
        display: none !important;
    }


    /* ---------------------------------------------------------
       Mobile navigation dropdown
       --------------------------------------------------------- */

    .mobile-nav {
        display: none;

        width: 100%;

        background: #f4f6f8;

        border-bottom: 1px solid #ccc;

        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);

        position: relative;

        z-index: 9999;

        max-height: calc(100vh - 56px);

        overflow-y: auto;
    }

    .mobile-nav.open {
        display: block;
    }

    .mobile-nav ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mobile-nav .menu-head {
        padding: 10px 18px;

        font-size: 12px;

        font-weight: bold;

        color: #888;

        text-transform: uppercase;

        background: #eceff2;

        border-bottom: 1px solid #d7dce1;
    }

    .mobile-nav li {
        margin: 0;
        padding: 0;
    }

    .mobile-nav a.menu-link {
        display: block;

        padding: 14px 18px;

        color: #333;

        border-left: 4px solid transparent;

        font-size: 15px;

        text-decoration: none;

        background: #f4f6f8;

        -webkit-tap-highlight-color: rgba(45, 95, 139, 0.15);
    }

    .mobile-nav a.menu-link:hover {
        background: #e3e8ee;
        text-decoration: none;
    }

    .mobile-nav a.menu-link.active {
        background: #dce6f0;

        border-left-color: #2d5f8b;

        color: #1f4a6e;

        font-weight: bold;
    }


    /* ---------------------------------------------------------
       Content
       --------------------------------------------------------- */

    .content {
        padding: 12px;
        width: 100%;
    }


    /* ---------------------------------------------------------
       Forms
       --------------------------------------------------------- */

    .form-inline .field {
        min-width: 100%;
    }


    /* ---------------------------------------------------------
       Summary boxes
       --------------------------------------------------------- */

    .summary-box {
        min-width: 100%;
    }


    /* ---------------------------------------------------------
       Login
       --------------------------------------------------------- */

    .login-box {
        width: 100%;
        max-width: 360px;
    }

}


/* ==========================================================================
   SMALL PHONES
   ========================================================================== */

@media (max-width: 400px) {

    .topbar {
        padding: 9px 10px;
    }

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

    .topbar .user {
        font-size: 10px;
    }

    .menu-toggle {
        width: 36px;
        height: 36px;
    }

    .menu-toggle .hamburger .bar {
        width: 22px;
    }

    .content {
        padding: 10px;
    }

    .mobile-nav a.menu-link {
        padding: 13px 15px;
        font-size: 14px;
    }

}


/* ==========================================================================
   DESKTOP
   Everything above 767px uses the normal sidebar.
   ========================================================================== */

@media (min-width: 768px) {

    .menu-toggle {
        display: none !important;
    }

    .mobile-nav {
        display: none !important;
    }

    .sidebar {
        display: block;
    }

}


/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {

    .sidebar,
    .topbar,
    .mobile-nav,
    .menu-toggle {
        display: none !important;
    }

    .wrapper {
        display: block;
    }

    .content {
        padding: 0;
    }

    body {
        background: #fff;
    }

}


.dashboard-filter-head { display:flex; justify-content:space-between; align-items:center; }
.dashboard-range-label { display:inline-block; margin-left:10px; color:#666; font-size:13px; font-weight:400; }
.dashboard-filter { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; padding:0 0 16px; border-bottom:1px solid #eee; margin-bottom:16px; }
.filter-presets { display:flex; gap:7px; flex-wrap:wrap; }
.filter-btn { border:1px solid #ccc; background:#fff; border-radius:6px; padding:8px 12px; cursor:pointer; font-size:13px; }
.filter-btn.active { font-weight:700; box-shadow:0 0 0 1px #999 inset; }
.custom-filter { display:flex; align-items:end; gap:8px; flex-wrap:wrap; }
.custom-filter label { font-size:12px; color:#666; display:flex; flex-direction:column; gap:4px; }
.custom-filter input[type=date] { border:1px solid #ccc; border-radius:5px; padding:7px 8px; min-width:135px; }
.method-state-strip { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-top:16px; }
.method-state-strip > div { border:1px solid #ddd; border-radius:8px; padding:12px; display:flex; justify-content:space-between; align-items:center; background:#fafafa; }
.method-state-strip span { color:#666; font-size:13px; }
.method-state-strip strong { font-size:18px; }
@media (max-width:600px) { .dashboard-filter { align-items:stretch; } .custom-filter { width:100%; } .custom-filter label { flex:1; } .method-state-strip { grid-template-columns:1fr; } .dashboard-range-label { display:block; margin:4px 0 0; } }

/* Payment-method dashboard */
.method-dashboard { margin-bottom: 20px; }
.method-periods { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:15px; }
.method-period { border:1px solid #ddd; border-radius:8px; padding:14px; background:#fafafa; }
.method-period-title { font-weight:700; font-size:14px; }
.method-period-total { font-size:22px; font-weight:800; margin-top:5px; }
.method-cards { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.method-card { border:1px solid #ddd; border-radius:8px; padding:13px; background:#fff; }
.method-card-title { font-weight:800; margin-bottom:10px; }
.method-card-values { display:grid; grid-template-columns:1fr; gap:8px; }
.method-card-values > div { display:grid; grid-template-columns:55px 1fr; align-items:center; }
.method-card-values span { color:#666; font-size:12px; }
.method-card-values strong { text-align:right; font-size:15px; }
.method-card-values small { grid-column:2; text-align:right; color:#888; font-size:11px; }
.method-table-wrap { margin-top:16px; overflow-x:auto; }
.method-table .total-row { background:#f5f5f5; }
@media (max-width: 900px) { .method-cards { grid-template-columns:repeat(2,1fr); } }
@media (max-width: 600px) { .method-periods { grid-template-columns:1fr; } .method-cards { grid-template-columns:1fr; } }


/* Daily Payment component */
.party-payment-card {
    border-left: 4px solid #2e7d32;
    box-shadow: 0 2px 7px rgba(0,0,0,.06);
}
.party-payment-card .panel-head {
    background: #eef8f0;
    color: #245f2a;
}
.party-payment-card input[readonly] {
    cursor: default;
}
.party-payment-card .muted {
    line-height: 1.5;
}
