/* ==========================================================================
   SHEETSAAS ENTERPRISE - ELITE SAAS DESIGN SYSTEM
   Inspired by Linear, Stripe & Supabase Visual Aesthetics
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* taste-skill Cold Luxury / Precision Zinc Foundation */
  --color-primary: #09090b;
  --color-primary-hover: #18181b;
  --color-primary-active: #27272a;
  --color-primary-text: #ffffff;
  --color-primary-subtle: rgba(9, 9, 11, 0.06);
  --color-primary-glow: rgba(9, 9, 11, 0.12);
  
  --color-btn-bg: #09090b;
  --color-btn-text: #ffffff;
  --color-btn-border: #09090b;
  --color-btn-hover: #18181b;

  /* Single Singular Data Accent: Precision Emerald */
  --color-accent: #10b981;
  --color-accent-subtle: rgba(16, 185, 129, 0.1);
  
  --color-success: #10b981;
  --color-success-subtle: rgba(16, 185, 129, 0.1);
  --color-warning: #f59e0b;
  --color-warning-subtle: rgba(245, 158, 11, 0.1);
  --color-danger: #ef4444;
  --color-danger-subtle: rgba(239, 68, 68, 0.1);
  --color-info: #0284c7;
  --color-info-subtle: rgba(2, 132, 199, 0.1);

  /* Neutrals - Precision Light Canvas */
  --bg-app: #fafafa;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f4f4f5;
  --bg-hover: #e4e4e7;
  --border-color: #e4e4e7;
  --border-subtle: #f4f4f5;
  --border-focus: #71717a;

  --text-main: #09090b;
  --text-muted: #71717a;
  --text-subtle: #a1a1aa;
  --text-on-primary: #ffffff;

  /* Shadows - Layered & Subtle */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px 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.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.09), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --card-ring: 0 0 0 1px rgba(0, 0, 0, 0.04) inset;

  /* Shape Consistency Lock (taste-skill) */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

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

  /* Layout dimensions */
  --sidebar-width: 240px;
  --header-height: 64px;
  --bottom-nav-height: 60px;
  --transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Mode Theme - Precision Zinc-950 (Vercel / Linear Tier) */
[data-theme="dark"] {
  --bg-app: #09090b;
  --bg-surface: #121215;
  --bg-surface-elevated: #18181b;
  --bg-subtle: #1f1f23;
  --bg-hover: #27272a;
  --border-color: #27272a;
  --border-subtle: #18181b;
  --border-focus: #52525b;

  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;

  --color-primary: #fafafa;
  --color-primary-hover: #e4e4e7;
  --color-primary-active: #d4d4d8;
  --color-primary-text: #09090b;
  --color-primary-subtle: rgba(250, 250, 250, 0.1);
  --color-primary-glow: rgba(250, 250, 250, 0.18);

  --color-btn-bg: #fafafa;
  --color-btn-text: #09090b;
  --color-btn-border: #fafafa;
  --color-btn-hover: #f4f4f5;

  --color-success-subtle: rgba(16, 185, 129, 0.15);
  --color-warning-subtle: rgba(245, 158, 11, 0.15);
  --color-danger-subtle: rgba(239, 68, 68, 0.15);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --card-ring: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

[data-theme="dark"] body {
  background-color: var(--bg-app);
  background-image: none;
}

/* Base Reset & Smooth Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-subtle);
  border-radius: var(--radius-full);
  opacity: 0.5;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--color-primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* App Container Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styles (Desktop) */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: var(--transition);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon-box {
  width: 32px;
  height: 32px;
  background: #09090b;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .brand-icon-box {
  background: #fafafa;
  color: #09090b;
  border-color: rgba(255, 255, 255, 0.15);
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.03em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.64rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-weight: 700;
  margin-left: auto;
  border: 1px solid var(--border-color);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  font-weight: 700;
  padding: 0.75rem 0.75rem 0.25rem 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.88rem;
  text-decoration: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--bg-hover);
  color: var(--text-main);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--text-main);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  opacity: 0.85;
}
.nav-item.active .nav-icon {
  opacity: 1;
  color: var(--text-main);
}

