@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500;700&family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600&display=swap');

.hrr-app {
  --ink: #172b25;
  --muted: #6d7d75;
  --line: #dce5dd;
  --paper: #f5f8f4;
  --white: #ffffff;
  --forest: #164d3d;
  --dark: #103c30;
  --lime: #d9ed83;
  --coral: #c64b38;
  --mono: 'DM Mono', ui-monospace, monospace;
  --sans: 'DM Sans', 'Segoe UI', system-ui, sans-serif;

  min-width: 340px;
  max-width: 1600px;
  margin: 0 auto;
  color: var(--ink);
  background: radial-gradient(ellipse at 12% 0%, rgba(217, 237, 131, 0.19), transparent 34rem), var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  box-sizing: border-box;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(16, 60, 48, 0.08);
}

.hrr-app * {
  box-sizing: border-box;
}

.hrr-app button,
.hrr-app input,
.hrr-app select {
  font: inherit;
}

.hrr-app button {
  cursor: pointer;
}

/* TOPBAR */
.hrr-app .topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  color: #f8fbf7;
  background: var(--dark);
  border-bottom: 3px solid var(--lime);
}

.hrr-app .brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.hrr-app .brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #ffffff;
  border: 2px solid var(--lime);
}

.hrr-app .brand strong {
  display: block;
  font-size: 21px;
  line-height: 1.15;
  color: #ffffff;
}

.hrr-app .brand small {
  display: block;
  color: #b6cdc1;
  font-family: var(--mono);
  font-size: 13px;
  margin-top: 2px;
}

.hrr-app .event-stamp {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d4e4db;
  font-family: var(--mono);
  font-size: 16px;
}

.hrr-app .event-stamp strong {
  color: var(--lime);
  font-weight: 600;
}

.hrr-app .live-dot,
.hrr-app .validation-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d2eb7d;
  display: inline-block;
  animation: hrrPulse 2.5s infinite;
}

@keyframes hrrPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

/* WORKSPACE */
.hrr-app .workspace {
  padding: 28px 28px 24px;
}

.hrr-app .heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
}

.hrr-app .eyebrow {
  margin: 0 0 6px;
  color: var(--forest);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.hrr-app .subheading {
  margin: 0;
  color: var(--muted);
  font-size: 22px;
}

.hrr-app .stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hrr-app .stats div {
  display: grid;
  gap: 2px;
  text-align: right;
}

.hrr-app .stats b {
  color: var(--forest);
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 700;
  line-height: 1;
}

.hrr-app .stats small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.hrr-app .stats i {
  height: 32px;
  width: 1px;
  background: var(--line);
}

/* RACEBAR */
.hrr-app .racebar {
  min-height: 54px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.hrr-app .racebar label {
  color: var(--forest);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
}

.hrr-app .racebar select {
  min-width: 250px;
  height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 15px;
}

.hrr-app .racebar span#lock-state {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: #5b9b4a;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: default;
  border: 0;
}

.hrr-app .racebar span#lock-state.locked {
  background: #c84d43;
  color: #fff;
}

.hrr-app .event-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hrr-app .racebar #new-event {
  margin-left: auto;
}

.hrr-app .racebar .event-actions .button,
.hrr-app .racebar #new-event {
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
}

.hrr-app .racebar #new-event {
  font-size: 30px;
  font-weight: 600;
}

/* ACTIONS BAR */
.hrr-app .actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.hrr-app .actions .selected-action,
.hrr-app .actions .icon-action {
  min-width: 40px;
  width: 40px;
  padding: 0;
  font-size: 20px;
}

.hrr-app .actions .selected-action:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.hrr-app .actions .action-delete {
  color: #a94a43;
}

.hrr-app .actions .save-action {
  color: #208744;
  font-size: 24px;
  font-weight: 800;
}

.hrr-app .actions .undo-action {
  color: #c93636;
  font-size: 24px;
  font-weight: 800;
}

.hrr-app .actions .icon-action#word {
  color: var(--forest);
}

.hrr-app .actions .icon-action#word b {
  font-size: 11px;
}

.hrr-app .action-separator {
  width: 1px;
  height: 28px;
  background: var(--line);
  margin: 0 2px;
}

