:root {
  --primary: #7a564b;
  --primary-hover: #69473c;
  --secondary: #55624d;
  --secondary-hover: #3e4a36;
  --tertiary: #625b6e;
  --surface: #fcf9f8;
  --surface-dim: #dcd9d9;
  --surface-container: #f0eded;
  --on-surface: #1b1c1c;
  --on-surface-variant: #504440;
  --outline: #827470;
  --error: #ba1a1a;
}

body {
  background-color: var(--surface);
  color: var(--on-surface);
}

.font-display {
  font-family: 'Lora', serif;
}

.font-body {
  font-family: 'Manrope', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Lora', serif;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: transparent;
  color: var(--on-surface);
  border: 1px solid var(--outline);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background-color: var(--surface-container);
  border-color: var(--on-surface-variant);
  color: var(--on-surface);
}

.input-bordered {
  border: 1px solid var(--surface-dim);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease;
}

.input-bordered:focus {
  border-color: var(--primary);
  outline: none;
}

.card {
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0px 4px 20px rgba(45, 45, 45, 0.04);
  padding: 1.5rem;
}

.card-hover:hover {
  box-shadow: 0px 12px 32px rgba(45, 45, 45, 0.08);
  transform: translateY(-2px);
}

.table th {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--on-surface-variant);
}

.badge-success {
  background-color: #d6e4c9;
  color: #596751;
}

.badge-error {
  background-color: #ffdad6;
  color: #93000a;
}

.stat-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 1rem;
}

.stat-card h3 {
  font-family: 'Manrope', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.9;
}

.stat-card .value {
  font-family: 'Lora', serif;
  font-size: 2rem;
  font-weight: 600;
}

.navbar {
  background-color: white;
  border-bottom: 1px solid var(--surface-dim);
}

.alert {
  border-radius: 0.5rem;
}

.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  animation: slideIn 0.3s ease;
}

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

.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.htmx-request .htmx-indicator {
  opacity: 1;
}

.htmx-request.htmx-indicator {
  opacity: 1;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background-color: white;
  border-right: 1px solid var(--surface-dim);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-header {
  padding: 2rem 1.5rem;
  border-bottom: 1px solid var(--surface-dim);
}

.sidebar-brand {
  font-family: 'Lora', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.sidebar-brand:hover {
  color: var(--primary-hover);
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  color: var(--on-surface-variant);
  font-family: 'Manrope', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.sidebar-link svg {
  flex-shrink: 0;
  stroke-width: 1.75;
}

.sidebar-link:hover {
  background-color: var(--surface-container);
  color: var(--on-surface);
}

.sidebar-link.active {
  background-color: var(--primary);
  color: white;
  box-shadow: 0px 4px 14px rgba(122, 86, 75, 0.28);
}

.sidebar-link.active:hover {
  background-color: var(--primary-hover);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--surface-dim);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.sidebar-user:hover {
  background-color: var(--surface-container);
}

.sidebar-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background-color: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--on-surface-variant);
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2.5rem;
  min-height: 100vh;
}

/* Authenticated pages use all available space beside the fixed sidebar. */
.main-content > main > .max-w-2xl,
.main-content > main > .max-w-4xl,
.main-content > main > .max-w-6xl,
.main-content > main > .max-w-7xl {
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}

.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 60;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 1px solid var(--surface-dim);
  background-color: white;
  color: var(--on-surface);
  cursor: pointer;
  box-shadow: 0px 4px 14px rgba(45, 45, 45, 0.06);
  transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
  background-color: var(--surface-container);
}

@media (max-width: 1023px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 1.5rem;
    padding-top: 4rem;
  }
}

