@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito Sans";
  src: url("/fonts/nunito-sans-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f7f1e3;
  --paper-deep: #efe5d2;
  --surface: #fffdf8;
  --surface-soft: #fbf6eb;
  --ink: #1d2a22;
  --ink-soft: #4b5a4f;
  --ink-faint: #637166;
  --forest: #1f3d2f;
  --forest-2: #2c5541;
  --moss: #6e8b6e;
  --terracotta: #a95236;
  --terracotta-dark: #8f3f29;
  --gold: #d8a544;
  --gold-soft: #f3dfb0;
  --line: #e4dac7;
  --line-strong: #d3c6ad;
  --danger: #b3402f;
  --success: #4f7a5b;
  --shadow-sm: 0 1px 2px rgba(29, 42, 34, 0.05), 0 6px 18px rgba(29, 42, 34, 0.05);
  --shadow-md: 0 12px 32px rgba(29, 42, 34, 0.1);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(216, 165, 68, 0.14), transparent 60%),
    radial-gradient(900px 520px at -10% 105%, rgba(110, 139, 110, 0.12), transparent 58%),
    var(--paper);
}
body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: var(--forest-2); text-decoration: none; }
a:hover { color: var(--terracotta-dark); }
::selection { background: var(--gold-soft); color: var(--forest); }
:focus-visible { outline: 3px solid rgba(216, 165, 68, 0.6); outline-offset: 2px; }

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--forest);
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin: 0;
}
h1 { font-size: clamp(2rem, 3.6vw, 3rem); font-weight: 600; }
h2 { font-size: clamp(1.35rem, 2.2vw, 1.8rem); font-weight: 600; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.12rem; font-weight: 600; margin: 0 0 0.45rem; }
p { margin: 0 0 0.8rem; }
.muted, p.muted { color: var(--ink-soft); }
.small { font-size: 0.88rem; }
.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
}
.back-link { display: flex; width: fit-content; align-items: center; gap: 0.3rem; margin-bottom: 0.5rem; color: var(--ink-soft); font-size: 0.82rem; font-weight: 800; }
.back-link:hover { color: var(--forest); }
.lede { color: var(--ink-soft); max-width: 62ch; margin-top: 0.5rem; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 241, 227, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 72px;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--forest); flex-shrink: 0; }
.brand:hover { color: var(--forest); }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--forest);
  color: var(--gold-soft);
  display: grid;
  place-items: center;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; letter-spacing: -0.01em; }
.main-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--surface); color: var(--forest); }
.nav-link.is-active { background: var(--forest); color: #fbf6e8; }
.nav-link.is-active:hover { background: var(--forest-2); color: #fffdf8; }
.account-menu { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.65rem 0.2rem 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}
.user-chip:hover { color: var(--forest); border-color: var(--line-strong); }
.avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--forest);
  display: inline-grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 2.6rem 1.5rem 4.5rem; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.grid { display: grid; gap: 0.9rem; }
.stat-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ---------- buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--forest);
  color: #fdf8ea;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 3px 8px rgba(31, 61, 47, 0.14);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
button:hover, .btn:hover {
  background: var(--forest-2);
  color: #fffdf8;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(31, 61, 47, 0.18);
}
button:active, .btn:active { transform: translateY(0); }
button:disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary, button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn.secondary:hover, button.secondary:hover { background: var(--gold-soft); color: var(--forest); }
.btn.danger, button.danger { background: var(--terracotta); color: #fff; }
.btn.danger:hover, button.danger:hover { background: var(--terracotta-dark); }
.btn.small, button.small { padding: 0.38rem 0.65rem; font-size: 0.8rem; border-radius: 9px; }
.btn-ghost, button.link {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  padding: 0.45rem 0.65rem;
}
.btn-ghost:hover, button.link:hover { background: var(--surface); color: var(--forest); transform: none; box-shadow: none; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.row.end { justify-content: flex-end; }
.inline-form { display: inline-flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin: 0; }
.inline-form select { width: auto; min-width: 150px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card.hover { transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s; }
.card.hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.stat { display: flex; flex-direction: column; gap: 0.3rem; }
.stat .big {
  font-family: var(--font-display);
  font-size: 2.15rem;
  font-weight: 600;
  color: var(--forest);
  line-height: 1;
}
.stat .label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: var(--forest);
  margin-bottom: 0.35rem;
}
.stat-icon svg { width: 18px; height: 18px; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(700px 300px at 90% 10%, rgba(216, 165, 68, 0.22), transparent 60%),
    linear-gradient(135deg, var(--forest), var(--forest-2));
  color: #fbf6e8;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 18px 40px rgba(31, 61, 47, 0.18);
}
.hero h1 { color: #fbf6e8; margin: 0.25rem 0 0.5rem; }
.hero .eyebrow { color: var(--gold-soft); }
.hero p { color: rgba(251, 246, 232, 0.78); max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; }
.hero .btn { background: var(--gold); color: var(--forest); }
.hero .btn:hover { background: #e7bd68; color: var(--forest); }
.hero .btn.secondary { background: transparent; color: #fbf6e8; border: 1px solid rgba(251, 246, 232, 0.35); }
.hero .btn.secondary:hover { background: rgba(251, 246, 232, 0.1); }
.hero-art {
  position: absolute;
  right: -10px;
  bottom: -38px;
  width: 260px;
  opacity: 0.14;
  color: #fbf6e8;
  pointer-events: none;
}

/* ---------- badges & chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.badge.gold, .badge.badge-gold { background: var(--gold-soft); border-color: #e7cd94; color: #6b4a12; }
.badge.moss, .badge.badge-moss { background: #e8f0e4; border-color: #c9dbca; color: #375c40; }
.badge.terracotta, .badge.badge-terracotta { background: #f8e4dc; border-color: #ebc5b8; color: #8e402a; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.6rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

/* ---------- avatars ---------- */
.thumb {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}
.placeholder {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-soft), #e8c98d);
  border: 1px solid #e7cd94;
  color: var(--forest);
  display: inline-grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}
.avatar-lg {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--paper-deep);
}

/* ---------- horse cards ---------- */
.horse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; align-items: start; }
.horse-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.horse-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.horse-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: linear-gradient(135deg, var(--paper-deep), #e9dcc4);
}
.horse-photo.placeholder-art {
  display: grid;
  place-items: center;
  color: rgba(31, 61, 47, 0.45);
  font-family: var(--font-display);
  font-size: 2.6rem;
}
.placeholder-art {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--paper-deep), #e9dcc4);
  color: rgba(31, 61, 47, 0.45);
  font-family: var(--font-display);
  font-size: 2.6rem;
}
.horse-body { padding: 0.95rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.55rem; flex: 1; }
.horse-body h3 { margin: 0; font-size: 1.25rem; }
.horse-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; color: var(--ink-soft); font-size: 0.82rem; }
.horse-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.3rem; }

/* ---------- yard cards ---------- */
.yard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.1rem; }
.yard-grid.compact { grid-template-columns: repeat(auto-fill, minmax(260px, 360px)); justify-content: start; }
.yard-card { display: flex; flex-direction: column; gap: 0.8rem; }
.yard-top { display: flex; align-items: center; gap: 0.7rem; }
.yard-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--gold-soft);
  color: var(--forest);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.yard-icon svg { width: 22px; height: 22px; }
.yard-card h3 { margin: 0; font-size: 1.3rem; }
.yard-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---------- profile ---------- */
.profile-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.profile-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 22px; background: var(--paper-deep); }
.profile-body h1 { margin: 0.15rem 0 0.35rem; }
.profile-body .lede { margin: 0; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.9rem; }
.note-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; }
.note-card h3 {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}
.note-card p { margin: 0; color: var(--ink); }

/* ---------- timeline ---------- */
.timeline { position: relative; border-left: 2px solid var(--line); padding-left: 1.25rem; margin-top: 0.75rem; }
.timeline-item { position: relative; padding: 0 0 1.15rem 0.2rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -1.62rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 2px var(--gold-soft);
}
.timeline-time { font-size: 0.76rem; font-weight: 800; color: var(--ink-faint); letter-spacing: 0.03em; }
.timeline-title { font-weight: 800; color: var(--forest); margin: 0.1rem 0 0.15rem; }
.timeline-body { color: var(--ink-soft); font-size: 0.9rem; }
.timeline-details { margin-top: 0.15rem; color: var(--ink-faint); font-size: 0.82rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; }
.pager-slot { flex: 1; display: flex; }
.pager-slot-end { justify-content: flex-end; }
.pager-status { font-size: 0.82rem; font-weight: 800; color: var(--ink-faint); white-space: nowrap; }

