:root {
  --white: #FFFFFF;
  --navy: #0B1F3A;
  --navy-dark: #071525;
  --blue: #1E5EFF;
  --bg: #F4F7FB;
  --text-muted: #667085;
  --success: #16A36A;
  --warning: #F79009;
  --danger: #D92D20;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(11,31,58,0.06), 0 4px 16px rgba(11,31,58,0.05);
  --shadow-lg: 0 8px 30px rgba(11,31,58,0.12);
  --nav-h: 64px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--navy);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--nav-h) + 12px);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: var(--navy);
  color: var(--white);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px;
}
.topbar .brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.topbar .brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn { position: relative; background: none; border: none; color: var(--white); font-size: 20px; cursor: pointer; padding: 4px; }
.icon-btn .dot { position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

.global-search {
  position: sticky; top: var(--topbar-h); z-index: 35;
  background: var(--white); padding: 10px 14px; border-bottom: 1px solid #E7ECF3;
}
.global-search input {
  width: 100%; border: 1px solid #E3E8F0; background: var(--bg); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 14px; color: var(--navy);
}
.global-search input:focus { outline: 2px solid var(--blue); outline-offset: 1px; background: var(--white); }

/* ---------- Drawer (mobile menu) ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(7,21,37,0.5); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 82%; max-width: 320px;
  background: var(--navy-dark); color: var(--white); z-index: 70;
  transform: translateX(-100%); transition: transform .25s ease;
  display: flex; flex-direction: column; padding: 18px 0;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 10px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.drawer-user { font-weight: 600; font-size: 15px; }
.drawer-role { font-size: 12px; color: #93A3BD; margin-top: 2px; }
.drawer nav { padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.drawer nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: var(--radius-sm);
  color: #C7D2E3; font-size: 14.5px; font-weight: 500;
}
.drawer nav a i { font-size: 18px; width: 20px; text-align: center; }
.drawer nav a.active { background: var(--blue); color: var(--white); }
.drawer nav a:hover { background: rgba(255,255,255,0.06); }
.drawer-footer { margin-top: auto; padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.drawer-footer a { color: #F1A9A3; font-size: 14px; display: flex; align-items: center; gap: 8px; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); z-index: 50;
  background: var(--white); border-top: 1px solid #E7ECF3;
  display: flex; align-items: stretch; justify-content: space-around;
  box-shadow: 0 -2px 10px rgba(11,31,58,0.06);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; color: var(--text-muted); font-weight: 500;
}
.bottom-nav a i { font-size: 20px; }
.bottom-nav a.active { color: var(--blue); }
.bottom-nav a.fab-slot { position: relative; }
.bottom-nav .fab {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  width: 48px; height: 48px; border-radius: 50%; background: var(--blue); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  box-shadow: 0 6px 16px rgba(30,94,255,0.4);
}

/* ---------- Layout ---------- */
.page { padding: 16px 14px 8px; max-width: 1200px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.page-title { font-size: 19px; font-weight: 700; color: var(--navy); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Cards ---------- */
.card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; border: 1px solid #EEF1F6;
}
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); border: 1px solid #EEF1F6; }
.stat-card .stat-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-icon.blue { background: rgba(30,94,255,0.1); color: var(--blue); }
.stat-icon.green { background: rgba(22,163,106,0.1); color: var(--success); }
.stat-icon.orange { background: rgba(247,144,9,0.1); color: var(--warning); }
.stat-icon.red { background: rgba(217,45,32,0.1); color: var(--danger); }
.stat-icon.navy { background: rgba(11,31,58,0.08); color: var(--navy); }

/* ---------- List item cards (mobile replaces tables) ---------- */
.item-card {
  background: var(--white); border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 8px;
  box-shadow: var(--shadow); border: 1px solid #EEF1F6;
  display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.item-card:active { background: #F8FAFD; }
.item-avatar {
  width: 38px; height: 38px; border-radius: 10px; background: var(--bg); color: var(--navy);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 14.5px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item-chevron { color: #C7D0DC; font-size: 18px; }

/* ---------- Badges ---------- */
.badge-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 100px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-success { background: rgba(22,163,106,0.12); color: var(--success); }
.badge-warning { background: rgba(247,144,9,0.12); color: var(--warning); }
.badge-danger { background: rgba(217,45,32,0.12); color: var(--danger); }
.badge-neutral { background: rgba(102,112,133,0.12); color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: var(--radius-sm);
  padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:active { background: #164ed6; }
.btn-outline { background: var(--white); color: var(--navy); border: 1px solid #DCE2EC; }
.btn-danger-outline { background: rgba(217,45,32,0.08); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.sticky-action { position: fixed; bottom: calc(var(--nav-h) + 12px); left: 14px; right: 14px; z-index: 45; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.form-control {
  width: 100%; border: 1px solid #DCE2EC; border-radius: var(--radius-sm); padding: 11px 13px;
  font-size: 14.5px; color: var(--navy); background: var(--white);
}
.form-control:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
textarea.form-control { min-height: 90px; resize: vertical; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(7,21,37,0.55); z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
  background: var(--white); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0;
  max-height: 92vh; overflow-y: auto; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(30px); transition: transform .2s ease;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-sheet.fullscreen { border-radius: 0; max-height: 100vh; height: 100vh; }
.modal-handle { width: 40px; height: 4px; background: #E2E7F0; border-radius: 4px; margin: 0 auto 14px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; top: calc(var(--topbar-h) + 10px); left: 14px; right: 14px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy-dark); color: var(--white); padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; max-width: 420px; width: 100%; }
.toast.success i { color: var(--success); }
.toast.danger i { color: var(--danger); }
.toast.warning i { color: var(--warning); }

/* ---------- Empty / skeleton ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state i { font-size: 34px; color: #CBD4E3; margin-bottom: 10px; display: block; }
.skeleton { background: linear-gradient(90deg, #EEF1F6 25%, #E4E9F1 37%, #EEF1F6 63%); background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite; border-radius: var(--radius-sm); height: 62px; margin-bottom: 8px; }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Filters ---------- */
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.filter-chip { flex-shrink: 0; padding: 7px 14px; border-radius: 100px; font-size: 13px; font-weight: 600;
  background: var(--white); border: 1px solid #E3E8F0; color: var(--text-muted); }
.filter-chip.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: #E3E8F0; }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before { content: ''; position: absolute; left: -24px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 2px solid var(--white); box-shadow: 0 0 0 2px #E3E8F0; }
.timeline-title { font-size: 14px; font-weight: 600; color: var(--navy); }
.timeline-meta { font-size: 12px; color: var(--text-muted); margin: 2px 0 4px; }
.timeline-desc { font-size: 13px; color: #45516B; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--navy-dark); }
.login-card { background: var(--white); border-radius: 20px; padding: 32px 26px; width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); }
.login-logo { width: 46px; height: 46px; border-radius: 12px; background: var(--blue); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }
.login-title { font-size: 20px; font-weight: 700; color: var(--navy); }
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }
.demo-accounts { margin-top: 18px; padding: 12px; background: var(--bg); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-muted); }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .drawer { transform: translateX(0); position: sticky; top: 0; height: 100vh; width: 260px; flex-shrink: 0; }
  .drawer-overlay { display: none; }
  .app-shell { display: flex; }
  .app-main { flex: 1; min-width: 0; }
  .stat-grid { grid-template-columns: repeat(5, 1fr); }
  .page { padding: 24px 28px; }
  .sticky-action { position: static; margin-bottom: 16px; max-width: 220px; margin-left: auto; }
  table.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; }
  table.data-table th { text-align: left; font-size: 12.5px; color: var(--text-muted); padding: 12px 14px; background: var(--bg); }
  table.data-table td { padding: 12px 14px; font-size: 13.5px; border-top: 1px solid #EEF1F6; }
  .mobile-cards { display: none; }
}
@media (max-width: 899px) {
  .desktop-table { display: none; }
}
