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

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --font: 'Inter', sans-serif;
  --radius: 8px;
  --radius-sm: 5px;
  --transition: 150ms ease;

  /* Light - Warmer Palette */
  --bg:          #f5f5f4;
  --surface:     #fafaf9;
  --sidebar-bg:  #111827;
  --sidebar-text:#9ca3af;
  --sidebar-act: #ffffff;
  --sidebar-act-bg: rgba(255,255,255,0.08);
  --border:      #e7e5e4;
  --border-dark: #d6d3d1;
  --text:        #1c1917;
  --text-2:      #57534e;
  --text-3:      #a8a29e;
  --accent:      #4f46e5;
  --accent-bg:   #eef2ff;
  --accent-text: #4338ca;
  --success-bg:  #f0fdf4;
  --success-text:#15803d;
  --success-bdr: #bbf7d0;
  --warn-bg:     #fffbeb;
  --warn-text:   #92400e;
  --warn-bdr:    #fde68a;
  --danger-bg:   #fff1f2;
  --danger-text: #be123c;
  --danger-bdr:  #fecdd3;
  --info-bg:     #eff6ff;
  --info-text:   #1d4ed8;
  --info-bdr:    #bfdbfe;
  --shadow:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.07);
}

[data-theme="dark"] {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --sidebar-bg:  #0a1020;
  --sidebar-text:#64748b;
  --sidebar-act: #f1f5f9;
  --sidebar-act-bg: rgba(255,255,255,0.07);
  --border:      #2d3748;
  --border-dark: #334155;
  --text:        #f1f5f9;
  --text-2:      #94a3b8;
  --text-3:      #64748b;
  --accent:      #6366f1;
  --accent-bg:   #1e1b4b;
  --accent-text: #a5b4fc;
  --success-bg:  #052e16;
  --success-text:#4ade80;
  --success-bdr: #166534;
  --warn-bg:     #1c1004;
  --warn-text:   #fbbf24;
  --warn-bdr:    #78350f;
  --danger-bg:   #1c0508;
  --danger-text: #f87171;
  --danger-bdr:  #9f1239;
  --info-bg:     #0c1a3b;
  --info-text:   #93c5fd;
  --info-bdr:    #1e3a8a;
  --shadow:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.4);
}

