/* Minimalist Light Mode Theme */
:root {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --pos: #16a34a;
  --pos-bg: #f0fdf4;
  --neg: #dc2626;
  --neg-bg: #fef2f2;
  --accent: #0f172a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Utilities */
.badge-pos {
  color: var(--pos);
  font-weight: 600;
}

.badge-neg {
  color: var(--neg);
  font-weight: 600;
}

.avatar-g {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), opacity 0.18s var(--ease-spring);
}
.avatar-g:hover {
  opacity: 0.9;
  transform: scale(1.06);
}
.avatar-g:active {
  transform: scale(0.94);
}

/* Profile Dropdown Menu */
.profile-menu-container {
  position: relative;
  display: inline-block;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
  min-width: 160px;
  z-index: 200;
  padding: 6px;
  transform-origin: top left;
  animation: dropdownFade 0.18s var(--ease-spring);
}

.m-header .profile-dropdown {
  left: auto;
  right: 0;
  transform-origin: top right;
}

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

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s var(--ease-spring), transform 0.15s var(--ease-spring);
  box-sizing: border-box;
}

.profile-dropdown-item:hover {
  background: var(--bg-muted);
}
.profile-dropdown-item:active {
  transform: scale(0.98);
}

.profile-dropdown-item.logout-item {
  color: var(--neg);
}

.profile-dropdown-item.logout-item:hover {
  background: #fef2f2;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Profile Page Layout */
.profile-page-container {
  max-width: 620px;
  margin: 2.5rem auto;
  padding: 0 1.25rem;
}

.profile-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.05);
  animation: modalPopDesktop 0.28s var(--ease-spring);
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.profile-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1.1rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 540px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
  .profile-page-container {
    margin: 1rem auto;
    padding: 0 0.75rem;
  }
  .profile-card {
    padding: 1.25rem;
  }
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.18s var(--ease-spring);
}

button:active {
  transform: scale(0.97);
}

input,
select {
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  font-size: 0.9rem;
  transition: border-color 0.18s var(--ease-smooth), box-shadow 0.18s var(--ease-smooth);
}

input:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

/* Auth Modal Gate */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: overlayFadeIn 0.22s var(--ease-spring);
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.14), 0 4px 14px -2px rgba(0, 0, 0, 0.05);
  animation: modalPopDesktop 0.24s var(--ease-spring);
}

/* =========================================
   DESKTOP VIEW (min-width: 769px)
   ========================================= */
.app-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.desktop-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
  min-height: 640px;
  overflow: hidden;
}

.mobile-layout {
  display: none;
}

/* Desktop Sidebar */
.d-sidebar {
  background: var(--bg-app);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.d-brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.d-balance-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}
.d-balance-box:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.d-balance-box.active {
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(15, 23, 42, 0.06);
}
.d-balance-box:active {
  transform: scale(0.99);
}

.d-balance-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.d-balance-net {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 4px 0;
}

.d-balance-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--bg-muted);
  padding-top: 8px;
  margin-top: 8px;
}

.d-contacts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
}

.d-contacts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 380px;
}

.d-contact-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.18s var(--ease-spring);
}

.d-contact-item:hover {
  background: var(--bg-muted);
  transform: translateX(2px);
}

.d-contact-item.active {
  background: var(--bg-surface);
  border-color: var(--border);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transform: translateX(0);
}

.d-contact-item:active {
  transform: scale(0.98);
}

/* Desktop Main Area */
.d-main {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--bg-surface);
}

.d-main-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

/* Interchangeable Direction Toggle */
.direction-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.dir-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
  transition: all 0.18s var(--ease-spring);
}

.dir-btn:hover {
  background: var(--bg-muted);
  border-color: #cbd5e1;
  color: var(--text-primary);
}

.dir-btn.active {
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  color: var(--accent);
  font-weight: 600;
  background: var(--bg-surface);
}

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

