/* =========================================================
   RESET
========================================================= */
.main {
    width: 100%;
    min-height: calc(100vh - 72px);

    background:
        radial-gradient(
            circle at 15% 25%,
            rgba(37, 99, 235, 0.05),
            transparent 30%
        ),
        radial-gradient(
            circle at 85% 70%,
            rgba(59, 130, 246, 0.04),
            transparent 30%
        ),
        #f5f7fb;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
}

body {
    width: 100%;
    min-height: 100vh;

    font-family: Arial, Helvetica, sans-serif;

    color: #1f2937;

    overflow-x: hidden;

    background:
        radial-gradient(
            circle at 0% 0%,
            rgba(37, 99, 235, 0.08),
            transparent 28%
        ),
        radial-gradient(
            circle at 100% 15%,
            rgba(59, 130, 246, 0.06),
            transparent 25%
        ),
        #f5f7fb;
}
a {
    text-decoration: none;
    color: inherit;
}

button,
input,
select,
textarea {
    font-family: inherit;
}


/* =========================================================
   COLORS
========================================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;

    --background: #f5f7fb;
    --surface: #ffffff;

    --text: #1f2937;
    --muted: #6b7280;

    --border: #e5e7eb;

    --success: #16a34a;
    --danger: #dc2626;
}


/* =========================================================
   APP
========================================================= */

.app {
    width: 100%;
    min-height: 100vh;
}


/* =========================================================
   TOP NAVIGATION
========================================================= */

.topbar {
    width: 100%;
    min-height: 72px;

    background: #ffffff;

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;

    gap: 30px;

    padding: 12px 28px;

    position: sticky;
    top: 0;

    z-index: 1000;
}


/* =========================================================
   BRAND
========================================================= */

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;

    border-radius: 10px;

    background: var(--primary);
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: bold;
    font-size: 20px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text strong {
    font-size: 16px;
    white-space: nowrap;
}

.logo-text span {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}


/* =========================================================
   NAVIGATION
========================================================= */

.navigation {
    display: flex;
    align-items: center;

    gap: 5px;

    flex: 1;
    min-width: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 7px;

    padding: 10px 12px;

    border-radius: 8px;

    color: #4b5563;

    font-size: 14px;

    white-space: nowrap;

    transition: 0.2s ease;
}

.nav-link:hover {
    background: #eff6ff;
    color: var(--primary);
}


/* =========================================================
   USER AREA
========================================================= */

.user-area {
    display: flex;
    align-items: center;
    gap: 10px;

    flex-shrink: 0;
}

.user-avatar {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: var(--primary);
    color: white;

    display: flex;
    align-items: center;
    justify-content: center;

    font-weight: bold;
}

.user-info {
    display: flex;
    flex-direction: column;

    min-width: 70px;
}

.user-info strong {
    font-size: 13px;
    white-space: nowrap;
}

.user-info span {
    color: var(--muted);
    font-size: 11px;
}

.logout-link {
    color: var(--danger);

    font-size: 13px;
    font-weight: 600;

    white-space: nowrap;

    padding: 8px;
}

.logout-link:hover {
    background: #fee2e2;
    border-radius: 6px;
}


/* =========================================================
   MAIN
========================================================= */

.main {
    width: 100%;
    min-height: calc(100vh - 72px);

    background: var(--background);
}


/* =========================================================
   PAGE TITLE
========================================================= */

.page-title-bar {
    width: 100%;
    padding: 24px 28px 0;
}

.page-title-bar h1 {
    font-size: 22px;
    font-weight: 600;
}


/* =========================================================
   CONTENT
========================================================= */

.content {
    width: 100%;
    max-width: 100%;

    padding: 24px 28px 40px;

    overflow: hidden;
}


/* =========================================================
   PAGE HEADER
========================================================= */

.page-header {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 24px;
}

.page-header h2 {
    font-size: 20px;
}

.page-header p {
    color: var(--muted);
    margin-top: 5px;
}


/* =========================================================
   DASHBOARD STATS
========================================================= */

.stats-grid {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(220px, 1fr));

    gap: 18px;

    margin-bottom: 28px;
}


/* =========================================================
   CARDS
========================================================= */

.card {
    width: 100%;
    min-width: 0;
    max-width: 100%;

    background: #ffffff;

    /* Clearly visible border */
    border: 1.5px solid #cbd5e1;

    border-radius: 12px;

    padding: 20px;

    overflow-wrap: break-word;

    /* Slight separation from page */
    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.06);

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.card:hover {
    border-color: #94a3b8;

    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.09);
}


/* =========================================================
   STAT CARDS
========================================================= */

