/* الخيل المصرية — الخيل المصرية
   Mobile-first, RTL, PWA / future Capacitor */
:root {
  --ink: #1A0F0A;
  --brown: #2A180E;
  --brown-2: #3C2415;
  --brown-3: #5C3A22;
  --gold: #C9A254;
  --gold-deep: #9A7430;
  --gold-soft: #E8D5A3;
  --cream: #F7F0E4;
  --sand: #EDE3D0;
  --paper: #FBF7F0;
  --text: #2A1C12;
  --muted: #6E5846;
  --line: rgba(201, 162, 84, 0.38);
  --card: #fffdf8;
  --shadow: 0 10px 30px rgba(26, 15, 10, 0.12);
  --radius: 16px;
  --header-h: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --serif: "Amiri", "Noto Naskh Arabic", serif;
  --touch: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--paper);
  line-height: 1.7;
  min-height: 100dvh;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brown-3); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold-deep); }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip-link {
  position: absolute; right: 1rem; top: 0; transform: translateY(-200%); background: var(--gold); color: var(--ink);
  padding: .5rem 1rem; z-index: 100; border-radius: 8px;
}
.skip-link:focus { transform: none; top: calc(var(--safe-t) + 8px); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(26, 15, 10, 0.94);
  color: var(--cream);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-t);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: 8px 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: inherit; text-decoration: none; min-height: var(--touch);
}
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--serif); font-size: 1.15rem; color: var(--gold-soft); font-weight: 700; }
.brand-text span { font-size: .75rem; color: rgba(247,240,228,.7); }

.nav-toggle {
  appearance: none; background: transparent; border: 1px solid var(--line);
  color: var(--cream); width: var(--touch); height: var(--touch);
  border-radius: 10px; display: grid; place-items: center; cursor: pointer;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--gold-soft); position: relative; content: "";
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }

.site-nav { display: none; }
.site-nav.open, .site-nav.is-desktop { display: block; }
.site-nav ul {
  list-style: none; margin: 0; padding: 8px 16px calc(12px + var(--safe-b));
  display: flex; flex-direction: column; gap: 4px;
}
.site-nav a {
  display: flex; align-items: center; min-height: var(--touch);
  padding: 0 12px; color: var(--cream); text-decoration: none; border-radius: 10px;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  background: rgba(201,162,84,.16); color: var(--gold-soft);
}

.header-inner { flex-wrap: wrap; }
.site-nav { width: 100%; }
@media (min-width: 1040px) {
  .nav-toggle { display: none; }
  .site-nav, .site-nav.open, .site-nav.is-desktop {
    display: block;
    width: auto;
    margin-inline-start: auto;
  }
  .site-nav ul {
    flex-direction: row; align-items: center; padding: 0;
    flex-wrap: wrap;
  }
  .site-nav a { font-size: .92rem; }
}

/* Layout */
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
.page { padding-bottom: calc(40px + var(--safe-b)); }

/* Hero */
.hero {
  position: relative;
  color: var(--cream);
  background: var(--ink) center/cover no-repeat;
  min-height: min(78vh, 640px);
  display: flex; align-items: flex-end;
  isolation: isolate;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(26,15,10,.25) 0%, rgba(26,15,10,.55) 40%, rgba(26,15,10,.92) 100%);
  z-index: 0;
}
.hero-inner {
  position: relative; z-index: 1; width: 100%;
  max-width: 1180px; margin: 0 auto;
  padding: 32px 16px calc(28px + var(--safe-b));
}
.eyebrow {
  display: inline-block; color: var(--gold-soft); letter-spacing: .08em;
  font-size: .8rem; margin-bottom: 8px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  line-height: 1.35; margin: 0 0 12px;
}
.hero p.lead { font-size: 1.05rem; max-width: 40rem; color: rgba(247,240,228,.9); margin: 0 0 20px; }

/* Search card */
.search-card {
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
  border: 1px solid var(--line);
}
.tabs { display: flex; gap: 6px; margin-bottom: 12px; background: var(--sand); padding: 4px; border-radius: 12px; }
.tab-btn {
  flex: 1; min-height: var(--touch); border: 0; border-radius: 10px;
  background: transparent; color: var(--brown-3); cursor: pointer; font-weight: 700;
  line-height: 1.25; padding: 6px 8px;
}
.tab-btn[aria-selected="true"] { background: var(--brown); color: var(--gold-soft); }
.search-box { position: relative; }
.search-box input {
  width: 100%; min-height: 52px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--paper);
  padding: 10px 44px 10px 14px; color: var(--text);
}
.search-box .icon-search {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--gold-deep); pointer-events: none;
}
.search-hint { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.results { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.result-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px; min-height: var(--touch);
  background: var(--cream); border-radius: 12px; text-decoration: none; color: inherit;
  border: 1px solid transparent;
}
.result-item .meta { flex: 1 1 10rem; text-align: start; }
.result-item:hover { border-color: var(--gold); }
.result-item .name-ar { font-weight: 700; display: block; }
.result-item .name-en { font-size: .85rem; color: var(--muted); }
.result-item .meta { font-size: .8rem; color: var(--muted); }

/* Sections */
.section { padding: 36px 0; }
.section h2 {
  font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin: 0 0 8px; color: var(--brown);
}
.section .sub { color: var(--muted); margin: 0 0 20px; }
.intro-grid, .cards, .timeline { display: grid; gap: 16px; }
@media (min-width: 760px) {
  .intro-grid { grid-template-columns: 1.2fr .8fr; align-items: start; }
  .cards { grid-template-columns: repeat(3, 1fr); }
}

.card, .news-card, .person-card, .horse-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 16px rgba(26,15,10,.05);
}
.card { padding: 20px; }
.card h3, .horse-card h3, .person-card h3, .news-card h3 {
  font-family: var(--serif); margin: 0 0 8px; font-size: 1.25rem;
}
.media-frame { aspect-ratio: 4/3; overflow: hidden; background: var(--sand); }
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.horse-card a, .person-card a, .news-card a { color: inherit; text-decoration: none; display: block; }
.horse-card .body, .person-card .body, .news-card .body { padding: 14px 16px 18px; }
.caption { font-size: .75rem; color: var(--muted); margin-top: 6px; }