/* ---------- people ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 380px)); gap: 1rem; justify-content: start; }
.person-card { display: flex; align-items: center; gap: 0.8rem; }
.person-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--gold-soft);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.person-body { min-width: 0; }
.person-body h3 { margin: 0; font-size: 1.05rem; }
.person-body p { margin: 0; font-size: 0.82rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }

/* ---------- sharing ---------- */
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.share-card { display: flex; flex-direction: column; gap: 0.9rem; }
.share-head { display: flex; align-items: center; gap: 0.75rem; }
.share-head h3 { margin: 0; font-size: 1.15rem; }
.switch { display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; user-select: none; font-weight: 800; font-size: 0.85rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 1px 3px rgba(29, 42, 34, 0.25);
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--forest); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid rgba(216, 165, 68, 0.6); outline-offset: 2px; }
.member-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.member-chip input { accent-color: var(--forest); width: 14px; height: 14px; }
.member-chip:has(input:checked) { background: var(--gold-soft); border-color: #e7cd94; color: #6b4a12; }
.member-chip.is-disabled { opacity: 0.42; cursor: not-allowed; }

/* ---------- forms ---------- */
.form { display: grid; gap: 1rem; max-width: 640px; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); }
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 640px) minmax(240px, 320px);
  gap: 1.25rem;
  align-items: start;
}
.form-layout .form { max-width: none; }
.form-aside { display: grid; gap: 1rem; align-self: start; }
.form-aside h3 { font-size: 1.02rem; }
.form-aside .card { padding: 1.1rem; }
.plain-list { margin: 0.55rem 0 0; padding-left: 1.1rem; color: var(--ink-soft); font-size: 0.88rem; display: grid; gap: 0.35rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.form-grid .field.full { grid-column: 1 / -1; }
.field { display: grid; gap: 0.35rem; }
.field label, .field > span.label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="file"], select, textarea {
  width: 100%;
  background: #fffefb;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.62rem 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="file"] { padding: 0.45rem; }
input[type="file"]::file-selector-button {
  margin-right: 0.6rem;
  padding: 0.42rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: #fffdf8;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--forest-2); }
input:disabled { background: var(--paper-deep); color: var(--ink-soft); cursor: not-allowed; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 4px rgba(31, 61, 47, 0.1);
}
input::placeholder, textarea::placeholder { color: #a9b3a8; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.hint { font-size: 0.78rem; color: var(--ink-faint); }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--ink-soft); }
.check input { width: 16px; height: 16px; accent-color: var(--forest); }
.checkbox-grid { display: grid; gap: 0.45rem; }

/* ---------- modal dialogs ---------- */
body.modal-open { overflow: hidden; }
dialog.modal {
  width: min(540px, calc(100vw - 2rem));
  max-height: min(86vh, 780px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(20, 35, 26, 0.3);
}
dialog.modal.wide { width: min(680px, calc(100vw - 2rem)); }
dialog.modal::backdrop {
  background: rgba(22, 38, 29, 0.58);
  backdrop-filter: blur(3px);
}
dialog.modal[open] { animation: modal-in 0.16s ease-out; }
@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.4rem 0;
}
.modal-head h2 { margin: 0.2rem 0 0; font-size: 1.7rem; }
.modal-subtitle { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.modal-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--ink-soft);
  box-shadow: none;
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--gold-soft); color: var(--forest); transform: none; box-shadow: none; }
.modal-body { display: grid; gap: 1rem; padding: 1.15rem 1.4rem 1.35rem; }
.modal-body .form { max-width: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; padding: 0 1.4rem 1.4rem; }
.modal-actions .btn, .modal-actions button { min-width: 100px; }
.modal .avatar-lg { width: 76px; height: 76px; }
.table-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.table-actions form { margin: 0; }
.danger-zone { border-color: #ecc8bd; background: #fffaf7; }
.danger-zone h3 { color: var(--terracotta-dark); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th, td { text-align: left; padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-soft); }
td .thumb, td .placeholder { width: 42px; height: 42px; }

/* ---------- alerts ---------- */
.flash, .error {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0.9rem 0;
}
.flash { background: #eaf2e5; border: 1px solid #cddfc8; color: #315a3d; }
.error { background: #fbe9e3; border: 1px solid #ecc8bd; color: #933c28; }
.note {
  background: rgba(243, 223, 176, 0.38);
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
  padding: 0.7rem 0.9rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------- empty state ---------- */
.empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.5);
}
.empty-art {
  width: 74px;
  height: 74px;
  margin: 0 auto 0.9rem;
  border-radius: 24px;
  background: var(--gold-soft);
  color: var(--forest);
  display: grid;
  place-items: center;
}
.empty-art svg { width: 36px; height: 36px; }
.empty h2 { margin: 0 0 0.35rem; }
.empty p { max-width: 46ch; margin: 0 auto 1.1rem; color: var(--ink-soft); }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.error-page .empty { width: 100%; max-width: 560px; }
.error-page .eyebrow { margin-bottom: 0.4rem; }
.error-page h1 { font-size: clamp(3rem, 8vw, 5rem); margin: 0.2rem 0 0.4rem; }

/* ---------- detail definitions ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.8rem 1.4rem; }
.detail-grid dt { color: var(--ink-faint); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.detail-grid dd { margin: 0.15rem 0 0.6rem; color: var(--ink); }

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--paper);
}
.login-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(700px 400px at 80% 0%, rgba(216, 165, 68, 0.22), transparent 60%),
    linear-gradient(150deg, var(--forest), #244735 70%, #1a3328);
  color: #fbf6e8;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-brand .brand { color: #fbf6e8; }
.login-brand .brand-mark { background: rgba(251, 246, 232, 0.12); color: var(--gold-soft); }
.login-brand .eyebrow { color: var(--gold-soft); }
.login-brand h2 { color: #fbf6e8; font-size: clamp(2rem, 3.4vw, 3.2rem); max-width: 14ch; margin: 2rem 0 1rem; }
.login-brand p { color: rgba(251, 246, 232, 0.78); max-width: 42ch; }
.login-art { width: 230px; opacity: 0.2; margin-top: 2rem; }
.login-quote { font-family: var(--font-display); font-size: 1.05rem; color: rgba(251, 246, 232, 0.8); border-left: 2px solid var(--gold); padding-left: 0.9rem; }
.login-panel { display: grid; place-items: center; padding: 2rem; }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 2.3rem; margin-bottom: 0.35rem; }
.login-card .form { max-width: none; margin-top: 1.2rem; }
.login-footer { margin-top: 1rem; font-size: 0.82rem; color: var(--ink-faint); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .profile-hero { grid-template-columns: 150px 1fr; }
  .hero-art { width: 200px; opacity: 0.1; }
}
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: 0.6rem; }
  .main-nav { order: 3; flex: 1 0 100%; width: 100%; padding-bottom: 0.35rem; }
  .account-menu { margin-left: auto; }
  .user-chip .user-name { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 1.6rem; min-height: auto; gap: 0.8rem; }
  .login-brand h2 { font-size: clamp(1.75rem, 7vw, 2.2rem); margin: 0.9rem 0 0.35rem; max-width: 18ch; }
  .login-brand p { display: none; }
  .login-panel { padding: 1.5rem 1.25rem 2.5rem; }
  .login-card h1 { font-size: 2rem; }
  .login-art { display: none; }
  .login-quote { display: none; }
  .profile-hero { grid-template-columns: 1fr; }
  .profile-photo { max-width: 220px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-layout { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar .brand-name { font-size: 0.95rem; }
}
@media (max-width: 640px) {
  .container { padding: 1.6rem 1rem 3rem; }
  .topbar-inner { padding: 0.55rem 1rem; }
  .brand-name { font-size: 1rem; }
  .main-nav { gap: 0.1rem; }
  .nav-link { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .horse-grid, .yard-grid, .people-grid, .share-grid, .notes-grid { grid-template-columns: 1fr; }
  .horse-photo { aspect-ratio: 16 / 10; }
  .hero { padding: 1.4rem; border-radius: 22px; }
  .hero-art { display: none; }
  dialog.modal { width: calc(100vw - 1.25rem); max-height: calc(100vh - 1.5rem); border-radius: 18px; }
  .modal-head { padding: 1.1rem 1.1rem 0; }
  .modal-body { padding: 1rem 1.1rem 1.1rem; }
  .modal-actions { padding: 0 1.1rem 1.1rem; }
  .modal-actions .btn, .modal-actions button { flex: 1; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .timeline { padding-left: 1rem; }
}
@media (max-width: 360px) {
  .topbar .brand-name { display: none; }
  .main-nav { gap: 0.05rem; }
  .nav-link { padding: 0.35rem 0.42rem; font-size: 0.76rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ============================================================
   Playful illustrated theme (local branch experiment)
   ============================================================ */
@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fff7e8;
  --paper-deep: #ffe9b5;
  --surface: #fffdf7;
  --surface-soft: #fff3d2;
  --ink: #20322a;
  --ink-soft: #4c5c51;
  --ink-faint: #5d6d62;
  --forest: #1f6d42;
  --forest-2: #2f8a58;
  --moss: #58a46b;
  --terracotta: #b7462c;
  --terracotta-dark: #8f3522;
  --gold: #ffc94a;
  --gold-soft: #ffe7a3;
  --coral: #f26b4a;
  --sky: #7bd7f2;
  --mint: #c9f2d3;
  --lilac: #d8c7ff;
  --pink: #ffd1dc;
  --line: #20322a;
  --line-strong: #20322a;
  --shadow-sm: 4px 4px 0 rgba(32, 50, 42, 0.15);
  --shadow-md: 8px 8px 0 rgba(32, 50, 42, 0.18);
  --radius-sm: 12px;
  --radius: 22px;
  --radius-lg: 30px;
  --font-display: "Fredoka", "Nunito Sans", sans-serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, sans-serif;
}

html { background: var(--paper); }
body {
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 201, 74, 0.22) 0 4px, transparent 4.5px),
    radial-gradient(circle at 72% 62%, rgba(123, 215, 242, 0.2) 0 3px, transparent 3.5px),
    radial-gradient(circle at 42% 86%, rgba(242, 107, 74, 0.14) 0 3px, transparent 3.5px);
  background-size: 120px 120px, 170px 170px, 140px 140px;
}

