/* Fixed workspace frame: the three working panes scroll independently. */
:root {
  --aq-font-scale: 1;
  --accent: #e1a5f5;
  --accent-strong: #f3d2ff;
}

html {
  font-size: calc(16px * var(--aq-font-scale));
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: radial-gradient(circle at 20% 0, #4d245d 0, transparent 32%), var(--bg);
}

.aq-shell {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.aq-top {
  min-width: 0;
}

.aq-header-actions {
  display: flex;
  align-items: center;
  margin-left: 12px;
}

.aq-menu-button {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 10px;
  font-size: 1.45rem;
  font-weight: 900;
  cursor: pointer;
}

.aq-menu-panel {
  position: fixed;
  z-index: 50;
  top: 164px;
  right: max(22px, calc((100vw - 1800px) / 2 + 22px));
  width: min(330px, calc(100vw - 24px));
  display: none;
}

.aq-menu-panel.open {
  display: grid;
}

.aq-menu-panel .ad-menu-section {
  display: grid;
  gap: 9px;
}

.aq-font-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  padding: 9px;
  border: 1px solid var(--ad-menu-line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--ad-menu-bg) 92%, transparent);
  color: var(--ad-menu-text);
  font-size: .82rem;
  font-weight: 900;
}

.aq-font-row input {
  width: 100%;
  padding: 0;
  accent-color: var(--ad-menu-accent);
}

.aq-font-row strong {
  color: var(--ad-menu-accent-strong);
  font-variant-numeric: tabular-nums;
}

.aq-layout {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.aq-side,
.aq-main,
.aq-notes {
  height: 100%;
  min-height: 0;
}

.aq-side {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.aq-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overscroll-behavior: contain;
}

.aq-main {
  overflow: auto;
  overscroll-behavior: contain;
}

.aq-notes {
  overflow: hidden;
}

.aq-note-list {
  overscroll-behavior: contain;
}

nav button.active,
.aq-switch button.active,
.aq-filters button.active,
.aq-note-compose button,
.aq-action {
  color: #241027;
}

.aq-section h2,
.aq-notes h2,
.aq-fact-grid small,
.aq-source-link {
  color: var(--accent-strong);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5edf7;
  --panel: #ffffff;
  --panel2: #f8f0fa;
  --line: #cdb6d1;
  --text: #241d28;
  --muted: #685d70;
  --accent: #78177d;
  --accent-strong: #6d1772;
}

html[data-theme="light"] body {
  background: radial-gradient(circle at 20% 0, #e8d2ed 0, transparent 32%), var(--bg);
}

html[data-theme="light"] .aq-top,
html[data-theme="light"] .aq-side,
html[data-theme="light"] .aq-main,
html[data-theme="light"] .aq-notes,
html[data-theme="light"] .aq-card,
html[data-theme="light"] .aq-comp,
html[data-theme="light"] .aq-section,
html[data-theme="light"] .aq-rich-section,
html[data-theme="light"] .aq-item {
  background: #fff;
}

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] .aq-note,
html[data-theme="light"] .aq-fact-grid > div,
html[data-theme="light"] .aq-rich-list > div {
  background: #fbf7fc;
}

html[data-theme="light"] nav button,
html[data-theme="light"] .aq-switch button {
  background: #fbf7fc;
  color: var(--text);
}

html[data-theme="light"] nav button.active,
html[data-theme="light"] .aq-switch button.active,
html[data-theme="light"] .aq-filters button.active,
html[data-theme="light"] .aq-note-compose button,
html[data-theme="light"] .aq-action {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Compact controls match the Rapid Surfing workspace. */
.aq-filters button {
  font-size: .62rem;
  line-height: 1.1;
  padding: 4px 8px;
}

.aq-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.aq-notes-head h2 {
  min-width: 0;
}

.aq-note-tabs {
  flex: 0 0 auto;
  gap: 2px;
}

.aq-note-tabs button {
  padding: 4px 6px;
  font-size: .68rem;
  font-weight: 850;
}

/* Every surface uses the shared theme variables, including the nested profile cards. */
.aq-top,
.aq-side,
.aq-main,
.aq-notes {
  background: var(--panel);
}

.aq-card,
.aq-comp,
.aq-section {
  background: var(--panel2);
}

.aq-item {
  background: color-mix(in srgb, var(--panel) 82%, var(--accent) 18%);
}

.aq-item:hover,
.aq-item.selected {
  background: color-mix(in srgb, var(--panel) 67%, var(--accent) 33%);
}

.aq-portrait {
  background: var(--panel2);
}

#aq-main .aq-portrait-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--panel2) 75%, var(--accent) 25%);
  color: var(--accent);
  font-size: 2rem;
}


html[data-theme="light"] .aq-item {
  background: color-mix(in srgb, #fff 93%, var(--accent) 7%);
}

html[data-theme="light"] .aq-item:hover,
html[data-theme="light"] .aq-item.selected {
  background: color-mix(in srgb, #fff 83%, var(--accent) 17%);
}

html[data-theme="light"] .aq-hover-card {
  box-shadow: 0 12px 25px rgba(52, 23, 56, .22);
}

.aq-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.aq-section-head h2 {
  margin-bottom: 0;
}

.aq-results-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.aq-result-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}

.aq-result-row b,
.aq-result-row small {
  display: block;
}

.aq-result-row small,
.aq-stat-scope {
  color: var(--muted);
  font-size: .78rem;
}

.aq-stat-scope {
  margin: 10px 0 0;
}

.aq-results-toggle {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: transparent;
  color: var(--accent-strong);
  font-size: .76rem;
  font-weight: 850;
}

.aq-results-toggle:hover,
.aq-results-toggle:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  outline: none;
}

/* The profile page keeps its normal page scroll. Only these two complete
   entry lists (Erfolge and Ergebnisse) scroll inside their own viewport. */
#aq-main .aq-profile-scroll-list {
  box-sizing: border-box;
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  height: clamp(280px, 42vh, 360px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-gutter: stable;
}

#aq-main .aq-profile-scroll-list:focus-visible {
  border-radius: 8px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#aq-main .aq-profile-scroll-list::-webkit-scrollbar {
  width: 10px;
}

