/* ═══════════════════════════════════════════════════════
   FeedsPro — Modern Admin UI
   Inspired by Tabler.io / Volt Bootstrap 5
   ═══════════════════════════════════════════════════════ */

/* ── Google Fonts: Inter ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design tokens — light mode ── */
:root {
  --sb-w: 240px;
  --tb-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Brand */
  --brand:       #1a5c38;
  --brand-hover: #1e7040;
  --brand-dark:  #144d2e;
  --accent:      #1a5c38;
  --accent2:     #f59e0b;

  /* Surfaces */
  --body-bg:    #f0f4f8;
  --card-bg:    #ffffff;
  --topbar-bg:  #ffffff;
  --input-bg:   #ffffff;

  /* Text */
  --text-body:    #1e293b;
  --text-sub:     #64748b;
  --text-muted-c: #94a3b8;
  --text-heading: #0f172a;

  /* Borders & shadows */
  --border:      #e2e8f0;
  --border-lite: #f1f5f9;
  --shadow-xs:   0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --shadow:      0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.12);

  /* Table */
  --tbl-head-bg:  #f8fafc;
  --tbl-hover-bg: #f5f9ff;

  /* Status */
  --danger:  #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info:    #3b82f6;
}

/* ── Design tokens — dark mode ── */
[data-bs-theme="dark"] {
  --body-bg:    #0f172a;
  --card-bg:    #1e293b;
  --topbar-bg:  #1e293b;
  --input-bg:   #0f172a;

  --text-body:    #e2e8f0;
  --text-sub:     #94a3b8;
  --text-muted-c: #64748b;
  --text-heading: #f8fafc;

  --border:      #334155;
  --border-lite: #1e293b;
  --shadow-xs:   0 1px 2px rgba(0,0,0,.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.35);
  --shadow:      0 4px 16px rgba(0,0,0,.45);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.55);

  --tbl-head-bg:  #263347;
  --tbl-hover-bg: #263347;

  color-scheme: dark;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--body-bg);
  color: var(--text-body);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sb-w);
  height: 100vh;
  background: var(--brand);
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

/* Brand / logo row */
.sb-brand {
  padding: 18px 16px 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.2px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}
.sb-brand i { color: var(--accent2); font-size: 20px; flex-shrink: 0; }
.sb-brand img { height: 26px; object-fit: contain; flex-shrink: 0; }

/* Nav */
.sb-nav { flex: 1; padding: 10px 8px; }

.nav-section {
  color: rgba(255,255,255,.35);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 10px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-link:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}
.nav-link.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-left-color: var(--accent2);
}
.nav-link i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
  opacity: .85;
}
.nav-link.active i,
.nav-link:hover i { opacity: 1; }

