/* SERVER-Projekt: Auswahlseite /server und die oeffentlichen Seiten /server/<Nummer>.
   Baut auf den vorhandenen Bausteinen auf (.tab-strip, .day-tab-btn, .list-row, .card,
   .badge); hier steht nur, was sie nicht abdecken: Tabellen mit klebender Kopfzeile,
   Zahlenspalten, Diagrammflaechen und der Zurueck-Pfeil. */

/* Modulakzent: Blau (die Palette kennt --info in beiden Themes), damit die Seiten nicht
   mit Alliance (Lila) oder Prep (Oliv) verwechselt werden. */
body.mod-server { --accent: var(--info); --accent-bg: var(--info-bg); }

/* ---- Kopf der Serverseite ---- */
.ally-head h1 { margin: 0 0 2px; }
.ally-head .hint { margin: 0; }
.ally-banner {
  margin: 8px 0 0; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--amber-bg); color: var(--amber); font-size: .88rem;
}
.ally-banner.info { background: var(--info-bg); color: var(--info); }

/* ---- Reiter: .tab-strip aus components.css, hier nur Fokus und Mindesthoehe ---- */
.ally-tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); }
.ally-tabs button { min-height: var(--tap); cursor: pointer; font: inherit; font-weight: 600; }
.ally-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- Bedienzeile ueber den Tabellen ---- */
.ally-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.ally-controls .field { margin: 0; min-width: 0; }
.ally-controls .field.grow { flex: 1 1 200px; }
.ally-controls select { width: auto; max-width: 100%; }
.ally-table th .ally-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; white-space: nowrap; }
.ally-table th .ally-sort:hover { text-decoration: underline; }
.ally-compare { width: 100%; margin: 0; }
.ally-compare input[type="range"] { width: 100%; padding: 0; accent-color: var(--accent); min-height: var(--tap); cursor: pointer; }
.ally-compare input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ally-compare-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ally-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ally-chips .day-tab-btn { cursor: pointer; font: inherit; font-weight: 600; font-size: .85rem; }
.ally-chips .day-tab-btn[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.ally-note { font-size: .78rem; color: var(--text-faint); margin: 4px 0 0; }
.ally-meta { font-size: .82rem; color: var(--text-dim); margin: 0; }

/* ---- Tabellen ---- */
/* Eigene Variante von .table-pane (transfer.css): diese Seiten laden transfer.css nicht.
   Scrollt in beide Richtungen, die Kopfzeile bleibt oben stehen. */
.ally-pane {
  overflow: auto; overscroll-behavior: contain; max-height: calc(100dvh - 140px);
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
}
.ally-pane.ally-pane-flat { max-height: none; }
.ally-table th, .ally-table td { white-space: nowrap; }
.ally-table td.wrap, .ally-table th.wrap { white-space: normal; overflow-wrap: anywhere; }
.ally-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2);
  border-bottom: none; box-shadow: inset 0 -1px 0 var(--border-soft);
}
.ally-table th.num, .ally-table td.num { text-align: end; font-variant-numeric: tabular-nums; }
.ally-table tbody tr:last-child td { border-bottom: none; }
/* Platz und Name bleiben beim seitlichen Wischen stehen (logische Eigenschaft: in
   Rechts-nach-links-Sprachen steht die Spalte rechts). */
.ally-rank th:nth-child(1), .ally-rank td:nth-child(1) {
  position: sticky; inset-inline-start: 0; z-index: 1; min-width: 52px; width: 52px; background: var(--bg);
}
.ally-rank th:nth-child(2), .ally-rank td:nth-child(2) {
  position: sticky; inset-inline-start: 52px; z-index: 1; background: var(--bg);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis;
}
.ally-rank thead th:nth-child(1), .ally-rank thead th:nth-child(2) { z-index: 3; background: var(--surface-2); }
.ally-rank tr:hover td:nth-child(1), .ally-rank tr:hover td:nth-child(2) { background: var(--surface-2); }
.ally-rank-mark { color: var(--amber); font-weight: 700; cursor: help; margin-inline-start: 1px; }

