:root {
  --bg: #0a0f1e;
  --bg2: #0f1628;
  --sidebar: #080d1a;
  --card: #111827;
  --card2: #151e30;
  --border: rgba(99,179,237,0.12);
  --accent: #3b82f6;
  --accent2: #06b6d4;
  --accent3: #8b5cf6;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --text: #e2e8f0;
  --muted: #64748b;
  --glow: 0 0 30px rgba(59,130,246,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 250px;
  min-height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}

.logo-area {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-pill {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px rgba(59,130,246,0.4);
}

.logo-text h2 {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}

.logo-text p {
  font-size: 10px;
  color: var(--accent2);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

.nav-section {
  padding: 16px 12px 8px;
}

.nav-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover { background: var(--card); color: var(--text); }

.nav-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(6,182,212,0.1));
  color: #fff;
  border: 1px solid rgba(59,130,246,0.25);
}

.nav-item.active .nav-dot {
  display: block;
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
  position: absolute;
  right: 12px;
  box-shadow: 0 0 6px var(--accent);
}

.nav-dot { display: none; }

.nav-icon { width: 18px; text-align: center; font-size: 15px; }

.sub-items {
  padding-left: 28px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.sub-items.open {
  max-height: 200px; /* Adjust if needed */
}

.sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 1px;
  transition: all .2s;
  text-decoration: none;
}

.sub-item:hover, .sub-item.active { color: var(--text); background: var(--card); }

.sub-item::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.sub-item.active::before { background: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent3), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}

.user-info p { font-size: 12.5px; font-weight: 600; color: var(--text); }
.user-info span { font-size: 10.5px; color: var(--accent2); }

/* ── MAIN CONTENT ── */
.main {
  margin-left: 250px;
  flex: 1;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.topbar-left h1 {
  font-family: 'Sora', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

.topbar-left p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

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

.icon-btn {
  width: 36px; height: 36px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all .2s;
}

.icon-btn:hover { border-color: var(--accent); }

.filter-tabs {
  display: flex;
  background: var(--card);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all .2s;
}

.filter-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 12px rgba(59,130,246,0.4);
}

.notif-dot {
  position: relative;
}

.notif-dot::after {
  content: '';
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  position: absolute;
  top: -2px; right: -2px;
  border: 2px solid var(--bg2);
  box-shadow: 0 0 6px var(--red);
}

/* ── CONTENT ── */
.content {
  padding: 24px 28px;
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--glow);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: 16px 16px 0 0;
}

