/* BF Operations — Parent Shell Styles */
:root {
  --shell-bg: #0F172A;
  --shell-surface: #1E293B;
  --shell-border: #334155;
  --shell-text: #F8FAFC;
  --shell-text-muted: #94A3B8;
  --shell-accent: #3B82F6;
  --shell-accent-hover: #2563EB;
  --shell-success: #10B981;
  --shell-warning: #F59E0B;
  --shell-danger: #EF4444;
  --module-radius: 12px;
  /* iOS safe area insets — used by Capacitor for notch/home-indicator */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; -ms-touch-action: manipulation; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: #F1F5F9; color: #1E293B; overflow: hidden; height: 100vh; height: 100dvh; -webkit-text-size-adjust: 100%; touch-action: manipulation; }

/* ==================== LOGIN ==================== */
.shell-login-page {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 50%, #0F172A 100%);
  position: relative; overflow-y: auto;
  padding-top: var(--sat); padding-bottom: var(--sab);
  padding-left: var(--sal); padding-right: var(--sar);
}
.shell-login-page::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 40%, rgba(59,130,246,0.15) 0%, transparent 60%),
              radial-gradient(circle at 70% 60%, rgba(16,185,129,0.1) 0%, transparent 50%);
}
.shell-login-card {
  background: rgba(30,41,59,0.95); backdrop-filter: blur(20px);
  border: 1px solid rgba(71,85,105,0.5); border-radius: 20px;
  padding: 48px 40px; width: 420px; max-width: 90vw; position: relative; z-index: 1;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
.shell-login-card.shell-login-wide {
  width: 520px; max-width: 95vw; padding: 36px 32px;
}
.shell-login-logo { text-align: center; margin-bottom: 24px; }
.shell-login-logo i { font-size: 42px; color: var(--shell-accent); margin-bottom: 8px; display: block; }
.shell-login-logo h1 { font-size: 26px; font-weight: 800; color: var(--shell-text); letter-spacing: -0.5px; }
.shell-login-logo p { font-size: 14px; color: var(--shell-text-muted); margin-top: 4px; }
.shell-login-card .form-group { margin-bottom: 20px; }
.shell-login-card .form-label { display: block; font-size: 13px; font-weight: 600; color: var(--shell-text-muted); margin-bottom: 6px; }
.shell-login-card .form-input {
  width: 100%; padding: 12px 14px; background: var(--shell-bg); border: 1px solid var(--shell-border);
  border-radius: 10px; color: var(--shell-text); font-size: 14px; outline: none; transition: border-color 0.2s;
}
.shell-login-card .form-input:focus { border-color: var(--shell-accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.shell-login-card .form-input::placeholder { color: #475569; }
.shell-btn-login {
  width: 100%; padding: 14px; background: linear-gradient(135deg, var(--shell-accent), var(--shell-accent-hover));
  color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.shell-btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(59,130,246,0.3); }
.shell-quick-btn {
  padding: 8px 12px; background: var(--shell-bg); border: 1px solid var(--shell-border);
  border-radius: 8px; color: var(--shell-text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.shell-quick-btn:hover { border-color: var(--shell-accent); color: var(--shell-text); background: rgba(59,130,246,0.1); }

/* --- User Picker Grid --- */
.pin-user-search-wrap {
  position: relative; margin-bottom: 16px;
}
.pin-user-search {
  width: 100%; padding: 10px 14px 10px 36px; background: var(--shell-bg); border: 1px solid var(--shell-border);
  border-radius: 10px; color: var(--shell-text); font-size: 14px; outline: none; transition: border-color 0.2s;
}
.pin-user-search:focus { border-color: var(--shell-accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.pin-user-search::placeholder { color: #475569; }
.pin-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #475569; font-size: 14px; pointer-events: none; }

.pin-user-grid {
  max-height: 400px; overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: var(--shell-border) transparent;
}
.pin-user-grid::-webkit-scrollbar { width: 6px; }
.pin-user-grid::-webkit-scrollbar-thumb { background: var(--shell-border); border-radius: 3px; }

.pin-dept-label {
  font-size: 11px; font-weight: 700; color: var(--shell-text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 12px 4px 6px; display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid rgba(71,85,105,0.3); margin-bottom: 6px;
}
.pin-dept-label:first-child { padding-top: 0; }

.pin-user-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  cursor: pointer; transition: all 0.15s; text-align: left;
}
.pin-user-btn:hover { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.3); }
.pin-user-btn:active { background: rgba(59,130,246,0.15); transform: scale(0.98); }

.pin-user-avatar {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.pin-user-info { flex: 1; min-width: 0; }
.pin-user-name { font-size: 14px; font-weight: 600; color: var(--shell-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-user-role { font-size: 11px; color: var(--shell-text-muted); margin-top: 1px; }

/* --- PIN Pad --- */
.pin-pad-container { text-align: center; }
.pin-back-btn {
  background: none; border: none; color: var(--shell-text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all 0.15s; margin-bottom: 16px;
  display: inline-flex; align-items: center; gap: 6px;
}
.pin-back-btn:hover { color: var(--shell-text); background: rgba(255,255,255,0.05); }

.pin-selected-user { margin-bottom: 20px; }
.pin-user-avatar-lg {
  width: 64px; height: 64px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 22px; margin-bottom: 10px;
}
.pin-selected-name { font-size: 20px; font-weight: 700; color: var(--shell-text); }
.pin-selected-role { font-size: 13px; color: var(--shell-text-muted); margin-top: 2px; }

.pin-prompt { font-size: 14px; color: var(--shell-text-muted); margin-bottom: 16px; }

.pin-dots {
  display: flex; justify-content: center; gap: 14px; margin-bottom: 8px;
}
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--shell-border);
  transition: all 0.15s;
}
.pin-dot.filled {
  background: var(--shell-accent); border-color: var(--shell-accent);
  box-shadow: 0 0 8px rgba(59,130,246,0.4);
}
.pin-dots.shake {
  animation: pinShake 0.4s ease-in-out;
}
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.pin-error {
  color: #EF4444; font-size: 13px; font-weight: 600; min-height: 20px; margin-bottom: 8px;
}

.pin-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 260px; margin: 0 auto;
}
.pin-key {
  width: 100%; aspect-ratio: 1.3; border-radius: 14px; border: 1px solid var(--shell-border);
  background: rgba(15,23,42,0.6); color: var(--shell-text); font-size: 22px; font-weight: 600;
  cursor: pointer; transition: all 0.12s; display: flex; align-items: center; justify-content: center;
}
.pin-key:hover { background: rgba(59,130,246,0.15); border-color: var(--shell-accent); }
.pin-key:active { transform: scale(0.92); background: rgba(59,130,246,0.25); }
.pin-key:disabled { opacity: 0.4; cursor: not-allowed; }
.pin-key.pin-key-fn { font-size: 18px; color: var(--shell-text-muted); }

/* PIN lockout */
.pin-lockout {
  text-align: center; padding: 24px 0;
}
.pin-lockout-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px;
  background: rgba(239,68,68,0.15); display: flex; align-items: center; justify-content: center;
}
.pin-lockout-icon i { font-size: 28px; color: #EF4444; }
.pin-lockout-title { font-size: 20px; font-weight: 700; color: #EF4444; margin-bottom: 4px; }
.pin-lockout-msg { font-size: 13px; color: var(--shell-text-muted); margin-bottom: 16px; }
.pin-lockout-timer {
  font-size: 36px; font-weight: 700; color: var(--shell-text); font-variant-numeric: tabular-nums;
  margin-bottom: 20px;
}
.pin-lockout-back {
  background: none; border: 1px solid var(--shell-border); color: var(--shell-text-muted);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: all 0.15s;
}
.pin-lockout-back:hover { color: var(--shell-text); border-color: var(--shell-text-muted); }

/* ==================== MODULE PICKER (HOME) ==================== */
.shell-home {
  height: 100vh; height: 100dvh; background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
  display: flex; flex-direction: column; overflow-y: auto;
  padding-top: var(--sat); padding-bottom: var(--sab);
  padding-left: var(--sal); padding-right: var(--sar);
}
.shell-home-header {
  padding: 40px 40px 0; display: flex; justify-content: space-between; align-items: flex-start;
}
.shell-home-brand { display: flex; align-items: center; gap: 14px; }
.shell-home-brand i { font-size: 36px; color: var(--shell-accent); }
.shell-home-brand h1 { font-size: 26px; font-weight: 800; color: var(--shell-text); letter-spacing: -0.5px; }
.shell-home-brand p { font-size: 13px; color: var(--shell-text-muted); }
.shell-home-user { display: flex; align-items: center; gap: 12px; }
.shell-home-user-info { text-align: right; }
.shell-home-user-info .name { font-size: 14px; font-weight: 600; color: var(--shell-text); }
.shell-home-user-info .role { font-size: 11px; color: var(--shell-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.shell-user-avatar {
  width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--shell-accent), #7C3AED);
  display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 16px;
}
.shell-logout-btn {
  background: none; border: 1px solid var(--shell-border); border-radius: 8px; padding: 8px 12px;
  color: var(--shell-text-muted); font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.shell-logout-btn:hover { border-color: var(--shell-danger); color: var(--shell-danger); }

.shell-home-grid {
  flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; padding: 40px; align-content: start; max-width: 1200px; margin: 0 auto; width: 100%;
}
.shell-module-card {
  background: var(--shell-surface); border: 1px solid var(--shell-border); border-radius: 16px;
  padding: 32px 28px; cursor: pointer; transition: all 0.25s; position: relative; overflow: hidden;
}
.shell-module-card:hover {
  transform: translateY(-4px); border-color: rgba(59,130,246,0.4);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.shell-module-card.coming-soon { opacity: 0.5; cursor: default; }
.shell-module-card.coming-soon:hover { transform: none; box-shadow: none; border-color: var(--shell-border); }
.shell-module-icon {
  width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: white; margin-bottom: 20px;
}
.shell-module-card h3 { font-size: 20px; font-weight: 700; color: var(--shell-text); margin-bottom: 6px; }
.shell-module-card p { font-size: 13px; color: var(--shell-text-muted); line-height: 1.5; }
.shell-module-badge {
  position: absolute; top: 16px; right: 16px; font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px;
}
.shell-module-badge.soon { background: rgba(245,158,11,0.15); color: #F59E0B; }
.shell-module-badge.live { background: rgba(16,185,129,0.15); color: #10B981; }

/* ==================== ACTIVE MODULE LAYOUT ==================== */
.shell-app-layout { display: flex; flex-direction: column; height: 100vh; }
.shell-topbar {
  height: calc(52px + var(--sat)); background: var(--shell-bg); border-bottom: 1px solid var(--shell-border);
  display: flex; align-items: center; padding: var(--sat) 16px 0; gap: 12px; flex-shrink: 0; z-index: 1000;
  padding-left: calc(16px + var(--sal)); padding-right: calc(16px + var(--sar));
}
.shell-back-btn {
  background: none; border: 1px solid var(--shell-border); border-radius: 8px; padding: 6px 12px;
  color: var(--shell-text-muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.shell-back-btn:hover { border-color: var(--shell-accent); color: var(--shell-text); }
.shell-module-tabs {
  display: flex; gap: 2px; flex: 1; margin-left: 8px;
}
.shell-module-tab {
  padding: 6px 16px; border-radius: 8px; font-size: 12px; font-weight: 600;
  color: var(--shell-text-muted); cursor: pointer; transition: all 0.15s; border: none; background: none;
  display: flex; align-items: center; gap: 6px;
}
.shell-module-tab:hover { color: var(--shell-text); background: rgba(255,255,255,0.05); }
.shell-module-tab.active { color: white; background: var(--shell-accent); }
.shell-module-tab.coming-soon { opacity: 0.4; cursor: default; }
.shell-module-tab.coming-soon:hover { color: var(--shell-text-muted); background: none; }
.shell-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.shell-topbar-user {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s;
}
.shell-topbar-user:hover { background: rgba(255,255,255,0.05); }
.shell-topbar-user .name { font-size: 12px; font-weight: 600; color: var(--shell-text); }
.shell-topbar-user .role { font-size: 10px; color: var(--shell-text-muted); }
.shell-topbar-avatar {
  width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--shell-accent), #7C3AED);
  display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 12px;
}
.shell-module-container {
  flex: 1; overflow: hidden; position: relative;
}
.shell-module-frame {
  width: 100%; height: 100%; overflow: auto; background: #F1F5F9;
  padding-bottom: var(--sab);
  padding-left: var(--sal); padding-right: var(--sar);
}

/* ==================== ADMIN PANEL ==================== */
.shell-admin-panel { padding: 24px; overflow: auto; height: 100%; background: #F1F5F9; }
.shell-admin-card { background: white; border-radius: 12px; border: 1px solid #E2E8F0; overflow: hidden; }
.shell-admin-card-header { padding: 16px 20px; border-bottom: 1px solid #E2E8F0; display: flex; align-items: center; justify-content: space-between; }
.shell-admin-card-header h3 { font-size: 16px; font-weight: 700; color: #1E293B; }
.shell-admin-table { width: 100%; border-collapse: collapse; }
.shell-admin-table th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.5px; background: #F8FAFC; }
.shell-admin-table td { padding: 12px 16px; font-size: 13px; border-top: 1px solid #F1F5F9; }
.shell-admin-table tr:hover { background: #F8FAFC; }
.shell-module-toggle {
  width: 18px; height: 18px; border-radius: 4px; border: 2px solid #CBD5E1; cursor: pointer;
  appearance: none; -webkit-appearance: none; transition: all 0.15s; position: relative;
}
.shell-module-toggle:checked { background: var(--shell-accent); border-color: var(--shell-accent); }
.shell-module-toggle:checked::after {
  content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 10px;
  color: white; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.shell-save-btn {
  padding: 6px 14px; background: var(--shell-accent); color: white; border: none; border-radius: 6px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.shell-save-btn:hover { background: var(--shell-accent-hover); }

/* ==================== TOAST ==================== */
.shell-toast {
  position: fixed; top: calc(16px + var(--sat)); right: calc(16px + var(--sar)); z-index: 99999;
  padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 600;
  color: white; box-shadow: 0 8px 24px rgba(0,0,0,0.2); transition: all 0.3s;
  display: flex; align-items: center; gap: 8px;
}
.shell-toast.success { background: #059669; }
.shell-toast.error { background: #DC2626; }

/* ==================== MOBILE MODULE DROPDOWN ==================== */
.shell-mobile-module-select {
  display: none; /* shown on mobile */
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--shell-border);
  background: var(--shell-surface); color: var(--shell-text); font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; min-width: 0; max-width: 160px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394A3B8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
.shell-mobile-module-select:focus { outline: none; border-color: var(--shell-accent); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  /* --- Login --- */
  .shell-login-card, .shell-login-card.shell-login-wide { padding: 24px 16px; width: 100%; max-width: 100vw; border-radius: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-start; padding-top: calc(24px + var(--sat)); }
  .shell-login-logo { margin-bottom: 16px; }
  .shell-login-logo h1 { font-size: 22px; }
  .shell-login-logo i { font-size: 36px; }
  .shell-btn-login { padding: 16px; font-size: 16px; }
  .pin-user-grid { max-height: calc(100dvh - 220px); }
  .pin-keypad { max-width: 240px; gap: 8px; }
  .pin-key { font-size: 20px; border-radius: 12px; }

  /* --- Home (module picker) --- */
  .shell-home { min-height: 100vh; min-height: 100dvh; }
  .shell-home-header { padding: 20px 16px 0; flex-direction: column; gap: 12px; }
  .shell-home-brand h1 { font-size: 22px; }
  .shell-home-brand i { font-size: 28px; }
  .shell-home-user { flex-wrap: wrap; gap: 8px; }
  .shell-home-grid { padding: 16px; grid-template-columns: 1fr; gap: 12px; }
  .shell-module-card { padding: 20px 18px; }
  .shell-module-card h3 { font-size: 17px; }
  .shell-module-card p { font-size: 12px; }
  .shell-module-icon { width: 44px; height: 44px; border-radius: 10px; font-size: 20px; margin-bottom: 14px; }

  /* --- Topbar inside module --- */
  .shell-topbar { height: calc(48px + var(--sat)); padding: var(--sat) 10px 0; gap: 6px;
    padding-left: calc(10px + var(--sal)); padding-right: calc(10px + var(--sar)); }
  .shell-module-tabs { display: none; }
  .shell-mobile-module-select { display: block; }
  .shell-back-btn { padding: 5px 8px; font-size: 11px; }
  .shell-back-btn span.back-label { display: none; }
  .shell-topbar-right { gap: 6px; }
  .shell-topbar-user .name, .shell-topbar-user .role { display: none; }
  .shell-topbar-user { padding: 4px; }
  .shell-topbar-avatar { width: 28px; height: 28px; font-size: 11px; }

  /* --- Admin panel --- */
  .shell-admin-panel { padding: 12px; }
  .shell-admin-card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .shell-admin-card-header h3 { font-size: 14px; }
  .shell-admin-table th { padding: 8px 10px; font-size: 10px; }
  .shell-admin-table td { padding: 10px 10px; font-size: 12px; }
  .shell-admin-table .hide-mobile { display: none; }

  /* --- Toast --- */
  .shell-toast { top: auto; bottom: calc(16px + var(--sab)); right: 12px; left: 12px; max-width: 100%; font-size: 13px; }
}

@media (max-width: 480px) {
  .shell-home-grid { padding: 12px; gap: 10px; }
  .shell-module-card { padding: 16px 14px; }
  .shell-module-icon { width: 38px; height: 38px; font-size: 17px; margin-bottom: 12px; }
  .shell-login-card, .shell-login-card.shell-login-wide { padding: 20px 12px; padding-top: calc(20px + var(--sat)); }
  .pin-user-grid { max-height: calc(100dvh - 200px); }
  .pin-keypad { max-width: 220px; }
}

/* ==================== NOTIFICATION BELL ==================== */
.shell-notif-wrap { position: relative; }
.shell-notif-btn {
  background: none; border: 1px solid var(--shell-border); border-radius: 8px;
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  color: var(--shell-text-muted); font-size: 15px; cursor: pointer; transition: all 0.15s; position: relative;
}
.shell-notif-btn:hover { border-color: var(--shell-accent); color: var(--shell-text); }
.shell-notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--shell-danger); color: white; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  line-height: 1; border: 2px solid var(--shell-bg);
}
.shell-notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 340px;
  background: var(--shell-surface); border: 1px solid var(--shell-border); border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4); z-index: 9999; overflow: hidden;
  display: none;
}
.shell-notif-dropdown.open { display: block; }
.shell-notif-header {
  padding: 12px 16px; border-bottom: 1px solid var(--shell-border);
  display: flex; align-items: center; justify-content: space-between;
}
.shell-notif-header h4 { font-size: 13px; font-weight: 700; color: var(--shell-text); }
.shell-notif-header button {
  background: none; border: none; color: var(--shell-accent); font-size: 11px;
  font-weight: 600; cursor: pointer; padding: 0;
}
.shell-notif-header button:hover { text-decoration: underline; }
.shell-notif-list { max-height: 320px; overflow-y: auto; }
.shell-notif-item {
  padding: 10px 16px; border-bottom: 1px solid rgba(51,65,85,0.4); cursor: pointer; transition: background 0.1s;
  display: flex; gap: 10px; align-items: flex-start;
}
.shell-notif-item:hover { background: rgba(255,255,255,0.03); }
.shell-notif-item.unread { background: rgba(59,130,246,0.06); }
.shell-notif-item.unread:hover { background: rgba(59,130,246,0.1); }
.shell-notif-icon {
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.shell-notif-icon.info { background: rgba(59,130,246,0.15); color: #3B82F6; }
.shell-notif-icon.warning { background: rgba(245,158,11,0.15); color: #F59E0B; }
.shell-notif-icon.success { background: rgba(16,185,129,0.15); color: #10B981; }
.shell-notif-icon.danger { background: rgba(239,68,68,0.15); color: #EF4444; }
.shell-notif-body { flex: 1; min-width: 0; }
.shell-notif-body .title { font-size: 12px; font-weight: 600; color: var(--shell-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell-notif-body .desc { font-size: 11px; color: var(--shell-text-muted); margin-top: 2px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shell-notif-body .time { font-size: 10px; color: var(--shell-text-muted); margin-top: 3px; }
.shell-notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--shell-accent); flex-shrink: 0; margin-top: 4px; }
.shell-notif-footer {
  padding: 10px 16px; border-top: 1px solid var(--shell-border); text-align: center;
}
.shell-notif-footer a {
  font-size: 12px; font-weight: 600; color: var(--shell-accent); text-decoration: none; cursor: pointer;
}
.shell-notif-footer a:hover { text-decoration: underline; }
.shell-notif-empty {
  padding: 30px 16px; text-align: center; color: var(--shell-text-muted); font-size: 12px;
}
.shell-notif-empty i { font-size: 24px; display: block; margin-bottom: 8px; opacity: 0.4; }
@media (max-width: 768px) {
  .shell-notif-btn { width: 30px; height: 30px; font-size: 13px; }
  .shell-notif-dropdown { width: 300px; right: -60px; }
  .shell-notif-badge { min-width: 14px; height: 14px; font-size: 8px; top: -3px; right: -3px; }
}
@media (max-width: 480px) {
  .shell-notif-dropdown { width: calc(100vw - 24px); right: -100px; }
}

/* ==================== PUSH NOTIFICATION TOGGLE ==================== */
.shell-push-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  border-radius: 8px; font-size: 12px; font-weight: 600; border: 1px solid #E2E8F0;
  background: #F8FAFC; color: #64748B; cursor: pointer; transition: all 0.2s;
}
.shell-push-btn:hover { background: #E2E8F0; }
.shell-push-btn.active { background: #DCFCE7; color: #16A34A; border-color: #BBF7D0; }
.shell-push-btn.active:hover { background: #BBF7D0; }

/* ==================== TOGGLE SWITCH ==================== */
.shell-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.shell-toggle input { opacity: 0; width: 0; height: 0; }
.shell-toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: #CBD5E1; border-radius: 22px; transition: 0.3s;
}
.shell-toggle-slider::before {
  content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.3s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.shell-toggle input:checked + .shell-toggle-slider { background: #3B82F6; }
.shell-toggle input:checked + .shell-toggle-slider::before { transform: translateX(18px); }

/* ==================== SHELL MODAL ==================== */
.shell-modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 10000; align-items: center; justify-content: center; padding: 20px;
}
.shell-modal {
  background: #F8FAFC; border-radius: 16px; max-width: 620px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}
.shell-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #E2E8F0; position: sticky; top: 0; background: white;
  border-radius: 16px 16px 0 0; z-index: 1;
}
.shell-modal-header h3 { margin: 0; font-size: 16px; color: #1E293B; }
.shell-modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: none; background: #F1F5F9;
  font-size: 18px; color: #64748B; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.shell-modal-close:hover { background: #E2E8F0; color: #1E293B; }
.shell-modal-body { padding: 20px; }

/* ==================== NOTIFICATION SETTINGS BUTTON ==================== */
.shell-notif-settings-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  border-radius: 6px; font-size: 11px; font-weight: 600; border: 1px solid #E2E8F0;
  background: white; color: #64748B; cursor: pointer; margin-left: 6px;
}
.shell-notif-settings-btn:hover { background: #F1F5F9; }

/* ==================== FEATURE REQUEST FAB ==================== */
.shell-feature-req-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9000;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: white; border: none; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 16px rgba(245,158,11,0.4);
  transition: all 0.2s ease; -webkit-tap-highlight-color: transparent;
}
.shell-feature-req-fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(245,158,11,0.5); }
.shell-feature-req-fab:active { transform: scale(0.95); }
@media (max-width: 768px) {
  .shell-feature-req-fab { bottom: max(16px, calc(var(--sab) + 12px)); right: 16px; width: 44px; height: 44px; font-size: 18px; }
}

/* ==================== AI HELP ASSISTANT ==================== */
.help-fab {
  position: fixed; bottom: 24px; right: 80px; z-index: 9000;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
  color: white; border: none; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 16px rgba(37,99,235,0.4);
  transition: all 0.25s ease; -webkit-tap-highlight-color: transparent;
}
.help-fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(37,99,235,0.5); }
.help-fab:active { transform: scale(0.95); }
.help-fab.active {
  background: linear-gradient(135deg, #7C3AED 0%, #2563EB 100%);
  transform: rotate(45deg);
}
/* Pulse animation when panel is closed to draw attention */
@keyframes helpFabPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(37,99,235,0.4); }
  50% { box-shadow: 0 4px 24px rgba(37,99,235,0.6), 0 0 0 8px rgba(37,99,235,0.1); }
}
.help-fab:not(.active) { animation: helpFabPulse 3s ease-in-out infinite; }
.help-fab:not(.active):hover { animation: none; }

/* Panel — slides in from the right */
.help-panel {
  position: fixed; top: 0; right: -420px; z-index: 10001;
  width: 400px; max-width: 100vw; height: 100vh; height: 100dvh;
  background: #FFFFFF; border-left: 1px solid #E2E8F0;
  box-shadow: -8px 0 30px rgba(0,0,0,0.15);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  border-radius: 16px 0 0 16px;
  overflow: hidden;
}
.help-panel.open { right: 0; }

.help-panel-inner {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}

/* Backdrop */
.help-backdrop {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.help-backdrop.open { opacity: 1; pointer-events: auto; }

/* Tab content areas */
.help-tab-content {
  flex: 1; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}
.help-tab-content::-webkit-scrollbar { width: 5px; }
.help-tab-content::-webkit-scrollbar-track { background: transparent; }
.help-tab-content::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
.help-tab-content::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* Suggestion buttons */
.help-suggestion {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; border: 1px solid #E5E7EB; border-radius: 10px;
  background: #F9FAFB; color: #374151; font-size: 13px;
  cursor: pointer; transition: all 0.15s;
  font-family: inherit; line-height: 1.4;
}
.help-suggestion:hover {
  background: #EFF6FF; border-color: #93C5FD; color: #1E40AF;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,0.1);
}
.help-suggestion:active { transform: translateY(0); }

/* Mobile responsive */
@media (max-width: 768px) {
  .help-fab {
    bottom: max(16px, calc(var(--sab) + 12px)); right: 68px;
    width: 44px; height: 44px; font-size: 18px;
  }
  .help-panel {
    width: 100vw; max-width: 100vw;
    border-radius: 0; right: -100vw;
  }
  .help-panel.open { right: 0; }
}
@media (max-width: 480px) {
  .help-fab { right: 64px; }
}

/* ==================== MOBILE BOTTOM NAV ==================== */
.shell-bottom-nav {
  display: none; /* shown only on mobile */
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1001;
  background: var(--shell-bg);
  border-top: 1px solid var(--shell-border);
  padding: 4px 0 calc(4px + var(--sab));
  padding-left: var(--sal); padding-right: var(--sar);
}
.shell-bottom-nav-items {
  display: flex; justify-content: space-around; align-items: stretch;
  max-width: 600px; margin: 0 auto;
}
.shell-bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 6px 4px 4px; flex: 1;
  background: none; border: none; color: var(--shell-text-muted);
  font-size: 10px; font-weight: 600; cursor: pointer;
  transition: color 0.15s; -webkit-tap-highlight-color: transparent;
  min-width: 0; text-decoration: none; position: relative;
}
.shell-bottom-nav-item i { font-size: 18px; line-height: 1; }
.shell-bottom-nav-item span {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; display: block;
}
.shell-bottom-nav-item.active { color: var(--shell-accent); }
.shell-bottom-nav-item.active i { transform: scale(1.1); }
.shell-bottom-nav-item .shell-bnav-badge {
  position: absolute; top: 2px; right: calc(50% - 16px);
  background: #DC2626; color: white; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1;
}

/* Module switcher button in topbar (mobile) */
.shell-module-switch-btn {
  display: none; /* shown on mobile */
  align-items: center; gap: 8px; padding: 4px 10px; border-radius: 8px;
  background: none; border: 1px solid var(--shell-border);
  color: var(--shell-text); font-size: 13px; font-weight: 700;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s;
}
.shell-module-switch-btn:active { border-color: var(--shell-accent); }
.shell-module-switch-btn i.module-icon { font-size: 14px; }
.shell-module-switch-btn i.fa-chevron-down { font-size: 9px; color: var(--shell-text-muted); margin-left: 2px; }

/* Module drawer (mobile full-screen overlay) */
.shell-module-drawer-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: shellFadeIn 0.15s ease;
}
.shell-module-drawer-overlay.open { display: flex; }
.shell-module-drawer {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--shell-surface); border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(16px + var(--sab));
  max-height: 70vh; overflow-y: auto;
  animation: shellSlideUp 0.2s ease;
}
@keyframes shellSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes shellFadeIn { from { opacity: 0; } to { opacity: 1; } }
.shell-module-drawer-handle {
  width: 36px; height: 4px; background: var(--shell-border); border-radius: 2px;
  margin: 0 auto 16px;
}
.shell-module-drawer h4 {
  font-size: 11px; font-weight: 700; color: var(--shell-text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.shell-module-drawer-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 12px;
  border-radius: 12px; cursor: pointer; transition: background 0.15s;
  -webkit-tap-highlight-color: transparent; border: none; background: none;
  width: 100%; text-align: left; font-family: inherit;
}
.shell-module-drawer-item:active { background: rgba(255,255,255,0.08); }
.shell-module-drawer-item.active { background: rgba(99,102,241,0.15); }
.shell-module-drawer-item .drawer-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; color: white; font-size: 16px;
  flex-shrink: 0;
}
.shell-module-drawer-item .drawer-label {
  font-size: 15px; font-weight: 600; color: var(--shell-text);
}
.shell-module-drawer-item .drawer-desc {
  font-size: 11px; color: var(--shell-text-muted); margin-top: 1px;
}
.shell-module-drawer-item.active .drawer-label { color: var(--shell-accent); }

/* "More" bottom sheet for overflow pages */
.shell-more-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--shell-surface); border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(16px + var(--sab));
  max-height: 70vh; overflow-y: auto;
  animation: shellSlideUp 0.2s ease;
}
.shell-more-sheet-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.shell-more-sheet-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 14px 6px;
  border-radius: 12px; cursor: pointer; transition: background 0.15s;
  -webkit-tap-highlight-color: transparent; border: none; background: rgba(255,255,255,0.04);
  text-align: center; font-family: inherit; min-height: 72px;
}
.shell-more-sheet-item:active { background: rgba(255,255,255,0.1); }
.shell-more-sheet-item.active { background: rgba(99,102,241,0.18); }
.shell-more-sheet-item i { font-size: 20px; color: var(--shell-text-muted); line-height: 1; }
.shell-more-sheet-item.active i { color: var(--shell-accent); }
.shell-more-sheet-item span { font-size: 11px; font-weight: 600; color: var(--shell-text); line-height: 1.2; }
.shell-more-sheet-item.active span { color: var(--shell-accent); }

@media (max-width: 768px) {
  .shell-bottom-nav { display: block; }
  .shell-module-switch-btn { display: flex; }
  /* Adjust module frame to account for bottom nav */
  .shell-module-frame { padding-bottom: calc(62px + var(--sab)) !important; }
  /* Hide desktop-only elements on mobile */
  .shell-mobile-module-select { display: none !important; }
  /* Adjust help FAB for bottom nav */
  .help-fab { bottom: calc(70px + var(--sab)) !important; }
  .feature-req-fab { bottom: calc(70px + var(--sab)) !important; }
  /* Topbar simplified */
  .shell-topbar { gap: 8px; }
  .shell-back-btn { display: none; }
  /* Hide per-module nav tab buttons — replaced by shell bottom nav.
     Keep containers for location pickers, action buttons, view-only banners. */
  .inv-nav-scroll, .po-nav-scroll, .tk-nav-scroll { display: none !important; }
  .inv-nav, .po-nav, .tk-nav {
    flex-wrap: wrap; justify-content: flex-end; min-height: 0;
    padding: 6px 12px !important; gap: 8px !important;
  }
  /* Logistics: hide hamburger menu-toggle + sidebar, bottom nav replaces it */
  .menu-toggle { display: none !important; }
  .sidebar { transform: translateX(-100%) !important; }
  .sidebar.open { transform: translateX(-100%) !important; }
  .sidebar-overlay { display: none !important; }
  /* Logistics topbar: slim down — page title only, hide date */
  .topbar { height: 36px !important; padding: 0 12px !important; border-bottom-color: transparent !important; }
  .topbar-breadcrumb { display: none !important; }
  .topbar-title { font-size: 13px !important; font-weight: 600 !important; color: #64748B !important; }
  /* Push toasts above bottom nav */
  .toast-container { bottom: calc(72px + var(--sab)) !important; }
  .shell-toast { bottom: calc(72px + var(--sab)) !important; }
}
