:root {
    --sidebar: #14212e;
    --sidebar-2: #0f1a24;
    --brand: #0fac9c;
    --brand-d: #0a8a7d;
    --orange: #f26522;
    --ink: #1c2b39;
    --muted: #6b7b8a;
    --line: #e8ecf1;
    --bg: #f4f6f9;
    --up: #0fac6c;
    --down: #e7413a;
    --card-r: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c8d2dc; border-radius: 8px; }
.text-brand { color: var(--brand) !important; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- layout shell ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex: 0 0 240px;
    background: var(--sidebar);
    color: #aeb9c4;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;
}

.sidebar::-webkit-scrollbar-thumb { background: #33424f; }

.brandbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    position: sticky;
    top: 0;
    background: var(--sidebar);
    z-index: 5;
}

.brandbar .logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    font-size: 20px;
    color: #fff;
}

.brandbar .logo .mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand), #1ec8b4);
    color: #fff;
    font-size: 15px;
}

.nav-group { padding: 2px 12px; }

.nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #5f7182;
    font-weight: 700;
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 9px;
    color: #aeb9c4;
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 1px;
    cursor: pointer;
}

.nav-item i:first-child { width: 18px; text-align: center; font-size: 14px; color: #7b8b99; }
.nav-item:hover { background: #1c2c3a; color: #fff; }
.nav-item:hover i:first-child { color: #cdd6de; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(15, 172, 156, .35); }
.nav-item.active i:first-child { color: #fff; }

/* ---------- main ---------- */
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 26px;
}

.topbar h5 { margin: 0; font-weight: 800; font-size: 18px; }

.icon-btn {
    border: 1px solid var(--line);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #5b6b7a;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    position: relative;
}

.icon-btn .dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--up);
    border: 2px solid #fff;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
}

.content { padding: 26px; display: flex; flex-direction: column; gap: 22px; }

/* ---------- welcome ---------- */
.welcome h1 { font-size: 30px; font-weight: 800; margin: 0; }
.welcome .sub { color: var(--muted); margin-top: 6px; font-size: 13.5px; }

.btn-pos {
    background: var(--orange);
    color: #fff !important;
    border: none;
    border-radius: 9px;
    padding: 9px 18px;
    font-weight: 700;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.btn-pos:hover { background: #d8531a; }

.btn-plain {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 9px;
    padding: 9px 14px;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    color: var(--ink);
}

/* ---------- cards ---------- */
.card2 {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--card-r);
    padding: 20px;
}

.card-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.card-h h3 { font-size: 17px; font-weight: 800; margin: 0; }

.round-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    color: #6b7b8a;
    font-size: 12px;
}

/* ---------- stat strip ---------- */
.statstrip {
    display: flex;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--card-r);
    padding: 8px 0;
}

.statstrip .cell {
    flex: 1 1 0;
    min-width: 180px;
    padding: 12px 22px;
    border-right: 1px solid var(--line);
}

.statstrip .cell:last-child { border-right: none; }
.statstrip .val { font-size: 24px; font-weight: 800; min-height: 30px; }
.statstrip .lbl { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- dark stats card ---------- */
.card-dark {
    background: linear-gradient(160deg, #0f1a24, #14212e);
    border: none;
    color: #fff;
}

.card-dark h3 { color: #fff; }

.tile {
    background: #22323f;
    border-radius: 9px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.tile .t { opacity: .7; font-size: 12px; }
.tile b { font-size: 18px; color: #fff; }

/* ---------- stock alerts list ---------- */
.alert-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #f1f4f7;
}

.alert-row:last-child { border-bottom: none; }

.alert-row .ico {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f2f5f8;
    display: grid;
    place-items: center;
    color: #7c8b99;
    font-size: 15px;
    flex: 0 0 38px;
}

.alert-row .nm { font-weight: 700; font-size: 13.5px; }
.alert-row .rc { color: var(--muted); font-size: 12px; }

.badge-stock {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #54636f;
    white-space: nowrap;
}

.badge-stock .d { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- expired rows ---------- */
.exp-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, #f04e35, #f26f4a);
    color: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.exp-row.warn { background: linear-gradient(90deg, #f6a623, #f2c04a); }

.exp-row .ico {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .2);
    display: grid;
    place-items: center;
}

.exp-row .nm { font-weight: 700; }
.exp-row .rc { font-size: 12px; opacity: .9; }
.exp-row .dt { margin-left: auto; font-weight: 700; font-size: 13px; white-space: nowrap; }

/* ---------- invoice cards ---------- */
.inv-card {
    border-radius: 14px;
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.inv-card .ic {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 16px;
}

.inv-card .cnt { position: absolute; top: 16px; right: 16px; color: var(--muted); font-size: 12px; font-weight: 600; }
.inv-card .lbl { color: var(--muted); font-weight: 600; margin-top: 16px; }
.inv-card .amt { font-size: 24px; font-weight: 800; margin-top: 2px; }

/* ---------- tables ---------- */
.card2 .table { font-size: 13px; margin-bottom: 0; }
.card2 .table th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom-color: var(--line); }
.card2 .table td { vertical-align: middle; }

.pill { font-size: 11px; font-weight: 700; border-radius: 20px; padding: 3px 12px; display: inline-block; }
.pill-due { background: #fdeceb; color: var(--down); }
.pill-partial { background: #fdf1e6; color: var(--orange); }

/* ---------- tabs ---------- */
.mp-tabs { border-bottom: none; margin-bottom: 0; }

.mp-tabs .nav-link {
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    color: var(--muted);
    font-weight: 700;
    font-size: 13.5px;
    background: #eef1f4;
    margin-right: 6px;
    padding: 10px 18px;
}

.mp-tabs .nav-link.active { background: #fff; color: var(--brand); }

.footer {
    padding: 16px 26px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
    background: #fff;
    margin-top: auto;
}

@media (max-width: 1100px) {
    .sidebar { display: none; }
}
