: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;
}

.topbar-menu {
  display: contents;
}

.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-weight: 600;
}

.mobile-nav-toggle-icon {
  width: 18px;
  height: 12px;
  display: inline-block;
  position: relative;
}

.mobile-nav-toggle-icon::before,
.mobile-nav-toggle-icon::after,
.mobile-nav-toggle-icon {
  border-top: 2px solid currentColor;
}

.mobile-nav-toggle-icon::before,
.mobile-nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
}

.mobile-nav-toggle-icon::before {
  top: 4px;
}

.mobile-nav-toggle-icon::after {
  top: 10px;
}

.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;
}

.page-header h1,
.page-header h2,
.card h2,
.card h3 {
  overflow-wrap: anywhere;
}

.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%;
  box-sizing: border-box;
  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;
}

.appointment-status-scale {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.appointment-status-option {
  position: relative;
}

.appointment-status-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.appointment-status-choice {
  display: inline-block;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.appointment-status-choice.status-scheduled {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

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

.appointment-status-choice.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.appointment-status-option:hover .appointment-status-choice {
  filter: brightness(0.98);
}

.appointment-status-radio:checked + .appointment-status-choice {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.28);
  border-width: 2px;
  border-color: #0f766e;
  font-weight: 700;
  transform: translateY(-1px);
}

.training-intensity-scale {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.training-session-form {
  display: grid;
  gap: 1rem;
}

.training-session-section {
  display: grid;
  gap: 0.45rem;
}

.training-category-scale {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.training-category-option {
  position: relative;
}

.training-category-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.training-category-choice {
  display: inline-block;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
  opacity: 0.8;
}

.training-category-option:hover .training-category-choice {
  opacity: 0.95;
}

.training-category-radio:checked + .training-category-choice {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
  border-width: 2px;
  border-color: #0f766e;
  opacity: 1;
  transform: translateY(-1px);
}

.training-category-radio:focus-visible + .training-category-choice {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.training-duration-scale {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.training-duration-option {
  position: relative;
}

.training-duration-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.training-duration-choice {
  display: inline-block;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: #334155;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.training-duration-option:hover .training-duration-choice {
  background: #f8fafc;
}

.training-duration-radio:checked + .training-duration-choice {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
  border-width: 2px;
  border-color: #0f766e;
  background: #ecfdf5;
  color: #0f766e;
  transform: translateY(-1px);
}

.training-duration-radio:focus-visible + .training-duration-choice {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.training-focus-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.25rem 0 0.55rem;
}

.training-focus-preset-badge {
  margin-right: 0;
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
  opacity: 0.72;
}

.training-focus-preset-badge:hover {
  opacity: 0.9;
}

.training-focus-preset-badge.is-active {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
  transform: translateY(-1px);
  opacity: 1;
}

.training-focus-preset-badge:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.training-intensity-option {
  position: relative;
}

.training-intensity-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.training-intensity-choice {
  display: inline-block;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.training-intensity-choice.intensity-1 {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

.training-intensity-choice.intensity-2 {
  background: #f0fdf4;
  border-color: #4ade80;
  color: #15803d;
}

.training-intensity-choice.intensity-3 {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #b45309;
}

.training-intensity-choice.intensity-4 {
  background: #fff7ed;
  border-color: #fb923c;
  color: #c2410c;
}

.training-intensity-choice.intensity-5 {
  background: #fef2f2;
  border-color: #f87171;
  color: #b91c1c;
}

.training-intensity-option:hover .training-intensity-choice {
  filter: brightness(0.98);
}

.training-intensity-radio:checked + .training-intensity-choice {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
  border-width: 2px;
  border-color: #0f766e;
  transform: translateY(-1px);
}

.training-intensity-radio:focus-visible + .training-intensity-choice {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.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-scale {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.diagram-side-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.diagram-side-btn:hover {
  background: #f1f5f9;
}

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

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

.diagram-tool-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.diagram-tool-btn:hover {
  background: #f1f5f9;
}

.diagram-tool-btn.is-active {
  border-color: #0f766e;
  background: #e6fffa;
  color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.diagram-layer-scale {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.diagram-layer-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.diagram-layer-btn:hover {
  background: #f1f5f9;
}

.diagram-layer-btn.is-active {
  border-color: #0f766e;
  background: #e6fffa;
  color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.diagram-resize-handle {
  stroke: #ffffff;
  stroke-width: 2px;
}

.treatment-modality-scale {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.treatment-modality-option {
  position: relative;
}

.treatment-modality-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.treatment-modality-btn {
  display: inline-block;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.treatment-modality-option:hover .treatment-modality-btn {
  background: #f1f5f9;
}

.treatment-modality-radio:checked + .treatment-modality-btn {
  border-color: #0f766e;
  background: #e6fffa;
  color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.treatment-summary-fields label {
  margin-top: 0.9rem;
}

.treatment-summary-fields label:first-child {
  margin-top: 0;
}

.treatment-summary-fields textarea {
  margin-top: 0.35rem;
}

.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-role-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-role-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.profile-role-badge {
  border: 1px solid transparent;
  font-weight: 700;
}

.profile-role-badge-horse-owner {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.profile-role-badge-trainer {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.profile-role-badge-equine-therapist {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #b45309;
}

.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;
  flex-wrap: wrap;
  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;
  white-space: normal;
  overflow-wrap: anywhere;
  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;
}

.grid.three .diagram-intensity-row {
  grid-column: 1 / -1;
}

.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-side-header h2 {
  overflow-wrap: normal;
  word-break: normal;
}

.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-view-controls {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.dashboard-view-toggle {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dashboard-view-toggle .btn.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.dashboard-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}

.dashboard-filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dashboard-filter-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dashboard-filter-badge {
  display: inline-flex;
}

.dashboard-filter-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dashboard-filter-badge .calendar-category-badge {
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-filter-input:checked + .calendar-category-badge {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.18);
}

.dashboard-filter-input:focus-visible + .calendar-category-badge {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.dashboard-filter-actions {
  justify-content: flex-end;
  margin: 0;
  gap: 0.5rem;
}

.dashboard-filter-actions .btn {
  width: 140px;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: 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;
  min-width: 0;
  overflow: visible;
}

.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;
  min-width: 0;
}

.dashboard-event {
  display: block;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 6px;
  padding: 0.15rem 0.25rem;
  font-size: 0.78rem;
  color: #1e3a8a;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

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

.dashboard-event span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

.calendar-category-badge.status-scheduled {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

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

.calendar-category-badge.status-completed {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1e40af;
}

.dashboard-event.status-cancelled {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.calendar-category-badge.status-cancelled {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

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

.calendar-category-badge.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-dental-check {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.dashboard-event-farrier {
  border-color: #fdba74;
  background: #fff7ed;
  color: #c2410c;
}

.dashboard-event-equitherapist {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.dashboard-event-saddle-check {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

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

.dashboard-event-training {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #6d28d9;
}

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

@media (max-width: 900px) and (orientation: landscape) {
  html,
  body,
  main {
    overflow-x: hidden;
  }

  .dashboard-day-popup {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    top: auto;
    bottom: 0.75rem;
    max-height: 52vh;
    z-index: 60;
    transform: translateY(4px);
  }

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

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

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

  .dashboard-day {
    min-height: 76px;
    padding: 0.22rem;
  }

  .dashboard-day-number {
    margin-bottom: 0.15rem;
    font-size: 0.8rem;
  }

  .dashboard-event {
    padding: 0.08rem 0.2rem;
    font-size: 0.66rem;
    line-height: 1.15;
  }
}

.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: 50%;
  top: calc(100% + 0.25rem);
  width: min(360px, calc(100vw - 1.5rem));
  max-width: calc(100vw - 1.5rem);
  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: translateX(-50%) 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: translateX(-50%) 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: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.35rem;
  row-gap: 0.2rem;
  align-items: start;
  color: var(--ink);
  text-decoration: none;
  padding: 0.2rem 0.3rem;
  border-radius: 6px;
  transition: background-color 0.12s ease;
}

.dashboard-day-popup-badge {
  grid-column: 1;
  grid-row: 1;
}

.dashboard-day-popup-title {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-day-popup-subtitle {
  grid-column: 2;
  grid-row: 2;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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-cancelled {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.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-week-list {
  display: grid;
  gap: 0.9rem;
}

.dashboard-week-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 0.9rem;
}

.dashboard-week-card.is-current-week {
  border-color: #99f6e4;
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.12);
}

.dashboard-week-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.dashboard-week-card-header h3 {
  margin: 0;
}

.dashboard-week-card.is-collapsible .dashboard-week-card-header {
  cursor: pointer;
  list-style: none;
}

.dashboard-week-card.is-collapsible .dashboard-week-card-header::-webkit-details-marker {
  display: none;
}

.dashboard-week-card.is-collapsible .dashboard-week-card-header::after {
  content: "Visa";
  margin-left: auto;
  font-size: 0.82rem;
  color: #0f766e;
  font-weight: 600;
}

.dashboard-week-card.is-collapsible[open] .dashboard-week-card-header::after {
  content: "Dölj";
}

.dashboard-week-card-body {
  display: grid;
  gap: 0.6rem;
}

.dashboard-week-day-group {
  display: grid;
  gap: 0.5rem;
}

.dashboard-week-day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.15rem 0.1rem;
  border-bottom: 1px solid #e2e8f0;
}

.dashboard-week-day-header strong {
  margin: 0;
}

.dashboard-week-day-entries {
  display: grid;
  gap: 0.55rem;
}

.dashboard-week-entry {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.dashboard-week-entry--compact {
  grid-template-columns: minmax(0, 1fr) auto;
}

.dashboard-week-entry-date strong {
  display: block;
}

.dashboard-week-entry-main {
  min-width: 0;
}

.dashboard-week-entry-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.dashboard-week-entry-subtitle {
  margin: 0.35rem 0 0;
  color: #475569;
}

.dashboard-week-entry-actions .btn {
  white-space: nowrap;
}

.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-reminder-row,
.dashboard-reminder-note,
.dashboard-treatment-row {
  overflow-wrap: anywhere;
}

.dashboard-reminder-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.dashboard-reminder-row .badge {
  flex: 0 0 auto;
}

.dashboard-reminder-meta,
.dashboard-reminder-copy {
  display: inline;
}

.dashboard-reminder-note {
  margin-top: -0.5rem;
}

.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-search-result-row {
  overflow-wrap: anywhere;
}

.dashboard-search-result-row + .dashboard-search-result-row {
  margin-top: 0.45rem;
}

.trainer-dashboard-session-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.trainer-dashboard-session-main,
.trainer-dashboard-session-link,
.dashboard-day-popup-item,
.dashboard-day-popup-item a,
.dashboard-schedule-customer,
.dashboard-schedule-horses,
.customer-card-contact,
.customer-card-next p {
  overflow-wrap: anywhere;
}

.trainer-dashboard-session-main small {
  display: inline;
}

.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;
  white-space: normal !important;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.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;
  white-space: normal !important;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.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;
  overflow-x: hidden;
}

.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;
  min-width: 0;
}

.appointment-datetime-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr);
  gap: 0.6rem;
}

.appointment-datetime-grid > div {
  min-width: 0;
}

.appointment-subfield-label {
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
  color: #475569;
}

.appointment-datetime-grid input[type="date"],
.appointment-datetime-grid input[type="time"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  display: block;
  inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.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;
  overflow-x: hidden;
}

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

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

.appointment-form-section .grid > div {
  min-width: 0;
}

.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;
}

.appointment-horse-badges {
  flex-wrap: wrap;
  gap: 0.45rem;
}

.appointment-horse-badge-label {
  position: relative;
  margin: 0;
}

.appointment-horse-badge-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.appointment-horse-badge-btn {
  white-space: nowrap;
}

.appointment-horse-badge-checkbox:checked + .appointment-horse-badge-btn {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.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;
  overflow-x: hidden;
}

.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-row-item-main {
  min-width: 0;
}

.horse-row-item-line {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 0.4rem;
  align-items: baseline;
}

.horse-row-item-badge {
  display: inline-flex;
  justify-content: flex-start;
  min-width: 0;
}

.horse-row-item-badge .calendar-category-badge {
  margin-right: 0;
  white-space: nowrap;
}

.horse-row-item-copy {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
}

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

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

.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 {
  min-width: 0;
}

.horse-history-filter-field select,
.horse-history-filter-field input,
.horse-history-filter-field textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-inline-size: 0;
  box-sizing: border-box;
}

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

.horse-history-filter-field input[type="date"] {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.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;
}

.horse-schedule-week-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.horse-schedule-week-header h2 {
  margin: 0;
}

.horse-schedule-list {
  display: grid;
  gap: 0.65rem;
}

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

.horse-schedule-date strong {
  display: block;
}

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

.horse-schedule-subtitle {
  margin: 0.35rem 0 0;
  color: #475569;
}

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

.horse-schedule-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}

.horse-schedule-filter-field {
  min-width: 0;
}

.horse-schedule-filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.horse-schedule-filter-badge {
  display: inline-flex;
}

.horse-schedule-filter-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.horse-schedule-filter-badge span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.horse-schedule-filter-badge span:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.horse-schedule-filter-input:checked + span {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.horse-schedule-filter-input:focus-visible + span {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.horse-schedule-filter-actions {
  margin: 0;
  flex-wrap: nowrap;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-self: end;
}

.horse-schedule-filter-actions .btn {
  width: 140px;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

  .horse-history-filter-field select,
  .horse-history-filter-field input[type="date"] {
    min-width: 0;
    max-width: 100%;
  }

  .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-layout + .actions {
  margin-top: 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;
}

.vaccination-type-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.35rem;
}

.vaccination-type-badge {
  display: block;
  cursor: pointer;
}

.vaccination-type-badge-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.vaccination-type-badge-card {
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  border: 1px solid #c8ddd5;
  background: #f8fcfa;
  color: #24453c;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.05);
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease;
}

.vaccination-type-badge-card strong {
  font-size: 0.94rem;
}

.vaccination-type-badge-card small {
  color: #4f6f66;
  font-size: 0.82rem;
}

.vaccination-type-badge:hover .vaccination-type-badge-card {
  transform: translateY(-1px);
  border-color: #7fb7a6;
}

.vaccination-type-badge-input:checked + .vaccination-type-badge-card {
  border-color: #0f766e;
  background: #edf7f3;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.vaccination-type-badge-input:focus-visible + .vaccination-type-badge-card {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  outline-offset: 2px;
}

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

.horse-care-form-block + .horse-care-form-block {
  margin-top: 0.85rem;
}

.horse-care-form-block {
  display: block;
  width: 100%;
  min-width: 0;
}

[data-horse-care-event-form-target="singleDateSection"] {
  margin-bottom: 0.85rem;
}

.horse-care-form-block label {
  margin-bottom: 0.35rem;
}

@media (max-width: 640px) {
  [data-horse-care-event-form-target="singleDateSection"] {
    margin-bottom: 1rem;
  }
}

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

.bulk-vaccination-card {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.bulk-vaccination-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.bulk-vaccination-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.bulk-vaccination-rows {
  display: grid;
  gap: 0.8rem;
}

.bulk-vaccination-row {
  padding: 0.9rem;
  border: 1px solid #d9e3df;
  border-radius: 16px;
  background: #f8fcfa;
}

.bulk-vaccination-row-main {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1fr;
  gap: 0.8rem;
}

.bulk-vaccination-vaccine {
  grid-column: 1 / -1;
}

.bulk-vaccination-row label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.bulk-vaccination-row select,
.bulk-vaccination-row input,
.bulk-vaccination-row textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-inline-size: 0;
  box-sizing: border-box;
}

.bulk-vaccination-row input[type="date"],
.bulk-vaccination-row input[type="text"],
.bulk-vaccination-row input[type="file"],
.bulk-vaccination-row textarea,
.bulk-vaccination-row select {
  display: block;
  inline-size: 100%;
}

.bulk-vaccination-row input[type="date"],
.bulk-vaccination-row input[type="text"] {
  -webkit-appearance: none;
  appearance: none;
}

.bulk-vaccination-notes {
  grid-column: 1 / -1;
}

.bulk-vaccination-row-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.bulk-vaccination-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.vaccination-type-badges--compact .vaccination-type-badge-card {
  min-width: 160px;
  padding: 0.7rem 0.9rem;
}

.bulk-vaccination-summary {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  background: #e3f3ed;
  color: #1f3d35;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-weight: 700;
}

@media (max-width: 640px) {
  .bulk-vaccination-row-main {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .bulk-vaccination-row-actions .btn,
  .bulk-vaccination-actions .btn {
    width: 100%;
  }
}

.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-planning-filters > div {
  min-width: 0;
}

.competition-planning-filters input,
.competition-planning-filters select,
.competition-planning-filters textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  box-sizing: border-box;
}

.competition-planning-filters input[type="date"] {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.competition-planning-table,
.competition-classes-table {
  min-width: 720px;
}

@media (max-width: 640px) {
  .competition-planning-filters {
    grid-template-columns: 1fr;
  }

  .competition-planning-filter-actions .btn,
  .competition-planning-header .actions .btn,
  .competition-planning-link-actions .btn {
    width: 100%;
  }

  .competition-planning-header {
    align-items: stretch;
  }

  .competition-planning-header .actions {
    width: 100%;
  }

  .competition-planning-quicklink-card {
    align-items: stretch;
  }

  .competition-planning-quicklink {
    display: block;
    width: 100%;
  }

  .competition-planning-table,
  .competition-classes-table {
    min-width: 640px;
  }
}

.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;
  }

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

  .dashboard-filter-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-filter-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .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) {
  html,
  body,
  main {
    overflow-x: hidden;
  }

  .container {
    width: min(100%, calc(100% - 1.25rem));
  }

  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.75rem;
  }

  .appointment-datetime-grid {
    grid-template-columns: 1fr;
  }

  .appointment-datetime-input {
    max-width: 100%;
  }

  .appointment-datetime-grid input[type="date"],
  .appointment-datetime-grid input[type="time"] {
    font-size: 16px;
  }

  .page-header {
    align-items: stretch;
  }

  .page-header > .btn,
  .page-header > .actions,
  .page-header > form,
  .page-header > div.actions {
    width: 100%;
  }

  .page-header .actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .actions .btn,
  .page-header .actions form,
  .page-header > .btn {
    width: 100%;
  }

  .page-header .actions form .btn {
    width: 100%;
  }

  .horse-show-header {
    align-items: stretch;
  }

  .horse-show-header .actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .horse-show-header .actions .btn {
    width: 100%;
    min-width: 0;
  }

  .horse-show-page .card {
    overflow-x: hidden;
  }

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

  .horse-profile-photo-wrap {
    justify-content: center;
    width: 100%;
  }

  .horse-profile-photo,
  .horse-profile-photo-placeholder {
    width: min(220px, 100%);
    max-width: 100%;
  }

  .horse-section-header {
    align-items: stretch;
  }

  .horse-section-header .actions {
    width: 100%;
  }

  .horse-section-header .actions .btn {
    width: 100%;
  }

  .horse-health-bar,
  .horse-section-card {
    overflow-x: hidden;
  }

  .horse-history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .horse-history-actions .btn,
  .horse-history-actions form {
    width: 100%;
  }

  .horse-history-actions form .btn {
    width: 100%;
  }

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

  .horse-schedule-actions .btn {
    width: 100%;
  }

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

  .horse-schedule-filter-actions {
    flex-wrap: wrap;
  }

  .horse-schedule-filter-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .horse-row-item strong,
  .horse-row-item span,
  .horse-row-item small,
  .horse-history-title,
  .horse-notes-block,
  .horse-fact,
  .horse-fact span,
  .tr-status-badges,
  .tr-status-badges .badge {
    overflow-wrap: anywhere;
  }

  .topbar-inner {
    gap: 0.6rem;
  }

  .brand {
    font-size: 1.1rem;
    min-width: 0;
  }

  .brand-logo {
    height: 44px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    grid-column: 2 / 3;
    grid-row: 1;
    justify-self: end;
  }

  .topbar-menu {
    grid-column: 1 / -1;
    width: 100%;
    order: 3;
    display: none;
    padding-top: 0.25rem;
  }

  .topbar.is-menu-open .topbar-menu {
    display: block;
  }

  .topbar-menu .nav-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: flex-start;
    min-width: 0;
  }

  .topbar-menu .nav-links a,
  .topbar-menu .nav-links span {
    width: 100%;
  }

  .topbar-menu .nav-links .muted {
    width: 100%;
    font-size: 0.95rem;
  }

  .topbar-menu form {
    width: 100%;
    margin-top: 0.75rem;
  }

  .topbar-menu form .btn {
    width: 100%;
  }

  .topbar-menu .nav-links a,
  .topbar-menu .nav-links span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .topbar-inner > form {
    display: none;
  }

  .dashboard-calendar-nav {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
  }

  .dashboard-calendar-nav h2 {
    width: auto;
    min-width: 0;
    text-align: center;
    font-size: 1.1rem;
  }

  .dashboard-calendar-nav .btn {
    width: auto;
    min-width: 0;
    padding: 0.45rem 0.7rem;
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .dashboard-filter-actions .btn {
    width: 100%;
  }

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

  .dashboard-week-entry-actions .btn {
    width: 100%;
  }

  .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;
    transform: translateY(4px);
  }

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

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

  .dashboard-side-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-tabs {
    width: 100%;
    margin-right: 0;
  }

  .dashboard-side-header h2 {
    width: 100%;
    margin: 0;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
  }

  .dashboard-tabs .btn {
    flex: 1 1 0;
  }

  .dashboard-reminders-card,
  .dashboard-recent-card {
    overflow-x: hidden;
  }

  .dashboard-reminder-row {
    align-items: flex-start;
  }

  .dashboard-reminder-row .badge {
    max-width: 100%;
    white-space: normal;
  }

  .dashboard-reminder-meta,
  .dashboard-reminder-copy,
  .dashboard-reminder-note small,
  .dashboard-treatment-row small {
    display: block;
    width: 100%;
  }

  .dashboard-reminder-note {
    margin-top: -0.2rem;
  }

  .dashboard-reminders-card hr {
    margin: 0.8rem 0;
  }

  .dashboard-search-card,
  .dashboard-search-results,
  .dashboard-search-result-row {
    overflow-x: hidden;
  }

  .dashboard-search-result-row small {
    display: block;
    width: 100%;
    margin-top: 0.15rem;
  }

  .trainer-dashboard-session-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .trainer-dashboard-session-main,
  .trainer-dashboard-session-link,
  .dashboard-day-popup-link,
  .dashboard-schedule-top,
  .dashboard-schedule-customer,
  .dashboard-schedule-horses,
  .customer-card-contact,
  .customer-card-next p,
  .card p,
  .card small {
    width: 100%;
  }

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

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

  .competition-classes-table,
  .competition-classes-table colgroup {
    min-width: 0;
    max-width: 100%;
  }

  .competition-classes-table colgroup {
    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;
    overflow: hidden;
  }

  .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;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .dashboard-day-popup {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    top: auto;
    bottom: 0.75rem;
    max-height: 52vh;
    z-index: 60;
    transform: translateY(4px);
  }

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

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