:root {
  /* Modernize Color Palette, cleaner contrast */
  --primary: #8E2E8B;
  --primary-700: #6f236d;
  --primary-light: #F4E8F4;
  --lavender: #EBE5F2;
  /* Lighter lavender for borders */
  --bg: #FAFAFA;
  /* Off-white background */
  --text: #111827;
  --text-muted: #6B7280;
  --muted: #9CA3AF;
  --card: #FFFFFF;
  /* Pure white cards */
  --bg-sessions: #F0F9FF;
  --bg-calendar: #FEFCE8;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.theme-owners {
  --primary: #059669;
  --primary-700: #047857;
  --lavender: #D1FAE5;
  --card: #ffffff;
}

body.theme-pets {
  --primary: #D97706;
  --primary-700: #B45309;
  --lavender: #FEF3C7;
  --card: #ffffff;
}

body.theme-sessions {
  --primary: #2563EB;
  --primary-700: #1D4ED8;
  --lavender: #DBEAFE;
  --card: #ffffff;
}

/* Animations */

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.summary-card {
  text-align: center;
  padding: 2rem 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.big-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  margin: 1rem 0;
  line-height: 1;
}

.breakdown {
  display: flex;
  justify-content: space-around;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 12px;
  border-radius: 12px;
  margin-top: 1rem;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}

.action-btn {
  background: var(--card);
  color: var(--primary);
  border: 1px solid var(--lavender);
  padding: 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

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

.action-btn:active {
  transform: translateY(0);
}

.action-btn .icon {
  font-size: 1.75rem;
  line-height: 1;
}

/* Undo/Redo */
.undo-redo-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.icon-btn {
  background: var(--card);
  border: 1px solid var(--lavender);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  color: var(--text-muted);
}

.icon-btn#search-toggle {
  display: none;
}

.icon-btn#admin-toggle {
  display: inline-flex;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(142, 46, 139, 0.05);
  color: var(--primary);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

.icon-btn:active:not(:disabled) {
  transform: translateY(0);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f3f4f6;
  border-color: #e5e7eb;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6,
.brand h1,
.big-number {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
}

/* App Layout Structure */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.main-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}

.app-content::-webkit-scrollbar {
  width: 6px;
}

.app-content::-webkit-scrollbar-thumb {
  background-color: var(--muted);
  border-radius: 6px;
}

body.locked .app-container {
  display: none !important;
}

/* Header Modernization */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--lavender);
  box-shadow: none;
  z-index: 20;
  flex-shrink: 0;
}

.app-header.compact-header {
  padding: 0 24px;
  border-bottom: none;
  height: 0;
  overflow: hidden;
}

.app-header.center-header {
  justify-content: space-between;
}

/* Header Left Actions */
.header-actions-left {
  display: flex;
  gap: 8px;
  flex-direction: column;
}

.header-action-row {
  display: flex;
  gap: 8px;
}

