/* ============================================================
   E-BIKE SHOWROOM - ADMIN THEME
   White / Blue / Light Grey  +  Dark Mode
   ============================================================ */

:root {
  --eb-primary: #2b6cff;
  --eb-primary-dark: #1e56d4;
  --eb-primary-light: #eaf1ff;
  --eb-bg: #f4f6fb;
  --eb-card: #ffffff;
  --eb-border: #e6e9f2;
  --eb-text: #1f2937;
  --eb-text-muted: #6b7280;
  --eb-sidebar-bg: #ffffff;
  --eb-sidebar-text: #4b5563;
  --eb-sidebar-active: #eaf1ff;
  --eb-shadow: 0 4px 18px rgba(43, 108, 255, 0.08);
  --eb-shadow-lg: 0 12px 32px rgba(17, 24, 39, 0.12);
  --eb-radius: 14px;
}

[data-bs-theme="dark"] {
  --eb-bg: #0f1420;
  --eb-card: #161d2e;
  --eb-border: #263046;
  --eb-text: #e5e7eb;
  --eb-text-muted: #94a3b8;
  --eb-sidebar-bg: #121826;
  --eb-sidebar-text: #cbd5e1;
  --eb-sidebar-active: #1e2b4f;
}

* { outline: none; }

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--eb-bg);
  color: var(--eb-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: clamp(.85rem, .8rem + .25vw, .92rem);
  line-height: 1.5;
}

img { max-width: 100%; height: auto; }
svg, canvas { max-width: 100%; }
table { max-width: 100%; }

/* ---------- Layout ---------- */
.app-layout { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

.app-sidebar {
  width: 262px; flex-shrink: 0;
  background:
    radial-gradient(120% 55% at 100% -8%, color-mix(in srgb, var(--eb-primary) 15%, transparent), transparent 62%),
    var(--eb-sidebar-bg);
  border-right: 1px solid var(--eb-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden;
  transition: width .25s ease, margin-left .25s ease;
  z-index: 1040;
}
.app-sidebar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--eb-primary), #7aa2ff, var(--eb-primary));
}
.app-main { flex-grow: 1; min-width: 0; height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }

.sidebar-brand {
  position: relative;
  display: flex; align-items: center; gap: .75rem;
  padding: 1.05rem 1.15rem 1rem;
  border-bottom: 1px solid var(--eb-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--eb-primary) 7%, transparent), transparent);
}
.sidebar-brand::after {
  content: ''; position: absolute; left: 1.15rem; right: 1.15rem; bottom: -1px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, var(--eb-primary), transparent);
}
.brand-logo {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--eb-primary), #7aa2ff);
  box-shadow: 0 6px 14px rgba(43,108,255,.35), inset 0 1px 0 rgba(255,255,255,.28);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.35rem;
  overflow: hidden; flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-text { line-height: 1.25; overflow: hidden; }