/* Bottom user row */
.sb-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  flex-shrink: 0;
}
.sb-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.25);
}
.sb-uinfo { flex: 1; min-width: 0; }
.sb-uname {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-urole { font-size: 11px; opacity: .5; margin-top: 1px; }
.sb-user a { color: rgba(255,255,255,.4); font-size: 15px; text-decoration: none; }
.sb-user a:hover { color: var(--accent2); }
.sb-powered {
  padding: 6px 14px 10px;
  font-size: 10px;
  color: rgba(255,255,255,.2);
  text-align: center;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════
   MAIN WRAPPER + TOPBAR
   ════════════════════════════════════════════════════════ */
.main-wrap {
  margin-left: var(--sb-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}

.topbar {
  height: var(--tb-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
  transition: background .25s, border-color .25s;
}

.sb-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-sub);
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  line-height: 1;
  min-width: 38px; min-height: 38px;
  align-items: center; justify-content: center;
  touch-action: manipulation;
}
.sb-toggle:hover { background: var(--border-lite); color: var(--text-body); }

.tb-title {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Generic topbar icon button */
.tb-btn {
  width: 36px; height: 36px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 16px;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
}
.tb-btn:hover { background: var(--border-lite); color: var(--text-body); }

/* Notification bell */
.notif-bell { position: relative; }
.notif-badge {
  position: absolute;
  top: 3px; right: 3px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 4px;
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
}

.tb-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.tb-date {
  font-size: 12px;
  color: var(--text-muted-c);
  font-weight: 500;
  white-space: nowrap;
}
.tb-time {
  font-size: 12px;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  min-width: 58px;
  font-weight: 500;
}

/* Theme toggle — sun/moon */
#themeToggleBtn { font-size: 15px; }
[data-bs-theme="dark"] #themeToggleBtn { color: #fbbf24; }
[data-bs-theme="dark"] #themeToggleBtn:hover { background: #334155; }

/* Page content */
.page-content { padding: 24px; flex: 1; }

/* Flash alert strip */
.page-flash { padding: 0 24px; margin-top: 16px; }

/* ════════════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  transition: background .25s, border-color .25s;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-header .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
}
.card-header .card-title i { color: var(--brand); font-size: 15px; }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: transparent;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ════════════════════════════════════════════════════════
   STAT CARDS  (KPI widgets on dashboard)
   ════════════════════════════════════════════════════════ */
.stat-card {
  border-radius: var(--radius);
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* Coloured gradient variants */
.stat-card.blue   { background: linear-gradient(135deg, #1a5c38, #1e7040); border: none; }
.stat-card.green  { background: linear-gradient(135deg, #16a34a, #15803d); border: none; }
.stat-card.amber  { background: linear-gradient(135deg, #f59e0b, #d97706); border: none; }
.stat-card.red    { background: linear-gradient(135deg, #ef4444, #dc2626); border: none; }
.stat-card.teal   { background: linear-gradient(135deg, #0d9488, #0f766e); border: none; }
.stat-card.purple { background: linear-gradient(135deg, #9333ea, #7c3aed); border: none; }

/* Coloured card text */
.stat-card.blue .stat-label,
.stat-card.green .stat-label,
.stat-card.amber .stat-label,
.stat-card.red .stat-label,
.stat-card.teal .stat-label,
.stat-card.purple .stat-label { color: rgba(255,255,255,.8); }

.stat-card.blue .stat-val,
.stat-card.green .stat-val,
.stat-card.amber .stat-val,
.stat-card.red .stat-val,
.stat-card.teal .stat-val,
.stat-card.purple .stat-val { color: #fff; }

.stat-card.blue .stat-sub,
.stat-card.green .stat-sub,
.stat-card.amber .stat-sub,
.stat-card.red .stat-sub,
.stat-card.teal .stat-sub,
.stat-card.purple .stat-sub { color: rgba(255,255,255,.65); }

/* Plain white stat card */
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.stat-val  { font-size: 1.7rem; font-weight: 700; color: var(--text-heading); line-height: 1.1; }
.stat-sub  { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.sc-icon   { font-size: 32px; opacity: .8; }
.sc-val    { font-size: 24px; font-weight: 700; line-height: 1; }
.sc-lbl    { font-size: 12px; opacity: .8; margin-top: 3px; }

/* ════════════════════════════════════════════════════════
   TABLES
   ════════════════════════════════════════════════════════ */
.table th {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-sub);
  background: var(--tbl-head-bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td, .table th { padding: 11px 14px; vertical-align: middle; }
.table td { color: var(--text-body); border-bottom: 1px solid var(--border-lite); }
.table-hover tbody tr:hover td { background: var(--tbl-hover-bg); }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }

/* ════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════ */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.bg-success-soft  { background: #dcfce7; color: #16a34a; }
.bg-danger-soft   { background: #fee2e2; color: #dc2626; }
.bg-warning-soft  { background: #fef3c7; color: #d97706; }
.bg-info-soft     { background: #dbeafe; color: #2563eb; }
.bg-secondary-soft{ background: #f1f5f9; color: #64748b; }

[data-bs-theme="dark"] .bg-success-soft  { background: rgba(22,163,74,.2);  color: #4ade80; }
[data-bs-theme="dark"] .bg-danger-soft   { background: rgba(239,68,68,.2);  color: #f87171; }
[data-bs-theme="dark"] .bg-warning-soft  { background: rgba(245,158,11,.2); color: #fbbf24; }
[data-bs-theme="dark"] .bg-info-soft     { background: rgba(59,130,246,.2); color: #60a5fa; }
[data-bs-theme="dark"] .bg-secondary-soft{ background: rgba(100,116,139,.15); color: #94a3b8; }

/* ════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════ */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: 14px;
  background-color: var(--input-bg);
  color: var(--text-body);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(26,92,56,.18) !important;
  background-color: var(--input-bg);
  color: var(--text-body);
}
.form-label { font-weight: 600; font-size: 13px; color: var(--text-body); margin-bottom: 5px; }
.input-group-text { background: var(--tbl-head-bg); border-color: var(--border); font-size: 14px; }

/* ════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════ */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; }
.btn-sm { font-size: 12px; padding: 5px 11px; }

.btn-primary,
.btn.btn-primary {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}
.btn-primary:hover,
.btn.btn-primary:hover { filter: brightness(.9); }
.btn-primary:focus,
.btn.btn-primary:focus {
  box-shadow: 0 0 0 3px rgba(26,92,56,.3) !important;
}

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

/* Icon-only button */
.btn-icon {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* Settings tab-style nav */
.stab-link.active,
.stab-link:hover { background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important; }

/* ════════════════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════════════════ */
.page-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-hdr h4 {
  font-weight: 700;
  color: var(--brand);
  margin: 0;
  font-size: 18px;
  letter-spacing: -.2px;
}
.page-hdr h4 i { color: var(--brand); }

/* ════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════ */
.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 13.5px; }

/* ════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════ */
.modal-header {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}
.modal-header .btn-close { filter: invert(1) brightness(2); }
.modal-title { font-weight: 700; }
[data-bs-theme="dark"] .modal-content { background: var(--card-bg); border-color: var(--border); }

/* ════════════════════════════════════════════════════════
   POS LAYOUT
   ════════════════════════════════════════════════════════ */
.pos-wrap { display: grid; grid-template-columns: 1fr 360px; gap: 16px; height: calc(100vh - var(--tb-h) - 40px); overflow: hidden; }
.pos-left { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.pos-search-box { position: relative; }
.pos-search-box input { width: 100%; padding: 10px 14px 10px 40px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; background: var(--input-bg); color: var(--text-body); }
.pos-search-box input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(26,92,56,.15); }
.pos-search-box .si { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted-c); font-size: 15px; }
.pos-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pos-filter-btn { padding: 5px 14px; border: 1.5px solid var(--border); border-radius: 20px; background: var(--card-bg); font-size: 12px; cursor: pointer; transition: all .15s; color: var(--text-body); }
.pos-filter-btn.active, .pos-filter-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.med-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; padding: 2px; }
.med-card { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 10px; cursor: pointer; text-align: center; transition: all .15s; box-shadow: var(--shadow-xs); }
.med-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.med-card.out { opacity: .4; pointer-events: none; }
.med-card.low-stock { border-color: #f59e0b; }
.mc-name  { font-weight: 600; font-size: 12.5px; color: var(--text-body); margin-bottom: 3px; line-height: 1.3; }
.mc-generic { font-size: 10px; color: var(--text-muted-c); margin-bottom: 4px; }
.mc-price { color: var(--brand); font-weight: 700; font-size: 14px; }
.mc-stock { font-size: 11px; margin-top: 3px; }
.mc-rx    { color: #9333ea; font-size: 10px; margin-top: 2px; }

/* ════════════════════════════════════════════════════════
   CART
   ════════════════════════════════════════════════════════ */
.cart-panel  { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.cart-hdr    { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: space-between; }
.cart-body   { flex: 1; overflow-y: auto; padding: 8px; }
.cart-empty  { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-muted-c); padding: 20px; text-align: center; }
.cart-empty i { font-size: 44px; margin-bottom: 10px; }
.cart-item   { display: flex; align-items: center; gap: 6px; padding: 7px 4px; border-bottom: 1px solid var(--border-lite); }
.ci-info     { flex: 1; min-width: 0; }
.ci-name     { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-price    { font-size: 11px; color: var(--text-sub); }
.ci-qty      { display: flex; align-items: center; gap: 4px; }
.ci-qty button { width: 22px; height: 22px; border: 1px solid var(--border); background: var(--tbl-head-bg); border-radius: 4px; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.ci-qty span { min-width: 22px; text-align: center; font-size: 13px; font-weight: 600; }
.ci-total    { font-size: 12.5px; font-weight: 700; min-width: 70px; text-align: right; }
.ci-del      { background: none; border: none; color: var(--text-muted-c); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.ci-del:hover { color: var(--danger); }
.cart-footer { padding: 14px; border-top: 1px solid var(--border); }
.cart-totals { margin-bottom: 10px; }
.ct-row      { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; color: var(--text-sub); }
.ct-row.grand { font-size: 17px; font-weight: 700; color: var(--text-heading); padding-top: 6px; border-top: 2px solid var(--border); margin-top: 6px; }
.btn-checkout { width: 100%; padding: 13px; background: #16a34a; color: #fff; font-size: 15px; font-weight: 700; border: none; border-radius: var(--radius-sm); cursor: pointer; transition: filter .15s; }
.btn-checkout:hover:not(:disabled) { filter: brightness(.9); }
.btn-checkout:disabled { background: var(--text-muted-c); cursor: not-allowed; }
.btn-clear { width: 100%; padding: 7px; background: transparent; border: 1.5px solid var(--border); border-radius: var(--radius-xs); font-size: 13px; cursor: pointer; margin-top: 6px; color: var(--text-sub); }
.btn-clear:hover { background: var(--tbl-head-bg); }

/* ════════════════════════════════════════════════════════
   RECEIPTS
   ════════════════════════════════════════════════════════ */
.receipt         { max-width: 480px; margin: auto; font-family: Arial, sans-serif; font-size: 13px; }
.receipt-header  { text-align: center; border-bottom: 2px dashed #ccc; padding-bottom: 12px; margin-bottom: 12px; }
.receipt-header h3 { margin: 0; color: var(--brand); font-size: 16px; }
.receipt-header p  { margin: 2px 0; font-size: 12px; color: #666; }
.receipt-stamp   { text-align: right; margin-top: 12px; }
.receipt-stamp img { max-height: 70px; opacity: .85; }
.receipt-sig     { text-align: right; margin-top: 6px; }
.receipt-sig img { max-height: 50px; opacity: .85; }
.receipt-footer  { text-align: center; border-top: 2px dashed #ccc; margin-top: 12px; padding-top: 8px; font-size: 11px; color: #888; }

/* ════════════════════════════════════════════════════════
   MISC
   ════════════════════════════════════════════════════════ */
.stock-ok  { color: #16a34a; font-weight: 600; }
.stock-low { color: #d97706; font-weight: 600; }
.stock-out { color: var(--danger); font-weight: 600; }
.text-right { text-align: right; }

/* Chart cards */
.chart-card  { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); padding: 18px; margin-bottom: 20px; }
.chart-title { font-weight: 700; font-size: 14px; color: var(--brand); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* Sidebar backdrop (mobile) */
.sb-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sb-backdrop.visible { display: block; }

/* ════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a5c38 0%, #15803d 55%, #f59e0b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
}
.login-logo         { text-align: center; margin-bottom: 28px; }
.login-logo i       { font-size: 46px; color: #f59e0b; }
.login-logo h2      { margin: 10px 0 2px; font-weight: 800; color: #1a5c38; font-size: 22px; }
.login-logo p       { color: #94a3b8; font-size: 13px; }
.btn-login          { width: 100%; padding: 13px; background: #1a5c38; color: #fff; border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700; cursor: pointer; transition: filter .15s; }
.btn-login:hover    { filter: brightness(.9); }

/* Nav-pills inside main content */
.main-wrap .nav-pills .nav-link {
  color: var(--text-sub);
  background: var(--tbl-head-bg);
  border: 1.5px solid var(--border);
  border-left: 1.5px solid var(--border) !important;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}
.main-wrap .nav-pills .nav-link:hover,
.main-wrap .nav-pills .nav-link.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Settings tab strip */
.stab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  padding-bottom: 0;
}
.stab-link {
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  background: var(--tbl-head-bg);
  transition: all .15s;
}
.stab-link.active,
.stab-link:hover {
  background: var(--brand) !important;
  color: #fff !important;
  border-color: var(--brand) !important;
}

/* SMTP info block */
.smtp-info {
  background: var(--tbl-head-bg);
  border-left: 3px solid var(--info);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  margin-bottom: 18px;
  color: var(--text-body);
}
.smtp-info table td { padding: 4px 8px; vertical-align: top; }
.smtp-info table td:first-child { font-weight: 700; white-space: nowrap; color: var(--brand); min-width: 110px; }

/* Accessibility */
.text-muted { color: var(--text-sub) !important; }
small.text-muted { color: var(--text-muted-c) !important; }
.form-text  { color: var(--text-sub) !important; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
  :root { --sb-w: 220px; }
  .stat-card { padding: 14px 12px; }
}

@media (max-width: 768px) {
  /* Sidebar: slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    width: 270px !important;
    height: 100vh; height: 100dvh;
    z-index: 1001;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  .sidebar.sb-open {
    transform: translateX(0);
    box-shadow: 6px 0 24px rgba(0,0,0,.35);
  }
  .main-wrap { margin-left: 0 !important; }

  /* Show hamburger */
  .sb-toggle { display: inline-flex; }

  /* Topbar */
  .topbar { padding: 0 12px; }
  .tb-date, .tb-divider { display: none; }
  .tb-title { font-size: 14px; max-width: 120px; }

  /* Page content */
  .page-content { padding: 12px !important; }

  /* Page header */
  .page-hdr { flex-direction: column; align-items: flex-start; padding-bottom: 8px; margin-bottom: 14px; }
  .page-hdr .d-flex { width: 100%; flex-wrap: wrap; }
  .page-hdr h4 { font-size: 16px; }

  /* KPI stat cards: 2 per row */
  .col-6.col-md-3 { width: 50% !important; }

  /* Tables */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .table td, .table th { white-space: nowrap; font-size: 12px; padding: 7px 9px; }

  /* POS */
  .pos-layout { flex-direction: column !important; height: auto !important; overflow: visible !important; }
  .pos-left, .pos-right { width: 100% !important; min-width: 0; }
  .pos-right {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 500;
    max-height: 45vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,.15);
    background: var(--card-bg);
  }
  .med-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important; max-height: calc(100vh - 56px - 45vh - 80px); overflow-y: auto; padding-bottom: 8px; }
  .med-card { height: 72px !important; padding: 5px 6px !important; }
  .mc-name  { font-size: 10px !important; }
  .mc-price { font-size: 11px !important; }
  .mc-stock { font-size: 9px  !important; }
  .cart-hdr { padding: 8px 12px; font-size: 13px; }
  .cart-body { max-height: 25vh; overflow-y: auto; }
  .btn-checkout { font-size: 13px !important; padding: 10px !important; }
  .ci-name  { font-size: 11px !important; }
  .ci-total { font-size: 11px !important; min-width: 52px !important; }

  /* Stat cards */
  .stat-card { padding: 10px 8px !important; }
  .sc-val { font-size: 16px !important; }
  .sc-icon { width: 34px; height: 34px; font-size: 15px !important; }

  /* Settings tabs */
  .stab-nav { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .stab-link { white-space: nowrap; padding: 7px 10px; font-size: 11px; }

  /* Nav-pills */
  .nav-pills { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .nav-pills .nav-link { white-space: nowrap; font-size: 12px; padding: 4px 10px; }

  /* Modals: bottom-sheet */
  .modal-dialog { margin: 0 !important; max-width: 100% !important; width: 100% !important; }
  .modal-content { border-radius: 16px 16px 0 0 !important; min-height: 50vh; }
  .modal.fade .modal-dialog { transform: translateY(100%); transition: transform .3s ease; }
  .modal.show .modal-dialog { transform: translateY(0); }
  .modal { align-items: flex-end !important; }

  /* PO rows */
  #poRows .form-select, #poRows .form-control { font-size: 11px; padding: 3px 5px; }
  #poRows td { padding: 4px !important; }

  /* Page header buttons */
  .page-hdr .btn { width: 100%; }
  .page-hdr .d-flex.gap-2 { flex-direction: column; }

  /* Invoice / GRN action bars */
  .invoice-actions { flex-wrap: wrap; gap: 6px; padding: 8px !important; }
  .invoice-actions .btn { font-size: 12px; padding: 5px 10px; }
  .no-print.print-bar { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }

  /* Log table */
  .log-details { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Cart toggle */
  #cartToggleBtn {
    display: flex;
    position: fixed; bottom: calc(45vh - 1px); right: 16px;
    z-index: 501;
    background: var(--card-bg); border: 2px solid var(--border);
    border-radius: 50%; width: 42px; height: 42px;
    align-items: center; justify-content: center;
    box-shadow: var(--shadow); font-size: 18px; cursor: pointer;
  }

  .filter-bar { flex-direction: column; align-items: stretch !important; }
}

@media (max-width: 480px) {
  .login-box { margin: 10px; padding: 24px 16px; }
  .med-grid  { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)) !important; }
  .med-card  { height: 68px !important; }
  .pos-right { max-height: 50vh; }
  .cart-body { max-height: 28vh; }
  .btn-checkout { font-size: 12px !important; }
  .tb-title  { display: none; }
  .col-6.col-md-3 { width: 50% !important; }
  .sc-val    { font-size: 15px !important; }
  .table td, .table th { font-size: 11px; padding: 5px 7px; }
  [class*="col-md-"] { width: 100% !important; }
  .col-6[class*="col-md-"] { width: 50% !important; }
}

@media (max-width: 360px) {
  .page-content { padding: 6px !important; }
  .card-body { padding: 12px !important; }
  .table td, .table th { font-size: 10px; padding: 4px 5px; }
  .btn-sm { font-size: 11px; padding: 4px 7px; }
  .stat-card { padding: 8px 6px !important; }
  .sc-val  { font-size: 13px !important; }
  .sc-icon { font-size: 13px !important; }
}

/* Touch targets */
@media (pointer: coarse) {
  .btn, .nav-link, .btn-icon, .tb-btn { min-height: 44px; min-width: 44px; }
  .btn-sm { min-height: 36px; }
  .form-control, .form-select { min-height: 44px; }
  .pos-filter-btn, .cat-btn { min-height: 36px; padding: 6px 14px; }
  .btn-checkout { min-height: 52px !important; }
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .pos-right    { padding-bottom: env(safe-area-inset-bottom); }
  #cartToggleBtn { bottom: calc(45vh + env(safe-area-inset-bottom)); }
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Print */
@media print {
  .sidebar, .topbar, .no-print, .sb-backdrop, .sb-toggle { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
}
