
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #080d18;
    --sidebar: #0d1525;
    --card: #111c2e;
    --gold: #d6ad60;
    --text: #f4f5f7;
    --muted: #8b98aa;
    --border: #253249;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Cairo', sans-serif;
}

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */

.sidebar {
    width: 250px;
    background: var(--sidebar);
    padding: 30px 20px;
    border-left: 1px solid var(--border);
}

.logo {
    margin-bottom: 45px;
}

.logo h2 {
    color: var(--text);
    letter-spacing: 2px;
    font-size: 25px;
}

.logo h2 span {
    color: var(--gold);
}

.logo p {
    color: var(--muted);
    font-size: 12px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 13px 15px;
    border-radius: 8px;
    transition: 0.3s;
}

nav a:hover,
nav a.active {
    background: #1b2a40;
    color: var(--gold);
}

/* Main */

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

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border);
}

.topbar h2 {
    font-size: 23px;
}

.topbar p,
.welcome p {
    color: var(--muted);
    font-size: 13px;
}

.user {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 8px;
    color: var(--gold);
}

.welcome {
    margin: 35px 0 25px;
}

.welcome h1 {
    font-size: 25px;
    margin-bottom: 5px;
}

/* Statistics */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.stat-card {
    background: linear-gradient(145deg, #142238, #101a2b);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 18px;
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
}

.stat-card p {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 15px;
}

.stat-card h2 {
    color: var(--gold);
    font-size: 25px;
    margin-bottom: 5px;
}

.stat-card span {
    color: var(--muted);
    font-size: 11px;
}

/* Responsive */

@media (max-width: 1000px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 18px;
    }

    .logo {
        margin-bottom: 15px;
    }

    nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    nav a {
        white-space: nowrap;
        font-size: 12px;
    }

    .main-content {
        padding: 20px 14px;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px 10px;
    }

    .stat-card h2 {
        font-size: 19px;
    }

    .topbar h2 {
        font-size: 19px;
    }
}
/* Financial Analytics */

.analytics {
    margin-top: 40px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading p {
    color: var(--muted);
    font-size: 13px;
}

.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.chart-header select {
    background: var(--sidebar);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 9px;
    border-radius: 7px;
}

.chart {
    height: 230px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.bar {
    width: 9%;
    background: linear-gradient(
        to top,
        #a77b35,
        #e5c477
    );
    border-radius: 7px 7px 0 0;
    position: relative;
    transition: 0.3s;
}

.bar:hover {
    filter: brightness(1.3);
}

.bar span {
    position: absolute;
    bottom: -30px;
    right: 50%;
    transform: translateX(50%);
    color: var(--muted);
    font-size: 10px;
}
.chart-feedback {
    margin-top: 45px;
    color: var(--gold);
    font-size: 13px;
    text-align: center;
}

.bar {
    cursor: pointer;
}

.bar.selected {
    outline: 2px solid white;
    outline-offset: 3px;
}

/* Finance Management */

.finance {
    margin-top: 40px;
}

.finance-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 25px;
}

.finance-card,
.transaction-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
}

.finance-card p {
    color: var(--muted);
    font-size: 13px;
}

.finance-card h2 {
    color: var(--gold);
    margin: 12px 0 5px;
    font-size: 24px;
}

.finance-card span {
    color: var(--muted);
    font-size: 11px;
}

.transaction-card {
    margin-bottom: 20px;
}

.transaction-card h3 {
    margin-bottom: 20px;
}

#financeForm {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
}

#financeForm input,
#financeForm select {
    min-width: 0;
    background: var(--sidebar);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: inherit;
}

#financeForm button {
    background: var(--gold);
    color: #080d18;
    border: none;
    border-radius: 8px;
    padding: 12px 18px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}

#financeForm button:hover {
    opacity: 0.85;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.transaction-item small {
    color: var(--muted);
}

.income-value {
    color: #45c78a;
}

.expense-value {
    color: #ed7777;
}

@media (max-width: 800px) {
    .finance-cards {
        grid-template-columns: 1fr;
    }

    #financeForm {
        grid-template-columns: 1fr;
    }
}

/* Customer Debts */

.debts {
    margin-top: 40px;
}

.debt-summary {
    background: linear-gradient(145deg, #142238, #101a2b);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.debt-summary p,
.debt-summary span {
    color: var(--muted);
    font-size: 13px;
}

.debt-summary h2 {
    color: var(--gold);
    font-size: 28px;
    margin: 10px 0;
}

#debtForm {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 12px;
}

#debtForm input {
    min-width: 0;
    background: var(--sidebar);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: inherit;
}

#debtForm button,
.pay-debt {
    background: var(--gold);
    color: #080d18;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}

.debt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.debt-item strong {
    color: #ed7777;
}

.debt-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 650px) {
    #debtForm {
        grid-template-columns: 1fr;
    }

    .debt-item {
        flex-wrap: wrap;
    }
}

/* Sales Management */

.sales {
    margin-top: 40px;
}

#salesForm {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
}

#salesForm input {
    min-width: 0;
    background: var(--sidebar);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: inherit;
}

#salesForm button {
    background: var(--gold);
    color: #080d18;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}

.sales-table-wrapper {
    overflow-x: auto;
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    margin: 15px 0;
}

.sales-table th,
.sales-table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.sales-table th {
    color: var(--gold);
    font-size: 13px;
}

.sales-table td {
    color: var(--text);
    font-size: 13px;
}

#salesEmpty {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    padding: 15px;
}

@media (max-width: 700px) {
    #salesForm {
        grid-template-columns: 1fr;
    }
}

/* Inventory Management */

.inventory {
    margin-top: 40px;
}

#inventoryForm {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
}

#inventoryForm input {
    min-width: 0;
    background: var(--sidebar);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    font-family: inherit;
}

#inventoryForm button {
    background: var(--gold);
    color: #080d18;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
}

.stock-low {
    color: #ed7777;
}

.stock-available {
    color: #45c78a;
}

@media (max-width: 700px) {
    #inventoryForm {
        grid-template-columns: 1fr;
    }
}


/* Authentication and account controls */
[hidden] { display: none !important; }
.auth-gate { min-height:100vh; display:grid; place-items:center; padding:24px; background:var(--bg); }
.auth-card { width:min(100%,430px); background:var(--card); border:1px solid var(--border); border-radius:16px; padding:30px; text-align:center; }
.auth-card h1 { margin-bottom:8px; letter-spacing:2px; }
.auth-card h1 span { color:var(--gold); }
.auth-card p { color:var(--muted); font-size:13px; margin-bottom:18px; }
.auth-card form { display:grid; gap:12px; }
.auth-card input { width:100%; background:var(--sidebar); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:13px; font:inherit; }
.auth-card form button, .logout-button { background:var(--gold); color:#080d18; border:0; border-radius:8px; padding:11px 16px; font:inherit; font-weight:700; cursor:pointer; }
.auth-toggle { margin-top:14px; background:transparent; color:var(--gold); border:0; cursor:pointer; font:inherit; }
.auth-card .auth-message { margin:14px 0 0; }
.user { display:flex; align-items:center; gap:12px; }
.logout-button { padding:6px 10px; font-size:12px; }
