/* ==========================================================================
   SPIRO Mortuary Care Services • Light Luxury Frosted Glass Theme
   Ethereal, luminous interface with subtle magenta, pink, and violet hues,
   high-contrast typography, and backdrop-blur glassmorphism.
   ========================================================================== */

:root {
  /* Background & Frosted Glass Surfaces */
  --bg-app: #fdf4ff;
  --bg-surface: rgba(255, 255, 255, 0.78);
  --bg-surface-elevated: rgba(255, 255, 255, 0.92);
  --bg-surface-subtle: rgba(245, 235, 255, 0.70);
  --bg-surface-hover: rgba(253, 244, 255, 0.90);
  
  /* Borders with delicate lilac / lavender glow */
  --border-subtle: rgba(192, 132, 252, 0.32);
  --border-strong: rgba(168, 85, 247, 0.50);
  --glass-border: rgba(255, 255, 255, 0.75);
  
  /* High-Legibility Deep Violet & Plum Typography */
  --text-primary: #240a34;      /* Deep Midnight Violet-Black for crisp readability */
  --text-secondary: #4a044e;    /* Rich Plum Purple */
  --text-muted: #701a75;        /* Soft Royal Magenta */
  --text-slate: #475569;        /* Neutral dark slate for subtle descriptions */
  
  /* Brand Accents: Magenta, Violet, Lilac, Orchid */
  --primary: #9333ea;           /* Vibrant Regal Violet */
  --primary-hover: #7e22ce;
  --primary-subtle: rgba(147, 51, 234, 0.12);
  --primary-border: rgba(147, 51, 234, 0.35);

  --magenta: #c026d3;           /* Vivid Magenta */
  --magenta-hover: #a21caf;
  --magenta-subtle: rgba(192, 38, 211, 0.12);
  --magenta-border: rgba(192, 38, 211, 0.35);

  --pink: #ec4899;              /* Gentle Rose Pink */
  --pink-subtle: rgba(236, 72, 153, 0.12);

  /* Status Colors (High Contrast on Light Frosted Surfaces) */
  --emerald: #059669;
  --emerald-hover: #047857;
  --emerald-subtle: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.32);

  --amber: #d97706;
  --amber-hover: #b45309;
  --amber-subtle: rgba(245, 158, 11, 0.14);
  --amber-border: rgba(245, 158, 11, 0.35);

  --orange: #ea580c;
  --orange-hover: #c2410c;
  --orange-subtle: rgba(234, 88, 12, 0.14);
  --orange-border: rgba(234, 88, 12, 0.35);

  --rose: #e11d48;
  --rose-hover: #be123c;
  --rose-subtle: rgba(225, 29, 72, 0.12);
  --rose-border: rgba(225, 29, 72, 0.35);

  --indigo: #7c3aed;
  --indigo-subtle: rgba(124, 58, 237, 0.12);
  --indigo-border: rgba(124, 58, 237, 0.32);

  --whatsapp: #16a34a;
  --whatsapp-hover: #15803d;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows & Glassmorphism */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 6px rgba(112, 26, 117, 0.05);
  --shadow-md: 0 8px 24px -4px rgba(112, 26, 117, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 16px 36px -6px rgba(112, 26, 117, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(192, 38, 211, 0.18);

  --glass-blur: blur(18px);
  --glass-blur-heavy: blur(24px);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  background-image: url('../assets/spiro-bg.jpg');
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  background-size: cover;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Glass Frosting Background Tint */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.50) 0%, rgba(253, 244, 255, 0.40) 50%, rgba(250, 232, 255, 0.50) 100%);
  pointer-events: none;
  z-index: -1;
}