.badge, .verified {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: rgba(201,162,84,.18); color: var(--gold-deep);
  border: 1px solid var(--line); white-space: nowrap;
}
.verified::before { content: "✓"; font-weight: 900; }
.status-upcoming { background: #e8f4ea; color: #215c2e; border-color: #b7d8be; }
.status-current { background: #f7ecd4; color: #7a4b00; border-color: var(--gold); }
.status-past, .status-listed { background: var(--sand); color: var(--muted); }

/* Timeline */
.timeline { position: relative; padding-right: 20px; }
.timeline::before {
  content: ""; position: absolute; right: 5px; top: 0; bottom: 0; width: 2px; background: var(--line);
}
.tl-item { position: relative; padding: 0 24px 24px 0; }
.tl-item::before {
  content: ""; position: absolute; right: 0; top: 8px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--paper);
}
.tl-item time, .tl-year {
  display: block; color: var(--gold-deep); font-weight: 800; font-size: .9rem;
}
.tl-item h3 { margin: 4px 0 6px; font-family: var(--serif); }
.source-link { font-size: .85rem; }

/* Horse page */
.horse-hero, .person-hero {
  background: linear-gradient(180deg, var(--brown) 0%, var(--ink) 100%);
  color: var(--cream); padding: 24px 0 28px;
}
.kicker { color: var(--gold-soft); font-size: .85rem; margin: 0 0 6px; }
.horse-hero h1, .person-hero h1 {
  font-family: var(--serif); margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem);
}
.en-name { margin: 4px 0 12px; color: rgba(247,240,228,.75); font-size: 1.05rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; padding: 0; list-style: none; }
.facts li { font-size: .95rem; }
.facts strong { color: var(--gold-soft); font-weight: 700; margin-left: 6px; }
.toolbar-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--touch); padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--brown-2); color: var(--gold-soft);
  text-decoration: none; cursor: pointer; font-weight: 700;
}
.btn-ghost { background: transparent; color: var(--cream); }
.btn-gold { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn-light { background: var(--card); color: var(--brown); }

/* Pedigree */
.pedigree-panel { background: var(--sand); border-radius: 20px; padding: 12px; border: 1px solid var(--line); }
.pedigree-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-wrap: wrap; margin-bottom: 8px;
}
.pedigree-toolbar .tools { display: flex; gap: 6px; }
.pedigree-toolbar button {
  min-width: var(--touch); min-height: var(--touch); border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700;
}
.pedigree-hint { font-size: .8rem; color: var(--muted); margin: 0; }
.pedigree-scroll {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y pinch-zoom;
  overscroll-behavior: contain;
  max-height: min(78vh, 820px);
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    repeating-linear-gradient(135deg, transparent, transparent 10px, rgba(201,162,84,.05) 10px, rgba(201,162,84,.05) 20px);
  border-radius: 14px;
  padding: 12px;
  cursor: grab;
}
.pedigree-scroll:active { cursor: grabbing; }
.pedigree-tree {
  transform-origin: top right;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  min-width: 920px;
  width: max-content;
  padding: 8px;
}
.ped-col {
  display: flex; flex-direction: column; justify-content: space-around;
}
.ped-slot {
  flex: 1; display: flex; align-items: center;
  min-height: 52px; position: relative;
}
.ped-col[data-gen="4"] .ped-slot { min-height: 36px; }
.p-node, .p-unknown {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 8px;
  width: 148px; min-height: 52px;
  box-shadow: 0 1px 0 rgba(26,15,10,.04);
  position: relative;
}
.ped-col[data-gen="0"] .p-node {
  width: 170px; min-height: 72px; background: var(--brown); color: var(--cream);
  border-color: var(--gold);
}
.ped-col[data-gen="0"] .p-node .en { color: rgba(247,240,228,.7); }
.p-node .ar { font-weight: 800; font-size: .9rem; display: block; line-height: 1.3; }
.p-node .en { font-size: .7rem; color: var(--muted); display: block; }
.p-node .yr { font-size: .68rem; color: var(--muted); }
.ped-col[data-gen="0"] .p-node .yr { color: var(--gold-soft); }
.p-unknown { background: #f3eee6; color: var(--muted); font-size: .75rem; display: flex; align-items: center; }
.p-node.has-title { border-color: var(--gold-deep); }
.medal {
  position: absolute; top: -7px; left: -7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(180deg, #f3d989, #c9a254);
  color: var(--ink); font-size: 12px;
  display: grid; place-items: center;
  border: 1px solid #8a6a28;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  cursor: pointer; z-index: 2;
}
.connector {
  width: 16px; position: relative;
}
.ped-pair { display: flex; flex: 1; flex-direction: column; }
/* vertical bar between sire/dam groups */
.ped-join {
  display: flex; flex-direction: row; align-items: stretch; flex: 1;
}
.ped-join .bar {
  width: 14px; position: relative;
}
.ped-join .bar::before {
  content: ""; position: absolute; top: 25%; bottom: 25%; left: 0;
  border-top: 1px solid var(--gold-deep);
  border-bottom: 1px solid var(--gold-deep);
  border-left: 1px solid var(--gold-deep);
  width: 8px;
}
.ped-join .bar::after {
  content: ""; position: absolute; top: 50%; left: 8px; width: 8px;
  border-top: 1px solid var(--gold-deep);
}

/* Champions list */
.champ-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.champ-list li {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.champ-list a { font-weight: 700; text-decoration: none; }
.muted { color: var(--muted); }
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 800px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Tooltip / popover for medals on touch */
.medal-pop {
  position: absolute; z-index: 80; max-width: 260px;
  background: var(--ink); color: var(--cream);
  padding: 8px 10px; border-radius: 10px; font-size: .8rem;
  box-shadow: var(--shadow); border: 1px solid var(--gold);
}
.medal-pop::after {
  content: ""; position: absolute; top: 100%; right: 12px;
  border: 6px solid transparent; border-top-color: var(--ink);
}

/* Admin form */
.form { display: grid; gap: 12px; max-width: 640px; }
.form label { font-weight: 700; display: grid; gap: 6px; }
.form input, .form select, .form textarea {
  min-height: var(--touch); border-radius: 10px; border: 1px solid var(--line);
  padding: 8px 12px; background: #fff;
}
.form textarea { min-height: 100px; resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Footer */
.site-footer {
  background: var(--ink); color: rgba(247,240,228,.8);
  padding: 28px 16px calc(24px + var(--safe-b));
  border-top: 1px solid var(--line);
}
.footer-inner { max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; }
@media (min-width: 700px) { .footer-inner { grid-template-columns: 1.2fr 1fr; } }
.site-footer h2 { font-family: var(--serif); color: var(--gold-soft); margin: 0 0 8px; font-size: 1.2rem; }
.site-footer a { color: var(--gold-soft); }
.tiny { font-size: .8rem; color: rgba(247,240,228,.6); }
.page .tiny, .coi-box .tiny, .section .tiny { color: var(--muted); }
.copyright {
  max-width: 1180px; margin: 20px auto 0;
  padding-top: 16px; border-top: 1px solid var(--line);
  font-size: .9rem; color: var(--gold-soft); font-weight: 700;
}
.data-error {
  background: #f7e4d4; color: #5c2a12; border-bottom: 1px solid #e0b08a;
  padding: 12px 0;
}
.data-error p { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.empty { text-align: center; color: var(--muted); padding: 20px 8px; }

/* Definition callout */
.callout {
  background: linear-gradient(180deg, #fff, var(--cream));
  border-right: 4px solid var(--gold);
  padding: 16px 18px; border-radius: 0 12px 12px 0;
}

/* Install hint: once-only iPhone Safari Add to Home Screen */
.install-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  max-width: 100%;
  box-sizing: border-box;
}
.install-hint[hidden] { display: none !important; }
.install-hint p { margin: 0; flex: 1; min-width: 0; }
.install-hint-dismiss {
  flex: 0 0 auto;
  min-width: var(--touch);
  min-height: var(--touch);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
}
.install-hint-dismiss:hover, .install-hint-dismiss:focus-visible { color: var(--brown); background: var(--sand, #f3efe6); }

@media (max-width: 759px) {
  .cards { grid-template-columns: 1fr; }
  .ped-tree-note { display: block; }
}

/* Racing */
.race-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.race-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  min-height: 40px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700;
}
.chip[aria-pressed="true"] { background: var(--brown); color: var(--gold-soft); border-color: var(--gold); }
.race-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.race-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: grid; gap: 4px;
}
.race-item .top { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.flag-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 700;
  background: var(--sand); border-radius: 999px; padding: 2px 10px;
}
.race-pos { font-weight: 800; color: var(--gold-deep); }
.race-icon {
  position: absolute; top: -7px; right: -7px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #2c4a3a; color: #e8f4ea;
  font-size: 11px; display: grid; place-items: center;
  border: 1px solid #1a3328; cursor: pointer; z-index: 2;
}
.p-node.has-race { box-shadow: inset 0 -2px 0 #2c4a3a; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.legend-row span { display: inline-flex; align-items: center; gap: 4px; }

/* Asayel brand + section layout */
.brand-text strong { font-family: var(--serif); font-size: 1.25rem; letter-spacing: .02em; }
.brand-text span { font-size: .75rem; color: var(--gold-soft); }

.section-subnav {
  background: var(--brown);
  border-bottom: 1px solid var(--line);
}
.section-subnav ul {
  list-style: none; margin: 0 auto; padding: 0 16px;
  max-width: 1180px; display: flex; flex-wrap: wrap; gap: 4px;
}
.section-subnav a {
  display: flex; align-items: center; min-height: 44px;
  padding: 0 12px; color: var(--cream); text-decoration: none;
  border-radius: 10px; font-weight: 700; font-size: .92rem;
}
.section-subnav a[aria-current="page"], .section-subnav a:hover {
  background: rgba(201,162,84,.16); color: var(--gold-soft);
}

.badge-se {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(180deg, #e8d5a3, #c9a254);
  color: #2A180E; font-weight: 800; font-size: .75rem;
  padding: 2px 10px; border-radius: 999px; border: 1px solid #9A7430;
  letter-spacing: .02em;
}
.badge-open {
  display: inline-flex; align-items: center;
  background: #2c4a3a; color: #e8f4ea;
  font-weight: 800; font-size: .75rem;
  padding: 2px 10px; border-radius: 999px; border: 1px solid #1a3328;
  letter-spacing: .02em;
}
.badge-line {
  display: inline-flex; align-items: center;
  background: var(--sand); color: var(--brown);
  font-weight: 700; font-size: .75rem;
  padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line);
}

.section-cards {
  display: grid; gap: 16px; margin-top: 8px;
}
@media (min-width: 760px) {
  .section-cards { grid-template-columns: 1fr 1fr; }
}
.gateway-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 22px 22px 24px;
  box-shadow: var(--shadow); min-height: 180px;
  transition: transform .15s ease, border-color .15s ease;
}
.gateway-card:hover { transform: translateY(-2px); border-color: var(--gold); color: inherit; }
.gateway-card .eyebrow { color: var(--gold-deep); font-weight: 800; font-size: .8rem; }
.gateway-card h2 { font-family: var(--serif); color: var(--brown); margin: 6px 0 8px; font-size: 1.7rem; }
.gateway-card p { margin: 0; color: var(--muted); }
.gateway-card.se { background: linear-gradient(180deg, #fffdf8, #f3e6c8); }

.search-filters {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: center; margin-top: 12px;
}
.search-filters label { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 700; margin: 0; }
.search-filters select {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; padding: 0 10px; color: var(--text);
}
.toggle {
  cursor: pointer; user-select: none;
  background: var(--sand); border-radius: 999px; padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
}
.toggle input { width: 18px; height: 18px; accent-color: var(--brown); }
.search-filters.is-locked-se .toggle { background: #e8d5a3; border-color: var(--gold); }

/* Calendar tables */
.cal-filters {
  display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0 20px; align-items: end;
}
.cal-filters label { display: grid; gap: 4px; font-weight: 700; font-size: .85rem; }
.cal-filters select, .cal-filters button {
  min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; padding: 0 12px;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table.cal {
  width: 100%; border-collapse: collapse; min-width: 640px; font-size: .95rem;
}
table.cal th, table.cal td {
  padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.cal th {
  background: var(--brown); color: var(--gold-soft); font-weight: 800; font-size: .85rem;
}
table.cal tr:last-child td { border-bottom: 0; }
table.cal tbody tr:hover { background: var(--sand); }

.kicker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Terms and error pages */
.terms-page .section { padding: 16px 0; }
.terms-page .section h2 { font-size: 1.35rem; }
.terms-page p { max-width: 70ch; }
.error-page { padding-top: 48px; padding-bottom: calc(80px + var(--safe-b)); }
.pedigree-source { margin-top: 8px; }

/* ===== Classic pedigree table (Asayel theme) ===== */
.ped-classic { padding: 14px; }
.ped-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ped-subject { background: var(--brown); color: var(--cream); border: 1px solid var(--gold); border-radius: 12px; padding: 8px 14px; display: flex; flex-direction: column; }
.ped-subject-name { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: .04em; font-size: 1.05rem; color: var(--gold-soft); }
.ped-subject-meta { font-size: .75rem; color: rgba(247,240,228,.75); }
.ped-gens { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
.ped-gens button { min-width: 40px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 800; cursor: pointer; color: var(--brown-3); }
.ped-gens button[aria-pressed="true"] { background: var(--brown); color: var(--gold-soft); border-color: var(--gold); }
.ped-scroll-hint { display: none; font-size: .78rem; color: var(--gold-deep); margin: 0 0 6px; }
.ped-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.ped-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 760px; table-layout: fixed; direction: rtl; }
.ped-table.ped-g3 { min-width: 0; }
.ped-table.ped-g4 { min-width: 620px; }
.ped-table th { position: sticky; top: 0; background: var(--sand); color: var(--brown-3); font-size: .72rem; font-weight: 800; padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); z-index: 2; }
.ped-table td.pc { position: relative; vertical-align: middle; padding: 4px 8px 4px 10px; border-bottom: 1px solid rgba(154,116,48,.22); border-left: 1px solid rgba(154,116,48,.22); line-height: 1.25; }
.ped-table td.pc-sire { background: #EEF2F4; box-shadow: inset -3px 0 0 #8FA6B4; }
.ped-table td.pc-dam { background: #F7EAE4; box-shadow: inset -3px 0 0 #C9A08F; }
.ped-table td.pc-g1 { padding-top: 10px; padding-bottom: 10px; }
.ped-table td.pc-g1.pc-sire { background: #E3EAEE; }
.ped-table td.pc-g1.pc-dam { background: #F2DFD6; }
.ped-table td.pc-empty { background: #FAF6EE; box-shadow: none; text-align: center; }
.pc-dash { color: #C2B39A; font-weight: 700; }
.pc-link { display: block; text-decoration: none; color: inherit; }
.pc-link:hover .pc-name, .pc-link:focus .pc-name { color: var(--gold-deep); text-decoration: underline; }
.pc-name { display: block; font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: .78rem; letter-spacing: .02em; color: var(--brown); text-align: right; overflow-wrap: anywhere; }
.pc-g1 .pc-name { font-size: .92rem; }
.pc-g2 .pc-name { font-size: .85rem; }
.pc-g5 .pc-name { font-size: .72rem; }
.pc-meta { display: block; font-size: .66rem; color: var(--muted); }
.pc-badges { display: inline-flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.pc-badges:empty { display: none; }
.ped-table td.pc-dup { box-shadow: inset -6px 0 0 var(--dup); }
.ped-table td.pc-dup .pc-name { color: var(--dup); }
.pb { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: .62rem; font-weight: 800; line-height: 1; border: 1px solid transparent; cursor: default; font-family: var(--font); }
.pb-se { background: rgba(201,162,84,.22); color: var(--gold-deep); border-color: rgba(154,116,48,.4); }
.pb-medal { background: linear-gradient(180deg, #f3d989, #c9a254); color: var(--ink); border-color: #8a6a28; cursor: pointer; padding: 0; width: 18px; }
.pb-race { background: #2c4a3a; color: #e8f4ea; border-color: #1a3328; cursor: pointer; padding: 0; width: 18px; font-size: .6rem; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.lg-sire { background: #EEF2F4; box-shadow: inset -3px 0 0 #8FA6B4; border: 1px solid #cfd8de; }
.lg-dam { background: #F7EAE4; box-shadow: inset -3px 0 0 #C9A08F; border: 1px solid #e6cfc4; }
.ped-filled { font-weight: 700; color: var(--brown-3); }
.ped-inbr-wrap { margin-top: 12px; }
.ped-inbr-wrap h3 { font-size: .95rem; margin: 0 0 2px; color: var(--brown); }
.ped-inbr { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ped-inbr li { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .78rem; }
.ped-inbr .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--dup); }
.ped-inbr a { color: var(--dup); font-weight: 800; text-decoration: none; font-family: Georgia, serif; }
.ped-inbr .x { color: var(--muted); }
.ped-inbr-none { font-size: .8rem; color: var(--muted); }
@media (max-width: 759px) {
  .ped-scroll-hint { display: block; }
  .ped-table td.pc-first, .ped-table th.pc-first { position: sticky; right: 0; z-index: 3; }
  .ped-table th.pc-first { z-index: 4; }
  .ped-table td.pc-first { width: 104px; box-shadow: inset -3px 0 0 #8FA6B4, -4px 0 8px -4px rgba(26,15,10,.25); }
  .ped-table td.pc-first.pc-dam { box-shadow: inset -3px 0 0 #C9A08F, -4px 0 8px -4px rgba(26,15,10,.25); }
  .ped-table td.pc-first.pc-dup { box-shadow: inset -6px 0 0 var(--dup), -4px 0 8px -4px rgba(26,15,10,.25); }
  .ped-table th.pc-first { width: 104px; }
  .ped-table.ped-g5 { min-width: 600px; }
  .ped-table.ped-g4 { min-width: 520px; }
  .ped-table.ped-g3 { min-width: 0; }
  .pc-g1 .pc-name { font-size: .8rem; }
}

/* ===== Progeny / siblings tables ===== */
.rel-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.rel-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 520px; }
.rel-table th { background: var(--sand); color: var(--brown-3); text-align: right; padding: 8px 10px; font-size: .75rem; }
.rel-table td { padding: 8px 10px; border-top: 1px solid rgba(154,116,48,.18); vertical-align: middle; }
.rel-table tr:nth-child(even) td { background: #fdf9f1; }
.rel-table .en-up { font-family: Georgia, serif; font-weight: 700; letter-spacing: .02em; text-decoration: none; color: var(--brown); }
.rel-table .en-up:hover { color: var(--gold-deep); text-decoration: underline; }
.rel-count { display: inline-block; background: var(--brown); color: var(--gold-soft); border-radius: 999px; padding: 0 10px; font-size: .8rem; margin-inline-start: 6px; vertical-align: middle; font-family: var(--font); }
.rel-sub { margin: 18px 0 8px; font-size: 1.05rem; color: var(--brown); }
.bio { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; line-height: 1.9; }
.src-list { font-size: .8rem; color: var(--muted); padding-inline-start: 18px; margin: 8px 0 0; }
.badge-ref { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: #eef2f4; color: #3d5562; border: 1px solid #cfd8de; }

/* ===== Encyclopedia ===== */
.enc-filters { display: grid; gap: 10px; margin-bottom: 14px; }
.enc-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.enc-letters { display: flex; flex-wrap: wrap; gap: 4px; }
.enc-letters button { min-width: 34px; min-height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 800; color: var(--brown-3); font-family: Georgia, var(--font); }
.enc-letters button[aria-pressed="true"] { background: var(--brown); color: var(--gold-soft); border-color: var(--gold); }
.enc-letters button:disabled { opacity: .35; cursor: default; }
.enc-search { flex: 1; min-width: 200px; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); padding: 0 12px; background: var(--paper); font: inherit; }
.enc-count { font-size: .85rem; color: var(--muted); }
.enc-group h2 { font-family: Georgia, var(--serif); font-size: 1.4rem; margin: 18px 0 8px; color: var(--gold-deep); border-bottom: 1px solid var(--line); }
.enc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.enc-list a { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; text-decoration: none; color: inherit; min-height: 44px; }
.enc-list a:hover { border-color: var(--gold); }
.enc-list .n { font-family: Georgia, serif; font-weight: 700; letter-spacing: .02em; color: var(--brown); }
.enc-list .ar { font-size: .85rem; color: var(--brown-3); }
.enc-list .m { font-size: .75rem; color: var(--muted); }
.pc-part { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; margin-top: 2px; }
.pp { display: block; font-size: .6rem; line-height: 1.3; color: #4a3a2c; white-space: normal; text-align: right; font-family: var(--font); }
.pp-show { color: #7a5a14; }
.pp-end { color: #2d5b4a; }
.pp-race { color: #24433a; }
.pp-more { font-size: .6rem; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 0 6px; cursor: pointer; color: var(--gold-deep); font-weight: 800; }
.medal-pop { white-space: pre-line; }

/* ===== Inquiry modal / form ===== */
.inq-btn { cursor: pointer; }
body.inq-open { overflow: hidden; }
.inq-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.inq-backdrop { position: absolute; inset: 0; background: rgba(26,15,10,.55); }
.inq-dialog { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--paper); border: 1px solid var(--gold); border-radius: 18px; padding: 16px 18px 20px; box-shadow: var(--shadow); }
.inq-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.inq-head h2 { margin: 0; font-family: var(--serif); color: var(--brown); }
.inq-x { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 1.4rem; cursor: pointer; }
.inq-form { display: grid; gap: 10px; }
.inq-form label { display: grid; gap: 4px; font-weight: 700; font-size: .9rem; color: var(--brown-3); }
.inq-form input, .inq-form textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); min-height: 44px; }
.inq-form .inq-ro { background: var(--sand); color: var(--brown); font-weight: 700; }
.inq-hp { display: none !important; }
.inq-err { color: #a3352b; font-size: .85rem; margin: 0; }
.inq-ok { background: #eaf4ea; border: 1px solid #b9d8bb; color: #24502a; border-radius: 12px; padding: 12px 14px; font-weight: 700; }
.inq-page { max-width: 620px; }
.ped-inbr-wrap .tiny { color: var(--muted); }
.ped-subject .pc-part { align-items: flex-start; }
.ped-subject .pp { color: var(--gold-soft); font-size: .68rem; text-align: left; }
.ped-table td.pc-champ .pc-name::after { content: " ★"; color: #b8891f; font-size: .8em; }
.ped-table td.pc-champ { outline: 1px solid rgba(184,137,31,.55); outline-offset: -2px; }
.ped-abp { margin: 10px 0 0; font-size: .85rem; }
.ped-abp a { color: var(--gold-deep); font-weight: 700; }
.coi-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 12px 0; }
.coi-val { font-size: 1.6rem; font-weight: 800; font-family: Georgia, serif; color: var(--brown); direction: ltr; }
.coi-badge { display: inline-block; border-radius: 999px; padding: 2px 12px; font-weight: 800; font-size: .9rem; }
.coi-low { background: #e5f2e6; color: #23602b; border: 1px solid #b6d7b9; }
.coi-mid { background: #fbf0d6; color: #8a6312; border: 1px solid #e6cf92; }
.coi-high { background: #f8e1dd; color: #9b2c1f; border: 1px solid #e4b3aa; }
.mate-form { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .mate-form { grid-template-columns: 1fr 1fr auto; align-items: end; } }
.mate-form label { display: grid; gap: 4px; font-weight: 700; color: var(--brown-3); font-size: .9rem; }
.mate-form input { font: inherit; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; direction: ltr; text-align: left; }
.disclaimer { font-size: .8rem; color: var(--muted); background: #fbf6ec; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.pc-part { align-items: flex-start; }
.pp { direction: rtl; text-align: right; }
.pp-win { color: #8a6312; font-weight: 800; }
.pp-win small { font-weight: 600; color: var(--muted); }
.pp-total { color: var(--muted); }
.ped-subject .pp-win, .ped-subject .pp-total { color: var(--gold-soft); }
.ped-subject .pp { text-align: right; }

/* ===== Compact pedigree (dense) — overrides ===== */
.ped-classic { padding: 8px; border-radius: 8px; }
.ped-head { margin-bottom: 6px; gap: 6px; }
.ped-subject { padding: 4px 10px; border-radius: 6px; }
.ped-subject-name { font-size: 13px; }
.ped-subject-meta { font-size: 10.5px; }
.ped-gens { font-size: 12px; }
.ped-gens button { min-width: 30px; min-height: 28px; border-radius: 6px; font-size: 12px; }
.ped-scroll { border-radius: 2px; border: 1px solid #bfa77a; background: #fffdf9; }
.ped-table { font-size: 11px; min-width: 0; border-spacing: 0; }
.ped-table.ped-g5 { min-width: 0; }
.ped-table.ped-g4 { min-width: 0; }
.ped-table th { font-size: 10px; padding: 2px 4px; font-weight: 700; }
.ped-table td.pc { padding: 1px 5px 1px 4px; line-height: 1.15; border-bottom: 1px solid rgba(120,90,40,.28); border-left: 1px solid rgba(120,90,40,.28); }
.ped-table td.pc-g1 { padding-top: 2px; padding-bottom: 2px; }
.ped-table td.pc-sire { box-shadow: inset -2px 0 0 #8FA6B4; }
.ped-table td.pc-dam { box-shadow: inset -2px 0 0 #C9A08F; }
.ped-table td.pc-dup { box-shadow: inset -4px 0 0 var(--dup); }
.pc-name, .pc-g1 .pc-name, .pc-g2 .pc-name, .pc-g5 .pc-name { font-size: 11px; letter-spacing: 0; }
.pc-g1 .pc-name { font-size: 12px; }
.pc-meta { font-size: 9.5px; line-height: 1.15; }
.pc-g4 .pc-link, .pc-g5 .pc-link { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; }
.pc-g4 .pc-name, .pc-g5 .pc-name { display: inline; }
.pc-g4 .pc-meta, .pc-g5 .pc-meta { display: inline; }
.pc-badges { margin-top: 0; }
.pb { min-width: 0; height: 13px; padding: 0 4px; font-size: 8.5px; }
.pc-part { margin-top: 1px; gap: 0; }
.pp { font-size: 9.5px; line-height: 1.2; }
.pc-dash { font-size: 10px; }
.ped-table td.pc-empty { padding: 0 4px; }
.ped-scroll-hint { font-size: 11px; margin-bottom: 4px; }
.ped-foot .legend-row { font-size: 11px; gap: 8px 12px; margin-top: 6px; }
.ped-inbr-wrap { margin-top: 6px; }
.ped-inbr-wrap h3 { font-size: 12.5px; }
.ped-inbr li { font-size: 11px; padding: 1px 8px; }
.ped-abp { font-size: 12px; margin-top: 6px; }
.coi-box { padding: 6px 10px; margin: 6px 0; gap: 8px; font-size: 13px; }
.coi-val { font-size: 1.15rem; }
@media (max-width: 759px) {
  .ped-table.ped-g5 { min-width: 560px; }
  .ped-table.ped-g4 { min-width: 440px; }
  .ped-table td.pc-first, .ped-table th.pc-first { width: 92px; }
  .pc-g1 .pc-name { font-size: 11px; }
}

/* ===== Fit-to-width pedigree grid (no horizontal scroll) — final overrides ===== */
.ped-classic { padding: 6px; }
.ped-head { margin-bottom: 4px; gap: 4px; align-items: center; }
.ped-subject { padding: 2px 8px; border-radius: 4px; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0 8px; max-width: 100%; }
.ped-subject-name { font-size: 12.5px; }
.ped-subject-meta { font-size: 10px; }
.ped-subject .pc-part { flex-basis: 100%; }
.ped-subject .pp { font-size: 9.5px; color: var(--cream); display: inline; margin-inline-end: 8px; }
.ped-gens { font-size: 11px; gap: 4px; }
.ped-gens button { min-width: 26px; min-height: 24px; font-size: 11px; border-radius: 4px; }
.ped-scroll { overflow-x: hidden; border: 0; border-radius: 0; background: transparent; }
.ped-scroll-hint { display: none !important; }
.ped-table, .ped-table.ped-g3, .ped-table.ped-g4, .ped-table.ped-g5 { width: 100%; min-width: 0 !important; max-width: 100%; table-layout: fixed; border-collapse: collapse; border: 1px solid #a89878; }
.ped-table th { position: static; font-size: 9.5px; padding: 1px 3px; border: 1px solid #a89878; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ped-table td.pc, .ped-table td.pc-first, .ped-table th.pc-first { position: static; width: auto; border: 1px solid #a89878; padding: 1px 3px; line-height: 1.15; vertical-align: middle; overflow: hidden; }
.ped-table td.pc-sire, .ped-table td.pc-first.pc-sire { box-shadow: none; }
.ped-table td.pc-dam, .ped-table td.pc-first.pc-dam { box-shadow: none; }
.ped-table td.pc-dup { box-shadow: inset -3px 0 0 var(--dup) !important; }
.pc-link { display: block; min-width: 0; }
.pc-name, .pc-g1 .pc-name, .pc-g2 .pc-name, .pc-g4 .pc-name, .pc-g5 .pc-name { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pc-g4 .pc-link, .pc-g5 .pc-link { display: block; }
.pc-meta, .pc-g4 .pc-meta, .pc-g5 .pc-meta { display: block; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-part { display: block; overflow: hidden; }
.pp { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-badges { display: inline; }
.pb { height: 12px; font-size: 8px; padding: 0 3px; }
.ped-foot .legend-row { font-size: 10px; gap: 4px 10px; margin-top: 4px; }
.lg { width: 10px; height: 10px; }
.ped-inbr-wrap h3 { font-size: 12px; margin: 4px 0 2px; }
.ped-inbr-wrap .tiny { font-size: 10px; margin: 0 0 4px; }
.ped-inbr li { font-size: 10px; padding: 0 6px; }
.coi-box { padding: 4px 8px; margin: 4px 0; font-size: 12px; gap: 6px; }
.coi-val { font-size: 1rem; }
@media (max-width: 759px) {
  .ped-classic { padding: 2px; border-radius: 4px; }
  .ped-table th { font-size: 8.5px; padding: 1px 2px; }
  .ped-table td.pc, .ped-table td.pc-first { padding: 0 2px; line-height: 1.1; }
  .pc-name, .pc-g1 .pc-name, .pc-g2 .pc-name, .pc-g3 .pc-name, .pc-g4 .pc-name, .pc-g5 .pc-name { font-size: 9.5px; }
  .pc-meta { font-size: 8.5px; }
  .pp { font-size: 8.5px; }
  .pc-g4 .pc-meta, .pc-g5 .pc-meta, .pc-g4 .pc-part, .pc-g5 .pc-part, .pc-g4 .pc-badges, .pc-g5 .pc-badges { display: none; }
  .ped-table.ped-g5 .pc-g3 .pc-part, .ped-table.ped-g5 .pc-g3 .pc-badges { display: none; }
  .pc-dash { font-size: 9px; }
  .ped-subject-name { font-size: 12px; }
  .ped-subject { padding: 2px 6px; }
  .ped-foot .legend-row { font-size: 9.5px; }
  .coi-box { font-size: 11px; }
}
.ped-namepop { font-size: 12px; max-width: 90vw; }
.ped-sec h2 { font-size: 1.05rem; margin-bottom: 2px; }
.ped-sec .sub { font-size: 11px; margin: 0 0 4px; }
@media (max-width: 759px) {
  #pedigree { margin-inline: -12px; }
  .ped-sec { margin-top: 10px; }
  .horse-hero .wrap { padding-top: 12px; padding-bottom: 12px; }
  .horse-hero h1 { font-size: 1.45rem; margin: 2px 0; }
  .horse-hero .facts { font-size: 12px; gap: 4px 10px; }
  .horse-hero .toolbar-links { gap: 6px; margin-top: 8px; }
  .horse-hero .toolbar-links .btn { min-height: 34px; padding: 4px 12px; font-size: 13px; }
}
@media (min-width: 760px) {
  .pc-g3 .pc-link, .pc-g4 .pc-link, .pc-g5 .pc-link { display: flex; align-items: baseline; gap: 0 4px; min-width: 0; }
  .pc-g3 .pc-name, .pc-g4 .pc-name, .pc-g5 .pc-name { flex: 0 1 auto; min-width: 0; }
  .pc-g3 .pc-meta, .pc-g4 .pc-meta, .pc-g5 .pc-meta { flex: 0 0 auto; }
  .ped-table.ped-g5 .pc-g5 .pc-badges { display: none; }
}
@media (max-width: 759px) {
  .coi-box .tiny { font-size: 10px; }
  .coi-box .coi-badge { font-size: 11px; padding: 0 8px; }
  .coi-box .coi-val { font-size: 14px; }
}
.visit-counter { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--gold-soft, #e8d3a0); background: rgba(255,255,255,.06); border: 1px solid rgba(201,162,84,.35); border-radius: 999px; padding: 1px 8px; white-space: nowrap; margin-inline-start: auto; margin-inline-end: 8px; }
.visit-counter[hidden] { display: none !important; }
.visit-counter b { font-weight: 800; font-family: Georgia, serif; }
@media (max-width: 380px) { .visit-counter { font-size: 10px; padding: 0 6px; } }
.reg-note { background: #fff7e3; border: 1px solid #e3c98a; border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 0 0 10px; }
.reg-share { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reg-form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px 4px; margin: 0 0 10px; }
.reg-form legend { font-weight: 800; color: var(--brown-3); padding: 0 6px; font-size: 14px; }
.reg-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0 8px; }
.reg-pick { margin: -4px 0 6px; min-height: 1em; }
.reg-pick.ok { color: #2c6a3a; } .reg-pick.new { color: var(--gold-deep); } .reg-pick.bad { color: #a03020; }
.req { color: #a03020; }
.reg-import textarea { width: 100%; min-height: 140px; font-family: monospace; direction: ltr; }
@media (max-width: 759px) {
  .rel-table { min-width: 0; table-layout: fixed; font-size: 11px; }
  .rel-table th, .rel-table td { padding: 4px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rel-table-wrap { overflow-x: hidden; }
}
@media (max-width: 759px) {
  .rel-table td a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
  .rel-table th:first-child, .rel-table td:first-child { width: 32%; }
}

/* tidy search results */
.result-item.ri2 { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; flex-wrap:nowrap; }
.ri2 .ri-names { min-width:0; flex:1 1 auto; overflow:hidden; }
.ri2 .name-ar, .ri2 .name-en, .ri2 .ri-par { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ri2 .name-ar { font-size:.95rem; }
.ri2 .name-en { font-size:.78rem; }
.ri2 .ri-par { font-size:.72rem; color:var(--muted); direction:ltr; text-align:right; }
.ri2 .ri-meta { flex:0 0 auto; display:flex; flex-direction:column; align-items:flex-end; gap:3px; font-size:.72rem; color:var(--muted); text-align:end; }
.ri2 .ri-meta .badge-se, .ri2 .ri-meta .badge-open { font-size:.7rem; white-space:nowrap; }
@media (max-width:600px){ .result-item.ri2 { padding:7px 8px; } .ri2 .name-ar{font-size:.88rem} }

.search-filters { display:flex; flex-wrap:wrap; gap:8px 12px; align-items:center; }
.search-filters label { display:flex; align-items:center; gap:6px; font-size:.85rem; }
.search-filters label[hidden] { display:none; }
.search-filters select { max-width:100%; font-size:.85rem; padding:4px 6px; }
@media (max-width:600px){ .search-filters label { flex:1 1 100%; justify-content:space-between; } .search-filters select{ flex:1 1 auto; } }

.cmp-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.cmp-col { min-width:0; }
.cmp-col h2 { font-size:1rem; margin:4px 0; }
.perf-cell { font-size:.78rem; line-height:1.5; display:block; }
.perf-table td { vertical-align:top; }
@media (max-width:700px){ .cmp-grid { grid-template-columns:1fr; } }

/* horse picker (autocomplete) */
.hp-wrap{position:relative}
.hp-list{position:absolute;inset-inline:0;top:100%;z-index:50;background:#fff;border:1px solid #d9cfb8;border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.12);max-height:min(60vh,360px);overflow-y:auto;margin-top:4px;text-align:start}
.hp-list[hidden]{display:none}
.hp-item{display:block;width:100%;text-align:start;background:none;border:0;border-bottom:1px solid #f0ebe0;padding:9px 12px;font:inherit;font-size:14px;cursor:pointer;color:inherit}
.hp-item:hover,.hp-item:focus{background:#faf6ec}
.hp-item [dir=ltr]{font-weight:600}
.hp-ar{color:#6b5b3e;font-size:13px}
.hp-m{display:block;font-size:12px;color:#8a7f6a}
.hp-empty{padding:10px 12px;color:#8a7f6a;font-size:13px}
.mate-form,.mate-form.card,.reg-form,form.card{overflow:visible}

/* Mobile/tablet: horizontal one-row nav (no hamburger, no vertical list); scrolls sideways if needed */
@media (max-width: 1039.98px) {
  .nav-toggle { display: none !important; }
  .header-inner { padding: 6px 12px 0; gap: 8px; min-height: 0; }
  .site-nav, .site-nav.open, .site-nav.is-desktop { display: block; width: 100%; order: 10; }
  .site-nav ul {
    flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 2px;
    padding: 2px 0 6px; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .site-nav ul::-webkit-scrollbar { display: none; }
  .site-nav li { flex: 0 0 auto; }
  .site-nav a { min-height: 36px; padding: 0 10px; font-size: .85rem; white-space: nowrap; border-radius: 999px; }
  .site-nav a[aria-current="page"] { background: rgba(201,162,84,.22); }
  .brand img { width: 34px; height: 34px; }
}
@media (max-width: 1039.98px) {
  .site-nav ul { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 26px); mask-image: linear-gradient(to right, transparent 0, #000 26px); padding-inline: 10px; }
}

/* Competitions accordion */
#comp-acc details > summary { list-style: none; cursor: pointer; }
#comp-acc details > summary::-webkit-details-marker { display: none; }
.acc { border: 1px solid #e3d9c4; border-radius: 12px; background: #fff; margin: 0 0 10px; overflow: hidden; }
.acc > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; font-weight: 700; list-style: none; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after, .comp > summary::after { content: "▾"; font-size: 14px; color: #a88a4e; transition: transform .2s; margin-inline-start: 6px; flex: 0 0 auto; }
.acc[open] > summary::after, .comp[open] > summary::after { transform: rotate(180deg); }
.acc-t { flex: 1 1 auto; }
.acc-c { font-size: 12px; font-weight: 400; color: #8a7f6a; white-space: nowrap; }
.acc-body { padding: 0 12px 12px; border-top: 1px solid #f0ebe0; }
.acc-body h3 { font-size: 15px; margin: 12px 0 6px; }
.comp { border: 1px solid #eee6d6; border-radius: 10px; margin: 0 0 6px; background: #fdfbf6; }
.comp > summary { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 13.5px; }
.comp-d { font-variant-numeric: tabular-nums; color: #6b5b3e; white-space: nowrap; font-size: 12.5px; }
.comp-n { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-k { font-size: 11px; background: #efe6d2; border-radius: 999px; padding: 1px 7px; color: #6b5b3e; }
.comp-body { padding: 4px 10px 10px; }
.comp-body h4 { font-size: 13px; margin: 8px 0 4px; }
.comp-req { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; font-size: 13px; margin: 0; }
.comp-req dt { color: #8a7f6a; } .comp-req dd { margin: 0; }
.comp-top { margin: 14px 0 16px; text-align: start; }
.comp-top .acc, .comp-top .comp { scroll-margin-top: calc(var(--header-h, 64px) + 56px); }
.comp-top > #comp-acc > p.tiny { color: rgba(247,240,228,.75); }
.acc > summary .acc-t { color: #2a1a10; }
.acc-body, .comp-body { color: #2a1a10; }
.nb-list { list-style: none; margin: 0; padding: 0; }
.nb-list li { padding: 7px 2px; border-bottom: 1px solid #f0ebe0; font-size: 14px; }
.nb-b { display: inline-block; font-size: 11px; border-radius: 999px; padding: 1px 8px; margin-inline-end: 4px; vertical-align: 1px; }
.nb-champ { background: #f3e2b3; color: #6b4a10; }
.nb-prod { background: #e6efe3; color: #2f5a2a; }
.comp-past { margin-top: 10px; }
/* Official stud logos */
.stud-logo { display: inline-block; vertical-align: middle; object-fit: contain; background: #fffdf8; border-radius: 4px; padding: 1px 2px; margin-inline: 0 5px; }
.stud-logo-xs { height: 11px; max-width: 30px; padding: 0 1px; margin-inline-end: 3px; }
.stud-logo-sm { height: 18px; max-width: 54px; }
.stud-logo-md { height: 30px; max-width: 96px; margin-inline-end: 8px; }
.stud-logo-hero { display: inline-block; background: #fffdf8; border-radius: 12px; padding: 8px 14px; margin-bottom: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.stud-logo-hero img { height: 56px; max-width: 200px; object-fit: contain; display: block; }
.stud-logo.stud-logo-dark, .stud-logo-hero.stud-logo-dark { background: #3b2a1e; }
/* Category badges */
.cat-badge { display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.12)); }
.pp .cat-badge { vertical-align: -1px; margin-inline-end: 1px; filter: none; }
h2 .cat-badge, .acc-t .cat-badge { margin-inline-end: 6px; vertical-align: -0.25em; }

/* ===== Polish pass (v11b): consistent spacing, refined surfaces ===== */
:root { --r-lg: 16px; --r-md: 12px; --sh-soft: 0 1px 2px rgba(26,15,10,.05), 0 6px 18px rgba(26,15,10,.06); --sh-lift: 0 2px 4px rgba(26,15,10,.06), 0 12px 28px rgba(26,15,10,.10); }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.section { margin-block: 28px; }
.section h2 { letter-spacing: 0; line-height: 1.3; }
.section .sub { margin-top: 4px; line-height: 1.7; }
.horse-card, .person-card, .card, .search-card { border-radius: var(--r-lg); box-shadow: var(--sh-soft); transition: box-shadow .2s, transform .2s; }
.horse-card:hover, .person-card:hover { box-shadow: var(--sh-lift); transform: translateY(-1px); }
.horse-card h3, .person-card h3 { line-height: 1.35; }
.gateway-card { border-radius: var(--r-lg); box-shadow: var(--sh-soft); }
/* section sub-navigation: one tidy row */
.section-subnav ul { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.section-subnav ul::-webkit-scrollbar { display: none; }
.section-subnav li { flex: 0 0 auto; }
.section-subnav a { white-space: nowrap; border-radius: 999px; font-size: .88rem; min-height: 34px; display: inline-flex; align-items: center; padding: 0 12px; }
/* accordion surfaces */
.acc { border: 1px solid rgba(201,162,84,.35); border-radius: var(--r-lg); background: linear-gradient(180deg,#fffdf8,#fbf6ea); box-shadow: var(--sh-soft); }
.acc[open] { box-shadow: var(--sh-lift); }
.acc > summary { padding: 13px 14px; min-height: 52px; }
.acc > summary:focus-visible, .comp > summary:focus-visible { outline: 2px solid #c9a254; outline-offset: 2px; border-radius: var(--r-md); }
.acc-body { background: #fffdf8; }
.comp { border-radius: var(--r-md); background: #fff; border-color: #efe6d4; }
.comp[open] { border-color: #e0cf9f; }
.nb-list li { display: block; line-height: 1.6; }
.nb-list li:last-child { border-bottom: 0; }
/* tables */
.rel-table { border-radius: var(--r-md); overflow: hidden; }
@media (max-width: 640px) {
  .section { margin-block: 22px; }
  .horse-hero { padding-bottom: 18px; }
  .wrap { padding-inline: 14px; }
  .section h2 { font-size: 1.35rem; }
}
.horse-hero .wrap, .person-hero .wrap { padding-bottom: 8px; }
.acc-body .muted, .acc-body .tiny.muted, .comp-body .muted { color: #7a6c55 !important; } .acc-body a { color: #7a4f12; }
.comp-group { background: #faf5e8; border-color: #e6d7b0; margin: 10px 0 8px; }
.comp-group > summary { font-weight: 700; font-size: 14px; padding: 10px 12px; }
.comp-group > .comp-body { padding-top: 2px; }
.nb-br { background: #e8e2f3; color: #4a3a73; min-width: 22px; text-align: center; }
/* v11d brand: Scheherazade New (OFL, fonts/OFL-ScheherazadeNew.txt) */
@font-face { font-family: "AsayelBrand"; src: url("../fonts/scheherazade-brand.woff2") format("woff2"); font-weight: 700; font-display: swap; }
.brand img { width: 44px; height: 44px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(214,173,98,.55); object-fit: cover; }
.brand-text strong { font-family: "AsayelBrand", var(--serif); font-weight: 700; font-size: 1.55rem; line-height: 1.45; letter-spacing: 0; margin: -8px 0 1px; padding-top: 4px; background: linear-gradient(180deg,#f0d38f,#c29445 65%,#a57a32); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 2px; }
.brand-text span { font-size: .72rem; color: #d6ad62; letter-spacing: .02em; }
.hero-logo { display: block; width: 132px; height: 132px; border-radius: 22px; margin: 0 auto 14px; box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(214,173,98,.6); }
@media (max-width: 1039.98px) { .brand img { width: 38px; height: 38px; } .brand-text strong { font-size: 1.35rem; } .hero-logo { width: 104px; height: 104px; border-radius: 18px; } }
/* v11d unified search: results only while typing, grouped by type */
.search-card .tabs, .search-card #search-filters, .search-card #search-hint { display: none !important; }
.search-card .results:empty { display: none; }
.sr-group { margin: 10px 0 4px; }
.sr-group + .sr-group { border-top: 1px solid rgba(168,121,42,.18); padding-top: 10px; }
.sr-h { font-size: .82rem; font-weight: 700; color: #7a5a22; margin: 0 2px 6px; display: flex; align-items: center; gap: 6px; letter-spacing: .01em; }
.sr-n { background: #f1e6cf; color: #6b4d1a; border-radius: 999px; padding: 0 8px; font-size: .72rem; line-height: 1.6; }
.sr-more { margin: 6px 0 2px; width: 100%; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.plain-list li { padding: 8px 12px; background: #fffaf0; border: 1px solid rgba(168,121,42,.18); border-radius: 10px; }
/* v11d tidy pass */
.hero-logo { margin-inline: 0 auto; }
.comp-top > div > p.tiny.muted, #comp-acc > p.tiny { display: none; }
.wrap.page > .section { padding-top: 22px; padding-bottom: 22px; margin: 0; }
@media (min-width: 1040px) { .wrap.page > .section { padding-top: 34px; padding-bottom: 34px; } }
.person-hero .facts { gap: 8px 18px; }
.person-hero .en-name { margin-top: 2px; opacity: .8; letter-spacing: .04em; }
.section h2 { margin-bottom: 12px; }
.cards { gap: 12px; }
.horse-card .body h3 { font-size: 1.02rem; line-height: 1.4; }
.horse-card .body p { font-size: .82rem; }
.horse-hero .facts, .person-hero .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 0; list-style: none; }
.horse-hero .facts li, .person-hero .facts li { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.horse-hero .facts li strong, .person-hero .facts li strong { font-size: .72rem; opacity: .75; font-weight: 600; }
@media (min-width: 1040px) { .horse-hero .facts, .person-hero .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.horse-hero + .wrap.page > .section:first-child, .person-hero + .wrap.page > .section:first-child { padding-top: 18px; }
.horse-hero .facts li, .person-hero .facts li { display: block; }
.horse-hero .facts li strong, .person-hero .facts li strong { display: block; margin-bottom: 2px; }
.horse-hero .facts li .badge-se, .horse-hero .facts li .badge-open { display: inline-block; width: auto; }
.horse-hero .facts li > a, .horse-hero .facts li > span { display: inline !important; }
.horse-hero .facts li { display: block !important; }

/* v11e sire season stats */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid rgba(214,173,98,.35); }
.stat-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
.stat-table th, .stat-table td { padding: 8px 10px; text-align: center; border-bottom: 1px solid rgba(0,0,0,.06); white-space: nowrap; }
.stat-table thead th { background: #5a1a2a; color: #f0d38f; font-weight: 700; }
.stat-table tbody tr:nth-child(even) td { background: rgba(214,173,98,.08); }

/* v11h restored emoji category markers */
.cat-emoji { display: inline; font-style: normal; line-height: 1; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }

/* v11h home redesign: dark green cards, grey Arabian on black hero, gold headline */
body.home-v2 { background: #0b1f19; }
body.home-v2 #main { background: radial-gradient(ellipse at top, #12332a 0%, #0b1f19 60%); }
.home2 { padding: 18px 14px 8px; }
.home2-wrap { max-width: 1120px; margin: 0 auto; display: grid; gap: 16px; }
.h2-hero { position: relative; border-radius: 22px; overflow: hidden; background: #000; border: 1px solid rgba(214,173,98,.45); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.h2-photo { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; object-position: 50% 0%; }
.h2-copy { position: absolute; inset: 0 auto 0 0; width: 50%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px 28px;
  background: linear-gradient(90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.55) 70%, rgba(0,0,0,0) 100%); }
.h2-logo { width: 72px; height: 72px; border-radius: 16px; box-shadow: 0 0 0 1px rgba(214,173,98,.7), 0 8px 22px rgba(0,0,0,.5); margin-bottom: 14px; }
.h2-title { font-family: "AsayelBrand", var(--serif); font-weight: 700; font-size: clamp(1.9rem, 4.2vw, 3.3rem); line-height: 1.5; margin: 0 0 8px;
  background: linear-gradient(180deg,#f6dc9b,#d3a654 60%,#a97b33); -webkit-background-clip: text; background-clip: text; color: transparent; padding-top: 6px; }
.h2-sub { color: #e9e2cf; font-size: 1.02rem; line-height: 1.8; margin: 0; max-width: 30em; }
.h2-search.search-card { background: #11302a; border: 1px solid rgba(214,173,98,.4); border-radius: 20px; padding: 14px; box-shadow: 0 10px 26px rgba(0,0,0,.35); margin: 0; }
.h2-search .search-box { background: #fff; border-radius: 999px; border: 1px solid rgba(214,173,98,.6); padding: 4px 18px; }
.h2-search .search-box input { background: transparent; color: #1f1a14; font-size: 1.05rem; height: 48px; border: 0; }
.h2-search .search-box input::placeholder { color: #8a8170; }
.h2-search .results:not(:empty) { background: #fffdf7; border-radius: 16px; margin-top: 10px; padding: 8px; }
.h2-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.h2-tile { display: flex; flex-direction: column; gap: 6px; padding: 20px 18px; border-radius: 20px; text-decoration: none; text-align: center; align-items: center;
  background: linear-gradient(160deg, #164036 0%, #0f2c25 100%); border: 1px solid rgba(214,173,98,.5); box-shadow: 0 10px 24px rgba(0,0,0,.35); transition: transform .15s ease, box-shadow .15s ease; }
.h2-tile:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,0,0,.45); }
.h2-tile strong { font-family: "AsayelBrand", var(--serif); font-size: 1.45rem; line-height: 1.5; color: #f0d38f; }
.h2-tile-k { font-size: .76rem; color: #b9c9bf; letter-spacing: .02em; }
.h2-tile-s { font-size: .9rem; color: #dfe7e1; line-height: 1.7; }
body.home-v2 .wrap.page { background: transparent; }
body.home-v2 .intro-grid h2 { color: #f0d38f; }
body.home-v2 .intro-grid .callout { background: #11302a; color: #e9e2cf; border-color: rgba(214,173,98,.4); }
body.home-v2 .intro-grid .callout strong { color: #f0d38f; }
body.home-v2 .intro-grid .card { background: #11302a; border-color: rgba(214,173,98,.4); }
body.home-v2 .intro-grid .caption { color: #b9c9bf; }
@media (max-width: 700px) {
  .home2 { padding: 12px 10px 4px; }
  .h2-photo { aspect-ratio: 4/3; }
  .h2-copy { position: static; width: auto; background: linear-gradient(180deg,#000 0%, #0d241e 100%); padding: 18px 16px 20px; }
  .h2-logo { width: 60px; height: 60px; margin-top: -48px; position: relative; }
  .h2-title { font-size: 1.95rem; }
  .h2-sub { font-size: .95rem; }
  .h2-tiles { gap: 10px; }
  .h2-tile { padding: 16px 10px; }
  .h2-tile strong { font-size: 1.12rem; }
  .h2-tile-s { font-size: .8rem; }
}
@media (min-width: 701px) { .h2-photo { aspect-ratio: auto; height: 500px; object-position: 50% 0%; } .h2-copy { width: 52%; } }
.h2-hero picture { display: block; width: 100%; }
@media (max-width: 700px) { .h2-search .search-box { padding: 2px 14px; } .h2-search .search-box input { font-size: .92rem; } }
@media (max-width: 700px) { .h2-photo { -webkit-mask-image: linear-gradient(180deg,#000 70%,transparent 100%); mask-image: linear-gradient(180deg,#000 70%,transparent 100%); } }

/* ================= v11i unified theme: dark green + gold, rounded cream content cards ================= */
:root {
  --g-0: #081a15; --g-1: #0b1f19; --g-2: #11302a; --g-3: #164036; --g-4: #1d5244;
  --ink: #081a15; --brown: #11302a; --brown-2: #164036; --brown-3: #1d5244;
  --gold: #D3A654; --gold-deep: #8f6a24; --gold-soft: #F0D38F;
  --line: rgba(211,166,84,.45);
  --paper: #FBF7F0; --card: #fffdf7; --sand: #f3ecdc; --cream: #F7F0E4;
  --shadow: 0 10px 26px rgba(0,0,0,.32);
}
body { background: radial-gradient(ellipse at top, #12332a 0%, #0b1f19 55%) fixed, #0b1f19; color: var(--text); }
a { color: #1d5244; }
a:hover { color: var(--gold-deep); }

/* header */
.site-header { background: rgba(8,26,21,.92); border-bottom: 1px solid rgba(211,166,84,.5); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.header-inner { max-width: 1120px; padding: 8px 14px 6px; gap: 8px 12px; }
.brand img { box-shadow: 0 0 0 1px rgba(211,166,84,.7); }
.visit-counter { background: transparent; border-color: rgba(211,166,84,.3); color: rgba(240,211,143,.75); font-size: 10.5px; }
.site-nav a { color: #e9e2cf; border: 1px solid transparent; border-radius: 999px; }
.site-nav a:hover { background: rgba(211,166,84,.12); color: var(--gold-soft); }
.site-nav a[aria-current="page"] { background: rgba(211,166,84,.16); color: var(--gold-soft); border-color: rgba(211,166,84,.55); }
@media (min-width: 1040px) {
  .site-nav ul { gap: 4px; }
  .site-nav a { min-height: 34px; padding: 0 12px; font-size: .88rem; }
}

/* page heroes (section pages, horse, person, encyclopedia, generic) */
.hero, .page-hero, .horse-hero, .person-hero, .section-hero {
  background: linear-gradient(160deg, #164036 0%, #0b1f19 100%) !important; color: var(--cream);
}
.horse-hero, .person-hero, .page-hero, .section-hero { margin: 14px auto 0; max-width: 1120px; width: calc(100% - 24px); border-radius: 22px; border: 1px solid rgba(211,166,84,.5); box-shadow: var(--shadow); overflow: hidden; }
.hero::before, .hero::after { opacity: .85; }
.horse-hero h1, .person-hero h1, .page-hero h1, .hero h1 { color: var(--gold-soft); }
.kicker, .eyebrow { color: #cfdcd4; }
.horse-hero .facts li, .person-hero .facts li { color: #f2ecdd; }
.horse-hero .facts li strong, .person-hero .facts li strong { color: var(--gold); }
.horse-hero a, .person-hero a { color: var(--gold-soft); }
.en-name { color: #d7e2db; }

/* content: every section is a cream rounded card with a gold border on the green page */
.wrap.page { max-width: 1120px; }
.wrap.page > .section, .wrap > .section, main > .section {
  background: var(--card); border: 1px solid rgba(211,166,84,.55); border-radius: 20px; box-shadow: var(--shadow);
  padding: 18px 16px; margin: 0 0 16px;
}
.section h2, .section h1 { color: #11302a; }
.section h2::after { background: var(--gold) !important; }
.section .sub, .muted { color: #5d6b63; }
.callout { background: #f7f1e3; border-color: rgba(211,166,84,.55); }

/* buttons / chips / tabs */
.btn { border-radius: 999px; }
.btn-gold { background: linear-gradient(180deg,#f0d38f,#d3a654); color: #081a15; border-color: #b88a3c; }
.btn-ghost { color: var(--gold-soft); border-color: rgba(211,166,84,.6); }
.btn-light { background: #fffdf7; color: #11302a; border-color: rgba(211,166,84,.6); }
.chip[aria-pressed="true"], .tab-btn[aria-selected="true"], .ped-gens button[aria-pressed="true"], .enc-letters button[aria-pressed="true"] { background: #11302a; color: var(--gold-soft); border-color: var(--gold); }
.rel-count { background: #11302a; color: var(--gold-soft); }

/* tables */
.rel-table th, .ped-table th, table.cal th, .stat-table thead th { background: #11302a !important; color: var(--gold-soft) !important; }
.rel-table-wrap, .table-wrap, .table-scroll { border-color: rgba(211,166,84,.5); }
.ped-subject { background: #11302a; border-color: var(--gold); }

/* search cards on section pages */
.search-card { background: #11302a; border: 1px solid rgba(211,166,84,.45); border-radius: 20px; box-shadow: var(--shadow); }
.search-card .search-box { background: #fff; border-radius: 999px; border-color: rgba(211,166,84,.6); }
.search-card .results:not(:empty) { background: #fffdf7; border-radius: 16px; margin-top: 10px; padding: 8px; }
.search-card .sr-h { color: #11302a; }

/* accordions (competition categories) */
.acc { border-color: rgba(211,166,84,.5); border-radius: 16px; }
.acc > summary { background: linear-gradient(180deg,#164036,#11302a); color: var(--gold-soft); }
.acc > summary .acc-c, .acc > summary .muted { color: #cfdcd4 !important; }
.acc[open] > summary { border-bottom: 1px solid rgba(211,166,84,.5); }

/* footer */
.site-footer { background: #081a15; border-top: 1px solid rgba(211,166,84,.5); color: #d9e2dc; }
.site-footer a { color: var(--gold-soft); }
.site-footer h2, .site-footer h3, .site-footer strong { color: var(--gold-soft); }

/* home keeps its own hero */
body.home-v2 .wrap.page > .section { background: transparent; border: 0; box-shadow: none; padding: 0; }

.acc > summary, .acc > summary .acc-t, .acc > summary span { color: var(--gold-soft); }
.acc > summary .acc-c { color: #cfdcd4 !important; }
.acc > summary::after, .acc > summary .acc-arrow { color: var(--gold) !important; border-color: var(--gold) !important; }
.search-card .search-box input { background: transparent; color: #1f1a14; }
.search-card .search-box input::placeholder { color: #8a8170; }
.hero { min-height: 0 !important; } .hero .hero-inner { padding-top: 22px; }
/* v11j: home tiles + headline use a full Arabic font (brand font is a 'أصايل'-only subset -> broken joining on phones) */
.h2-title { font-family: "Amiri", "Noto Naskh Arabic", serif !important; font-weight: 700; }
.h2-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
.h2-tile { display: flex !important; flex-direction: column; justify-content: flex-start; align-items: center; gap: 10px; padding: 22px 16px 20px !important; text-align: center;
  background: linear-gradient(160deg,#1b4a3d,#0f2c24) !important; border: 1.5px solid rgba(240,211,143,.7) !important; }
.h2-tile > * { display: block; width: 100%; margin: 0; white-space: normal; word-break: normal; overflow-wrap: anywhere; }
.h2-tile-k { order: 1; font-family: "Tajawal", sans-serif; font-size: .78rem !important; font-weight: 700; color: #0b1f19 !important; background: #e6c27a; border-radius: 999px; padding: 3px 12px; width: auto !important; align-self: center; line-height: 1.6; }
.h2-tile strong { order: 2; font-family: "Amiri", "Noto Naskh Arabic", serif !important; font-weight: 700; font-size: 1.7rem !important; line-height: 1.45 !important; color: #FBE3A6 !important; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.h2-tile-s { order: 3; font-family: "Tajawal", sans-serif; font-size: .95rem !important; line-height: 1.75 !important; color: #F3F6F2 !important; font-weight: 500; }
@media (max-width: 600px) {
  .h2-tiles { gap: 10px; }
  .h2-tile { padding: 16px 10px 16px !important; gap: 8px; }
  .h2-tile strong { font-size: 1.32rem !important; }
  .h2-tile-s { font-size: .84rem !important; line-height: 1.7 !important; }
}
@media (max-width: 350px) { .h2-tiles { grid-template-columns: 1fr; } }
/* v11j: foal registration (one short form) */
.reg-page { max-width: 620px; margin: 0 auto 18px; background: linear-gradient(165deg,#173f34,#0e2a22) !important; border: 1.5px solid rgba(211,166,84,.6) !important; border-radius: 22px !important; padding: 20px 18px !important; color: #eef3ef; }
.reg-foal { display: flex; flex-direction: column; gap: 12px; }
.reg-foal .rf { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: .98rem; color: #F0D38F; margin: 0; }
.reg-foal .rf .muted { color: #b9c9bf; font-weight: 500; }
.reg-foal .req { color: #ffb4a0; }
.reg-foal input[type=text], .reg-foal input:not([type]), .reg-foal input[name], .reg-foal select { width: 100%; min-height: 50px; padding: 10px 14px; font-size: 1.02rem; border-radius: 14px; border: 1.5px solid rgba(211,166,84,.55); background: #fffdf7; color: #1d1a14; box-sizing: border-box; }
.reg-foal input[type=radio] { width: auto; min-height: 0; accent-color: #D3A654; }
.reg-foal input:focus, .reg-foal select:focus { outline: 3px solid rgba(240,211,143,.55); outline-offset: 1px; }
.rf-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: end; }
.reg-foal fieldset.rf-sex { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.reg-foal fieldset.rf-sex legend { color: #F0D38F; font-weight: 700; font-size: .98rem; padding: 0; margin-bottom: 6px; width: 100%; }
.pill-opt { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; border-radius: 14px; border: 1.5px solid rgba(211,166,84,.55); background: rgba(255,255,255,.06); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; font-size: .92rem; }
.pill-opt:has(input:checked) { background: #D3A654; color: #0b1f19; border-color: #F0D38F; }
.reg-foal .reg-pick { margin: -6px 0 0; color: #cfdcd4; }
.reg-foal .reg-pick.ok { color: #9be3a8; } .reg-foal .reg-pick.new { color: #F0D38F; } .reg-foal .reg-pick.bad { color: #ffb4a0; }
.reg-foal .reg-pick a { color: #F0D38F; }
.reg-line { margin: 0; color: #eef3ef; font-size: .92rem; min-height: 0; }
.rf-more { border: 1px dashed rgba(211,166,84,.5); border-radius: 14px; padding: 10px 12px; }
.rf-more summary { cursor: pointer; color: #F0D38F; font-weight: 700; }
.rf-more[open] { display: flex; flex-direction: column; gap: 10px; }
.reg-submit { min-height: 56px; font-size: 1.12rem !important; font-weight: 800; border-radius: 16px !important; width: 100%; }
.reg-foot { text-align: center; color: #b9c9bf !important; margin: 0; }
.reg-page .inq-ok { color: #eef3ef; }
.h2-reg { display: flex; justify-content: center; margin: 12px 0 0; }
.h2-reg a { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; background: #D3A654; color: #0b1f19; font-weight: 800; text-decoration: none; box-shadow: 0 8px 20px rgba(0,0,0,.35); }
@media (max-width: 380px) { .rf-row { grid-template-columns: 1fr; } }
.reg-foal .rf { display: block !important; }
.reg-foal .rf > span, .reg-foal legend > span { display: inline !important; margin: 0 4px 0 0; }
.reg-foal .rf > input, .reg-foal .rf > select { display: block; margin-top: 6px; }
.reg-foal .pill-opt { flex-direction: row !important; color: #fff !important; opacity: 1 !important; }
.reg-foal .pill-opt input { margin: 0 !important; display: inline-block !important; }
.reg-foal .pill-opt:has(input:checked) { color: #0b1f19 !important; }
.reg-foal .rf-sex { display: flex !important; flex-wrap: wrap; }
.reg-foal .rf-sex .pill-opt { min-height: 50px; }
.rf-row { align-items: start; }
.reg-foal .pill-opt input[type=radio] { width: 18px !important; height: 18px; min-height: 0 !important; padding: 0 !important; border: 0 !important; flex: 0 0 auto; }
.reg-foal .rf-sex .pill-opt { flex: 1 1 40%; }
@media (max-width: 600px) { .rf-row { grid-template-columns: 1fr; } }
.reg-foal label.pill-opt { display: flex !important; flex-direction: row !important; justify-content: center; align-items: center; gap: 8px; }
.reg-foal .rf-sex { flex-direction: row !important; flex-wrap: nowrap !important; }
/* v11j: text placed directly on the dark page background (calendar, news, history, terms, 404) */
.wrap.page > h1, .wrap.page > .eyebrow + h1 { color: #F0D38F !important; font-family: "Amiri", var(--serif) !important; }
.wrap.page > .sub, .wrap.page > p:not(.reg-note), .wrap.page > .eyebrow { color: #dfe7e1 !important; }
.wrap.page > .sub a, .wrap.page > p a { color: #F0D38F !important; text-decoration-color: rgba(240,211,143,.5); }
.wrap.page > h2, .wrap.page > section:not(.section) > h2, .wrap.page > .cal-block > h2 { color: #F0D38F !important; }
.wrap.page > .cal-filters label, .cal-filters label { color: #F0D38F !important; font-weight: 700; }
.contact-page .muted, .inq-page .muted, .inq-page p.tiny { color: #6b5a48; }
details.comp:not(.comp-group) { color: #2a2118; }
details.comp:not(.comp-group) .comp-body, details.comp:not(.comp-group) .comp-body p, details.comp:not(.comp-group) .tiny, details.comp:not(.comp-group) .muted { color: #5a4a3a !important; }
details.comp:not(.comp-group) > summary, details.comp:not(.comp-group) > summary * { color: #1f3d33; }
.badge-verified, .vbadge, span.verified { color: #6b4e14 !important; }
.ped-empty, .pc-empty, td .dash { color: #8a7a62 !important; }
@media (max-width: 600px) {
  table.cal, table.cal tbody, table.cal tr, table.cal td { display: block; width: 100%; box-sizing: border-box; }
  table.cal thead { display: none; }
  table.cal tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.cal td { border: 0 !important; padding: 2px 0 !important; text-align: right; }
  table.cal td:first-child { font-weight: 700; color: #8f6a24; font-size: .88rem; }
}
.race-item.is-medal { border-color: rgba(211,166,84,.75); background: #fffaf0; }

/* v11m: user-registered foals — subtle marker */
.badge-ref.badge-user{opacity:.85;border-style:dashed}

/* v11o: discipline markers (🏆 جمال · 🐎 ماراثون · 🏇 سباق) next to horse names everywhere, incl. every pedigree cell */
.disc-marks { display: inline-flex; gap: .12em; margin-inline-start: .3em; white-space: nowrap; vertical-align: baseline; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; letter-spacing: 0; }
.pc-name .disc-marks { font-size: .95em; margin-inline-start: .25em; }
.horse-hero h1 .disc-marks { font-size: .62em; margin-inline-start: .35em; vertical-align: middle; }
.ped-subject-name .disc-marks { font-size: .9em; }
.result-item .name-ar .disc-marks, .horse-card h3 .disc-marks { font-size: .85em; }
/* v11o: pedigree name row = name link (ellipsis) + linked discipline markers that always stay visible */
.ped-table .pc-namerow { display: flex !important; align-items: baseline; gap: 0 2px; min-width: 0; max-width: 100%; overflow: visible; white-space: nowrap; }
.ped-table .pc-namerow[dir="ltr"] { justify-content: flex-end; }
.ped-table .pc-name-link { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
.ped-table .pc-name-link:hover, .ped-table .pc-name-link:focus { color: var(--gold-deep); text-decoration: underline; }
.ped-table .pc-namerow .disc-marks { flex: 0 0 auto; margin-inline-start: 2px; gap: 1px; }
.ped-table .pc-meta-link { display: block; }
.disc-link { text-decoration: none !important; cursor: pointer; border-radius: 4px; }
.disc-link:hover, .disc-link:focus-visible { background: rgba(201,162,74,.22); outline: none; }
.section.hash-hit { box-shadow: 0 0 0 2px var(--gold, #c9a24a); transition: box-shadow .4s; scroll-margin-top: 80px; }
.section#shows, .section#endurance, .section#races { scroll-margin-top: 80px; }
/* v11p: tidy pedigree cells — line 1: name + markers · line 2: year/colour (+ مصري) · line 3 (optional): one short summary */
.ped-table td.pc { vertical-align: middle; }
.ped-table td.pc-champ { outline: none; }
.ped-table .pc-name::after { content: none !important; }
.ped-table .pc-metarow { display: flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; overflow: hidden; }
.ped-table .pc-metarow .pc-meta-link { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.ped-table .pc-metarow .pc-meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ped-table .pc-metarow .pc-badges { flex: 0 0 auto; margin: 0; display: inline-flex; }
.ped-table .pc-part { display: block; margin-top: 1px; overflow: hidden; }
.ped-table .pp-one { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; line-height: 1.35; color: #5a4a3a; }
.ped-table .pp-one.pp-win { color: #8a6312; font-weight: 800; }
.ped-subject .pc-part { display: block; }
.ped-subject .pp-one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; color: var(--gold-soft); }
@media (max-width: 759px) {
  .ped-table .pp-one { font-size: 9px; }
  .ped-table .pc-g4 .pc-metarow, .ped-table .pc-g5 .pc-metarow, .ped-table .pc-g4 .pc-part, .ped-table .pc-g5 .pc-part { display: none; }
  .ped-table.ped-g5 .pc-g3 .pc-part { display: none; }
}
.ped-table .pc-g5 .pc-part { display: none; }
/* v11q: offspring / siblings / half-siblings — icons only, right beside the name, as large as the name, never clipped */
.rel-table .rel-name { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; vertical-align: middle; }
.rel-table .rel-name .en-up { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-table .rel-name .disc-marks { flex: 0 0 auto; display: inline-flex; gap: 2px; margin: 0; font-size: 1.15em; line-height: 1; }
.rel-table .disc-link { display: inline-block !important; overflow: visible !important; text-overflow: clip !important; width: auto !important; }
.rel-table .rel-ar { margin-inline-start: 6px; }
@media (max-width: 759px) {
  .rel-table .rel-name { display: flex; }
  .rel-table .rel-name .en-up { display: block; flex: 0 1 auto; }
  .rel-table .rel-name .disc-marks { font-size: 14px; }
  .rel-table .rel-ar { display: block; margin: 1px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
  .rel-table th:first-child, .rel-table td:first-child { width: 40%; }
}

/* ===== v11r: one alignment for every pedigree cell, full names (wrap, never "…") ===== */
.ped-table td.pc:not(.pc-empty) { direction: rtl; text-align: right !important; vertical-align: middle !important; padding: 3px 6px !important; overflow: visible !important; }
.ped-table td.pc-empty { text-align: center; vertical-align: middle; }
.ped-table .pc-namerow, .ped-table .pc-namerow[dir] { display: block !important; direction: rtl; text-align: right !important; justify-content: initial !important;
  white-space: normal !important; overflow: visible !important; text-overflow: clip !important; max-width: 100%; line-height: 1.2; overflow-wrap: anywhere; word-break: normal; hyphens: none; }
.ped-table .pc-name-link { display: inline !important; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; min-width: 0; flex: none; }
.ped-table .pc-name-link bdi { unicode-bidi: isolate; }
.ped-table .pc-namerow .disc-marks { display: inline-flex !important; vertical-align: baseline; margin-inline-start: 3px !important; white-space: nowrap; }
.ped-table .pc-metarow { justify-content: flex-start; direction: rtl; text-align: right; margin-top: 1px; }
.ped-table .pc-part, .ped-table .pp-one { text-align: right !important; direction: rtl; }
.ped-table .pc-name, .ped-table .pc-g1 .pc-name, .ped-table .pc-g2 .pc-name, .ped-table .pc-g3 .pc-name, .ped-table .pc-g4 .pc-name, .ped-table .pc-g5 .pc-name { font-size: 11.5px; }
.ped-table .pc-g1 .pc-name { font-size: 12.5px; }
.ped-table.ped-g5 .pc-g5 .pc-name, .ped-table.ped-g5 .pc-g4 .pc-name { font-size: 10.5px; }
.ped-subject-name bdi { unicode-bidi: isolate; }
@media (max-width: 759px) {
  .ped-table td.pc:not(.pc-empty) { padding: 2px 4px !important; }
  .ped-table .pc-name, .ped-table .pc-g1 .pc-name, .ped-table .pc-g2 .pc-name, .ped-table .pc-g3 .pc-name, .ped-table .pc-g4 .pc-name, .ped-table .pc-g5 .pc-name { font-size: 10px; letter-spacing: 0; }
  .ped-table .pc-g1 .pc-name { font-size: 10.5px; }
  .ped-table.ped-g5 .pc-g4 .pc-name, .ped-table.ped-g5 .pc-g5 .pc-name { font-size: 9px; }
  .ped-table .pc-namerow .disc-marks { margin-inline-start: 2px !important; }
}

/* ===== v11s: full-site QA fixes ===== */
/* competition/event titles: wrap (max 2 lines) instead of "…" */
.comp-n { white-space: normal !important; overflow: hidden; text-overflow: clip !important; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.35; overflow-wrap: anywhere; }
.comp summary { align-items: flex-start; }
/* relatives tables on phones: full names wrap, nothing cut to "…" */
@media (max-width: 759px) {
  .rel-table th, .rel-table td { white-space: normal !important; text-overflow: clip !important; overflow: visible !important; overflow-wrap: anywhere; vertical-align: middle; }
  .rel-table td a, .rel-table .rel-name .en-up { white-space: normal !important; text-overflow: clip !important; overflow: visible !important; display: inline !important; }
  .rel-table .rel-name { display: inline !important; }
  .rel-table .rel-name .disc-marks { display: inline-flex !important; vertical-align: middle; margin-inline-start: 3px; }
  .rel-table th:nth-child(2), .rel-table td:nth-child(2) { width: 13%; }
  .rel-table th:nth-child(3), .rel-table td:nth-child(3) { width: 13%; }
  .rel-table th:last-child, .rel-table td:last-child { width: 15%; }
  .rel-table .pb { white-space: nowrap; }
}
/* consistent right alignment */
.reg-foot { text-align: right !important; }
.ped-table td.pc-empty { text-align: right !important; padding-right: 6px !important; }
/* v11s: break pedigree names only at spaces (long single words are shrunk by fitNames) */
.ped-table .pc-namerow, .ped-table .pc-namerow[dir] { overflow-wrap: normal !important; word-break: keep-all !important; }
.ped-table .pc-name-link bdi { white-space: normal; }
/* v11s: repeated ancestors (inbreeding) — each one its own colour, clearly visible inside every cell where it appears */
.ped-table td.pc.pc-dup { background: color-mix(in srgb, var(--dup) 17%, #fffdf8) !important; box-shadow: inset -5px 0 0 var(--dup) !important; outline: 1px solid color-mix(in srgb, var(--dup) 55%, transparent); outline-offset: -1px; }
.ped-table td.pc.pc-dup .pc-name-link { color: var(--dup) !important; }
.ped-table td.pc.pc-dup .pc-meta { color: color-mix(in srgb, var(--dup) 70%, #4a3a2c); }
@media (max-width: 759px) { .ped-table td.pc.pc-dup { box-shadow: inset -4px 0 0 var(--dup) !important; } }
/* v11s: relatives tables — break only between words, roomy columns */
@media (max-width: 759px) {
  .rel-table th, .rel-table td { overflow-wrap: normal !important; word-break: keep-all !important; }
  .rel-table th { white-space: nowrap !important; font-size: 10px; }
  .rel-table th:first-child, .rel-table td:first-child { width: 34% !important; }
  .rel-table th:nth-child(2), .rel-table td:nth-child(2) { width: 12% !important; }
  .rel-table th:nth-child(3), .rel-table td:nth-child(3) { width: 12% !important; }
  .rel-table th:last-child, .rel-table td:last-child { width: 14% !important; }
  .rel-table td:nth-child(4) .en-up { font-size: 10px; }
  .rel-table td { font-size: 11px; }
}

/* v11t: Arabic name line under the English name in pedigree cells */
.ped-table td.pc .pc-arrow{display:block;text-align:right;direction:rtl;font-size:.86em;line-height:1.25;margin-top:1px;word-break:keep-all;overflow-wrap:normal;white-space:normal}
.ped-table td.pc .pc-ar-link{color:inherit;opacity:.85;text-decoration:none;font-weight:600}
.ped-subject-ar{display:block;font-size:.9em;opacity:.85;margin-top:2px}
/* ===== v11w: compact pedigree proportions (classic chart sizing) — same layout, order and inbreeding colours ===== */
.pedigree-panel { padding: 8px; }
.ped-table th { padding: 3px 6px; font-size: .68rem; }
.ped-table td.pc { line-height: 1.12; }
.ped-table td.pc:not(.pc-empty) { padding: 1px 5px !important; }
.ped-table td.pc-g1:not(.pc-empty) { padding: 3px 6px !important; }
.ped-table .pc-name, .ped-table .pc-g2 .pc-name, .ped-table .pc-g3 .pc-name, .ped-table .pc-g4 .pc-name, .ped-table .pc-g5 .pc-name { font-size: 11px; letter-spacing: .01em; }
.ped-table .pc-g1 .pc-name { font-size: 12px; }
.ped-table.ped-g5 .pc-g4 .pc-name, .ped-table.ped-g5 .pc-g5 .pc-name { font-size: 10.5px; }
.ped-table td.pc .pc-arrow { font-size: 9.5px; line-height: 1.12; margin-top: 0; }
.ped-table .pc-metarow { margin-top: 0; }
.ped-table .pc-meta { font-size: 8.5px; line-height: 1.12; }
.ped-table .pc-badges .badge, .ped-table .pc-badges > * { font-size: 8px; line-height: 1.1; padding-top: 0; padding-bottom: 0; }
.ped-table .pc-part { margin-top: 0; }
.ped-table .pp-one { font-size: 9px; line-height: 1.15; }
.ped-table .pc-namerow .disc-marks { font-size: 9.5px !important; line-height: 1; gap: 0; }
.ped-gens { gap: 4px; font-size: .78rem; }
.ped-gens button { min-width: 32px; min-height: 30px; border-radius: 8px; }
.ped-subject { padding: 5px 10px; border-radius: 10px; }
.ped-subject-name { font-size: .95rem; }
@media (max-width: 759px) {
  .pedigree-panel { padding: 6px; border-radius: 14px; }
  .ped-table td.pc:not(.pc-empty) { padding: 1px 3px !important; }
  .ped-table td.pc-g1:not(.pc-empty) { padding: 2px 4px !important; }
  .ped-table td.pc { line-height: 1.08; }
  .ped-table .pc-name, .ped-table .pc-g2 .pc-name, .ped-table .pc-g3 .pc-name, .ped-table .pc-g4 .pc-name, .ped-table .pc-g5 .pc-name { font-size: 10px; letter-spacing: 0; }
  .ped-table .pc-g1 .pc-name { font-size: 10.5px; }
  .ped-table.ped-g5 .pc-g4 .pc-name, .ped-table.ped-g5 .pc-g5 .pc-name { font-size: 9px; }
  .ped-table td.pc .pc-arrow { font-size: 8.5px; line-height: 1.08; }
  .ped-table .pc-meta { font-size: 8px; }
  .ped-table .pp-one { font-size: 8.5px; }
  .ped-table .pc-namerow .disc-marks { font-size: 8.5px !important; }
  .ped-gens button { min-width: 36px; min-height: 34px; }
}
/* ===== v11x: one colour system site-wide (dark green + gold), shared tokens; pedigree inbreeding colours untouched ===== */
:root {
  --t-green: color-mix(in srgb, var(--g-4) 11%, var(--card));   /* light green tint on cards */
  --t-green-bd: color-mix(in srgb, var(--g-4) 30%, var(--card));
  --t-gold: color-mix(in srgb, var(--gold) 20%, var(--card));    /* light gold tint */
  --t-gold-bd: color-mix(in srgb, var(--gold) 55%, var(--card));
  --t-rust: color-mix(in srgb, #9b2c1f 12%, var(--card));        /* warning tint (warm, in palette) */
  --t-rust-bd: color-mix(in srgb, #9b2c1f 35%, var(--card));
  --on-dark: var(--cream); --on-dark-muted: rgba(247,240,228,.72);
  --ink-soft: #4f4436;  /* body muted text on light cards */
  --field-bd: color-mix(in srgb, var(--gold) 55%, #ffffff);
}
/* badges & chips */
.badge-open { background: var(--g-3); color: var(--on-dark); border-color: var(--g-1); }
.badge-ref { background: var(--t-green); color: var(--g-3); border-color: var(--t-green-bd); }
.coi-low { background: var(--t-green); color: var(--g-3); border-color: var(--t-green-bd); }
.coi-mid { background: var(--t-gold); color: var(--gold-deep); border-color: var(--t-gold-bd); }
.coi-high { background: var(--t-rust); color: #8a2a1c; border-color: var(--t-rust-bd); }
.nb-champ { background: var(--t-gold); color: #6b4a10; }
.nb-prod { background: var(--t-green); color: var(--g-3); }
.nb-br { background: color-mix(in srgb, var(--gold) 14%, var(--card)); color: var(--g-3); border: 1px solid var(--t-gold-bd); }
.nb-list li { border-bottom-color: color-mix(in srgb, var(--gold) 22%, var(--card)); }
.status-upcoming { background: var(--t-green); color: var(--g-3); border-color: var(--t-green-bd); }
.status-current { background: var(--t-gold); color: #6b4a10; border-color: var(--gold); }
.status-past, .status-listed { background: var(--sand); color: var(--ink-soft); }
/* text on light cards: readable warm muted, never pale-on-cream */
.nb-list .tiny, .acc-body .tiny, .comp-body .tiny, .card .tiny, .section .tiny { color: var(--ink-soft); }
.disclaimer { color: var(--ink-soft); background: var(--paper); border-color: var(--t-gold-bd); }
.pc-dash { color: #a8977a; }
/* forms (admin / register / inquiry / mating): same field style everywhere */
.form label { color: var(--gold-soft); }
.card .form label, .section .form label { color: var(--g-3); }
#horse-form label, .wrap.page > .form label { color: var(--gold-soft); }
.form input, .form select, .form textarea, .inq-form input, .inq-form textarea, .mate-form input, .mate-form select, .cal-filters select {
  background: var(--card); color: var(--text); border: 1px solid var(--field-bd); accent-color: var(--g-4); }
.form input:focus, .form select:focus, .form textarea:focus, .inq-form input:focus, .inq-form textarea:focus, .mate-form input:focus, .mate-form select:focus {
  outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.req { color: #9b2c1f; }
.reg-foal .req { color: var(--gold-soft); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--g-4); }
/* links: one colour on light, one on dark */
a { color: var(--g-4); }
a:hover { color: var(--gold-deep); }
.site-header a, .site-footer a, footer a { color: var(--gold-soft); }
.site-footer a:hover, footer a:hover { color: var(--gold); }

.wrap.page > p.disclaimer { color: var(--ink-soft) !important; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { border-color: var(--field-bd); }

/* v11y: featured horses ranked by 1st places */
.nb-rank { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 5px; margin-inline-end: 6px; border-radius: 999px; background: var(--g-3); color: var(--gold-soft); font-size: 11px; font-weight: 800; vertical-align: 1px; }
.nb-list li:nth-child(-n+3) .nb-rank { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: var(--g-1); }
.nb-b.nb-wins { font-weight: 800; background: var(--t-gold); color: #6b4a10; border: 1px solid var(--t-gold-bd); }

/* v14d: WhatsApp share button (site tokens; WhatsApp green only on the icon) */
.btn.wa-share {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--touch); min-width: var(--touch);
  padding: 8px 14px;
  background: var(--g-2); color: var(--gold-soft); border: 1px solid var(--gold);
  white-space: normal; overflow-wrap: anywhere; text-decoration: none;
  box-sizing: border-box; max-width: 100%;
}
.btn.wa-share:hover, .btn.wa-share:focus-visible { background: var(--g-3); color: #fff; border-color: var(--gold-soft); }
.btn.wa-share .wa-ico { flex: 0 0 auto; display: block; }
.footer-share, .page-share { margin: 10px 0 4px; max-width: 100%; }
.page-share { margin: 8px 0 14px; }
.site-footer .btn.wa-share { color: var(--gold-soft); }
.ped-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; max-width: 100%; }
.ped-head h2 { margin: 0; }
.ped-head .btn.wa-share { flex: 0 1 auto; }
.horse-hero .toolbar-links .btn.wa-share { min-height: var(--touch); padding: 8px 14px; font-size: inherit; }
@media (max-width: 420px) { .toolbar-links { flex-wrap: wrap; } .btn.wa-share { padding-inline: 12px; } }

/* v12b: visitor counter (own worker API) */
.visit-counter { color: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: color-mix(in srgb, var(--g-2) 70%, transparent); font-size: 11px; white-space: nowrap; }
.visit-counter b { color: var(--gold-soft); }
.visit-counter .vc-today[hidden] { display: none !important; }
.visit-counter .vc-today { opacity: .85; }
@media (max-width: 360px) { .visit-counter .vc-today { display: none !important; } }
/* v12b: keep counter clearly readable at the top on phones (it sits beside the logo, outside the collapsible menu) */
@media (max-width: 700px) { .visit-counter { font-size: 12.5px; padding: 3px 9px; } .visit-counter b { font-size: 13px; } }
@media (max-width: 360px) { .visit-counter { font-size: 11.5px; padding: 2px 7px; } }
/* v12d: world + Kuwait news */
.wn-section { margin: 8px 0 26px; }
.wn-h { font-family: var(--serif); color: var(--g-2); font-size: 1.35rem; margin: 18px 0 6px; border-bottom: 2px solid var(--gold); padding-bottom: 6px; }
.wn-sub { color: var(--gold-deep); font-size: 1.05rem; margin: 16px 0 8px; }
.wn-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.wn-chip { border: 1px solid var(--gold); background: #fff; color: var(--g-2); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .88rem; cursor: pointer; }
.wn-chip.is-on, .wn-chip:hover { background: var(--g-2); color: var(--gold-soft); }
.wn-list { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .wn-list { grid-template-columns: 1fr 1fr; } }
.wn-card { background: #fff; border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); border-inline-start: 4px solid var(--g-3); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.wn-card[hidden] { display: none; }
.wn-card h3 { margin: 6px 0; color: var(--g-1); font-size: 1.04rem; line-height: 1.5; overflow-wrap: anywhere; }
.wn-card p { margin: 4px 0; color: var(--ink-soft, #4f4436); line-height: 1.7; font-size: .95rem; }
.wn-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .82rem; color: var(--ink-soft, #4f4436); }
.wn-cat { background: var(--g-2); color: var(--gold-soft); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.wn-country { border: 1px solid var(--gold); border-radius: 999px; padding: 1px 8px; color: var(--g-2); }
.wn-horses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wn-horse { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px; background: color-mix(in srgb, var(--gold-soft) 35%, #fff); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); border-radius: 8px; padding: 2px 8px; font-size: .85rem; color: var(--g-1); text-decoration: none; max-width: 100%; overflow-wrap: anywhere; }
.wn-horse.is-link { border-color: var(--g-3); color: var(--g-2); font-weight: 700; }
.wn-horse.is-link:hover { background: var(--g-2); color: var(--gold-soft); }
.wn-en { font-size: .8em; letter-spacing: .02em; }
.wn-sep { opacity: .55; }
.wn-quote { margin: 8px 0; padding: 8px 12px; border-inline-start: 3px solid var(--gold); background: color-mix(in srgb, var(--gold-soft) 25%, #fff); color: var(--g-1); line-height: 1.8; border-radius: 6px; }
.wn-quote footer { margin-top: 4px; font-size: .85rem; color: var(--gold-deep); }
.wn-section .sub { color: rgb(223, 231, 225); }
.wn-sub { color: var(--gold-soft); }
.wn-h { color: var(--gold-soft); }

/* v12e: full race results inside news cards (white card: dark text) */
.wn-results{margin-top:.6rem;border-top:1px solid color-mix(in srgb, var(--gold) 45%, transparent);padding-top:.4rem}
.wn-results>summary{cursor:pointer;color:var(--gold-deep);font-weight:700;min-height:44px;display:flex;align-items:center}
.wn-race{margin:.5rem 0 .9rem}
.wn-card p.wn-race-h{margin:.2rem 0 .4rem;color:var(--g-1);font-size:.92rem;font-weight:700}
.wn-table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
.wn-table{width:100%;border-collapse:collapse;font-size:.85rem;min-width:560px}
.wn-table th,.wn-table td{padding:.35rem .45rem;border-bottom:1px solid var(--line);text-align:start;white-space:nowrap;color:var(--text)}
.wn-table th{color:var(--gold-deep);font-weight:700;background:var(--paper)}

/* v12f: «موسوعة الخيل» dropdown in the top nav */
.site-nav { position: relative; }
.nav-dd-btn { appearance: none; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; background: transparent; color: #e9e2cf; border: 1px solid transparent; border-radius: 999px; min-height: 34px; padding: 0 12px; font-size: .88rem; white-space: nowrap; }
.nav-dd-btn:hover, .nav-dd-btn[aria-expanded="true"] { background: rgba(211,166,84,.12); color: var(--gold-soft); }
.nav-dd-btn.is-current { background: rgba(211,166,84,.16); color: var(--gold-soft); border-color: rgba(211,166,84,.55); }
.nav-dd-btn:focus-visible, .nav-dd-menu a:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.nav-dd-caret { font-size: .7rem; transition: transform .15s ease; }
.nav-dd-btn[aria-expanded="true"] .nav-dd-caret { transform: rotate(180deg); }
.site-nav ul.nav-dd-menu[hidden] { display: none !important; }
.site-nav ul.nav-dd-menu { list-style: none; margin: 0; }
@media (min-width: 1040px) {
  .site-nav ul.nav-dd-menu { position: absolute; z-index: 60; min-width: 230px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
    background: #0d2a22; border: 1px solid rgba(211,166,84,.55); border-radius: 14px; box-shadow: 0 14px 30px rgba(0,0,0,.45); }
  .site-nav ul.nav-dd-menu a { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 10px; font-size: .92rem; }
}
@media (max-width: 1039.98px) {
  .nav-dd-btn { min-height: 36px; padding: 0 10px; font-size: .85rem; }
  .site-nav ul.nav-dd-menu { overflow: visible; -webkit-mask-image: none; mask-image: none; flex-direction: row; display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px 8px; margin: 0 0 4px; border-top: 1px solid rgba(211,166,84,.3); background: rgba(13,42,34,.6); border-radius: 0 0 12px 12px; }
  .site-nav ul.nav-dd-menu a { min-height: 36px; padding: 0 12px; font-size: .85rem; white-space: nowrap; border: 1px solid rgba(211,166,84,.4) !important; border-radius: 999px; }
}

/* v12f: home «أبرز أخبار الخيل» under the foal-registration button */
.home-news { margin: 18px 0 4px; }
.home-news[hidden] { display: none; }
.home-news .wn-h { text-align: center; margin: 0 0 12px; color: var(--gold-soft); }
.home-news-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.home-news .wn-card p.home-news-sum { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.home-news-more { display: flex; justify-content: center; margin: 14px 0 0; }
.home-news-more .btn { min-height: 44px; }
@media (max-width: 640px) { .home-news-list { grid-template-columns: 1fr; } }

/* v12g: restored v11b «الأبرز» list shown directly inside each category (ranked by 1st places, «فوز ×N» before the name) */
.nb-top { margin: 10px 0 12px; }
.nb-top > h3 { font-size: 1rem; margin: 6px 0 6px; color: var(--g-1); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nb-list li a.nb-b.nb-champ { text-decoration: none; font-weight: 800; border: 1px solid var(--t-gold-bd); min-width: 54px; text-align: center; }
.nb-list li a.nb-b.nb-champ:hover, .nb-list li a.nb-b.nb-champ:focus-visible { background: var(--gold); color: var(--g-1); }
.nb-list li a[dir="ltr"] { overflow-wrap: anywhere; white-space: normal; }
.nb-top > h3 .nb-sort { flex-basis: 100%; font-weight: 400; color: var(--ink-soft, #4f4436); }

/* v12i: link to the other record of the same horse */
.same-as-note { margin: 8px 0 0; font-size: .92rem; color: var(--gold-soft); }
.same-as-note a { color: #fff; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }

/* v12s/v12v: كلاس / تشامبيون tags on beauty-show results (horse page). One list, no grouping. Tags must not truncate. */
.show-kind {
  display: inline-block;
  flex: 0 1 auto;
  font-size: .75rem;
  font-weight: 800;
  line-height: 1.4;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.show-kind-champ {
  background: color-mix(in srgb, var(--gold) 42%, var(--card));
  color: #5a3d0c;
  border: 1.5px solid var(--gold);
  font-size: .92rem;
  font-weight: 800;
  padding: 4px 12px;
  box-shadow: 0 1px 0 rgba(201,162,84,.35);
}
.show-kind-ico { font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.show-kind-class {
  background: var(--t-green, #eef2f4);
  color: var(--g-3, #3d5562);
  border: 1px solid var(--t-green-bd, #cfd8de);
}
.show-kind-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  flex-wrap: wrap;
  max-width: 100%;
}
.race-item.is-champ:not(.is-medal) { border-color: var(--t-gold-bd); }
.race-item.is-champ { background: color-mix(in srgb, var(--gold) 8%, var(--card)); }
.race-item .top strong {
  min-width: 0;
  flex: 1 1 12rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
@media (max-width: 420px) {
  .show-kind-champ { font-size: .88rem; padding: 4px 10px; }
  .show-kind-class { font-size: .72rem; padding: 2px 8px; }
  .race-item .top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .race-item .top strong { flex: 1 1 auto; width: 100%; }
}

/* v12t: merge compare into test-mating — tabs + no name/title truncation */
.tool-hero h1 { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.tool-hero .sub { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.tool-tabs { margin: 0 0 14px; }
.tool-tabs .tab-btn { font-size: .95rem; white-space: normal; overflow: visible; text-overflow: unset; overflow-wrap: anywhere; }
.mate-form .inq-err { grid-column: 1 / -1; margin: 0; }
.cmp-col h2, .cmp-col h2 a { overflow-wrap: anywhere; white-space: normal; }
@media (max-width: 420px) {
  .tool-tabs { gap: 4px; padding: 3px; }
  .tool-tabs .tab-btn { font-size: .88rem; padding: 8px 6px; line-height: 1.3; }
  .tool-hero h1 { font-size: 1.28rem; line-height: 1.35; }
}
/* v13f news: month headings, status line */
.wn-month { margin: 14px 0 6px; font-size: .98rem; color: var(--gold-soft); border-inline-start: 3px solid var(--gold); padding-inline-start: 8px; }
.wn-status[hidden], .wn-filters[hidden] { display: none; }
.wn-window, .wn-status .sub, #wn-root .sub { color: rgb(223, 231, 225); }

/* ===== v13g: results tables fit the viewport on mobile — wrap names, no sideways scroll, nothing cut off ===== */
.wn-card, .wn-results, .wn-race, .wn-table-wrap, .rel-table-wrap, .table-wrap, .table-scroll {
  min-width: 0;
  max-width: 100%;
}

/* News race results: 6-col table when the card is wide; compact 4-col+meta when the
   container is narrow (phones, or the desktop two-column news grid). Names wrap, never truncate. */
.wn-table-wrap {
  overflow-x: hidden;
  width: 100%;
  container-type: inline-size;
  container-name: wn-table;
}
.wn-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: .85rem;
}
.wn-table th, .wn-table td {
  padding: .4rem .45rem;
  border-bottom: 1px solid var(--line);
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
  color: var(--text);
}
.wn-table th { color: var(--gold-deep); font-weight: 700; background: var(--paper); }
.wn-th-short { display: none; }
.wn-th-pos, .wn-td-pos { width: 3.6rem; text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; }
.wn-th-time, .wn-td-time { width: 6.4rem; font-variant-numeric: tabular-nums; }
.wn-th-jockey, .wn-td-jockey { width: 16%; }
.wn-th-trainer, .wn-td-trainer { width: 18%; }
.wn-th-owner, .wn-td-owner { width: 18%; }
.wn-td-trainer:empty::after,
.wn-td-owner:empty::after { content: "—"; }

.wn-table .wn-horse {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  max-width: 100%;
  font-size: inherit;
  line-height: 1.35;
}
.wn-table .wn-sep { display: none; }
.wn-table .wn-ar { font-weight: 700; overflow-wrap: anywhere; }
.wn-table .wn-en { font-size: .78em; letter-spacing: .02em; opacity: .88; overflow-wrap: anywhere; }

@container wn-table (max-width: 639px) {
  .wn-table { display: block; font-size: .78rem; }
  .wn-table thead, .wn-table tbody { display: block; width: 100%; }
  .wn-table thead tr,
  .wn-table tbody tr {
    display: grid;
    grid-template-columns: 1.7rem minmax(0, 1.35fr) 4.35rem minmax(0, 1fr);
    column-gap: 6px;
    row-gap: 2px;
    width: 100%;
    align-items: start;
  }
  .wn-table thead tr { border-bottom: 1px solid var(--line); padding: 4px 0 6px; }
  .wn-table tbody tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .wn-table th, .wn-table td {
    display: block;
    width: auto !important;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .wn-th-pos, .wn-td-pos { grid-column: 1; grid-row: 1; text-align: center; padding-top: 1px; font-size: .95em; }
  .wn-th-horse, .wn-td-horse { grid-column: 2; grid-row: 1; min-width: 0; }
  .wn-th-time, .wn-td-time { grid-column: 3; grid-row: 1; }
  .wn-th-jockey, .wn-td-jockey { grid-column: 4; grid-row: 1; min-width: 0; }
  .wn-table th.wn-th-trainer,
  .wn-table th.wn-th-owner { display: none; }
  .wn-td-trainer, .wn-td-owner {
    grid-column: 2 / 5;
    font-size: .72rem;
    color: var(--muted, #6E5846);
    min-width: 0;
  }
  .wn-td-trainer:not(:empty)::before { content: "المدرب: "; font-weight: 700; color: var(--gold-deep); }
  .wn-td-owner:not(:empty)::before { content: "المالك: "; font-weight: 700; color: var(--gold-deep); }
  .wn-table td.wn-td-trainer:empty,
  .wn-table td.wn-td-owner:empty { display: none; }
  .wn-th-long { display: none; }
  .wn-th-short { display: inline; }
}
@container wn-table (max-width: 359px) {
  .wn-table thead tr,
  .wn-table tbody tr {
    grid-template-columns: 1.5rem minmax(0, 1.4fr) 3.9rem minmax(0, .95fr);
    column-gap: 4px;
  }
  .wn-table { font-size: .74rem; }
}

/* Competition / show result tables (se.html, open.html).
   Keep td as table-cell (never display:flex on the cell — that collapses the column).
   Inner .rel-horse stacks Arabic over English. Widths use !important to beat v11s family-table percentages. */
.rel-table.rel-results { min-width: 0; table-layout: fixed; width: 100%; }
.rel-table.rel-results th:nth-child(1),
.rel-table.rel-results td:nth-child(1),
.rel-table.rel-results th.rel-th-pos,
.rel-table.rel-results td.rel-td-pos { width: 3.6rem !important; }
.rel-table.rel-results th:nth-child(2),
.rel-table.rel-results td:nth-child(2),
.rel-table.rel-results td.rel-name-td { width: auto !important; }
.rel-table.rel-results th:nth-child(3),
.rel-table.rel-results td:nth-child(3),
.rel-table.rel-results th.rel-th-time,
.rel-table.rel-results td.rel-td-time { width: 5.2rem !important; }
.rel-horse {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
}
.rel-horse .rel-ar { font-weight: 700; margin: 0; display: block; white-space: normal; overflow-wrap: break-word; }
.rel-horse .en-up, .rel-horse .rel-name { display: block; font-size: .8em; white-space: normal; overflow: visible; overflow-wrap: break-word; }

/* All rel-tables: wrap names at spaces, never ellipsis or letter-stack; cells stay table-cell */
@media (max-width: 759px) {
  .rel-table-wrap { overflow-x: hidden; width: 100%; }
  .rel-table { min-width: 0 !important; width: 100%; table-layout: fixed; }
  .rel-table th, .rel-table td {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    vertical-align: top;
  }
  .rel-table .rel-name-td { display: table-cell !important; }
  .rel-table .rel-ar {
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
  }
  .rel-table .rel-name { display: block !important; max-width: 100%; }
  .rel-table .rel-name .en-up {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
  }
  /* family tables: name column stays the widest */
  .rel-table:not(.rel-results) th:first-child,
  .rel-table:not(.rel-results) td:first-child { width: 42% !important; }
  .rel-table.rel-results th:first-child,
  .rel-table.rel-results td:first-child,
  .rel-table.rel-results th.rel-th-pos,
  .rel-table.rel-results td.rel-td-pos { width: 2.8rem !important; }
  .rel-table.rel-results th:nth-child(2),
  .rel-table.rel-results td:nth-child(2),
  .rel-table.rel-results td.rel-name-td { width: auto !important; }
  .rel-table.rel-results th:nth-child(3),
  .rel-table.rel-results td:nth-child(3),
  .rel-table.rel-results th.rel-th-time,
  .rel-table.rel-results td.rel-td-time { width: 4.6rem !important; }
  .rel-table.rel-results th:last-child,
  .rel-table.rel-results td:last-child { width: 4.6rem !important; }
  /* 3-col results: last-child is time; override the family 14% last-child rule */
  .rel-table.rel-results th:nth-child(2):last-child,
  .rel-table.rel-results td:nth-child(2):last-child { width: auto !important; }
}

/* Calendar tables already stack under 600px — drop min-width so they cannot force a sideways scroll */
@media (max-width: 600px) {
  table.cal { min-width: 0 !important; }
  .table-wrap { overflow-x: hidden; width: 100%; }
}

/* Horse-page sire-stats and any .stat-table */
.stat-table { min-width: 0; table-layout: fixed; width: 100%; }
.stat-table th, .stat-table td { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 639px) {
  .table-scroll { overflow-x: hidden; width: 100%; }
  .stat-table { display: block; width: 100%; font-size: .82rem; }
  .stat-table thead { display: none; }
  .stat-table tbody { display: block; width: 100%; }
  .stat-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 10px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0,0,0,.06);
    width: 100%;
  }
  .stat-table td {
    display: block;
    padding: 2px 0;
    text-align: start;
    white-space: normal;
    border: 0;
    min-width: 0;
  }
  .stat-table td:first-child { grid-column: 1 / -1; font-weight: 800; }
  .stat-table td::before { content: attr(data-label) " "; font-weight: 700; color: var(--gold-deep); }
}

/* Horse-page race / show entry lists: names and titles wrap fully */
.race-item, .race-item .top, .race-item .top strong, .race-item .muted {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

/* v13i: race pages use the news results table (.wn-table); status text for non-placed starters; horse-page people line */
.comp-body .wn-table-wrap { margin: 6px 0; }
.wn-table .wn-status-txt { font-size: .85em; color: var(--muted, #6E5846); overflow-wrap: anywhere; }
.race-item .race-people { font-size: .82rem; overflow-wrap: anywhere; }

/* v13j: تشغيل الخيل — original Asayel workout section, mobile-first */
.wo-wrap { padding-bottom: 2.5rem; max-width: 820px; }
.wo-hero { margin: 8px 0 18px; }
.wo-kicker { color: var(--gold-deep); font-weight: 800; margin: 0 0 4px; letter-spacing: .04em; }
.wo-hero h1 { font-family: var(--serif); font-size: 1.8rem; margin: 0 0 8px; color: var(--gold-soft); }
.wo-lead, .wo-hint, .wo-note, .wo-meta { overflow-wrap: anywhere; word-break: break-word; }
.wo-lead { margin: 0; color: var(--muted); }
.wo-tabs {
  display: flex; gap: 6px; margin: 0 0 18px; padding: 4px; background: var(--sand);
  border-radius: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.wo-tab {
  flex: 1 1 0; min-width: 0; text-align: center; text-decoration: none; color: var(--brown-3);
  font-weight: 800; padding: 10px 8px; min-height: var(--touch); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.wo-tab.is-current, .wo-tab[aria-current="page"] { background: var(--brown); color: var(--gold-soft); }
.wo-h { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 8px; }
.wo-hint { color: var(--muted); margin: 0 0 14px; }
.wo-note { color: var(--muted); font-size: .9rem; margin: 8px 0 14px; }
.wo-empty { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.wo-cards { display: grid; gap: 14px; }
.wo-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.wo-card:hover { border-color: var(--gold); }
.wo-card-kroki { background: #0b1f19; }
.wo-kroki-svg, .wo-card-kroki svg { width: 100%; height: auto; display: block; }
.wo-kroki-wrap { border-radius: var(--radius); overflow: hidden; background: #0b1f19; margin: 8px 0 10px; }
.wo-card-body { padding: 12px 14px 14px; }
.wo-card-body h2, .wo-track h2, .wo-on { overflow-wrap: anywhere; word-break: break-word; margin: 0 0 6px; font-size: 1.15rem; }
.wo-ar, .wo-en { overflow-wrap: anywhere; word-break: break-word; }
.wo-en { font-weight: 700; }
.wo-sep { color: var(--muted); }
.wo-more { margin: 8px 0 0; color: var(--gold-deep); font-weight: 800; }
.wo-facts { list-style: none; padding: 0; margin: 0 0 16px; }
.wo-facts li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.wo-facts strong { color: var(--gold-deep); margin-left: 8px; }
.wo-dists { margin: 0 0 16px; }
.wo-dists h3, .wo-recent h3, .wo-canvas-wrap h3, .wo-splits h3 { font-size: 1rem; margin: 0 0 8px; }
.wo-dists ul {
  display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0;
}
.wo-dists li {
  background: var(--sand); border: 1px solid var(--line); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: .92rem;
}
.wo-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 18px; }
.wo-btn { min-height: var(--touch); padding: 10px 16px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; }
.wo-actions .btn-ghost { background: var(--sand); color: var(--brown); border: 1px solid var(--line); }
.wo-stop { background: #7a2e1a; color: var(--cream); border-color: #7a2e1a; }
.wo-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0;
}
.wo-stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0;
}
.wo-stat-k { display: block; color: var(--muted); font-size: .82rem; font-weight: 700; }
.wo-stat-v { display: block; font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; }
.wo-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.wo-row-link {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; text-decoration: none; color: inherit;
}
.wo-row-link:hover { border-color: var(--gold); }
.wo-row-date, .wo-row-horse, .wo-row-track, .wo-row-stats { display: block; overflow-wrap: anywhere; word-break: break-word; }
.wo-row-date { font-weight: 800; color: var(--gold-deep); }
.wo-row-stats { color: var(--muted); margin-top: 4px; }
.wo-horse-link { color: inherit; text-decoration: none; font-weight: 800; overflow-wrap: anywhere; }
.wo-horse-box { margin: 12px 0; }
.wo-label { display: block; font-weight: 800; margin: 10px 0 4px; }
.wo-horse-box input[type="search"], .wo-form input, .wo-form select, .wo-form textarea, .wo-filters select {
  width: 100%; max-width: 100%; border: 1px solid var(--line); background: var(--paper);
  border-radius: 12px; padding: 10px 12px; min-height: var(--touch); box-sizing: border-box;
}
.wo-form textarea { min-height: 84px; resize: vertical; }
.wo-horse-box, .wo-entry, .wo-enc-request, .wo-prep, .wo-add-horse, .wo-form.wo-reg-horse {
  overflow: visible;
}
.wo-horse-results {
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin-top: 6px;
  max-height: min(240px, 45vh); overflow: auto; -webkit-overflow-scrolling: touch;
  position: relative; z-index: 30;
}
.wo-horse-hit {
  display: block; width: 100%; text-align: start; background: transparent; border: 0;
  border-bottom: 1px solid var(--line); padding: 10px 12px; cursor: pointer;
  overflow-wrap: anywhere; word-break: break-word; min-height: var(--touch);
  touch-action: manipulation; -webkit-tap-highlight-color: rgba(212, 175, 55, 0.25);
}
.wo-horse-hit:last-child { border-bottom: 0; }
.wo-picked { margin: 8px 0 0; overflow-wrap: anywhere; }
.wo-clear-horse { margin-right: 8px; background: none; border: 0; color: var(--gold-deep); font-weight: 800; cursor: pointer; min-height: var(--touch); }
.wo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wo-dur-row { grid-template-columns: 1fr 1fr 1fr; }
.wo-filters { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0 0 14px; }
.wo-filters label { font-weight: 800; }
.wo-warn { background: #f7ecd4; border: 1px solid var(--gold); border-radius: 12px; padding: 10px 12px; }
.wo-canvas-wrap { margin: 14px 0; }
.wo-canvas-wrap canvas { width: 100%; height: auto; display: block; border-radius: 12px; background: #0b1f19; }
.wo-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wo-table { width: 100%; border-collapse: collapse; min-width: 0; }
.wo-table th, .wo-table td { padding: 8px 6px; text-align: start; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.wo-table th { color: var(--gold-deep); font-size: .85rem; }
.wo-cal-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.wo-cal-nav strong { flex: 1 1 100%; text-align: center; overflow-wrap: anywhere; color: var(--ink); font-size: 1.15rem; order: -1; }
.wo-cal-nav .btn-ghost { background: var(--sand); color: var(--brown); border: 1px solid var(--line); flex: 1 1 40%; }
.wo-cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
}
.wo-cal-dow { font-size: .75rem; font-weight: 800; color: var(--gold-deep); text-align: center; padding: 4px 0; }
.wo-cal-day {
  min-width: 0; min-height: 64px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px; font-size: .78rem; overflow-wrap: anywhere; word-break: break-word;
}
.wo-cal-day.is-empty { background: transparent; border-color: transparent; }
.wo-cal-day.has-work { border-color: var(--gold); background: #f7ecd4; }
.wo-cal-n { display: block; font-weight: 800; }
.wo-cal-day ul { list-style: none; padding: 0; margin: 4px 0 0; }
.wo-cal-day a { text-decoration: none; color: var(--ink); font-weight: 700; display: block; }
.wo-back { margin: 0 0 8px; }
.wo-back a { text-decoration: none; font-weight: 800; color: var(--gold-deep); }
@media (min-width: 700px) {
  .wo-cards { grid-template-columns: 1fr 1fr; }
  .wo-filters { grid-template-columns: 1fr 1fr; }
  .wo-stats { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 430px) {
  .wo-cal-day { min-height: 52px; font-size: .7rem; padding: 3px; }
  .wo-dur-row, .wo-row { grid-template-columns: 1fr; }
  .wo-table thead { display: none; }
  .wo-table, .wo-table tbody, .wo-table tr, .wo-table td { display: block; width: 100%; }
  .wo-table tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .wo-table td { border: 0; padding: 2px 0; }
  .wo-table td::before { content: attr(data-label) " "; font-weight: 700; color: var(--gold-deep); }
}

/* v13k: membership, trainer horses, session roster, workout share — same Asayel tokens */
.wo-prep, .wo-share-box, .wo-account, .wo-trainer-horse, .wo-entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0 16px;
  min-width: 0;
}
.wo-prep h3, .wo-share-box h3, .wo-add-horse h3, .wo-trainer-head {
  margin: 0 0 8px;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.wo-entry { margin: 10px 0; }
.wo-entry-row { margin-bottom: 6px; }
.wo-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.wo-chip {
  border: 1px solid var(--line);
  background: var(--sand);
  color: var(--brown);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: var(--touch);
  font-weight: 800;
  cursor: pointer;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.wo-chip:hover, .wo-chip:focus-visible { border-color: var(--gold); }
.wo-trainer-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.wo-trainer-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.wo-trainer-head .wo-horse-link { color: var(--gold-deep); }
.wo-share-box .wo-actions { margin-bottom: 8px; }
.wo-recap-preview, .wo-recap-canvas {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 10px auto 0;
  border-radius: 12px;
  background: #0b1f19;
}
.wo-recap-canvas { position: fixed; inset: auto auto -9999px -9999px; width: 180px; pointer-events: none; opacity: .01; }
.wo-download { display: inline-block; margin: 8px 0 0; font-weight: 800; color: var(--gold-deep); overflow-wrap: anywhere; }
.wo-account input, .wo-prep input, .wo-entry input, .wo-add-horse input {
  width: 100%; max-width: 100%; border: 1px solid var(--line); background: var(--paper);
  border-radius: 12px; padding: 10px 12px; min-height: var(--touch); box-sizing: border-box;
}
#wo-otp { letter-spacing: .35em; font-size: 1.4rem; font-weight: 800; text-align: center; }
.wo-tabs { flex-wrap: nowrap; }
@media (max-width: 430px) {
  .wo-tab { font-size: .88rem; padding: 10px 6px; }
  .wo-entry-row { grid-template-columns: 1fr; }
}

/* v13l: workout map, gait color bar, gait split, heart rate — Asayel tokens only */
.wo-map-panel { margin: 0 0 14px; max-width: 100%; }
.wo-map-frame {
  width: 100%;
  height: 300px;
  border-radius: 12px;
  overflow: hidden;
  background: #0b1f19;
  border: 1px solid var(--line);
}
.wo-map-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  background: #0b1f19;
}
.wo-map-attr, .wo-map-empty p {
  color: var(--muted);
  font-size: .78rem;
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.wo-map-empty {
  min-height: 160px;
  border-radius: 12px;
  background: #0b1f19;
  color: var(--gold-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 16px;
  border: 1px solid var(--line);
}
.wo-map-empty p { color: var(--gold-soft); margin: 0; font-weight: 700; }
.wo-stat-hero { grid-column: 1 / -1; }
.wo-stat-hero .wo-stat-v { font-size: 1.55rem; color: var(--brown); }
.wo-colorbar { margin: 4px 0 16px; max-width: 100%; direction: ltr; }
.wo-cb-track {
  display: flex;
  width: 100%;
  min-height: 28px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.wo-cb-seg {
  min-width: 0;
  min-height: 14px;
}
.wo-cb-names {
  display: flex;
  width: 100%;
  margin-top: 4px;
  gap: 0;
}
.wo-cb-name {
  font-size: .72rem;
  font-weight: 800;
  color: var(--gold-soft);
  text-align: center;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.wo-cb-scale {
  position: relative;
  height: 1.15rem;
  margin-top: 2px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  direction: ltr;
}
.wo-cb-scale span {
  position: absolute;
  top: 0;
  white-space: nowrap;
}

.wo-gaits { margin: 8px 0 14px; }
.wo-gaits h3, .wo-hr h3 { font-size: 1rem; margin: 0 0 6px; }
.wo-gait-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wo-gait-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-inline-start-width: 5px;
  border-radius: 12px;
  padding: 10px 10px 10px 12px;
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: start;
}
.wo-gait-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 6px; grid-row: 1 / 3;
}
.wo-gait-name { font-weight: 800; overflow-wrap: anywhere; }
.wo-gait-vals {
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
  overflow-wrap: anywhere;
}
.wo-hr { margin: 8px 0 16px; }
.wo-hr-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 8px;
}
@media (max-width: 430px) {
  .wo-map-frame { height: 280px; }
  .wo-stat-hero .wo-stat-v { font-size: 1.4rem; }
  .wo-cb-name { font-size: .65rem; }
}

.wo-section h2, .wo-h, .wo-gaits h3, .wo-hr h3, .wo-splits h3, .wo-share-box h3, .wo-recent h3, .wo-dists h3, .wo-prep h3, .wo-add-horse h3, .wo-trainer-head {
  color: var(--gold-soft);
}
.wo-recap-preview {
  width: 280px !important;
  max-width: 100%;
  height: auto !important;
  aspect-ratio: 720 / 1280;
  max-height: 500px;
}
canvas.wo-recap-preview {
  width: 280px !important;
  height: 498px !important;
  max-width: 100%;
}

/* v13m: ميدان التشغيل — roles, members, orders inbox, plans, live plan, trainer views (Asayel tokens only) */
.wo-tabs { flex-wrap: wrap; overflow-x: visible; }
.wo-tab { position: relative; flex: 1 1 18%; }
.wo-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-inline-start: 6px; border-radius: 999px; background: #A65B2B; color: #fff; font-size: .75rem; font-weight: 800; line-height: 1; font-family: Tajawal, sans-serif; }
.wo-badge-inline { vertical-align: middle; }
.wo-group-card, .wo-today, .wo-requests, .wo-notify, .wo-trainer-tools, .wo-op-inbox, .wo-live-plan, .wo-plan-day, .wo-plan-notes, .wo-plan-cmp, .wo-hnotes, .wo-rc, .wo-th, .wo-roles form, .wo-day-ed, .wo-end-horse, .wo-week-sum, .wo-plan-banner, .wo-join-cta {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; min-width: 0; overflow-wrap: anywhere;
}
.wo-group-card h3, .wo-today h3, .wo-requests h3, .wo-notify h3, .wo-trainer-tools h3, .wo-op-inbox h3, .wo-plan-day h3, .wo-plan-notes h3, .wo-plan-cmp h3, .wo-hnotes h3, .wo-end h3, .wo-sent h3, .wo-thorse h3, .wo-compose h3, .wo-trainer-tools h4, .wo-mytpl h4, .wo-join-cta h2 { margin: 0 0 8px; font-size: 1.05rem; color: var(--gold-soft); }
.wo-members, .wo-inbox, .wo-req-list, .wo-rcs, .wo-th-list, .wo-th-ops, .wo-muted, .wo-hlist, .wo-mytpl ul, .wo-hnotes ul, .wo-sum-gaits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wo-members li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wo-mname { font-weight: 800; min-width: 0; }
.wo-role, .wo-tag, .wo-kind, .wo-gchip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 800; border: 1px solid var(--line); white-space: nowrap; }
.wo-role-trainer, .wo-kind-week { background: rgba(201,162,84,.18); color: var(--gold-deep); }
.wo-role-operator, .wo-kind-day { background: rgba(143,174,140,.22); color: #3f5e3c; }
.wo-kind-message { background: rgba(122,46,26,.12); color: #7A2E1A; }
.wo-tag-ok { background: rgba(143,174,140,.25); color: #2f4f2c; border-color: rgba(143,174,140,.6); }
.wo-gchip { border-color: var(--g); color: var(--ink); background: color-mix(in srgb, var(--g) 22%, transparent); }
.wo-inbox-row a { display: grid; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: inherit; min-width: 0; }
.wo-inbox-row.is-unread a { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold); }
.wo-inbox-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wo-from { font-weight: 800; min-width: 0; overflow-wrap: anywhere; }
.wo-dot { width: 9px; height: 9px; border-radius: 50%; background: #A65B2B; display: inline-block; }
.wo-inbox-horse, .wo-inbox-when, .wo-inbox-text, .wo-inbox-stat { overflow-wrap: anywhere; }
.wo-inbox-at { color: var(--muted); font-size: .8rem; text-align: start; }
.wo-actions-wrap { flex-wrap: wrap; }
.wo-segs { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.wo-segs li { display: grid; grid-template-columns: 28px auto 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.wo-seg-n { font-weight: 800; color: var(--gold-deep); text-align: center; }
.wo-seg-a { font-weight: 800; }
.wo-seg-t { color: var(--muted); font-weight: 700; white-space: nowrap; }
.wo-plan-day.is-today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.wo-rest { font-weight: 800; color: var(--muted); }
.wo-msg-text, .wo-plan-notes p { white-space: pre-wrap; overflow-wrap: anywhere; }
.wo-check { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.wo-check input { width: 20px !important; height: 20px; min-height: 0 !important; flex: 0 0 auto; accent-color: var(--gold-deep); }
.wo-share-check { margin-top: 12px; }
.wo-role-pick { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.wo-role-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.wo-role-opt.is-on { border-color: var(--gold); background: rgba(201,162,84,.12); }
.wo-role-opt input { width: 20px !important; height: 20px; min-height: 0 !important; grid-row: span 2; accent-color: var(--gold-deep); }
.wo-role-opt small { color: var(--muted); grid-column: 2; }
.wo-live-plan .wo-lp-head { font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.wo-lp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.wo-lp-grid > div { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; min-width: 0; }
.wo-lp-grid .wo-stat-v { font-size: .98rem; }
.wo-lp-verdict { font-weight: 800; margin: 8px 0 4px; }
.is-in .wo-stat-v, .wo-lp-verdict.is-in, .wo-v-in { color: #2f6b2a; }
.is-slow .wo-stat-v, .wo-lp-verdict.is-slow, .wo-v-slow { color: #9A7430; }
.is-fast .wo-stat-v, .wo-lp-verdict.is-fast, .wo-v-fast { color: #7A2E1A; }
.wo-v-none { color: var(--muted); }
.wo-lp-bar { height: 8px; border-radius: 999px; background: var(--sand); overflow: hidden; margin: 6px 0 2px; }
.wo-lp-bar span { display: block; height: 100%; background: var(--gold); }
.wo-plan-banner { padding: 8px 12px; border-color: var(--gold); }
.wo-sum-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 6px 0; }
.wo-sum-grid > div { border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; min-width: 0; }
.wo-sum-gaits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin: 6px 0; }
.wo-sum-gaits li { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .88rem; }
.wo-hnotes li p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.wo-rc-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.wo-rc-st { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.wo-rc-done { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 6px; }
.wo-seg-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.wo-seg-tabs a { flex: 1 1 0; min-width: 0; text-align: center; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; font-weight: 800; color: inherit; }
.wo-seg-tabs a.is-on { background: var(--brown); color: var(--gold-soft); border-color: var(--brown); }
.wo-rcpts { display: grid; gap: 6px; margin: 4px 0 8px; }
.wo-rcpt-op { border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; }
.wo-rcpt-horses { display: flex; flex-wrap: wrap; gap: 6px; padding-inline-start: 28px; }
.wo-chip-check { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; margin: 0; font-size: .88rem; }
.wo-day-ed legend { font-weight: 800; color: var(--gold-deep); padding: 0 6px; }
.wo-day-ed { padding-top: 6px; }
.wo-seg-head, .wo-seg-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, .8fr) minmax(0, .8fr) 30px; gap: 4px; align-items: center; }
.wo-seg-head { font-size: .72rem; color: var(--muted); font-weight: 700; margin-top: 6px; }
.wo-seg-row { margin: 4px 0; }
.wo-form .wo-seg-row input, .wo-form .wo-seg-row select { padding: 6px 4px; min-height: 40px; font-size: .88rem; border-radius: 8px; }
.wo-s-del { appearance: none; border: 1px solid var(--line); background: transparent; border-radius: 8px; height: 40px; font-size: 1.1rem; cursor: pointer; color: inherit; padding: 0; }
.wo-tpl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wo-tpl-row .wo-label { margin: 0; }
.wo-tpl-row select { flex: 1 1 160px; }
.wo-mytpl li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wo-th-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: baseline; }
.wo-th-ops li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wo-th-assign { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.wo-th-assign select { flex: 1 1 160px; min-width: 0; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 8px 10px; min-height: var(--touch); }
.wo-end-hname { font-weight: 800; margin: 0 0 4px; }
.wo-end-horse textarea { width: 100%; }
.wo-join-cta { margin: 28px 0 8px; text-align: center; border-color: var(--gold); }
.wo-join-cta p { color: var(--muted); margin: 0 0 12px; }
.wo-join-cta-btns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; max-width: 420px; margin-inline: auto; }
.wo-join-cta-btns .btn { width: 100%; justify-content: center; white-space: normal; }
.wo-row-track .wo-tag { font-size: .72rem; }
@media (max-width: 430px) {
  .wo-tab { flex: 1 1 30%; font-size: .85rem; padding: 8px 4px; }
  .wo-segs li { grid-template-columns: 24px auto 1fr; }
  .wo-seg-t { grid-column: 2 / -1; white-space: normal; }
  .wo-seg-head { display: none; }
  .wo-seg-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr); }
  .wo-seg-row .wo-s-min, .wo-seg-row .wo-s-max { grid-column: span 1; }
  .wo-seg-row .wo-s-del { grid-column: span 1; }
  .wo-seg-row { border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
  .wo-lp-grid .wo-stat-v { font-size: .9rem; }
  .wo-join-cta-btns { grid-template-columns: 1fr; }
}

/* v13m: phone/tablet top nav — wrap all items onto rows (nothing clipped, no sideways scroll) */
@media (max-width: 1039.98px) {
  .site-nav ul.nav-main {
    flex-wrap: wrap; overflow: visible; justify-content: center; row-gap: 4px; column-gap: 4px;
    -webkit-mask-image: none; mask-image: none; padding: 2px 6px 8px;
  }
  .site-nav ul.nav-main a, .site-nav ul.nav-main .nav-dd-btn { min-height: 32px; padding: 0 9px; font-size: .82rem; }
}

/* v13m: contrast on the dark page — forms become light cards; text placed straight on the dark background is light */
.wo-tabs { flex-wrap: nowrap; }
.wo-tab { flex: 1 1 0; }
@media (max-width: 430px) { .wo-tab { flex: 1 1 0; font-size: .8rem; padding: 8px 2px; } .wo-badge { min-width: 18px; height: 18px; padding: 0 4px; margin-inline-start: 3px; font-size: .7rem; } }
.wo-page .wo-section:not(.wo-account) > form.wo-form, .wo-share-plan, .wo-msg-text, .wo-cmp-item {
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; min-width: 0;
}
.wo-page .wo-section:not(.wo-account) > .wo-hint, .wo-page .wo-section:not(.wo-account) > .wo-meta, .wo-page .wo-section:not(.wo-account) > .wo-on,
.wo-page .wo-section:not(.wo-account) > .wo-plan-horse, .wo-page .wo-section:not(.wo-account) > .wo-note, .wo-page .wo-gaits > .wo-hint, .wo-page .wo-map-panel .wo-hint, .wo-page .wo-cal-nav strong { color: #dccfb3; }
.wo-page .wo-section > .wo-plan-horse strong, .wo-page .wo-section > .wo-meta strong { color: var(--gold-soft); }
.wo-group-card h3, .wo-today h3, .wo-requests h3, .wo-notify h3, .wo-trainer-tools h3, .wo-trainer-tools h4, .wo-op-inbox h3, .wo-plan-day h3, .wo-plan-day h4, .wo-plan-notes h3, .wo-plan-cmp h3, .wo-hnotes h3,
.wo-rc h3, .wo-end form h3, .wo-compose form h3, .wo-mytpl h4, .wo-join-cta h2, .wo-account .wo-h, .wo-prep h3, .wo-share-box h3, .wo-add-horse h3, .wo-trainer-head, .wo-roles form h3, .wo-week-sum h3 { color: var(--gold-deep); }
.wo-cmp-list { list-style: none; margin: 0; padding: 0; }
.wo-plan-cmp .wo-cmp-item, .wo-sum .wo-cmp-item, .wo-end .wo-cmp-item { margin: 6px 0; padding: 8px 10px; }
.wo-cmp-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wo-cmp-vals { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-weight: 700; }
.wo-cmp-dt { color: var(--muted); font-weight: 600; font-size: .85rem; }
.wo-tag.wo-v-in { background: rgba(143,174,140,.25); border-color: rgba(143,174,140,.6); }
.wo-tag.wo-v-slow { background: rgba(201,162,84,.2); }
.wo-tag.wo-v-fast { background: rgba(122,46,26,.12); }
.wo-msg-text { white-space: pre-wrap; }
.wo-page .wo-join-cta h2 { color: var(--gold-deep); }
.wo-page .wo-splits .wo-table td, .wo-page .wo-splits .wo-table th { color: #efe6d2; }
.wo-page .wo-hr > .wo-hint, .wo-page .wo-hr .wo-hint, .wo-page .wo-section > p.wo-meta { color: #dccfb3; }
.wo-download[hidden] { display: none !important; }
.wo-s-f { display: block; min-width: 0; margin: 0; }
.wo-s-cap { display: none; font-size: .7rem; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.wo-s-del { align-self: end; }
@media (max-width: 430px) { .wo-s-cap { display: block; } }
/* v13m: on phones the wrapped nav makes the header tall, so it scrolls away instead of covering ~1/5 of the screen */
@media (max-width: 600px) { .site-header { position: relative; } }
.wrap.page > section.wo-join-cta > h2 { color: var(--gold-deep) !important; }

/* ===== v13n: language switch, LTR, no sideways header scroll ===== */
.header-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.lang-switch {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  border: 1px solid rgba(211,166,84,.5);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0,0,0,.22);
}
.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(247,240,228,.88);
  font: inherit;
  font-size: .72rem;
  font-weight: 800;
  padding: 4px 10px;
  min-height: 30px;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
}
.lang-btn[aria-pressed="true"] {
  background: rgba(211,166,84,.3);
  color: var(--gold-soft);
}
.header-inner { min-width: 0; }
.brand { min-width: 0; }
html { overflow-x: hidden; }
@media (max-width: 430px) {
  .lang-btn { font-size: .66rem; padding: 3px 8px; min-height: 28px; }
  .header-end { gap: 6px; }
}
html.lang-en .only-ar,
html:not(.lang-en) .only-en { display: none !important; }

html[dir="ltr"] .ped-table,
html[dir="ltr"] .ped-table th,
html[dir="ltr"] .ped-table td.pc:not(.pc-empty),
html[dir="ltr"] .ped-table .pc-namerow,
html[dir="ltr"] .ped-table .pc-namerow[dir],
html[dir="ltr"] .ped-table .pc-metarow,
html[dir="ltr"] .ped-table .pc-part,
html[dir="ltr"] .ped-table .pp-one,
html[dir="ltr"] .ped-table td.pc .pc-arrow,
html[dir="ltr"] .pp,
html[dir="ltr"] .rel-table th,
html[dir="ltr"] .reg-foot,
html[dir="ltr"] .pc-name,
html[dir="ltr"] .ped-subject .pp,
html[dir="ltr"] table.cal td,
html[dir="ltr"] .rel-table td a { direction: ltr; text-align: left; }
html[dir="ltr"] .timeline { padding-right: 0; padding-inline-start: 20px; }
html[dir="ltr"] .facts strong { margin-left: 0; margin-inline-start: 6px; }
html[dir="ltr"] .wo-facts strong { margin-left: 0; margin-inline-start: 8px; }
html[dir="ltr"] .wo-clear-horse { margin-right: 0; margin-inline-end: 8px; }
html[dir="ltr"] body { font-family: Tajawal, "Segoe UI", system-ui, sans-serif; }

/* v13o: one membership CTA + private log page accordion */
.wo-join-cta.is-in { text-align: start; }
.wo-join-cta .wo-join-in { margin: 0; }
.wo-page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.wo-page-log { margin: 12px 0 0; min-width: 0; }
.wo-page-log .acc.wo-acc { margin: 0 0 10px; max-width: 100%; }
.wo-page-log .acc.wo-acc > summary { align-items: flex-start; gap: 8px; min-width: 0; }
.wo-page-log .acc.wo-acc .acc-t { min-width: 0; overflow-wrap: anywhere; word-break: break-word; font-size: .95rem; line-height: 1.45; }
.wo-page-log .acc.wo-acc .acc-meta { display: block; font-weight: 400; font-size: .82rem; color: #8a7f6a; margin-top: 2px; }
.wo-page-log .acc-body { min-width: 0; overflow: hidden; }
.wo-page-log .wo-map-panel, .wo-page-log .wo-map-frame, .wo-page-log canvas { max-width: 100%; }
.wo-page-log .wo-stats, .wo-page-log .wo-gait-grid { min-width: 0; }
.wo-role-pick .wo-role-opt input[type="radio"] { accent-color: var(--gold-deep); }
.wo-auth-role { margin: 8px 0 12px; }
.wo-auth-switch { margin: 12px 0 0; overflow-wrap: anywhere; }
.wo-auth-switch button {
  display: inline; background: none; border: 0; padding: 0; margin: 0;
  color: var(--gold-deep); font: inherit; font-weight: 800; cursor: pointer;
  text-decoration: underline; text-align: inherit; overflow-wrap: anywhere;
}
.wo-verify-pick { margin: 8px 0 12px; }
.wo-verify-pick > .wo-hint { margin: 0 0 8px; }
.wo-verify-pick .wo-role-opt { overflow-wrap: anywhere; }
.wo-account .wo-form input[type="password"] { direction: ltr; }
#wo-auth-notice { overflow-wrap: anywhere; }

/* v13p: public operator credit on a horse page (name only, beside results) */
.horse-op-credit { margin: 0 0 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 700; overflow-wrap: anywhere; }
.horse-op-credit + .section, .horse-op-credit + section { margin-top: 0; }

/* v13p: real-name add-horse form + private page horses/orders/achievements */
.wo-reg-horse .wo-span-2 { grid-column: 1 / -1; min-width: 0; }
.wo-reg-or { margin: 10px 0 4px; }
.wo-claim, .wo-midan-add { margin: 16px 0; min-width: 0; }
.wo-claim-row, .wo-th-assign { min-width: 0; }
.wo-claim-row select, .wo-th-assign select { max-width: 100%; }
.wo-page-horses, .wo-page-orders, .wo-page-achieve { display: grid; gap: 8px; margin: 0 0 16px; min-width: 0; }
.wo-achieve-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wo-achieve-list li { overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 420px) {
  .wo-row.wo-entry-row { grid-template-columns: 1fr; }
}

/* v13w: workouts page polish (Asayel tokens only; 390px, no sideways scroll) */
.wo-hero { margin: 6px 0 14px; }
.wo-hero .wo-lead { color: #dccfb3; line-height: 1.75; font-size: .98rem; }
.wo-tabs { gap: 3px; padding: 4px; margin-bottom: 16px; overflow-x: visible; }
.wo-tab { font-size: .8rem; padding: 10px 2px; white-space: nowrap; letter-spacing: 0; }
@media (min-width: 431px) { .wo-tab { font-size: .9rem; padding: 10px 6px; } }
.wo-wrap .wo-section { margin: 0 0 22px; min-width: 0; }
.wo-wrap .wo-section > .wo-h { margin-bottom: 6px; }
.wo-wrap .wo-section > .wo-hint { margin-bottom: 12px; }
.wo-midan .wo-main-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 4px 0 16px; }
.wo-midan .wo-main-actions > :first-child { grid-column: 1 / -1; }
.wo-midan .wo-main-actions .wo-btn { width: 100%; white-space: normal; text-align: center; }
.wo-midan .wo-main-actions > :only-child { grid-column: 1 / -1; }
.wo-prep-acc { margin: 0 0 16px; }
.wo-prep-acc .acc-body { padding: 4px 12px 14px; }
.wo-prep-acc .wo-prep { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.wo-prep-acc .wo-prep .wo-hint { margin-top: 8px; }
.wo-midan .wo-group-card, .wo-midan .wo-recent, .wo-midan .wo-midan-add { margin-top: 0; margin-bottom: 16px; }
.wo-midan > .wo-hint:last-child { margin-top: 4px; }
.wo-join-cta { margin-top: 8px; }
.wo-midan .wo-main-actions > :nth-child(2):last-child { grid-column: 1 / -1; }
.wo-midan .wo-midan-add { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 18px; }
.wo-midan .wo-midan-add h3 { color: var(--gold-deep); }
.wo-midan .wo-midan-add .wo-hint, .wo-midan .wo-midan-add .wo-label, .wo-midan .wo-midan-add .wo-meta { color: #2a1a10; }
.wo-midan .wo-midan-add .wo-hint { color: #5a4a30; }

/* v13x: GPS status, live-follow indicator and trainer «مباشر الآن» (workouts section only) */
.wo-gps { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: var(--card); min-width: 0; font-weight: 700; }
.wo-gps-t { min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.wo-gps-dot { flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%; background: #8a8a80; }
.wo-gps-good .wo-gps-dot { background: #3e9b4f; box-shadow: 0 0 0 4px rgba(62,155,79,.22); }
.wo-gps-ok .wo-gps-dot { background: #8FAE8C; }
.wo-gps-wait .wo-gps-dot { background: #C9A254; animation: wo-gps-pulse 1.2s ease-in-out infinite; }
.wo-gps-warn { border-color: #C9A254; background: #f7ecd4; color: #3a2a12; }
.wo-gps-warn .wo-gps-dot { background: #d08a1c; }
.wo-gps-bad { border-color: #b3422b; background: #f9e3dd; color: #4a1a10; }
.wo-gps-bad .wo-gps-dot { background: #b3422b; }
.wo-gps-off .wo-gps-dot { background: #8a8a80; }
.wo-follow-ind { font-weight: 600; font-size: .92rem; padding: 8px 12px; margin-top: 6px; }
.wo-gps-steps { margin: 0 0 12px; padding: 10px 12px 10px 28px; padding-inline-start: 28px; padding-inline-end: 12px; border: 1px dashed #b3422b; border-radius: 12px; background: #fdf3ef; color: #3a1a10; line-height: 1.7; overflow-wrap: anywhere; }
.wo-gps-steps li { margin: 6px 0; }
@keyframes wo-gps-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.wo-livecard h3 { display: flex; align-items: center; gap: 8px; }
.wo-live-dot { width: 10px; height: 10px; border-radius: 50%; background: #3e9b4f; box-shadow: 0 0 0 4px rgba(62,155,79,.25); flex: 0 0 10px; }
.wo-live-row { display: grid; gap: 4px; padding: 10px 12px; margin: 8px 0 0; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: inherit; background: rgba(255,255,255,.05); min-width: 0; min-height: var(--touch); }
.wo-live-row.is-stale { opacity: .8; }
.wo-live-who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.wo-live-badge { display: inline-flex; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 800; background: #3e9b4f; color: #fff; white-space: nowrap; }
.wo-live-badge.is-stale { background: #d08a1c; }
.wo-live-hs, .wo-live-n { overflow-wrap: anywhere; min-width: 0; font-size: .92rem; }
.wo-live-n { font-weight: 800; }
.wo-follow { min-width: 0; }
@media (prefers-reduced-motion: reduce) { .wo-gps-wait .wo-gps-dot { animation: none; } }

/* v13y: documented-only horse add + request confirmation */
.wo-enc-confirm, .wo-enc-request {
  margin: 10px 0 0;
  padding: 12px;
  border: 1px solid var(--line, rgba(212,175,55,.28));
  border-radius: 12px;
  background: rgba(11,31,25,.45);
  min-width: 0;
  overflow-wrap: anywhere;
}
.wo-enc-confirm-name { margin: 0 0 6px; font-weight: 700; color: var(--gold-deep, #d4af37); overflow-wrap: anywhere; }
.wo-enc-confirm .wo-meta, .wo-enc-request .wo-meta { margin: 2px 0; overflow-wrap: anywhere; }
.wo-enc-confirm .wo-row, .wo-enc-request .wo-row { min-width: 0; }
.wo-unverified {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #3a2a12;
  background: #e4c07a;
  vertical-align: middle;
}
.wo-enc-reqs { list-style: none; margin: 8px 0 0; padding: 0; min-width: 0; }
.wo-enc-reqs li { padding: 8px 0; border-bottom: 1px solid rgba(212,175,55,.16); overflow-wrap: anywhere; }
.wo-enc-reqs li:last-child { border-bottom: 0; }
.badge-approved { background: #1e3d32; color: #e8d5a3; }
@media (max-width: 420px) {
  .wo-enc-confirm .wo-row, .wo-enc-request .wo-row { grid-template-columns: 1fr; }
}

/* v13z: general member (عضو) — hide midan workout tabs */
body.wo-member-only .wo-tab[data-tab="orders"] { display: none; }

/* v14a: homepage membership tile */
.h2-tile.join { grid-column: 1 / -1; }
@media (min-width: 701px) {
  .h2-tiles { grid-template-columns: 1fr 1fr 1fr; }
  .h2-tile.join { grid-column: auto; }
}
@media (max-width: 700px) {
  .h2-tile.join { grid-column: 1 / -1; }
}

/* v14a: admin work overview, 390px-friendly */
.adm-work-auth { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.adm-work-auth input { min-height: 44px; }
.adm-work-root { display: grid; gap: 18px; margin-top: 12px; }
.adm-block h3 { margin: 0 0 8px; font-size: 1.05rem; }
.adm-table { width: 100%; min-width: 0; }
.adm-sessions, .adm-live { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.adm-map { display: block; width: 100%; max-width: 100%; height: 220px; border-radius: 12px; background: #0b1f19; margin-top: 8px; }
.adm-detail { margin-top: 10px; }
.wo-owner-badge { margin-inline-start: 6px; vertical-align: middle; }
@media (max-width: 700px) {
  .adm-work .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* v14c: highlight the register-new path when search has no hit */
.wo-enc-request.is-open {
  outline: 2px solid var(--gold, #d4af37);
  outline-offset: 2px;
}
.wo-goto-new { margin-top: 8px; width: 100%; max-width: 100%; }
.wo-mine-picks { min-width: 0; }
.wo-mine-picks .wo-hint { margin: 0 0 8px; }

/* v14c: member name directory and searchable operator/trainer pick */
.wo-dir-block, .wo-member-pick { min-width: 0; margin: 10px 0 0; overflow: visible; }
.wo-dir-list { max-height: min(280px, 50vh); }
.wo-member-hit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wo-member-hit .wo-mname { font-weight: 800; overflow-wrap: anywhere; min-width: 0; }
.wo-th-assign .wo-member-pick, .wo-claim-row .wo-member-pick { flex: 1 1 100%; min-width: 0; }
.wo-claim-row { display: flex; flex-wrap: wrap; gap: 8px; }
.wo-claim-row #wo-claim-h, .wo-claim-row #wo-claim-send { flex: 1 1 100%; max-width: 100%; }

/* v14c: two-path add-horse + quiet empty history */
.wo-add-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 12px; min-width: 0; }
.wo-add-path { min-height: 44px; padding: 8px 10px; font-weight: 800; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--brown, #3a2a18); cursor: pointer; overflow-wrap: anywhere; }
.wo-add-path.is-on { background: var(--brown); color: var(--gold-soft); border-color: var(--gold); }
.wo-add-pane[hidden] { display: none; }
.wo-history-quiet .wo-hint { margin-top: 8px; }
