:root {
  --bg: #f7f5f2;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f766e;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(180deg, #faf9f7, #f3f2ef);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
}

main {
  flex: 1;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 70px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  margin-top: 1rem;
}

.site-footer-inner {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
}

.brand-logo {
  height: 56px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  gap: 1rem;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
}

.flash {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.flash.notice { border-color: #99f6e4; }
.flash.alert { border-color: #fecaca; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 600;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}

textarea { min-height: 110px; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.field { margin-bottom: 0.8rem; }

.devise-links {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
}

.devise-link {
  font-size: 0.95rem;
}

.auth-shell {
  max-width: 520px;
  margin: 1.5rem auto;
}

.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
  width: 100%;
  overflow: hidden;
}

.auth-logo {
  max-width: 100%;
  max-height: 120px;
  width: auto;
  height: auto;
  display: block;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.remember-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.remember-row label {
  margin: 0;
  font-weight: 500;
}

.mode-choice-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.mode-choice-row input[type="checkbox"],
.mode-choice-row input[type="radio"] {
  width: auto;
  margin: 0;
}

.appointment-header-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: #0d6962;
  --bs-btn-hover-border-color: #0d6962;
  --bs-btn-active-bg: #0b5953;
  --bs-btn-active-border-color: #0b5953;
}

.btn-outline-secondary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: #7ecfc8;
  --bs-btn-hover-bg: #e8f7f5;
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-hover-color: #0d6962;
  --bs-btn-active-bg: #d8f0ed;
  --bs-btn-active-border-color: #0d6962;
  --bs-btn-active-color: #0b5953;
}

.badge {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 0.8rem;
}

.appointment-status-badge {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.appointment-status-badge.status-scheduled {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.appointment-status-badge.status-completed {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.appointment-status-badge.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.appointment-status-badge.status-unlogged {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.appointment-journal-badge {
  margin-left: 0.35rem;
  border: 1px solid #7ecfc8;
  background: #e8f7f5;
  color: #0d6962;
  font-weight: 700;
}

.appointment-journal-badge:hover {
  text-decoration: none;
  background: #d8f0ed;
  color: #0b5953;
}

.appointment-journal-badge.is-disabled {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
}

.diagram-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.7rem;
}

.diagram-editor-layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 0.8rem;
  align-items: start;
}

.diagram-canvas {
  width: 100%;
  max-width: 680px;
  aspect-ratio: 5 / 3;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.diagram-side-btn.is-active {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
  font-weight: 700;
}

.mark-list {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.5rem;
}

.mark-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem;
  background: #fff;
}

.marker-compact-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 0.4rem;
}

.marker-color-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
}

.marker-color-dot.intensity-low {
  background: #facc15;
}

.marker-color-dot.intensity-mid {
  background: #fb923c;
}

.marker-color-dot.intensity-high {
  background: #ef4444;
}

.marker-note-inline {
  min-width: 0;
  padding: 0.38rem 0.5rem;
}

.marker-separator {
  color: var(--muted);
  font-weight: 700;
}

.marker-intensity-select {
  width: 4rem;
  padding: 0.32rem 0.35rem;
  font-size: 0.85rem;
}

.marker-compact-help {
  display: block;
  margin-top: 0.3rem;
}

.marker-display-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.4rem;
}

.marker-display-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  align-items: start;
}

.profile-avatar {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #d1d5db;
}

.profile-avatar-placeholder {
  width: 160px;
  height: 160px;
  border-radius: 12px;
  border: 1px dashed #94a3b8;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.profile-edit-shell {
  max-width: 1020px;
}

.profile-edit-header {
  max-width: 1020px;
}

.profile-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  gap: 1rem;
}

.profile-edit-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.85rem;
}

.profile-edit-panel h2 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.profile-edit-avatar-panel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile-edit-avatar-preview {
  display: flex;
  justify-content: center;
}