/* Quick Entry Composer */
.entry-card {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.entry-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.entry-inputs-grid {
  display: grid;
  grid-template-columns: 140px 150px 1fr auto;
  gap: 10px;
}
@media (max-width: 900px) {
  .entry-inputs-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.18s var(--ease-spring);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-primary:hover {
  background: #1e293b;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.18s var(--ease-spring);
}

.btn-outline:hover {
  background: var(--bg-muted);
  border-color: #cbd5e1;
  transform: translateY(-1px);
  opacity: 1;
}

.btn-outline:active {
  transform: translateY(0) scale(0.98);
}

/* Table */
.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ledger-table tbody tr {
  transition: background-color 0.15s ease;
}

.ledger-table tbody tr:hover {
  background-color: #f8fafc;
}

.ledger-table th {
  background: var(--bg-app);
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.ledger-table td {
  padding: 12px;
  border-bottom: 1px solid var(--bg-muted);
}

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

/* =========================================
   MOBILE VIEW (max-width: 768px)
   ========================================= */
@media (max-width: 768px) {
  .app-container {
    margin: 0;
    padding: 0;
  }

  .desktop-layout {
    display: none;
  }

  .mobile-layout {
    display: block;
    min-height: 100vh;
    padding: 1.25rem 1rem 5rem 1rem;
    background: var(--bg-surface);
  }
}

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

.m-card-net {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.m-filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.m-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s var(--ease-spring);
}

.m-tab:hover {
  border-color: #cbd5e1;
  color: var(--text-primary);
}

.m-tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

.m-tab:active {
  transform: scale(0.95);
}

.m-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.m-contact-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.18s var(--ease-spring);
}

.m-contact-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.m-contact-card:active {
  transform: scale(0.98);
}

/* Scooped Mobile Bottom Dock (Icon-only with center dipped cradle) */
.m-dock {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2.5rem);
  max-width: 360px;
  height: 60px;
  z-index: 90;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.08)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.03));
}

@media (min-width: 769px) {
  .m-dock {
    display: none !important;
  }
}

.m-dock-bar {
  display: flex;
  width: 100%;
  height: 60px;
  align-items: stretch;
}

.dock-wing {
  flex: 1;
  height: 60px;
  background: var(--bg-surface, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.dock-wing-left {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-right: none;
  border-radius: 30px 0 0 30px;
}

.dock-wing-right {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-left: none;
  border-radius: 0 30px 30px 0;
}

.dock-notch-container {
  width: 84px;
  height: 60px;
  flex-shrink: 0;
  position: relative;
  margin-left: -1px;
  margin-right: -1px;
}

.dock-notch-svg {
  display: block;
  width: 84px;
  height: 60px;
  overflow: visible;
}

.dock-icon-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s var(--ease-spring);
}

.dock-icon-btn:hover {
  color: var(--accent);
  background: var(--bg-muted);
  transform: scale(1.08);
}

.dock-icon-btn:active {
  transform: scale(0.92);
}

.dock-icon-btn.active {
  color: var(--accent);
  background: var(--bg-muted);
}

.dock-fab {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-spring);
  z-index: 2;
}

.dock-fab:hover {
  transform: translateX(-50%) translateY(-2px) scale(1.04);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.32);
}

.dock-fab:active {
  transform: translateX(-50%) translateY(0) scale(0.93);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

/* Date grouping headers */
.date-group-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin: 1.25rem 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-group-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.m-tx-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.18s var(--ease-spring);
}
.m-tx-card:hover {
  background: var(--bg-app);
  border-color: #cbd5e1;
}
.m-tx-card:active {
  transform: scale(0.98);
}

/* Modal Bottom-Sheet & Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 90;
  animation: overlayFadeIn 0.22s var(--ease-spring);
}

@media (min-width: 769px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 500px;
  padding: 1.5rem;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
  animation: sheetSlideUp 0.28s var(--ease-spring);
}

@media (min-width: 769px) {
  .modal-content {
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.14), 0 4px 14px -2px rgba(0, 0, 0, 0.05);
    animation: modalPopDesktop 0.24s var(--ease-spring);
  }
}

/* Keyframes */
@keyframes overlayFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheetSlideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes modalPopDesktop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

/* View Switching Transitions */
#dGlobalLedger,
#dActiveLedger,
#dEmptyState,
#mHomeView,
#mPeopleView,
#mDetailView,
#profileAlert {
  animation: viewFadeIn 0.22s var(--ease-spring);
}

