/* ══════════════════════════════════════════════════════════════
   IUEA Student Portal — Premium Design System
   Award-winning modern UI · 2026
   ══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --primary: #7A0000;
  --primary-50: #fef2f2;
  --primary-100: #fde3e3;
  --primary-200: #fbb7b7;
  --primary-600: #7A0000;
  --primary-700: #5c0000;
  --primary-800: #3e0000;
  --accent: #1e3a5f;
  --accent-light: #2d5a8e;
  --gray-25: #fcfcfd;
  --gray-50: #f9fafb;
  --gray-100: #f2f4f7;
  --gray-200: #eaecf0;
  --gray-300: #d0d5dd;
  --gray-400: #98a2b3;
  --gray-500: #667085;
  --gray-600: #475467;
  --gray-700: #344054;
  --gray-800: #1d2939;
  --gray-900: #101828;
  --success: #12b76a;
  --success-light: #ecfdf3;
  --warning: #f79009;
  --warning-light: #fffaeb;
  --danger: #f04438;
  --danger-light: #fef3f2;
  --info: #2e90fa;
  --info-light: #eff8ff;
  --bg: #f8f9fc;
  --bg-card: #ffffff;
  --sidebar-bg: #0c111d;
  --sidebar-hover: #1d2939;
  --sidebar-active: rgba(122,0,0,0.15);
  --text-primary: #101828;
  --text-secondary: #344054;
  --text-tertiary: #475467;
  --text-placeholder: #98a2b3;
  --text-white: #ffffff;
  --border-primary: #eaecf0;
  --border-secondary: #d0d5dd;
  --border-hover: #98a2b3;
  --shadow-xs: 0 1px 2px rgba(16,24,40,0.05);
  --shadow-sm: 0 1px 3px rgba(16,24,40,0.1), 0 1px 2px rgba(16,24,40,0.06);
  --shadow-md: 0 4px 8px -2px rgba(16,24,40,0.1), 0 2px 4px -2px rgba(16,24,40,0.06);
  --shadow-lg: 0 12px 16px -4px rgba(16,24,40,0.08), 0 4px 6px -2px rgba(16,24,40,0.03);
  --shadow-xl: 0 20px 24px -4px rgba(16,24,40,0.08), 0 8px 8px -4px rgba(16,24,40,0.03);
  --shadow-focus-primary: 0 0 0 4px rgba(122,0,0,0.12);
  --sidebar-w: 272px;
  --sidebar-w-collapsed: 72px;
  --header-h: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 200ms;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--primary-700); }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ══════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--gray-400);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width 300ms var(--ease);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  flex-shrink: 0;
  position: relative;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 2px 8px rgba(0,0,0,0.25),
    0 0 20px rgba(122,0,0,0.15);
  transition: box-shadow 300ms var(--ease), transform 300ms var(--ease);
}

.sidebar-brand:hover .brand-mark {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.12),
    0 4px 12px rgba(0,0,0,0.3),
    0 0 28px rgba(122,0,0,0.25);
  transform: scale(1.04);
}

.brand-mark img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1.5px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--gray-500);
  letter-spacing: 0.3px;
  margin-top: 1px;
}

.brand-divider {
  height: 1px;
  margin: 0 16px;
  background: linear-gradient(90deg, var(--primary), rgba(122,0,0,0.3) 60%, transparent);
  flex-shrink: 0;
}

.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .brand-divider { margin: 0 8px; }

.sidebar-nav {
  list-style: none;
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item > a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  color: var(--gray-400);
  font-size: 0.88rem;
  font-weight: 500;
  margin: 1px 0;
  transition: all var(--duration) var(--ease);
  position: relative;
  white-space: nowrap;
}

.nav-item > a::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.nav-item > a:hover { color: var(--text-white); background: var(--sidebar-hover); }
.nav-item > a.active { color: var(--text-white); background: var(--sidebar-active); }
.nav-item > a.active::before { opacity: 1; }

.nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--duration) var(--ease);
}

.nav-item > a:hover .nav-icon,
.nav-item > a.active .nav-icon { opacity: 1; }

.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .nav-item > a { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-group-toggle::after { display: none; }

.nav-group-toggle { cursor: pointer; }

.nav-group-toggle::after {
  content: '';
  width: 5px; height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  margin-left: auto;
  transition: transform 250ms var(--ease);
  flex-shrink: 0;
}

.nav-group.open .nav-group-toggle::after { transform: rotate(45deg); }

.nav-group-items {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms var(--ease);
}

.nav-group.open .nav-group-items { max-height: 500px; }

.nav-group-items .nav-item > a {
  padding: 6px 20px 6px 52px;
  font-size: 0.84rem;
  color: var(--gray-500);
}

.nav-group-items .nav-item > a::before { display: none; }
.nav-group-items .nav-item > a:hover { color: var(--text-white); }
.nav-group-items .nav-item > a.active { color: var(--text-white); background: var(--sidebar-active); }

.sidebar-toggle-btn {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 1100;
  background: var(--sidebar-bg);
  color: var(--text-white);
  border: none;
  border-radius: var(--radius-md);
  width: 40px; height: 40px;
  cursor: pointer;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  opacity: 0;
  transition: opacity 300ms var(--ease);
}

.sidebar-overlay.active { display: block; opacity: 1; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-user img {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.1);
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--gray-500);
}

.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 16px 0; }

/* ══════════════════════════════════════
   MAIN WRAPPER
   ══════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  transition: margin-left 300ms var(--ease);
}

.sidebar.collapsed ~ .main-wrapper { margin-left: var(--sidebar-w-collapsed); }

/* ══════════════════════════════════════
   HEADER
   ══════════════════════════════════════ */
