/* CareOS Design System - Beyond Barriers */
:root {
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --line-light: #f1f5f9;
  --navy: #0f172a;
  --navy-light: #1e293b;
  --navy-dark: #090d16;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-light: #eff6ff;
  --blue-border: #bfdbfe;
  --green: #10b981;
  --green-light: #ecfdf5;
  --green-border: #a7f3d0;
  --green-text: #047857;
  --orange: #f59e0b;
  --orange-light: #fffbeb;
  --orange-border: #fde68a;
  --orange-text: #b45309;
  --red: #ef4444;
  --red-light: #fef2f2;
  --red-border: #fecaca;
  --red-text: #b91c1c;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --card-bg: #ffffff;
  --body-bg: #f8fafc;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;
}

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

body {
  margin: 0;
  background: var(--body-bg);
  color: var(--ink);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--blue-hover);
}

/* ==========================================================================
   App Shell & Layout
   ========================================================================== */
.app-shell {
  min-height: 100vh;
  display: flex;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header {
  padding: 20px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  overflow: hidden;
}

.brand-text strong {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.brand-text small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #60a5fa;
  text-transform: uppercase;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.branch-switch {
  margin: 12px 12px 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
  user-select: none;
}
.branch-switch.clickable {
  cursor: pointer;
}
.branch-switch:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
}
.branch-switch .dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}
.branch-switch small {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #94a3b8;
}
.branch-switch strong {
  display: block;
  font-size: 12px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Branch Dropdown Menus */
.branch-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 12px;
  right: 12px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 6px;
  z-index: 50;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropdown-head {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 6px 8px 4px;
}
.branch-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: #e2e8f0;
  text-decoration: none;
  font-size: 12px;
  transition: all 0.15s ease;
}
.branch-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.branch-option.selected {
  background: var(--blue);
  color: #ffffff;
}
.branch-option .status-dot-all {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #60a5fa;
  flex-shrink: 0;
}
.branch-option .status-dot-branch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}
.branch-option .opt-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.branch-option .opt-text strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.branch-option .opt-text small {
  font-size: 10px;
  color: #94a3b8;
}
.branch-option.selected .opt-text small {
  color: #bfdbfe;
}
.branch-option .check-icon {
  font-size: 12px;
  font-weight: 900;
  margin-left: auto;
}

/* Topbar Branch Switcher Widget */
.topbar-branch-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--body-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--ink);
  cursor: default;
  transition: all 0.15s ease;
}
.topbar-branch-btn.clickable {
  cursor: pointer;
}
.topbar-branch-btn.clickable:hover {
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}
.topbar-branch-btn .dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}
.topbar-branch-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 280px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 6px;
  z-index: 50;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar-branch-menu .dropdown-head {
  color: var(--muted);
}
.topbar-branch-menu .branch-option {
  color: var(--ink);
}
.topbar-branch-menu .branch-option:hover {
  background: var(--body-bg);
  color: var(--ink);
}
.topbar-branch-menu .branch-option.selected {
  background: var(--blue);
  color: #ffffff;
}
.desktop-collapse-btn {
  background: var(--body-bg);
  border: 1px solid var(--line);
  color: var(--muted);
}
.desktop-collapse-btn:hover {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--blue);
}

/* Sidebar Navigation */
.sidebar nav {
  padding: 8px 12px;
  flex: 1;
}

.sidebar nav p {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin: 18px 8px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin: 2px 0;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
}

.nav-link.active {
  background: var(--blue);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

.nav-badge.soon {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

/* Sidebar Footer */
.sidebar-foot {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.user-info strong {
  font-size: 13px;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info small {
  font-size: 11px;
  color: #94a3b8;
}

.logout-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Collapsed Sidebar on Desktop */
.app-shell.sidebar-collapsed .sidebar {
  width: 68px;
}
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .branch-switch div,
.app-shell.sidebar-collapsed .branch-switch .chevron,
.app-shell.sidebar-collapsed nav p,
.app-shell.sidebar-collapsed .nav-link span:not(.nav-icon),
.app-shell.sidebar-collapsed .nav-badge,
.app-shell.sidebar-collapsed .user-info {
  display: none !important;
}
.app-shell.sidebar-collapsed .brand-mark {
  justify-content: center;
}
.app-shell.sidebar-collapsed .branch-switch {
  margin: 10px 8px;
  padding: 10px;
  justify-content: center;
}
.app-shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 10px 0;
}
.app-shell.sidebar-collapsed .sidebar-foot {
  padding: 12px 8px;
  justify-content: center;
}
.app-shell.sidebar-collapsed .sidebar-header {
  padding: 16px 8px;
  justify-content: center;
}
.app-shell.sidebar-collapsed .main-content {
  margin-left: 68px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--body-bg);
}

.content-body {
  flex: 1;
  padding: 24px 28px;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

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

.crumb {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.crumb-sep {
  color: var(--muted-light);
}

.top-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  background: var(--body-bg);
  color: var(--muted);
  font-size: 13px;
  transition: all 0.15s ease;
}
.search-box:focus-within {
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  width: 180px;
}

/* Fixed Layout Footer */
.app-footer {
  margin-top: auto;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.02);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  height: 22px;
  width: auto;
  display: block;
}

.footer-tagline {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.footer-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-meta a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}
.footer-meta a:hover {
  text-decoration: underline;
}

.status-pill-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-light);
  color: var(--green-text);
  border: 1px solid var(--green-border);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}
