/* ==========================================================================
   SARA EXPRESS Digital Payment Portal - Ultra-Modern Corporate Stylesheet
   ========================================================================== */

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

/* ══════════════════════════════════════════════════════════════
   COPY PROTECTION — Disable text selection & right-click
   ══════════════════════════════════════════════════════════════ */
* {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}
/* Allow typing in inputs & textareas */
input, textarea, select, [contenteditable] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  user-select: text !important;
}


:root {
  /* Color Tokens */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-sidebar: #0f172a; /* Deep Slate Sidebar */
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #ffffff;
  
  --primary: #02529c;
  --primary-hover: #013d75;
  --primary-light: #e6f0fa;
  --accent: #008751; /* Corporate Green Accent */
  --accent-hover: #00663d;
  --accent-light: #e6f4ed;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #02529c;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px rgba(2, 82, 156, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --bg-sidebar: #0f172a;
  
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-light: rgba(56, 189, 248, 0.15);
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-light: rgba(16, 185, 129, 0.15);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --border-color: #334155;
  --border-focus: #38bdf8;
}

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

html {
  font-size: 14px; /* Base: all rem values scale from 14px for professional compact UI */
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.45;
  min-height: 100vh;
  font-size: 1rem;
}

/* App Layout Grid */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   1. ULTRA-MODERN LOGIN PAGE STYLING & FIXED LOGO
   ========================================================================== */
.login-bg-layout {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.login-vector-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
}

.login-container { width: 100%; max-width: 440px; padding: 1.5rem; z-index: 10; position: relative; }

