:root {
    --green-900: #123c2b;
    --green-800: #18533b;
    --green-700: #1f6b4b;
    --green-600: #27845c;
    --green-100: #e8f5ee;

    --gold: #c7a24a;
    --gold-light: #f5ecd5;

    --bg: #f4f7f5;
    --surface: #ffffff;
    --border: #e2e9e5;

    --text: #17211c;
    --text-soft: #718078;

    --warning: #d97706;
    --warning-bg: #fff7e6;

    --sidebar-width: 255px;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

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

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.epos-layout {
    min-height: 100vh;
}

.main-area {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.page-body {
    padding: 28px 32px 40px;
}

/* ===== SIDEBAR ===== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--green-900) 0%, var(--green-800) 100%);
    color: #ffffff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 26px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--gold);
    color: var(--green-900);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 17px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text strong {
    font-size: 17px;
}

.brand-text span {
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    letter-spacing: 1.5px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 24px;
}

.nav-item {
    padding: 13px 14px;
    border-radius: 11px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 14px;
    font-weight: 600;
    transition: 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.nav-item.active {
    background: var(--gold);
    color: var(--green-900);
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 8px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
}

.user-details strong {
    font-size: 14px;
}

.user-details span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.logout-link {
    display: block;
    padding: 10px 12px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    font-size: 13px;
    font-weight: 600;
}

.logout-link:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}


/* ===== TOP BAR ===== */

.topbar {
    height: 86px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--green-900);
}

.topbar-left p {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--text-soft);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--green-700);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-600);
    box-shadow: 0 0 0 4px rgba(39, 132, 92, 0.12);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 11px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--gold-light);
    color: var(--green-900);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-info strong {
    font-size: 13px;
    color: var(--text);
}

.user-info span {
    font-size: 11px;
    color: var(--text-soft);
}


/* ===== WELCOME PANEL ===== */

.welcome-panel {
    background: linear-gradient(135deg, var(--green-900), var(--green-700));
    color: #ffffff;
    border-radius: var(--radius);
    padding: 28px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-shadow: 0 12px 30px rgba(18, 60, 43, 0.14);
}

.eyebrow {
    display: block;
    color: var(--gold-light);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.6px;
    margin-bottom: 8px;
}

.welcome-panel h2 {
    margin: 0;
    font-size: 25px;
    font-weight: 700;
}

.welcome-panel p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.primary-action {
    background: var(--gold);
    color: var(--green-900);
    padding: 13px 19px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

/* ===== STAT CARDS ===== */

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    box-shadow: 0 5px 18px rgba(18, 60, 43, 0.04);
}

.stat-label {
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
}

.stat-value {
    color: var(--green-900);
    font-size: 25px;
    font-weight: 800;
}

.stat-note {
    color: var(--text-soft);
    font-size: 11px;
}

.stat-card.warning {
    background: var(--warning-bg);
    border-color: rgba(217, 151, 6, 0.22);
}

.stat-card.warning .stat-value {
    color: var(--warning);
}

/* ===== DASHBOARD PANELS ===== */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.dashboard-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 5px 18px rgba(18, 60, 43, 0.04);
    min-height: 220px;
}

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

.panel-heading h3 {
    margin: 0;
    color: var(--green-900);
    font-size: 17px;
    font-weight: 800;
}

.panel-heading p {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 12px;
}

.panel-heading a {
    color: var(--green-700);
    font-size: 12px;
    font-weight: 700;
}

.empty-state {
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    color: var(--text-soft);
}

.empty-state strong {
    color: var(--text);
    font-size: 14px;
}

.empty-state span {
    font-size: 12px;
}
/* ===== RESPONSIVE ===== */

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

@media (max-width: 800px) {
    :root {
        --sidebar-width: 210px;
    }

    .page-body {
        padding: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 20px;
    }

    .topbar-status {
        display: none;
    }
}

/* =========================================================
   HERBAL SHIFA HORIZONTAL LAYOUT
   ========================================================= */

.epos-layout {
    display: block;
    min-height: 100vh;
    background: #f5f7f3;
}