.sc-blue::before   { background: linear-gradient(90deg,var(--accent),var(--accent2)); }
.sc-green::before  { background: linear-gradient(90deg,var(--green),#34d399); }
.sc-purple::before { background: linear-gradient(90deg,var(--accent3),#a78bfa); }
.sc-yellow::before { background: linear-gradient(90deg,var(--yellow),#fbbf24); }
.sc-red::before    { background: linear-gradient(90deg,var(--red),#f87171); }
.sc-teal::before   { background: linear-gradient(90deg,#14b8a6,#22d3ee); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.si-blue   { background: rgba(59,130,246,0.15); }
.si-green  { background: rgba(16,185,129,0.15); }
.si-purple { background: rgba(139,92,246,0.15); }
.si-yellow { background: rgba(245,158,11,0.15); }
.si-red    { background: rgba(239,68,68,0.15); }
.si-teal   { background: rgba(20,184,166,0.15); }

.stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
  line-height: 1;
}

.stat-label {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

.form-control, .form-select {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  width: 100%;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .2s, box-shadow .2s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}
.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .2s, box-shadow .2s;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 10px; font-size: 13px;
  font-weight: 600; cursor: pointer; border: none; transition: all .25s;
  font-family: 'Plus Jakarta Sans', sans-serif;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; box-shadow: 0 4px 15px rgba(59,130,246,0.3);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(59,130,246,0.4); }

.btn-ghost {
  background: var(--card); color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { color: var(--text); border-color: rgba(99,179,237,0.3); }

.row {
  display: flex;
  flex-wrap: wrap;
  margin: -8px;
}
.col {
  padding: 8px;
  flex: 1;
}
.col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
}
.col-md-4 {
  flex: 0 0 33.333%;
  max-width: 33.333%;
}
.col-md-3 {
  flex: 0 0 25%;
  max-width: 25%;
}
.mb-3 {
  margin-bottom: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--card2); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 600; }
td { padding: 12px 10px; font-size: 13px; color: var(--text); border-bottom: 1px solid rgba(99,179,237,0.05); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.s-delivered { background: rgba(16,185,129,0.12); color: #10b981; }
.s-pending   { background: rgba(245,158,11,0.12); color: #f59e0b; }
.s-dispatch  { background: rgba(59,130,246,0.12); color: #60a5fa; }
.s-cancelled { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── CHARTS ROW ── */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.chart-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.chart-legend {
  display: flex;
  gap: 12px;
}

.legend-dot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}

.legend-dot::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 2px;
}

.ld-blue::before   { background: var(--accent); }
.ld-green::before  { background: var(--green); }
.ld-purple::before { background: var(--accent3); }

canvas { max-width: 100%; }

/* ── BOTTOM ROW ── */
.bottom-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}

/* ── RECENT ORDERS TABLE ── */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.table-title { font-size: 14px; font-weight: 700; color: #fff; }

.view-all {
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(59,130,246,0.1);
  transition: background .2s;
}

.view-all:hover { background: rgba(59,130,246,0.2); }

.order-id { color: var(--accent2); font-weight: 700; font-size: 11.5px; }

/* ── RIDER / BRANCH CARD ── */
.side-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mini-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

.mini-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-title span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  display: inline-block;
}

.rider-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(99,179,237,0.06);
}

.rider-item:last-child { border-bottom: none; padding-bottom: 0; }

.rider-avatar {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  flex-shrink: 0;
}

.ra-1 { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.ra-2 { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.ra-3 { background: linear-gradient(135deg, #10b981, #059669); }
.ra-4 { background: linear-gradient(135deg, #f59e0b, #ef4444); }

.rider-info p { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 0; }
.rider-info span { font-size: 11px; color: var(--muted); }

.rider-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(6,182,212,0.1);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ── EXPENSES MINI ── */
.expense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid rgba(99,179,237,0.06);
  font-size: 12.5px;
}

.expense-row:last-child { border-bottom: none; }

.exp-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
}

.exp-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.exp-amount {
  font-weight: 700;
  color: var(--red);
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-card { animation: fadeUp .4s ease both; }
.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .1s; }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .2s; }
.stat-card:nth-child(5) { animation-delay: .25s; }
.stat-card:nth-child(6) { animation-delay: .3s; }
.stat-card:nth-child(7) { animation-delay: .35s; }
.stat-card:nth-child(8) { animation-delay: .4s; }
.stat-card:nth-child(9) { animation-delay: .45s; }

/* ── PROFIT HIGHLIGHT ── */
.profit-card {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(6,182,212,0.08));
  border-color: rgba(16,185,129,0.3) !important;
}

.profit-value { color: #10b981 !important; }

/* ── PLATFORM QUICK ACCESS ── */
.platform-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.platform-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .25s;
  text-decoration: none;
  color: #fff;
}

.platform-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); color: #fff; }

.pb-wa  { background: linear-gradient(135deg,#128C7E,#25D366); }
.pb-fb  { background: linear-gradient(135deg,#1877F2,#0ea5e9); }
.pb-ig  { background: linear-gradient(135deg,#833ab4,#fd1d1d,#fcb045); }
.pb-tt  { background: linear-gradient(135deg,#010101,#ff0050); }
.pb-web { background: linear-gradient(135deg,var(--accent),var(--accent2)); }

.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 700; color: #fff;
  margin-bottom: 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); margin-bottom: 20px;
}

.breadcrumb span { color: var(--accent2); font-weight: 600; }
.breadcrumb .sep { color: var(--muted); }

/* ── ORDER BANNER ── */
.order-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(6,182,212,0.06));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  animation: fadeUp .4s ease both;
}

.banner-left { display: flex; align-items: center; gap: 12px; }

.banner-icon {
  width: 40px; height: 40px; background: rgba(59,130,246,0.15);
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 18px;
}

.banner-text p { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.banner-text h3 { font-family: 'Sora', sans-serif; font-size: 18px; font-weight: 700; color: var(--accent2); }

.banner-right { display: flex; align-items: center; gap: 16px; }

.banner-meta { text-align: right; }
.banner-meta p { font-size: 11px; color: var(--muted); }
.banner-meta span { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── FORM GRID ── */
.form-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

/* ── SECTION CARD ── */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 16px;
  animation: fadeUp .4s ease both;
}

.section-card:nth-child(1) { animation-delay: .05s; }
.section-card:nth-child(2) { animation-delay: .1s; }
.section-card:nth-child(3) { animation-delay: .15s; }

.section-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}

/* ── FORM FIELDS ── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.field-row.full { grid-template-columns: 1fr; }
.field-row.triple { grid-template-columns: 1fr 1fr 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 0px;
}

input, select, textarea {
  background: #0d1424;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all .2s;
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
  background: #0f1830;
}

input::placeholder, textarea::placeholder { color: var(--muted); font-size: 12.5px; }
select option { background: #111827; color: var(--text); }
textarea { resize: vertical; min-height: 80px; }

/* ── SOURCE SELECTOR ── */
.source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.source-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 10px 6px; border-radius: 10px;
  border: 1px solid var(--border); cursor: pointer;
  transition: all .2s; background: #0d1424;
  font-size: 11px; font-weight: 600; color: var(--muted);
}

.source-btn .s-icon { font-size: 18px; }
.source-btn:hover { border-color: rgba(99,179,237,0.3); color: var(--text); }

.source-btn.selected {
  border-color: var(--accent);
  background: rgba(59,130,246,0.12);
  color: #fff;
  box-shadow: 0 0 12px rgba(59,130,246,0.2);
}

/* ── MEDICINE SEARCH ── */
.medicine-search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--muted);
}

.medicine-search-wrap input { padding-left: 36px; }

.medicine-suggestions {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #111827; border: 1px solid rgba(59,130,246,0.25);
  border-radius: 10px; margin-top: 4px; z-index: 50;
  overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.suggestion-item {
  padding: 10px 14px; font-size: 13px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: background .15s;
}

.suggestion-item:hover { background: rgba(59,130,246,0.1); }
.suggestion-item .med-price { color: var(--accent2); font-weight: 700; font-size: 12px; }

/* ── MEDICINE TABLE ── */
.med-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.med-table {
  width: 100%;
  border-collapse: collapse;
}

.med-table th {
  background: rgba(59,130,246,0.06);
  padding: 10px 12px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); font-weight: 600; text-align: left;
  border-bottom: 1px solid var(--border);
}

.med-table td {
  padding: 10px 12px; font-size: 12.5px; color: var(--text);
  border-bottom: 1px solid rgba(99,179,237,0.05);
}

.med-table tr:last-child td { border-bottom: none; }
.med-table tr:hover td { background: rgba(255,255,255,0.02); }

.qty-control {
  display: flex; align-items: center; gap: 8px;
}

.qty-btn {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; font-weight: 700;
}

.qty-btn:hover { background: rgba(59,130,246,0.15); border-color: var(--accent); }

.qty-val {
  width: 32px; text-align: center; font-weight: 700;
  font-size: 13px; color: #fff;
}

.del-btn {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
  color: var(--red); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}

.del-btn:hover { background: rgba(239,68,68,0.2); }

.med-name { font-weight: 600; color: var(--text); margin-bottom: 0px;}
.med-unit { color: var(--muted); font-size: 11px; }
.med-total { font-weight: 700; color: var(--accent2); }

.empty-meds {
  text-align: center; padding: 28px 20px;
  color: var(--muted); font-size: 13px;
}

.empty-meds .empty-icon { font-size: 32px; margin-bottom: 8px; opacity: .5; }

/* ── TOTALS CARD ── */
.totals-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  animation: fadeUp .5s ease both;
  animation-delay: .2s;
}

.total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(99,179,237,0.06);
  font-size: 13px;
}

.total-row:last-child { border-bottom: none; }
.total-label { color: var(--muted); font-weight: 500; }
.total-val { font-weight: 700; color: var(--text); }
.total-val.green { color: var(--green); }
.total-val.red { color: var(--red); }

.grand-total {
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(6,182,212,0.06));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px;
}

.gt-label {
  font-size: 13px; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: .5px;
}

.gt-val {
  font-family: 'Sora', sans-serif;
  font-size: 22px; font-weight: 700;
  color: var(--accent2);
}

/* ── INVOICE PREVIEW ── */
.invoice-toggle {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}

.toggle-switch {
  width: 42px; height: 24px; background: var(--card2);
  border-radius: 12px; position: relative; cursor: pointer;
  border: 1px solid var(--border); transition: background .2s;
}

.toggle-switch.on { background: var(--accent); border-color: var(--accent); }

.toggle-knob {
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  position: absolute; top: 2px; left: 2px; transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-switch.on .toggle-knob { transform: translateX(18px); }
.toggle-label { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── ACTION BUTTONS ── */
.action-row {
  display: flex; gap: 12px; margin-top: 18px;
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #059669);
  color: #fff; flex: 1; border: none; padding: 10px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all .25s; font-size: 13px;
  box-shadow: 0 4px 15px rgba(16,185,129,0.3);
}

.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(16,185,129,0.4); }

/* ── QUICK STATS (RIGHT SIDEBAR) ── */
.quick-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  animation: fadeUp .4s ease both;
}

.qs-title {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
}

.qs-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid rgba(99,179,237,0.05);
  font-size: 12px;
}

.qs-row:last-child { border-bottom: none; }
.qs-k { color: var(--muted); }
.qs-v { font-weight: 700; color: var(--text); }
.qs-v.blue { color: var(--accent2); }

/* ── STEP INDICATOR ── */
.steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 22px;
}

.step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
}

.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}

.step.done .step-num { background: var(--green); color: #fff; }
.step.active .step-num { background: var(--accent); color: #fff; box-shadow: 0 0 12px rgba(59,130,246,0.4); }
.step.inactive .step-num { background: var(--card2); color: var(--muted); }
.step.done .step-label { color: var(--green); }
.step.active .step-label { color: #fff; }
.step.inactive .step-label { color: var(--muted); }

.step-line {
  flex: 1; height: 1px; margin: 0 10px;
  background: var(--border);
  min-width: 20px;
}

.step-line.done { background: var(--green); }

/* ── FIELD INPUT PRICE ── */
.input-prefix-wrap {
  position: relative;
}

.input-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: var(--muted);
}

.input-prefix-wrap input { padding-left: 30px; }


/* -- MOBILE APP RESPONSIVENESS -- */
@media (max-width: 768px) {
  /* Main Container Adjustment */
  body {
    padding-bottom: 65px; /* space for bottom nav */
    background: var(--bg);
  }
  
  .main {
    margin-left: 0;
    width: 100%;
    min-height: calc(100vh - 65px);
  }

  .content {
    padding: 16px;
  }

  /* Topbar fixed and small */
  .topbar {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  }

  .topbar-left h1 {
    font-size: 15px;
  }
  
  .topbar-left p {
    font-size: 10px;
  }

  .filter-tabs {
    display: none; /* Hide filter tabs on small screens if space is tight, or scroll them */
  }

  .icon-btn {
    width: 30px; height: 30px; font-size: 13px;
  }

  /* Sidebar to Bottom Nav (App-like) */
  .sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 65px;
    min-height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    z-index: 100;
    background: var(--bg2);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    overflow: visible;
  }

  .logo-area, .sidebar-footer, .nav-label, .sub-items {
    display: none !important;
  }

  .nav-section {
    padding: 0;
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
  }

  .nav-item {
    flex-direction: column;
    padding: 8px 0;
    margin: 0;
    gap: 4px;
    font-size: 9px;
    border-radius: 8px;
    border: none !important;
    background: transparent !important;
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  .nav-icon {
    font-size: 20px;
    margin: 0 auto;
  }

  .nav-item.active {
    color: var(--accent) !important;
    background: transparent !important;
    border: none !important;
  }
  
  .nav-item.active .nav-icon {
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(59,130,246,0.6);
  }

  .nav-dot { display: none !important; }
  .nav-item span { display: block; font-weight: 600; }

  /* Grid Adjustments */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-icon {
    width: 32px; height: 32px; font-size: 15px; margin-bottom: 8px;
  }

  .stat-value {
    font-size: 20px;
  }

  .charts-row, .bottom-row, .form-grid {
    grid-template-columns: 1fr;
  }

  .platform-bar {
    justify-content: space-between;
  }

  .platform-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 4px;
    font-size: 11px;
    text-align: center;
  }

  .platform-btn span {
    display: none; /* Only show icons on very small screens or keep text short */
  }

  .card, .section-card, .table-card {
    padding: 16px;
    border-radius: 12px;
  }

  .order-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .banner-right {
    width: 100%;
    justify-content: space-between;
  }

  .field-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .source-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .med-table-wrap {
    overflow-x: auto;
  }

  .med-table th, .med-table td {
    padding: 8px;
    font-size: 11.5px;
  }

  .action-row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Modals/Popups if any */
  .medicine-suggestions {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    max-height: 50vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    border: none;
    border-top: 1px solid rgba(59,130,246,0.3);
    z-index: 9999;
  }
  
  .medicine-search-wrap input:focus + .medicine-suggestions {
    display: block;
  }

}

@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* -- MOBILE NAV AND DRAWER -- */
.mobile-bottom-nav {
  display: none;
}

.mobile-drawer {
  display: none;
}

@media (max-width: 768px) {
  /* Hide the regular sidebar since we use the custom bottom nav now */
  .sidebar { display: none !important; }

  .mobile-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 65px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  }

  .mobile-bottom-nav .nav-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--muted); text-decoration: none; font-size: 10px; gap: 4px;
    flex: 1; position: relative;
    transition: all .2s;
  }

  .mobile-bottom-nav .nav-btn .icon {
    font-size: 20px;
    transition: all .2s;
  }

  .mobile-bottom-nav .nav-btn.active {
    color: var(--accent);
  }

  .mobile-bottom-nav .nav-btn.active .icon {
    transform: translateY(-2px);
    text-shadow: 0 0 10px rgba(59,130,246,0.6);
  }

  .mobile-drawer {
    display: block;
    position: fixed;
    top: 0; bottom: 0; right: -300px;
    width: 260px;
    background: var(--sidebar);
    z-index: 1001;
    transition: right .3s ease;
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    border-left: 1px solid var(--border);
  }

  .mobile-drawer.open {
    right: 0;
  }

  .drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px; border-bottom: 1px solid var(--border);
  }

  .drawer-header h3 {
    font-family: 'Sora', sans-serif; font-size: 16px; font-weight: 700; color: #fff;
  }

  .drawer-header button {
    background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer;
  }

  .drawer-content {
    padding: 20px 10px;
    display: flex; flex-direction: column; gap: 8px;
  }

  .drawer-content a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  }

  .drawer-content a:hover {
    background: var(--card); color: var(--text);
  }
}
