/* ==========================================================================
   Pharmao Admin — modern design system (overrides Bootstrap 5.3)
   ========================================================================== */

:root {
    --brand:        #0ea372;
    --brand-dark:   #0b8a60;
    --brand-darker: #096b4b;
    --brand-light:  #e7f6f0;
    --brand-rgb:    14, 163, 114;

    --ink:        #111827;
    --body:       #374151;
    --muted:      #6b7280;
    --line:       #e5e7eb;
    --bg:         #f3f5f7;
    --surface:    #ffffff;

    --sidebar-w:   264px;
    --sidebar-bg:  #e3f4ec;   /* light pale-green sidebar (the dark green one was judged too dark) */
    --sidebar-bg2: #d6ede2;

    --radius:    14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.08);
    --shadow-md: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.05);
    --shadow-lg: 0 12px 32px rgba(16,24,40,.12);

    /* Bootstrap variable remap */
    --bs-primary:        #0ea372;
    --bs-primary-rgb:    14, 163, 114;
    --bs-success:        #0ea372;
    --bs-success-rgb:    14, 163, 114;
    --bs-body-color:     #374151;
    --bs-body-bg:        #f3f5f7;
    --bs-border-color:   #e5e7eb;
    --bs-link-color:     #0b8a60;
    --bs-link-hover-color: #096b4b;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--body);
    font-size: .9375rem;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; }
a { text-decoration: none; }

/* ==========================================================================
   App shell : sidebar + content
   ========================================================================== */

.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
    border-right: 1px solid #bfe0d0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow: hidden;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.25rem 1.4rem;
    color: var(--ink);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.02em;
}
.sidebar__brand .logo-mark {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: var(--brand);
    border-radius: 10px;
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(var(--brand-rgb), .45);
}

.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    padding: .25rem .75rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(17,24,39,.15) transparent;
}
.sidebar__nav::-webkit-scrollbar { width: 6px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(17,24,39,.14); border-radius: 6px; }

.nav-section {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 1.1rem .85rem .35rem;
}

.nav-link-side {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .85rem;
    margin-bottom: 2px;
    border-radius: 9px;
    color: var(--body);
    font-weight: 500;
    font-size: .9rem;
    transition: background .15s ease, color .15s ease;
}
.nav-link-side i { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .8; color: var(--muted); }
.nav-link-side:hover { background: #c6e6d6; color: var(--brand-darker); }
.nav-link-side:hover i { color: var(--brand-dark); opacity: 1; }
.nav-link-side.active {
    background: #b4dfc9;
    color: var(--brand-darker);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--brand);
}
.nav-link-side.active i { opacity: 1; color: var(--brand-dark); }

.sidebar__footer {
    border-top: 1px solid var(--line);
    padding: .85rem 1rem;
}

.app-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding: .7rem 1.6rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.topbar__title { font-weight: 650; color: var(--ink); font-size: 1.02rem; margin: 0; }
.topbar__spacer { flex: 1; }

.user-chip {
    display: flex; align-items: center; gap: .6rem;
    padding: .3rem .3rem .3rem .85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
}
.user-chip .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-darker) 100%);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600; font-size: .8rem;
}
.user-chip .u-name { font-weight: 600; color: var(--ink); font-size: .85rem; line-height: 1.1; }
.user-chip .u-role { color: var(--muted); font-size: .72rem; }

.content-area { padding: 1.75rem 1.6rem 3rem; flex: 1; }

/* Sidebar toggler (mobile) */
.sidebar-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 9px; width: 38px; height: 38px; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
    .app-content { margin-left: 0; }
    .sidebar-toggle { display: inline-grid; place-items: center; }
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.card-body { padding: 1.35rem; }
.card-title { font-weight: 650; }

.stat-card { transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
    width: 46px; height: 46px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--brand-light); color: var(--brand-dark);
    font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat-card .stat-label { color: var(--muted); font-size: .85rem; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn { border-radius: var(--radius-sm); font-weight: 550; padding: .5rem 1rem; transition: all .15s ease; }
.btn-sm { padding: .32rem .7rem; border-radius: 8px; font-size: .82rem; }
.btn-lg { padding: .7rem 1.4rem; }

.btn-success, .btn-primary {
    background: var(--brand); border-color: var(--brand); color: #fff;
    box-shadow: 0 1px 2px rgba(var(--brand-rgb), .35);
}
.btn-success:hover, .btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); box-shadow: 0 4px 12px rgba(var(--brand-rgb), .35); }
.btn-success:focus, .btn-primary:focus { box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .3); }

