/* ============================================================
   Smart Bay Technology - Master Stylesheet
   Brand: Black / Cyan / White
   ============================================================ */

/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
  --bg-primary:    #0a0a0a;
  --bg-secondary:  #111827;
  --bg-sidebar:    #0d1117;
  --bg-card:       #1a1f2e;
  --accent:        #00b4d8;
  --accent-hover:  #0096c7;
  --accent-light:  #48cae4;
  --text-primary:  #ffffff;
  --text-secondary:#9ca3af;
  --text-muted:    #4b5563;
  --border:        #1f2937;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;
  --sidebar-width: 260px;
  --topbar-height: 65px;
  --border-radius: 8px;
  --transition:    all 0.3s ease;
}

/* ── CSS Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 0.75rem; color: var(--text-secondary); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-light); }

img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ── Layout Wrapper ──────────────────────────────────────────── */
.wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  transition: transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sidebar-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
}
.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-logo-text .name  { color: var(--accent); font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-logo-text .tagline { color: var(--text-secondary); font-size: 10px; margin-top: 2px; }

/* Logo-only mode: centre and enlarge the logo */
.sidebar-logo--logo_only {
  justify-content: center;
  padding: 12px 16px;
}
.sidebar-logo--logo_only img {
  width: 100%;
  height: auto;
  max-height: 70px;
  max-width: 210px;
  object-fit: contain;
  border-radius: 6px;
}

/* Name-only mode: no gap needed for missing image */
.sidebar-logo--name_only {
  gap: 0;
}

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { position: relative; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.sidebar-nav a:hover {
  background: rgba(0, 180, 216, 0.08);
  color: var(--accent);
  border-left-color: transparent;
}
.sidebar-nav a.active {
  background: rgba(0, 180, 216, 0.12);
  color: var(--accent);
  border-left-color: var(--accent);
}
.sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}
.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 15px 20px 5px;
  letter-spacing: 1px;
  font-weight: 600;
}
.nav-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 15px;
}

/* Submenus */
.sidebar-submenu { display: none; background: rgba(0, 0, 0, 0.2); }
.sidebar-submenu a {
  padding-left: 50px;
  font-size: 13px;
}
.sidebar-submenu.open { display: block; }
.has-submenu > a .submenu-arrow { margin-left: auto; transition: transform 0.3s ease; font-size: 12px; }
.has-submenu.open > a .submenu-arrow { transform: rotate(90deg); }

/* Sidebar footer */
.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info .name { color: var(--text-primary); font-size: 13px; font-weight: 600; line-height: 1.3; }
.sidebar-user-info .role { color: var(--accent); font-size: 10px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.sidebar-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: var(--transition);
  font-size: 15px;
}
.sidebar-logout:hover { color: var(--danger); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}
.sidebar-overlay.active { display: block; }

/* ── Main Content Area ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 25px;
  gap: 15px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  min-width: 0;
}
.hamburger {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}
.hamburger:hover { color: var(--accent); background: rgba(0,180,216,0.1); }
.page-title {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-shrink: 0;
}
.topbar-brand {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}
.topbar-user i { font-size: 15px; }
.topbar-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.topbar-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Trading Session Badge (topbar) ─────────────────────────── */
.session-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .2s;
}
.session-badge:hover { opacity: .85; text-decoration: none; }
.session-badge--active {
  background: rgba(16,185,129,.15);
  color: #10b981;
  border: 1px solid rgba(16,185,129,.4);
}
.session-badge--inactive {
  background: rgba(239,68,68,.12);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,.35);
}
.session-badge--stale {
  background: rgba(124,58,237,.15);
  color: #7c3aed;
  border: 1px solid rgba(124,58,237,.4);
  animation: stalePulse 2s infinite;
}
@keyframes stalePulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(124,58,237,.4); }
  50%      { box-shadow: 0 0 0 5px rgba(124,58,237,.0); }
}
.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  animation: sessionPulse 2s infinite;
}
@keyframes sessionPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
  50%      { box-shadow: 0 0 0 5px rgba(16,185,129,.0); }
}
.session-code { font-weight: 700; }
.session-timer { font-variant-numeric: tabular-nums; opacity: .85; }

