/* ==========================================================================
   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; }

/* ---------- 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; }

/* ==========================================================================
   Responsive / mobile layout (traditional style preserved, just stacked)
   ========================================================================== */
/* Allow wide tables to scroll horizontally on small screens */
.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; }

@media (max-width: 820px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }
    .topbar .user { font-size: 12px; }

    /* Stack sidebar above content */
    .wrapper {
        display: block;
        min-height: auto;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ccc;
        padding: 6px 0;
        max-height: 260px;
        overflow-y: auto;
    }
    .sidebar .menu-head { padding: 6px 12px; }
    .sidebar a.menu-link { padding: 8px 12px; }

    .content { padding: 12px; }

    .login-box { width: 100%; max-width: 360px; }
    .form-inline .field { min-width: 100%; }
    .summary-box { min-width: 100%; }
}

@media print {
    .sidebar, .topbar { display: none !important; }
    .wrapper { display: block; }
    .content { padding: 0; }
    body { background: #fff; }
}