.hrr-app .button {
  position: relative;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.hrr-app .button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hrr-app .quiet {
  color: var(--forest);
  background: #edf3ee;
  border-color: #dae5dc;
}

.hrr-app .quiet:hover:not(:disabled) {
  background: #e2ede4;
}

.hrr-app .quiet.dirty {
  color: #ffffff;
  background: #b8791e;
  border-color: #9c6518;
  animation: hrrBounce 0.4s ease;
}

@keyframes hrrBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.hrr-app .primary {
  color: #ffffff;
  background: var(--forest);
  border-color: var(--forest);
}

.hrr-app .primary:hover:not(:disabled) {
  background: var(--dark);
}

.hrr-app .danger {
  color: #ffffff;
  background: #a6413a;
  border-color: #8a382f;
}

.hrr-app .danger:hover:not(:disabled) {
  background: #8a382f;
}

.hrr-app #word b {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: var(--dark);
  background: var(--lime);
  border-radius: 11px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.hrr-app .button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 30;
  padding: 6px 10px;
  color: #ffffff;
  background: var(--dark);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(16, 35, 28, 0.25);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition: opacity 0.12s, transform 0.12s;
}

.hrr-app .button:hover::after,
.hrr-app .button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hrr-app .button[hidden] {
  display: none !important;
}

/* TABLE FRAME */
.hrr-app .table-frame {
  margin-top: 8px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid #d6e1d8;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.hrr-app .table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 280px);
  min-height: 320px;
}

.hrr-app .entry-grid {
  width: 100%;
  min-width: 1280px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* COLUMNS */
.hrr-app .entry-grid col:nth-child(1) { width: 36px; }  /* Auswahl */
.hrr-app .entry-grid col:nth-child(2) { width: 70px; }  /* Nr. */
.hrr-app .entry-grid col:nth-child(3) { width: 220px; } /* Teilnehmer */
.hrr-app .entry-grid col:nth-child(4) { width: 75px; }  /* Geschlecht */
.hrr-app .entry-grid col:nth-child(5) { width: 175px; } /* Hund */
.hrr-app .entry-grid col:nth-child(6) { width: 85px; }  /* Klasse */
.hrr-app .entry-grid col:nth-child(7) { width: 85px; }  /* Lauf 1 */
.hrr-app .entry-grid col:nth-child(8) { width: 85px; }  /* Lauf 2 */
.hrr-app .entry-grid col:nth-child(9) { width: 85px; }  /* Lauf 3 */
.hrr-app .entry-grid col:nth-child(10) { width: 90px; } /* Durchschnitt */
.hrr-app .entry-grid col:nth-child(11) { width: 75px; } /* Platz */

.hrr-app .action-cell,
.hrr-app .action-footer-cell {
  text-align: center;
  white-space: nowrap;
}
.hrr-app .edit-header {
  text-align: center;
  font-size: 16px;
}

.hrr-app .entry-grid th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 44px;
  padding: 4px 8px;
  color: #40584b;
  background: #dce6dd;
  border-bottom: 1px solid #bccdbf;
  text-align: left;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.hrr-app .entry-grid thead tr:first-child th {
  top: 0;
  z-index: 3;
}

.hrr-app .entry-grid thead tr:nth-child(2) th {
  top: 44px;
  z-index: 2;
  height: 36px;
  text-align: center;
  background: #e8f0e9;
  font-size: 13px;
}

.hrr-app .entry-grid th[rowspan="2"] {
  vertical-align: middle;
}

.hrr-app .entry-grid th.sorted {
  color: #173c2d;
  background: #c2d5c4;
  box-shadow: inset 0 -3px var(--forest);
}

.hrr-app .run-title {
  text-align: center !important;
}

.hrr-app .sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.hrr-app .sort span {
  color: var(--forest);
  font-size: 13px;
}

.hrr-app .entry-grid td {
  height: 42px;
  padding: 3px 5px;
  background: #ffffff;
  border-bottom: 1px solid #edf1ed;
  vertical-align: middle;
}

.hrr-app .entry-grid tbody tr:hover td {
  background: #f7faf7;
}

.hrr-app .cell-input {
  width: 100%;
  height: 34px;
  padding: 0 6px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  outline: 0;
  font-size: 14.5px;
  transition: background 0.12s, border-color 0.12s;
}

.hrr-app .cell-input:focus {
  background: #ffffff;
  border-color: #4d8b6e;
  box-shadow: 0 0 0 2px rgba(77, 139, 110, 0.2);
}

.hrr-app .cell-input:disabled {
  color: #7d8b83;
  cursor: not-allowed;
}

.hrr-app .number,
.hrr-app .time {
  font-family: var(--mono);
  text-align: center;
  font-size: 14px;
}

.hrr-app .time {
  font-style: italic;
}

.hrr-app .select-cell input,
.hrr-app #select-all {
  width: 16px;
  height: 16px;
  margin: 0 auto;
  display: block;
  accent-color: var(--forest);
  cursor: pointer;
}

