:root {
  --bg: #06111c;
  --panel: #0b1b2a;
  --panel-2: #0f2538;
  --line: rgba(95, 225, 255, 0.18);
  --text: #e8f7ff;
  --muted: #93a9b8;
  --cyan: #22d3ee;
  --green: #2ee59d;
  --amber: #f59e0b;
  --red: #ef4444;
  --brand-red: #e30613;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 45% 0%, rgba(34, 211, 238, .18), transparent 28%), var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--cyan); text-decoration: none; }
button, .button {
  border: 1px solid rgba(34, 211, 238, .45);
  background: linear-gradient(135deg, rgba(34,211,238,.16), rgba(46,229,157,.12));
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}
.danger { border-color: rgba(239,68,68,.55); color: #fecaca; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  padding: 18px 14px;
  background: rgba(4, 13, 22, .94);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: width .2s ease, transform .2s ease;
}
.sidebar-collapse, .menu-toggle {
  width: 40px;
  min-height: 40px;
  padding: 0;
}
.sidebar-collapse { align-self: flex-end; }
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 40;
}
.menu-backdrop { display: none; }
.brand-mini { display: block; }
.brand-mini img { width: 100%; max-width: 210px; display: block; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a {
  color: var(--text);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar nav a:hover { border-color: var(--line); background: rgba(34,211,238,.08); }
.sidebar nav svg,
.header-logout svg,
button svg,
.button svg,
.back-link svg,
.social-link svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: currentColor;
}
.nav-logout {
  margin-top: 10px;
  color: #fecaca !important;
  border-color: rgba(239, 68, 68, .28) !important;
}
.partner-logos {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}
.partner-logos a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
  padding: 10px;
}
.partner-logos img {
  width: 100%;
  max-height: 86px;
  object-fit: contain;
  display: block;
}
.shell {
  margin-left: 250px;
  padding: 18px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 24, 38, .9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  margin-bottom: 18px;
}
.top-logo { height: 48px; width: auto; vertical-align: middle; margin-right: 18px; }
.system-status { color: var(--green); text-transform: uppercase; font-size: 13px; letter-spacing: .04em; font-weight: 700; }
.user-box { display: flex; gap: 14px; align-items: center; color: var(--muted); }
.user-profile-link {
  display: grid;
  gap: 2px;
  color: var(--text);
  text-align: right;
}
.user-name { font-weight: 700; }
.user-role { color: var(--muted); font-size: 12px; }
.header-logout {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, .35);
  border-radius: 8px;
  padding: 8px 10px;
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 24, 38, .92);
  padding: 25px 28px;
  box-shadow: 0 24px 90px rgba(0,0,0,.4);
}
.auth-logo {
  width: 220px;
  max-width: 100%;
  display: block;
  margin: 0 auto 18px;
}
.auth-title {
  text-align: center;
}
.auth-form {
  align-items: end;
}
.auth-form .auth-field {
  gap: 7px;
}
.auth-input-wrap {
  position: relative;
  display: block;
}
.auth-input-wrap input {
  padding-left: 40px;
  padding-right: 42px;
}
.auth-field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.auth-field-icon svg,
.auth-password-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}
.auth-password-toggle:hover {
  color: var(--text);
  background: rgba(34,211,238,.08);
}
.grid-form .auth-submit {
  justify-self: center;
  width: auto;
  min-width: 150px;
  min-height: 36px;
  padding: 8px 18px;
}
.auth-links {
  margin: 24px 0 0;
  text-align: center;
  white-space: nowrap;
}
.hero-panel, .panel {
  border: 1px solid var(--line);
  background: rgba(8, 24, 38, .86);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}