.action-btn-glass {
  background: rgba(142, 46, 139, 0.06);
  color: var(--primary-700);
  border: 1px solid rgba(142, 46, 139, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn-glass:hover {
  background: rgba(142, 46, 139, 0.12);
  transform: translateY(-1px);
}

.action-btn-glass:active {
  transform: translateY(0);
}

/* Logo */
.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
}

.logo {
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
}

.logo-container.large-logo .logo {
  height: 110px;
  /* Slightly smaller to fit header better */
  transition: height 0.3s;
}

/* Header Right Stats */
.header-stats-right {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.stat-badge {
  background: var(--card);
  border: 1px solid var(--lavender);
  padding: 8px 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  min-width: 80px;
}

.stat-icon {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.stat-card-income {
  background: var(--card);
  border: 1px solid var(--lavender);
  padding: 8px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 140px;
  position: relative;
  overflow: hidden;
}

.stat-card-income.privacy-hide {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.stat-card-income.privacy-hide .income-total,
.stat-card-income.privacy-hide .income-breakdown,
.stat-card-income.privacy-hide .income-header {
  visibility: hidden;
}

.income-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.income-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Outfit', sans-serif;
  line-height: 1;
  margin-bottom: 6px;
}

.income-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px dashed var(--lavender);
  padding-top: 4px;
}

.income-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  align-items: center;
}

.income-label {
  color: var(--text-muted);
}

.income-val {
  font-weight: 600;
  color: var(--text);
}

/* Mobile Quick Actions (Header) */
.header-actions-mobile {
  display: none;
  gap: 12px;
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
}

.app-header.compact-header .header-actions-mobile {
  display: none !important;
}

.icon-btn-mobile {
  background: white;
  border: 1px solid var(--lavender);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.icon-btn-mobile:active {
  transform: scale(0.95);
  background: var(--bg);
}

/* Responsive Header for Mobile */
@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    padding: 12px 16px;
    gap: 16px;
  }

  .app-header.compact-header {
    padding: 0 16px;
    gap: 0;
  }

  .logo-container {
    order: -1;
    /* Logo on top */
  }

  .logo-container.large-logo .logo {
    height: 86px;
  }

  .header-actions-left {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }

  .header-stats-right {
    width: 100%;
    justify-content: space-between;
  }

  .stat-badge {
    flex: 1;
  }

  .stat-card-income {
    flex: 2;
  }

  .header-actions-mobile {
    display: flex;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 8px;
    gap: 12px;
  }

  .app-header.compact-header {
    padding: 0 8px;
    gap: 0;
  }

  .logo-container.large-logo .logo {
    height: 64px;
  }

  .action-btn-glass {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .header-actions-left {
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .header-actions-left .header-action-row {
    justify-content: space-between;
    width: 100%;
  }

  .header-actions-left .header-action-row>button {
    flex: 1;
    justify-content: center;
  }

  .stat-badge {
    padding: 6px;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  .income-total {
    font-size: 1.1rem;
  }
}

.brand h1 {
  margin: 0;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: .5px
}

.brand p {
  margin: 0;
  color: var(--muted)
}

/* Session Card Styles */
.session-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.session-pet-name {
  margin: 0;
  color: var(--primary);
}

.session-pet-breed {
  font-size: 0.8em;
  color: var(--muted);
  font-weight: normal;
  text-transform: uppercase;
  margin-left: 0.5rem;
}

.session-owner {
  font-size: 0.9rem;
  color: var(--text);
}

.session-service {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 0.5rem 0;
}

.session-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
  background: #f9f9f9;
  padding: 0.5rem;
  border-radius: 6px;
}

.session-notes {
  margin-top: 0.5rem;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 6px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
  border-bottom: 1px solid var(--lavender);
  align-items: center;
  flex-shrink: 0;
}

.badge {
  background: var(--primary-light);
  color: var(--primary-700);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  margin-left: 6px;
  font-weight: 700;
  transition: all 0.2s;
}

.tab.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Navigation Grouping (Dropdown) */
.tab-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--card);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  z-index: 100;
  padding: 8px;
  border: 1px solid var(--lavender);
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  animation: fadeUp 0.3s ease;
}

/* Puente invisible para mantener el hover */
.dropdown-content::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
}

.tab-dropdown:hover .dropdown-content,
.tab-dropdown.open .dropdown-content {
  display: flex;
}

.dropdown-content .tab {
  width: 100%;
  justify-content: flex-start;
  padding: 12px 16px;
}

.dropdown-arrow {
  font-size: 0.6rem;
  margin-left: 4px;
  opacity: 0.5;
  transition: transform 0.2s;
}

.tab-dropdown:hover .dropdown-arrow,
.tab-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.tab {
  border: none;
  border-radius: 12px;
  padding: 6px 14px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
}

.tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow);
}

.nav-spacer {
  flex: 1;
}

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

/* Search Input wrapper */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 0.9rem;
  pointer-events: none;
}

.search-input {
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--lavender);
  border-radius: 20px;
  background: var(--bg);
  width: 200px;
  transition: width 0.3s, border-color 0.2s;
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  width: 250px;
  box-shadow: 0 0 0 3px rgba(142, 46, 139, 0.1);
}

.content {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto
}

.hidden {
  display: none !important
}

.panel {
  display: none;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeUp 0.3s ease-out forwards;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel.active {
  display: block
}

.panel-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px
}

.panel-header h2 {
  margin: 0;
  font-size: 1.75rem;
  color: var(--text);
}