.header {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.header-toggle {
  background: none;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--duration) var(--ease);
  font-size: 1.1rem;
}

.header-toggle:hover { background: var(--gray-50); border-color: var(--border-secondary); }

.header-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.header-breadcrumb .bc-home { color: var(--text-tertiary); display: flex; align-items: center; }
.header-breadcrumb .bc-sep { color: var(--gray-300); font-size: 0.7rem; }
.header-breadcrumb .bc-current { color: var(--text-primary); font-weight: 600; }

.header-right { display: flex; align-items: center; gap: 8px; }

.header-action {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--duration) var(--ease);
  position: relative;
}

.header-action:hover { background: var(--gray-100); color: var(--text-primary); }

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-md);
  transition: background var(--duration) var(--ease);
}

.header-user:hover { background: var(--gray-50); }

.header-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
}

.header-user .user-info { display: flex; flex-direction: column; }

.header-user .user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-user .user-role {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 200px;
  padding: 4px;
  display: none;
  z-index: 200;
}

.dropdown.open .dropdown-menu { display: block; }

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--duration) var(--ease);
}

.dropdown-menu a:hover { background: var(--gray-50); color: var(--text-primary); }
.dropdown-menu a svg { width: 16px; height: 16px; color: var(--text-tertiary); flex-shrink: 0; }
.dropdown-divider { border: none; border-top: 1px solid var(--border-primary); margin: 4px 0; }

/* ══════════════════════════════════════
   CONTENT AREA
   ══════════════════════════════════════ */
.content {
  flex: 1;
  padding: 20px 24px;
  max-width: 1320px;
  width: 100%;
}

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.page-header p { font-size: 0.9rem; color: var(--text-tertiary); margin-top: 4px; }

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */
.footer {
  padding: 12px 28px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-placeholder);
  border-top: 1px solid var(--border-primary);
}