h1, h2, h3, .brand-name, .stat .big, .hero h1, .login-card h1, .login-brand h2 {
  font-family: var(--font-display);
  font-weight: 600;
}
h1 { letter-spacing: -0.025em; }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

.eyebrow {
  padding: 0.22rem 0.58rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.16);
  letter-spacing: 0.1em;
}
.hero .eyebrow, .login-brand .eyebrow {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--ink);
}
.back-link { color: var(--ink-soft); }
.back-link:hover { color: var(--forest); }

/* Top bar */
.topbar {
  background: rgba(255, 247, 232, 0.92);
  border-bottom: 2px solid var(--ink);
}
.brand { color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 2px 2px 0 var(--ink);
  transform: rotate(-4deg);
}
.brand-name { letter-spacing: -0.02em; }
.nav-link {
  border: 2px solid transparent;
  color: var(--ink-soft);
  transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.nav-link:hover {
  background: var(--mint);
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-1px);
}
.nav-link.is-active {
  background: var(--sky);
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  animation: playful-pop 0.25s ease-out;
}
.user-chip {
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.16);
}
.avatar-sm {
  background: var(--pink);
  color: var(--ink);
  border: 2px solid var(--ink);
}
@keyframes playful-pop {
  from { transform: scale(0.95); }
  to { transform: scale(1); }
}