/* Bottom Nav for Mobile */
@media (max-width: 768px) {
  .tabs {
    padding: 10px 16px;
    gap: 4px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  .search-wrapper {
    display: none;
  }

  .icon-btn#search-toggle {
    display: inline-flex;
  }

  .panel {
    padding: 16px 12px;
  }

  .panel-header h2 {
    font-size: 1.4rem;
  }
}

@media (max-width: 600px) {

  /* Transform tabs into a fixed bottom navigation */
  .main-wrapper {
    padding-bottom: 64px;
    /* Space for bottom nav */
  }

  .tabs.bottom-nav-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    border-top: 1px solid var(--lavender);
    border-bottom: none;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 4px 16px 4px;
    /* Extra padding bottom for safe area on iOS */
    justify-content: space-around;
    overflow-x: visible;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  }

  .tab {
    flex-direction: column;
    padding: 6px;
    gap: 4px;
    border-radius: 8px;
    flex: 1;
    min-width: 0;
    /* allows squishing */
  }

  .tab .tab-icon {
    font-size: 1.2rem;
  }

  .tab .tab-label {
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .badge {
    display: none;
  }

  /* Hide badges on bottom nav to save space */
  .nav-spacer {
    display: none;
  }

  .nav-actions {
    display: none;
  }

  /* Hide admin/search toggle from bottom nav, ideally move to header or a "More" drawer if needed, but keeping simple for now. Need to rethink where to place Admin/Search toggle on mobile. */
  .tab-dropdown .dropdown-content {
    top: auto;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 12px;
    margin-top: 0;
  }

  #tab-listados-toggle .tab-label {
    display: none;
  }

  #tab-listados-toggle .dropdown-arrow {
    display: none;
  }

  .tab-dropdown .tab .tab-icon {
    font-size: 1.5rem;
  }

  .app-header {
    border-bottom: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  }
}

.primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.primary:hover {
  background: var(--primary-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(142, 46, 139, 0.25);
}

.primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.danger {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.danger:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.25);
}

.danger:active {
  transform: translateY(0);
  box-shadow: none;
}