.stat-card {
    display: flex;

    flex-direction: column;

    gap: 8px;

    background: #ffffff;

    border: 1.5px solid #cbd5e1;

    border-radius: 12px;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.06);
}

.stat-card:hover {
    border-color: #93c5fd;

    box-shadow:
        0 4px 14px rgba(37, 99, 235, 0.10);
}


/* =========================================================
   STAT TEXT
========================================================= */

.stat-label {
    color: #6b7280;

    font-size: 13px;
}

.stat-value {
    color: #1f2937;

    font-size: 28px;

    font-weight: 700;
}


/* =========================================================
   BUTTONS
========================================================= */

.btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 11px 18px;

    min-height: 42px;

    border-radius: 8px;

    border: 1px solid transparent;

    cursor: pointer;

    font-weight: 600;
    font-size: 14px;

    white-space: nowrap;

    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}


/* PRIMARY */

.btn-primary {
    background: var(--primary);
    color: white;

    border-color: #1d4ed8;
}

.btn-primary:hover {
    background: var(--primary-dark);
}


/* SUCCESS */

.btn-success {
    background: var(--success);
    color: white;

    border-color: #15803d;
}

.btn-success:hover {
    background: #15803d;
}


/* DANGER */

.btn-danger {
    background: var(--danger);
    color: white;

    border-color: #b91c1c;
}

.btn-danger:hover {
    background: #b91c1c;
}


/* SECONDARY */

.btn-secondary {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    padding: 10px 16px;

    border-radius: 8px;

    border: 1px solid var(--border);

    background: white;

    color: var(--text);

    font-weight: 600;

    font-size: 14px;
}

.btn-secondary:hover {
    background: #f9fafb;
}


/* =========================================================
   TABLES
========================================================= */

.table-container {
    width: 100%;
    max-width: 100%;

    background: white;

    border: 1px solid #dfe3e8;

    border-radius: 12px;

    overflow-x: auto;
}

table {
    width: 100%;

    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;

    text-align: left;

    border-bottom: 1px solid var(--border);
}

th {
    font-size: 12px;

    color: var(--muted);

    text-transform: uppercase;

    font-weight: 600;
}

td {
    font-size: 14px;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: #f9fafb;
}


/* =========================================================
   TRANSACTION COLORS
========================================================= */

.transaction-sale {
    display: inline-block;

    padding: 5px 10px;

    border-radius: 6px;

    background: #dcfce7;

    color: #166534;

    font-weight: 700;

    font-size: 12px;
}

.transaction-purchase {
    display: inline-block;

    padding: 5px 10px;

    border-radius: 6px;

    background: #dbeafe;

    color: #1e40af;

    font-weight: 700;

    font-size: 12px;
}


/* =========================================================
   FORMS
========================================================= */

.form-card {
    width: 100%;
    max-width: 700px;

    background: white;

    border: 1px solid var(--border);

    border-radius: 12px;

    padding: 25px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    font-weight: 600;

    font-size: 14px;
}

.form-control {
    width: 100%;

    padding: 11px 12px;

    border: 1px solid var(--border);

    border-radius: 7px;

    outline: none;

    background: white;

    color: var(--text);
}

.form-control:focus {
    border-color: var(--primary);

    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10);
}


/* =========================================================
   ALERTS
========================================================= */

.alert {
    width: 100%;

    padding: 12px;

    border-radius: 8px;

    margin-bottom: 18px;
}


/* =========================================================
   QUICK ACTION CARDS
========================================================= */

.quick-action-card {
    display: flex;

    flex-direction: column;

    min-height: 190px;
}

.quick-action-card h3 {
    margin-bottom: 8px;
}

.quick-action-card p {
    color: var(--muted);

    line-height: 1.5;

    margin-bottom: 18px;
}

.quick-action-card .btn {
    align-self: flex-start;

    margin-top: auto;
}


/* =========================================================
   TRANSACTION FILTERS
========================================================= */

.transaction-filter-card {
    margin-bottom: 20px;
}

.transaction-filter {
    display: flex;

    align-items: flex-end;

    gap: 16px;

    flex-wrap: wrap;
}

.filter-group {
    min-width: 180px;
}

.filter-group label {
    display: block;

    margin-bottom: 7px;

    font-size: 13px;

    font-weight: 600;

    color: var(--text);
}

.transaction-filter .form-control {
    width: auto;

    min-width: 180px;
}

.filter-buttons {
    display: flex;

    gap: 10px;
}


/* =========================================================
   LOGIN
========================================================= */

.login-page {
    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    background: var(--background);
}