.profile-remove-avatar-row {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.profile-edit-actions {
  margin-top: 1rem;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.attachment-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem;
  background: #fff;
}

.attachment-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.intensity-scale {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.intensity-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 0.22rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.intensity-btn.intensity-low {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
}

.intensity-btn.intensity-mid {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.intensity-btn.intensity-high {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.intensity-btn.is-active {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
  font-weight: 700;
}

.intensity-description {
  display: block;
  margin-top: 0.3rem;
}

.intensity-pill {
  margin-top: 0.35rem;
}

.intensity-pill.intensity-low {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.intensity-pill.intensity-mid {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.intensity-pill.intensity-high {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 1rem;
  align-items: start;
}

.dashboard-calendar-card {
  min-height: 640px;
}

.dashboard-calendar-header,
.dashboard-side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.dashboard-side-header {
  padding-right: 0.75rem;
}

.dashboard-calendar-header {
  justify-content: center;
}

.dashboard-calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dashboard-calendar-nav h2 {
  margin: 0;
  min-width: 170px;
  text-align: center;
}

.dashboard-weekdays,
.dashboard-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

.dashboard-weekdays {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.dashboard-day {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 112px;
  padding: 0.4rem;
  background: #fff;
}

.dashboard-day.is-outside {
  opacity: 0.45;
}

.dashboard-day.is-today {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.dashboard-day.is-conflict {
  border-color: #ef4444;
}

.dashboard-day-number {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.dashboard-day-number-link {
  color: inherit;
  text-decoration: none;
}

.dashboard-day-number-link:hover {
  color: var(--brand);
  text-decoration: underline;
}

.dashboard-conflict-indicator {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 2px #fee2e2;
  margin-bottom: 0.25rem;
}

.dashboard-conflict-text {
  display: block;
  color: #b91c1c;
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}

.dashboard-day-events {
  display: grid;
  gap: 0.25rem;
}

.dashboard-event {
  display: block;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 6px;
  padding: 0.15rem 0.25rem;
  font-size: 0.78rem;
  color: #1e3a8a;
}

.dashboard-event-trigger {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dashboard-event span {
  display: block;
}

.dashboard-event-appointment {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.dashboard-event.status-scheduled {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.dashboard-event.status-completed {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e40af;
}

.dashboard-event.status-unlogged {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.dashboard-event-vaccination {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.dashboard-event-vaccinate-reminder {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.dashboard-event-vet-visit {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
}

.dashboard-event-deworming {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.dashboard-event-foaling {
  border-color: #e9d5ff;
  background: #faf5ff;
  color: #6b21a8;
}

.dashboard-event-other {
  border-color: #d1d5db;
  background: #f9fafb;
  color: #374151;
}

.dashboard-event-competition {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.calendar-category-badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.72rem;
  line-height: 1.2;
}

.dashboard-vaccinate-latest {
  display: block;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.08rem 0.3rem;
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.dashboard-day-popup {
  position: absolute;
  left: 0.4rem;
  top: calc(100% + 0.25rem);
  width: 360px;
  max-height: 320px;
  overflow: auto;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
  z-index: 15;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

/* For lower calendar rows, open popup upwards so it stays visible */
.dashboard-calendar-grid .dashboard-day:nth-last-child(-n+14) .dashboard-day-popup {
  top: auto;
  bottom: calc(100% + 0.25rem);
}

.dashboard-day.is-open .dashboard-day-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dashboard-day-popup-item {
  margin-top: 0.45rem;
  font-size: 0.82rem;
}

.dashboard-day-popup-item a {
  color: var(--ink);
}

.dashboard-day-popup-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  text-decoration: none;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
  transition: background-color 0.12s ease;
}

.dashboard-day-popup-link:hover {
  text-decoration: none;
  background: #f1f5f9;
}

.dashboard-day-popup-link.status-scheduled {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.dashboard-day-popup-link.status-completed {
  background: #eff6ff;
  border: 1px solid #93c5fd;
}

.dashboard-day-popup-link.status-unlogged {
  background: #fffbeb;
  border: 1px solid #fcd34d;
}

.dashboard-day-popup-time {
  min-width: 38px;
  color: #334155;
  font-weight: 600;
}

.dashboard-day-popup-link .badge {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.dashboard-competition-horses {
  display: block;
  margin-top: 0.15rem;
}

.dashboard-competition-horse-list {
  display: block;
  margin-top: 0.1rem;
}

.dashboard-competition-horse-list span {
  display: block;
}

.dashboard-competition-no-horses {
  display: block;
  margin-top: 0.18rem;
}

.dashboard-tabs {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
  margin-right: 1rem;
}

.dashboard-tabs .btn.is-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.dashboard-side-list {
  max-height: 640px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-side-body {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-right: 0.35rem;
}

.dashboard-treatment-row {
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
}

.dashboard-schedule-row {
  display: grid;
  gap: 0.12rem;
  transition: background-color 0.12s ease;
}

.dashboard-schedule-row:hover {
  background: #ecfdf5;
}

.dashboard-schedule-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dashboard-schedule-customer {
  display: block;
}

.dashboard-schedule-horses {
  display: block;
}

.dashboard-treatment-row.is-conflict-light {
  background: #fee2e2;
  border: 1px solid #fecaca;
}

.dashboard-conflict-inline {
  margin-left: 0.35rem;
  color: #b91c1c;
  font-weight: 600;
}

.customer-picker-list {
  display: grid;
  gap: 0.55rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.customer-picker-card {
  text-align: left;
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}

.customer-picker-card:hover {
  border-color: #7ecfc8;
  background: #f8fcfb;
}

.customer-picker-card.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px #ccfbf1;
  background: #f0fdfa;
}

.customer-picker-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

.customers-search-row {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1.6fr auto;
  align-items: end;
}

.customers-search-actions {
  justify-content: flex-end;
}

.customers-index-header {
  margin-bottom: 0.8rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: baseline;
}

.customers-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0.9rem;
}

.customers-letter-group + .customers-letter-group {
  margin-top: 0.4rem;
}

.customers-letter-heading {
  margin: 0.2rem 0 0.55rem;
  font-size: 1.05rem;
  color: #334155;
}

.customers-pagination {
  margin-top: 0.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.customers-pagination-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.customers-pagination-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  flex-wrap: wrap;
}

.customers-page-link {
  min-width: 2.1rem;
  height: 2.1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.55rem;
  font-size: 0.88rem;
  text-decoration: none;
  background: #fff;
  color: #334155;
}

.customers-page-link:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  text-decoration: none;
}

.customers-page-link.is-current {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
  font-weight: 700;
}

.customers-page-link.is-disabled {
  opacity: 0.45;
  background: #f8fafc;
  color: #94a3b8;
  pointer-events: none;
}

.customers-page-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  color: #64748b;
}

.customer-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: #fff;
}

.customer-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.customer-card-top h3 {
  margin: 0;
  font-size: 1rem;
}

.customer-card-top .badge {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  border: 1px solid #0d6962;
  letter-spacing: 0.01em;
}

.customer-card-contact {
  margin: 0.2rem 0;
}

.customer-card-next {
  margin: 0.6rem 0 0.7rem;
}

.customer-card-next p {
  margin: 0.2rem 0 0;
}

.my-horse-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.my-horse-card-top h3 {
  margin: 0;
  font-size: 1rem;
}

.my-horse-card-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.my-horse-card-badges .badge {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  border: 1px solid #0d6962;
  letter-spacing: 0.01em;
}

.my-horse-stat-badge {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  border: 1px solid #0d6962;
  letter-spacing: 0.01em;
}

.my-horse-vaccine-badge {
  background: #e0f2fe !important;
  color: #075985 !important;
  border-color: #7dd3fc !important;
}

.my-horse-vaccine-badge.is-warning {
  background: #fef9c3 !important;
  color: #854d0e !important;
  border-color: #fde68a !important;
}

.my-horse-vaccine-badge.is-invalid {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #fca5a5 !important;
}

.tr-status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tr-badge-start {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-color: #86efac !important;
}

.tr-badge-earliest {
  background: #fef9c3 !important;
  color: #854d0e !important;
  border-color: #fde68a !important;
}

.tr-badge-latest {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #fca5a5 !important;
}

.btn-check:checked + .farrier-material-option {
  background: #0f766e !important;
  border-color: #0f766e !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 2px #99f6e4;
}

.farrier-material-option.is-selected {
  background: #0f766e !important;
  border-color: #0f766e !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 2px #99f6e4;
}

.farrier-material-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.farrier-material-item {
  margin: 0;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.farrier-material-item .form-check-input {
  margin: 0;
}

.farrier-material-item .form-check-label {
  margin: 0;
  white-space: nowrap;
  font-weight: 600;
}

.my-horse-card-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: start;
  margin-bottom: 0.65rem;
}

.my-horse-card-photo {
  width: 110px;
  height: 110px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  object-fit: cover;
}

.my-horse-card-photo-placeholder {
  width: 110px;
  height: 110px;
  border-radius: 10px;
  border: 1px dashed #94a3b8;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  font-size: 0.82rem;
}

.appointment-form-shell {
  max-width: 920px;
}

.appointment-page {
  max-width: 980px;
  margin: 0 auto;
}

.appointment-subtitle {
  margin-top: -0.45rem;
  margin-bottom: 0.75rem;
}

.appointment-datetime-input {
  font-size: 1rem;
  padding: 0.7rem 0.8rem;
}

.quick-time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.quick-time-btn {
  min-width: 58px;
}

.appointment-form-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.85rem;
}

.appointment-form-section + .appointment-form-section {
  margin-top: 0.85rem;
}

.appointment-form-section h2 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
}

.appointment-form-actions {
  flex-direction: column;
  align-items: center;
  margin-top: 0.95rem;
  gap: 0.55rem;
}

.horse-pick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.horse-pick-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.horse-pick-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
}

.horse-pick-checkbox {
  width: 1rem;
  height: 1rem;
}

.horse-summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 1rem;
  align-items: start;
}

.horse-profile-photo-wrap {
  display: flex;
  justify-content: flex-end;
}

.horse-profile-photo {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  object-fit: cover;
}

.horse-profile-photo-placeholder {
  width: 220px;
  height: 220px;
  border-radius: 12px;
  border: 1px dashed #94a3b8;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.horse-profile-thumb {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  object-fit: cover;
}

.horse-focus-picker {
  margin-top: 0.55rem;
  position: relative;
  width: min(420px, 100%);
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}

.horse-focus-picker.is-empty {
  min-height: 150px;
}

.horse-focus-picker-image {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #fff;
}

.horse-focus-picker-image.is-hidden {
  display: none;
}

.horse-focus-picker-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.horse-focus-picker-frame {
  position: absolute;
  border: 2px solid rgba(15, 118, 110, 0.9);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  background: rgba(15, 118, 110, 0.06);
  pointer-events: none;
}

.horse-focus-picker-hint {
  margin: 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  color: #475569;
  background: rgba(248, 250, 252, 0.94);
}

.horse-show-page {
  max-width: 1100px;
}

.horse-show-header {
  margin-bottom: 0.8rem;
}

.horse-health-bar {
  padding: 0.75rem 1rem;
}

.horse-health-bar .tr-status-badges {
  margin: 0;
}

.horse-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
}

.horse-top-grid--single {
  grid-template-columns: 1fr;
}

.horse-summary-card--enhanced {
  gap: 1.2rem;
}

.horse-facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem 1rem;
}

.horse-fact {
  margin: 0.1rem 0;
}

.horse-fact span {
  color: var(--ink);
}

.horse-notes-block {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.horse-notes-block .muted p {
  margin: 0.2rem 0 0;
}

.horse-gallery-card h2 {
  margin-top: 0;
}

.horse-gallery-item img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.horse-gallery-item .btn {
  margin-top: 0.45rem;
}

.horse-section-card h2 {
  margin-top: 0;
}

.horse-row-item {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.45rem 0.1rem;
  border-bottom: 1px solid #eef2f7;
}

.horse-row-item:last-child {
  border-bottom: 0;
}

.horse-row-item--hoverable {
  border-radius: 10px;
  transition: background-color 0.15s ease;
}

.horse-row-item--hoverable:hover {
  background: #f8fafc;
}

.horse-row-item span {
  min-width: 0;
}

.horse-section-header {
  margin-bottom: 0.55rem;
}

.horse-history-title {
  margin-bottom: 0.25rem;
}

.horse-history-actions {
  margin-bottom: 0.8rem;
}

.horse-history-list-card {
  padding-top: 0.9rem;
}

.horse-history-filter-card {
  margin-bottom: 0.8rem;
}

.horse-history-filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 0.75rem 0.9rem;
}

.horse-history-filter-field label {
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
  color: #475569;
}

.horse-history-filter-field select {
  min-width: 210px;
  width: 100%;
}

.horse-history-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 !important;
  padding: 0;
  white-space: nowrap;
}

.horse-history-filter-checkbox span {
  font-size: 0.9rem;
  color: #1f2937;
}

.horse-history-filter-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
  margin: 0;
}

.horse-history-list {
  display: grid;
  gap: 0.6rem;
}

.horse-history-row {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 0.7rem 0.8rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.horse-history-row-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.horse-history-row-summary {
  margin: 0.4rem 0 0.35rem;
  color: #334155;
}

.horse-history-row-attachments {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.horse-history-row-actions .btn {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .horse-history-filter-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .horse-history-filter-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }
}

.horse-attachment-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.4rem 0 0.65rem;
}

.horse-attachment-badge-btn,
.horse-attachment-badge {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.8rem;
  line-height: 1.3;
  display: inline-block;
}

.horse-attachment-badge-btn:hover {
  background: #e2e8f0;
}

.customer-show-page {
  max-width: 1100px;
}

.customer-show-header {
  margin-bottom: 0.8rem;
}

.customer-show-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1rem;
}

.customer-show-main-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.customer-show-card h2 {
  margin-top: 0;
}

.customer-show-facts p {
  margin: 0.2rem 0;
}

.customer-show-notes {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.customer-show-stats {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.customer-show-stats .badge {
  background: var(--brand);
  color: #fff;
  border: 1px solid #0d6962;
}

.customer-show-stats-actions {
  margin-top: 0.65rem;
}

.customer-row-item {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0.1rem;
  border-bottom: 1px solid #eef2f7;
}

.customer-row-item:last-child {
  border-bottom: 0;
}

.customer-highlight-row {
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.customer-highlight-row:hover {
  background: #ecfdf5;
}

.customer-row-item .appointment-status-badge {
  justify-self: start;
}

.customer-row-item--appointments {
  grid-template-columns: 170px minmax(0, 1fr) auto;
}

.customer-row-meta {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.customer-row-status {
  display: inline-flex;
  justify-content: flex-start;
}

.customer-horse-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.customer-horse-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.78rem;
  line-height: 1.3;
}

.customer-row-action {
  justify-self: end;
}

.customer-upcoming-row {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin: 0;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.customer-upcoming-row:hover {
  background: #ecfdf5;
}

.customer-upcoming-row .appointment-status-badge {
  flex: 0 0 auto;
}

.customer-upcoming-horses {
  min-width: 0;
}

.customer-upcoming-action {
  margin-left: auto;
  white-space: nowrap;
}

.customer-form-shell {
  max-width: 980px;
}

.customer-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1rem;
}

.customer-form-section {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.85rem;
}

.customer-form-section h2 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.owner-kind-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.owner-kind-badge {
  display: inline-flex;
  align-items: center;
}

.owner-kind-badge-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.owner-kind-badge span {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.owner-kind-badge-input:checked + span {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.owner-kind-badge-input:focus-visible + span {
  outline: 2px solid #2dd4bf;
  outline-offset: 2px;
}

.customer-form-shell .actions {
  justify-content: center;
}

.horse-blup-results {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.horse-blup-result {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
}

.horse-blup-result strong {
  display: block;
}

.horse-blup-result small {
  display: block;
  margin-top: 0.1rem;
}

.horse-blup-debug {
  margin-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.6rem;
}

.horse-blup-debug h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.horse-blup-debug table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.horse-blup-debug th,
.horse-blup-debug td {
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  padding: 0.35rem 0.3rem;
  vertical-align: top;
}

.horse-form-shell {
  max-width: 980px;
}

.horse-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr);
  gap: 1.1rem;
  margin-bottom: 0.9rem;
}

.horse-form-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}

.horse-form-section h3 {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
}

.horse-subsection-title {
  margin-top: 0.9rem !important;
  padding-top: 0.7rem;
  border-top: 1px solid #edf2f7;
}

.horse-form-section-hint {
  margin: -0.2rem 0 0.75rem;
}

.form-error {
  display: block;
  margin-top: 0.3rem;
  color: #b91c1c;
  font-weight: 600;
}

.attachment-folder {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.8rem;
  background: #f8fafc;
}

.attachment-folder h3 {
  margin: 0 0 0.6rem;
  font-size: 0.98rem;
}

.attachment-folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.attachment-folder-header h3 {
  margin: 0;
}

.attachment-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.attachment-lightbox-panel {
  width: min(980px, 100%);
  max-height: 92vh;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 0.85rem;
  display: grid;
  gap: 0.7rem;
}

.attachment-lightbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.attachment-lightbox-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.attachment-lightbox-body img {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.attachment-lightbox-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.horse-customer-choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.horse-customer-choice {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  background: #f8fafc;
}

.horse-customer-choice input[type="radio"] {
  width: 1rem;
}

.horse-customer-active-user {
  margin: 0 0 0.65rem;
}

.horse-form-sidebar {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.horse-form-optional {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  margin: 0.9rem 0;
  padding: 0.85rem 1rem;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}

.horse-form-optional summary {
  cursor: pointer;
  font-weight: 600;
}

.horse-form-optional-body {
  margin-top: 0.8rem;
}

.horse-form-actions {
  flex-direction: column;
  align-items: center;
}

.horse-form-actions--split {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.horse-form-actions-left,
.horse-form-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.horse-form-actions-right {
  justify-content: flex-end;
}

.horse-form-save-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.88rem;
}

small, .muted { color: var(--muted); }

.competition-planning-table tbody tr:hover td {
  background-color: #eef9f1;
}

.competition-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.competition-status-badge.status-open {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.competition-status-badge.status-closed {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.competition-status-badge.status-approved {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.competition-status-badge.status-cancelled {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.competition-status-badge.status-default {
  background: #e5e7eb;
  color: #374151;
  border-color: #d1d5db;
}

.competition-add-form {
  margin: 0;
}

.competition-add-badge {
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.18rem 0.58rem;
  line-height: 1.2;
}

.competition-add-badge.is-added {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.competition-planning-planned-link {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.competition-planning-planned-link:hover,
.competition-planning-planned-link:focus-visible {
  border-color: #4ade80;
  background: #bbf7d0;
  color: #14532d;
}

.competition-planning-quicklink-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.competition-planning-quicklink {
  color: #166534;
  font-weight: 700;
  text-decoration: none;
}

.competition-planning-quicklink:hover,
.competition-planning-quicklink:focus-visible {
  color: #14532d;
  text-decoration: underline;
}

.competition-remove-planned-btn {
  border: 1px solid #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.competition-remove-planned-btn:hover,
.competition-remove-planned-btn:focus-visible {
  border-color: #f87171;
  background: #fecaca;
  color: #7f1d1d;
}

.competition-horse-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.competition-horse-more {
  position: relative;
  cursor: pointer;
}

.competition-horse-hover-popup {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  min-width: 220px;
  max-width: min(300px, calc(100vw - 3rem));
  overflow: visible;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 25;
}

.competition-horse-hover-popup span {
  display: block;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.competition-horse-hover-popup span:last-child {
  margin-bottom: 0;
}

.competition-horse-more:hover .competition-horse-hover-popup {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.competition-classes-table {
  table-layout: fixed;
}

.planned-week-heading {
  margin: 1rem 0 0.55rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line);
}

.planned-competition-list {
  display: grid;
  gap: 0.6rem;
}

.planned-competition-card {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.7rem 0.8rem;
  align-items: start;
}

.planned-competition-main {
  display: grid;
  gap: 0.35rem;
}

.planned-competition-title {
  margin: 0;
  font-size: 1.12rem;
}

.planned-competition-title a {
  color: #0f766e;
  font-weight: 600;
  text-decoration: none;
}

.planned-competition-title a:hover,
.planned-competition-title a:focus-visible {
  color: #0b5f59;
  text-decoration: underline;
}

.planned-competition-horses {
  min-width: 0;
}

.planned-competition-discipline-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: #1e3a8a;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.planned-classes-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.planned-classes-heading-main {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.planned-classes-heading-main span {
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
}

.planned-remove-competition-btn {
  border: 1px solid #fca5a5;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  line-height: 1.2;
}

.planned-remove-competition-btn:hover,
.planned-remove-competition-btn:focus-visible {
  border-color: #f87171;
  background: #fecaca;
  color: #7f1d1d;
}

.planned-remove-competition-confirm-btn {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

.planned-remove-competition-confirm-btn:hover,
.planned-remove-competition-confirm-btn:focus-visible {
  border-color: #b91c1c;
  background: #b91c1c;
  color: #fff;
}

.planned-class-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.3rem;
  margin-bottom: 0.4rem;
}

.planned-class-group:last-child {
  margin-bottom: 0;
}

.planned-class-date-heading {
  margin: 0.65rem 0 0.35rem;
  font-size: 0.94rem;
  color: #334155;
}

.planned-class-label {
  display: block;
  color: #0f172a;
}

.planned-class-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0.2rem 0.3rem;
  text-align: left;
  cursor: pointer;
}

.planned-class-trigger:hover,
.planned-class-trigger:focus-visible {
  background: #e2e8f0;
}

.planned-class-count {
  color: #334155;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: right;
  white-space: normal;
}

.planned-class-horse-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.planned-class-horse-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.planned-class-horse-list li:last-child {
  border-bottom: 0;
}

.planned-class-remove-link {
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.planned-class-remove-link:hover,
.planned-class-remove-link:focus-visible {
  color: #991b1b;
  text-decoration: underline;
}

@media (max-width: 880px) {
  .planned-competition-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .topbar-inner {
    flex-wrap: wrap;
    align-items: flex-start;
    min-height: auto;
    padding: 0.65rem 0;
  }

  .nav-links {
    flex-wrap: wrap;
    gap: 0.45rem 0.8rem;
    min-width: 0;
  }

  .topbar-inner form {
    margin-left: auto;
  }

  .dashboard-calendar-nav h2 {
    min-width: 0;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-calendar-card,
  .dashboard-side-list {
    min-height: auto;
    max-height: none;
  }

  .customers-search-row {
    grid-template-columns: 1fr;
  }

  .customers-search-actions {
    justify-content: flex-start;
  }

  .customers-grid {
    grid-template-columns: 1fr;
  }

  .customers-pagination {
    align-items: flex-start;
  }

  .horse-pick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .horse-form-actions--split {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0.6rem;
  }

  .horse-form-actions-left,
  .horse-form-actions-right {
    justify-content: center;
  }

  .my-horse-card-body {
    grid-template-columns: 1fr;
  }

  .diagram-editor-layout {
    grid-template-columns: 1fr;
  }

  .attachment-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    grid-template-columns: 1fr;
  }

  .profile-edit-layout {
    grid-template-columns: 1fr;
  }

  .horse-summary-card {
    grid-template-columns: 1fr;
  }

  .horse-profile-photo-wrap {
    justify-content: flex-start;
  }

  .horse-top-grid {
    grid-template-columns: 1fr;
  }

  .customer-show-top-grid,
  .customer-show-main-grid {
    grid-template-columns: 1fr;
  }

  .customer-form-layout {
    grid-template-columns: 1fr;
  }

  .horse-facts-grid {
    grid-template-columns: 1fr;
  }

  .horse-row-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .customer-row-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .horse-form-layout {
    grid-template-columns: 1fr;
  }

  .horse-customer-choice-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    gap: 0.6rem;
  }

  .brand {
    font-size: 1.1rem;
  }

  .brand-logo {
    height: 44px;
  }

  .nav-links {
    width: 100%;
    order: 3;
  }

  .topbar-inner form {
    order: 2;
    margin-left: 0;
  }

  .dashboard-calendar-nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .dashboard-calendar-nav h2 {
    width: 100%;
    text-align: center;
  }

  .dashboard-weekdays,
  .dashboard-calendar-grid {
    gap: 0.25rem;
  }

  .dashboard-day {
    min-height: 88px;
    padding: 0.25rem;
  }

  .dashboard-day-number {
    margin-bottom: 0.2rem;
    font-size: 0.82rem;
  }

  .dashboard-event {
    min-height: 8px;
    padding: 0;
    font-size: 0;
    line-height: 0;
    border-radius: 999px;
  }

  .dashboard-event span {
    display: none;
  }

  .dashboard-day-popup {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    top: auto;
    bottom: 0.75rem;
    max-height: 52vh;
    z-index: 60;
  }

  .dashboard-calendar-grid .dashboard-day:nth-last-child(-n+14) .dashboard-day-popup {
    top: auto;
    bottom: 0.75rem;
  }

  .horse-pick-grid {
    grid-template-columns: 1fr;
  }

  .competition-classes-table thead {
    display: none;
  }

  .competition-classes-table,
  .competition-classes-table tbody,
  .competition-classes-table tr,
  .competition-classes-table td {
    display: block;
    width: 100%;
  }

  .competition-classes-table tr {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.45rem;
    background: #fff;
  }

  .competition-classes-table td {
    border: 0;
    padding: 0.2rem 0;
  }

  .competition-classes-table td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: #334155;
  }

  .competition-horse-more {
    display: inline-flex;
  }
}