.secondary-solid {
  background: #6B7280;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.secondary-solid:hover {
  filter: brightness(0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.secondary-solid:active {
  transform: translateY(0);
  box-shadow: none;
}

.secondary {
  background: white;
  border: 2px solid var(--primary);
  color: var(--primary);
  border-radius: 12px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.secondary:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.ghost {
  background: transparent;
  border: 1px solid var(--lavender);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.ghost:hover {
  background: #f3f4f6;
  color: var(--text);
  border-color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px
}

.card {
  background: var(--card);
  border: 1px solid var(--lavender);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 12px 0;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
}

.calendar-day {
  background: var(--bg-calendar);
  border-radius: 14px;
  border: 1px solid #f4e5ff;
  padding: 0.75rem 1rem 1rem;
}

.calendar-day+.calendar-day {
  margin-top: 1rem;
}



.calendar-hour-label-row {
  min-height: 56px;
  max-height: 56px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0 12px 0 0;
  font-size: 0.75rem;
  font-weight: 400;
  color: #70757a;
  position: relative;
}

.calendar-hour-label-row span {
  transform: translateY(-50%);
  display: inline-block;
  background: #fff;
  padding: 0 4px;
}

.calendar-timeline-row {
  height: 56px;
  border-bottom: 1px solid #9aa0a6 !important;
  box-sizing: border-box;
}

.calendar-day-header {
  margin-bottom: 0.5rem;
}

.calendar-day-header h3 {
  margin: 0;
  color: var(--primary);
  text-transform: capitalize;
}

.calendar-day-grid {
  display: grid;
  grid-template-columns: 72px 1fr;
  column-gap: 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #dadce0;
  margin-top: 10px;
  overflow: hidden;
}

.calendar-hours-column {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #dadce0;
  background: #fff;
  z-index: 5;
  position: relative;
}

.calendar-timeline-column {
  position: relative;
}

.calendar-timeline {
  position: relative;
  width: 100%;
}

.calendar-event-block {
  position: absolute;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  user-select: none;
  -webkit-user-select: none;
}

/* Universal WhatsApp Button Styling */
.btn-wa-direct-universal {
  color: #25D366;
  /* WhatsApp Green */
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-wa-direct-universal:hover {
  transform: scale(1.2);
  filter: brightness(1.1);
}

.btn-wa-direct-universal svg {
  fill: currentColor;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Specific adjustment for Agenda view as requested by user */
.wa-agenda {
  margin-bottom: 3px;
  /* Move it slightly higher */
}

.calendar-event-block:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  z-index: 100 !important;
  border-color: rgba(255, 255, 255, 0.6);
  /* Fallback reminder */
}

.calendar-event-main {
  flex: 1;
  min-width: 0;
}

.calendar-event-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.calendar-event-time {
  font-weight: 600;
  font-size: 0.75rem;
  opacity: 0.95;
}

.calendar-event-title {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event-sub {
  font-size: 0.75rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event-button {
  font-size: 0.75rem;
  padding: 1px 8px;
  margin-top: 0;
  align-self: flex-start;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.calendar-event-block.completed {
  background: #16a34a;
}

.dialog h3.owner-header {
  color: #2E8B57
}

.dialog h3.pet-header {
  color: #D97706
}

.dialog h3.session-header {
  color: #2563EB
}

.muted {
  color: var(--muted)
}

.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #ddd;
  color: #444;
  font-size: .85rem
}

/* Event Color Picker */
.calendar-color-picker {
  margin-top: 8px;
}

.color-swatches {
  display: flex;
  gap: 12px;
  align-items: center;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  padding: 0;
  outline: none;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  border-color: var(--text);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(0, 0, 0, 0.1);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 0.75rem;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--lavender);
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid var(--lavender);
  background: white;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  color: var(--text);
}

.pagination button:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: var(--primary-700);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination .page-info {
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination select {
  padding: 4px 8px;
  border: 1px solid var(--lavender);
  border-radius: 6px;
  background: white;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.dialog {
  display: none;
  /* Oculto por defecto */
  border: none;
  border-radius: 20px;
  max-width: 850px;
  width: 90%;
  padding: 0;
  box-shadow: var(--shadow-float);
  flex-direction: column;
  overflow: hidden;
  max-height: 92vh;
  margin: auto;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dialog.is-dragged {
  transition: none !important;
}


.dialog.maximized {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  top: 0 !important;
  left: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

.dialog[open] {
  display: flex;
  /* Solo visible cuando se abre */
}

.dialog::backdrop {
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(0.5px);
}

.dialog form {
  padding: 0;
  /* Quitamos padding aquí para manejarlo internamente */
  background: var(--card);
  border-radius: 0 0 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.dialog h3 {
  font-size: 1.4rem;
  margin-top: 0;
  color: var(--text);
  padding: 24px 24px 0 24px;
}

.dialog-side-right {
  position: fixed;
  top: 180px;
  right: 32px;
  left: auto;
  max-width: 420px;
  width: 420px;
  margin: 0;
  transform: none;
  max-height: calc(100vh - 210px);
  overflow: auto;
}

.dialog-side-right .dialog-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.dialog-side-right .calendar-color-picker {
  width: 100%;
  margin-right: 0 !important;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lavender);
}

body.calendar-sidebar-open #calendar-events-list {
  margin-right: 440px;
}

@media (max-width: 1200px) {
  body.calendar-sidebar-open #calendar-events-list {
    margin-right: 360px;
  }
}

@media (max-width: 992px) {
  body.calendar-sidebar-open #calendar-events-list {
    margin-right: 0;
  }

  .dialog-side-right {
    top: 130px;
    right: 16px;
    left: 16px;
    max-width: none;
    width: auto;
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px, 3vw, 24px);
  margin: 0;
  padding: clamp(16px, 4vw, 32px);
  overflow-y: auto;
  flex: 1;
  max-height: 85vh;
}

.form-grid label textarea {
  grid-column: span 2;
  min-height: 120px;
}

.dialog.maximized .form-grid {
  max-height: none;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
}

input,
select,
textarea {
  padding: 12px 14px;
  border: 1px solid var(--lavender);
  border-radius: 12px;
  background: var(--bg);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(142, 46, 139, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: #f3f4f6;
  color: #374151;
  opacity: 1;
  /* Override browser default opacity */
  border-color: #eee;
  cursor: default;
  font-weight: 500;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  background: var(--card);
  border-top: 1px solid var(--lavender);
  margin-top: auto;
}

.footer {
  padding: 30px;
  text-align: center;
  color: var(--muted)
}

.status-programada {
  background: #f0e7f7;
  border-color: #d1b6e8;
  color: #6b3a86
}

.status-completada {
  background: #e7f7ee;
  border-color: #c8e8d4;
  color: #1d7b43
}

.status-cancelada {
  background: #fde7ea;
  border-color: #f6c4cc;
  color: #8a1f2a
}

/* Data Tables Modernization */
.table-responsive {
  overflow-x: auto;
  border-radius: 16px;
  background: white;
  border: 1px solid var(--lavender);
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: normal;
  font-size: 0.95rem;
}

.data-table th {
  background: #F9FAFB;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--lavender);
  position: sticky;
  top: 0;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--lavender);
  color: var(--text);
  vertical-align: middle;
}

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

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

/* Reset global table styles that might conflict */
.data-table td {
  white-space: normal;
  vertical-align: top;
}

#pet-sessions-dialog .data-table td {
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  height: auto !important;
  padding: 8px !important;
}

#pet-sessions-dialog .data-table tr {
  height: auto !important;
}

#pet-sessions-dialog .data-table th:nth-child(4),
#pet-sessions-dialog .data-table td:nth-child(4) {
  width: 100px;
}

/* Tiempo */
#pet-sessions-dialog .data-table th:nth-child(5),
#pet-sessions-dialog .data-table td:nth-child(5) {
  width: 80px;
}

/* Precio */
#pet-sessions-dialog .data-table th:nth-child(6),
#pet-sessions-dialog .data-table td:nth-child(6) {
  width: 50px;
  text-align: center;
}

/* Pago */

/* Pet dialog layout adjustments */
#pet-dialog {
  max-width: 640px;
}

#pet-dialog .form-grid {
  grid-template-columns: repeat(2, 1fr);
}