.sidebar-footer {
  padding: 1rem 0.85rem;
  border-top: 1px solid var(--border-color);
}

.user-snippet {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-hover);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  box-shadow: var(--shadow-xs);
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  line-height: 1.2;
}

.user-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: capitalize;
  font-weight: 500;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}

/* Top App Header - Glassmorphic */
.top-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
}

[data-theme="dark"] .top-header {
  background: rgba(9, 9, 11, 0.88);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--text-main);
  color: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .header-brand-mark {
    display: none;
  }
}

.page-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

/* Modern Global Search Bar */
.global-search-wrapper {
  position: relative;
  display: none;
}
@media (min-width: 768px) {
  .global-search-wrapper {
    display: block;
  }
}

.global-search-input {
  width: 250px;
  padding: 0.45rem 2rem 0.45rem 2.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}
.global-search-input:focus {
  width: 320px;
  border-color: var(--border-focus);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.search-icon-pos {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.kbd-hint {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-subtle);
  pointer-events: none;
}

/* Icon Buttons */
.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-focus);
}

/* Unified Header Action Capsule (Top Navbar) */
.header-action-capsule {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 3px 6px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(12px);
}

[data-theme="dark"] .header-action-capsule {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.capsule-divider {
  width: 1px;
  height: 16px;
  background: var(--border-color);
  opacity: 0.6;
}

.capsule-btn {
  width: 28px !important;
  height: 28px !important;
  border: none !important;
  background: transparent !important;
  border-radius: 50% !important;
  color: var(--text-muted) !important;
  transition: var(--transition);
}

.capsule-btn:hover {
  background: var(--bg-subtle) !important;
  color: var(--text-main) !important;
}

.sheets-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-main);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: livePulseGreen 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes livePulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* User Header Avatar & Dropdown */
.avatar-header-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text-main);
  color: var(--bg-app);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}