.brand-text strong { display: block; font-size: 1rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand-text small { color: var(--eb-text-muted); font-size: .76rem; }

.sidebar-nav { flex-grow: 1; overflow-y: auto; padding: .6rem .75rem 1rem; scrollbar-width: thin; scrollbar-color: var(--eb-border) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--eb-border); border-radius: 6px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-heading {
  font-size: .9rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--eb-text-muted);
  padding: 1.05rem .55rem .4rem;
  display: flex; align-items: center; justify-content: space-between; gap: .4rem;
  cursor: pointer; user-select: none; transition: color .18s ease;
}
.sidebar-heading .sidebar-heading-label { display: inline-flex; align-items: center; gap: .5rem; }
.sidebar-heading .sidebar-heading-label i {
  font-size: .85rem; width: 22px; height: 22px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--eb-sidebar-active); color: var(--eb-primary);
  transition: all .18s ease;
}
.sidebar-heading:hover { color: var(--eb-primary); }
.sidebar-heading:hover .sidebar-heading-label i { background: var(--eb-primary); color: #fff; }
.sidebar-heading .bi-chevron-down { font-size: .72rem; opacity: .5; transition: transform .22s ease, opacity .18s ease; }
.sidebar-heading:hover .bi-chevron-down { opacity: 1; }
.sidebar-heading.collapsed .bi-chevron-down { transform: rotate(-90deg); }
.sidebar-group { display: none; }
.sidebar-group.show { display: block; }
.sidebar-link {
  position: relative;
  display: flex; align-items: center; gap: .7rem;
  color: var(--eb-sidebar-text); text-decoration: none;
  padding: .5rem .65rem; border-radius: 12px; margin-bottom: 3px;
  font-weight: 500; font-size: .8rem;
  transition: background .18s ease, color .18s ease, transform .12s ease, box-shadow .18s ease;
}
.sidebar-link i {
  font-size: 1.05rem; width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--eb-text-muted); transition: all .18s ease;
}
.sidebar-link:hover { background: var(--eb-sidebar-active); color: var(--eb-primary); transform: translateX(2px); }
.sidebar-link:hover i { color: var(--eb-primary); }
.sidebar-link:focus-visible { outline: 2px solid var(--eb-primary); outline-offset: 2px; }
.sidebar-link.active {
  background: linear-gradient(135deg, var(--eb-primary), var(--eb-primary-dark));
  color: #fff; box-shadow: 0 6px 16px rgba(43,108,255,.35);
}
.sidebar-link.active i { color: #fff; }
.sidebar-foot {
  padding: .85rem 1.15rem; border-top: 1px solid var(--eb-border);
  background: color-mix(in srgb, var(--eb-primary) 4%, transparent);
}
.sidebar-foot span { font-size: .74rem; letter-spacing: .02em; color: var(--eb-text-muted); }

/* Collapsed (icon-only) sidebar on desktop */
@media (min-width: 992px) {
  .app-sidebar.collapsed { width: 76px; }
  .app-sidebar.collapsed .sidebar-brand { justify-content: center; padding: 1rem .5rem; }
  .app-sidebar.collapsed .brand-text,
  .app-sidebar.collapsed .sidebar-link span,
  .app-sidebar.collapsed .sidebar-foot span { display: none; }
  .app-sidebar.collapsed .sidebar-heading {
    margin: .7rem .5rem .4rem; padding: 0; text-align: center; font-size: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .app-sidebar.collapsed .sidebar-heading .sidebar-heading-label { display: none; }
  .app-sidebar.collapsed .sidebar-heading::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--eb-border);
  }
  .app-sidebar.collapsed .sidebar-heading.heading-active::before { background: var(--eb-primary); }
  .app-sidebar.collapsed .sidebar-heading .bi-chevron-down { display: none; }
  .app-sidebar.collapsed .sidebar-group { display: block !important; }
  .app-sidebar.collapsed .sidebar-link { justify-content: center; gap: 0; padding: .5rem; width: 44px; margin: 0 auto 4px; position: relative; }
  .app-sidebar.collapsed .sidebar-link:hover { transform: none; }
  .app-sidebar.collapsed .sidebar-link i { width: 28px; height: 28px; font-size: 1.2rem; margin: 0; }
  .app-sidebar.collapsed .sidebar-link.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 24px; background: #fff; border-radius: 0 3px 3px 0;
  }
  .app-sidebar.collapsed .sidebar-nav { padding: .6rem .5rem; }
  .app-sidebar.collapsed .sidebar-foot { padding: .75rem .5rem; text-align: center; }
  .app-sidebar.collapsed .sidebar-foot span { font-size: .58rem; }
}

/* ---------- Topbar ---------- */
.app-topbar {
  position: sticky; top: 0; z-index: 1030;
  background: color-mix(in srgb, var(--eb-card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--eb-border);
  padding: .55rem 1.25rem;
}
.topbar-inner { min-width: 0; }
.topbar-inner > .dropdown, .topbar-inner > .btn, .topbar-inner > a.btn { flex-shrink: 0; }
.btn-icon {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--eb-border); background: var(--eb-card); color: var(--eb-text);
  border-radius: 10px; flex-shrink: 0;
}
.btn-icon:hover { color: var(--eb-primary); border-color: var(--eb-primary); }
.breadcrumb-bar { font-size: .85rem; }

.btn-profile {
  border: 1px solid var(--eb-border); background: var(--eb-card); border-radius: 12px; padding: .3rem .6rem;
  flex-shrink: 0;
}
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--eb-primary), #5b8cff);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Mobile search toggle (hidden on desktop) */
.search-toggle-mobile { display: none; }