.status-pill-live::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 35;
}

/* ==========================================================================
   UI Components: Cards, Buttons, Inputs, Tables
   ========================================================================== */

/* Flash messages */
.flash {
  background: var(--green-light);
  color: var(--green-text);
  border: 1px solid var(--green-border);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.flash.error {
  background: var(--red-light);
  color: var(--red-text);
  border-color: var(--red-border);
}

.flash.warning {
  background: var(--orange-light);
  color: var(--orange-text);
  border-color: var(--orange-border);
}

.flash-close {
  background: transparent;
  border: none;
  color: currentColor;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  opacity: 0.7;
}
.flash-close:hover {
  opacity: 1;
}

/* Page Header */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  color: var(--ink);
}

.page-head p {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 14px;
}

.page-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-light);
}

.card-head h2 {
  font-size: 16px;
  margin: 0;
}

.card-head a {
  font-size: 13px;
  font-weight: 600;
}

/* Metric Cards */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.metric-icon-wrap.blue { background: var(--blue-light); color: var(--blue); }
.metric-icon-wrap.green { background: var(--green-light); color: var(--green); }
.metric-icon-wrap.orange { background: var(--orange-light); color: var(--orange); }
.metric-icon-wrap.purple { background: var(--purple-light); color: var(--purple); }

.metric-data {
  flex: 1;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  margin: 4px 0 2px;
}

.metric-note {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Grids */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 24px;
}

.content-grid-even {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--blue);
  color: #ffffff;
  border: 1px solid transparent;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.button:hover {
  background: var(--blue-hover);
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.button.secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover {
  background: var(--line-light);
  border-color: #cbd5e1;
  color: var(--ink);
}

.button.outline-blue {
  background: #ffffff;
  color: var(--blue);
  border: 1px solid var(--blue-border);
}
.button.outline-blue:hover {
  background: var(--blue-light);
}

.button.success {
  background: var(--green);
  color: white;
}
.button.success:hover {
  background: #059669;
}

.button.danger {
  background: var(--red);
  color: white;
}
.button.danger:hover {
  background: #dc2626;
}

.button.sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Form Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 6px;
}

label span.req {
  color: var(--red);
  margin-left: 2px;
}

.field, .select, textarea.field {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.15s ease;
  outline: none;
}

.field:focus, .select:focus, textarea.field:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2364748b' 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: 32px;
}

.form-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 4px;
  font-weight: 500;
}

.section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 0 -22px;
  padding: 0 22px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--body-bg);
}

.data-table th:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}
.data-table th:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.data-table td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--line-light);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.data-table .name {
  font-weight: 600;
  color: var(--ink);
}

.data-table .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.data-table .empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
  font-size: 14px;
}

/* Status Badges */
.status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

.status.active, .status.completed, .status.paid, .status.reviewed, .status.achieved {
  background: var(--green-light);
  color: var(--green-text);
  border: 1px solid var(--green-border);
}

.status.scheduled, .status.partial, .status.in_progress {
  background: var(--orange-light);
  color: var(--orange-text);
  border: 1px solid var(--orange-border);
}

.status.unpaid, .status.cancelled, .status.no_show, .status.discharged, .status.inactive {
  background: var(--red-light);
  color: var(--red-text);
  border: 1px solid var(--red-border);
}

.status.draft, .status.on_hold, .status.not_started {
  background: var(--purple-light);
  color: var(--purple);
  border: 1px solid #ddd6fe;
}

