/* ── Reset ─────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f5f7fa; color: #1a1a2e; font-size: 0.93rem; }
a { text-decoration: none; color: inherit; }

/* ── Menubar ───────────────────────────────────────────────────────────────── */
.menubar {
    background: linear-gradient(135deg, #1b5e20 0%, #1565c0 100%);
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 58px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    position: sticky;
    top: 0;
    z-index: 100;
}
.menubar .brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    margin-right: auto;
    letter-spacing: 0.3px;
}
.menubar .brand a { color: #fff; }
.menubar a {
    color: rgba(255,255,255,0.78);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}
.menubar a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.menubar a.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-bottom: 2px solid #64b5f6;
}

/* ── Main ──────────────────────────────────────────────────────────────────── */
main { padding: 28px 32px; max-width: 1400px; }
main h2 { margin-bottom: 20px; font-size: 1.35rem; font-weight: 700; color: #1a1a2e; }

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.page-header h2 { margin-bottom: 0; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 8px;
    border: 1px solid #d0d7de;
    background: #fff;
    color: #1a1a2e;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
}
.btn:hover { background: #f0f4f8; border-color: #b0bec5; transform: translateY(-1px); }
.btn-primary { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.btn-primary:hover { background: #1b5e20; border-color: #1b5e20; }
.btn-accent  { background: #1565c0; color: #fff; border-color: #1565c0; }
.btn-accent:hover { background: #0d47a1; border-color: #0d47a1; }
.btn-danger  { background: #c62828; color: #fff; border-color: #c62828; }
.btn-danger:hover { background: #b71c1c; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-restock { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.btn-restock:hover { background: #2e7d32; color: #fff; }

/* ── Stat cards ────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.card {
    background: #fff;
    border-radius: 12px;
    padding: 22px 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    border: 1px solid #e8edf2;
    text-decoration: none;
    color: #1a1a2e;
    display: block;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2e7d32, #1565c0);
}
.card-link:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.1); transform: translateY(-3px); }
.card.alert::before { background: #c62828; }
.card h3 { font-size: 0.75rem; color: #607d8b; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.card .big { font-size: 1.9rem; font-weight: 700; margin-bottom: 4px; color: #1a1a2e; }
.card small { color: #90a4ae; font-size: 0.76rem; }

/* ── Nav cards ─────────────────────────────────────────────────────────────── */
.nav-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 28px;
    justify-content: center;
}
.nav-card {
    width: 151px; height: 151px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    color: #1a1a2e;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid #e8edf2;
    transition: all 0.2s;
}
.nav-card:hover {
    box-shadow: 0 6px 20px rgba(21,101,192,0.15);
    transform: translateY(-3px);
    border-color: #90caf9;
    color: #1565c0;
}
.nav-card-icon { font-size: 2.2rem; }

/* ── Notice ────────────────────────────────────────────────────────────────── */
.notice {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    border-left: 4px solid #2e7d32;
    background: #e8f5e9;
    color: #1b5e20;
}
.notice-error { background: #ffebee; color: #b71c1c; border-left-color: #c62828; }

/* ── Form card ─────────────────────────────────────────────────────────────── */
.form-card {
    background: #fff;
    padding: 28px 32px;
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    border: 1px solid #e8edf2;
}
.form-card h3 { margin-bottom: 20px; font-size: 1.1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: #546e7a; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input,
.form-group select,
.form-group textarea {
    padding: 9px 12px;
    border: 1.5px solid #cfd8dc;
    border-radius: 8px;
    font-size: 0.92rem;
    color: #1a1a2e;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1565c0;
    box-shadow: 0 0 0 3px rgba(21,101,192,0.1);
}
.form-actions { margin-top: 24px; display: flex; gap: 10px; }
.form-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #90a4ae;
    font-weight: 700;
    margin: 22px 0 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8f5e9;
}
.drug-form-header { text-align: center; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid #e8edf2; }
.drug-form-header h3 { font-size: 1.2rem; font-weight: 700; }
.drug-form-header p { font-size: 0.83rem; color: #90a4ae; margin-top: 4px; }

/* ── Search ────────────────────────────────────────────────────────────────── */
.search-bar { margin-bottom: 14px; }
.search-bar input {
    padding: 9px 14px;
    border: 1.5px solid #cfd8dc;
    border-radius: 8px;
    width: 300px;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color 0.2s;
}
.search-bar input:focus { outline: none; border-color: #1565c0; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    border: 1px solid #e8edf2;
}
thead { background: linear-gradient(135deg, #1b5e20, #1565c0); }
th {
    padding: 12px 14px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: none;
}
td {
    padding: 11px 14px;
    font-size: 0.88rem;
    border-bottom: 1px solid #f0f4f8;
    white-space: nowrap;
    color: #1a1a2e;
}
tbody tr:hover { background: #f5f7fa; }
tbody tr:last-child td { border-bottom: none; }

/* ── Row highlights ────────────────────────────────────────────────────────── */
.row-low-stock { background: #fffde7 !important; }
.row-expiring  { background: #fff8e1 !important; }
.row-expired   { background: #ffebee !important; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.badge-cash     { background: #e8f5e9; color: #2e7d32; }
.badge-momo     { background: #e3f2fd; color: #1565c0; }
.badge-credit   { background: #fff3e0; color: #e65100; }
.badge-success  { background: #e8f5e9; color: #2e7d32; }
.badge-danger   { background: #ffebee; color: #c62828; }
.badge-warning  { background: #fff8e1; color: #f57f17; }
.badge-info     { background: #e3f2fd; color: #1565c0; }
.badge-muted    { background: #f5f5f5; color: #757575; }
.badge-ok       { background: #e8f5e9; color: #2e7d32; }
.badge-expired  { background: #ffebee; color: #c62828; }
.badge-expiring { background: #fff8e1; color: #f57f17; }
.badge-no_sales { background: #f5f5f5; color: #757575; }
.badge-critical { background: #ffebee; color: #c62828; }
.badge-low      { background: #fff3e0; color: #e65100; }
.badge-watch    { background: #fff8e1; color: #f57f17; }

/* ── Small buttons ─────────────────────────────────────────────────────────── */
.btn-sm { padding: 5px 12px; font-size: 0.78rem; border-radius: 6px; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: center; }

/* ── Sale items table ──────────────────────────────────────────────────────── */
.sale-items-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; border-radius: 8px; overflow: hidden; }
.sale-items-table th { background: linear-gradient(135deg, #1b5e20, #1565c0); color: #fff; padding: 10px 12px; font-size: 0.8rem; text-align: left; }
.sale-items-table td { padding: 8px 10px; border-bottom: 1px solid #f0f4f8; }
.sale-items-table input[type=text],
.sale-items-table input[type=number] { padding: 7px 10px; border: 1.5px solid #cfd8dc; border-radius: 6px; font-size: 0.88rem; }
.sale-total { text-align: right; font-size: 1.2rem; font-weight: 700; margin-top: 14px; color: #1b5e20; }

/* ── Receipt ───────────────────────────────────────────────────────────────── */
.receipt-header { text-align: center; margin-bottom: 16px; }
.receipt-header h2 { font-size: 1.2rem; margin-bottom: 4px; }
.receipt-header p { font-size: 0.82rem; color: #666; }
.receipt-divider { border: none; border-top: 1px dashed #ccc; margin: 12px 0; }
.receipt-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.receipt-table th { text-align: left; padding: 4px 0; color: #888; font-weight: normal; border-bottom: 1px solid #eee; }
.receipt-table td { padding: 5px 0; }
.receipt-table .amount { text-align: right; }
.receipt-grand { display: flex; justify-content: space-between; font-size: 1.05rem; font-weight: 700; margin-top: 12px; }
.receipt-meta { text-align: center; margin-top: 8px; font-size: 0.82rem; color: #555; }
.receipt-footer { text-align: center; margin-top: 16px; font-size: 0.78rem; color: #aaa; }

/* ── Restock modal ─────────────────────────────────────────────────────────── */
.price-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price-col { background: #f5f7fa; border-radius: 8px; padding: 14px; border: 1px solid #e8edf2; }
.price-col h4 { font-size: 0.72rem; text-transform: uppercase; color: #90a4ae; margin-bottom: 10px; font-weight: 700; letter-spacing: 0.5px; }
.price-col .current-val { font-size: 1rem; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.strategy-options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.strategy-option { border: 2px solid #e8edf2; border-radius: 10px; padding: 12px 8px; cursor: pointer; text-align: center; transition: all 0.2s; }
.strategy-option:hover { border-color: #1565c0; }
.strategy-option input[type=radio] { display: none; }
.strategy-option.selected { border-color: #1565c0; background: #e3f2fd; }
.strategy-option .s-icon { font-size: 1.4rem; display: block; margin-bottom: 4px; }
.strategy-option .s-title { font-size: 0.8rem; font-weight: 700; color: #1a1a2e; }
.strategy-option .s-desc { font-size: 0.7rem; color: #90a4ae; margin-top: 2px; }
.batch-info { background: #e3f2fd; border-left: 3px solid #1565c0; padding: 10px 14px; border-radius: 6px; font-size: 0.83rem; margin-bottom: 16px; color: #1565c0; }

/* ── Forecast ──────────────────────────────────────────────────────────────── */
.status-critical { background: #ffebee !important; }
.status-low      { background: #fff3e0 !important; }
.status-watch    { background: #fffde7 !important; }
.profit-positive { color: #2e7d32; font-weight: 700; }
.profit-negative { color: #c62828; font-weight: 700; }

/* ── Select2 override ──────────────────────────────────────────────────────── */
.select2-container--default .select2-selection--single {
    border: 1.5px solid #cfd8dc;
    border-radius: 8px;
    height: 38px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 38px; padding-left: 12px; color: #1a1a2e; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.select2-container--default .select2-results__option--highlighted { background: #1565c0 !important; }
.select2-container--default .select2-selection--single:focus { border-color: #1565c0; }