.main-area {
    margin-left: 0;
    width: 100%;
    min-height: auto;
}

/* ===== GREEN BRAND HEADER ===== */

.brand-header {
    min-height: 78px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: linear-gradient(135deg, #17633f 0%, #238348 55%, #17633f 100%);
    color: #ffffff;
    box-shadow: 0 5px 16px rgba(18, 60, 43, 0.20);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 54px;
    height: 46px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e2c168, #cfa647);
    color: #174b34;
    font-size: 17px;
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(0,0,0,.14);
}

.brand-title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-title strong {
    color: #ffffff;
    font-size: 23px;
    font-weight: 900;
}

.brand-title span {
    margin-top: 5px;
    color: #f3e3a7;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
}

.brand-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-user-badge {
    padding: 10px 15px;
    border-radius: 22px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.24);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.header-logout {
    padding: 10px 17px;
    border-radius: 10px;
    background: #ffffff;
    color: #17633f;
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(0,0,0,.12);
}

/* ===== HORIZONTAL MENU ===== */

.horizontal-nav {
    min-height: 60px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex-wrap: wrap;
    background: #fffdf7;
    border-bottom: 1px solid #e5e1d4;
    box-shadow: 0 4px 12px rgba(18, 60, 43, .07);
}

.horizontal-nav-item {
    min-width: 104px;
    padding: 10px 17px;
    border-radius: 9px;
    text-align: center;
    text-decoration: none;
    color: #24523d;
    background: #ffffff;
    border: 1px solid #d8dfd8;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(18,60,43,.06);
    transition: .18s ease;
}

.horizontal-nav-item:hover {
    color: #ffffff;
    background: #238348;
    border-color: #238348;
    transform: translateY(-1px);
}

.horizontal-nav-item.active {
    color: #173f2d;
    background: linear-gradient(135deg, #e2c168, #cfa647);
    border-color: #c79d3f;
    box-shadow: 0 4px 9px rgba(207,166,71,.25);
}

/* ===== DASHBOARD TITLE BAR ===== */

.topbar {
    min-height: 74px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border-bottom: 1px solid #e1e6e1;
}

.topbar-left h1 {
    margin: 0;
    color: #174b34;
    font-size: 22px;
    font-weight: 900;
}

.topbar-left p {
    margin: 4px 0 0;
    color: #718077;
    font-size: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #17633f;
    font-size: 12px;
    font-weight: 800;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2ca76c;
    box-shadow: 0 0 0 4px rgba(44,167,108,.12);
}

/* ===== CONTENT WIDTH ===== */

.page-body {
    width: min(1600px, calc(100% - 40px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 800px) {
    .brand-header {
        padding: 14px 18px;
        align-items: flex-start;
        flex-direction: column;
    }

    .brand-user {
        width: 100%;
        justify-content: space-between;
    }

    .horizontal-nav {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .horizontal-nav-item {
        flex: 0 0 auto;
    }

    .topbar {
        padding: 0 20px;
    }

    .page-body {
        width: calc(100% - 28px);
    }
}

/* ===== HERBAL SHIFA BRAND COLOUR OVERRIDE ===== */

.brand-header {
    background: linear-gradient(135deg, #086522 0%, #16852f 55%, #24963b 100%);
}

.dashboard-hero {
    background: linear-gradient(135deg, #086522 0%, #16852f 55%, #24963b 100%);
}

.horizontal-nav-item.active {
    background: linear-gradient(180deg, #e3bd5b 0%, #d5aa43 100%);
    color: #073d1b;
}

.brand-mark {
    background: linear-gradient(135deg, #e3bd5b, #d5aa43);
    color: #073d1b;
}


/* ===== LIVE WALK-IN & APPOINTMENTS ===== */

.live-appointments-panel {
    margin-top: 20px;
    background: #ffffff;
    border: 1px solid #d9e1da;
    border-radius: 15px;
    padding: 16px;
    box-shadow: 0 3px 10px rgba(0,0,0,.05);
}

.live-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.live-panel-heading h3 {
    margin: 0;
    color: #087a2b;
    font-size: 20px;
    font-weight: 800;
}

.live-indicator {
    color: #078b2e;
    font-size: 14px;
    font-weight: 800;
}

.staff-patient-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.staff-patient-column {
    min-height: 310px;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid;
}

.staff-patient-column h3 {
    margin: 0 0 12px;
    padding-bottom: 10px;
    text-align: center;
    font-size: 17px;
    font-weight: 800;
    border-bottom: 2px solid;
}

.staff-green {
    background: #f0faf3;
    border-color: #9ed9ae;
}

.staff-green h3 {
    color: #087a2b;
    border-color: #159447;
}

.staff-purple {
    background: #faf5ff;
    border-color: #d3b3ef;
}

.staff-purple h3 {
    color: #8436bd;
    border-color: #9a4ed1;
}

.staff-blue {
    background: #f2f7ff;
    border-color: #a9caef;
}

.staff-blue h3 {
    color: #1265b5;
    border-color: #2d7dd2;
}

.staff-orange {
    background: #fff8ed;
    border-color: #efc17c;
}

.staff-orange h3 {
    color: #c46a00;
    border-color: #df820f;
}

.no-patients {
    margin: 28px 0 0;
    color: #68736c;
    font-size: 13px;
}

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

@media (max-width: 600px) {
    .staff-patient-grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   MOBILE SHARED NAVIGATION
   ========================================================= */
@media (max-width: 768px) {

    .brand-header {
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .brand-logo {
        min-width: 0;
    }

    .brand-user {
        margin-left: auto;
    }

    .horizontal-nav {
        display: flex !important;
        overflow-x: auto;
        gap: 8px;
        padding: 8px 10px;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .horizontal-nav-item {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 10px 14px;
    }
}


/* =========================================================
   HERBAL SHIFA - LARGE COLOURED RECTANGULAR NAVIGATION
   Locked visual component.
   ========================================================= */

@media (min-width: 901px) {

    .horizontal-nav {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;

        gap: 10px !important;

        padding: 10px 22px !important;

        width: 100% !important;
        box-sizing: border-box !important;
    }

    .horizontal-nav-item {
        height: 50px !important;
        min-width: 130px !important;

        padding: 0 18px !important;

        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;

        gap: 9px !important;

        border-radius: 10px !important;

        font-size: 15px !important;
        font-weight: 800 !important;

        text-decoration: none !important;

        border: 1px solid rgba(0, 0, 0, 0.09) !important;

        box-shadow:
            0 2px 4px rgba(0,0,0,.07),
            inset 0 1px 0 rgba(255,255,255,.65) !important;

        transition:
            transform .12s ease,
            box-shadow .12s ease,
            filter .12s ease !important;
    }

    .horizontal-nav-item:hover {
        transform: translateY(-1px) !important;
        filter: brightness(.98) !important;

        box-shadow:
            0 4px 8px rgba(0,0,0,.10),
            inset 0 1px 0 rgba(255,255,255,.65) !important;
    }

    .horizontal-nav-item span {
        font-size: 15px !important;
        font-weight: 800 !important;
    }

    /* HOME */
    .horizontal-nav-item:nth-child(1) {
        background: #e8b63f !important;
        border-color: #d6a72e !important;
        color: #173d28 !important;
    }

    /* TILL */
    .horizontal-nav-item:nth-child(2) {
        background: #dceeff !important;
        border-color: #b7d8f7 !important;
        color: #075da8 !important;
    }

    /* STOCK */
    .horizontal-nav-item:nth-child(3) {
        background: #d5f6df !important;
        border-color: #afe8c0 !important;
        color: #075c31 !important;
    }

    /* PATIENTS */
    .horizontal-nav-item:nth-child(4) {
        background: #eadcff !important;
        border-color: #d4bdf7 !important;
        color: #6420a8 !important;
    }

    /* APPOINTMENTS */
    .horizontal-nav-item:nth-child(5) {
        background: #ffdce5 !important;
        border-color: #f5bdcc !important;
        color: #a51335 !important;
    }

    /* REPORTS */
    .horizontal-nav-item:nth-child(6) {
        background: #d9ecff !important;
        border-color: #b6d7f6 !important;
        color: #075ca7 !important;
    }

    /* STAFF */
    .horizontal-nav-item:nth-child(7) {
        background: #ffdccc !important;
        border-color: #f3bfa8 !important;
        color: #9d2815 !important;
    }

    /* RECEIPT */
    .horizontal-nav-item:nth-child(8) {
        background: #cff3ef !important;
        border-color: #a7dfda !important;
        color: #086962 !important;
    }

    /* Active tab */
    .horizontal-nav-item.active {
        box-shadow:
            0 5px 10px rgba(0,0,0,.16),
            inset 0 0 0 2px rgba(255,255,255,.40) !important;

        transform: translateY(-1px) !important;
    }
}


/* Keep existing responsive layout behaviour on smaller screens.
   Only add colours/icons without forcing large desktop widths. */

@media (max-width: 900px) {

    .horizontal-nav-item {
        border-radius: 9px !important;
        gap: 6px !important;
    }

    .horizontal-nav-item:nth-child(1) {
        background: #e8b63f !important;
        color: #173d28 !important;
    }

    .horizontal-nav-item:nth-child(2) {
        background: #dceeff !important;
        color: #075da8 !important;
    }

    .horizontal-nav-item:nth-child(3) {
        background: #d5f6df !important;
        color: #075c31 !important;
    }

    .horizontal-nav-item:nth-child(4) {
        background: #eadcff !important;
        color: #6420a8 !important;
    }

    .horizontal-nav-item:nth-child(5) {
        background: #ffdce5 !important;
        color: #a51335 !important;
    }

    .horizontal-nav-item:nth-child(6) {
        background: #d9ecff !important;
        color: #075ca7 !important;
    }

    .horizontal-nav-item:nth-child(7) {
        background: #ffdccc !important;
        color: #9d2815 !important;
    }

    .horizontal-nav-item:nth-child(8) {
        background: #cff3ef !important;
        color: #086962 !important;
    }
}

/* =========================================================
   FINAL NAV SIZE / BALANCE REFINEMENT
   Visual only
   ========================================================= */

@media (min-width: 901px) {

    .horizontal-nav {
        gap: 12px !important;
        padding: 10px 18px !important;
    }

    .horizontal-nav-item {
        flex: 0 0 140px !important;

        width: 140px !important;
        min-width: 140px !important;
        max-width: 140px !important;

        height: 52px !important;
        min-height: 52px !important;

        padding: 0 14px !important;

        border-radius: 9px !important;

        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;

        gap: 9px !important;

        font-size: 15px !important;
        line-height: 1 !important;

        box-sizing: border-box !important;
        white-space: nowrap !important;
    }

    .horizontal-nav-item span {
        font-size: 15px !important;
        line-height: 1 !important;
    }
}

/* =========================================================
   FINAL NAV TEXT FIT / WIDTH CORRECTION
   ========================================================= */

@media (min-width: 901px) {

    .horizontal-nav-item {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 118px !important;
        max-width: none !important;

        height: 52px !important;
        min-height: 52px !important;

        padding: 0 18px !important;

        white-space: nowrap !important;
        overflow: visible !important;
    }

    /* Wider tabs for longer labels */
    .horizontal-nav-item:nth-child(4) {
        min-width: 128px !important;
    }

    .horizontal-nav-item:nth-child(5) {
        min-width: 155px !important;
    }

    .horizontal-nav-item:nth-child(6) {
        min-width: 128px !important;
    }

    .horizontal-nav-item:nth-child(8) {
        min-width: 128px !important;
    }

    .horizontal-nav-item span {
        white-space: nowrap !important;
        line-height: 1 !important;
    }
}

/* =========================================================
   SUPPLIERS & PURCHASES NAV TAB
   Keep approved locked navigation design.
   Only allow extra width for the longer label.
   ========================================================= */

@media (min-width: 901px) {
    .horizontal-nav-item:nth-child(8) {
        min-width: 205px !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
}