#pet-dialog .row {
  display: initial;
}

#pet-dialog select[name="propietario_id"],
#pet-dialog select[name="especie"] {
  max-width: 280px;
  width: 100%;
  align-self: flex-start;
}

#session-pet-display,
#session-owner-display {
  display: block;
  margin-top: 4px;
  margin-left: 0 !important;
}

/* Extra separación entre Mascota y Propietario en diálogo de sesión */
#session-form .row:first-child label+label {
  margin-top: 10px;
}

/* Extra separación entre Propietario y Nombre de Mascota en diálogo de mascota */
#pet-form .row:first-child label+label {
  margin-top: 10px;
}

/* Extra separación entre nombre de propietario y Duración en Datos de Sesión */
#session-form .row:nth-child(2) label+label {
  margin-top: 10px;
}

/* Línea bajo títulos de formularios de datos */
#owner-dialog h3,
#pet-dialog h3,
#session-dialog h3,
#sale-dialog h3 {
  border-bottom: 2px solid #999;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

/* --- Prices Section Styles --- */
.price-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e7e0f1;
  transition: transform 0.2s, box-shadow 0.2s;
}

.price-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.price-category {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 6px;
}

.price-breeds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.breed-tag {
  background: var(--bg);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  border: 1px solid #e0e0e0;
}

.price-services {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-services li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed #eee;
  padding-bottom: 4px;
}

.price-services li:last-child {
  border-bottom: none;
}

.service-name {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.service-price {
  font-weight: 700;
  color: var(--primary-700);
  font-size: 1rem;
}

/* --- Window Management (Movable & Minimizable) --- */
/* Estilos adicionales para diálogos gestionados */
.dialog.is-dragged {
  margin: 0;
  position: fixed;
}

.dialog-header {
  background: var(--primary);
  color: white;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
}

.dialog-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
}

.dialog-controls {
  display: flex;
  gap: 8px;
}

.win-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.win-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}

.win-btn.close-btn:hover {
  background: #ff4d4d;
}

/* Persistent Footer for Dialogs */
.dialog-persistent-footer {
  background: white;
  border-top: 2px solid var(--lavender);
  padding: 12px 24px;
  display: flex !important;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
}