/* Utility Helpers */
.hidden { display: none !important; }
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-orange { color: var(--orange); }
.text-rose { color: var(--rose); }
.text-indigo { color: var(--indigo); }
.text-magenta { color: var(--magenta); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.sep { color: var(--border-strong); opacity: 0.6; }

/* Background Helpers */
.bg-blue-subtle { background-color: var(--primary-subtle); color: var(--primary); }
.bg-emerald-subtle { background-color: var(--emerald-subtle); color: var(--emerald); }
.bg-amber-subtle { background-color: var(--amber-subtle); color: var(--amber); }
.bg-rose-subtle { background-color: var(--rose-subtle); color: var(--rose); }
.bg-indigo-subtle { background-color: var(--indigo-subtle); color: var(--indigo); }

/* App Shell Layout */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Header - Frosted Glass Bar */
.app-header {
  height: 78px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border-bottom: 1px solid rgba(192, 132, 252, 0.35);
  box-shadow: 0 4px 20px rgba(112, 26, 117, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.brand-logo-img {
  height: 52px;
  max-width: 240px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(112, 26, 117, 0.18));
  transition: transform var(--transition-fast);
}

.brand-logo-img:hover {
  transform: scale(1.02);
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #3b0764;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.70rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--magenta);
  text-transform: uppercase;
  background: linear-gradient(135deg, #a21caf, #7e22ce);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: #701a75;
  font-weight: 600;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(192, 132, 252, 0.40);
  padding: 7px 15px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 6px;
  box-shadow: 0 2px 6px rgba(112, 26, 117, 0.04);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Dedicated Header Command & Management Bar */
.app-command-bar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(192, 132, 252, 0.35);
  box-shadow: 0 4px 16px rgba(112, 26, 117, 0.04);
  padding: 10px 32px;
  position: sticky;
  top: 78px;
  z-index: 35;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, box-shadow 0.25s ease;
  will-change: transform, opacity;
}

.app-command-bar.command-bar-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  box-shadow: none;
}

.command-bar-container {
  max-width: 1840px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.command-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.command-group.primary-actions .btn {
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

/* App Main Container */
.app-main {
  flex: 1;
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Metrics Grid - Frosted Glass Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--bg-surface-elevated);
  box-shadow: var(--shadow-md);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.metric-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

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

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #240a34;
}

.metric-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(192, 132, 252, 0.22);
}

.metric-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Urgent Attention Banner - Frosted Amber Alert */
.urgent-banner {
  background: rgba(254, 243, 199, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(245, 158, 11, 0.40);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.12);
}

.urgent-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: var(--amber-subtle);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.urgent-banner-content {
  flex: 1;
}

.urgent-banner-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #78350f;
}

.urgent-banner-sub {
  font-size: 0.80rem;
  color: #92400e;
  margin-top: 2px;
  font-weight: 500;
}

.urgent-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toolbar & Filter Bar - Luxury Frosted Glass Strip */
.toolbar-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
}

.search-box-wrap {
  flex: 1 1 320px;
  min-width: 280px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--primary);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 42px 0 42px;
  background-color: #ffffff;
  border: 1.5px solid rgba(192, 132, 252, 0.45);
  border-radius: var(--radius-md);
  color: #240a34;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(112, 26, 117, 0.04);
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: #8a7090;
  font-weight: 500;
  font-size: 0.84rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.20), 0 4px 12px rgba(112, 26, 117, 0.08);
}

.clear-search-btn,
.search-clear-btn {
  position: absolute;
  right: 10px;
  width: 26px;
  height: 26px;
  background: rgba(147, 51, 234, 0.12);
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all var(--transition-fast);
  z-index: 2;
}

.clear-search-btn:hover,
.search-clear-btn:hover {
  color: #ffffff;
  background-color: var(--primary);
  transform: scale(1.08);
}

/* Toolbar Filters Container */
.toolbar-filters,
.filters-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 2 1 auto;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.60);
  border: 1px solid rgba(192, 132, 252, 0.30);
  padding: 3px 6px 3px 10px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.filter-group:hover,
.filter-group:focus-within {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.08);
}

.filter-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: #581c87;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.select-control {
  height: 36px;
  background-color: #ffffff;
  border: 1px solid rgba(192, 132, 252, 0.40);
  border-radius: var(--radius-sm);
  color: #240a34;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.select-control:hover {
  border-color: var(--primary);
}

.select-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.16);
}

/* View Toggle Buttons */
.view-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(245, 235, 255, 0.85);
  border: 1px solid rgba(192, 132, 252, 0.40);
  border-radius: var(--radius-md);
  padding: 4px;
}

.view-toggle-btn,
.view-btn {
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.view-toggle-btn:hover,
.view-btn:hover {
  color: var(--primary);
  background-color: rgba(192, 132, 252, 0.15);
}

.view-toggle-btn.active,
.view-btn.active {
  background-color: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(112, 26, 117, 0.15);
}

/* Filter Chips Bar */
.active-chips-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 16px;
}