.login-card {
    width: 100%;

    max-width: 420px;

    background: white;

    padding: 35px;

    border-radius: 15px;

    border: 1px solid var(--border);

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.login-logo {
    text-align: center;

    margin-bottom: 30px;
}

.login-logo h1 {
    margin-top: 12px;

    font-size: 24px;
}

.login-logo p {
    color: var(--muted);

    margin-top: 5px;
}

.login-card input {
    width: 100%;

    padding: 12px;

    border: 1px solid var(--border);

    border-radius: 8px;

    margin-top: 7px;
}

.login-card button {
    width: 100%;

    margin-top: 10px;
}

.error-message {
    background: #fee2e2;

    color: #991b1b;

    padding: 12px;

    border-radius: 8px;

    margin-bottom: 18px;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1100px) {

    .topbar {
        gap: 15px;

        padding-left: 18px;
        padding-right: 18px;
    }

    .navigation {
        gap: 2px;
    }

    .nav-link {
        padding: 8px;

        font-size: 13px;
    }

    .user-info {
        display: none;
    }

    .content {
        padding-left: 20px;
        padding-right: 20px;
    }

    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .topbar {
        min-height: auto;

        padding: 12px 14px;

        flex-wrap: wrap;

        gap: 10px;
    }

    .brand {
        flex: 1;

        min-width: 0;
    }

    .logo-text {
        display: none;
    }

    .user-area {
        margin-left: auto;

        flex-shrink: 0;
    }

    .user-info {
        display: none;
    }

    .logout-link {
        display: inline-block;

        padding: 8px 10px;

        font-size: 13px;

        white-space: nowrap;
    }

    .navigation {
        order: 3;

        flex-basis: 100%;

        width: 100%;

        display: flex;

        overflow-x: auto;

        gap: 4px;

        padding-bottom: 4px;

        scrollbar-width: thin;
    }

    .nav-link {
        flex-shrink: 0;

        padding: 9px 11px;

        font-size: 13px;
    }

    .page-title-bar {
        padding: 20px 16px 0;
    }

    .content {
        padding: 20px 16px 30px;
    }

    .stats-grid {
        grid-template-columns: 1fr;

        gap: 15px;
    }

    .card {
        width: 100%;

        padding: 18px;
    }

    .page-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 10px;
    }

    .transaction-filter {
        flex-direction: column;

        align-items: stretch;
    }

    .filter-group {
        width: 100%;

        min-width: 0;
    }

    .transaction-filter .form-control {
        width: 100%;

        min-width: 0;
    }

    .filter-buttons {
        width: 100%;
    }

    .filter-buttons .btn,
    .filter-buttons .btn-secondary {
        flex: 1;
    }

    .quick-action-card {
        min-height: 175px;
    }
}


/* =========================================================
   SMALL SCREENS
========================================================= */

@media (max-width: 600px) {

    .content {
        padding-left: 12px;
        padding-right: 12px;
    }

    .page-title-bar {
        padding-left: 12px;
        padding-right: 12px;
    }

    .card {
        padding: 16px;
    }

    .btn {
        min-height: 44px;

        padding: 11px 16px;
    }

    th,
    td {
        padding: 11px 12px;
    }
}/* =========================================================
   PAYMENT STATUS
========================================================= */

.payment-paid {
    display: inline-block;

    padding: 5px 10px;

    border-radius: 6px;

    background: #dcfce7;

    color: #166534;

    font-size: 12px;

    font-weight: 700;
}

.payment-credit {
    display: inline-block;

    padding: 5px 10px;

    border-radius: 6px;

    background: #fef3c7;

    color: #92400e;

    font-size: 12px;

    font-weight: 700;
}


/* =========================================================
   TRANSACTION TABLE
========================================================= */

.transaction-filter-card {
    margin-bottom: 20px;
}

.transaction-filter {
    display: flex;

    align-items: flex-end;

    gap: 16px;

    flex-wrap: wrap;
}

.filter-group {
    min-width: 180px;
}

.filter-buttons {
    display: flex;

    gap: 10px;
}


/* =========================================================
   MOBILE TRANSACTIONS
========================================================= */

@media (max-width: 768px) {

    .transaction-filter {
        flex-direction: column;

        align-items: stretch;
    }

    .filter-group {
        width: 100%;

        min-width: 0;
    }

    .transaction-filter .form-control {
        width: 100%;
    }

    .filter-buttons {
        width: 100%;
    }

    .filter-buttons .btn {
        flex: 1;
    }
}/* =========================================================
   CREDIT PAGES
========================================================= */

.credit-page-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 20px;
}

.credit-page-header h2 {
    font-size: 20px;
}

.credit-page-header p {
    color: var(--muted);

    margin-top: 5px;
}

