* { box-sizing: border-box; }
:root {
  --background: #f4f1ea;
  --foreground: #202622;
  --muted: #6f766f;
  --line: #d6d0c3;
  --panel: #fffdf8;
  --panel-soft: #ede7dc;
  --accent-strong: #315842;
}
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: Arial, Helvetica, sans-serif;
}
button, input, select, textarea { font: inherit; }
button {
  border: 0;
  background: var(--accent-strong);
  color: white;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--line);
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--foreground);
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
}
textarea { min-height: 88px; resize: vertical; }
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(79, 116, 92, 0.18), transparent 38%),
    linear-gradient(315deg, rgba(154, 91, 54, 0.18), transparent 44%),
    var(--background);
}
.login-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 18px 60px rgba(40, 34, 25, 0.08);
}
.login-card h1, .topbar h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}
.login-card p { color: var(--muted); }
.login-card form { display: grid; gap: 14px; margin-top: 24px; }
.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 18px 52px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 8px;
}
.dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.top-dashboard {
  width: min(520px, 100%);
  margin: 14px 0 0;
}
.top-dashboard article {
  padding: 12px;
  font-size: 12px;
}
.dashboard article, .plan-card, .entry-form, .entry, .horse-card, .profile-card, .current-entry-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.top-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: flex-end;
}
.add-horse {
  position: relative;
  min-width: 150px;
}
.add-horse summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 44px;
  padding: 0 14px;
  background: #fff;
}
.add-horse-form {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: min(420px, 90vw);
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 18px 60px rgba(40, 34, 25, 0.16);
}
.horse-tools {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}
.horse-card, .profile-card { padding: 16px; }
.side-stack {
  display: grid;
  gap: 12px;
}
.selector-top { margin-bottom: 16px; }
.horse-summary {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 16px;
  align-items: start;
}
.horse-summary img {
  width: 116px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.horse-summary h2 {
  margin: 0 0 12px;
  font-size: 28px;
  letter-spacing: 0;
}
dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
dd {
  margin: 3px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}
dd small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-weight: 800;
  min-height: 42px;
  display: flex;
  align-items: center;
}
.profile-form, .document-form, .weight-form, .vet-form {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.document-form, .weight-form, .vet-form { margin-top: 16px; }
.documents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.documents a {
  color: var(--accent-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  text-decoration: none;
  font-weight: 700;
  background: #fff;
}
.ghost-link {
  color: var(--accent-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  text-decoration: none;
  font-weight: 700;
  background: #fff;
  display: inline-flex;
  width: fit-content;
}
.weight-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.vet-history {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.vet-history article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.vet-history article div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.vet-history span, .vet-history em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}
.vet-history p {
  margin: 8px 0;
  line-height: 1.45;
}
.weight-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.weight-list strong { color: var(--foreground); }
.weight-list span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}
.dashboard article { padding: 16px; color: var(--muted); }
.dashboard span {
  display: block;
  color: var(--foreground);
  font-size: 28px;
  font-weight: 800;
}
.planner {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 16px;
  align-items: start;
}
.plan-card, .entry-form, .current-entry-card { padding: 18px; }
.plan-card { position: sticky; top: 18px; }
.day-workspace {
  display: grid;
  gap: 14px;
}
.selector {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
.plan-card h2, .section-heading h2 {
  margin: 0 0 12px;
  font-size: 25px;
  letter-spacing: 0;
}
.plan-card p { line-height: 1.5; }
.calendar-card {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
}
.calendar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 10px;
}
.calendar-head strong { color: var(--foreground); }
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}
.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}
.dot.ride, .calendar-day.ride { background: #4f8f64; }
.dot.rest, .calendar-day.rest { background: #d5ae46; }
.dot.stand, .calendar-day.stand { background: #b75a4e; }
.dot.movement, .calendar-day.movement { background: #5d86a8; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}
.weekday {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.calendar-empty {
  min-height: 34px;
}
.calendar-day {
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--foreground);
  border: 1px solid var(--line);
  font-size: 13px;
}
.calendar-day.ride,
.calendar-day.rest,
.calendar-day.stand,
.calendar-day.movement {
  color: #fff;
  border-color: transparent;
}
.calendar-day:disabled {
  cursor: default;
  opacity: 0.72;
}
.entry-modal {
  width: min(720px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  background: var(--panel);
  color: var(--foreground);
  box-shadow: 0 24px 80px rgba(40, 34, 25, 0.24);
}
.entry-modal::backdrop {
  background: rgba(20, 24, 21, 0.36);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 34px;
  width: 34px;
  padding: 0;
  border-radius: 999px;
}
.entry-modal h2 {
  margin: 0 0 16px;
}
.modal-entry {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}
.modal-entry h3 {
  margin: 0 0 8px;
}
.modal-entry p {
  line-height: 1.45;
}
.row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.entry-form, .training-fields, .rest-fields { display: grid; gap: 14px; }
.checkline {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  color: var(--foreground);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.checkline input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  accent-color: var(--accent-strong);
}
.message, .saved {
  color: var(--accent-strong);
  font-weight: 700;
  margin: 0 0 16px;
}
.reminders {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}
.reminders > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.reminders article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.reminders strong {
  display: block;
}
.reminders span {
  color: var(--muted);
  font-size: 13px;
}
.history { margin-top: 30px; }
.section-heading { margin-bottom: 12px; }
.entries { display: grid; gap: 12px; }
.entry { padding: 16px; }
.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.entry-head strong { display: block; font-size: 17px; }
.entry-head span, .entry-head em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}
.entry p { margin: 8px 0; line-height: 1.45; }
.current-entry-card h2 {
  margin: 0;
  font-size: 24px;
}
.current-entry-card p {
  margin: 9px 0;
  line-height: 1.45;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.empty {
  color: var(--muted);
  background: var(--panel-soft);
  border-radius: 8px;
  padding: 18px;
}
.compact {
  padding: 10px 12px;
  margin: 0;
}
@media (max-width: 820px) {
  .topbar, .entry-head, .top-actions { flex-direction: column; }
  .dashboard, .planner, .row, .selector, .horse-tools, .horse-summary, dl { grid-template-columns: 1fr; }
  .top-actions, .add-horse { width: 100%; }
  .add-horse-form {
    position: static;
    width: 100%;
    margin-top: 8px;
  }
  .plan-card { position: static; }
}

.print-body {
  background: #fff;
}
.print-sheet {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px;
  color: #1f241f;
}
.print-sheet h1 {
  margin: 0 0 8px;
}
.print-record {
  border-top: 1px solid #d6d0c3;
  padding-top: 14px;
  margin-top: 14px;
}
.print-record h2 {
  margin: 0 0 8px;
}
@media print {
  .print-sheet {
    padding: 0;
  }
}