.hrr-app .computed {
  font-family: var(--mono);
  font-size: 14px;
}

.hrr-app .average {
  color: var(--forest);
  font-weight: 700;
  text-align: center;
}

.hrr-app .place {
  color: var(--coral);
  font-weight: 900;
  text-align: center;
}

.hrr-app .handle,
.hrr-app .remove,
.hrr-app .email-edit {
  border: 0;
  background: transparent;
  color: #91a198;
  cursor: pointer;
}

.hrr-app .handle {
  cursor: grab;
  letter-spacing: -2px;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 32px;
  padding: 4px;
  user-select: none;
  color: var(--forest);
}

.hrr-app .handle:active {
  cursor: grabbing;
}

.hrr-app .handle[draggable="false"] {
  cursor: not-allowed;
  opacity: 0.35;
  color: #91a198;
}

.hrr-app .remove {
  font-size: 22px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  color: #ab574c;
}

.hrr-app .remove:hover:not(:disabled) {
  background: #fbeee9;
}

.hrr-app .email-edit {
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--forest);
  margin-right: 2px;
}

.hrr-app .email-edit:hover:not(:disabled) {
  background: #edf3ee;
}

.hrr-app .email-edit:disabled,
.hrr-app .remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* DRAG & DROP VISUAL FEEDBACK */
.hrr-app tr.dragging {
  opacity: 0.5;
}

.hrr-app tr.drag-over {
  border-top: 3px solid #2e7d32;
}

/* FOOTER */
.hrr-app footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #76857b;
  background: #f6f9f6;
  border-top: 1px solid #e5ece6;
  font-size: 13.5px;
}

.hrr-app .empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

/* TOAST */
.hrr-app #toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999999;
  max-width: 440px;
  padding: 14px 18px;
  color: #ffffff;
  background: var(--dark);
  border-left: 4px solid var(--lime);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(16, 60, 48, 0.3);
  font-family: var(--sans);
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}

.hrr-app #toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.hrr-app #toast.error {
  background: #873c32;
  border-left-color: #f7a399;
}

/* DIALOGS */
.hrr-app dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 26px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(16, 35, 28, 0.35);
}

.hrr-app dialog::backdrop {
  background: rgba(16, 35, 28, 0.6);
  backdrop-filter: blur(2px);
}

.hrr-app dialog form {
  display: grid;
  gap: 14px;
}

.hrr-app dialog h2 {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  color: var(--dark);
}

.hrr-app dialog label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.hrr-app dialog input {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  font-size: 16px;
}

.hrr-app .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.hrr-app .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* WORDPRESS ADMIN EMBED STYLES */
.hrr-admin-wrap {
  margin: 20px 20px 20px 0;
}

.hrr-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.hrr-admin-header h1 {
  font-size: 23px;
  font-weight: 600;
  margin: 0;
}

.hrr-admin-tabs {
  margin-bottom: 20px;
}

/* MOBILE QUICK ENTRY / EDITOR */
.hrr-app .mobile-shell,
.hrr-app .mobile-entry {
  display: none;
}