.sale-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 1023px) {
  .sale-layout {
    grid-template-columns: 1fr;
  }
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.service-card {
  background-color: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0px 4px 20px rgba(45, 45, 45, 0.04);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.service-card:hover {
  box-shadow: 0px 12px 32px rgba(45, 45, 45, 0.08);
  transform: translateY(-2px);
}

.service-card-image {
  aspect-ratio: 4 / 3;
  background-color: var(--surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.service-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.service-card-placeholder {
  color: var(--outline);
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.service-card-title {
  font-family: 'Lora', serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.3;
}

.service-card-meta {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-card-price {
  font-family: 'Lora', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: auto;
  padding-top: 0.75rem;
}

.service-card-add {
  margin-top: 0.75rem;
  width: 100%;
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.service-card-add:hover {
  background-color: var(--primary-hover);
}

.sale-cart {
  position: sticky;
  top: 2rem;
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0px 4px 20px rgba(45, 45, 45, 0.04);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.sale-cart h2 {
  font-family: 'Lora', serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cart-empty {
  text-align: center;
  color: var(--on-surface-variant);
  font-size: 0.9375rem;
  padding: 1.5rem 0;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--surface-container);
  border-radius: 0.75rem;
}

.cart-item-image {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  background-color: var(--surface-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.8125rem;
  color: var(--on-surface-variant);
}

.cart-item-qty {
  width: 4rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--surface-dim);
  border-radius: 0.5rem;
  text-align: center;
  font-size: 0.9375rem;
}

.cart-item-remove {
  background: transparent;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease;
}

.cart-item-remove:hover {
  background-color: #ffdad6;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--surface-dim);
}

.cart-total-label {
  font-size: 0.9375rem;
  color: var(--on-surface-variant);
}

.cart-total-value {
  font-family: 'Lora', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary);
}

.client-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--surface-dim);
  padding-bottom: 0.25rem;
}

.client-tab {
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-surface-variant);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.client-tab:hover {
  color: var(--on-surface);
  background-color: var(--surface-container);
}

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

.client-panel {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.client-panel.active {
  display: flex;
}

.search-services {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface-dim);
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.search-services:focus {
  outline: none;
  border-color: var(--primary);
}

.catalog-eyebrow {
  color: var(--primary);
  font-family: 'Manrope', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.catalog-section {
  margin-bottom: 3.5rem;
}

.catalog-section-heading {
  align-items: end;
  border-bottom: 1px solid var(--surface-dim);
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.875rem;
}

.catalog-count,
.catalog-duration {
  border-radius: 9999px;
  font-family: 'Manrope', sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.catalog-count {
  color: var(--on-surface-variant);
  white-space: nowrap;
}

.service-catalog-card {
  background: white;
  border: 1px solid transparent;
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(45, 45, 45, 0.04);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.service-catalog-card:hover {
  border-color: #d4c3be;
  box-shadow: 0 12px 32px rgba(45, 45, 45, 0.08);
  transform: translateY(-2px);
}

.service-catalog-media {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #f6f3f2, #eae7e7);
  color: var(--primary);
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.service-catalog-media img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.catalog-duration {
  background: rgba(255, 255, 255, 0.94);
  bottom: 0.75rem;
  color: var(--on-surface);
  padding: 0.5rem 0.625rem;
  position: absolute;
  right: 0.75rem;
}

.service-catalog-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
}

.service-catalog-body h2 {
  color: var(--on-surface);
  font-family: 'Lora', serif;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
}

.service-catalog-body > p {
  color: var(--on-surface-variant);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.service-catalog-footer {
  align-items: center;
  border-top: 1px solid var(--surface-container);
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1rem;
}

.service-catalog-footer strong {
  color: var(--primary);
  font-family: 'Lora', serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.catalog-action {
  border-radius: 0.375rem;
  color: var(--on-surface-variant);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.375rem;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.catalog-action:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

.catalog-action-danger:hover {
  background: #ffdad6;
  color: var(--error);
}

.catalog-empty {
  background: white;
  border: 1px dashed var(--surface-dim);
  border-radius: 1rem;
  color: var(--on-surface-variant);
  padding: 1.5rem;
}

@media (max-width: 640px) {
  .catalog-section-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.5rem;
  }
}