/* ══════════════════════════════════════
   CARDS
   ══════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 20px;
  transition: box-shadow var(--duration) var(--ease);
}

.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 16px; }

.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-primary);
  background: var(--gray-25);
}

/* ══════════════════════════════════════
   METRICS
   ══════════════════════════════════════ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--duration) var(--ease);
}

.metric-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-secondary); }

.metric-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon.primary { background: var(--primary-100); color: var(--primary); }
.metric-icon.success { background: var(--success-light); color: var(--success); }
.metric-icon.warning { background: var(--warning-light); color: var(--warning); }
.metric-icon.info { background: var(--info-light); color: var(--info); }
.metric-icon.danger { background: var(--danger-light); color: var(--danger); }

.metric-body { min-width: 0; }

.metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 1px;
  font-weight: 500;
}

/* Legacy stat compat */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-primary); border-radius: var(--radius-xl); padding: 20px; display: flex; align-items: center; gap: 16px; transition: all var(--duration) var(--ease); }
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-secondary); }
.stat-icon { width: 46px; height: 46px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-icon.primary { background: var(--primary-100); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.info { background: var(--info-light); color: var(--info); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-content .stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-content .stat-label { font-size: 0.8rem; color: var(--text-tertiary); margin-top: 2px; }

/* ══════════════════════════════════════
   QUICK ACTIONS
   ══════════════════════════════════════ */
/* Dashboard bottom two-col layout */
.dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--duration) var(--ease);
  cursor: pointer;
}

.action-card:hover {
  border-color: var(--primary-200);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  color: var(--primary);
}

.action-card svg {
  color: var(--text-tertiary);
  transition: color var(--duration) var(--ease);
}

.action-card:hover svg { color: var(--primary); }
.action-card span { font-size: 0.78rem; font-weight: 600; text-align: center; line-height: 1.2; }

/* ══════════════════════════════════════
   TABLES
   ══════════════════════════════════════ */
.table-responsive { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

table th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-primary);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

table tbody tr { transition: background var(--duration) var(--ease); }
table tbody tr:hover { background: var(--gray-50); }
table tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: var(--text-white); border-color: var(--primary); box-shadow: 0 1px 2px rgba(122,0,0,0.2); }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: #fff; box-shadow: var(--shadow-sm); }
.btn-accent { background: var(--accent); color: var(--text-white); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-light); border-color: var(--accent-light); color: #fff; }
.btn-success { background: var(--success); color: var(--text-white); border-color: var(--success); }
.btn-success:hover { background: #0ea55e; color: #fff; }
.btn-danger { background: var(--danger); color: var(--text-white); border-color: var(--danger); }
.btn-danger:hover { background: #d92d20; color: #fff; }

.btn-outline {
  background: var(--bg-card);
  border-color: var(--border-secondary);
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--border-hover); color: var(--text-primary); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-tertiary); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

/* ══════════════════════════════════════
   FORMS
   ══════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: all var(--duration) var(--ease);
  outline: none;
  font-family: inherit;
  box-shadow: var(--shadow-xs);
}

.form-control::placeholder { color: var(--text-placeholder); }
.form-control:focus { border-color: var(--primary); box-shadow: var(--shadow-focus-primary); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23667085' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }

/* ══════════════════════════════════════
   ALERTS
   ══════════════════════════════════════ */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

.alert-success { background: var(--success-light); color: #054f31; border-color: #a6f4c5; }
.alert-danger { background: var(--danger-light); color: #7a271a; border-color: #fecdca; }
.alert-warning { background: var(--warning-light); color: #7a2e0e; border-color: #fedf89; }
.alert-info { background: var(--info-light); color: #194185; border-color: #b2ddff; }

/* ══════════════════════════════════════
   BADGES
   ══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-success { background: var(--success-light); color: #054f31; border-color: #a6f4c5; }
.badge-warning { background: var(--warning-light); color: #7a2e0e; border-color: #fedf89; }
.badge-danger { background: var(--danger-light); color: #7a271a; border-color: #fecdca; }
.badge-info { background: var(--info-light); color: #194185; border-color: #b2ddff; }
.badge-primary { background: var(--primary-50); color: var(--primary); border-color: var(--primary-200); }

/* ══════════════════════════════════════
   WELCOME BANNER
   ══════════════════════════════════════ */
.welcome-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  color: var(--text-white);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -60%; right: -8%;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.welcome-banner h2 {
  font-size: 1.1rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.welcome-banner .welcome-date {
  font-size: 0.78rem;
  opacity: 0.7;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

/* ══════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════ */
/* ── base (desktop) ── */
.login-page {
  position: fixed; inset: 0; z-index: 9999;
  overflow-y: auto; overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.login-bg { position: fixed; inset: 0; }
.login-bg img { width: 100%; height: 100%; object-fit: cover; object-position: 35% center; }

.login-bg-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(6,4,14,0.72) 0%, rgba(6,4,14,0.28) 52%, rgba(6,4,14,0.08) 78%),
    linear-gradient(to top, rgba(6,4,14,0.82) 0%, transparent 42%),
    linear-gradient(135deg, rgba(120,0,0,0.18) 0%, transparent 60%);
}

.login-hero-text { position: fixed; bottom: 48px; left: 48px; z-index: 10; color: #fff; max-width: 480px; }

.login-hero-pill {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 24px;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 18px;
}

.login-hero-text h1 { font-size: 2.7rem; font-weight: 800; line-height: 1.1; margin-bottom: 14px; letter-spacing: -0.5px; }
.login-hero-em { font-style: italic; font-weight: 900; background: linear-gradient(90deg, #e8292a 0%, #ff6b35 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.login-hero-text p { font-size: 1rem; color: rgba(255,255,255,0.72); line-height: 1.65; max-width: 400px; }

/* card — desktop: absolutely positioned right side */
.login-card-float {
  position: fixed; right: 5vw; top: 50%; transform: translateY(-50%);
  z-index: 20; width: 420px;
}

.login-card-inner {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(24px);
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.3);
  overflow: hidden;
}

.login-logo { width: 160px; max-width: 55%; height: auto; object-fit: contain; margin: 0 auto 24px; display: block; }
.login-card-inner h2 { font-size: 1.65rem; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.login-card-sub { font-size: 0.92rem; color: #8892a4; margin-bottom: 22px; }

.login-alert { background: #fff0f0; border: 1px solid #fecaca; color: #991b1b; padding: 10px 14px; border-radius: 10px; font-size: 0.88rem; margin-bottom: 18px; font-weight: 500; }

.lf-group { margin-bottom: 16px; }
.lf-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #3a3f4b; margin-bottom: 6px; }
.lf-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lf-label-row label { margin-bottom: 0; }
.lf-forgot { font-size: 0.8rem; color: var(--primary); font-weight: 600; }
.lf-forgot:hover { text-decoration: underline; }
.lf-input-wrap { position: relative; }
.lf-input-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #a0aab8; pointer-events: none; }

.lf-input-wrap input {
  width: 100%;
  padding: 13px 14px 13px 44px;
  font-size: 0.98rem; font-family: inherit;
  border: 1.5px solid #e2e6ee; border-radius: 12px;
  background: #fff; color: #1a1a2e; outline: none;
  transition: border-color var(--duration), box-shadow var(--duration);
}
.lf-input-wrap input::placeholder { color: #b0b8c8; }
.lf-input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(122,0,0,0.08); }

.lf-submit {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px; margin-top: 6px;
  font-size: 1.02rem; font-weight: 700; font-family: inherit;
  color: #fff; background: linear-gradient(135deg, var(--primary) 0%, #9a1a1a 100%);
  border: none; border-radius: 12px; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(122,0,0,0.25);
}
.lf-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(122,0,0,0.35); }
.lf-submit:active { transform: translateY(0); }

.lf-footer { text-align: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid #edf0f4; font-size: 0.75rem; color: #a0a8b4; line-height: 1.8; }

/* ── tablet (≤ 1024px): narrower card ── */
@media (max-width: 1024px) {
  .login-card-float { width: 380px; right: 4vw; }
}

/* ── small tablet / large phone (≤ 900px): centered floating card, hero hidden ── */
@media (max-width: 900px) {
  .login-bg-overlay {
    background: rgba(6,4,14,0.55);
  }
  .login-hero-text { display: none; }
  /* switch card from fixed to in-flow so page can scroll when keyboard opens */
  .login-card-float {
    position: relative;
    right: auto; top: auto; transform: none;
    width: min(92vw, 440px);
    margin: 0 auto;
    padding: 5vh 0;
    /* center vertically when content is shorter than viewport */
    display: flex; flex-direction: column; justify-content: center;
    min-height: 100vh;
  }
  /* page itself is the scroll container */
  .login-page { display: flex; flex-direction: column; }
}

/* ── phone landscape (short screens) ── */
@media (max-height: 600px) and (max-width: 900px) {
  .login-card-float { min-height: auto; padding: 24px 0; }
  .login-logo { width: 110px; margin-bottom: 14px; }
  .login-card-inner { padding: 24px 28px 20px; }
  .login-card-inner h2 { font-size: 1.3rem; }
  .lf-group { margin-bottom: 10px; }
  .lf-submit { padding: 11px; }
}

/* ── mobile portrait (≤ 520px): bottom-sheet style ── */
@media (max-width: 520px) {
  .login-card-float {
    width: 100%;
    min-height: auto;
    padding: 0;
    margin: auto 0 0;   /* push to bottom */
    justify-content: flex-end;
  }
  .login-card-inner {
    border-radius: 22px 22px 0 0;
    padding: 28px 22px 36px;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.25);
  }
  .login-logo { width: 130px; margin-bottom: 16px; }
  .login-card-inner h2 { font-size: 1.45rem; }
  .lf-input-wrap input { font-size: 1rem; padding: 14px 14px 14px 44px; }
  .lf-submit { padding: 15px; font-size: 1rem; border-radius: 14px; }
  .lf-footer { font-size: 0.78rem; }
}

/* ── very small phones (≤ 360px) ── */
@media (max-width: 360px) {
  .login-card-inner { padding: 22px 16px 30px; }
  .login-logo { width: 110px; }
  .login-card-inner h2 { font-size: 1.3rem; }
}

/* ── First-Time Login Wizard ── */
.ftl-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
  padding: 0 8px;
}

.ftl-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.ftl-step-num {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 0.82rem; font-weight: 700;
  background: #edf0f4; color: #a0a8b4;
  transition: all 300ms;
}

.ftl-step.active .ftl-step-num {
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 10px rgba(122,0,0,0.3);
}

.ftl-step.done .ftl-step-num {
  background: var(--success); color: #fff;
}

.ftl-step-label {
  font-size: 0.68rem; font-weight: 600; color: #a0a8b4;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.ftl-step.active .ftl-step-label { color: var(--primary); }
.ftl-step.done .ftl-step-label { color: var(--success); }

.ftl-step-line {
  flex: 1; height: 2px; min-width: 40px;
  background: #edf0f4; margin: 0 8px; margin-bottom: 18px;
}

.ftl-hint {
  display: block; font-size: 0.73rem; color: #a0a8b4; margin-top: 4px;
}

.ftl-success-icon {
  width: 56px; height: 56px; margin: 0 auto 16px;
  background: var(--success-light); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.ftl-success-icon svg { width: 28px; height: 28px; color: var(--success); }

.ftl-email-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #f0f4ff; border: 1px solid #d1deff;
  border-radius: 10px; padding: 10px 16px;
  font-size: 0.9rem; font-weight: 600; color: #2d5a8e;
  margin: 12px 0 20px; width: 100%; justify-content: center;
}

.ftl-instructions {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;
}

.ftl-instruction-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.84rem; color: #4a5568;
}

.ftl-instruction-num {
  width: 22px; height: 22px; min-width: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 0.7rem; font-weight: 700;
  background: #edf0f4; color: #667085;
}

.ftl-resend-text {
  font-size: 0.82rem; color: #8892a4; text-align: center; margin-bottom: 16px;
}

.ftl-resend-link {
  background: none; border: none; color: var(--primary);
  font-weight: 600; cursor: pointer; font-size: inherit; font-family: inherit; padding: 0;
  text-decoration: underline;
}

.ftl-back-link {
  display: block; text-align: center; font-size: 0.85rem;
  color: var(--primary); font-weight: 600;
}

.ftl-match-msg {
  font-size: 0.78rem; margin-top: 4px; min-height: 18px; font-weight: 600;
}
.ftl-match-msg.success { color: var(--success); }
.ftl-match-msg.error { color: var(--danger); }

.lf-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.lf-submit:disabled:hover { transform: none; box-shadow: none; }

/* ══════════════════════════════════════
   PROFILE
   ══════════════════════════════════════ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.profile-header .avatar-lg { width: 80px; height: 80px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.3); object-fit: cover; }
.profile-header h2 { font-size: 1.3rem; font-weight: 600; }
.profile-header .subtitle { font-size: 0.85rem; opacity: 0.85; }

/* ══════════════════════════════════════
   INFO GRID
   ══════════════════════════════════════ */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px 16px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-primary);
}

.info-item:last-child { border-bottom: none; }
.info-item .label { font-size: 0.73rem; color: var(--text-placeholder); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.info-item .value { font-size: 0.92rem; font-weight: 600; color: var(--text-primary); }

/* ══════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-tertiary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-full { width: 100%; }

.empty-state { text-align: center; padding: 56px 24px; color: var(--text-placeholder); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.25; }
.empty-state p { font-size: 0.95rem; }

/* ══════════════════════════════════════
   RECEIPT FORM
   ══════════════════════════════════════ */
.receipt-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.receipt-col { display: flex; flex-direction: column; gap: 2px; }
.req { color: var(--danger); font-weight: 700; }
.form-hint { display: block; font-size: 0.72rem; color: var(--text-placeholder); margin-top: 2px; }
.upload-row { display: flex; gap: 8px; align-items: flex-end; }
.upload-row .form-control { flex: 1; }

/* ── Upload Zone ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 200ms, background 200ms;
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-50);
}
.upload-zone-icon { width: 36px; height: 36px; color: var(--gray-400); margin: 0 auto 8px; display: block; }
.upload-zone-text { font-size: 0.88rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 2px; }
.upload-zone-hint { font-size: 0.75rem; color: var(--text-placeholder); }

.upload-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; background: var(--gray-50); border-radius: var(--radius-md);
}
.upload-preview img {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border-primary);
}
.upload-preview-info { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--text-secondary); }
.upload-preview-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-remove {
  background: none; border: none; color: var(--danger); font-size: 1.3rem; cursor: pointer;
  padding: 4px 8px; line-height: 1; border-radius: var(--radius-sm);
}
.upload-remove:hover { background: var(--danger-light); }

.upload-actions {
  display: flex; gap: 8px; margin-top: 10px;
}
.upload-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--radius-md); font-size: 0.82rem; font-weight: 600;
  border: 1px solid var(--border-secondary); background: #fff; color: var(--text-secondary);
  cursor: pointer; transition: all 150ms var(--ease);
}
.upload-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.upload-btn-camera { border-color: var(--accent); color: var(--accent); }
.upload-btn-camera:hover { background: #eef4fb; border-color: var(--accent); color: var(--accent); }

.upload-submit {
  width: 100%; margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.upload-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Camera viewfinder */
.camera-viewfinder {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 10px; border-radius: var(--radius-lg); overflow: hidden;
  background: #000; position: relative;
}
.camera-viewfinder video {
  width: 100%; max-height: 300px; object-fit: cover; display: block;
}
.camera-controls {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px; background: rgba(0,0,0,0.7); width: 100%;
}
.camera-snap {
  background: none; border: 3px solid #fff; border-radius: 50%;
  width: 52px; height: 52px; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center; transition: transform 100ms;
}
.camera-snap:active { transform: scale(0.9); }
.camera-cancel {
  background: none; border: none; color: rgba(255,255,255,0.8);
  font-size: 0.85rem; cursor: pointer;
}
.camera-cancel:hover { color: #fff; }

.steps-guide {
  background: linear-gradient(135deg, #e8f4fd 0%, #f0f7ff 100%);
  border: 1px solid #b8daff;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.steps-guide strong { font-size: 0.85rem; color: #004085; display: block; margin-bottom: 8px; }
.steps-list { display: flex; flex-wrap: wrap; gap: 6px; }
.step-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; padding: 6px 12px; border-radius: var(--radius-md);
  font-size: 0.78rem; color: var(--text-secondary); border: 1px solid #d1e7ff; flex: 1; min-width: 150px;
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}

.attachments-list { margin-top: 8px; }
.attachments-list strong { font-size: 0.82rem; color: var(--text-secondary); }
.attachments-list ul { list-style: none; padding: 0; margin: 6px 0 0; }
.attachments-list li { padding: 6px 0; border-bottom: 1px solid var(--border-primary); font-size: 0.82rem; }
.attachments-list li:last-child { border-bottom: none; }
.attachments-list a { color: var(--primary); text-decoration: none; }
.attachments-list a:hover { text-decoration: underline; }

/* ══════════════════════════════════════
   AUTH SHELL (forgot / reset / errors)
   ══════════════════════════════════════ */
.login-wrapper {
  min-height: 100vh;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
}

.login-header { text-align: center; margin-bottom: 24px; }
.login-header img { width: 140px; max-width: 55%; height: auto; margin: 0 auto 16px; }
.login-header h1 { font-size: 1.45rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.login-header p { font-size: 0.9rem; color: var(--text-tertiary); }

.login-body { margin-bottom: 8px; }
.login-footer { text-align: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-primary); font-size: 0.85rem; }
.login-footer a { font-weight: 600; }

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */

/* Tablet landscape / small desktop */
@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-bottom { grid-template-columns: 1fr; }
  .content { padding: 18px 20px; }
}

/* Tablet / drawer sidebar */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    transition: transform 300ms var(--ease);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  /* Ignore desktop collapsed state on mobile */
  .sidebar.collapsed .brand-text,
  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .sidebar-user-info { display: flex; }
  .sidebar.collapsed .brand-text { flex-direction: column; }
  .sidebar.collapsed .sidebar-brand { justify-content: flex-start; padding: 18px 20px; }
  .sidebar.collapsed .nav-item > a { justify-content: flex-start; padding: 8px 20px; }
  .sidebar.collapsed .nav-group-toggle::after { display: block; }
  .sidebar.collapsed .sidebar-user { justify-content: flex-start; padding: 16px 20px; }

  .sidebar-toggle-btn { display: flex; }
  .main-wrapper { margin-left: 0 !important; }
  body.sidebar-open { overflow: hidden; }

  .header { padding: 0 16px; }
  .header-breadcrumb .bc-current {
    max-width: min(48vw, 220px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }
}

/* Tablet portrait */
@media (max-width: 768px) {
  .info-grid { grid-template-columns: 1fr; }
  .receipt-form-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .dash-bottom { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: repeat(3, 1fr); }

  .profile-header {
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
    gap: 12px;
  }
  .profile-header .avatar-lg { margin: 0 auto; }

  .page-header { margin-bottom: 20px; }
  .page-header h1 { font-size: 1.25rem; }

  .status-timeline {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .status-step-label { font-size: 0.62rem; }

  .modal-card { padding: 22px 18px; width: calc(100% - 24px); }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; min-width: 0; }

  .toast-container { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }

  .ftl-step-label { font-size: 0.6rem; }
  .ftl-step-line { min-width: 20px; margin: 0 4px; margin-bottom: 18px; }

  .btn-lg { width: 100%; }

  [data-tooltip]::after {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(4px);
    min-width: 140px;
    max-width: min(260px, 70vw);
  }
  [data-tooltip]:hover::after {
    transform: translateX(0) translateY(0);
  }
}

/* Phones */
@media (max-width: 640px) {
  .content { padding: 12px; }
  .footer { padding: 12px 16px; font-size: 0.7rem; }
  .card { margin-bottom: 14px; border-radius: var(--radius-lg); }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .card-footer { padding: 12px 14px; }

  .metrics-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-grid { grid-template-columns: 1fr !important; }
  .action-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .action-card { padding: 12px 6px; }
  .action-card span { font-size: 0.72rem; }

  .header { padding: 0 12px; height: 56px; }
  .header-user .user-info { display: none; }
  .header-user svg:last-child { display: none; }
  .header-toggle { width: 40px; height: 40px; }

  .welcome-banner {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .welcome-banner h2 { font-size: 1rem; }
  .welcome-banner .welcome-date { white-space: normal; }

  .page-info { font-size: 0.82rem; flex-direction: column; gap: 8px; padding: 12px 14px; }

  /* Card headers stack on mobile */
  .card-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start !important;
  }
  .card-header .d-flex {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  .card-header .btn,
  .card-header form { width: 100%; }
  .card-header .btn { justify-content: center; }
  .card-header form .btn { width: 100%; }

  /* Card-style tables on mobile */
  .table-responsive {
    margin: 0 -2px;
    -webkit-overflow-scrolling: touch;
  }
  .table-responsive.mobile-cards table thead { display: none; }
  .table-responsive.mobile-cards table,
  .table-responsive.mobile-cards table tbody { display: block; width: 100%; }
  .table-responsive.mobile-cards table tr {
    display: block;
    background: #fff;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 10px;
  }
  .table-responsive.mobile-cards table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.85rem;
    text-align: right;
    word-break: break-word;
  }
  .table-responsive.mobile-cards table td:last-child { border-bottom: none; }
  .table-responsive.mobile-cards table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    text-align: left;
    max-width: 42%;
  }
  .table-responsive.mobile-cards table td .d-flex {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }
  .table-responsive.mobile-cards table td .btn {
    min-height: 40px;
    min-width: 72px;
    justify-content: center;
  }
  .table-responsive.mobile-cards table td.text-right { text-align: right; }

  /* Edit receipt page mobile tweaks */
  .steps-list { flex-direction: column; }
  .step-item { min-width: 0; }
  .upload-actions { flex-direction: column; }
  .upload-btn { justify-content: center; padding: 12px; min-height: 44px; }
  .camera-viewfinder video { max-height: 250px; }
  .camera-snap { width: 60px; height: 60px; }

  /* Button row stacking */
  .flex-wrap-mobile { flex-direction: column; gap: 10px; }
  .flex-wrap-mobile .btn { width: 100%; justify-content: center; }

  /* Evaluation questions — bigger touch targets */
  .form-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    min-height: 44px;
    min-width: 0;
    flex: 1 1 100%;
  }
  .form-check input[type="radio"] { width: 20px; height: 20px; flex-shrink: 0; }

  .login-card { padding: 28px 20px 24px; }
  .login-header img { width: 120px; }
  .login-header h1 { font-size: 1.3rem; }

  .metric-card { padding: 12px 14px; }
  .metric-value { font-size: 0.95rem; white-space: normal; }

  .empty-state { padding: 36px 16px; }
  .d-flex.gap-1, .d-flex.gap-2 { flex-wrap: wrap; }
}

/* Small phones */
@media (max-width: 400px) {
  html { font-size: 14px; }
  .content { padding: 10px; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  .header-breadcrumb .bc-current { max-width: 36vw; }
  .btn { padding: 10px 14px; }
  .ftl-step-label { display: none; }
}

/* ══════════════════════════════════════
   TOOLTIPS & HELPERS
   ══════════════════════════════════════ */

/* Tooltip trigger icon (? circle) */
.tip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  font-size: 0.62rem;
  font-weight: 800;
  background: var(--gray-200);
  color: var(--gray-600);
  border-radius: 50%;
  cursor: help;
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 4px;
  transition: all var(--duration) var(--ease);
  position: relative;
}
.tip-trigger:hover {
  background: var(--primary-100);
  color: var(--primary);
}

/* Tooltip bubble */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--gray-800);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  white-space: normal;
  min-width: 180px;
  max-width: 280px;
  text-align: center;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
  box-shadow: var(--shadow-lg);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Page Info Banner */
.page-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--info-light);
  border: 1px solid #b2ddff;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: #194185;
  line-height: 1.55;
}
.page-info svg { flex-shrink: 0; margin-top: 1px; }
.page-info.warning { background: var(--warning-light); border-color: #fedf89; color: #7a2e0e; }
.page-info.success { background: var(--success-light); border-color: #a6f4c5; color: #054f31; }

/* Inline field hint (improved) */
.field-help {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-placeholder);
  margin-top: 4px;
  line-height: 1.4;
}
.field-help svg { width: 12px; height: 12px; flex-shrink: 0; opacity: 0.6; }

/* Status Timeline */
.status-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 0;
}
.status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  text-align: center;
}
.status-step-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--gray-200);
  color: var(--gray-500);
}
.status-step.active .status-step-dot { background: var(--primary); color: #fff; }
.status-step.done .status-step-dot { background: var(--success); color: #fff; }
.status-step-label { font-size: 0.68rem; color: var(--text-placeholder); font-weight: 600; }
.status-step.active .status-step-label { color: var(--primary); }
.status-step.done .status-step-label { color: var(--success); }
.status-step-line { flex: 1; height: 2px; background: var(--gray-200); min-width: 24px; }
.status-step-line.done { background: var(--success); }

/* Confirmation Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  text-align: center;
  transform: scale(0.95);
  transition: transform 200ms var(--ease);
}
.modal-overlay.active .modal-card { transform: scale(1); }

.modal-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.modal-icon.warning { background: var(--warning-light); color: var(--warning); }
.modal-icon.danger { background: var(--danger-light); color: var(--danger); }
.modal-icon.success { background: var(--success-light); color: var(--success); }

.modal-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.modal-card p { font-size: 0.88rem; color: var(--text-tertiary); line-height: 1.55; margin-bottom: 20px; }

.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { min-width: 100px; }

/* Toast Notification (auto-save feedback) */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  animation: toastIn 300ms var(--ease);
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Enhanced empty states */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-placeholder);
}
.empty-state-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.empty-state-icon svg { width: 28px; height: 28px; color: var(--gray-400); }
.empty-state h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: 0.85rem; margin-bottom: 12px; }

/* Progress / Completion indicator */
.completion-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}
.completion-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--success);
  transition: width 500ms var(--ease);
}

/* Contextual action hint (pulsing dot) */
.action-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
}
.action-hint-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Inline auto-save badge */
.autosave-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--gray-400);
  font-weight: 500;
}
.autosave-badge.saved { color: var(--success); }
.autosave-badge svg { width: 12px; height: 12px; }

@media print {
  .sidebar, .header, .footer, .sidebar-toggle-btn, .sidebar-overlay { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .content { padding: 0; }
}