/* Filter Drawer & Toolbar Elements */
.d-filter-toolbar {
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.filter-section {
  margin-bottom: 1.25rem;
}

.filter-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill {
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.16s var(--ease-spring);
}

.filter-pill:hover {
  border-color: #cbd5e1;
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

.filter-pill:active {
  transform: scale(0.96);
}

.filter-count-badge {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
  display: inline-block;
}

.badge-filter-count {
  background: var(--bg-muted);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  animation: viewFadeIn 0.18s var(--ease-spring);
}

.active-filter-chip-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
  font-size: 0.9rem;
  line-height: 1;
}

.active-filter-chip-remove:hover {
  color: var(--neg);
}

.quick-filters-row {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-filters-row::-webkit-scrollbar {
  display: none;
}

/* Accessibility: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .skeleton {
    animation: none;
    background: var(--bg-muted);
  }

  .top-loading-bar::after {
    animation: none;
    left: 0;
    width: 100%;
  }
}

/* ==========================================================================
   Skeleton Loading States (Shimmer Placeholders)
   ========================================================================== */
@keyframes skeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton {
  display: inline-block;
  background: linear-gradient(90deg, var(--bg-muted) 25%, #e2e8f0 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

.skeleton-hero {
  width: 148px;
  height: 1.9rem;
  border-radius: 8px;
  vertical-align: middle;
}

.skeleton-hero-lg {
  width: 168px;
  height: 2.1rem;
  border-radius: 8px;
  vertical-align: middle;
}

.skeleton-value {
  width: 68px;
  height: 0.95rem;
  vertical-align: middle;
}

.skeleton-count {
  width: 20px;
  height: 0.85rem;
  vertical-align: middle;
}

.skeleton-title {
  width: 140px;
  height: 1.25rem;
  vertical-align: middle;
}

.skeleton-line {
  height: 0.85rem;
  display: block;
}

.skeleton-line-sm {
  height: 0.7rem;
  display: block;
}

.skeleton-badge {
  width: 64px;
  height: 1.15rem;
  border-radius: 12px;
  vertical-align: middle;
}

.skeleton-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.skeleton-contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  pointer-events: none;
}

/* Optimistic UI Pending State & Toast Feedback */
.is-pending {
  opacity: 0.72;
  transition: opacity 0.2s var(--ease-smooth);
}

.app-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  max-width: 360px;
  padding: 10px 16px;
  background: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.22);
  z-index: 200;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.22s var(--ease-smooth), transform 0.22s var(--ease-spring);
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.app-toast.error {
  background: #991b1b;
}

@media (max-width: 768px) {
  .app-toast {
    right: auto;
    left: 50%;
    bottom: 6rem;
    width: max-content;
    max-width: calc(100% - 2.5rem);
    transform: translate(-50%, 10px);
  }

  .app-toast.show {
    transform: translate(-50%, 0);
  }
}

/* Atomic Button Press States, Inline Spinners & Loading Screens */
.btn-primary,
.btn-outline,
.dock-fab {
  transition: transform 0.12s ease, opacity 0.18s var(--ease-smooth), background-color 0.18s ease, border-color 0.18s ease;
}

.btn-primary:active:not(:disabled),
.btn-outline:active:not(:disabled),
.dock-fab:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled,
.btn-loading {
  opacity: 0.72;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-loading {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  animation: app-spin 0.65s linear infinite;
}

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

.top-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 3000;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.08);
  transition: opacity 0.18s ease;
}

.top-loading-bar.active {
  opacity: 1;
}

.top-loading-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: var(--accent, #0f172a);
  border-radius: 999px;
  animation: top-bar-slide 1.1s ease-in-out infinite;
}

@keyframes top-bar-slide {
  0% {
    left: -40%;
    width: 35%;
  }
  50% {
    left: 35%;
    width: 50%;
  }
  100% {
    left: 100%;
    width: 35%;
  }
}

.app-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.app-loading-screen.show {
  display: flex;
}

.app-loading-card {
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.75rem;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.loading-spinner-lg {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent, #0f172a);
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  animation: app-spin 0.65s linear infinite;
}