/* ============================================================
   PHARMACY BILLING SYSTEM — MASTER STYLESHEET
   Design: Dark navy sidebar + pharmacy green accent
   Font: Inter (Google Fonts)
   ============================================================ */

/* ---- Google Fonts are loaded in layout heads ---- */

/* ============================================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================================ */
:root {
    /* Brand Colors */
    --brand-primary:   #1a2744;
    --brand-accent:    #00c896;
    --brand-accent-dk: #00a87e;
    --brand-accent-lt: rgba(0, 200, 150, 0.12);

    /* Backgrounds */
    --bg-app:       #f0f4f8;
    --bg-card:      #ffffff;
    --bg-sidebar:   #1a2744;
    --bg-sidebar-dk:#131d36;
    --bg-topbar:    #ffffff;

    /* Text */
    --text-primary:   #1a2744;
    --text-secondary: #6b7a99;
    --text-muted:     #9aa5be;
    --text-on-dark:   #ffffff;

    /* Borders */
    --border:         #e8edf5;
    --border-focus:   #00c896;

    /* Status Colors */
    --danger:     #ff4757;
    --danger-lt:  rgba(255, 71, 87, 0.1);
    --warning:    #ffa502;
    --warning-lt: rgba(255, 165, 2, 0.1);
    --success:    #00c896;
    --success-lt: rgba(0, 200, 150, 0.1);
    --info:       #4a90d9;
    --info-lt:    rgba(74, 144, 217, 0.1);

    /* Typography */
    --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:   'SFMono-Regular', Consolas, monospace;
    --fs-xs:       11px;
    --fs-sm:       13px;
    --fs-base:     14px;
    --fs-md:       15px;
    --fs-lg:       18px;
    --fs-xl:       22px;
    --fs-2xl:      28px;

    /* Spacing */
    --sidebar-w:   260px;
    --topbar-h:    64px;

    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(26, 39, 68, 0.08);
    --shadow-md:   0 4px 16px rgba(26, 39, 68, 0.10);
    --shadow-lg:   0 8px 32px rgba(26, 39, 68, 0.14);

    /* Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;

    /* Transition */
    --transition: 0.2s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: var(--fs-base);
    color: var(--text-primary);
    background: var(--bg-app);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ============================================================
   LAYOUT — SIDEBAR + MAIN WRAPPER
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition);
    overflow: hidden;
}

.sidebar.collapsed { width: 64px; }

.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

.main-wrapper.sidebar-collapsed { margin-left: 64px; }

/* ============================================================
   SIDEBAR BRAND
   ============================================================ */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-on-dark);
    letter-spacing: -0.02em;
}

.sidebar-brand-sub {
    font-size: 10px;
    color: var(--brand-accent);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ============================================================
   SIDEBAR NAVIGATION
   ============================================================ */
.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.3);
    padding: 10px 8px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    font-size: var(--fs-sm);
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-on-dark);
    text-decoration: none;
}

.nav-item.active {
    background: var(--brand-accent-lt);
    color: var(--brand-accent);
    font-weight: 600;
}

/* ============================================================
   SIDEBAR FOOTER
   ============================================================ */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-accent), var(--brand-accent-dk));
    color: white;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: #679ca5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 10px;
    color: var(--brand-accent);
    font-weight: 500;
}

.logout-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.5);
    transition: all var(--transition);
    flex-shrink: 0;
    text-decoration: none;
}

.logout-btn svg { width: 16px; height: 16px; }
.logout-btn:hover { background: rgba(255, 71, 87, 0.2); color: var(--danger); text-decoration: none; }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition);
}
.sidebar-toggle svg { width: 20px; height: 20px; }
.sidebar-toggle:hover { background: var(--bg-app); color: var(--text-primary); }

.topbar-title { flex: 1; }
.topbar-title h1 {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-date {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
    flex: 1;
    padding: 24px;
    max-width: 1600px;
    width: 100%;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: var(--fs-sm);
    font-weight: 500;
    animation: slideDown 0.3s ease;
    position: relative;
}

.flash svg { width: 16px; height: 16px; flex-shrink: 0; }

.flash-success { background: var(--success-lt); color: #00875a; border-bottom: 2px solid var(--success); }
.flash-error   { background: var(--danger-lt);  color: var(--danger);  border-bottom: 2px solid var(--danger); }

.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: inherit;
    opacity: 0.6;
    line-height: 1;
}
.flash-close:hover { opacity: 1; }

@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: visible; /* Prevents autocomplete search dropdown boxes from being clipped */
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    border-top-left-radius: calc(var(--radius-lg) - 1px);
    border-top-right-radius: calc(var(--radius-lg) - 1px);
}

.card-title {
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--text-primary);
}