.dialog form {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dialog h3 {
  display: none !important;
}

/* Header Colors per type */
.header-pet {
  background-color: #d97706 !important;
}

.header-owner {
  background-color: #059669 !important;
}

.header-session {
  background-color: #0891b2 !important;
}

.header-sale {
  background-color: #4f46e5 !important;
}

.header-calendar {
  background-color: #8e2e8b !important;
}

/* Taskbar for Minimized Windows */
/* Taskbar v4.1 - Refinado y Elegante */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: #1e293b !important;
  /* Azul pizarra oscuro profesional */
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  display: none;
  align-items: center;
  padding: 0 15px;
  gap: 15px;
  z-index: 2147483647 !important;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.taskbar.show {
  display: flex !important;
}

.taskbar-label {
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.taskbar-items-container {
  display: flex !important;
  gap: 10px;
  align-items: center;
  flex: 1;
  height: 100%;
  overflow-x: auto;
  padding: 0 5px;
}

body.has-taskbar .calendar-event-block.completed {
  background: rgba(76, 175, 80, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  color: #fff !important;
  border-left: 5px solid #2e7d32 !important;
}

.calendar-event-block.partial {
  background: rgba(255, 193, 7, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  color: #000 !important;
  border-left: 5px solid #ff8f00 !important;
}

.calendar-event-block.partial .calendar-event-time,
.calendar-event-block.partial .calendar-event-title,
.calendar-event-block.partial .calendar-event-sub {
  color: #000 !important;
}

.calendar-event-block.partial .calendar-event-button {
  background: rgba(0, 0, 0, 0.1) !important;
  color: #000 !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}

body.has-taskbar .main-wrapper {
  padding-bottom: 50px;
}

.task-item {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  transition: all 0.2s;
  min-width: 130px;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-item:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-2px);
  border-color: var(--primary) !important;
}

.task-item .icon {
  font-size: 1rem;
}

/* Security & Password UX */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 40px !important;
  width: 100%;
}

.resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  /* Aumentado de 6px a 12px para mejor agarre */
  cursor: ns-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.2s;
}

.resize-handle:hover {
  background: rgba(255, 255, 255, 0.2);
}

.calendar-event-block.is-interacting .resize-handle:hover {
  background: transparent;
}

.resize-handle.top {
  top: -6px;
}

.resize-handle.bottom {
  bottom: -6px;
}

/* Feedback visual de horas en tiempo real */
.calendar-event-block.is-interacting .event-time-display {
  font-weight: 800;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 4px;
  border-radius: 4px;
  transform: scale(1.1);
  display: inline-block;
  transition: all 0.1s;
}

.password-toggle {
  position: absolute;
  right: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 1.2rem;
  opacity: 0.6;
  transition: opacity 0.2s;
  z-index: 5;
}

.password-toggle:hover {
  opacity: 1;
}

.btn-wa-direct {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: #25D366;
  color: white !important;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  padding: 0;
  text-decoration: none;
}

.btn-wa-direct:hover {
  background-color: #128C7E;
  transform: scale(1.1);
}

.btn-wa-direct svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

#access-dialog h3 {
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--primary);
}

.settings-group-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary);
  border-bottom: 2px solid var(--lavender);
  padding-bottom: 0.5rem;
}

/* --- Searchable Select Component (Buscador) --- */
.searchable-select-container {
  position: relative;
  width: 100%;
}

.searchable-select-input {
  width: 100%;
  padding: 12px 14px !important;
  border: 1px solid var(--lavender) !important;
  border-radius: 12px !important;
  background: var(--bg) !important;
  font-size: 0.95rem !important;
  font-family: inherit !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

.searchable-select-input:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(142, 46, 139, 0.1) !important;
}

.searchable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white !important;
  border: 1px solid var(--lavender) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-lg) !important;
  z-index: 2000 !important;
  max-height: 250px !important;
  overflow-y: auto !important;
  display: none;
  margin-top: 4px !important;
}

.searchable-select-dropdown.active {
  display: block !important;
}

.searchable-select-option {
  padding: 10px 14px !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
  font-size: 0.9rem !important;
  color: var(--text) !important;
}

.searchable-select-option:hover {
  background: var(--primary-light) !important;
  color: var(--primary-700) !important;
}

.searchable-select-option.selected {
  background: var(--primary-light) !important;
  font-weight: 700 !important;
  color: var(--primary) !important;
}

.searchable-select-empty {
  padding: 10px 14px !important;
  color: var(--muted) !important;
  font-style: italic !important;
  font-size: 0.9rem !important;
}