@media (max-width: 600px) {
  .hrr-app {
    min-width: 0;
    max-width: none;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    background: var(--paper);
  }

  .hrr-app .mobile-shell {
    display: none !important;
  }

  /* Auf dem Smartphone bleibt das Grid die Startansicht. */
  .hrr-app .workspace {
    display: block;
    min-width: 0;
  }

  .hrr-app .table-frame {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

   .hrr-app .entry-grid {
    min-width: 980px;
  }

  .hrr-app .topbar {
    padding: 10px 12px;
  }

  .hrr-app #event-dialog {
    max-width: calc(100vw - 24px);
  }

  .hrr-app .mobile-shell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 4px 2px;
  }

  .hrr-app .mobile-shell-head span {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .hrr-app .mobile-shell-head strong {
    font-size: 18px;
  }

  .hrr-app .mobile-shell-head small {
    color: var(--muted);
    font-size: 12px;
  }

  .hrr-app .mobile-add,
  .hrr-app .mobile-edit-button {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: var(--white);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .hrr-app .mobile-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
  }

  .hrr-app .mobile-starter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    padding: 7px 8px 7px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--white);
  }

  .hrr-app .mobile-starter-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .hrr-app .mobile-starter-info strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .hrr-app .mobile-starter-info span {
    color: var(--muted);
    font-size: 12px;
  }

  .hrr-app .mobile-edit-button {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    font-size: 19px;
  }

  .hrr-app .mobile-edit-button:disabled,
  .hrr-app .mobile-add:disabled {
    opacity: .45;
    cursor: default;
  }

  .hrr-app .mobile-empty {
    margin: 20px 4px;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
  }

  .hrr-app .mobile-grid-edit {
    width: 18px;
    height: 18px;
    margin: 1px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--white);
    color: var(--ink);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .hrr-app .mobile-grid-edit:disabled {
    opacity: .45;
    cursor: default;
  }

  .hrr-app .mobile-entry[hidden] {
    display: none !important;
  }

  .hrr-app .mobile-entry {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 0, 0, .28);
  }

  .hrr-app .mobile-entry-card {
    width: min(100%, 390px);
    margin-top: 8vh;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 12px 35px rgba(0, 0, 0, .20);
  }

  .hrr-app .mobile-entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 17px;
  }

  .hrr-app .mobile-entry form {
    display: flex;
    flex-direction: column;
    gap: 11px;
  }

  .hrr-app .mobile-field.has-mobile-lov { position: relative; }
.hrr-app .mobile-lov {
  position: absolute;
  left: 0; right: 0; top: calc(100% - 2px);
  z-index: 100;
  max-height: 180px;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid #cfd8d2;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.hrr-app .mobile-lov-item {
  display: block; width: 100%; padding: 9px 11px;
  border: 0; border-bottom: 1px solid #e7ece8;
  background: var(--paper); color: var(--ink);
  text-align: left; font: inherit; cursor: pointer;
}
.hrr-app .mobile-lov-item:last-child { border-bottom: 0; }
.hrr-app .mobile-lov-item:active,
.hrr-app .mobile-lov-item:hover { background: #eef5ef; }

.hrr-app .mobile-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .hrr-app .mobile-field label {
    font-weight: 600;
    font-size: 13px;
  }

  .hrr-app .mobile-field input,
  .hrr-app .mobile-field select {
    width: 100%;
    min-height: 43px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--white);
    color: var(--ink);
    font-size: 16px;
    box-sizing: border-box;
  }

  .hrr-app .mobile-entry-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex: 0 0 auto;
  }

  .hrr-app .mobile-icon-button {
    width: 42px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-size: 25px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
  }

  .hrr-app .mobile-ok {
    background: #258a45;
  }

  .hrr-app .mobile-cancel {
    background: #c93636;
  }

  .hrr-app .mobile-icon-button:disabled {
    opacity: .5;
    cursor: default;
  }
}

/* RESPONSIVE */
@media (max-width: 850px) {
  .hrr-app .workspace { padding: 20px 16px; }
  .hrr-app .heading { flex-direction: column; align-items: flex-start; gap: 14px; }
  .hrr-app .stats { width: 100%; justify-content: flex-start; }
  .hrr-app .racebar { flex-wrap: wrap; }
  .hrr-app .racebar select { flex: 1; min-width: 180px; }
  .hrr-app .racebar #new-event { margin-left: 0; width: 100%; }
  .hrr-app .actions { flex-wrap: wrap; }
  .hrr-app .actions .button { flex: 0 0 auto; }
  .hrr-app .actions .action-add { flex: 1 0 100%; }
  .hrr-app .table-scroll { max-height: calc(100vh - 360px); }
}

@media (max-width: 520px) {
  .hrr-app .topbar { padding: 10px 14px; }
  .hrr-app .brand strong { font-size: 16px; }
  .hrr-app .brand small { font-size: 11px; }
  .hrr-app .brand-logo { width: 44px; height: 44px; }
  .hrr-app .event-stamp span:not(.live-dot) { display: none; }
  .hrr-app .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hrr-app .actions #word { grid-column: 1 / -1; }
}
/* Kompakte Pfeil-Buttons zum Verschieben der Zeilen */
.hrr-app .row-move-btn {
  background: #edf3ee;
  border: 1px solid #dae5dc;
  color: var(--forest);
  font-size: 10px;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
}

.hrr-app .row-move-btn:hover:not(:disabled) {
  background: var(--forest);
  color: #ffffff;
  border-color: var(--forest);
}