.avatar-header-btn:hover {
  transform: scale(1.08);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 0.45rem;
  z-index: 100;
  animation: dropdownFade 0.15s ease-out;
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-dropdown-header {
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.dropdown-role-badge {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: capitalize;
  font-weight: 500;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.35rem 0;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.user-dropdown-item:hover {
  background: var(--bg-subtle);
}
.user-dropdown-item.item-danger {
  color: var(--color-danger);
}
.user-dropdown-item.item-danger:hover {
  background: var(--color-danger-subtle);
}

/* Profile Page Styles */
.profile-hero-card {
  padding: 1.75rem !important;
}

.profile-hero-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.profile-avatar-large {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.profile-display-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.profile-username-tag {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.profile-subtitle {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 0.35rem;
}

/* Main View Container */
.content-body {
  flex: 1;
  padding: 1.75rem;
  padding-bottom: 5rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* View Sections Switcher - Silky Side-In Motion */
.view-section {
  display: none;
}
.view-section.active {
  display: block;
  animation: viewSlideIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Zero Animation on Initial Load/Refresh: Page renders statically without slide-in */
body.is-initial-load .view-section,
body.is-initial-load .view-section.active {
  animation: none !important;
  transition: none !important;
}

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

/* Modern Button System - Linear / Vercel Precision */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.48rem 1.05rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  border: 1px solid var(--color-btn-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--text-subtle);
  color: var(--text-main);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #e11d48;
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}

/* Card & Bento Layout */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--card-ring), var(--shadow-xs);
  padding: 1.5rem;
  transition: var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* ==========================================================================
   EXECUTIVE DASHBOARD & BENTO GRID SYSTEM
   ========================================================================== */
/* ==========================================================================
   MASTER FINANCIAL BALANCE HERO & 4-METRIC STUDIO QUAD
   ========================================================================== */
.financial-balance-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .financial-balance-hero {
  background: linear-gradient(180deg, #13141b 0%, #0d0e12 100%);
  border-color: rgba(255, 255, 255, 0.08);
}

.balance-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.balance-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.35rem;
}

.balance-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.balance-meta-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.balance-amount-display {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-main);
  line-height: 1;
}

@media (max-width: 768px) {
  .financial-balance-hero {
    padding: 1.15rem 1.15rem;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
  }
  .balance-amount-display {
    font-size: 1.95rem;
  }
}

.balance-substrip {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.balance-delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.balance-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.balance-stat-item strong {
  font-family: var(--font-mono);
  color: var(--text-main);
  font-weight: 700;
}

.balance-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .balance-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
  }
  .balance-quick-actions .btn {
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
    justify-content: center;
  }
}

/* 4-Metric Studio Quad */
.dashboard-metric-quad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 992px) {
  .dashboard-metric-quad {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin-bottom: 1rem;
  }
}

.quad-metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
}

.quad-metric-card:hover {
  border-color: var(--border-focus);
}

.quad-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quad-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.quad-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.quad-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

@media (max-width: 768px) {
  .quad-metric-card {
    padding: 0.85rem 0.95rem;
  }
  .quad-value {
    font-size: 1.15rem;
  }
}

.quad-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Standard KPI Cards Grid Fallback */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--card-ring), var(--shadow-xs);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  box-shadow: var(--card-ring), var(--shadow-lg), 0 0 20px -8px var(--color-primary-glow);
  border-color: var(--border-focus);
  transform: translateY(-2.5px);
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.kpi-card:hover::after {
  opacity: 1;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.kpi-label {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.kpi-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  color: var(--color-primary);
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.kpi-card:hover .kpi-icon-badge {
  background: var(--color-primary-subtle);
  border-color: var(--color-primary-glow);
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 0.45rem;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.kpi-comparison {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Pure Monochrome Badges */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.badge-success {
  background: var(--bg-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.badge-danger {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.badge-warning {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-info {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

/* Chart Canvas Wrapper */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1.15fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.chart-card {
  min-height: 340px;
  display: flex;
  flex-direction: column;
}

.chart-canvas-wrapper {
  position: relative;
  flex: 1;
  min-height: 260px;
  width: 100%;
}

/* Dashboard Bottom Grid */
.dashboard-subgrid {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 1.25rem;
}

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

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

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

.form-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.required-asterisk {
  color: var(--color-danger);
}

.form-control {
  width: 100%;
  padding: 0.62rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.form-control.is-invalid {
  border-color: var(--color-danger);
}

.invalid-feedback {
  font-size: 0.74rem;
  color: var(--color-danger);
  display: none;
}

.is-invalid + .invalid-feedback {
  display: block;
}

/* Table Controls Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Data Table Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

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

.data-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
  transition: var(--transition);
}
.data-table th.sortable:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

.data-table tbody tr {
  animation: tableRowFade 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transition: background 0.15s ease, transform 0.15s ease;
}

@keyframes tableRowFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

/* ==========================================================================
   RECORDS MANAGEMENT PAGE (ELITE REDESIGN)
   ========================================================================== */
.records-header-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.records-page-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.records-page-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.records-quick-stats {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.records-stat-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.records-stat-pill:hover {
  border-color: var(--border-focus);
}

.stat-pill-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.stat-pill-value {
  font-size: 0.92rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.stat-pill-value.stat-primary,
.stat-pill-value.stat-success { color: var(--text-main); }
.stat-pill-value.stat-warning { color: var(--text-muted); }

/* Linear-style Segmented Status Tabs */
.records-card {
  padding: 0 !important;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.records-segmented-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  margin-bottom: 0;
  overflow-x: auto;
  background: var(--bg-surface);
}

.seg-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.seg-tab:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.seg-tab.active {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.tab-badge {
  font-size: 0.72rem;
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-muted);
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.seg-tab.active .tab-badge {
  background: var(--color-primary);
  color: #ffffff;
}

.dot-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-success { background: var(--color-success); box-shadow: 0 0 6px var(--color-success); }
.dot-warning { background: var(--color-warning); box-shadow: 0 0 6px var(--color-warning); }
.dot-danger { background: var(--color-danger); box-shadow: 0 0 6px var(--color-danger); }

/* Command Bar */
.records-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  gap: 1rem;
  flex-wrap: wrap;
}

.cmd-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  flex: 1;
}

.cmd-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.search-box-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.records-search-field {
  width: 100%;
  padding: 0.46rem 2rem 0.46rem 2.25rem;
  font-size: 0.84rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.records-search-field:focus {
  border-color: var(--border-focus);
  box-shadow: var(--ring-focus);
}

.search-clear-btn {
  position: absolute;
  right: 0.65rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.2rem;
  border-radius: 50%;
}
.search-clear-btn:hover { color: var(--text-main); }

.page-size-selector-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.page-size-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.select-compact {
  padding: 0.35rem 0.6rem !important;
  font-size: 0.8rem !important;
  width: auto !important;
  height: auto !important;
  border-radius: var(--radius-sm);
}

.filter-count-badge {
  background: var(--color-primary);
  color: #ffffff;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 9999px;
  font-weight: 700;
  margin-left: 0.2rem;
}

/* Row Action Buttons Group */
.table-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  justify-content: flex-end;
}

.action-btn-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn-sm:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-color);
  transform: translateY(-1px);
}

.action-btn-sm.delete-btn:hover {
  background: var(--color-danger-subtle);
  color: var(--color-danger);
  border-color: transparent;
}

/* Customer Avatar Badge - Pure Monochrome */
.customer-avatar-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.74rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

[data-theme="dark"] .customer-avatar-badge {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-main);
}

/* Monospace ID Chip - Pure Monochrome */
.record-id-chip {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-subtle);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-block;
  border: 1px solid var(--border-color);
}

.record-id-chip:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* Pulse status dot */
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
}

/* Hide mobile cards on desktop */
#records-mobile-cards {
  display: none;
}

@media (max-width: 768px) {
  #view-records .table-responsive {
    display: none !important;
  }
  #records-mobile-cards {
    display: block !important;
  }
}

/* Pagination Bar */
.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Modern Modals with Glassmorphism */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-backdrop.show {
  display: flex;
  animation: modalFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFade {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1.15rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-subtle);
}

/* Filter Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: none;
}
.drawer-backdrop.show {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  z-index: 95;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.drawer.show {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.15rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  pointer-events: auto;
  animation: toastSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastSlide {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-danger); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info { border-left: 4px solid var(--color-info); }

/* Fullscreen Loader */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
}
[data-theme="dark"] .spinner-overlay {
  background: rgba(9, 13, 22, 0.75);
}

.spinner-overlay.show {
  display: flex;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.85rem auto;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile Bottom Navigation (< 768px) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  z-index: 50;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
  backdrop-filter: blur(12px);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  border: none;
  background: transparent;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  transition: var(--transition);
}

.mobile-nav-item.active {
  color: var(--color-primary);
}

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

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
    padding-bottom: calc(var(--bottom-nav-height) + 2.5rem);
  }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0.85rem;
    left: 1rem;
    right: 1rem;
    max-width: 440px;
    margin: 0 auto;
    height: 60px;
    background: rgba(14, 14, 18, 0.88);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 35px;
    z-index: 100;
    box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    padding: 4px;
    align-items: center;
    justify-content: space-between;
  }

  [data-theme="light"] .mobile-bottom-nav {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  /* Smooth Gliding Active Pill (Fluid Apple-standard glide with ZERO bounce jump) */
  .nav-sliding-indicator {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 0;
    width: 48px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1), width 0.34s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease;
  }

  [data-theme="dark"] .nav-sliding-indicator {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  }

  .mobile-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border: none;
    background: transparent !important;
    height: 48px;
    flex: 1;
    border-radius: 28px;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: color 0.2s ease, transform 0.15s ease;
  }

  .mobile-nav-item svg {
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), color 0.2s ease;
  }

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

  .mobile-nav-item.active {
    color: var(--text-main);
  }

  .mobile-nav-item.active svg {
    color: var(--text-main);
    transform: scale(1.08);
  }

  .mobile-nav-center-action {
    height: 44px;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-center-squircle {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--text-main);
    color: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Always keep the Plus icon contrasting against the squircle */
  .nav-center-squircle svg,
  .mobile-nav-center-action.active .nav-center-squircle svg {
    color: var(--bg-app) !important;
    stroke: var(--bg-app) !important;
    transform: none !important;
  }

  .nav-center-squircle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  }

  .mobile-nav-center-action:active .nav-center-squircle {
    transform: scale(0.88);
  }
  .content-body {
    padding: 0.85rem;
    padding-bottom: calc(var(--bottom-nav-height) + 3rem);
  }
  .top-header {
    height: 52px;
    padding: 0 0.85rem;
    gap: 0.5rem;
  }
  .header-left {
    min-width: 0;
    flex: 1;
  }
  .page-title {
    font-size: 1.05rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
    max-width: 140px;
  }
  .header-right {
    gap: 0.45rem;
    flex-shrink: 0;
  }
  #btn-quick-add {
    display: none !important;
  }
  .sheets-live-pill .live-pill-text {
    display: none !important;
  }
  .sheets-live-pill {
    padding: 0.35rem !important;
    border-radius: 50% !important;
    width: 26px;
    height: 26px;
    justify-content: center;
  }
  .sheets-live-pill .pulse-dot {
    margin: 0 !important;
  }

  /* Eliminate duplicate and broken header on mobile */
  .records-header-meta {
    display: none !important;
  }
  .records-header-box {
    margin-bottom: 0.65rem !important;
    flex-direction: column;
    align-items: flex-start;
  }
  .records-quick-stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .records-stat-pill {
    width: 100%;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
  }
  .records-command-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem;
  }
  .cmd-left, .cmd-right {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }
  .records-search-box {
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .cmd-left .btn, .cmd-right .btn {
    flex: 1;
    justify-content: center;
  }
  .page-size-selector-wrap {
    display: none;
  }

  .table-responsive {
    border: none;
    background: transparent;
  }
  
  /* Compact & Balanced Mobile Card Architecture */
  .mobile-record-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 0.65rem;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    transition: var(--transition);
    cursor: pointer;
  }
  .mobile-record-card:active {
    background: var(--bg-subtle);
  }

  .m-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .m-card-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
  }
  .m-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-main);
    flex-shrink: 0;
  }
  .m-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
  }
  .m-cat {
    font-size: 0.74rem;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .m-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    flex-shrink: 0;
  }
  .m-amount {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.96rem;
    color: var(--text-main);
    line-height: 1.2;
  }
  .m-badge {
    padding: 0.15rem 0.5rem !important;
    font-size: 0.68rem !important;
  }

  .m-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.5rem;
    gap: 0.5rem;
  }
  .m-id-date {
    font-size: 0.72rem;
    color: var(--text-subtle);
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }
  .m-dot {
    opacity: 0.35;
  }
  .m-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }
  .m-action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
  }
  .m-action-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-main);
  }
  .m-action-btn.m-btn-del:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
  }
}