.credit-filter-buttons {
    display: flex;

    gap: 8px;

    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 12px;

    min-height: 36px;

    font-size: 13px;
}

.credit-cleared-text {
    color: #166534;

    font-weight: 600;

    font-size: 13px;
}


/* =========================================================
   CREDIT TABLE
========================================================= */

.credit-page-header + .table-container {
    border: 1.5px solid #cbd5e1;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .credit-page-header {
        align-items: flex-start;

        flex-direction: column;
    }

    .credit-filter-buttons {
        width: 100%;
    }

    .credit-filter-buttons .btn {
        flex: 1;

        text-align: center;
    }
}/* =========================================================
CREDIT MANAGEMENT
========================================================= */

.credit-stat-card {
border: 2px solid #d6e3f5;
background: #ffffff;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.08);
}

.credit-paid {
color: #16a34a;
}

.credit-outstanding {
color: #dc2626;
}

.credit-amount {
font-weight: 700;
color: #dc2626;
}

.credit-status {
display: inline-block;
padding: 5px 10px;
border-radius: 7px;
font-size: 12px;
font-weight: 700;
}

.credit-pending {
background: #fef3c7;
color: #92400e;
border: 1px solid #f59e0b;
}

.credit-cleared {
background: #dcfce7;
color: #166534;
border: 1px solid #22c55e;
}

.credit-complete {
color: #16a34a;
font-weight: 700;
font-size: 13px;
}

.btn-small {
padding: 8px 12px;
min-height: 36px;
font-size: 12px;
}

.credit-payment-wrapper {
width: 100%;
display: flex;
justify-content: center;
}

.credit-payment-card {
width: 100%;
max-width: 750px;
border: 2px solid #d6e3f5;
box-shadow: 0 5px 18px rgba(37, 99, 235, 0.10);
}

.credit-summary {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
margin-bottom: 25px;
}

.credit-summary > div {
padding: 15px;
background: #f8fbff;
border: 1px solid #cbdcf2;
border-radius: 9px;
}

.credit-summary span {
display: block;
color: var(--muted);
font-size: 12px;
margin-bottom: 5px;
}

.credit-summary strong {
font-size: 16px;
}

.payment-actions {
display: flex;
gap: 10px;
margin-top: 20px;
}

.payment-actions .btn {
min-width: 140px;
}

.credit-payment-card form p {
margin-bottom: 18px;
}

.credit-payment-card form label {
display: block;
margin-bottom: 7px;
font-weight: 600;
font-size: 14px;
}

.credit-payment-card form input,
.credit-payment-card form select,
.credit-payment-card form textarea {
width: 100%;
padding: 11px 12px;
border: 1px solid #cbd5e1;
border-radius: 8px;
background: #ffffff;
outline: none;
}

.credit-payment-card form input:focus,
.credit-payment-card form select:focus,
.credit-payment-card form textarea:focus {
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

@media (max-width: 768px) {


.credit-summary {
    grid-template-columns: 1fr;
}

.payment-actions {
    flex-direction: column;
}

.payment-actions .btn {
    width: 100%;
}

.btn-small {
    white-space: nowrap;
}


}
.credit-payment-history {
    margin-top: 8px;
}

.credit-payment-history summary {
    cursor: pointer;
    list-style: none;
    display: inline-block;
}

.credit-payment-history summary::-webkit-details-marker {
    display: none;
}

.payment-history-box {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    min-width: 500px;
}

.payment-history-box h4 {
    margin-top: 0;
    margin-bottom: 12px;
}

.payment-history-box table {
    width: 100%;
    border-collapse: collapse;
}

.payment-history-box th,
.payment-history-box td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.payment-history-summary {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

.credit-paid {
    color: #198754;
}

.credit-outstanding {
    color: #dc3545;
}


.site-footer {
margin-top: 60px;
padding: 40px 20px 20px;
background: #111827;
color: #d1d5db;
text-align: center;
}

.footer-content {
max-width: 700px;
margin: 0 auto;
}

.footer-content h3 {
color: white;
font-size: 20px;
margin-bottom: 10px;
}

.footer-content p {
font-size: 14px;
line-height: 1.6;
}

.footer-links {
display: flex;
justify-content: center;
gap: 20px;
flex-wrap: wrap;
margin-top: 20px;
}

.footer-links a {
color: #d1d5db;
text-decoration: none;
font-size: 14px;
}

.footer-links a:hover {
color: white;
}

.footer-bottom {
max-width: 700px;
margin: 30px auto 0;
padding-top: 15px;
border-top: 1px solid #374151;
font-size: 13px;
color: #9ca3af;
}