.chips-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.chips-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(245, 235, 255, 0.85);
  border: 1px solid rgba(192, 132, 252, 0.40);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

/* Records Content Container */
.records-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Table View Wrapper - Glassmorphic Card */
.table-view-wrapper {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.records-table th {
  background: rgba(245, 235, 255, 0.85);
  color: #4a044e;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 16px;
  border-bottom: 2px solid rgba(192, 132, 252, 0.35);
  white-space: nowrap;
}

.records-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(233, 213, 255, 0.60);
  color: var(--text-primary);
  font-size: 0.86rem;
  vertical-align: middle;
}

.records-table tr:last-child td {
  border-bottom: none;
}

.records-table tbody tr {
  transition: background-color var(--transition-fast);
}

.records-table tbody tr:hover td {
  background-color: var(--bg-surface-hover);
}

/* Cells formatting */
.member-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-name {
  font-weight: 700;
  color: #240a34;
  font-size: 0.90rem;
}

.member-code {
  font-family: var(--font-mono);
  font-size: 0.70rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background-color: rgba(147, 51, 234, 0.10);
  color: var(--primary);
  border: 1px solid rgba(147, 51, 234, 0.25);
}

.member-contact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--text-slate);
}

.beneficiary-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.beneficiary-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.beneficiary-name {
  font-weight: 600;
  color: #3b0764;
  font-size: 0.86rem;
}

.relation-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background-color: rgba(192, 38, 211, 0.10);
  color: var(--magenta);
  border: 1px solid rgba(192, 38, 211, 0.25);
}

.due-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.due-date-text {
  font-weight: 700;
  font-size: 0.86rem;
  color: #240a34;
}