#aq-main .aq-profile-scroll-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 65%, var(--line));
  background-clip: padding-box;
}

#aq-main .aq-achievement-list {
  gap: 0;
  padding-right: 20px;
}

#aq-main .aq-rich-list > .aq-achievement-date {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  padding: 5px 0 3px;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .05em;
}

#aq-main .aq-achievement-date::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--accent) 38%, var(--line));
}

#aq-main .aq-compact-results {
  gap: 0;
  padding-right: 20px;
}

#aq-main .aq-results-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px 14px;
}

#aq-main .aq-results-head > h2 {
  min-width: 0;
}

#aq-main .aq-results-head > .aq-label {
  justify-self: end;
}

#aq-main .aq-result-filters {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 2;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  overflow: visible;
  padding: 2px 0 4px;
}

#aq-main .aq-result-filters button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: transparent;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  white-space: nowrap;
}

#aq-main .aq-result-filters button:hover,
#aq-main .aq-result-filters button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

#aq-main .aq-result-filters button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

#aq-main .aq-results-list > .aq-result-date {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  padding: 5px 0 3px;
  border: 0;
  background: var(--panel);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
}

#aq-main .aq-result-date::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--accent) 38%, var(--line));
}

#aq-main .aq-results-list > .aq-compact-result {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) minmax(120px, .42fr) max-content;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 7px 4px 7px 0;
}

/* Derived from scored Dressur result rows; no separate Best Results data set. */
#aq-main .aq-best-results {
  overflow: hidden;
}

#aq-main .aq-best-result-head,
#aq-main .aq-best-result {
  display: grid;
  grid-template-columns: minmax(112px, .85fr) minmax(102px, 1fr) 86px minmax(110px, .9fr) minmax(120px, 1fr);
  align-items: center;
  gap: 10px;
}

#aq-main .aq-best-result-head {
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .66rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .045em;
}

#aq-main .aq-best-result {
  min-height: 46px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

#aq-main .aq-best-category,
#aq-main .aq-best-venue,
#aq-main .aq-best-horse {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#aq-main .aq-best-category {
  font-size: .78rem;
}

#aq-main .aq-best-score {
  display: block;
  min-width: 0;
  height: 24px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

#aq-main .aq-best-score i {
  display: flex;
  align-items: center;
  width: var(--aq-score-width);
  min-width: 41px;
  max-width: 100%;
  height: 100%;
  padding: 0 7px;
  box-sizing: border-box;
  background: color-mix(in srgb, #12bd71 80%, var(--accent));
  color: #fff;
  font-size: .72rem;
  font-style: normal;
  font-weight: 900;
}

#aq-main .aq-best-score em { font-style: normal; }

#aq-main .aq-best-result time {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  white-space: nowrap;
}

#aq-main .aq-best-venue,
#aq-main .aq-best-horse {
  font-size: .73rem;
  font-weight: 750;
}

#aq-main .aq-best-horse .aq-entity-link,
#aq-main .aq-best-horse .aq-entity-link > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  #aq-main .aq-best-result-head { display: none; }
  #aq-main .aq-best-result {
    grid-template-columns: minmax(92px, .8fr) minmax(104px, 1fr) 1fr;
    gap: 5px 9px;
    padding: 9px 0;
  }
  #aq-main .aq-best-category { grid-column: 1; grid-row: 1; }
  #aq-main .aq-best-score { grid-column: 2 / -1; grid-row: 1; }
  #aq-main .aq-best-result time { grid-column: 1; grid-row: 2; }
  #aq-main .aq-best-venue { grid-column: 2; grid-row: 2; }
  #aq-main .aq-best-horse { grid-column: 3; grid-row: 2; }
}

#aq-main .aq-result-summary {
  min-width: 0;
}

#aq-main .aq-result-summary b,
#aq-main .aq-result-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#aq-main .aq-result-partner {
  min-width: 0;
  overflow: hidden;
}