/* ── RESET & APP FEEL ────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html {
  height: 100%;
  width: 100%;
  overflow: hidden;
}
html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  user-select: none; /* Native app feel */
}
input, textarea, select, .tbl-wrap {
  user-select: auto;
}
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }
a { text-decoration: none; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── LAYOUT ──────────────────────────────────────────────── */
#app-page {
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
.main-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  min-width: 0;
}
.page-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  width: 100%;
  background: var(--bg);
}
.ptr-indicator {
  position: absolute;
  top: 10px;
  left: 50%;
  margin-left: -20px;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transform: translateY(-60px) scale(0.5);
  opacity: 0;
  pointer-events: none;
}
.ptr-indicator.releasing {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}
.ptr-indicator.refreshing {
  transform: translateY(60px) scale(1);
  opacity: 1;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.ptr-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
}
.ptr-indicator.refreshing .ptr-spinner {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
.sidebar-overlay {
  display: none;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.logo-name {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.3px;
}
.logo-sub {
  font-size: 10px;
  color: var(--sidebar-text);
  font-weight: 400;
}
nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 6px 4px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.nav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: #e2e8f0;
}
.nav-btn.active {
  background: var(--sidebar-act-bg);
  color: var(--sidebar-act);
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 600; color: #e2e8f0; }
.user-role { font-size: 10px; color: var(--sidebar-text); }
.btn-logout {
  width: 100%;
  padding: 6px;
  background: transparent;
  border: 1px solid rgba(239,68,68,0.25);
  color: #f87171;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,0.1); }

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
  z-index: 10;
}
[data-theme="dark"] .topbar {
  border-bottom: none;
  box-shadow: none;
  background: #1e293b;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.page-title { font-size: 15px; font-weight: 600; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 4px;
}
.menu-btn:hover { background: var(--bg); }

/* ── THEME TOGGLE ────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-icon { font-size: 14px; }

/* ── PAGE CONTENT ────────────────────────────────────────── */
.page-head {
  margin-bottom: 20px;
}
.page-head h2 { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.page-head p { font-size: 13px; color: var(--text-2); }

/* ── STAT STRIP ──────────────────────────────────────────── */
/* ── CARD & STATS ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  transition: transform 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.05);
}
.icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-box-blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.icon-box-green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.icon-box-yellow { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.icon-box-red { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.icon-box-purple { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }

.stat-info { flex: 1; }
.stat-lbl {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stat-num {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

/* ── CHART & QUICK STATS ROW ── */
.dash-grid-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .dash-grid-row {
    grid-template-columns: 1fr;
  }
}
.chart-card {
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  border: none;
}
.quick-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.qs-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}
.qs-purple { background: rgba(139, 92, 246, 0.04); }
.qs-blue { background: rgba(59, 130, 246, 0.04); }
.qs-green { background: rgba(16, 185, 129, 0.04); }
.qs-yellow { background: rgba(245, 158, 11, 0.04); }
[data-theme="dark"] .qs-purple { background: rgba(139, 92, 246, 0.1); }
[data-theme="dark"] .qs-blue { background: rgba(59, 130, 246, 0.1); }
[data-theme="dark"] .qs-green { background: rgba(16, 185, 129, 0.1); }
[data-theme="dark"] .qs-yellow { background: rgba(245, 158, 11, 0.1); }

.qs-icon {
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 8px;
}
.qs-purple .qs-icon { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.qs-blue .qs-icon { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.qs-green .qs-icon { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.qs-yellow .qs-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

.qs-num { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px; }
.qs-lbl { font-size: 10px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 16px; }

/* ── TABLE ───────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
thead tr { background: var(--bg); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  vertical-align: middle;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
td strong { color: var(--text); font-weight: 600; }

/* ── VISUAL TABLE GROUPING (DESKTOP) ── */
@media (min-width: 901px) {
  /* Using native rowspan for optimal desktop display */
  td[rowspan] {
    vertical-align: middle;
    background: var(--surface);
    border-bottom: 2px solid var(--border-dark);
  }
  /* The last item row in the group needs the same strong bottom border */
  tr.req-row-last td,
  tr.req-row-single td {
    border-bottom: 2px solid var(--border-dark);
  }
}

/* ── FORM ────────────────────────────────────────────────── */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; min-width: 180px; }
.form-group.full { flex: 1 1 100%; }
label { font-size: 12px; font-weight: 600; color: var(--text-2); }
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
textarea { resize: vertical; min-height: 60px; }

.password-wrapper {
  position: relative;
  width: 100%;
}
.password-wrapper input {
  padding-right: 36px !important;
}
.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: var(--transition);
  border-radius: var(--radius-sm);
}
.password-toggle-btn:hover {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.08);
}
html[data-theme='light'] .password-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}
.password-toggle-btn svg {
  display: block;
}

html[data-theme='dark'] input[type="date"] {
  color-scheme: dark;
}
html[data-theme='light'] input[type="date"] {
  color-scheme: light;
}
html[data-theme='dark'] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.7);
  cursor: pointer;
}
html[data-theme='light'] input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}
/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-ghost {
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: #9ca3af; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger-ghost {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-bdr);
}
.btn-danger-ghost:hover { opacity: 0.85; }

/* ── BADGE ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-pending   { background: var(--warn-bg);   color: var(--warn-text);   border-color: var(--warn-bdr); }
.badge-supplied  { background: var(--success-bg); color: var(--success-text);border-color: var(--success-bdr); }
.badge-partial   { background: var(--info-bg);    color: var(--info-text);   border-color: var(--info-bdr); }
.badge-rejected  { background: var(--danger-bg);  color: var(--danger-text); border-color: var(--danger-bdr); }
.badge-owner     { background: var(--accent-bg);  color: var(--accent-text); border-color: #c7d2fe; }
.badge-manager   { background: var(--warn-bg);    color: var(--warn-text);   border-color: var(--warn-bdr); }
.badge-store     { background: var(--success-bg); color: var(--success-text);border-color: var(--success-bdr); }

/* ── SHORTFALL TEXT ──────────────────────────────────────── */
.txt-danger  { color: var(--danger-text); font-weight: 600; }
.txt-success { color: var(--success-text); font-weight: 600; }
.txt-muted   { color: var(--text-3); }

/* ── ITEM CHECKLIST ──────────────────────────────────────── */
.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-name { font-weight: 600; color: var(--text); }
.checklist-qty  { color: var(--text-2); font-size: 12px; margin-top: 1px; }