.btn-outline-success, .btn-outline-primary { color: var(--brand-dark); border-color: #cfe9df; }
.btn-outline-success:hover, .btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.btn-outline-secondary { color: var(--body); border-color: var(--line); background: #fff; }
.btn-outline-secondary:hover { background: #f3f4f6; border-color: #d1d5db; color: var(--ink); }

.btn-outline-light { border-color: rgba(255,255,255,.4); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table { color: var(--body); margin-bottom: 0; }
.table > thead th {
    background: #fafbfc;
    color: var(--muted);
    font-weight: 600;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--line);
    padding: .8rem 1rem;
}
.table.table-light thead th, .table thead.table-light th { background: #fafbfc; }
.table > tbody td { padding: .85rem 1rem; border-bottom: 1px solid #f1f3f5; vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: var(--brand-light); --bs-table-bg-state: var(--brand-light); }
.card > .table-responsive { border-radius: var(--radius); overflow: hidden; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge { font-weight: 600; padding: .38em .7em; border-radius: 7px; font-size: .74rem; letter-spacing: .01em; }
.badge.bg-success { background: var(--brand-light) !important; color: var(--brand-darker) !important; }
.badge.bg-secondary { background: #eef0f2 !important; color: #4b5563 !important; }
.badge.bg-warning { background: #fef3c7 !important; color: #92611a !important; }
.badge.bg-danger { background: #fee2e2 !important; color: #b42318 !important; }
.badge.bg-info { background: #e0f2fe !important; color: #075985 !important; }
.badge.bg-light { background: #f3f4f6 !important; color: #374151 !important; }

/* ==========================================================================
   Forms
   ========================================================================== */
.form-label { font-weight: 550; color: var(--ink); font-size: .85rem; margin-bottom: .35rem; }
.form-control, .form-select {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .55rem .85rem;
    color: var(--ink);
    font-size: .9rem;
    background-color: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .15);
}
.form-control::placeholder { color: #9ca3af; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .2); border-color: var(--brand); }
.input-group > :first-child { border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm); }
.input-group > :last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.input-group-text { background: #fff; border-color: var(--line); color: var(--muted); }

/* Section heading inside forms */
.form-section-title {
    font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--brand-dark); font-weight: 700;
    padding-bottom: .5rem; margin: 1.75rem 0 1rem;
    border-bottom: 1px solid var(--line);
}
.form-section-title:first-child { margin-top: 0; }

/* ==========================================================================
   Alerts
   ========================================================================== */
.alert { border: 1px solid transparent; border-radius: var(--radius-sm); padding: .85rem 1.1rem; font-size: .9rem; }
.alert-info { background: #eff6ff; border-color: #dbeafe; color: #1e40af; }
.alert-success { background: var(--brand-light); border-color: #c4ead9; color: var(--brand-darker); }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #b42318; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92611a; }

/* Pagination */
.pagination { gap: .25rem; }
.page-link { border-radius: 8px !important; border: 1px solid var(--line); color: var(--body); margin: 0; padding: .4rem .7rem; }
.page-link:hover { background: var(--brand-light); color: var(--brand-dark); border-color: #cfe9df; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }

/* Page header helper */
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.page-header h2 { margin: 0; }

/* Empty state */
.text-muted { color: var(--muted) !important; }

/* ==========================================================================
   Auth (login)
   ========================================================================== */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1200px 600px at 100% 0%, rgba(var(--brand-rgb),.12), transparent 60%),
        radial-gradient(900px 500px at 0% 100%, rgba(var(--brand-rgb),.10), transparent 55%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 410px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 2.25rem;
}
.auth-logo {
    width: 52px; height: 52px; border-radius: 14px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-darker) 100%);
    color: #fff; display: grid; place-items: center; font-size: 1.5rem;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 20px rgba(var(--brand-rgb), .4);
}