/* Print Styles */
@media print {
  .sidebar, .top-header, .mobile-bottom-nav, .toolbar, .btn, .pagination-wrapper, .modal-backdrop, .toast-container {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .content-body {
    padding: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .data-table {
    border: 1px solid #000;
  }
  .data-table th, .data-table td {
    border: 1px solid #ddd;
    color: #000 !important;
  }
}

/* ==========================================================================
   SKELETON SHIMMER LOADERS (Subtle, non-jarring loading states)
   ========================================================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 25%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.04) 75%
  ) !important;
  background-size: 200% 100% !important;
  animation: skeleton-shimmer 1.8s ease-in-out infinite !important;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.07) 50%,
    rgba(255, 255, 255, 0.03) 75%
  ) !important;
  background-size: 200% 100% !important;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 0.85rem;
  width: 70%;
  margin-bottom: 0.25rem;
}

.skeleton-value {
  height: 1.85rem;
  width: 55%;
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.skeleton-row td {
  padding: 0.85rem 0.75rem !important;
}
.skeleton-cell {
  height: 1.1rem;
  width: 80%;
  border-radius: 4px;
}

/* Non-blocking Button Spinning Feedback */
@keyframes spinClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-icon svg,
.rotating svg {
  animation: spinClockwise 0.8s linear infinite !important;
}