.card-link {
    font-size: var(--fs-sm);
    color: var(--brand-accent);
    font-weight: 600;
    text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

.card-body { padding: 20px; }
.card-wide  { flex: 2; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    font-family: var(--font);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-accent {
    background: var(--brand-accent);
    color: var(--brand-primary);
    border-color: var(--brand-accent);
}
.btn-accent:hover { background: var(--brand-accent-dk); border-color: var(--brand-accent-dk); color: var(--brand-primary); text-decoration: none; }

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}
.btn-outline:hover { border-color: var(--brand-accent); color: var(--brand-accent); text-decoration: none; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-app); color: var(--text-primary); text-decoration: none; }

.btn-danger {
    background: #dfd3d4;
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover { background: #e0374a; text-decoration: none; }

.btn-sm  { padding: 5px 12px; font-size: var(--fs-xs); }
.btn-lg  { padding: 12px 24px; font-size: var(--fs-base); }
.btn-full { width: 100%; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Icon Button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-app);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover  { background: var(--border); color: var(--text-primary); text-decoration: none; }
.btn-edit:hover  { background: rgba(74,144,217,0.1); color: var(--info); }
.btn-delete:hover{ background: var(--danger-lt); color: var(--danger); }

.action-group { display: flex; align-items: center; gap: 4px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.has-error .form-input { border-color: var(--danger); }

.form-label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 3px rgba(0, 200, 150, 0.12);
}
.form-input[readonly] { background: var(--bg-app); color: var(--text-secondary); }
textarea.form-input { resize: vertical; min-height: 80px; }

.form-error { font-size: var(--fs-xs); color: var(--danger); font-weight: 500; }

.form-row { display: flex; gap: 14px; }
.flex-1   { flex: 1; }
.align-end { align-items: flex-end; }
.align-center { align-items: center; }

.form-actions { display: flex; gap: 12px; padding-top: 8px; }

.required { color: var(--danger); }

/* Input with icon */
.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-right: 42px; }
.input-icon-btn {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding: 4px;
}
.input-icon-btn:hover { color: var(--text-primary); }

/* Info box */
.form-info-box {
    background: var(--info-lt);
    border: 1px solid rgba(74, 144, 217, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: var(--fs-xs);
    color: var(--info);
    line-height: 1.6;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container { 
    overflow-x: auto; 
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
    border-bottom-right-radius: calc(var(--radius-lg) - 1px);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.table thead tr {
    background: var(--bg-app);
    border-bottom: 2px solid var(--border);
}

.table th {
    padding: 10px 14px;
    text-align: left;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: none; }

.row-warning td { background: rgba(255, 165, 2, 0.04); }
.row-danger  td { background: rgba(255, 71, 87, 0.04); }

.table-footer {
    padding: 10px 20px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.table-summary-row td {
    background: var(--bg-app);
    font-weight: 700;
}

.cell-primary   { font-weight: 600; color: var(--text-primary); }
.cell-secondary { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; }
.cell-link      { color: var(--text-primary); font-weight: 600; text-decoration: none; }
.cell-link:hover{ color: var(--brand-accent); }
.amount-cell    { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.time-cell      { font-size: var(--fs-xs); color: var(--text-secondary); white-space: nowrap; }
.text-green     { color: #00875a; }
.text-red       { color: var(--danger); }
.text-center    { text-align: center; }
.text-muted     { color: var(--text-muted); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-success   { background: var(--success-lt); color: #00875a; }
.badge-danger    { background: var(--danger-lt);  color: var(--danger); }
.badge-warning   { background: var(--warning-lt); color: #b37700; }
.badge-primary   { background: rgba(26,39,68,0.08); color: var(--brand-primary); }
.badge-category  { background: rgba(74,144,217,0.1); color: var(--info); }

/* Payment method badges */
.badge-cash   { background: #e8f5e9; color: #2e7d32; }
.badge-upi    { background: rgba(74,144,217,0.1); color: #1565c0; }
.badge-card   { background: rgba(103,58,183,0.1);  color: #4527a0; }
.badge-credit { background: rgba(255,165,2,0.1);   color: #b37700; }

/* Bill number badge */
.bill-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--brand-primary);
    background: var(--bg-app);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.filter-bar .form-input { height: 36px; padding: 6px 12px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    gap: 10px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 40px;
    margin-bottom: 6px;
    opacity: 0.7;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid { display: flex; flex-direction: column; gap: 20px; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-body { flex: 1; }
.stat-value { font-size: var(--fs-xl); font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.stat-label { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: 500; margin-top: 2px; }
.stat-trend { color: var(--brand-accent); opacity: 0.7; }
.stat-trend svg { width: 16px; height: 16px; }
.stat-action { font-size: var(--fs-xs); color: var(--brand-accent); font-weight: 600; position: absolute; bottom: 12px; right: 14px; }

.stat-card-green  .stat-icon { background: var(--success-lt); color: var(--brand-accent); }
.stat-card-blue   .stat-icon { background: var(--info-lt); color: var(--info); }
.stat-card-warning.stat-icon { background: var(--warning-lt); color: var(--warning); }
.stat-card-danger .stat-icon { background: var(--danger-lt); color: var(--danger); }
.stat-card-purple .stat-icon { background: rgba(103,58,183,0.1); color: #673ab7; }
.stat-card-teal   .stat-icon { background: rgba(0,188,212,0.1); color: #00838f; }
.stat-card-indigo .stat-icon { background: rgba(63,81,181,0.1); color: #3949ab; }
.stat-card-warning.stat-card { border-left: 3px solid var(--warning); }
.stat-card-danger.stat-card  { border-left: 3px solid var(--danger); }

.dashboard-row { display: flex; gap: 20px; align-items: flex-start; }
.dashboard-row .card:first-child { flex: 2; }
.dashboard-row .card:last-child  { flex: 1; min-width: 280px; }

/* Top Medicines List */
.top-meds-list { padding: 8px 4px; }
.top-med-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.top-med-item:hover { background: var(--bg-app); }
.top-med-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--brand-accent-lt);
    color: var(--brand-accent);
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.top-med-info { flex: 1; min-width: 0; }
.top-med-name { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-med-qty  { font-size: var(--fs-xs); color: var(--text-secondary); }
.top-med-revenue { font-weight: 700; font-size: var(--fs-sm); color: var(--brand-accent); white-space: nowrap; }

/* Alert List */
.alert-list { padding: 4px 0; }
.alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
}
.alert-item:hover { background: var(--bg-app); }
.alert-name { font-size: var(--fs-sm); font-weight: 500; }

/* ============================================================
   BILLING PAGE
   ============================================================ */
.billing-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.billing-form-panel    { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.billing-summary-panel { width: 280px; flex-shrink: 0; position: sticky; top: calc(var(--topbar-h) + 24px); }

.billing-summary-card { }
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: var(--fs-sm);
    border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-divider { border-top: 2px solid var(--border); margin: 8px 0; }
.summary-total { font-weight: 700; font-size: var(--fs-base); padding-top: 10px; }
.grand-total-value { font-size: var(--fs-xl); font-weight: 800; color: var(--brand-accent); }

.quick-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}
.quick-stat-val { font-weight: 700; color: var(--text-primary); }

/* Suggestions dropdown */
.suggestions-box {
    position: absolute;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 260px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active {
    background: var(--brand-accent-lt);
    color: var(--text-primary);
    outline: none;
}
.suggestion-empty { color: var(--text-muted); font-size: var(--fs-sm); padding: 12px 14px; cursor: default; }
.suggestion-empty:hover { background: none; }

.suggestions-header {
    background: var(--bg-app);
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.suggestions-loader {
    padding: 10px 14px;
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.suggestions-loader .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--brand-accent);
    border-radius: 50%;
    animation: sug-spin 0.8s linear infinite;
}
@keyframes sug-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.sug-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
.sug-meta { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; }

/* Ensure form groups with suggestions are position:relative */
.form-group { position: relative; }

/* Stock quantity cell */
.qty-cell { font-weight: 600; }
.qty-low  { color: var(--danger); }
.qty-alert { margin-left: 4px; }

/* Header actions */
.header-actions { display: flex; gap: 8px; }

/* ============================================================
   TWO-COLUMN FORM (Add/Edit)
   ============================================================ */
.two-col-form { display: flex; gap: 20px; align-items: flex-start; }
.form-col     { flex: 1; display: flex; flex-direction: column; gap: 16px; }

.form-actions-card { display: flex; flex-direction: column; gap: 8px; }

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.profile-sidebar { width: 280px; flex-shrink: 0; }
.profile-main    { flex: 1; }

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: white;
    font-size: 28px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.profile-name { font-size: var(--fs-lg); font-weight: 800; color: var(--text-primary); }
.profile-meta { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 4px; }

.profile-stats {
    display: flex;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.profile-stat {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border-right: 1px solid var(--border);
}
.profile-stat:last-child { border-right: none; }
.profile-stat-val   { font-size: 18px; font-weight: 800; color: var(--brand-accent); }
.profile-stat-label { font-size: 10px; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }

.customer-avatar-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-accent-lt);
    color: var(--brand-accent);
    font-size: 11px;
    font-weight: 700;
    margin-right: 8px;
    vertical-align: middle;
}

/* ============================================================
   REPORTS PAGE
   ============================================================ */
.reports-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.reports-sidebar { width: 260px; flex-shrink: 0; }
.reports-main    { flex: 1; }

.report-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.report-title  { font-size: var(--fs-lg); font-weight: 700; color: var(--text-primary); }
.report-period { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   AUTH LAYOUT
   ============================================================ */
.auth-body {
    background: var(--bg-app);
    min-height: 100vh;
    display: flex;
}

.auth-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.auth-left {
    width: 420px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-brand { margin-bottom: 40px; }
.auth-logo  { width: 64px; height: 64px; margin-bottom: 16px; }

.auth-brand-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-on-dark);
    letter-spacing: -0.02em;
}

.auth-brand-tagline {
    font-size: var(--fs-sm);
    color: var(--brand-accent);
    font-weight: 500;
    margin-top: 4px;
}

.auth-features { display: flex; flex-direction: column; gap: 20px; flex: 1; }
.auth-feature  { display: flex; align-items: flex-start; gap: 14px; }
.auth-feature-icon {
    font-size: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.07);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.auth-feature-title { font-size: var(--fs-sm); font-weight: 700; color: var(--text-on-dark); }
.auth-feature-desc  { font-size: var(--fs-xs); color: rgba(255,255,255,0.45); margin-top: 2px; }

.auth-left-footer { font-size: 10px; color: rgba(255,255,255,0.25); margin-top: 20px; }

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card-header { margin-bottom: 28px; }
.auth-card-header h2 { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.auth-card-header p  { font-size: var(--fs-sm); color: var(--text-secondary); margin-top: 4px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-demo-hint {
    margin-top: 20px;
    padding: 10px 14px;
    background: var(--brand-accent-lt);
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    color: var(--brand-accent-dk);
    border: 1px solid rgba(0,200,150,0.2);
}

/* ============================================================
   STOCK / QTY INDICATORS
   ============================================================ */
.stock-bar {
    width: 80px;
    height: 6px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.stock-bar-fill { height: 100%; border-radius: 4px; background: var(--brand-accent); }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar,
    .topbar,
    .topbar-actions,
    .flash,
    .print-actions,
    .filter-bar,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    body {
        background: white;
        font-size: 11px;
    }

    .card {
        box-shadow: none !important;
        border: none !important;
    }

    .invoice-wrapper {
        max-width: 100%;
        padding: 0;
    }
}


/* ============================================================
   BILLING UX ENHANCEMENTS
   ============================================================ */
.suggestion-item.active {
    background: var(--brand-accent-lt);
    border-left: 3px solid var(--brand-accent);
}

.table-qty-input {
    width: 72px;
    padding: 6px 8px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 600;
    background: #fafbfd;
    outline: none;
    transition: all var(--transition);
    height: 32px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.table-qty-input:focus {
    border-color: var(--brand-accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(0, 200, 150, 0.12);
}

.medicine-search-large {
    font-size: 1.15rem !important;
    height: 48px !important;
    padding: 12px 18px !important;
    border-radius: var(--radius-md) !important;
    border-width: 2px !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important;
}
.medicine-search-large:focus {
    border-color: var(--brand-accent) !important;
    box-shadow: 0 0 0 4px rgba(0, 200, 150, 0.15) !important;
}

.hotkeys-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--brand-primary);
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: var(--fs-xs);
    align-items: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--brand-accent);
}
.hotkeys-title {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-accent);
    margin-right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.hotkey-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.hotkey-badge kbd {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 10px;
    box-shadow: 0 1.5px 0 rgba(0, 0, 0, 0.15);
}

.badge-expired {
    background: var(--danger-lt);
    color: var(--danger);
    border: 1px solid rgba(255, 71, 87, 0.2);
}
.badge-expiring {
    background: var(--warning-lt);
    color: #b37700;
    border: 1px solid rgba(255, 165, 2, 0.2);
}
.badge-lowstock {
    background: rgba(255, 71, 87, 0.08);
    color: var(--danger);
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid rgba(255, 71, 87, 0.12);
}

/* Custom Live Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: #1e293b;
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-sm);
    font-weight: 500;
    min-width: 250px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.3s 3.7s forwards;
    border-left: 4px solid var(--brand-accent);
}
.toast-danger { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-success { border-left-color: var(--success); }

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastFadeOut {
    to { transform: translateX(50%) translateY(0); opacity: 0; pointer-events: none; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    :root { --sidebar-w: 220px; }
    .billing-layout { flex-direction: column; }
    .billing-summary-panel { width: 100%; position: static; }
    .dashboard-row { flex-direction: column; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .auth-left { display: none; }
    .two-col-form  { flex-direction: column; }
    .profile-layout { flex-direction: column; }
    .profile-sidebar { width: 100%; }
    .reports-layout { flex-direction: column; }
    .reports-sidebar { width: 100%; }
    .form-row { flex-direction: column; }
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-app); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