.ally-up { color: var(--ok); }
.ally-down { color: var(--danger); }
.ally-flat { color: var(--text-faint); }
.ally-sub { display: block; font-size: .74rem; color: var(--text-faint); }
.ally-warn { color: var(--amber); margin-inline-start: 4px; cursor: help; }
.ally-tag { font-weight: 700; }
.ally-date { color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 6.4em; }
.ally-arrow { color: var(--text-faint); padding: 0 2px; }
.ally-old { color: var(--text-dim); }

/* ---- Listen (Wechsel, Namen, Bewegungen) ---- */
.ally-list .list-row { align-items: baseline; }
.ally-list .list-row-main { flex-wrap: wrap; overflow: visible; gap: 2px 8px; }
.ally-list .list-row-main strong { overflow: visible; white-space: normal; overflow-wrap: anywhere; }

/* ---- Zurueck-Pfeil und Seitenkopf von Spieler-/Allianzseite ---- */
.ally-top { display: flex; align-items: flex-start; gap: 10px; }
.ally-top h1 { margin: 0; overflow-wrap: anywhere; }
.ally-top .hint { margin: 0; }
.ally-back { flex-shrink: 0; font-size: 1.3rem; line-height: 1; }
[dir="rtl"] .ally-back span { display: inline-block; transform: scaleX(-1); }

/* ---- Diagramme ---- */
.ally-chart { position: relative; height: 260px; width: 100%; }
.ally-spark { position: relative; height: 34px; width: 120px; }
.ally-section { display: flex; flex-direction: column; gap: 8px; }
.ally-section > h2, .ally-section > h3 { margin: 6px 0 0; }
.ally-empty { color: var(--text-dim); padding: 12px 4px; }
.ally-loading { color: var(--text-dim); padding: 20px 4px; }

/* ---- Auswahlseite ---- */
.ally-choose { max-width: 560px; margin: 0 auto; width: 100%; }
.ally-choose .card { padding: 14px; }
#kid-input { font-size: 1.2rem; max-width: 200px; letter-spacing: .04em; }
#kid-input[aria-invalid="true"] { border-color: var(--danger); }
.field-hint.is-error { color: var(--danger); }

@media (max-width: 640px) {
  .ally-chart { height: 220px; }
  .ally-rank td:nth-child(2) { max-width: 130px; }
  .ally-rank th:nth-child(2), .ally-rank td:nth-child(2) { inset-inline-start: 44px; }
  .ally-rank th:nth-child(1), .ally-rank td:nth-child(1) { min-width: 44px; width: 44px; padding-inline: 6px; }
}
#kid-hint { color: var(--text-dim); min-height: 1.2em; }
#kid-hint.is-error { color: var(--danger); }

/* ---- Aktivitaet (allyActivity.js) ---- */
/* Klassenfarben: dieselben Variablen nutzt das Diagramm (allyActivity.js, CLASS_VAR). Die Klasse steht
   immer auch als Text im Badge, die Farbe allein traegt nichts. */
.act-daily { --act: var(--ok); }
.act-regular { --act: var(--info); }
.act-occasional { --act: var(--amber); }
.act-pause { --act: var(--brown); }
.act-inactive { --act: var(--danger); }
.act-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1px solid var(--act); color: var(--act); white-space: nowrap;
}
.act-flag { color: var(--danger); font-size: .78rem; font-weight: 600; cursor: help; white-space: nowrap; }
.act-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.act-stat { border: 1px solid var(--border-soft); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); min-width: 0; }
.act-stat-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.act-stat-label { font-size: .8rem; color: var(--text-dim); }
.act-stat-sub { font-size: .74rem; color: var(--text-faint); overflow-wrap: anywhere; }
.act-legend { display: grid; gap: 4px 16px; margin: 0; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.act-legend > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.act-legend dd { margin: 0; font-size: .82rem; color: var(--text-dim); }
.act-how { font-size: .85rem; color: var(--text-dim); }
.act-how summary { cursor: pointer; font-weight: 600; }
.act-index { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.act-bar { display: inline-block; width: 54px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.act-bar > i { display: block; height: 100%; background: var(--accent); }
.act-index-num { min-width: 2ch; text-align: end; font-variant-numeric: tabular-nums; }
.act-player { align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 640px) { .act-bar { width: 36px; } }