/* ── Email tag widget ───────────────────────────────────────── */
.email-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(27,108,168,.15);
  color: #1b6ca8;
  border: 1px solid rgba(27,108,168,.35);
  border-radius: 20px;
  padding: 4px 10px 4px 12px;
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Trading Session — Cash Calc Box ────────────────────────── */
.session-calc-box {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 4px 0;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.session-calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.session-calc-row:last-child { border-bottom: none; }
.session-calc-total {
  background: rgba(16,185,129,.1);
  font-weight: 700;
  color: #065f46;
  font-size: 1rem;
}

/* ── Page Content ────────────────────────────────────────────── */
.page-content { padding: 25px; flex: 1; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}
.page-header h1 { font-size: 22px; color: var(--text-primary); font-weight: 600; }
.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.breadcrumb a { color: var(--accent); }
.breadcrumb span { color: var(--text-muted); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: hidden;
}
.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.card-header h3 { font-size: 16px; color: var(--text-primary); font-weight: 600; margin: 0; }
.card-body { padding: 20px; }
.card-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Stat Cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: var(--transition);
  text-decoration: none;
}
.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 180, 216, 0.1);
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.cyan   { background: rgba(0,180,216,0.15);   color: var(--accent); }
.stat-icon.green  { background: rgba(16,185,129,0.15);  color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,0.15);  color: var(--warning); }
.stat-icon.red    { background: rgba(239,68,68,0.15);   color: var(--danger); }
.stat-icon.blue   { background: rgba(59,130,246,0.15);  color: var(--info); }
.stat-icon.purple { background: rgba(139,92,246,0.15);  color: #8b5cf6; }
.stat-info .label { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }
.stat-info .value { color: var(--text-primary); font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-info .sub   { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }

/* ── Dashboard grid ──────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; margin-bottom: 20px; }
.dashboard-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
table.dataTable, .table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-primary);
}
table th {
  background: rgba(0, 180, 216, 0.06);
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 15px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
table td {
  padding: 12px 15px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
  font-size: 14px;
}
table tbody tr:hover { background: rgba(255,255,255,0.025); }
table tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 6px; align-items: center; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 500;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control option { background: #0d1117; color: var(--text-primary); }

/* ── Date picker visibility on dark backgrounds ──────────────────────────── */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(0.8);
  cursor: pointer;
  opacity: 0.7;
  padding: 2px;
  border-radius: 3px;
  transition: opacity 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  filter: invert(1) brightness(1);
}
input[type="date"]::-webkit-datetime-edit-fields-wrapper { color: var(--text-primary); }
input[type="date"]::-webkit-datetime-edit-text          { color: var(--text-muted); }
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field    {
  color: var(--text-primary);
  background: transparent;
}
input[type="date"]::-webkit-datetime-edit-month-field:focus,
input[type="date"]::-webkit-datetime-edit-day-field:focus,
input[type="date"]::-webkit-datetime-edit-year-field:focus {
  background: var(--accent);
  color: #fff;
  border-radius: 2px;
  outline: none;
}
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; }
.form-text  { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* Input group */
.input-group { display: flex; }
.input-group .form-control { border-radius: 6px 0 0 6px; border-right: none; }
.input-group .btn { border-radius: 0 6px 6px 0; flex-shrink: 0; }
.input-group-text {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0 12px;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
}
.input-group .input-group-text:first-child { border-radius: 6px 0 0 6px; border-right: none; }
.input-group .input-group-text:last-child  { border-radius: 0 6px 6px 0; border-left: none; }

/* Checkbox / radio */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"],
.form-check input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.form-check-label { color: var(--text-secondary); font-size: 14px; cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
}
.btn-sm  { padding: 6px 12px; font-size: 13px; }
.btn-lg  { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #374151; color: var(--text-primary); }
.btn-secondary:hover { background: #4b5563; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning   { background: var(--warning); color: #0a0a0a; }
.btn-warning:hover { background: #d97706; }
.btn-info      { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; }
.btn-outline-primary { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); color: #fff; }
.btn-outline-secondary { background: transparent; border: 1px solid #374151; color: var(--text-secondary); }
.btn-outline-secondary:hover { background: #374151; color: var(--text-primary); }
.btn-outline-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-icon { padding: 7px 10px; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}
.badge-success   { background: rgba(16,185,129,0.15);  color: var(--success); }
.badge-danger    { background: rgba(239,68,68,0.15);   color: var(--danger); }
.badge-warning   { background: rgba(245,158,11,0.15);  color: var(--warning); }
.badge-info      { background: rgba(59,130,246,0.15);  color: var(--info); }
.badge-secondary { background: rgba(107,114,128,0.15); color: #9ca3af; }
.badge-primary   { background: rgba(0,180,216,0.15);   color: var(--accent); }
.badge-purple    { background: rgba(139,92,246,0.15);  color: #8b5cf6; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}
.alert i { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info    { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
.alert-dismissible { position: relative; padding-right: 40px; }
.alert-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.7;
  color: inherit;
}
.alert-close:hover { opacity: 1; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-header h3 { color: var(--text-primary); font-size: 18px; margin: 0; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
  line-height: 1;
}
.modal-close:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ── Login Page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image: radial-gradient(ellipse at 50% 50%, rgba(0,180,216,0.03) 0%, transparent 70%);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo img { max-height: 80px; margin: 0 auto; }
.login-logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  color: #fff;
  font-weight: 700;
}
.login-logo h1  { color: var(--accent); font-size: 22px; font-weight: 700; margin: 0; }
.login-logo p   { color: var(--text-secondary); font-size: 13px; margin: 4px 0 0; }
.login-title    { font-size: 18px; color: var(--text-primary); font-weight: 600; margin-bottom: 22px; text-align: center; }
.login-footer   { text-align: center; margin-top: 22px; color: var(--text-secondary); font-size: 12px; }

/* Password toggle */
.password-wrapper { position: relative; }
.password-wrapper .form-control { padding-right: 44px; }
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  transition: var(--transition);
}
.password-toggle:hover { color: var(--accent); }

/* ── POS Layout ──────────────────────────────────────────────── */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  height: calc(100vh - var(--topbar-height) - 50px);
}
.pos-products {
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.pos-products::-webkit-scrollbar { width: 4px; }
.pos-products::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.pos-cart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pos-cart-header { padding: 15px 20px; border-bottom: 1px solid var(--border); }
.pos-cart-header h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.pos-cart-footer { padding: 15px 20px; border-top: 1px solid var(--border); }
.pos-cart-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
}
.pos-cart-empty i { font-size: 36px; margin-bottom: 10px; display: block; }

/* Cart items */
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid transparent;
  transition: var(--transition);
}
.cart-item:hover { border-color: rgba(0,180,216,0.2); }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { color: var(--accent); font-size: 12px; margin-top: 2px; }
.cart-item-total { color: var(--accent); font-size: 13px; font-weight: 600; white-space: nowrap; }
.cart-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 3px; font-size: 14px; transition: var(--transition); }
.cart-remove:hover { color: var(--danger); }
.cart-qty { display: flex; align-items: center; gap: 5px; }
.cart-qty-btn {
  width: 24px;
  height: 24px;
  background: var(--border);
  border: none;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.cart-qty-btn:hover { background: var(--accent); }
.cart-qty-input {
  width: 40px;
  text-align: center;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  padding: 2px 4px;
  font-size: 13px;
  outline: none;
}
.cart-qty-input:focus { border-color: var(--accent); }

/* Cart totals */
.cart-totals { margin-bottom: 12px; }
.cart-total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; color: var(--text-secondary); }
.cart-total-row.grand-total {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 8px;
}

/* Product grid (POS) */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,180,216,0.1); }
.product-card .prod-img {
  width: 100%;
  height: 100px;
  object-fit: contain;
  margin-bottom: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
}
.product-card .prod-img-placeholder {
  width: 100%;
  height: 100px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 28px;
}
.product-card .prod-name { font-size: 13px; color: var(--text-primary); font-weight: 500; margin-bottom: 4px; line-height: 1.3; }
.product-card .prod-price { color: var(--accent); font-size: 15px; font-weight: 700; }
.product-card .prod-stock { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.product-card.out-of-stock { opacity: 0.5; cursor: not-allowed; }
.product-card.out-of-stock:hover { border-color: var(--border); transform: none; box-shadow: none; }

/* POS filters */
.pos-filters { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; align-items: center; }
.pos-search { flex: 1; min-width: 200px; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  padding: 5px 14px;
  border-radius: 50px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  white-space: nowrap;
}
.filter-pill.active, .filter-pill:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Online Store (public) ───────────────────────────────────── */
.store-layout { background: #f8fafc; min-height: 100vh; }
.store-header { background: #0a0a0a; position: sticky; top: 0; z-index: 500; }
.store-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.store-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.store-logo img { height: 45px; }
.store-logo-icon {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #00b4d8, #0096c7);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}
.store-logo-text .name    { font-size: 18px; font-weight: 700; color: #00b4d8; }
.store-logo-text .tagline { font-size: 11px; color: #9ca3af; }
.store-cart-btn {
  background: #00b4d8;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: background 0.3s;
  white-space: nowrap;
}
.store-cart-btn:hover { background: #0096c7; }
.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.store-nav { background: #111827; border-bottom: 1px solid rgba(255,255,255,0.08); position: sticky; top: 62px; z-index: 499; }
.store-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.store-nav a {
  color: #9ca3af;
  padding: 12px 16px;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.store-nav a:hover, .store-nav a.active { color: #00b4d8; border-bottom-color: #00b4d8; }

.store-main { max-width: 1200px; margin: 0 auto; padding: 25px 20px; }

.store-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.store-product-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s;
}
.store-product-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.12); transform: translateY(-3px); }
.store-product-img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  padding: 15px;
  background: #f9fafb;
  display: block;
}
.store-product-img-placeholder {
  width: 100%;
  height: 180px;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  font-size: 40px;
}
.store-product-info { padding: 15px; }
.store-product-name  { font-size: 14px; font-weight: 600; color: #1a1a2e; margin-bottom: 4px; line-height: 1.3; }
.store-product-brand { font-size: 12px; color: #9ca3af; margin-bottom: 8px; }
.store-product-price { font-size: 18px; font-weight: 700; color: #00b4d8; }
.store-product-badge { font-size: 11px; padding: 2px 8px; border-radius: 50px; }
.store-add-cart {
  width: 100%;
  background: #00b4d8;
  color: #fff;
  border: none;
  padding: 9px;
  border-radius: 6px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s;
}
.store-add-cart:hover { background: #0096c7; }
.store-add-cart:disabled { background: #d1d5db; cursor: not-allowed; color: #6b7280; }

/* Store cart sidebar */
.store-cart-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 380px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.store-cart-sidebar.open { transform: translateX(0); }
.store-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1999;
  display: none;
}
.store-cart-overlay.active { display: block; }
.store-cart-head {
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0a0a0a;
  color: #fff;
}
.store-cart-head h3 { margin: 0; font-size: 16px; color: #fff; }
.store-cart-close { background: none; border: none; color: #9ca3af; font-size: 22px; cursor: pointer; }
.store-cart-close:hover { color: #ef4444; }
.store-cart-body { flex: 1; overflow-y: auto; padding: 15px; }
.store-cart-foot { padding: 15px; border-top: 1px solid #e5e7eb; background: #f9fafb; }

/* Store cart item */
.store-cart-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.store-cart-item-img { width: 60px; height: 60px; object-fit: contain; border-radius: 6px; background: #f9fafb; padding: 4px; }
.store-cart-item-info { flex: 1; }
.store-cart-item-name { font-size: 13px; font-weight: 600; color: #1a1a2e; margin-bottom: 3px; }
.store-cart-item-price { font-size: 12px; color: #6b7280; }
.store-cart-item-total { font-size: 14px; font-weight: 700; color: #00b4d8; margin-top: 4px; }

/* ── DataTable dark theme overrides ─────────────────────────── */
.dataTables_wrapper { color: var(--text-primary); }
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate .paginate_button { color: var(--text-secondary); }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: #0d1117;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 5px;
  padding: 5px 10px;
  outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--accent); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  border-radius: 4px !important;
  margin: 0 2px !important;
  padding: 4px 10px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.4 !important;
}
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after { color: var(--accent); }

/* ── Charts ──────────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px; }

/* ── Image upload preview ────────────────────────────────────── */
.img-preview-wrap { margin-top: 10px; }
.img-preview {
  max-width: 160px;
  max-height: 160px;
  border-radius: 8px;
  border: 2px solid var(--border);
  object-fit: contain;
  background: rgba(255,255,255,0.03);
  padding: 4px;
}

/* Product image in table */
.product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: contain;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 2px;
}
.product-thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
}

/* ── Utilities ───────────────────────────────────────────────── */
.text-accent   { color: var(--accent); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-info     { color: var(--info); }
.text-muted    { color: var(--text-secondary); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-left     { text-align: left; }
.fw-bold       { font-weight: 700; }
.fw-600        { font-weight: 600; }
.fs-12         { font-size: 12px; }
.fs-13         { font-size: 13px; }
.fs-14         { font-size: 14px; }

.d-flex        { display: flex; }
.d-block       { display: block; }
.d-none        { display: none; }
.d-inline-flex { display: inline-flex; }
.align-center  { align-items: center; }
.align-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }

.gap-5   { gap: 5px; }
.gap-8   { gap: 8px; }
.gap-10  { gap: 10px; }
.gap-12  { gap: 12px; }
.gap-15  { gap: 15px; }
.gap-20  { gap: 20px; }

.mb-0  { margin-bottom: 0; }
.mb-5  { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-25 { margin-bottom: 25px; }
.mb-30 { margin-bottom: 30px; }
.mt-5  { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-25 { margin-top: 25px; }
.ms-auto { margin-left: auto; }
.me-auto { margin-right: auto; }

.p-0  { padding: 0; }
.p-10 { padding: 10px; }
.p-15 { padding: 15px; }
.p-20 { padding: 20px; }

.w-100 { width: 100%; }
.w-auto { width: auto; }

.hidden { display: none !important; }
.visible { display: block !important; }

.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.position-relative { position: relative; }

/* Empty state */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-secondary); }
.empty-state i { font-size: 48px; margin-bottom: 15px; display: block; color: var(--border); }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p  { font-size: 14px; margin-bottom: 15px; }

/* Section divider */
.section-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Color dot */
.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Loading spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 180, 216, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-md { width: 42px; height: 42px; font-size: 16px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }

/* Info box */
.info-box {
  background: rgba(0,180,216,0.06);
  border: 1px solid rgba(0,180,216,0.2);
  border-radius: 8px;
  padding: 15px;
}

/* Quick stats list */
.quick-stat-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 14px; }
.quick-stat-item:last-child { border-bottom: none; }
.quick-stat-item .label { color: var(--text-secondary); }
.quick-stat-item .value { color: var(--text-primary); font-weight: 600; }

/* Stock level indicator */
.stock-indicator { display: flex; align-items: center; gap: 6px; }
.stock-level-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.stock-level-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

/* Receipt / print styles in modal */
.receipt-preview {
  background: #fff;
  color: #000;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
}
.receipt-preview .receipt-header { text-align: center; margin-bottom: 15px; }
.receipt-preview .receipt-divider { border-top: 1px dashed #ccc; margin: 10px 0; }
.receipt-preview .receipt-row { display: flex; justify-content: space-between; }
.receipt-preview .receipt-total { font-weight: 700; font-size: 15px; }

/* ── Dashboard grid classes (used instead of inline styles for responsive control) ── */
.db-kpi  { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 16px; margin-bottom: 24px; }
.db-row1 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.db-row2 { display: grid; grid-template-columns: 1fr 1fr;     gap: 20px; margin-bottom: 20px; }
.db-row3 { display: grid; grid-template-columns: 1fr 1fr;     gap: 20px; margin-bottom: 20px; }

/* ── Responsive ──────────────────────────────────────────────── */

/* Tablet / small desktop — only POS changes, dashboard stays multi-column */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 992px) {
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-cart   { max-height: 450px; }
}

/* ── Mobile only (phones in portrait — does NOT affect tablets) ── */
@media (max-width: 767px) {

  /* Layout */
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .store-product-grid { grid-template-columns: 1fr 1fr; }
  .store-cart-sidebar { width: 100%; }
  .dashboard-row { grid-template-columns: 1fr; }
  .page-content { padding: 12px; }
  .topbar { padding: 0 12px; }
  .topbar-brand { display: none; }
  .session-timer { display: none; }   /* hide HH:MM:SS on mobile — show code only */
  .login-card { padding: 25px 20px; }
  .modal { width: 95%; }

  /* Dashboard grids — stack to single column on phones */
  .db-kpi  { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
  .db-row1 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }
  .db-row2 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }
  .db-row3 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }

  /* Welcome banner — stack and hide date */
  .db-welcome { flex-direction: column !important; gap: 6px !important; padding: 16px 18px !important; }
  .db-welcome-date { display: none !important; }
  .db-welcome h2 { font-size: 18px !important; }

  /* KPI cards — tighter padding on mobile */
  .db-kpi .stat-card { padding: 12px 12px !important; }

  /* Page headers — allow wrapping */
  .page-header { flex-wrap: wrap; gap: 10px; }
  .page-header h1 { font-size: 18px; }

  /* ── Topbar — shrink right side so page title isn't squished ── */
  .topbar { padding: 0 10px; }
  .topbar-right { gap: 8px; }
  .topbar-user span { display: none; }       /* hide name, keep icon */
  .topbar-logout span { display: none; }     /* hide "Logout" text   */

  /* ── Main content — prevent child elements overflowing viewport ── */
  .main-content { min-width: 0; overflow-x: hidden; }
  .page-content  { max-width: 100vw; box-sizing: border-box; }

  /* ── Card headers — wrap title + action button on small screens ── */
  .card-header { flex-wrap: wrap; padding: 12px 14px; gap: 6px; }
  .card-header h3 { font-size: 14px; }

  /* ── KPI values — scale down so numbers fit in 2-column grid ── */
  .kpi-value { font-size: 18px !important; word-break: break-word; }

  /* ── Dashboard tables → card layout on mobile (no scrolling) ── */

  /* Convert table structure to block layout */
  .db-recent-sales,
  .db-recent-sales tbody,
  .db-recent-sales tr,
  .db-low-stock,
  .db-low-stock tbody,
  .db-low-stock tr { display: block !important; }

  /* Hide column headers — labels come from ::before instead */
  .db-recent-sales thead,
  .db-low-stock thead { display: none !important; }

  /* Each table row → a card */
  .db-recent-sales tr,
  .db-low-stock tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
  }

  /* Each cell → a label : value row */
  .db-recent-sales td,
  .db-low-stock td {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    font-size: 13px;
  }
  .db-recent-sales tr td:last-child,
  .db-low-stock  tr td:last-child { border-bottom: none !important; }

  /* Label shown before each cell value */
  .db-recent-sales td::before,
  .db-low-stock   td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 10px;
  }

  /* Hide the row-index # column — no useful info on mobile */
  .db-recent-sales td:nth-child(1),
  .db-low-stock   td:nth-child(1) { display: none !important; }

  /* Recent sales cell labels */
  .db-recent-sales td:nth-child(2)::before { content: "Sale #"; }
  .db-recent-sales td:nth-child(3)::before { content: "Customer"; }
  .db-recent-sales td:nth-child(4)::before { content: "Items"; }
  .db-recent-sales td:nth-child(5)::before { content: "Total"; }
  .db-recent-sales td:nth-child(6)::before { content: "Payment"; }
  .db-recent-sales td:nth-child(7)::before { content: "Staff"; }
  .db-recent-sales td:nth-child(8)::before { content: "Source"; }
  .db-recent-sales td:nth-child(9)::before { content: "Date"; }

  /* Low stock cell labels */
  .db-low-stock td:nth-child(2)::before { content: "Product"; }
  .db-low-stock td:nth-child(3)::before { content: "Category"; }
  .db-low-stock td:nth-child(4)::before { content: "Brand"; }
  .db-low-stock td:nth-child(5)::before { content: "Stock"; }
  .db-low-stock td:nth-child(6)::before { content: "Alert Level"; }
  .db-low-stock td:nth-child(7)::before { content: "Status"; }
  .db-low-stock td:nth-child(8)::before { content: "Action"; }

  /* ── Store header — stack search below logo+cart on phones ── */
  .store-header-inner {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 8px;
    align-items: center;
  }
  .store-logo { flex: 1; min-width: 0; order: 1; }
  .store-logo img { height: 36px; }
  .store-logo-icon { width: 36px; height: 36px; font-size: 16px; }
  .store-logo-text .name { font-size: 15px; }
  .store-logo-text .tagline { display: none; }
  .store-header-search {
    order: 3;
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
  .store-cart-btn {
    order: 2;
    padding: 8px 13px;
    font-size: 13px;
    gap: 5px;
  }

  /* ── Store nav — scrollable tabs, tighter padding ── */
  .store-nav { top: 55px; }
  .store-nav-inner { padding: 0 10px; }
  .store-nav a { padding: 10px 12px; font-size: 13px; }
  /* Hide scrollbar visually but keep scrolling */
  .store-nav-inner::-webkit-scrollbar { height: 0; }
  .store-nav-inner { scrollbar-width: none; }

  /* ── Store main — tighter padding ── */
  .store-main { padding: 14px 12px; }

  /* ── Hero banner — shrink padding and font ── */
  .store-hero { padding: 28px 20px !important; margin-bottom: 18px !important; }
  .store-hero h1 { font-size: 24px !important; }
  .store-hero p  { font-size: 14px !important; margin-bottom: 16px !important; }
  .store-hero .store-hero-features {
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .store-hero .store-hero-features span { text-align: center; justify-content: center; }

  /* ── Product grid — 2 columns on phones ── */
  .store-product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .store-product-img, .store-product-img-placeholder { height: 140px; }
  .store-product-info { padding: 10px; }
  .store-product-name { font-size: 13px; }
  .store-product-price { font-size: 16px; }
  .store-add-cart { font-size: 13px; padding: 8px; }
}

/* ── Small phones (< 480px — S24 Ultra portrait, etc.) ── */
@media (max-width: 480px) {
  /* Store: drop product grid to 1 column so cards are bigger and easier to tap */
  .store-product-grid { grid-template-columns: 1fr; gap: 10px; }
  .store-product-img, .store-product-img-placeholder { height: 180px; }
  .store-hero { padding: 20px 16px !important; }
  .store-hero h1 { font-size: 22px !important; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

  /* Slightly reduce chart heights to fit without scrolling */
  .db-chart-h220 { height: 180px !important; }
  .db-chart-h160 { height: 120px !important; }

  /* Orders donut — centre and stack vertically */
  .db-orders-wrap { flex-direction: column; align-items: center !important; gap: 16px !important; }
}

/* ── Print / Save-as-PDF ─────────────────────────────────────── */
@media print {
  @page { size: A4 landscape; margin: 10mm 12mm; }

  /* ── 1. Redefine ALL dark CSS variables → light for print ── */
  :root {
    --bg-primary:   #ffffff !important;
    --bg-secondary: #f8f8f8 !important;
    --bg-sidebar:   #ffffff !important;
    --bg-card:      #ffffff !important;
    --bg-elevated:  #f4f4f4 !important;
    --bg-hover:     #f0f0f0 !important;
    --text-primary:   #111111 !important;
    --text-secondary: #444444 !important;
    --text-muted:     #666666 !important;
    --border:         #cccccc !important;
    --accent:         #0088bb !important;
    --success:        #16a34a !important;
    --danger:         #dc2626 !important;
    --warning:        #d97706 !important;
    --sidebar-width:  0px     !important;
  }

  /* ── 2. Hide all admin chrome & UI controls ── */
  .sidebar,
  .sidebar-overlay,
  .topbar,
  .no-print,
  .dataTables_paginate,
  .dataTables_length,
  .dataTables_filter,
  .dataTables_info,
  .hamburger,
  canvas                          { display: none !important; }

  /* ── 3. Layout: full-width single column ── */
  body, html   { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .wrapper     { display: block !important; background: #fff !important; }
  .main-content {
    margin-left: 0 !important;
    padding:     0 !important;
    min-height:  auto !important;
    background:  #fff !important;
  }
  .page-content { padding: 0 !important; background: #fff !important; }

  /* ── 4. Print-only report header (injected by JS) ── */
  #printReportHeader {
    display:       block !important;
    border-bottom: 2px solid #0088bb;
    padding-bottom: 10px;
    margin-bottom:  16px;
  }
  #printReportHeader .print-sys-name {
    font-size: 18pt; font-weight: 700; color: #0088bb !important;
  }
  #printReportHeader .print-report-title {
    font-size: 13pt; font-weight: 600; color: #111 !important; margin-top: 2px;
  }
  #printReportHeader .print-meta {
    font-size: 9pt; color: #555 !important; margin-top: 4px;
  }

  /* ── 5. Page header (keep title, hide buttons) ── */
  .page-header         { margin-bottom: 10px !important; border: none !important; background: #fff !important; padding: 0 !important; }
  .page-header h1      { font-size: 14pt !important; color: #111 !important; }
  .page-header-right   { display: none !important; }

  /* ── 6. Cards ── */
  .card {
    box-shadow:   none !important;
    border:       1px solid #ccc !important;
    background:   #fff !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 12px !important;
  }
  .card-header {
    background:   #f4f4f4 !important;
    border-bottom: 1px solid #ccc !important;
    padding:      8px 14px !important;
  }
  .card-header h3   { color: #111 !important; font-size: 11pt !important; }
  .card-header a,
  .card-header button { display: none !important; }
  .card-body { padding: 10px 14px !important; background: #fff !important; }

  /* ── 7. Tables ── */
  .table {
    border-collapse: collapse !important;
    width:     100% !important;
    font-size: 8.5pt !important;
    background: #fff !important;
  }
  .table th {
    background:  #eef2f5 !important;
    color:       #111 !important;
    font-weight: 700 !important;
    border:      1px solid #bbb !important;
    padding:     5px 8px !important;
    white-space: nowrap;
  }
  .table td {
    color:       #111 !important;
    border:      1px solid #ddd !important;
    padding:     4px 8px !important;
    background:  #fff !important;
  }
  .table tbody tr:nth-child(even) td { background: #f9f9f9 !important; }
  .table-responsive { overflow: visible !important; }

  /* ── 8. Stat cards ── */
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    gap: 8px !important;
  }
  .stat-card {
    border:       1px solid #ccc !important;
    background:   #fff !important;
    box-shadow:   none !important;
    break-inside: avoid;
    padding:      8px 12px !important;
  }
  .stat-card .label { color: #555 !important; font-size: 8pt !important; }
  .stat-card .value { color: #111 !important; font-size: 13pt !important; }
  .stat-card .sub   { color: #777 !important; font-size: 8pt !important; }
  .stat-icon        { display: none !important; }

  /* ── 9. Badges ── */
  .badge { border: 1px solid #aaa !important; background: #f0f0f0 !important; color: #111 !important; }

  /* ── 10. All remaining text → black ── */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  h1, h2, h3, h4, h5, p, span, li, div, td, th { color: #111 !important; }
  a { color: #111 !important; text-decoration: none !important; }

  /* ── 11. Progress bars (expense %) → visible ── */
  [style*="background:#"] { background: #ddd !important; }
}