.due-countdown-tag {
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag-active { color: var(--emerald); }
.tag-upcoming { color: var(--indigo); }
.tag-urgent { color: var(--amber); }
.tag-grace { color: var(--orange); }
.tag-overdue { color: var(--rose); }
.tag-paused { color: var(--text-muted); }

.action-buttons-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* Cards View Grid Wrapper */
.cards-view-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

/* Empty State */
.empty-state {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 60px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: rgba(192, 132, 252, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 420px;
  margin-bottom: 20px;
}

.empty-state-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Pagination / Footer Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
}

.pagination-info {
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* App Footer - Luxury Frosted Strip */
.app-footer {
  margin-top: auto;
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-subtle);
  padding: 16px 28px;
}

.footer-content {
  max-width: 1540px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #3b0764;
}

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

.footer-brand-text,
.footer-brand-title,
.footer-brand-heading {
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #240a34;
}

.zink-watermark {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(112, 26, 117, 0.45);
  letter-spacing: 0.04em;
  user-select: none;
  font-style: italic;
  transition: color var(--transition-fast);
}

.zink-watermark strong {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-style: normal;
  color: rgba(112, 26, 117, 0.60);
}

.zink-watermark:hover {
  color: rgba(112, 26, 117, 0.75);
}

.zink-watermark:hover strong {
  color: #701a75;
}

.footer-sep {
  color: rgba(147, 51, 234, 0.28);
  margin: 0 4px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==========================================================================
   UNIVERSAL RESOLUTION & RESPONSIVE DESIGN SYSTEM (320px up to 4K Ultra-HD)
   ========================================================================== */

/* High-DPI, 2K & 4K Ultra-Wide Displays (1920px+) */
@media (min-width: 1920px) {
  .app-main, .footer-content {
    max-width: 1840px;
  }
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
  .metrics-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  .sales-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 2560px) {
  .app-main, .footer-content {
    max-width: 2300px;
  }
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  }
}

/* Medium Desktop & Small Laptops (993px - 1280px) */
@media (max-width: 1280px) {
  .app-header {
    padding: 12px 24px;
  }
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
  .toolbar-filters {
    gap: 8px;
  }
}

/* Tablets Landscape & Portrait (769px - 992px) */
@media (max-width: 992px) {
  .app-header {
    height: auto;
    min-height: 72px;
    padding: 14px 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .header-brand {
    justify-content: space-between;
    width: 100%;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-status-pill {
    margin-right: 0;
  }
  .app-main {
    padding: 18px 16px;
    gap: 16px;
  }
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
  }
  .toolbar-section {
    padding: 12px 16px;
  }
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
  .modal-dialog.modal-xl,
  .modal-dialog.modal-lg {
    width: 95vw;
    max-width: 95vw;
  }
}

/* Phablets & Mobile Devices (577px - 768px) */
@media (max-width: 768px) {
  .app-header {
    padding: 12px 14px;
  }
  .brand-logo-img {
    height: 38px;
  }
  .brand-title {
    font-size: 1.05rem;
  }
  .brand-subtitle {
    font-size: 0.70rem;
  }
  .header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .header-actions .btn {
    flex: 1 1 auto;
    font-size: 0.78rem;
    padding: 6px 10px;
    justify-content: center;
  }
  .toolbar-section {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }
  .search-box-wrap {
    width: 100%;
    min-width: 100%;
  }
  .toolbar-filters,
  .filters-wrap {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    justify-content: stretch;
  }
  .filter-group {
    flex: 1 1 100%;
    width: 100%;
    padding: 2px 8px;
  }
  .filter-group .select-control {
    width: 100%;
    font-size: 0.82rem;
  }
  .view-toggle-wrap {
    grid-column: 1 / -1;
    justify-content: center;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .metric-card {
    padding: 14px;
  }
  .metric-value {
    font-size: 1.45rem;
  }
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .urgent-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 10px;
  }
  .urgent-banner-actions {
    width: 100%;
  }
  .urgent-banner-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .active-chips-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 12px;
  }
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .footer-links {
    justify-content: center;
    flex-wrap: wrap;
  }
  .modal-dialog {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 8px auto;
    border-radius: 16px;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 16px 14px;
    max-height: calc(85dvh - 120px);
  }
  .modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
  .form-row, .form-row-2, .form-row-3, .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .sales-toolbar-card {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .sales-search-box {
    max-width: 100%;
    width: 100%;
  }
  .sales-filter-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .sales-filter-row .select-control {
    width: 100%;
  }
  .sales-content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Compact Smartphones (320px - 576px) */
@media (max-width: 576px) {
  html {
    font-size: 14.5px;
  }
  .app-header {
    padding: 10px 12px;
  }
  .brand-logo-img {
    height: 32px;
  }
  .brand-title {
    font-size: 0.98rem;
  }
  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 6px;
  }
  .header-actions .header-status-pill {
    grid-column: 1 / -1;
    text-align: center;
    justify-content: center;
  }
  .header-actions #btnOpenAddModal {
    grid-column: 1 / -1;
  }
  .header-actions #btnLogout {
    grid-column: 1 / -1;
  }
  .app-main {
    padding: 12px 10px;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .metric-card {
    padding: 12px 10px;
    border-radius: 12px;
  }
  .metric-label {
    font-size: 0.74rem;
  }
  .metric-value {
    font-size: 1.30rem;
  }
  .metric-icon-wrap {
    width: 28px;
    height: 28px;
  }
  .toolbar-filters {
    grid-template-columns: 1fr !important;
  }
  .records-table th,
  .records-table td {
    padding: 10px 10px;
    font-size: 0.80rem;
  }
  .member-card {
    padding: 14px 12px;
  }
  .card-meta-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .card-footer-actions .button-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .card-footer-actions .button-row .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
  }
  .login-card {
    padding: 24px 18px 20px 18px;
    border-radius: 18px;
  }
  .login-brand-logo {
    height: 48px;
  }
  .login-form input {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
    height: 44px;
  }
  .btn-login-submit {
    height: 46px;
    font-size: 0.92rem;
  }
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.80rem;
  }
  .analytics-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .matrix-tab-controls {
    width: 100%;
  }
  .matrix-tab-controls button {
    flex: 1;
    text-align: center;
  }
}

/* Landscape Mode on Short Mobile Screens */
@media (max-height: 520px) and (orientation: landscape) {
  .app-header {
    position: relative;
  }
  .modal-dialog {
    max-height: 94dvh;
    margin: 6px auto;
  }
  .modal-body {
    max-height: calc(94dvh - 100px);
  }
  .login-screen-wrap {
    align-items: flex-start;
    padding: 12px;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .select-control,
  .view-toggle-btn,
  .modal-close,
  .filter-chip {
    min-height: 38px;
  }
  .search-input {
    min-height: 42px;
    font-size: 16px !important; /* Prevents iOS browser auto-zoom */
  }
  .btn-assign-agent-action {
    min-height: 32px;
    padding: 4px 10px;
  }
}

/* Utility & System */
.hidden {
  display: none !important;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