/* Buttons */
button, .btn {
  font-family: var(--font-display);
  font-weight: 600;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
button:hover, .btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}
button:active, .btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn.secondary, button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(32, 50, 42, 0.18);
}
.btn.secondary:hover, button.secondary:hover { background: var(--mint); color: var(--ink); }
.btn.danger, button.danger {
  background: var(--coral);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.btn.danger:hover, button.danger:hover { background: #ff8364; color: var(--ink); }
.btn-ghost, button.link {
  border-color: transparent;
  box-shadow: none;
  font-family: var(--font-body);
}
.btn-ghost:hover, button.link:hover { background: var(--mint); border-color: transparent; box-shadow: none; transform: none; }
button:disabled, .btn:disabled { box-shadow: none; transform: none; }

/* Cards and surfaces */
.card, .horse-card, .note-card, .form-card, .profile-hero, .login-card {
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
}
.card.hover:hover, .horse-card:hover {
  transform: translate(-2px, -2px) rotate(-0.35deg);
  box-shadow: var(--shadow-md);
  border-color: var(--ink);
}
.profile-photo, .avatar-lg { border: 2px solid var(--ink); }
.horse-photo { border-bottom: 2px solid var(--ink); }
.horse-body h3, .profile-body h1, .person-body h3 { font-family: var(--font-display); font-weight: 600; }
.horse-photo.placeholder-art, .placeholder-art {
  background: linear-gradient(135deg, var(--gold-soft), var(--pink));
  color: rgba(32, 50, 42, 0.5);
}

/* Stat cards */
.stat-grid .card:nth-child(1) { background: #fff1b8; }
.stat-grid .card:nth-child(2) { background: #dff5ff; }
.stat-grid .card:nth-child(3) { background: #def5e4; }
.stat-grid .card:nth-child(4) { background: #f0e7ff; }
.stat-icon {
  background: rgba(255, 253, 247, 0.65);
  border: 2px solid var(--ink);
  border-radius: 14px;
  box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.12);
}
.stat .big { color: var(--ink); }
.stat .label { color: var(--ink-soft); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #ffe08a 0%, #ffb86b 58%, #ff9a8b 100%);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}
.hero h1 { color: var(--ink); font-size: clamp(2.4rem, 4.5vw, 3.8rem); }
.hero p { color: rgba(32, 50, 42, 0.82); }
.hero .btn {
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}
.hero .btn:hover { background: var(--mint); color: var(--ink); }
.hero .btn.secondary {
  background: rgba(255, 253, 247, 0.38);
  color: var(--ink);
  border-color: var(--ink);
}
.hero .btn.secondary:hover { background: rgba(255, 253, 247, 0.78); }
.hero-art {
  color: var(--ink);
  opacity: 0.14;
  animation: playful-bob 6s ease-in-out infinite;
}
@keyframes playful-bob {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-8px) rotate(-4deg); }
}

/* Badges, chips, icons */
.badge {
  border: 2px solid var(--ink);
  background: var(--mint);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.14);
}
.badge.gold, .badge.badge-gold { background: var(--gold); border-color: var(--ink); color: var(--ink); }
.badge.moss, .badge.badge-moss { background: var(--mint); border-color: var(--ink); color: var(--ink); }
.badge.terracotta, .badge.badge-terracotta { background: var(--coral); border-color: var(--ink); color: var(--ink); }
.chip { border: 2px solid var(--ink); background: var(--surface); color: var(--ink); box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.12); }
.chip.badge.gold { background: var(--gold); }
.yard-icon {
  background: var(--sky);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.14);
}
.person-avatar {
  background: var(--mint);
  color: var(--ink);
  border: 2px solid var(--ink);
}

/* Notes, people, profiles */
.notes-grid .note-card:nth-child(1) { background: #fff1b8; }
.notes-grid .note-card:nth-child(2) { background: #dff5ff; }
.notes-grid .note-card:nth-child(3) { background: #def5e4; }
.notes-grid .note-card:nth-child(4) { background: #ffe4d9; }
.notes-grid .note-card:nth-child(5) { background: #f0e7ff; }
.note-card h3 { color: var(--ink-soft); }
.profile-hero { background: var(--surface); }

/* Timeline */
.timeline { border-left: 2px dashed #cdbb9c; }
.timeline-dot { background: var(--coral); border-color: var(--paper); box-shadow: 0 0 0 2px var(--gold); }
.timeline-title { color: var(--forest); }
.timeline-details { color: var(--ink-faint); }

/* Tables */
table { border: 2px solid var(--ink); box-shadow: 4px 4px 0 rgba(32, 50, 42, 0.14); }
th { background: var(--gold); color: var(--ink); }
th, td { border-bottom: 1px solid #e1d4bd; }
tbody tr:hover td { background: var(--surface-soft); }

/* Forms */
input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="file"], select, textarea {
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fffdf7;
  box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.08);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--sky);
}
input[type="file"]::file-selector-button {
  border: 2px solid var(--ink);
  background: var(--sky);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.14);
  font-family: var(--font-display);
  font-weight: 600;
}
.form-card { background: var(--surface); }
.check input { accent-color: var(--forest); }

/* Modals */
dialog.modal {
  border: 2px solid var(--ink);
  box-shadow: 10px 10px 0 var(--ink);
  border-radius: 26px;
}
.modal-close {
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.modal-close:hover { background: var(--coral); color: var(--ink); transform: translate(-1px, -1px); }
.modal-subtitle { color: var(--ink-soft); }

/* Sharing */
.switch-track { border: 2px solid var(--ink); background: #e1d4bd; }
.switch input:checked + .switch-track { background: var(--forest); }
.member-chip { border: 2px solid var(--ink); background: var(--surface); color: var(--ink); }
.member-chip:has(input:checked) { background: var(--gold); border-color: var(--ink); color: var(--ink); }

/* Alerts and empty states */
.flash { background: #def5e4; border: 2px solid var(--ink); color: var(--ink); box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.12); }
.error { background: #ffe0d6; border: 2px solid var(--ink); color: var(--ink); box-shadow: 2px 2px 0 rgba(32, 50, 42, 0.12); }
.note { background: var(--gold-soft); border-left: 4px solid var(--coral); }
.empty { border: 2px dashed var(--ink); background: rgba(255, 253, 247, 0.65); }
.empty-art { background: var(--gold); border: 2px solid var(--ink); box-shadow: 3px 3px 0 rgba(32, 50, 42, 0.14); }
.danger-zone { background: #fff1ec; border-color: var(--ink); }
.danger-zone h3 { color: var(--terracotta-dark); }

/* Login */
.login { background: var(--paper); }
.login-brand {
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 201, 74, 0.32) 0 4px, transparent 4.5px) 0 0 / 80px 80px,
    radial-gradient(circle at 82% 70%, rgba(123, 215, 242, 0.22) 0 3px, transparent 3.5px) 0 0 / 110px 110px,
    linear-gradient(150deg, #2b7a4e, #1f5b3d 70%, #194a33);
  border-right: 2px solid var(--ink);
}
.login-brand .brand { color: #fff8e8; }
.login-brand .brand-mark { background: var(--gold); color: var(--ink); }
.login-brand h2 { color: #fff8e8; }
.login-brand p { color: rgba(255, 248, 232, 0.82); }
.login-art { color: #fff8e8; opacity: 0.28; }
.login-quote { color: #fff8e8; border-left-color: var(--gold); }
.login-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--ink);
}
.login-card h1 { color: var(--ink); }
.login-footer { color: var(--ink-faint); }

@media (max-width: 640px) {
  .card, .horse-card, .note-card, .form-card, .profile-hero, .login-card { box-shadow: 3px 3px 0 rgba(32, 50, 42, 0.16); }
  .hero { box-shadow: 5px 5px 0 var(--ink); }
  .login-card { padding: 1.25rem; }
  .login-card h1 { font-size: 2rem; }
}

/* ============================================================
   Reference implementation theme
   Soft-sand canvas, white neo-brutalist cards, storybook accents.
   ============================================================ */
:root {
  --sand: #f8f5ee;
  --stone: #1c1917;
  --stone-soft: #44403c;
  --stone-muted: #78716c;
  --paper: #fffdf7;
  --surface: #fffdf7;
  --surface-raised: #ffffff;
  --emerald: #065f46;
  --emerald-2: #047857;
  --emerald-soft: #d1fae5;
  --amber: #fcd34d;
  --amber-soft: #fef3c7;
  --sky: #bae6fd;
  --sky-soft: #e0f2fe;
  --mint: #bbf7d0;
  --mint-soft: #dcfce7;
  --lilac: #e9d5ff;
  --lilac-soft: #f3e8ff;
  --rose: #fecdd3;
  --rose-soft: #ffe4e6;
  --rose-strong: #f87171;
  --peach: #fed7aa;
  --peach-soft: #ffedd5;
  --ink: #1c1917;
  --ink-soft: #57534e;
  --ink-faint: #78716c;
  --forest: #065f46;
  --forest-2: #047857;
  --gold: #fcd34d;
  --gold-soft: #fef3c7;
  --terracotta: #dc2626;
  --coral: #f87171;
  --line: #1c1917;
  --line-strong: #1c1917;
  --line-ink: #1c1917;
  --radius: 20px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --shadow-sm: 2px 2px 0 #1c1917;
  --shadow-md: 4px 4px 0 #1c1917;
  --shadow-lg: 8px 8px 0 #1c1917;
  --shadow-btn: 3px 3px 0 #1c1917;
}

.bg-soft-sand { background-color: #f8f5ee; background-image: none; }

html {
  background: var(--sand);
}

body {
  background-color: var(--sand);
  background-image: none;
  color: var(--stone);
  font-family: var(--font-body);
}

h1, h2, h3 {
  color: #064e3b;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.15rem, 4.2vw, 3.25rem); line-height: 1.03; }
h2 { font-size: clamp(1.55rem, 2.5vw, 2rem); }
h3 { font-size: 1.12rem; color: var(--stone); }

a { color: var(--emerald); }
a:hover { color: var(--emerald-2); }
:focus-visible { outline: 3px solid var(--emerald-2); outline-offset: 3px; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.container.page > * {
  max-width: none;
  margin-inline: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-head h1 { margin: 0.55rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.page-section { margin-top: 2.4rem; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.section-head h2 { margin: 0.5rem 0 0; }

.back-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  padding: 0.35rem 0.75rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 2px 2px 0 var(--stone);
  color: var(--stone-soft);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}

.back-link:hover { color: var(--stone); transform: translateY(-1px); }
.page-head .back-link { display: flex; }

.lede {
  max-width: 62ch;
  margin-top: 0.5rem;
  color: var(--stone-muted);
  font-size: 1rem;
}

/* ---------- Pills, badges, chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  padding: 0.22rem 0.7rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 1px 1px 0 var(--stone);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
}

.pill-amber { background: var(--amber); }
.role-pill { text-transform: none; letter-spacing: 0; font-size: 0.72rem; }
.pill-mint { background: var(--mint); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.58rem;
  border: 1.5px solid var(--stone);
  border-radius: 999px;
  background: #fff;
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.55;
  white-space: nowrap;
}

.badge-mint, .badge.mint, .badge.moss { background: var(--mint-soft); }
.badge-amber, .badge.gold { background: var(--amber-soft); }
.badge-rose, .badge.terracotta { background: var(--rose-soft); color: #9f1239; }
.badge-sky { background: var(--sky-soft); }
.badge-lilac { background: var(--lilac-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }

.eyebrow {
  display: inline-flex;
  width: fit-content;
  padding: 0.16rem 0.55rem;
  border: 1.5px solid var(--stone);
  border-radius: 999px;
  background: var(--amber);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.56rem 1rem;
  border: 2px solid var(--stone);
  border-radius: 12px;
  background: var(--emerald);
  box-shadow: var(--shadow-btn);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button:hover, .btn:hover {
  background: var(--emerald-2);
  color: #fff;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--stone);
}

button:active, .btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--stone);
}

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: 2px 2px 0 var(--stone);
}

.btn-primary, .btn.primary { background: var(--emerald); color: #fff; }
.btn-primary:hover, .btn.primary:hover { background: var(--emerald-2); }
.btn-secondary, .btn.secondary, button.secondary {
  background: #fff;
  color: var(--stone);
  box-shadow: 2px 2px 0 var(--stone);
}
.btn-secondary:hover, .btn.secondary:hover, button.secondary:hover {
  background: #fafaf9;
  color: var(--stone);
  box-shadow: 3px 3px 0 var(--stone);
}
.btn-rose, .btn.danger, button.danger {
  background: var(--rose-strong);
  color: var(--stone);
}
.btn-rose:hover, .btn.danger:hover, button.danger:hover { background: #ef4444; color: var(--stone); }
.btn-small, .btn.small, button.small { padding: 0.34rem 0.7rem; font-size: 0.72rem; border-radius: 10px; box-shadow: 2px 2px 0 var(--stone); }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--stone-soft);
  box-shadow: 2px 2px 0 var(--stone);
}
.icon-button:hover { background: var(--amber-soft); color: var(--stone); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--stone); }
.icon-button svg { width: 17px; height: 17px; }

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  inset: auto;
  z-index: 40;
  width: auto;
  background: rgba(255, 253, 247, 0.96);
  color: var(--stone);
  border-bottom: 2px solid var(--stone);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 1280px;
  min-height: 76px;
  margin: 0 auto;
  padding: 0.55rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--stone);
  flex-shrink: 0;
}

.brand:hover { color: var(--stone); }
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.04); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--stone);
  border-radius: 13px;
  background: var(--amber);
  color: var(--stone);
  box-shadow: 2px 2px 0 var(--stone);
  transform: rotate(0);
  transition: transform 0.2s ease;
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; color: var(--stone); }
.brand-tag { font-family: var(--font-body); font-size: 0.63rem; color: var(--stone-muted); letter-spacing: 0.03em; }

.main-nav { display: flex; align-items: center; gap: 0.25rem; flex: 1; justify-content: center; min-width: 0; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 0.9rem;
  border: 2px solid transparent;
  border-radius: 999px;
  color: var(--stone-soft);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}
.nav-link:hover { color: var(--stone); background: #f5f5f4; transform: none; }
.nav-link.is-active {
  border-color: var(--stone);
  background: var(--sky);
  color: var(--stone);
  box-shadow: 2px 2px 0 var(--stone);
  transform: translateY(-1px);
}

.context-nav { background: #fff; border-top: 1px solid #e7e5e4; }
.context-nav-inner { display: flex; align-items: center; gap: 0.25rem; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0.4rem 1.5rem; overflow-x: auto; }
.context-label { margin-right: 0.5rem; color: var(--stone-muted); font-family: var(--font-display); font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.context-link { padding: 0.28rem 0.65rem; border: 1.5px solid transparent; border-radius: 999px; color: var(--stone-soft); font-family: var(--font-display); font-size: 0.74rem; font-weight: 600; white-space: nowrap; }
.context-link:hover { background: #f5f5f4; color: var(--stone); }
.context-link.is-active { border-color: var(--stone); background: var(--amber); box-shadow: 1px 1px 0 var(--stone); color: var(--stone); }
.header-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.account-menu { position: relative; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem 0.3rem 0.3rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--stone);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}
.user-chip:hover { background: #fafaf9; transform: translateY(-1px); box-shadow: 3px 3px 0 var(--stone); }
.avatar-sm {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--stone);
  border-radius: 50%;
  background: var(--rose);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}
.chevron { width: 14px; height: 14px; color: var(--stone-muted); transition: transform 0.15s ease; }
.user-chip[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.55rem);
  width: 270px;
  padding: 0.6rem;
  border: 2px solid var(--stone);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 4px 4px 0 var(--stone);
  z-index: 60;
}
.account-dropdown[hidden] { display: none !important; }
.account-summary { padding: 0.55rem 0.6rem 0.7rem; border-bottom: 1px solid #e7e5e4; margin-bottom: 0.35rem; }
.account-name { margin: 0; font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; color: var(--stone); }
.account-email { margin: 0.1rem 0 0; font-size: 0.72rem; color: var(--stone-muted); overflow: hidden; text-overflow: ellipsis; }
.account-role {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.45rem;
  padding: 0.12rem 0.5rem;
  border: 1px solid #6ee7b7;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald);
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 700;
}
.account-role svg { width: 12px; height: 12px; }
.dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: var(--stone-soft);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: left;
  justify-content: flex-start;
}
.dropdown-link:hover { background: var(--amber-soft); color: var(--stone); transform: none; box-shadow: none; }
.dropdown-link svg { width: 15px; height: 15px; }
.dropdown-signout { color: #be123c; }
.dropdown-signout:hover { background: var(--rose-soft); color: #9f1239; }
.account-dropdown form { margin: 0; }
.sound-toggle .sound-on { display: none; }
.sound-toggle .sound-off { display: block; }
.sound-toggle[aria-pressed="true"] .sound-on { display: block; }
.sound-toggle[aria-pressed="true"] .sound-off { display: none; }

/* ---------- Cards and grids ---------- */
.brutal-card, .card {
  background: var(--paper);
  border: 2px solid var(--stone);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.card { padding: 1.2rem; }
.brutal-card-hover { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.brutal-card-hover:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--stone); }

.horse-grid { display: grid; gap: 1.25rem; align-items: stretch; }
.horse-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.horse-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.yard-grid { display: grid; gap: 1.25rem; }
.yard-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.person-grid { display: grid; gap: 1.25rem; }
.person-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.person-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.journal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }

.horse-card, .yard-card, .person-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  background: var(--paper);
  border: 2px solid var(--stone);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  color: var(--stone);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.horse-card:hover, .yard-card:hover, .person-card:hover {
  color: var(--stone);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--stone);
}

.horse-photo, .yard-photo, .person-photo {
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid var(--stone);
  background: linear-gradient(135deg, var(--amber-soft), var(--rose-soft));
}
.horse-photo { aspect-ratio: 4 / 3; }
.yard-photo { aspect-ratio: 16 / 10; }
.person-photo { aspect-ratio: 4 / 3; }
.horse-photo img, .yard-photo img, .person-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.horse-card:hover .horse-photo img, .yard-card:hover .yard-photo img, .person-card:hover .person-photo img { transform: scale(1.05); }
.portrait-initial {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 150px;
  background: linear-gradient(135deg, var(--amber-soft), var(--rose-soft));
  color: var(--stone-muted);
  font-family: var(--font-display);
  font-size: 3.6rem;
  font-weight: 700;
}

.horse-body, .yard-body, .person-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 1rem 1.1rem 1.15rem; flex: 1; }
.horse-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.horse-body h3, .yard-body h3, .person-body h3 { margin: 0; font-family: var(--font-display); font-size: 1.18rem; font-weight: 700; color: var(--stone); }
.horse-subtitle, .person-email { margin: 0; color: var(--stone-muted); font-size: 0.78rem; }
.horse-owner { margin: 0; color: var(--stone-muted); font-family: var(--font-body); font-size: 0.72rem; }
.horse-age { color: var(--stone-muted); font-family: var(--font-body); font-size: 0.75rem; }
.horse-note {
  margin: 0.25rem 0 0;
  padding: 0.3rem 0.45rem;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  background: #fffbeb;
  color: var(--stone-soft);
  font-size: 0.72rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.marking-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.marking-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border: 1.5px solid var(--stone);
  border-radius: 999px;
  background: var(--mint-soft);
  color: #065f46;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  box-shadow: 1px 1px 0 var(--stone);
}
.card-button, .card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: auto;
  padding: 0.45rem 0.7rem;
  border: 2px solid var(--stone);
  border-radius: 10px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--stone);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
}
.horse-body .card-button { margin-top: 0.6rem; }
.card-link { width: auto; align-self: flex-start; margin-top: 0.5rem; }
.horse-card:hover .card-button, .person-card:hover .card-button, .yard-card:hover .card-link { background: #fafaf9; }

.horse-yard-badge, .person-role-badge, .ownership-badge, .yard-state, .yard-count, .person-horse-count {
  position: absolute;
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.55rem;
  border: 1.5px solid var(--stone);
  border-radius: 999px;
  background: #fff;
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 700;
  box-shadow: 1px 1px 0 var(--stone);
  z-index: 1;
}
.horse-yard-badge, .person-role-badge, .yard-state, .ownership-badge { top: 0.6rem; left: 0.6rem; }
.person-horse-count { top: 0.6rem; right: 0.6rem; background: var(--amber); }
.yard-count { top: 0.6rem; left: 0.6rem; }
.yard-state { top: 0.6rem; left: 0.6rem; }
.ownership-badge { background: #fff; }

/* ---------- Hero strip and stats ---------- */
.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border: 2px solid var(--stone);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--stone);
}
.hero-strip h1 { margin: 0.35rem 0 0; font-size: clamp(1.7rem, 3vw, 2.3rem); }
.hero-strip-note { margin: 0; color: var(--stone-muted); font-family: var(--font-body); font-style: italic; font-size: 0.85rem; text-align: right; }

.stat-grid { display: grid; gap: 1rem; margin-top: 1.25rem; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-block {
  padding: 1.2rem 1.3rem;
  border: 2px solid var(--stone);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.stat-number { display: block; font-family: var(--font-display); font-size: clamp(2rem, 3vw, 2.7rem); font-weight: 700; line-height: 1; color: var(--stone); }
.stat-label { display: block; margin-top: 0.35rem; font-family: var(--font-display); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone-soft); }
.stat-yellow { background: #fef08a; }
.stat-sky { background: var(--sky); }
.stat-mint { background: var(--mint); }
.stat-lilac { background: var(--lilac); }
.stat-rose { background: var(--rose); }

/* ---------- Search / filters ---------- */
.search-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem;
  border: 2px solid var(--stone);
  border-radius: 16px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--stone);
}
.search-field { position: relative; flex: 1; min-width: 220px; }
.search-field svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--stone-muted); pointer-events: none; }
.search-field input {
  width: 100%;
  padding: 0.5rem 0.7rem 0.5rem 2.2rem;
  border: 1.5px solid #d6d3d1;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: none;
  font-size: 0.8rem;
}
.filter-tabs { display: flex; align-items: center; gap: 0.2rem; overflow-x: auto; }
.filter-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border: 2px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  color: var(--stone-muted);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.filter-tab:hover { background: #f5f5f4; color: var(--stone); transform: none; box-shadow: none; }
.filter-tab.is-active { border-color: var(--stone); background: var(--amber); color: var(--stone); box-shadow: 1px 1px 0 var(--stone); }

/* ---------- Profiles ---------- */
.profile-hero {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.6rem;
  align-items: center;
  margin-bottom: 1.4rem;
  padding: 1.4rem;
  background: var(--paper);
  border: 2px solid var(--stone);
  border-radius: var(--radius-xl);
  box-shadow: 6px 6px 0 var(--stone);
}
.profile-photo { width: 100%; aspect-ratio: 1; overflow: hidden; border: 2px solid var(--stone); border-radius: 22px; background: var(--amber-soft); box-shadow: 3px 3px 0 var(--stone); }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo .portrait-initial { min-height: 100%; font-size: 5rem; }
.profile-body h1 { margin: 0.6rem 0 0.4rem; }
.profile-body .lede { margin: 0.3rem 0 0; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 1rem; }
.nickname { margin-left: 0.35rem; color: var(--stone-muted); font-family: var(--font-body); font-size: 0.75em; font-style: italic; }

.contact-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin-bottom: 1.2rem; }
.contact-box { padding: 0.85rem 1rem; border: 2px solid var(--stone); border-radius: 14px; background: #fff; box-shadow: 2px 2px 0 var(--stone); }
.contact-danger { background: #fffbeb; }
.info-label { display: block; margin-bottom: 0.2rem; color: var(--stone-muted); font-family: var(--font-display); font-size: 0.63rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.contact-box a, .contact-box span:not(.info-label) { color: var(--stone); font-size: 0.8rem; font-weight: 600; overflow-wrap: anywhere; }
.person-yards { margin-top: 0.35rem; }
.person-yards-label { display: block; margin-bottom: 0.15rem; color: var(--stone-muted); font-family: var(--font-display); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.person-yards .chips { margin-top: 0.2rem; }

.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.info-box { padding: 1rem; border: 2px solid var(--stone); border-radius: 16px; box-shadow: 3px 3px 0 var(--stone); }
.info-box p { margin: 0.15rem 0 0; color: var(--stone); font-size: 0.84rem; }
.info-yellow { background: #fef08a; }
.info-sky { background: var(--sky); }
.info-mint { background: var(--mint); }
.info-peach { background: var(--peach); }
.info-lilac { background: var(--lilac); }
.info-rose { background: var(--rose); }

.owner-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.2rem; }
.owner-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border: 2px solid var(--stone);
  border-radius: 8px;
  background: #fff;
  box-shadow: 1px 1px 0 var(--stone);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
}
.owner-pill svg { width: 13px; height: 13px; color: var(--emerald); }
.owner-pill:hover { background: #fafaf9; transform: translateY(-1px); }

.marking-callout { margin-top: 1.4rem; padding: 1.1rem 1.25rem; }
.marking-callout h3 { margin: 0 0 0.6rem; }
.marking-callout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.marking-callout-grid > div { padding: 0.7rem 0.8rem; border: 1px solid #d6d3d1; border-radius: 10px; background: #fffbeb; }
.marking-callout-grid p { margin: 0; font-size: 0.82rem; }

.content-card { padding: 1rem 1.1rem; }
.account-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; }
.account-summary > div { display: flex; flex-direction: column; gap: 0.1rem; }
.account-summary strong { color: var(--stone); font-family: var(--font-display); font-size: 1.1rem; }
.account-summary .muted { font-size: 0.78rem; }
@media (max-width: 520px) { .account-summary { align-items: flex-start; flex-direction: column; } }
.transfer-list { display: grid; gap: 0.65rem; }
.transfer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 2px solid var(--stone);
  border-radius: 12px;
  background: #fffbeb;
}
.transfer-row strong { font-family: var(--font-display); font-size: 0.82rem; }
.transfer-row .muted { font-size: 0.72rem; }

.document-list { display: grid; gap: 0.65rem; }
.document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 2px solid var(--stone);
  border-radius: 12px;
  background: #fff;
}
.document-main { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.document-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 2px solid var(--stone);
  border-radius: 12px;
  background: var(--gold-soft);
  box-shadow: 2px 2px 0 var(--stone);
  color: var(--stone);
}
.document-icon svg { width: 25px; height: 25px; }
.document-icon-passport { background: #f8e8a6; }
.document-icon-dentist_record { background: #ddcdf8; }
.document-icon-veterinary_record { background: #bfe6f8; }
.document-icon-breed_registration { background: #f8d0b4; }
.document-icon-other { background: #c7f0d1; }
.document-copy { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.document-copy > a {
  overflow-wrap: anywhere;
  color: var(--forest-2);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
}
.document-copy > a:hover { color: var(--terracotta-dark); text-decoration: underline; }
.document-file { color: var(--ink-faint); font-size: 0.72rem; overflow-wrap: anywhere; }
.document-download {
  margin-left: 0.45rem;
  color: var(--terracotta);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}
.document-download:hover { color: var(--terracotta-dark); text-decoration: underline; }
.document-preview-modal { width: min(1120px, calc(100vw - 1.5rem)); max-height: calc(100vh - 1.5rem); }
.document-preview-actions { display: flex; align-items: center; gap: 0.5rem; }
.document-preview-body { padding-top: 0.8rem; }
.document-preview-body iframe {
  width: 100%;
  height: min(72vh, 760px);
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
}
.document-preview-body img {
  max-width: 100%;
  max-height: min(72vh, 760px);
  margin: 0 auto;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
}
.document-edit { margin-top: 0.25rem; }
.document-edit summary { width: fit-content; color: var(--forest-2); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.document-edit-form { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.document-edit-form input, .document-edit-form select {
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
}
.document-edit-form input { flex: 1; min-width: 180px; }
.document-row .btn { flex: none; }
@media (max-width: 520px) {
  .document-row { align-items: flex-start; flex-direction: column; }
}

.section-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.weight-list { display: grid; gap: 0.65rem; }
.weight-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.8rem 0.95rem;
  border: 2px solid var(--stone);
  border-radius: 12px;
  background: #fffbeb;
}
.weight-main { display: flex; flex-direction: column; min-width: 110px; }
.weight-value { color: var(--forest); font-family: var(--font-display); font-size: 1.18rem; font-weight: 700; }
.weight-details { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.7rem; }
.weight-method { color: var(--stone); font-size: 0.8rem; font-weight: 600; }
.weight-bcs {
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--stone);
  font-size: 0.7rem;
  font-weight: 700;
}
.weight-notes { flex-basis: 100%; margin: 0.1rem 0 0; color: var(--ink-soft); font-size: 0.8rem; }
.weight-row .btn { flex: none; }
@media (max-width: 520px) { .weight-row { flex-direction: column; } }

.note-list { display: grid; gap: 0.8rem; }
.note-card { padding: 0.95rem 1.05rem; }
.note-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.55rem; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.65rem; }
.note-source { background: var(--gold-soft); }
.note-text { margin: 0 0 0.65rem; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-audio { width: 100%; max-width: 420px; margin-top: 0.45rem; }
.note-voice-panel { margin-top: 0.8rem; padding: 0.8rem 0.9rem; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface-soft); }
.note-voice-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; margin-bottom: 0.7rem; }
.note-voice-actions #note-status { flex: 1; min-width: 160px; }
@media (max-width: 520px) { .note-head { flex-direction: column; } }

/* ---------- Care notes page ---------- */
.care-page { max-width: 1180px; }
.care-title-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.7rem;
}
.care-heading { text-align: center; }
.care-heading h1 { margin: 0.45rem 0 0; }
.care-back {
  justify-self: start;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--stone);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
}
.care-title-row > .btn { justify-self: end; }
.care-layout {
  display: grid;
  grid-template-columns: minmax(340px, 450px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.care-sidebar { display: grid; gap: 0.8rem; }
.care-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--stone);
}
.care-search svg { width: 18px; height: 18px; flex: none; color: var(--stone-muted); }
.care-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.care-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.care-filter {
  padding: 0.25rem 0.7rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: var(--surface);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.care-filter:hover { background: var(--gold-soft); color: var(--stone); }
.care-filter.is-active { background: var(--forest); color: var(--paper); }
.care-note-list { display: grid; gap: 0.7rem; }
.care-note-card {
  --care-bg: var(--surface);
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.95rem;
  border: 3px solid var(--stone);
  border-radius: 16px;
  background: var(--care-bg);
  box-shadow: 5px 5px 0 var(--stone);
  color: var(--stone);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.care-note-card:hover { transform: translate(-1px, -1px); box-shadow: 7px 7px 0 var(--stone); color: var(--stone); }
.care-note-card.is-selected { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--stone); }
.care-note-top { display: flex; align-items: center; gap: 0.45rem; }
.care-note-type {
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.care-note-date { color: var(--stone-muted); font-size: 0.68rem; }
.care-source-icon { display: inline-flex; width: 15px; height: 15px; color: var(--stone-muted); }
.care-source-icon svg { width: 15px; height: 15px; }
.care-note-card strong { font-family: var(--font-display); font-size: 0.9rem; line-height: 1.25; }
.care-vet { --care-bg: #bfe6f8; }
.care-dental { --care-bg: #ddcdf8; }
.care-farrier { --care-bg: #f8d0b4; }
.care-yard { --care-bg: #f8e8a6; }
.care-owner { --care-bg: #c7f0d1; }
.care-empty { padding: 1rem; border: 2px dashed var(--line-strong); border-radius: 14px; color: var(--ink-soft); }
.care-empty p { margin: 0; }
.care-detail { padding: 1.1rem 1.25rem; background: var(--surface); }
.care-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.care-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; color: var(--ink-soft); font-size: 0.78rem; }
.care-badge {
  --care-bg: var(--gold-soft);
  padding: 0.15rem 0.6rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: var(--care-bg);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.care-detail-title { margin: 1rem 0 0.8rem; font-size: clamp(1.4rem, 2.4vw, 2rem); }
.care-audio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 3px solid var(--stone);
  border-radius: 14px;
  background: #e2d5ff;
}
.care-audio audio { flex: 1; min-width: 220px; height: 38px; }
.care-audio-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border: 2px solid var(--stone);
  border-radius: 10px;
  background: var(--surface);
  color: var(--stone);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}
.care-audio-play { font-size: 0.6rem; }
.care-transcript {
  display: inline-block;
  margin-top: 0.65rem;
  padding: 0.18rem 0.6rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.care-detail-text { margin: 0.8rem 0 1rem; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.care-detail-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; }
.care-file {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border: 2px solid var(--stone);
  border-radius: 999px;
  background: var(--surface);
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
}
.care-file svg { width: 14px; height: 14px; }
.care-file:hover { background: var(--gold-soft); color: var(--stone); }
.care-detail-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: 1.1rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line-strong);
}
.care-detail-empty { padding: 1.4rem; background: var(--surface); }
.care-detail-empty h2 { margin-top: 0; }
.care-preview-list { display: grid; gap: 0.55rem; }
.care-preview-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 2px solid var(--stone);
  border-radius: 12px;
  background: var(--surface);
  color: var(--stone);
}
.care-preview-row:hover { background: var(--gold-soft); color: var(--stone); }
.care-preview-copy { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.care-preview-copy strong { font-family: var(--font-display); font-size: 0.84rem; }
@media (max-width: 900px) {
  .care-layout { grid-template-columns: 1fr; }
  .care-title-row { grid-template-columns: 1fr auto; }
  .care-heading { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .care-title-row > .btn { grid-column: 2; grid-row: 1; }
}

/* ---------- Journal ---------- */
.journal-card { padding: 1rem 1.1rem; background: #fff; }
.journal-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.45rem; color: var(--stone-muted); font-size: 0.7rem; }
.journal-card h3 { margin: 0; font-size: 0.9rem; }
.journal-card p { margin: 0.25rem 0 0; color: var(--stone-muted); font-size: 0.74rem; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1rem; max-width: 720px; }
.form-card { padding: 1.3rem; background: var(--paper); border: 2px solid var(--stone); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.form-layout { display: grid; grid-template-columns: minmax(0, 720px) minmax(240px, 320px); gap: 1.4rem; align-items: start; }
.form-aside { display: grid; gap: 1rem; align-self: start; }
.form-section { display: grid; gap: 0.9rem; padding-bottom: 1.2rem; border-bottom: 1px solid #e7e5e4; }
.form-section:last-of-type { padding-bottom: 0; border-bottom: 0; }
.form-section > h3 { margin: 0; font-size: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .field.full { grid-column: 1 / -1; }
.field { display: grid; gap: 0.3rem; }
.field label, .field > span.label, .field-label { color: var(--stone-soft); font-family: var(--font-display); font-size: 0.69rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], input[type="search"], input[type="file"], select, textarea {
  width: 100%;
  padding: 0.58rem 0.7rem;
  border: 2px solid var(--stone);
  border-radius: 10px;
  background: #fff;
  box-shadow: 2px 2px 0 rgba(28, 25, 23, 0.12);
  color: var(--stone);
  font: inherit;
  font-size: 0.85rem;
}
input[type="file"] { padding: 0.4rem; }
input[type="file"]::file-selector-button { margin-right: 0.5rem; padding: 0.35rem 0.6rem; border: 1.5px solid var(--stone); border-radius: 7px; background: var(--amber); color: var(--stone); font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--emerald-2); box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.18), 2px 2px 0 var(--stone); }
input:disabled { background: #f5f5f4; color: var(--stone-muted); }
textarea { min-height: 100px; resize: vertical; }
.hint { color: var(--stone-muted); font-size: 0.68rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding-top: 0.3rem; }
.check { display: flex; align-items: center; gap: 0.5rem; color: var(--stone-soft); font-size: 0.82rem; }
.check input { width: 16px; height: 16px; accent-color: var(--emerald); }
.plain-list { display: grid; gap: 0.35rem; margin: 0.55rem 0 0; padding-left: 1.1rem; color: var(--stone-muted); font-size: 0.78rem; }

/* ---------- Owner / portrait pickers ---------- */
.owner-picker { padding: 0.9rem; border: 2px solid var(--stone); border-radius: 14px; background: #fffbeb; box-shadow: 2px 2px 0 var(--stone); }
.owner-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
.owner-count { color: var(--stone-muted); font-family: var(--font-body); font-size: 0.7rem; }
.owner-options { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.owner-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border: 1.5px solid #d6d3d1;
  border-radius: 10px;
  background: #fff;
  color: var(--stone-soft);
  font-size: 0.74rem;
  cursor: pointer;
}
.owner-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.owner-option:has(input:checked) { border: 2px solid var(--stone); background: var(--emerald); color: #fff; box-shadow: 2px 2px 0 var(--stone); transform: translateY(-1px); }
.owner-avatar { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #f5f5f4; color: var(--stone); font-family: var(--font-display); font-size: 0.6rem; font-weight: 700; }
.owner-option:has(input:checked) .owner-avatar { background: var(--amber); }
.owner-name { font-family: var(--font-display); font-weight: 700; }
.owner-role { font-size: 0.62rem; opacity: 0.7; }

.portrait-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.portrait-option {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem;
  border: 2px solid #d6d3d1;
  border-radius: 12px;
  background: #fff;
  color: var(--stone);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.portrait-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.portrait-option img, .portrait-monogram { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1.5px solid var(--stone); border-radius: 8px; background: linear-gradient(135deg, var(--amber-soft), var(--rose-soft)); }
.portrait-monogram { display: grid; place-items: center; color: var(--stone-muted); font-size: 1.6rem; }
.portrait-option:has(input:checked) { border-color: var(--stone); background: var(--emerald-soft); box-shadow: 2px 2px 0 var(--stone); transform: translateY(-1px); }

/* ---------- Tables, timeline, notices ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 2px solid var(--stone); border-radius: 16px; background: #fff; box-shadow: 3px 3px 0 var(--stone); }
th, td { padding: 0.65rem 0.8rem; border-bottom: 1px solid #e7e5e4; text-align: left; vertical-align: middle; }
th { background: var(--amber); color: var(--stone); font-family: var(--font-display); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fffbeb; }
.table-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.table-actions form { margin: 0; }

.timeline { position: relative; padding-left: 1.2rem; border-left: 2px dashed #a8a29e; }
.timeline-item { position: relative; padding: 0 0 1.1rem 0.2rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -1.58rem; top: 0.35rem; width: 10px; height: 10px; border: 2px solid var(--stone); border-radius: 50%; background: var(--amber); }
.timeline-time { color: var(--stone-muted); font-size: 0.7rem; font-weight: 700; }
.timeline-title { color: var(--stone); font-weight: 700; }
.timeline-body, .timeline-details { color: var(--stone-muted); font-size: 0.8rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; }
.pager-slot { flex: 1; display: flex; }
.pager-slot-end { justify-content: flex-end; }
.pager-status { color: var(--stone-muted); font-size: 0.75rem; font-weight: 700; }

.flash, .error { margin: 0.8rem 0; padding: 0.7rem 0.9rem; border: 2px solid var(--stone); border-radius: 10px; box-shadow: 2px 2px 0 var(--stone); font-size: 0.82rem; font-weight: 700; }
.flash { background: var(--mint-soft); color: #065f46; }
.error { background: var(--rose-soft); color: #9f1239; }
.note { padding: 0.7rem 0.9rem; border: 1.5px solid #fcd34d; border-left: 4px solid var(--amber); border-radius: 8px; background: #fffbeb; color: var(--stone-soft); font-size: 0.8rem; }
.warning-box { padding: 0.85rem 1rem; border: 2px solid #f59e0b; border-radius: 12px; background: #fffbeb; color: var(--stone); font-size: 0.8rem; }
.warning-box strong { display: block; margin-bottom: 0.25rem; color: #92400e; }
.warning-box p { margin: 0; }

.empty { padding: 2.5rem 1.5rem; text-align: center; background: #fff; }
.empty h2 { margin: 0 0 0.35rem; }
.empty p { max-width: 44ch; margin: 0 auto 1rem; color: var(--stone-muted); font-size: 0.85rem; }
.empty-art { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 0.8rem; border: 2px solid var(--stone); border-radius: 18px; background: var(--amber); box-shadow: 2px 2px 0 var(--stone); }
.empty-art svg { width: 30px; height: 30px; }
.muted { color: var(--stone-muted); }
.small { font-size: 0.8rem; }
.mt-1 { margin-top: 0.75rem; }
.mt-2 { margin-top: 1.5rem; }
.mt-3 { margin-top: 2.4rem; }
.text-link { color: var(--emerald); font-family: var(--font-display); font-size: 0.76rem; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }

/* ---------- Modals ---------- */
dialog.modal {
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - 2rem));
  max-height: min(90vh, 860px);
  margin: 0;
  transform: translate(-50%, -50%);
  padding: 0;
  overflow: auto;
  border: 2px solid var(--stone);
  border-radius: 24px;
  background: var(--paper);
  color: var(--stone);
  box-shadow: 8px 8px 0 var(--stone);
}
dialog.modal.wide, dialog.modal-wide { width: min(760px, calc(100vw - 2rem)); }
dialog.modal::backdrop { background: rgba(28, 25, 23, 0.58); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.4rem 0; }
.modal-head h2 { margin: 0.45rem 0 0; font-size: 1.7rem; }
.modal-subtitle { margin: 0.3rem 0 0; color: var(--stone-muted); font-size: 0.8rem; }
.modal-close { width: 36px; height: 36px; padding: 0; border-radius: 50%; background: #fff; box-shadow: 2px 2px 0 var(--stone); color: var(--stone-soft); font-size: 1.2rem; flex-shrink: 0; }
.modal-close:hover { background: var(--rose-soft); color: var(--stone); transform: translateY(-1px); }
.modal-body { display: grid; gap: 0.9rem; padding: 1.1rem 1.4rem 1.3rem; }
.modal-body .form { max-width: none; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; flex-wrap: wrap; padding-top: 0.2rem; }
.modal-actions form { margin: 0; }
.modal-actions .btn { min-width: 100px; }
.modal .avatar-lg { width: 76px; height: 76px; }
.danger-zone { background: #fff1f2; border-color: var(--stone); }
.danger-zone h3 { color: #9f1239; }

/* ---------- Login ---------- */
.login {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 100vh;
  background: var(--paper);
}
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.2rem;
  padding: clamp(1.6rem, 4vw, 3.4rem);
  background: #1a4d3e;
  color: #fff;
  border-right: 2px solid var(--stone);
}
.login-brand-top { display: grid; gap: 1.6rem; }
.brand-on-dark .brand-name { color: #fef3c7; }
.brand-on-dark .brand-tag { color: rgba(209, 250, 229, 0.8); }
.brand-on-dark .brand-mark { background: var(--amber); }
.login-intro { max-width: 38rem; }
.login-intro h1 { margin: 0.9rem 0 0.8rem; color: #fff; font-size: clamp(2.2rem, 4vw, 3.4rem); }
.login-intro p { margin: 0; max-width: 40rem; color: #d1fae5; font-size: 1rem; }
.login-art-card { max-width: 440px; padding: 0.55rem; border: 2px solid #0e2a22; border-radius: 20px; background: #fffbeb; box-shadow: 6px 6px 0 #0e2a22; transform: rotate(-1deg); }
.login-art-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--stone); border-radius: 13px; }
.login-art-caption { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.25rem 0; color: var(--stone); font-family: var(--font-body); font-size: 0.75rem; font-weight: 700; }
.login-quote { margin: 0; color: #d1fae5; font-family: var(--font-body); font-size: 0.9rem; font-weight: 700; border-left: 4px solid var(--amber); padding-left: 0.8rem; }
.login-panel { display: grid; place-items: center; padding: clamp(1.4rem, 4vw, 3rem); background: var(--sand); }
.login-card { width: 100%; max-width: 430px; padding: clamp(1.4rem, 3vw, 2.2rem); box-shadow: 6px 6px 0 var(--stone); }
.login-card h2 { margin: 0.7rem 0 0.35rem; font-size: 2.2rem; }
.login-card > .muted { margin: 0; font-size: 0.85rem; }
.login-form { max-width: none; margin-top: 1.1rem; }
.login-card .error { margin: 0.8rem 0 0; }
.login-footer { display: flex; align-items: center; gap: 0.4rem; margin: 1rem 0 0; padding-top: 0.9rem; border-top: 1px solid #e7e5e4; color: var(--stone-muted); font-size: 0.7rem; }
.login-footer svg { width: 15px; height: 15px; color: var(--emerald); flex-shrink: 0; }

/* ---------- Error page ---------- */
.error-page { display: grid; place-items: center; min-height: 100vh; padding: 2rem 1rem; background: var(--sand); }
.error-page .empty { width: 100%; max-width: 520px; }
.error-page h1 { margin: 0.3rem 0 0.4rem; font-size: clamp(3rem, 8vw, 5rem); }

/* ---------- Responsive ---------- */
@media (max-width: 1120px) {
  .horse-grid.four, .person-grid.four { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .horse-grid.three, .person-grid.three, .yard-grid.three, .journal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .topbar-inner { flex-wrap: wrap; gap: 0.5rem; padding: 0.55rem 1rem; }
  .main-nav { order: 3; flex: 1 0 100%; justify-content: flex-start; flex-wrap: wrap; overflow: visible; padding-bottom: 0.25rem; gap: 0.1rem; }
  .nav-link { padding: 0.42rem 0.58rem; font-size: 0.78rem; }
  .brand-tag { display: none; }
  .header-actions { margin-left: auto; }
  .form-layout { grid-template-columns: 1fr; }
  .form-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 1fr; }
  .login-brand { border-right: 0; border-bottom: 2px solid var(--stone); }
  .login-art-card { display: none; }
  .login-quote { display: none; }
}

@media (max-width: 760px) {
  .container { padding: 1.25rem 1rem 3rem; }
  .topbar-inner { min-height: auto; }
  .brand-name { font-size: 1rem; }
  .user-chip .user-name { display: none; }
  .header-actions { gap: 0.4rem; }
  .horse-grid.four, .horse-grid.three, .person-grid.four, .person-grid.three,
  .yard-grid.three, .journal-grid, .info-grid, .stat-grid.four, .stat-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-hero { grid-template-columns: 1fr; }
  .profile-photo { max-width: 220px; }
  .hero-strip { align-items: flex-start; flex-direction: column; }
  .hero-strip-note { text-align: left; }
  .search-filter-bar { align-items: stretch; flex-direction: column; }
  .filter-tabs { overflow-x: auto; }
  .contact-grid, .form-aside { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .portrait-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: flex-start; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn { flex: 1; }
  .modal-actions .btn, .modal-actions button { flex: 1; }
  .login-intro h1 { font-size: 2.1rem; }
  .login-brand { padding: 1.4rem; }
  .login-panel { padding: 1.2rem 1rem 2rem; }
}

@media (max-width: 520px) {
  .horse-grid.four, .horse-grid.three, .person-grid.four, .person-grid.three,
  .yard-grid.three, .journal-grid, .info-grid, .stat-grid.four, .stat-grid.three { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .horse-photo, .person-photo { aspect-ratio: 16 / 10; }
  .modal-head, .modal-body { padding-left: 1rem; padding-right: 1rem; }
  .modal-actions { padding-left: 1rem; padding-right: 1rem; }
  .brand-tag { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