/* ── REQUEST CARD ────────────────────────────────────────── */
.req-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}
.req-card-row { display: flex; align-items: center; justify-content: space-between; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.login-left {
  flex: 1;
  background: linear-gradient(135deg, var(--accent) 0%, #312e81 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle background pattern/overlay for the left side */
.login-left::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.login-brand-wrapper {
  position: relative;
  z-index: 1;
}

.login-brand-logo {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  margin: 0 auto 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.login-brand-title {
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.login-brand-sub {
  font-size: 16px;
  opacity: 0.8;
  font-weight: 500;
  max-width: 400px;
  margin: 0 auto;
}

.login-right {
  flex: 0 0 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  box-shadow: -10px 0 30px rgba(0,0,0,0.05);
  padding: 40px;
  z-index: 2;
}

[data-theme="dark"] .login-right {
  box-shadow: -10px 0 30px rgba(0,0,0,0.4);
}

.login-box {
  width: 100%;
  max-width: 340px;
}

.login-header {
  margin-bottom: 32px;
}
.login-title { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-subtitle { font-size: 14px; color: var(--text-2); }
.demo-accounts { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.demo-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.demo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 5px;
}
.demo-item:hover { border-color: var(--accent); background: var(--accent-bg); }
.demo-item-name { font-size: 12px; font-weight: 600; color: var(--text); }
.demo-item-role { font-size: 11px; color: var(--text-2); }
.demo-login-tag { font-size: 11px; color: var(--accent); font-weight: 600; }

/* ── MODAL ───────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 90%; max-width: 460px;
  box-shadow: var(--shadow-md);
  transform: translateY(-8px);
  transition: transform 200ms ease;
  max-height: 90vh;
  overflow-y: auto;
}
.overlay.open .modal { transform: translateY(0); }
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-close {
  background: none; border: none; color: var(--text-3);
  font-size: 18px; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px; }
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--bg);
  border-radius: 0 0 10px 10px;
  position: sticky; bottom: 0;
}

/* ── SIM PANEL ───────────────────────────────────────────── */
.sim-panel {
  position: fixed;
  bottom: 16px; right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 150;
  min-width: 200px;
}
.sim-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.sim-toggle {
  background: none; border: none; color: var(--text-3);
  font-size: 12px;
}
.sim-body { padding: 6px; }
.sim-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 6px 8px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: var(--transition);
  margin-bottom: 4px;
}
.nav-btn:hover { background: var(--bg); color: var(--text); }
.nav-btn.active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent);
  font-weight: 600;
}
.nav-icon { margin-right: 12px; font-size: 16px; opacity: 0.8; }
.sim-panel.collapsed .sim-body { display: none; }
.sim-panel.collapsed { min-width: auto; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-60px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: var(--text);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 8px;
  z-index: 999;
  transition: transform 250ms ease, opacity 250ms ease;
  opacity: 0;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { border-color: var(--danger-bdr); }

/* ── UTILITY ─────────────────────────────────────────────── */
.flex   { display: flex; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mb-5   { margin-bottom: 20px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.color-2 { color: var(--text-2); }
.color-3 { color: var(--text-3); }
.w-full { width: 100%; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); font-size: 13px; }

/* ── DESKTOP/MOBILE VISIBILITY ───────────────────────────── */
#mobile-logout { display: none; }
.hide-mobile { display: inline-block; }

.users-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

/* ── CATEGORY E-COMMERCE UI ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.cat-card:active { transform: scale(0.96); }
.cat-card img {
  width: 64px; height: 64px;
  object-fit: contain;
  border-radius: 12px;
}
.cat-card-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.cat-items-list {
  display: flex; flex-direction: column; gap: 12px;
}
.cat-search-wrap {
  position: relative;
  margin-bottom: 14px;
}
.cat-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
}
input.cat-search-input {
  width: 100%;
  padding: 10px 12px 10px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
input.cat-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.item-select-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  gap: 8px;
}
.item-select-info {
  display: flex; flex-direction: column; flex: 1; min-width: 0;
}
.item-select-info span:first-child {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-select-controls {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.item-qty-input {
  width: 64px; min-width: 64px; max-width: 64px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 4px;
  background: var(--bg); color: var(--text);
  font-weight: 700; font-size: 14px;
  box-sizing: border-box;
}

.floating-cart {
  position: fixed;
  bottom: 80px; /* above nav bar */
  left: 16px; right: 16px;
  max-width: 600px;
  margin: 0 auto;
  background: var(--accent);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 8px 30px rgba(79, 70, 229, 0.4);
  cursor: pointer;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.floating-cart:active { transform: scale(0.98); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .login-page {
    flex-direction: column;
  }
  .login-left {
    padding: 60px 20px;
    flex: none;
  }
  .login-brand-title { font-size: 32px; }
  .login-right {
    flex: 1;
    width: 100%;
    max-width: 100%;
    padding: 40px 20px;
    box-shadow: none;
  }
  
  /* ── NATIVE APP BOTTOM NAVIGATION ── */
  .layout { grid-template-columns: 1fr; }
  
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    height: 65px;
    width: 100%;
    flex-direction: row;
    border-top: 1px solid var(--border);
    z-index: 100;
    background: var(--surface);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  }
  [data-theme="dark"] .sidebar {
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
  }
  
  /* Hide sidebar branding and footer entirely on mobile */
  .sidebar-logo, .sidebar-footer { display: none; }
  .sidebar-overlay { display: none !important; }
  
  /* Convert nav into a horizontal flex row */
  #sidebar-nav {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    padding: 0 8px;
    gap: 0;
  }
  
  .nav-btn {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    margin: 0;
    font-size: 10px;
    line-height: 1.2;
    flex: 1;
    text-align: center;
    border-radius: 8px;
    background: transparent !important;
  }
  .nav-icon { margin-right: 0; margin-bottom: 4px; font-size: 20px; width: auto; }
  
  .nav-btn.active { color: var(--accent); }
  .nav-btn.active .nav-icon { color: var(--accent); opacity: 1; }
  
  /* Adjust main panel to leave space for the bottom bar */
  .main-panel { height: 100vh; padding-bottom: 65px; }
  
  /* Topbar adjustments */
  .menu-btn { display: none; } /* No hamburger menu anymore */
  .page-title { display: none; } /* Hide page title to make room for logo */
  .mobile-topbar-logo { display: flex !important; }
  #mobile-logout { display: inline-flex; }
  .hide-mobile { display: none; }
  .topbar { padding: 0 16px; height: 56px; }
  .page-body { padding: 16px; padding-bottom: 60px; }
  .stats { 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px; 
  }
  .stat-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
  }
  .stat-card .icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .stat-card .icon-box svg {
    width: 18px;
    height: 18px;
  }
  .stat-card .stat-lbl {
    font-size: 10px;
    line-height: 1.2;
  }
  .stat-card .stat-num {
    font-size: 20px;
    margin-top: 2px;
  }
  .users-grid { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .floating-cart { bottom: 80px; left: 16px; right: 16px; }
  
  /* ── BOTTOM SHEET MODAL ── */
  .modal {
    position: absolute;
    bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; max-width: 100%;
    max-height: 90vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.1, 0.9, 0.2, 1);
    margin: 0;
  }
  .modal-overlay.open .modal {
    transform: translateY(0);
  }
}
@media (max-width: 480px) {
  .stat-box { padding: 12px; }
  .stat-num { font-size: 18px; }
  .stat-lbl { font-size: 11px; }
  .form-row { flex-direction: column; }
  .form-group { min-width: 0; }
  .req-card-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .page-head h2 { font-size: 20px; }
  .page-head p { font-size: 12px; }
  .topbar { padding: 0 16px; height: 54px; }
}

/* ── PROGRESS BAR ANIMATION ────────────────────────────── */
@keyframes loadingBar {
  0% { left: -30%; width: 30%; }
  50% { left: 100%; width: 30%; }
  100% { left: -30%; width: 30%; }
}
.progress-bar-inner {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--accent);
  border-radius: 4px;
  animation: loadingBar 1.5s infinite linear;
}

/* Centered Loading Modal */
.loading-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 320px;
  box-shadow: var(--shadow-md);
  padding: 24px;
  text-align: center;
  transform: translateY(-8px);
  transition: transform 200ms ease;
  position: relative;
  z-index: 201;
}
.overlay.open .loading-modal {
  transform: translateY(0);
}

/* ── OUTLET CARDS ── */
.outlet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 32px;
}
.outlet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.outlet-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.oc-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.oc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}
.oc-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.oc-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.oc-status {
  margin-left: auto;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
}
.oc-status.active {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}
.oc-status.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.oc-stats {
  display: flex;
  gap: 16px;
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
}
.oc-stat {
  flex: 1;
}
.oc-stat-val {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.oc-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Center modals on mobile if modal-centered class is present */
@media (max-width: 768px) {
  .modal.modal-centered {
    position: relative !important;
    bottom: auto !important; left: auto !important; right: auto !important; top: auto !important;
    width: 90% !important;
    max-width: 400px !important;
    border-radius: 12px !important;
    transform: translateY(-8px) !important;
    margin: 0 auto !important;
    transition: transform 200ms ease !important;
  }
  .overlay.open .modal.modal-centered {
    transform: translateY(0) !important;
  }
}

/* Mobile-only User Information Footer */
.mobile-user-footer {
  display: none;
}
@media (max-width: 768px) {
  .mobile-user-footer {
    display: block;
    margin: 30px auto 10px auto;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-2);
    width: fit-content;
    text-align: center;
    font-weight: 500;
  }
}