.status.checked_in {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

/* Filters bar */
.filter-bar {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.filter-bar .search-input {
  flex: 1;
  min-width: 220px;
}

.filter-bar select {
  min-width: 150px;
}

/* Detail lists */
.detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.detail-row:last-child {
  border-bottom: none;
}
.detail-row span {
  color: var(--muted);
  font-size: 13px;
}
.detail-row strong {
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  text-align: right;
}

/* Schedule / Activity list */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--body-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}
.schedule-item:hover {
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  border-color: #cbd5e1;
}

.schedule-time {
  font-weight: 700;
  font-size: 12px;
  color: var(--blue);
  background: var(--blue-light);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
  min-width: 75px;
  line-height: 1.3;
}

.schedule-details {
  flex: 1;
}

/* ==========================================================================
   Child Profile Specific
   ========================================================================== */
.profile-hero {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-lg);
  flex-wrap: wrap;
  position: relative;
}

.child-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  display: grid;
  place-items: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.profile-hero-content {
  flex: 1;
  min-width: 250px;
}

.profile-hero-content h1 {
  color: #ffffff;
  font-size: 24px;
  margin: 0 0 6px;
}

.profile-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: #e2e8f0;
}

.profile-hero-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 18px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.active {
  color: var(--blue);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 2px 2px 0 0;
}

.tab-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--line);
  color: var(--ink-secondary);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}
.tab-btn.active .tab-count {
  background: var(--blue-light);
  color: var(--blue);
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* ==========================================================================
   Non-Scrollable Executive Settings Command Hub & Upper Tab Navigation
   ========================================================================== */
.settings-nav-container {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
}

.settings-nav-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-light);
  flex-wrap: wrap;
  gap: 10px;
}

.settings-nav-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-nav-heading h2 {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.settings-category-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.settings-cat-btn {
  background: var(--body-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  user-select: none;
}

.settings-cat-btn:hover {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--muted-light);
}

.settings-cat-btn.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.settings-tabs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.settings-tab-button {
  background: var(--body-bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
  width: 100%;
  box-sizing: border-box;
}

.settings-tab-button:hover {
  background: #ffffff;
  border-color: var(--blue-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.settings-tab-button.active {
  background: #eff6ff;
  border-color: var(--blue);
  box-shadow: 0 0 0 1.5px var(--blue), var(--shadow-sm);
}

.settings-tab-button.active.accent-bkash {
  background: #fff1f2;
  border-color: #e11d48;
  box-shadow: 0 0 0 1.5px #e11d48, var(--shadow-sm);
}

.settings-tab-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.settings-tab-button:hover .settings-tab-icon {
  border-color: var(--blue);
  color: var(--blue);
}

.settings-tab-button.active .settings-tab-icon {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.settings-tab-button.active.accent-bkash .settings-tab-icon {
  background: #e11d48;
  color: #ffffff;
  border-color: #e11d48;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.settings-tab-info {
  flex: 1;
  min-width: 0;
}

.settings-tab-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.settings-tab-button.active .settings-tab-title {
  color: var(--blue);
}

.settings-tab-button.active.accent-bkash .settings-tab-title {
  color: #e11d48;
}

.settings-tab-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.settings-tab-pill {
  font-size: 10px;
  font-weight: 800;
  background: var(--line);
  color: var(--ink-secondary);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.settings-tab-button.active .settings-tab-pill {
  background: var(--blue);
  color: #ffffff;
}

.settings-tab-button.active.accent-bkash .settings-tab-pill {
  background: #e11d48;
  color: #ffffff;
}

/* Active Module Indicator Banner */
.settings-module-banner {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 20px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.settings-module-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-module-banner-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  flex-shrink: 0;
}

.settings-module-banner-text h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.settings-module-banner-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a3b8;
}

/* Responsive Split & Card Grids (Prevents any horizontal scroll) */
.settings-split-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 992px) {
  .settings-split-grid {
    grid-template-columns: 1fr;
  }
}

.settings-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 18px;
  width: 100%;
  box-sizing: border-box;
}

.tab-pane .table-wrap {
  margin: 0;
  padding: 0;
  overflow-x: auto;
  max-width: 100%;
}

/* Backward compatibility for legacy hub classes */
.settings-hub-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.settings-hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
}

.settings-hub-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-section-row {
  margin-bottom: 16px;
}
.settings-section-row:last-child {
  margin-bottom: 0;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  width: 100%;
}

.settings-nav-tile {
  background: var(--body-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  position: relative;
  user-select: none;
  width: 100%;
}

.settings-nav-tile:hover {
  background: #ffffff;
  border-color: var(--blue-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.settings-nav-tile.active {
  background: #eff6ff;
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue), var(--shadow-sm);
}

.settings-nav-tile.active.accent-bkash {
  background: #fff1f2;
  border-color: #e11d48;
  box-shadow: 0 0 0 1px #e11d48, var(--shadow-sm);
}

.settings-tile-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.settings-nav-tile:hover .settings-tile-icon {
  border-color: var(--blue);
  color: var(--blue);
}

.settings-nav-tile.active .settings-tile-icon {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

.settings-nav-tile.active.accent-bkash .settings-tile-icon {
  background: #e11d48;
  color: #ffffff;
  border-color: #e11d48;
}

.settings-tile-content {
  flex: 1;
  min-width: 0;
}

.settings-tile-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.settings-nav-tile.active .settings-tile-title {
  color: var(--blue);
}
.settings-nav-tile.active.accent-bkash .settings-tile-title {
  color: #e11d48;
}

.settings-tile-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.settings-tile-badge {
  font-size: 10px;
  font-weight: 800;
  background: var(--line);
  color: var(--ink);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.settings-nav-tile.active .settings-tile-badge {
  background: var(--blue);
  color: #ffffff;
}

/* Goal Items */
.goal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--body-bg);
  transition: all 0.15s ease;
}
.goal-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
}

.goal-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.goal-domain {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.goal-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin: 2px 0;
}

.goal-measurement {
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow-y: auto;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex !important;
}

.modal-dialog, .modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
  margin: auto;
  animation: modalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-dialog.large, .modal-card.large {
  max-width: 840px;
}

.modal-dialog.sm, .modal-card.sm {
  max-width: 480px;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header, .modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  gap: 12px;
}

.modal-header h3, .modal-head h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}

.modal-header p, .modal-head p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.modal-close {
  background: #f1f5f9;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
}

.modal-close:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.modal-body {
  padding: 24px;
  max-height: calc(85vh - 140px);
  overflow-y: auto;
}

.modal-footer, .modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--body-bg);
}