.hrr-app .row-move-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Auffällige Markierung für die zuletzt verschobene Starterzeile */
.hrr-app #grid-body tr.row-moved-highlight > td {
  background: #fff0a8 !important;
  border-top: 2px solid #e2a900;
  border-bottom: 2px solid #e2a900;
}
.hrr-app #grid-body tr.row-moved-highlight > td:first-child {
  border-left: 4px solid #e2a900;
}
.hrr-app #grid-body tr.row-moved-highlight > td:last-child {
  border-right: 2px solid #e2a900;
}

/* Bearbeiten-Aktion nur auf Smartphones anzeigen. */
#action-edit { display: none !important; }
@media (max-width: 760px) {
  #action-edit { display: inline-flex !important; }
}

/* 1.6.7: Tooltips nur bei aktiven Aktionen anzeigen; deaktivierte/ausgeblendete Buttons bleiben ohne Hoveranzeige. */
.hrr-app .button[data-tooltip]:disabled::after,
.hrr-app .button[hidden]::after {
  display: none !important;
}

.hrr-app .actions #word {
  color: var(--forest);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.hrr-app .actions #word:hover:not(:disabled),
.hrr-app .actions #word:focus-visible {
  color: var(--forest);
  background: rgba(32, 135, 68, 0.08);
  border-color: transparent;
}


/* Rennstatus ist der Wiederaktivieren-Button bei archivierten Rennen. */
.hrr-app .racebar #lock-state:disabled {
  opacity: 1;
  cursor: default;
}
.hrr-app .racebar #lock-state:not(:disabled) {
  cursor: pointer;
}

/* 1.7.1: Smartphone-Aktionsleiste im Header */
@media (max-width: 600px) {
  .hrr-app .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand logout"
      "race race"
      "help help"
      "actions actions";
    gap: 8px 10px;
    align-items: center;
  }

  .hrr-app .topbar .brand {
    grid-area: brand;
    min-width: 0;
  }

  .hrr-app .topbar #event-stamp {
    grid-area: race;
    justify-self: stretch;
    width: 100%;
    margin-left: 0 !important;
    min-height: 34px;
    justify-content: flex-start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hrr-app .topbar .hrr-manual-link {
    grid-area: help;
    justify-self: end;
    min-height: 28px;
    padding: 4px 9px;
    font-size: 11px;
    line-height: 1.2;
  }

  .hrr-app .topbar form {
    grid-area: logout;
    margin-left: 0 !important;
  }

  .hrr-app .topbar .actions {
    grid-area: actions;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(78px, 1.6fr) repeat(4, minmax(34px, 1fr));
    gap: 5px;
    margin: 0;
    padding: 7px 0 2px;
    border-top: 1px solid rgba(0,0,0,.08);
    border-bottom: 0;
  }

  .hrr-app .topbar .actions .action-separator {
    display: none;
  }

  .hrr-app .topbar .actions .button {
    min-width: 0;
    width: 100%;
    min-height: 36px;
    height: 36px;
    padding: 0 4px;
    justify-content: center;
    border-radius: 7px;
  }

  .hrr-app .topbar .actions .action-add {
    grid-column: span 2;
    font-size: 13px;
    font-weight: 600;
  }

  .hrr-app .topbar .actions .selected-action,
  .hrr-app .topbar .actions .icon-action {
    width: 100%;
    min-width: 0;
    font-size: 18px;
  }

  .hrr-app .topbar .actions #word {
    grid-column: 5;
    grid-row: 1;
  }

  .hrr-app .topbar .actions #action-edit {
    grid-column: 3;
    grid-row: 1;
  }

  .hrr-app .topbar .actions #action-move-up {
    grid-column: 4;
    grid-row: 1;
  }

  .hrr-app .topbar .actions #action-move-down {
    grid-column: 5;
    grid-row: 1;
  }

  .hrr-app .topbar .actions #action-email {
    grid-column: 1;
    grid-row: 2;
  }

  .hrr-app .topbar .actions #action-delete {
    grid-column: 2;
    grid-row: 2;
  }

  .hrr-app .topbar .actions #save {
    grid-column: 3;
    grid-row: 2;
  }

  .hrr-app .topbar .actions #undo {
    grid-column: 4;
    grid-row: 2;
  }

  .hrr-app .topbar .actions #word {
    grid-column: 5;
    grid-row: 2;
  }

  .hrr-app #actions-anchor {
    display: block;
  }

  .hrr-app .workspace {
    padding-top: 10px;
  }

  .hrr-app .racebar {
    padding-top: 8px;
  }
}