.login-card-glass {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.login-brand-header { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }

.login-logo {
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  margin-bottom: 0.25rem;
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.login-brand-header h2 { font-family: var(--font-heading); font-size: 1.65rem; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }
.login-brand-header p { font-size: 0.825rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }

.login-form { display: flex; flex-direction: column; gap: 1.1rem; }
.form-field-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-field-group label { font-size: 0.8rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 0.4rem; }
.form-field-group input { width: 100%; padding: 0.75rem 1rem; font-family: var(--font-body); font-size: 0.95rem; color: var(--text-main); background: #ffffff; border: 1.5px solid var(--border-color); border-radius: var(--radius-sm); transition: all var(--transition-fast); }
.form-field-group input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2, 82, 156, 0.15); }
.btn-login-submit { width: 100%; padding: 0.85rem; font-size: 1rem; justify-content: center; margin-top: 0.25rem; box-shadow: 0 4px 14px rgba(2, 82, 156, 0.3); }

.quick-accounts-box { background: var(--primary-light); border: 1px solid rgba(2, 82, 156, 0.15); border-radius: var(--radius-md); padding: 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.quick-acc-title { font-size: 0.75rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.04em; }
.quick-acc-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn-quick-tag { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; padding: 0.4rem 0.65rem; font-family: var(--font-body); font-size: 0.775rem; font-weight: 700; background: #ffffff; color: var(--primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition-fast); }
.btn-quick-tag:hover { border-color: var(--primary); background: var(--primary); color: #ffffff; }

.login-footer { text-align: center; font-size: 0.75rem; color: var(--text-muted); }

/* Flash Alerts */
.alert-box { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; }
.alert-danger { background-color: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-success { background-color: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

.toast-flash { padding: 0.85rem 1.5rem; margin: 1rem 2rem 0; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; box-shadow: var(--shadow-sm); }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }

/* ==========================================================================
   2. LEFT SIDEBAR NAVIGATION STYLING
   ========================================================================== */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1100;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.12);
}

.sidebar-header {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  height: 38px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
  padding: 4px 8px;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.nav-section-label {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.65rem 0.85rem 0.35rem 0.85rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sidebar);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  width: 100%;
}

.nav-link i { font-size: 1rem; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-link:hover { color: #ffffff; background-color: rgba(255, 255, 255, 0.08); }
.nav-link.active { color: #ffffff; background: linear-gradient(90deg, var(--primary) 0%, rgba(2, 82, 156, 0.85) 100%); box-shadow: 0 4px 14px rgba(2, 82, 156, 0.35); }

/* ── Nav Submenu Dropdowns ──────────────────────────────────── */
.nav-item-dropdown {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-sidebar);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.nav-dropdown-toggle:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}
.nav-dropdown-toggle.active {
  color: #ffffff;
}

.nav-dropdown-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.nav-dropdown-left i {
  font-size: 1rem;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.25s ease;
  opacity: 0.75;
}

.nav-item-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.submenu-list {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.85rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  margin-left: 1.1rem;
}

.nav-item-dropdown.open .submenu-list {
  display: flex;
}

.submenu-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.submenu-link i {
  width: 14px;
  height: 14px;
}
.submenu-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}
.submenu-link.active {
  color: #ffffff;
  background: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(2, 82, 156, 0.3);
}

.sidebar-footer {
  padding: 1.25rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background-color: rgba(0, 0, 0, 0.18);
}

.sidebar-user-card { display: flex; align-items: center; gap: 0.65rem; }
.user-avatar { width: 32px; height: 32px; border-radius: var(--radius-full); background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); color: #ffffff; font-family: var(--font-heading); font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-name { color: #ffffff; font-size: 0.8rem; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.user-role { color: var(--text-sidebar); font-size: 0.65rem; text-transform: uppercase; font-weight: 600; letter-spacing: 0.04em; }

.sidebar-actions { display: flex; gap: 0.5rem; }
.sidebar-action-btn { flex: 1; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12); color: #ffffff; padding: 0.4rem 0.65rem; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none; font-size: 0.75rem; font-weight: 600; transition: all var(--transition-fast); }
.sidebar-action-btn:hover { background: rgba(255, 255, 255, 0.18); }

/* ── Sidebar Collapse Mode ──────────────────────────────────── */
.sidebar {
  transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.sidebar-collapsed {
  width: 64px !important;
}
.sidebar-collapsed .sidebar-logo            { display: none; }
.sidebar-collapsed .nav-section-label       { display: none; }
.sidebar-collapsed .nav-link span           { display: none; }
.sidebar-collapsed .nav-dropdown-toggle span { display: none; }
.sidebar-collapsed .dropdown-chevron        { display: none; }
.sidebar-collapsed .submenu-list            { display: none !important; }
.sidebar-collapsed .user-details            { display: none; }
.sidebar-collapsed .sidebar-user-card       { justify-content: center; }
.sidebar-collapsed .sidebar-actions         { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; width: 100%; }
.sidebar-collapsed .sidebar-action-btn      { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: var(--radius-sm); }
.sidebar-collapsed .sidebar-action-btn span { display: none; }
.sidebar-collapsed .sidebar-header          { padding: .85rem .5rem; }
.sidebar-collapsed .sidebar-footer          { padding: .85rem .35rem; align-items: center; }
.sidebar-collapsed .sidebar-nav             { padding: .85rem .5rem; }
.sidebar-collapsed .nav-link,
.sidebar-collapsed .nav-dropdown-toggle {
  justify-content: center;
  padding: .65rem;
  gap: 0;
}
.sidebar-collapsed .nav-dropdown-left {
  justify-content: center;
  width: 100%;
}
.sidebar-collapsed .nav-link i,
.sidebar-collapsed .nav-dropdown-left i {
  width: 20px;
  height: 20px;
}

/* Floating tooltips for collapsed sidebar items */
@media (min-width: 851px) {
  .sidebar-collapsed .nav-link[title],
  .sidebar-collapsed .nav-dropdown-toggle[title] {
    position: relative;
  }
  .sidebar-collapsed .nav-link[title]:hover::after,
  .sidebar-collapsed .nav-dropdown-toggle[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 12px;
    background: #0f172a;
    color: #ffffff;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0,0,0,0.35);
    z-index: 9999;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.18);
  }
}

/* main wrapper adjusts when sidebar collapses */
.app-layout {
  transition: grid-template-columns 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ==========================================================================
   3. MAIN CONTENT WRAPPER & FROZEN TOP APP HEADER
   ========================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* FROZEN STICKY TOP APP HEADER */
.top-app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 2rem;
  background-color: #0f172a; /* Corporate Dark Slate Header BG */
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.top-header-left { display: flex; align-items: center; gap: 0.85rem; }
.top-portal-title { display: flex; align-items: center; gap: 0.75rem; }
.top-portal-title h1 { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 800; color: #ffffff; line-height: 1; }
.portal-badge { background: rgba(16, 185, 129, 0.2); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); font-size: 0.65rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.04em; }

.top-header-right { display: flex; align-items: center; gap: 1.1rem; }

/* NOTIFICATION BELL BUTTON & DROPDOWN */
.notification-wrapper { position: relative; }
.top-icon-btn { width: 38px; height: 38px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.15); color: #ffffff; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; transition: all var(--transition-fast); }
.top-icon-btn:hover { background: rgba(255, 255, 255, 0.2); color: #38bdf8; border-color: #38bdf8; }

.notif-badge-count { position: absolute; top: -2px; right: -2px; background: var(--danger); color: #ffffff; font-size: 0.65rem; font-weight: 800; width: 18px; height: 18px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; border: 2px solid #0f172a; }

.notification-dropdown-panel { display: none; position: absolute; right: 0; top: 46px; width: 320px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 1000; flex-direction: column; overflow: hidden; animation: dropdownFade 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.notification-wrapper:hover .notification-dropdown-panel, .notification-wrapper:focus-within .notification-dropdown-panel { display: flex; }
@keyframes dropdownFade { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.notif-header { padding: 0.85rem 1rem; background: var(--bg-primary); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.notif-header h4 { font-family: var(--font-heading); font-size: 0.875rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.notif-clear-btn { font-size: 0.725rem; color: var(--primary); cursor: pointer; font-weight: 600; }
.notif-clear-btn:hover { text-decoration: underline; }

.notif-list { display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; }
.notif-item { display: flex; gap: 0.75rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-color); font-size: 0.8rem; transition: background var(--transition-fast); }
.notif-item.unread { background: var(--primary-light); }
.notif-item:hover { background: var(--bg-primary); }
.notif-icon-box { width: 32px; height: 32px; border-radius: var(--radius-full); background: var(--success-bg); color: var(--success); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-content p { color: var(--text-main); margin-bottom: 0.2rem; }
.notif-time { font-size: 0.7rem; color: var(--text-muted); }

.user-top-profile { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.15); padding: 0.35rem 0.85rem; border-radius: var(--radius-full); color: #ffffff; }
.user-top-name { font-weight: 700; color: #ffffff; }
.role-pill { background: #38bdf8; color: #0f172a; font-size: 0.65rem; font-weight: 800; padding: 0.15rem 0.45rem; border-radius: 4px; text-transform: uppercase; }

.btn-get-location { font-size: 0.75rem; padding: 0.25rem 0.6rem; border-color: var(--primary); color: var(--primary); }

.mobile-header { display: none; }
.mobile-toggle-btn { display: none; background: transparent; border: none; font-size: 1.5rem; color: #ffffff; cursor: pointer; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-sm); }

.view-panel { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.75rem 2rem 2.5rem 2rem; max-width: 1200px; margin: 0 auto; width: 100%; flex: 1; }

.view-title-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; background: var(--bg-surface); padding: 0.9rem 1.25rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.view-title-bar h2 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 0.45rem; }
.view-title-bar p { font-size: 0.78rem; color: var(--text-muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.95rem; font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; letter-spacing: 0.01em; }
.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); box-shadow: 0 4px 12px rgba(2,82,156,0.25); transform: translateY(-1px); }
.btn-accent { background-color: var(--accent); color: #ffffff; }
.btn-accent:hover { background-color: var(--accent-hover); transform: translateY(-1px); }
.btn-outline { background-color: transparent; border-color: var(--border-color); color: var(--text-main); }
.btn-outline:hover { background-color: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.28rem 0.6rem; font-size: 0.72rem; }

/* Metrics Grid */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.metric-card { background: var(--bg-surface); border-radius: var(--radius-md); border: 1px solid var(--border-color); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-sm); }
.metric-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.metric-label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.metric-value { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 800; }

/* Dashboard Tables Grid */
.dashboard-tables-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 1.5rem; }
.dash-card { background: var(--bg-surface); border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.dash-card-header h3 { font-family: var(--font-heading); font-size: 0.92rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.dash-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.82rem; }
.dash-table th { background: var(--bg-primary); color: var(--text-muted); font-family: var(--font-heading); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; padding: 0.55rem 0.85rem; border-bottom: 2px solid var(--border-color); letter-spacing: 0.04em; }
.dash-table td { padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; font-size: 0.82rem; }

.badge { display: inline-flex; align-items: center; padding: 0.18rem 0.5rem; font-size: 0.64rem; font-weight: 700; border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.03em; }
.badge-verified, .badge-trained { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-incomplete { background: var(--danger-bg); color: var(--danger); }

.mini-progress { display: flex; align-items: center; gap: 0.5rem; font-size: 0.775rem; font-weight: 600; }
.mini-progress-bar { width: 65px; height: 6px; background: var(--border-color); border-radius: var(--radius-full); overflow: hidden; }
.mini-progress-fill { height: 100%; background: var(--primary); }

/* MAIN APP FOOTER — FROZEN / STICKY AT BOTTOM */
.app-main-footer {
  position: fixed;
  bottom: 0;
  left: 260px;
  right: 0;
  z-index: 999;
  padding: 0.55rem 2rem;
  background-color: #0f172a;
  border-top: 2px solid var(--primary);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.25);
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  transition: left 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* Adjust footer position when sidebar is collapsed */
.sidebar.sidebar-collapsed + .main-wrapper .app-main-footer,
.sidebar.sidebar-collapsed ~ .main-wrapper .app-main-footer {
  left: 64px;
}

.app-main-footer strong {
  color: #38bdf8;
  font-weight: 700;
}

/* Push page content up so footer doesn't overlap it */
.main-wrapper {
  padding-bottom: 44px;
}

/* Form Toolbar */
.form-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; background: var(--bg-surface); padding: 0.9rem 1.25rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); }
.select-counter-wrapper { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; }
.select-input { padding: 0.55rem 0.9rem; font-family: var(--font-body); font-size: 0.85rem; color: var(--text-main); background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.form-toolbar-buttons { display: flex; align-items: center; gap: 0.5rem; }

/* Printable Paper Card */
.paper-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  position: relative;
  overflow: hidden;
}

.paper-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%); }

/* DOCUMENT HEADER: Logo Left Only, Title Right-Center */
.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 2px dashed var(--border-color);
  gap: 1.5rem;
}

.doc-header-left { display: flex; align-items: center; }

.doc-logo-img {
  height: 52px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
}

.doc-header-right { flex: 1; text-align: center; }
.doc-header-right h2 { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 0.2rem; }
.doc-header-right p { font-size: 0.95rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }

.info-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.1rem; background: var(--primary-light); padding: 1.25rem; border-radius: var(--radius-md); border: 1px solid rgba(2, 82, 156, 0.15); }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label { font-size: 0.775rem; font-weight: 700; text-transform: uppercase; color: var(--primary); }
.form-field input { width: 100%; padding: 0.6rem 0.85rem; font-family: var(--font-body); font-size: 0.9rem; color: var(--text-main); background: var(--bg-surface); border: 1.5px solid var(--border-color); border-radius: var(--radius-sm); }

.checklist-section { display: flex; flex-direction: column; gap: 1rem; }
.section-header-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border-color); padding-bottom: 0.6rem; }
.section-title { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }

.table-wrapper { width: 100%; overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.checklist-table { width: 100%; border-collapse: collapse; text-align: left; background: var(--bg-surface); }
.checklist-table th { background: var(--bg-primary); color: var(--text-muted); font-family: var(--font-heading); font-size: 0.775rem; font-weight: 700; text-transform: uppercase; padding: 0.75rem 0.9rem; border-bottom: 2px solid var(--border-color); }
.checklist-table td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; }

.sl-col { width: 50px; text-align: center; font-weight: 700; color: var(--text-muted); }
.item-col { font-weight: 500; }
.status-col { width: 60px; text-align: center; }
.remarks-col { width: 35%; }
.remarks-input { width: 100%; padding: 0.4rem 0.7rem; font-family: var(--font-body); font-size: 0.85rem; color: var(--text-main); background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); }

.checkbox-custom-container { display: inline-flex; align-items: center; justify-content: center; position: relative; cursor: pointer; }
.checkbox-custom-container input { position: absolute; opacity: 0; height: 0; width: 0; }
.checkmark { height: 22px; width: 22px; background-color: var(--bg-surface); border: 2px solid var(--border-color); border-radius: 5px; display: flex; align-items: center; justify-content: center; }
.checkbox-custom-container input:checked ~ .checkmark { background-color: var(--primary); border-color: var(--primary); }
.checkmark::after { content: ""; position: absolute; display: none; width: 5px; height: 10px; border: solid #ffffff; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -2px; }
.checkbox-custom-container input:checked ~ .checkmark::after { display: block; }

.verification-section { display: flex; flex-direction: column; gap: 1rem; background: var(--bg-primary); padding: 1.25rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.verification-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.85rem; }
.verification-item { display: flex; align-items: center; gap: 0.65rem; background: var(--bg-surface); padding: 0.85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color); cursor: pointer; }

.signatures-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.sig-box { background: var(--bg-surface); border: 1.5px dashed var(--border-color); border-radius: var(--radius-md); padding: 1.1rem; display: flex; flex-direction: column; gap: 0.65rem; }
.sig-header { display: flex; justify-content: space-between; align-items: center; }
.sig-title { font-family: var(--font-heading); font-size: 0.9rem; font-weight: 700; }
.canvas-wrapper { position: relative; width: 100%; height: 120px; background: #ffffff; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.sig-canvas { width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-line { position: absolute; bottom: 25px; left: 10%; right: 10%; border-bottom: 1.5px dashed #cbd5e1; pointer-events: none; }

.assign-container { display: grid; grid-template-columns: 360px 1fr; gap: 1.5rem; }
.assign-form { display: flex; flex-direction: column; gap: 1rem; }

/* ==========================================================================
   RESPONSIVE SYSTEM — Full Site Coverage
   ========================================================================== */

/* ── Tablet landscape & medium screens (≤1024px) ── */
@media (max-width: 1024px) {
  .sidebar { width: 220px; }
  .view-panel { padding: 1.5rem 1.5rem 2rem 1.5rem; }
  .top-app-header { padding: 0.75rem 1.5rem; }
  .dashboard-tables-grid { grid-template-columns: 1fr; }
  .assign-container { grid-template-columns: 300px 1fr; }
  .doc-header-right h2 { font-size: 1.4rem; }
}

/* ── Tablet portrait (≤850px) — sidebar becomes overlay ── */
@media (max-width: 850px) {

  /* Sidebar: slide off-canvas, overlay on open */
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1200;
    box-shadow: 6px 0 30px rgba(0,0,0,0.35);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  /* Full-screen dark overlay BEHIND open sidebar — covers main content */
  .sidebar.mobile-open::after {
    content: '';
    position: fixed;
    inset: 0;
    left: 260px;          /* starts after sidebar edge */
    background: rgba(0,0,0,0.55);
    z-index: 1100;        /* above content, below sidebar */
    backdrop-filter: blur(2px);
  }

  /* Show hamburger toggle */
  .mobile-toggle-btn { display: flex !important; }

  /* App footer full width on mobile */
  .app-main-footer { left: 0 !important; }

  /* Top header compact */
  .top-app-header { padding: 0.75rem 1rem; }
  .portal-badge { display: none; }

  /* Main content full-width */
  .main-wrapper { width: 100%; }
  .view-panel { padding: 1.1rem 1rem 2rem 1rem; max-width: 100%; }
  .toast-flash { margin: 0.75rem 1rem 0; }

  /* Grids → single column */
  .assign-container { grid-template-columns: 1fr; }
  .dashboard-tables-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
  .verification-grid { grid-template-columns: 1fr; }
  .signatures-section { grid-template-columns: 1fr; }
  .info-section { grid-template-columns: 1fr; }

  /* Card / table padding reduction */
  .dash-card { padding: 1rem; }
  .paper-card { padding: 1.25rem; }
  .view-title-bar { flex-direction: column; align-items: flex-start; gap: 0.65rem; }

  /* Notification dropdown full-width-ish */
  .notification-dropdown-panel { width: 280px; right: -10px; }

  /* User profile pill — hide full name on tablet */
  .user-top-name { display: none; }

  /* Doc header stacks */
  .doc-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .doc-header-right { text-align: left; }
  .doc-header-right h2 { font-size: 1.2rem; }

  /* Table wrapper always scrolls horizontally */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Tasks page KPI cards → 2-col on tablet */
  .t-kpi { grid-template-columns: repeat(2,1fr) !important; }

  /* Task cards — stack action buttons */
  .task-card { padding: .85rem !important; }

  /* Routine flow pipeline → 2-col on tablet */
  .flow-pipeline { grid-template-columns: 1fr 1fr !important; }

  /* Routine task row → stack */
  .routine-task-row { grid-template-columns: auto 1fr !important; }
  .routine-task-row > div:last-child { grid-column: 1 / -1; display:flex; justify-content:flex-end; }

  /* Map height reduction */
  #interactive-live-map { height: 380px !important; }
}

/* ── Small tablets / large phones (≤640px) ── */
@media (max-width: 640px) {

  html { font-size: 13px; }

  /* Metrics 2-col → 1-col on very narrow */
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .metric-card { padding: 0.9rem; gap: 0.65rem; }
  .metric-icon { width: 38px; height: 38px; }
  .metric-value { font-size: 1.2rem; }

  /* Title bar stacks */
  .view-title-bar { padding: 0.75rem 1rem; }
  .view-title-bar h2 { font-size: 0.95rem; }

  /* Dash card header rows wrap */
  .dash-card-header { flex-wrap: wrap; gap: 0.5rem; }

  /* Table font shrink */
  .dash-table th, .dash-table td { font-size: 0.75rem; padding: 0.45rem 0.65rem; }
  .checklist-table th, .checklist-table td { font-size: 0.78rem; padding: 0.55rem 0.65rem; }

  /* Buttons smaller */
  .btn { font-size: 0.75rem; padding: 0.4rem 0.75rem; }
  .btn-login-submit { font-size: 0.9rem; padding: 0.75rem; }

  /* Top header: compress */
  .top-portal-title h1 { font-size: 1rem; }
  .top-header-right { gap: 0.65rem; }
  .top-icon-btn { width: 32px; height: 32px; }

  /* Form toolbar stacks */
  .form-toolbar { flex-direction: column; align-items: stretch; gap: 0.65rem; }
  .form-toolbar-buttons { flex-wrap: wrap; justify-content: flex-start; }

  /* Paper card */
  .paper-card { padding: 1rem; gap: 1.25rem; }
  .section-title { font-size: 1rem; }
  .doc-header-right h2 { font-size: 1.05rem; }

  /* Chat widget moves inward */
  .chat-widget-btn { bottom: 16px; right: 14px; padding: 0.65rem 1rem; font-size: 0.8rem; }
  .chat-window-panel { right: 10px; width: calc(100vw - 20px); max-width: 360px; }

  /* Toast full-width */
  .toast-flash { margin: 0.5rem 0.75rem 0; padding: 0.7rem 1rem; font-size: 0.82rem; }

  /* Map height */
  #interactive-live-map { height: 320px !important; }

  /* Notification dropdown */
  .notification-dropdown-panel { width: calc(100vw - 2rem); right: -60px; }
}

/* ── Mobile phones (≤480px) ── */
@media (max-width: 480px) {

  html { font-size: 12.5px; }

  /* Metrics 2-col → 1-col */
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { padding: 0.85rem 1rem; }

  /* Login page */
  .login-container { padding: 1rem; }
  .login-card-glass { padding: 1.5rem 1.25rem; gap: 1.15rem; border-radius: var(--radius-md); }
  .login-brand-header h2 { font-size: 1.35rem; }
  .form-field-group input { padding: 0.65rem 0.85rem; font-size: 0.9rem; }

  /* View panel ultra-compact */
  .view-panel { padding: 0.85rem 0.75rem 2rem 0.75rem; gap: 1rem; }

  /* Dash card compact */
  .dash-card { padding: 0.85rem; gap: 0.75rem; }

  /* Mini progress bar shrinks */
  .mini-progress-bar { width: 48px; }

  /* Buttons full-width in forms */
  .form-toolbar .btn { width: 100%; justify-content: center; }

  /* Checklist table: hide remarks column on phone */
  .remarks-col, .remarks-input { min-width: 100px; }

  /* Chat widget bottom-right */
  .chat-widget-btn span:first-of-type { display: none; }
  .chat-window-panel { width: calc(100vw - 16px); right: 8px; bottom: 76px; height: 420px; }

  /* Map */
  #interactive-live-map { height: 280px !important; }

  /* User profile pill ultra-compact */
  .user-top-profile { padding: 0.3rem 0.55rem; gap: 0.35rem; }
  .role-pill { display: none; }

  /* Top header */
  .top-app-header { padding: 0.6rem 0.75rem; }
  .top-portal-title h1 { font-size: 0.92rem; }
  /* Hide clock on small phones */
  #live-clock-widget { display: none !important; }

  /* Tasks KPI 1-col on phone */
  .t-kpi { grid-template-columns: 1fr 1fr !important; }

  /* Flow pipeline 1-col on phone */
  .flow-pipeline { grid-template-columns: 1fr !important; }
  .flow-col { border-right: none !important; border-bottom: 1px solid var(--border-color); }

  /* Stopwatch clock smaller on phone */
  .rsw-clock { font-size: 2.8rem !important; }
  .sw-time { font-size: 2.4rem !important; }

  /* Routine task row compact */
  .routine-task-row { gap: .4rem !important; padding: .65rem .75rem !important; }

  /* View title bar buttons wrap */
  .view-title-bar > div:last-child { display:flex; flex-wrap:wrap; gap:.4rem; width:100%; }
  .view-title-bar .btn { flex:1; justify-content:center; font-size:.75rem; }
}

/* ── Extra-small phones (≤360px) ── */
@media (max-width: 360px) {
  html { font-size: 12px; }
  .login-card-glass { padding: 1.25rem 1rem; }
  .view-panel { padding: 0.65rem 0.6rem 1.5rem 0.6rem; }
}

/* Notification dropdown toggle via .open class (JS-driven) */
.notification-dropdown-panel.open { display: flex; }



/* Print CSS */
@media print {
  @page { size: A4 portrait; margin: 10mm 12mm; }
  body { background: #ffffff !important; color: #000000 !important; padding: 0 !important; margin: 0 !important; }
  .sidebar, .top-app-header, .app-main-footer, .form-toolbar, .btn, .form-bottom-save-bar,
  .view-title-bar, .chk-select-card, #pdf-preview-modal, #modal-counter-map,
  .chat-widget-btn, .chat-window-panel, .toast-flash, #notice-bar { display: none !important; }
  .main-wrapper { flex: none !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .view-panel { padding: 0 !important; margin: 0 !important; }
  #printable-area { display: block !important; border: none !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
  .paper-card { border: none !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
  .paper-card::before { display: none !important; }
  .doc-header { border-bottom: 2px solid #000000 !important; padding-bottom: 6pt !important; }
  .doc-logo-img { max-height: 48px !important; }
  .info-section { background: #f8fafc !important; border: 1px solid #cbd5e1 !important; padding: 8pt !important; grid-template-columns: repeat(3, 1fr) !important; }
  .form-field input { border: none !important; border-bottom: 1px solid #000000 !important; border-radius: 0 !important; padding: 2pt 0 !important; font-size: 9pt !important; }
  .checklist-table { border: 1px solid #000000 !important; }
  .checklist-table th { background: #f1f5f9 !important; color: #000000 !important; border-bottom: 1px solid #000000 !important; padding: 4pt !important; font-size: 8pt !important; }
  .checklist-table td { padding: 4pt !important; font-size: 8.5pt !important; }
  .remarks-input { border: none !important; border-bottom: 1px dotted #94a3b8 !important; border-radius: 0 !important; background: transparent !important; }
  .signatures-section { grid-template-columns: 1fr 1fr !important; }
  .sig-box { border: 1px solid #000000 !important; padding: 6pt !important; }
  .canvas-wrapper { height: 80px !important; border: none !important; }
  .canvas-wrapper canvas { display: none !important; }
  .sig-print-img { display: block !important; }
}