.dashboard-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 16px;
}
.hero-panel {
  min-height: 112px;
  display: flex;
  align-items: end;
  margin-bottom: 0;
}
.hero-panel p {
  margin-bottom: 0;
  line-height: 1.35;
}
h1, h2 { margin: 0 0 12px; letter-spacing: 0; }
p { color: var(--muted); }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 0;
}
.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.dashboard-charts .panel { margin-bottom: 0; }
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 37, 56, .82);
  padding: 12px;
  min-height: 112px;
}
.metric span { display: block; color: var(--muted); font-size: 12px; line-height: 1.25; }
.metric strong { display: block; margin-top: 10px; font-size: 22px; color: var(--text); overflow-wrap: anywhere; }
.metric-tone-1 strong { color: #facc15; }
.metric-tone-2 strong { color: #38bdf8; }
.metric-tone-3 strong { color: #f472b6; }
.metric-tone-4 strong { color: #2ee59d; }
.metric-tone-5 strong { color: #a78bfa; }
.metric-tone-6 strong { color: #fb923c; }
.bars { display: grid; gap: 12px; }
.chart-panel h2 { margin-bottom: 15px; }
.chart-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}
.chart-title-row h2 { margin-bottom: 0; }
.chart-nav {
  display: inline-flex;
  gap: 8px;
}
.chart-nav button {
  width: 36px;
  min-height: 34px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
}
.chart-nav button:disabled {
  color: #6b7280;
  border-color: rgba(107, 114, 128, .35);
  background: rgba(15, 23, 42, .38);
  cursor: default;
}
.bar-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 12px; align-items: center; }
.bar-row div { height: 12px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.bar-row i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); }
.vertical-bars {
  min-height: 260px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}
.vertical-bar {
  display: grid;
  grid-template-rows: 34px 180px auto;
  gap: 8px;
  min-width: 0;
  text-align: center;
}
.vertical-bar strong {
  color: #facc15;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.vertical-bar div {
  height: 180px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.vertical-bar i {
  width: 48%;
  min-height: 4px;
  display: block;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #facc15, var(--green));
}
.vertical-bar span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.grid-form.single { grid-template-columns: 1fr; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; min-width: 0; position: relative; }
label.wide, .grid-form button { grid-column: 1 / -1; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(3, 10, 18, .75);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  min-height: 40px;
}
input[type="date"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 1;
  cursor: pointer;
}
.date-filter {
  position: relative;
  min-width: 180px;
}
.date-filter::after {
  content: "📅";
  position: absolute;
  right: 10px;
  bottom: 10px;
  pointer-events: none;
}
.select-search {
  min-height: 34px;
  padding: 8px 10px;
  border-style: dashed;
}
.select2-container {
  width: 100% !important;
  max-width: 100% !important;
  color: var(--text);
  min-width: 0 !important;
}
.select2-container--default .select2-selection--single {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 10, 18, .75);
  display: flex;
  align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text);
  line-height: 40px;
  padding-left: 10px;
  padding-right: 28px;
  width: 100%;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 38px;
  right: 6px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--muted) transparent transparent transparent;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--muted) transparent;
}
.select2-dropdown {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071320;
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  z-index: 60;
}
.select2-container--open .select2-dropdown {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
.select2-container--open {
  width: 100% !important;
  max-width: 100% !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 10, 18, .95);
  color: var(--text);
  outline: 0;
}
.select2-results__option {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  padding: 8px 10px;
}
.select2-container--default .select2-results__option--selected {
  background: rgba(46,229,157,.18);
  color: var(--text);
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: rgba(34,211,238,.24);
  color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.audit-filters { align-items: end; }
.events-panel .panel-title {
  margin-bottom: 12px;
}
.audit-filters button {
  height: 40px;
  min-height: 40px;
  padding-block: 0;
}
.filter-hint {
  align-self: end;
  color: var(--muted);
  font-size: 12px;
  padding: 0 0 11px;
}
.inline-form { display: inline-flex; margin-left: 8px; }
.filters input, .filters select { width: auto; min-width: 160px; }
.public-search-panel {
  margin-top: 16px;
}
.horse-search-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}
.horse-search-form > label,
.grid-form > label {
  min-width: 0;
}
.horse-search-form .search-wide {
  grid-column: span 2;
}
.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.filter-actions button {
  gap: 8px;
}
.button.secondary {
  background: rgba(15, 37, 56, .66);
  color: var(--muted);
}
.search-summary {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.public-horse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.horse-card,
.public-horse-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: var(--text);
}
.public-horse-card {
  position: relative;
  min-height: 100%;
}
.public-horse-card:hover {
  border-color: rgba(34, 211, 238, .48);
  background: rgba(34, 211, 238, .07);
}
.public-horse-card strong {
  font-size: 16px;
}
.public-horse-card span {
  color: var(--text);
}
.public-horse-card .public-card-subtitle {
  font-size: 13px;
  line-height: 1.25;
}
.public-horse-card .public-card-total {
  color: var(--brand-red);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
}
.public-horse-card small {
  color: var(--muted);
  line-height: 1.35;
}
.public-horse-card em {
  position: absolute;
  top: 18px;
  right: 18px;
  border-radius: 999px;
  background: rgba(239, 68, 68, .86);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  padding: 4px 8px;
}
.horse-card img,
.public-horse-card img,
.photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(34,211,238,.12);
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-weight: 700;
}
.horse-card em { color: var(--muted); font-style: normal; }
.horse-card em.fallecido { color: #fecaca; }
.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}
.profile { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.public-profile-head {
  display: grid;
  gap: 16px;
}
.public-profile-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.profile-media {
  display: grid;
  gap: 10px;
}
.profile-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}
.back-link,
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 37, 56, .66);
  color: var(--muted);
  font-size: 13px;
}
.social-link {
  color: var(--text);
  border-color: rgba(227, 6, 19, .45);
  background: rgba(227, 6, 19, .13);
}
.back-link:hover,
.social-link:hover {
  color: var(--text);
  border-color: rgba(34, 211, 238, .45);
}
.back-link svg,
.social-link svg {
  width: 17px;
  height: 17px;
  flex-basis: 17px;
}
.horse-subtitle {
  color: var(--brand-red);
  font-weight: 800;
  letter-spacing: .02em;
}
.profile-photo { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.profile-photo.placeholder { display: grid; place-items: center; background: rgba(34,211,238,.12); }
.info-card-grid,
.genealogy-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.genealogy-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 0;
}
.info-card-grid article,
.genealogy-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  padding: 12px;
}
.info-card-grid article {
  min-height: 82px;
}
.info-card-grid article.tone-a { border-color: rgba(56, 189, 248, .34); background: rgba(56, 189, 248, .1); }
.info-card-grid article.tone-b { border-color: rgba(250, 204, 21, .38); background: rgba(250, 204, 21, .1); }
.info-card-grid article.tone-c { border-color: rgba(46, 229, 157, .36); background: rgba(46, 229, 157, .1); }
.info-card-grid article.tone-d { border-color: rgba(244, 114, 182, .34); background: rgba(244, 114, 182, .1); }
.info-card-grid article.tone-a strong { color: #38bdf8; }
.info-card-grid article.tone-b strong { color: #facc15; }
.info-card-grid article.tone-c strong { color: #2ee59d; }
.info-card-grid article.tone-d strong { color: #f472b6; }
.genealogy-grid article:nth-child(1) { border-color: rgba(56, 189, 248, .42); background: rgba(56, 189, 248, .11); }
.genealogy-grid article:nth-child(2) { border-color: rgba(244, 114, 182, .42); background: rgba(244, 114, 182, .1); }
.genealogy-grid article:nth-child(3) { border-color: rgba(250, 204, 21, .42); background: rgba(250, 204, 21, .1); }
.genealogy-grid article:nth-child(4) { border-color: rgba(46, 229, 157, .42); background: rgba(46, 229, 157, .1); }
.genealogy-grid article:nth-child(5) { border-color: rgba(167, 139, 250, .42); background: rgba(167, 139, 250, .1); }
.genealogy-grid article:nth-child(6) { border-color: rgba(251, 146, 60, .42); background: rgba(251, 146, 60, .1); }
.info-card-grid span,
.genealogy-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}
.info-card-grid strong,
.genealogy-grid strong {
  display: block;
  color: var(--text);
  overflow-wrap: anywhere;
}
.genealogy-grid strong {
  font-size: 14px;
  line-height: 1.25;
}
.detail-section p {
  margin-bottom: 0;
}
.profile-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.profile-summary article {
  min-width: 0;
}
.profile-summary h2 {
  font-size: 18px;
  margin-top: 0;
}
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(260px, 3fr);
  gap: 18px;
  align-items: start;
}
.profile-timeline-panel > p {
  margin-top: -4px;
  color: var(--muted);
}
.profile-timeline {
  margin-top: 18px;
  display: grid;
  gap: 18px;
}
.timeline-day {
  position: relative;
  padding-left: 22px;
}
.timeline-day::after {
  content: "";
  position: absolute;
  left: -2px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fde68a;
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .12);
}
.timeline-day::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 30px;
  bottom: 0;
  width: 2px;
  background: rgba(34, 211, 238, .22);
}
.timeline-day h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: #fde68a;
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0 12px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: var(--bg);
}
.timeline-item time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.timeline-item div {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, .22);
  border-radius: 8px;
  padding: 10px;
  background: rgba(4, 12, 22, .36);
}
.timeline-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
.timeline-item strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.timeline-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  max-width: 100%;
  max-height: 4.4em;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.profile-info-panel {
  position: sticky;
  top: 18px;
}
.profile-action-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.profile-action-row button,
.password-button {
  width: auto;
  min-width: 150px;
  min-height: 46px;
  padding: 0 18px;
}
.password-button {
  border-color: rgba(245, 158, 11, .62);
  background: rgba(245, 158, 11, .14);
  color: #fde68a;
}
.password-button:hover {
  border-color: rgba(245, 158, 11, .88);
  background: rgba(245, 158, 11, .2);
}
.password-modal {
  width: min(460px, 100%);
}
.children-list {
  display: grid;
  gap: 10px;
}
.children-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  padding: 12px;
  color: var(--text);
}
.children-list span {
  color: var(--text);
}
.children-list strong {
  color: #facc15;
  white-space: nowrap;
}
dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px; }
dt { color: var(--muted); }
dd { margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }
td input, td select { min-width: 120px; }
pre { white-space: pre-wrap; max-width: 340px; color: var(--muted); margin: 0; }
.alert {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}
.alert.ok { border-color: rgba(46,229,157,.45); color: #bbf7d0; }
.alert.error { border-color: rgba(239,68,68,.55); color: #fecaca; }
.debug-panel {
  border: 1px dashed rgba(245, 158, 11, .7);
  background: rgba(245, 158, 11, .08);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}
.debug-panel h2 { font-size: 16px; color: #fde68a; }
.debug-code {
  color: #fde68a;
  font-size: 22px;
  letter-spacing: .08em;
}
.audit-table,
.events-table,
.users-table,
.horses-table,
.ranking-table,
.audit-table th,
.audit-table td,
.events-table th,
.events-table td,
.users-table th,
.users-table td,
.horses-table th,
.horses-table td,
.ranking-table th,
.ranking-table td,
.dt-container {
  font-size: 12px;
}
.audit-table thead th {
  text-align: center !important;
}
.events-table thead th {
  text-align: center !important;
}
.users-table thead th {
  text-align: center !important;
}
.horses-table thead th {
  text-align: center !important;
}
.ranking-table thead th {
  text-align: center !important;
}
.ranking-table td {
  vertical-align: middle;
}
.ranking-photo-cell {
  width: 74px;
  text-align: center !important;
}
.ranking-photo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ranking-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
}
.ranking-thumb.placeholder {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.ranking-main-link {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.ranking-main-link:hover {
  color: var(--cyan);
}
.muted-cell {
  color: var(--muted);
}
.events-table .event-creator {
  width: 220px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
}
.status-badge.active {
  color: #bbf7d0;
  border: 1px solid rgba(46, 229, 157, .45);
  background: rgba(46, 229, 157, .14);
}
.status-badge.inactive {
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, .45);
  background: rgba(239, 68, 68, .14);
}
.checkbox-label input {
  width: auto;
  min-height: 0;
  justify-self: start;
}
.audit-table thead th.audit-date {
  text-align: center !important;
}
.audit-table th,
.audit-table td {
  font-weight: 400;
}
.audit-table .audit-date { width: 150px; white-space: nowrap; text-align: left !important; }
.audit-table .audit-actor { width: 190px; max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-table .audit-action { width: 82px; max-width: 82px; }
.audit-table .audit-entity { width: 130px; max-width: 130px; }
.audit-detail {
  display: block;
  width: 100%;
  max-width: 360px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audit-detail[data-expanded="1"] {
  white-space: pre-wrap;
  overflow: visible;
  max-width: none;
}
.audit-empty {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}
.stacked-dates {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
}
.row-actions {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  width: 100%;
}
.icon-action {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
}
.icon-action svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}
.icon-action.edit {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, .48);
  background: rgba(56, 189, 248, .12);
}
.icon-action.delete {
  color: #fecaca;
  border-color: rgba(239, 68, 68, .48);
  background: rgba(239, 68, 68, .12);
}
.icon-action.trophy {
  color: #bbf7d0;
  border-color: rgba(46, 229, 157, .55);
  background: rgba(46, 229, 157, .14);
}
.icon-action.org {
  color: #fde68a;
  border-color: rgba(245, 158, 11, .58);
  background: rgba(245, 158, 11, .14);
}
.form-errors {
  border: 1px solid rgba(239, 68, 68, .55);
  border-radius: 8px;
  padding: 10px;
  color: #fecaca;
  background: rgba(239, 68, 68, .08);
}
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .62);
}
.app-modal-backdrop[hidden] {
  display: none;
}
.app-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #081826;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .55);
  padding: 18px;
}
.app-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.app-modal header button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}
.confirm-modal {
  width: min(430px, 100%);
}
.horse-modal {
  width: min(980px, 100%);
}
.mini-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 12px;
}
.mini-table th,
.mini-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
}
.mini-table th {
  color: var(--muted);
  font-weight: 600;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.event-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 4px;
}
.event-action-col {
  width: 100%;
  display: flex;
  justify-content: center;
}
.save-button,
.cancel-button {
  grid-column: auto;
  gap: 8px;
  width: auto;
  min-width: 160px;
  justify-self: center;
}
.save-button {
  border-color: rgba(46, 229, 157, .55);
  background: rgba(46, 229, 157, .14);
  color: #bbf7d0;
}
.save-button:hover {
  border-color: rgba(46, 229, 157, .85);
  background: rgba(46, 229, 157, .2);
}
.cancel-button {
  border-color: rgba(239, 68, 68, .58);
  background: rgba(239, 68, 68, .13);
  color: #fecaca;
}
.cancel-button:hover {
  border-color: rgba(239, 68, 68, .85);
  background: rgba(239, 68, 68, .2);
}
.dt-container,
.dt-container .dt-search label,
.dt-container .dt-length label,
.dt-container .dt-info {
  color: var(--muted);
}
.dt-container .dt-layout-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.dt-container .dt-layout-cell {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
.dt-container .dt-length,
.dt-container .dt-search {
  display: flex !important;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.dt-container .dt-length label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.dt-container .dt-length select {
  width: auto !important;
  min-width: 74px;
}
.dt-container .dt-search input {
  width: 220px !important;
}
.dt-container .dt-search label,
.dt-container .dt-length label {
  margin: 0;
  white-space: nowrap;
}
.dt-container .dt-input,
.dt-container select {
  background: rgba(3, 10, 18, .75) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
}
.dt-container table.dataTable thead th {
  text-transform: uppercase;
}
.dt-container table.dataTable thead th.dt-orderable-asc,
.dt-container table.dataTable thead th.dt-orderable-desc,
.dt-container table.dataTable thead th.dt-ordering-asc,
.dt-container table.dataTable thead th.dt-ordering-desc {
  position: relative !important;
  padding-left: 30px !important;
  padding-right: 10px !important;
}
.dt-container table.dataTable thead th div.dt-column-header {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}
.dt-container table.dataTable thead th div.dt-column-header span.dt-column-order {
  position: static !important;
  order: -1 !important;
  flex: 0 0 12px !important;
  width: 12px !important;
  height: 18px !important;
}
.dt-container table.dataTable thead span.dt-column-order {
  left: 10px !important;
  right: auto !important;
}
.dt-container table.dataTable thead span.dt-column-order::before,
.dt-container table.dataTable thead span.dt-column-order::after {
  left: 0 !important;
  right: auto !important;
}
.dt-container .dt-paging .dt-paging-button {
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  margin: 0 2px;
  background: rgba(15, 37, 56, .72) !important;
}
.dt-container .dt-paging .dt-paging-button.current {
  background: rgba(34, 211, 238, .16) !important;
}
.dt-container .dt-paging .dt-paging-button.disabled,
.dt-container .dt-paging .dt-paging-button.disabled:hover {
  color: #6b7280 !important;
  border-color: rgba(107, 114, 128, .35) !important;
  background: rgba(15, 23, 42, .38) !important;
  opacity: 1 !important;
}
.site-footer {
  margin-top: auto;
  padding: 14px 0 4px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--cyan); }
.auth-footer { margin-top: 20px; }
.sidebar-collapsed .sidebar {
  width: 78px;
  padding-inline: 10px;
}
.sidebar-collapsed .brand-mini,
.sidebar-collapsed .partner-logos { display: none; }
.sidebar-collapsed .sidebar nav a {
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  width: 48px;
  min-height: 46px;
  justify-content: center;
  padding: 12px;
}
.sidebar-collapsed .sidebar nav a span { display: none; }
.sidebar-collapsed .shell { margin-left: 78px; }
.crop-canvas {
  display: none;
  width: 360px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020617;
  cursor: grab;
  touch-action: none;
}
.crop-canvas.dragging {
  cursor: grabbing;
}

@media (max-width: 1100px) {
  .menu-toggle { display: inline-flex; }
  .sidebar-collapse { display: none; }
  .sidebar {
    z-index: 35;
    transform: translateX(-105%);
    width: min(82vw, 320px);
    max-width: 320px;
    overflow-y: auto;
  }
  .mobile-menu-open .sidebar { transform: translateX(0); }
  .mobile-menu-open .menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, .48);
  }
  .sidebar-collapsed .sidebar { width: 260px; }
  .sidebar-collapsed .brand-mini,
  .sidebar-collapsed .partner-logos { display: block; }
  .sidebar-collapsed .sidebar nav a {
    max-width: none;
    width: auto;
    justify-content: flex-start;
  }
  .sidebar-collapsed .sidebar nav a span { display: inline; }
  .shell { margin-left: 0; padding-top: 62px; }
  .dashboard-summary { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-charts { grid-template-columns: 1fr; }
  .profile, .profile-layout, .grid-form, .horse-search-form, .public-profile-grid, .info-card-grid, .genealogy-grid, .profile-summary { grid-template-columns: 1fr; }
  .horse-search-form .search-wide { grid-column: auto; }
  .topbar { align-items: flex-start; gap: 12px; flex-direction: column; }
  .user-profile-link { text-align: left; }
  .profile-info-panel { position: static; }
}