/* ==========================================================================
   Comprehensive Responsive Breakpoints & Native Mobile App Experience
   ========================================================================== */
html, body {
  overflow-x: hidden;
  width: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav {
  display: none;
}

/* Base Mobile Form Input Safeguard (Prevents unwanted iOS viewport zooming) */
@media (max-width: 768px) {
  input.field, select.select, textarea.field, .search-box input {
    font-size: 16px !important;
  }
}

/* Tablet Breakpoint (<= 1024px) */
@media (max-width: 1024px) {
  .content-grid, .content-grid-even {
    grid-template-columns: 1fr;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 680px;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Mobile Devices Breakpoint (<= 768px) */
@media (max-width: 768px) {
  /* Sidebar Drawer with Smooth Transitions */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 10px 0 30px rgba(0,0,0,0.25);
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 39;
  }
  .app-shell.sidebar-open .sidebar-overlay {
    display: block;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0;
  }

  /* Safe Area Aware Padding */
  .content-body {
    padding: 12px 12px calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Sticky Native-Like Topbar */
  .topbar {
    padding: 8px 12px;
    gap: 8px;
  }
  .topbar-left {
    gap: 8px;
  }
  .top-actions {
    gap: 6px;
    flex-wrap: wrap;
  }
  .top-actions .search-box {
    display: none; /* Accessible via search shortcuts */
  }
  .top-actions .button {
    font-size: 11.5px;
    padding: 6px 10px;
    min-height: 36px;
  }
  .crumb {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
  }

  /* Page Head & Quick Action Headers */
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-head h1 {
    font-size: 19px;
    line-height: 1.25;
  }
  .page-head p {
    font-size: 12.5px;
  }
  .page-head-actions {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }
  .page-head-actions .button {
    flex: 1;
    min-height: 42px;
    justify-content: center;
    font-size: 13px;
  }

  /* Metric Stat Cards */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .metric-card {
    padding: 12px;
    border-radius: var(--radius-md);
  }
  .metric-card .v {
    font-size: 18px;
  }
  .metric-card .k {
    font-size: 10px;
    letter-spacing: 0.3px;
  }
  .metric-card .s {
    font-size: 10.5px;
  }

  /* Forms & Form Grids */
  .form-grid, .form-grid.three-col, .form-grid.two-col {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .form-grid .full {
    grid-column: span 1 !important;
  }
  .card {
    padding: 16px !important;
    border-radius: var(--radius-lg);
  }

  /* Diagnostic Requisition Pads & Checkbox Grids */
  [id^="cb_group_"] {
    grid-template-columns: 1fr !important;
    padding: 10px !important;
    gap: 6px !important;
  }
  .checkbox-option-label {
    font-size: 12.5px !important;
    padding: 6px 4px !important;
  }

  /* Responsive Horizontal Touch Tabs (Child Profile, Staff, Settings, Portal) */
  .profile-tabs, .nav-tabs-wrapper, .filter-tabs {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 6px;
    margin-bottom: 16px;
  }
  .profile-tabs::-webkit-scrollbar, .nav-tabs-wrapper::-webkit-scrollbar, .filter-tabs::-webkit-scrollbar {
    display: none;
  }
  .tab-btn, .profile-tab-item {
    padding: 8px 14px !important;
    font-size: 12.5px !important;
    flex-shrink: 0;
  }

  /* Profile Heros */
  .profile-hero {
    padding: 16px 14px;
    gap: 14px;
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-hero-meta {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Touch-Friendly Responsive Tables */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #ffffff;
    margin-bottom: 16px;
    box-shadow: inset -4px 0 8px -4px rgba(0,0,0,0.06);
  }
  .data-table {
    min-width: 600px;
    width: 100%;
  }
  .data-table th, .data-table td {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* Kanban Departmental Task Board */
  .kanban-board-grid {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 12px !important;
    padding-bottom: 12px;
  }
  .kanban-column {
    min-width: 270px;
    max-width: 290px;
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  /* Master Calendar Month Grid */
  .calendar-day-cell {
    min-height: 56px;
    padding: 3px !important;
  }
  .calendar-day-cell .cal-event-badge {
    font-size: 8.5px !important;
    padding: 1px 3px !important;
  }

  /* Mobile Modals (Bottom Sheet or Pinned Card) */
  .modal-dialog, .modal-card {
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-md) var(--radius-md);
    margin: 8px;
    width: calc(100% - 16px);
    max-height: 88vh;
  }
  .modal-body {
    padding: 16px;
    max-height: calc(88vh - 120px);
  }
  .modal-header, .modal-head {
    padding: 12px 16px;
  }
  .modal-footer, .modal-foot {
    padding: 10px 16px;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .button, .modal-foot .button {
    width: 100%;
    min-height: 42px;
    justify-content: center;
  }

  /* Sticky Form Submission Action Bar */
  .card[style*="position: sticky"] {
    bottom: 74px !important;
    padding: 12px 16px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .card[style*="position: sticky"] div {
    display: flex;
    gap: 8px;
    width: 100%;
  }
  .card[style*="position: sticky"] div button, .card[style*="position: sticky"] div a {
    flex: 1;
    min-height: 42px;
    justify-content: center;
  }

  /* Native Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    z-index: 999;
    align-items: center;
    justify-content: space-around;
    padding: 2px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.09);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    gap: 2px;
    transition: color 0.15s ease, transform 0.15s ease;
    border-radius: var(--radius-sm);
  }

  .mobile-nav-item:active {
    transform: scale(0.92);
  }

  .mobile-nav-item.active {
    color: var(--blue);
    font-weight: 800;
  }

  .mobile-nav-center {
    position: relative;
    top: -10px;
  }

  .mobile-nav-center-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
    border: 3px solid #ffffff;
    transition: transform 0.15s ease;
  }

  .mobile-nav-center:active .mobile-nav-center-icon {
    transform: scale(0.92);
  }

  .mobile-nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-footer {
    margin-bottom: 74px;
    padding: 16px 12px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px;
  }
  .page-head h1 {
    font-size: 17px;
  }
  .login-card {
    padding: 24px 18px !important;
    border-radius: var(--radius-lg) !important;
  }
}

/* ==========================================================================
   Centered Beyond Barriers Logo Watermark
   ========================================================================== */
.content-body {
  position: relative;
  min-height: calc(100vh - 140px);
}

.content-body::before {
  content: "";
  position: fixed;
  top: 52%;
  left: 56%;
  transform: translate(-50%, -50%);
  width: 480px;
  height: 480px;
  background-image: url('/assets/brand/bb2-logo.jpeg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.038;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: grayscale(100%);
}

@media (max-width: 768px) {
  .content-body::before {
    left: 50%;
    width: 260px;
    height: 260px;
  }
}

@media print {
  body::before, .content-body::before, .invoice-box::before, .clinical-report-sheet::before {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background-image: url('/assets/brand/bb2-logo.jpeg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.045;
    pointer-events: none;
    z-index: 0;
  }
}