/* 1.7.2: Smartphone kompakt – auch im Querformat */
@media (max-width: 600px), (orientation: landscape) and (max-width: 1000px) {
  .hrr-app .heading {
    gap: 6px;
  }

  .hrr-app .stats {
    gap: 9px;
    width: auto;
    justify-content: flex-end;
  }

  .hrr-app .stats div {
    gap: 1px;
  }

  .hrr-app .stats b {
    font-size: 24px;
  }

  .hrr-app .stats small {
    font-size: 9px;
    letter-spacing: .2px;
  }

  .hrr-app .stats i {
    height: 22px;
  }

  .hrr-app .topbar .actions .button,
  .hrr-app .topbar .actions .selected-action,
  .hrr-app .topbar .actions .icon-action {
    min-height: 32px;
    height: 32px;
    font-size: 15px;
    border-radius: 6px;
  }

  .hrr-app .topbar .actions .action-add {
    font-size: 11px;
  }

  .hrr-app .topbar .actions #word {
    font-size: 15px;
  }

  /* Bearbeiten bleibt auch im Querformat sichtbar und wird nicht vom alten 760px-Breakpoint verdrängt. */
  #action-edit {
    display: inline-flex !important;
  }
}

@media (orientation: landscape) and (max-width: 1000px) {
  .hrr-app .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 8px;
    padding: 6px 10px;
  }

  .hrr-app .brand-logo {
    width: 38px;
    height: 38px;
  }

  .hrr-app .brand {
    gap: 8px;
  }

  .hrr-app .brand strong {
    font-size: 13px;
  }

  .hrr-app .brand small {
    font-size: 9px;
  }

  .hrr-app .topbar .actions {
    padding: 4px 0 1px;
    gap: 4px;
  }

  .hrr-app .topbar .actions .action-add {
    grid-column: span 2;
  }

  .hrr-app .workspace {
    padding-top: 6px;
  }

  .hrr-app .heading {
    margin-bottom: 4px;
  }
}


/* Kontextbezogene Hilfe – eigenständiger Dialog, ohne das Tabellenlayout zu verändern. */
.hrr-app .hrr-context-help-trigger { margin-left: 6px; white-space: nowrap; }
.hrr-app .hrr-context-help-dialog {
  width: min(620px, calc(100vw - 28px)); max-width: 620px; max-height: min(82vh, 760px);
  padding: 0; border: 1px solid #dce5dd; border-radius: 16px; color: #172b25; background: #fff;
  box-shadow: 0 24px 80px rgba(16,60,48,.25); font: 16px/1.6 var(--sans, system-ui); overflow: auto;
}
.hrr-app .hrr-context-help-dialog::backdrop { background: rgba(9, 31, 24, .58); backdrop-filter: blur(2px); }
.hrr-app .hrr-context-help-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:22px 24px 14px; border-bottom:1px solid #e4ebe5; background:#f5f8f4; }
.hrr-app .hrr-context-help-head .eyebrow { margin:0 0 4px; color:#537063; font-size:11px; font-weight:700; letter-spacing:.12em; }
.hrr-app .hrr-context-help-head h2 { margin:0; font-size:22px; line-height:1.25; }
.hrr-app .hrr-context-help-content { padding:18px 24px 8px; }
.hrr-app .hrr-context-help-content p { margin:0 0 14px; }
.hrr-app .hrr-context-help-content ul { margin:0 0 16px; padding-left:22px; }
.hrr-app .hrr-context-help-foot { padding:14px 24px 22px; border-top:1px solid #e4ebe5; }
.hrr-app .hrr-context-help-foot a { color:#164d3d; font-weight:700; }
@media (max-width:600px) {
  .hrr-app .topbar .hrr-context-help-trigger { margin-left:4px; padding:7px 9px; font-size:13px; }
  .hrr-app .hrr-context-help-head { padding:18px 18px 12px; }
  .hrr-app .hrr-context-help-content { padding:16px 18px 6px; }
  .hrr-app .hrr-context-help-foot { padding:12px 18px 18px; }
}


/* Guided helper introduction */
#hrr-helper-tour { width: min(620px, calc(100vw - 28px)); }
#hrr-tour-step-title { margin: 0 0 12px; }
#hrr-tour-count { font-size: 12px; opacity: .7; text-transform: uppercase; letter-spacing: .08em; }
#hrr-tour-back:disabled { opacity: .4; cursor: not-allowed; }
#hrr-tour-step-body p { line-height: 1.6; }