#aq-main .aq-result-partner .aq-entity-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#aq-main .aq-result-place {
  justify-self: end;
  min-width: max-content;
  color: var(--muted);
  font-size: .76rem;
  white-space: nowrap;
}

#aq-main .aq-rich-list > .aq-achievement-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 7px 0;
}

#aq-main .aq-achievement-row b {
  overflow: hidden;
  font-size: .92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#aq-main .aq-achievement-row small {
  justify-self: end;
  min-width: max-content;
  margin: 0;
  padding-right: 4px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
  white-space: nowrap;
}

#aq-main .aq-achievement-icon {
  box-sizing: border-box;
  display: block;
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 82%, #102b32);
  object-fit: contain;
}

#aq-main .aq-achievement-icon.aq-rank-dressage {
  background: #78858b;
}

#aq-main .aq-achievement-icon.aq-rank-eventing {
  background: #12bd71;
}

#aq-main .aq-achievement-icon.aq-rank-jumping {
  background: #4179b9;
}

#aq-main .aq-achievement-icon.aq-rank-driving {
  background: #a66b36;
}

#aq-main .aq-achievement-icon.aq-rank-vaulting {
  background: #8a549d;
}

#aq-main .aq-achievement-icon.aq-rank-para-dressage {
  background: #be5d81;
}

#aq-main .aq-achievement-icon-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
}

/* Compact athlete-profile lists: starred entries are editorial choices, not FEI data. */
#aq-main .aq-profile-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
}

#aq-main .aq-profile-list-toggle,
#aq-main .aq-profile-short-more,
#aq-main .aq-profile-item-tools button {
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

#aq-main .aq-profile-list-toggle {
  padding: 5px 9px;
  font-size: .74rem;
}

#aq-main .aq-profile-shortlist {
  display: grid;
  gap: 9px;
}

#aq-main .aq-profile-short-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 8px;
}

#aq-main .aq-profile-short-row > span {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
}

#aq-main .aq-profile-short-row > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

#aq-main .aq-profile-short-more {
  align-self: center;
  min-width: 34px;
  min-height: 31px;
  padding: 0 8px;
  font-size: 1.15rem;
  line-height: 1;
}

#aq-main .aq-profile-full-list {
  max-height: 354px;
  overflow: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

#aq-main .aq-profile-list-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: .72rem;
}

#aq-main .aq-profile-list-item.aq-achievement-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) max-content auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 5px;
  border-bottom: 1px solid var(--line);
}

#aq-main .aq-profile-list-item.aq-compact-result {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) minmax(120px, .42fr) max-content auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 5px;
  border-bottom: 1px solid var(--line);
}

#aq-main .aq-profile-list-item.is-starred {
  border-left: 4px solid #f2c230;
  background: color-mix(in srgb, #f2c230 12%, transparent);
}


#aq-main .aq-profile-item-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#aq-main .aq-profile-item-tools button {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  font-size: .9rem;
}

#aq-main .aq-profile-item-tools .aq-profile-item-star.is-starred {
  color: #f2c230;
  border-color: #c99a00;
  background: #fff5c8;
}

#aq-main .aq-profile-list-item b,
#aq-main .aq-result-summary b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#aq-main .aq-entry-name,
#aq-main .aq-result-summary {
  min-width: 0;
}

#aq-main .aq-editorial-name {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 2px;
  padding: 1px 5px;
  overflow: hidden;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-strong);
  font-size: .68rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 680px) {
  #aq-main .aq-rich-list > .aq-achievement-row {
    grid-template-columns: 22px minmax(0, 1fr) max-content;
    gap: 7px;
  }

  #aq-main .aq-achievement-row small {
    font-size: .68rem;
  }

  #aq-main .aq-profile-short-row > div {
    grid-template-columns: 1fr;
  }

  #aq-main .aq-profile-list-item.aq-achievement-row,
  #aq-main .aq-profile-list-item.aq-compact-result {
    grid-template-columns: 22px minmax(0, 1fr) max-content auto;
    gap: 7px;
  }

  #aq-main .aq-profile-list-item.aq-compact-result .aq-result-partner {
    display: none;
  }

  #aq-main .aq-profile-list-item.aq-compact-result .aq-result-place {
    grid-column: 3;
  }

  #aq-main .aq-results-list > .aq-compact-result {
    grid-template-columns: 22px minmax(0, 1fr) max-content;
    gap: 7px;
  }

  #aq-main .aq-result-partner {
    grid-column: 2;
    font-size: .72rem;
  }

  #aq-main .aq-result-place {
    grid-column: 3;
    grid-row: 1 / span 2;
    font-size: .68rem;
  }

}

@media (max-width: 1120px) {
  .aq-menu-panel {
    top: 148px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .aq-shell {
    height: auto;
    min-height: 100dvh;
    display: block;
  }

  .aq-top {
    align-items: center;
  }

  .aq-header-actions {
    margin-left: auto;
  }

  .aq-menu-panel {
    top: 78px;
    right: 10px;
  }

  .aq-layout,
  .aq-side,
  .aq-main,
  .aq-notes {
    height: auto;
    overflow: visible;
  }

  .aq-list {
    max-height: 300px;
  }
}