/* ---------- Global Search ---------- */
.global-search { position: relative; width: 320px; max-width: 100%; }
.global-search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--eb-text-muted); }
.global-search .form-control { padding-left: 34px; border-radius: 20px; background: var(--eb-bg); border: 1px solid var(--eb-border); }
.search-results {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--eb-card); border: 1px solid var(--eb-border); border-radius: 12px;
  max-height: 420px; overflow-y: auto; z-index: 1050;
}
.search-results.show { display: block; }
.search-group { padding: .5rem .9rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--eb-text-muted); }
.search-item { display: flex; gap: .6rem; align-items: center; padding: .55rem .9rem; text-decoration: none; color: var(--eb-text); min-width: 0; }
.search-item:hover { background: var(--eb-bg); }
.search-item .icon-box { width: 34px; height: 34px; border-radius: 9px; background: var(--eb-primary-light); color: var(--eb-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.search-item > span:last-child { min-width: 0; }
.search-item span span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item small { display: block; color: var(--eb-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Notifications ---------- */
.notif-badge {
  position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px; padding: 0 4px;
  background: #ef4444; color: #fff; font-size: .62rem; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.notif-panel { width: 340px; max-width: calc(100vw - 24px); padding: 0; }
.notif-head { padding: .7rem 1rem; font-weight: 600; border-bottom: 1px solid var(--eb-border); }
.notif-body { max-height: min(340px, 60vh); overflow-y: auto; }
.notif-item { padding: .6rem 1rem; border-bottom: 1px solid var(--eb-border); font-size: .85rem; }
.notif-item div { min-width: 0; }
.notif-foot { padding: .5rem 1rem; border-top: 1px solid var(--eb-border); text-align: center; }

/* ---------- Content ---------- */
.app-content {
  padding: clamp(.9rem, 1.5vw, 1.25rem);
  flex-grow: 1; min-width: 0; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.app-content .container-fluid { padding-left: 0; padding-right: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--eb-card); border: 1px solid var(--eb-border);
  border-radius: var(--eb-radius); box-shadow: var(--eb-shadow);
}
.card-header { background: transparent; border-bottom: 1px solid var(--eb-border); padding: .9rem 1.15rem; font-weight: 600; }
.card-body { padding: 1.15rem; }

/* ---------- Stat cards ---------- */
.stat-card {
  border-radius: var(--eb-radius); padding: 1.1rem 1.15rem;
  background: var(--eb-card); border: 1px solid var(--eb-border);
  box-shadow: var(--eb-shadow); position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  height: 100%;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--eb-shadow-lg); }
.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: 12px; font-size: 1.35rem;
  display: flex; align-items: center; justify-content: center; margin-bottom: .7rem;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--eb-text-muted); font-size: .8rem; }
.stat-card .stat-trend { font-size: .75rem; }
.bg-soft-primary { background: var(--eb-primary-light); color: var(--eb-primary); }
.bg-soft-green { background: #e3f7ec; color: #16a34a; }
.bg-soft-red { background: #fdeaea; color: #dc2626; }
.bg-soft-amber { background: #fef3e2; color: #d97706; }
.bg-soft-purple { background: #f0e9fd; color: #7c3aed; }
.bg-soft-cyan { background: #e0f6fb; color: #0891b2; }
.bg-soft-slate { background: #eef1f6; color: #475569; }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--eb-text-muted); border-bottom: 1px solid var(--eb-border); font-weight: 600;
}
.table td, .table th { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--eb-bg); }
.table-actions .btn { padding: .2rem .4rem; font-size: .95rem; }

/* ---------- Forms ---------- */
.form-label { font-size: .8rem; font-weight: 600; color: var(--eb-text); margin-bottom: .3rem; }
.form-control, .form-select {
  background: var(--eb-card); border: 1px solid var(--eb-border); color: var(--eb-text);
  border-radius: 10px; font-size: .9rem; padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus { border-color: var(--eb-primary); box-shadow: 0 0 0 .2rem rgba(43,108,255,.12); }
.form-control::placeholder { color: var(--eb-text-muted); }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-size: .88rem; }
.btn-primary { background: var(--eb-primary); border-color: var(--eb-primary); }
.btn-primary:hover { background: var(--eb-primary-dark); border-color: var(--eb-primary-dark); }
.btn-light { background: var(--eb-bg); border-color: var(--eb-border); color: var(--eb-text); }
.btn-outline-primary { color: var(--eb-primary); border-color: var(--eb-primary); }
.btn-soft { background: var(--eb-primary-light); color: var(--eb-primary); border: 0; }
.btn-soft:hover { background: var(--eb-primary); color: #fff; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; }
.text-available { color: #16a34a; }
.text-sold { color: #64748b; }
.text-reserved { color: #d97706; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h4 { font-weight: 700; margin: 0; }
.page-head > :nth-child(2) { margin-left: auto; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eaf1ff 0%, #f4f6fb 50%, #e6edff 100%);
  padding: 1rem;
}
.login-card { width: 100%; max-width: 420px; }
.login-logo {
  width: 62px; height: 62px; border-radius: 18px; font-size: 2rem;
  background: linear-gradient(135deg, var(--eb-primary), #5b8cff);
  color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto;
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff !important; }
  .app-layout, .app-main { height: auto !important; overflow: visible !important; }
  .app-content { padding: 0 !important; height: auto !important; overflow: visible !important; }
  .app-sidebar, .app-topbar, .no-print, .app-content .alert { display: none !important; }
  .card { border: none !important; box-shadow: none !important; }
  .print-area { width: 100%; }
}

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.stat-card, .card { animation: fadeUp .35s ease both; }
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }

/* ---------- Misc ---------- */
.avatar-lg { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; }
.chart-box { position: relative; height: 280px; }
.chart-box-sm { position: relative; height: 220px; }
.text-primary { color: var(--eb-primary) !important; }
.cursor-pointer { cursor: pointer; }
.min-w-150 { min-width: 150px; }
.stock-cell.low { color: #dc2626; font-weight: 700; }

.pagination { margin-bottom: 0; }

/* Invoice preview modal */
.invoice-preview { background: #fff; color: #111; padding: 0; font-size: .85rem; }
.invoice-preview .table { color: #111; }
.invoice-preview .table th { color: #111; border-color: #ddd; }

/* print area inside modal */
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { position: absolute; left: 0; top: 0; width: 100%; }
}

/* ============================================================
   RESPONSIVE SYSTEM (mobile-first + enhancement breakpoints)
   ============================================================ */

/* ---------- Charts ---------- */
.chart-box { height: clamp(220px, 26vh, 300px); }
.chart-box-sm { height: clamp(180px, 22vh, 240px); }

/* ---------- Dropdowns stay in viewport ---------- */
.dropdown-menu {
  max-width: calc(100vw - 20px);
}
.dropdown-menu.dropdown-menu-end {
  right: 0; left: auto;
}
@media (max-width: 575.98px) {
  .dropdown-menu.dropdown-menu-end:not(.notif-panel) {
    right: 0; left: auto;
    transform: none;
  }
  /* Notification panel pins to viewport so it can never overflow */
  .dropdown-menu.notif-panel {
    position: fixed;
    left: 10px; right: 10px;
    top: 62px;
    width: auto;
    max-width: none;
    transform: none;
  }
}

/* ---------- Modals never overflow the viewport ---------- */
@media (max-width: 767.98px) {
  .modal-dialog { margin: .5rem auto; max-width: calc(100% - 1rem); }
  .modal-dialog.modal-fullscreen { max-width: 100%; margin: 0; }
  .modal-dialog-centered { margin: .5rem auto; }
}
@media (max-width: 991.98px) {
  .modal-xl, .modal-lg { max-width: calc(100vw - 1rem); }
}
.modal-header { gap: .5rem; }
.modal-title { word-break: break-word; }
.modal-dialog:not(.modal-dialog-scrollable) .modal-body { max-height: 70vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-footer { flex-wrap: wrap; }
.modal-footer .btn { margin-bottom: .25rem; }
.modal-content { min-width: 0; }

/* ---------- Forms & buttons ---------- */
.btn { white-space: normal; }
.form-control, .form-select { max-width: 100%; }

/* ---------- Premium date range filter ---------- */
.date-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .4rem .55rem;
  background: var(--eb-card);
  border: 1px solid var(--eb-border);
  border-radius: .75rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  max-width: 100%;
}
.date-filter::before {
  content: "\f1e4";
  font-family: "bootstrap-icons";
  color: var(--eb-primary);
  font-size: 1.1rem;
  line-height: 1;
}
.date-filter .form-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--eb-text-muted);
  margin-bottom: 0;
}
.date-filter .df-range,
.date-filter .df-from,
.date-filter .df-to {
  height: auto;
  padding: .34rem .55rem;
  font-size: .85rem;
  color: var(--eb-text);
  background-color: var(--eb-bg);
  border: 1px solid var(--eb-border);
  border-radius: .45rem;
  min-width: 0;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.date-filter .df-range { min-width: 9rem; }
.date-filter .df-from, .date-filter .df-to { width: 8.5rem; }
.date-filter .df-range:hover,
.date-filter .df-from:hover,
.date-filter .df-to:hover { border-color: #c6d2ea; }
.date-filter .df-range:focus,
.date-filter .df-from:focus,
.date-filter .df-to:focus {
  border-color: var(--eb-primary);
  box-shadow: 0 0 0 .18rem var(--eb-primary-light);
  outline: none;
}
.date-filter .text-secondary { font-size: .8rem; color: var(--eb-text-muted); }
@media (max-width: 575.98px) {
  .date-filter { width: 100%; }
  .date-filter .df-range { width: 100%; min-width: 0; }
  .date-filter .df-from, .date-filter .df-to { flex: 1 1 0; width: auto; min-width: 0; }
}

/* ---------- Table action buttons / export toolbar ---------- */
.export-toolbar { text-align: right; }
.table-actions { white-space: nowrap; }
.table-responsive { -webkit-overflow-scrolling: touch; }
.table-responsive table { min-width: 0; }
.table td, .table th { overflow-wrap: break-word; }

/* ---------- Filter/search inputs with inline min-width become fluid on mobile ---------- */
@media (max-width: 767.98px) {
  input.form-control[style*="min-width"] {
    min-width: 0 !important;
    width: 100%;
    max-width: 100%;
  }
  .row > .col-auto:has(input.form-control[style*="min-width"]),
  .row.g-2 > .col-auto:has(input.form-control[style*="min-width"]) {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* ---------- Card headers wrap on small screens ---------- */
.card-header.d-flex, .modal-header, .page-head { flex-wrap: wrap; }

/* ============================================================
   TABLET (768px - 1024px)
   ============================================================ */
@media (max-width: 991.98px) {
  body.sidebar-open { overflow: hidden; }
  .app-sidebar { position: fixed; left: 0; top: 0; margin-left: -262px; box-shadow: var(--eb-shadow-lg); }
  .app-sidebar.open { margin-left: 0; }
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
  .sidebar-backdrop.show { display: block; }
  .global-search { width: 190px; }
  .app-topbar { padding: .55rem .9rem; }
}

/* ============================================================
   MOBILE (up to 767px)
   ============================================================ */
@media (max-width: 767.98px) {
  /* Touch-friendly controls */
  .btn-icon { width: 42px; height: 42px; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  .form-control, .form-select { min-height: 42px; }
  .form-control-sm, .form-select-sm { min-height: 32px; }
  .input-group .form-control { min-height: 42px; }
  .pagination .page-link { min-width: 38px; text-align: center; }

  .stat-value { font-size: clamp(1.25rem, 1.1rem + 1vw, 1.45rem); }
  .page-head h4 { font-size: clamp(1.1rem, 1rem + 1.2vw, 1.3rem); }
  .global-search { width: 100%; }
}

/* ============================================================
   SMALL MOBILE (up to 575px)
   ============================================================ */
@media (max-width: 575.98px) {
  .app-content { padding: .8rem; }
  .app-topbar { padding: .5rem .7rem; }
  .topbar-inner { gap: .35rem !important; }
  .theme-toggle-btn { display: none; }

  /* Mobile search: hidden by default, expands below topbar when toggled */
  .search-toggle-mobile { display: inline-flex; }
  .global-search {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    width: 100%;
    padding: .65rem .75rem;
    background: var(--eb-card);
    border-bottom: 1px solid var(--eb-border);
    box-shadow: 0 10px 20px rgba(0,0,0,.10);
    z-index: 1032;
  }
  .app-topbar.search-open .global-search { display: block; }
  .app-topbar.search-open .search-toggle-mobile i { transform: rotate(90deg); }
  .search-results { top: calc(100% + 4px); }

  .notif-head, .notif-item, .notif-foot { padding-left: .75rem; padding-right: .75rem; }

  .card-header { padding: .75rem .9rem; }
  .card-body { padding: .95rem; }
  .stat-card { padding: .95rem 1rem; }

  .page-head { flex-direction: column; align-items: stretch; }
  .page-head > .btn { width: 100%; }
  .page-head > div { width: 100%; }
}

/* ============================================================
   DESKTOP (1025px and up)
   ============================================================ */
@media (min-width: 1025px) {
  .app-content { padding: 1.35rem; }
}

/* Keep `d-*-block`/`d-*-none` working with sticky topbar */
@media (min-width: 576px) and (max-width: 767.98px) {
  .global-search { display: block; width: 190px; position: relative; left: auto; right: auto; padding: 0; background: transparent; border: 0; box-shadow: none; }
  .search-toggle-mobile { display: none !important; }
  .global-search .search-results { top: calc(100% + 8px); }
}

/* Call log timeline */
.call-timeline { position: relative; padding-left: 22px; }
.call-timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--eb-border, #dee2e6); }
.call-item { position: relative; padding-bottom: 14px; }
.call-item:last-child { padding-bottom: 0; }
.call-item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #6c757d; }
.call-item.incoming::before { border-color: #0d6efd; }
.call-item.outgoing::before { border-color: #198754; }
.call-item.visit::before { border-color: #6f42c1; }
.call-item.whatsapp::before { border-color: #0dcaf0; }
.call-item.note::before { border-color: #adb5bd; }
.call-item .call-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.call-item .call-meta { font-size: .78rem; color: #6c757d; }

/* Hide modal header close (X) buttons */
.modal-header .btn-close { display: none; }
