:root {

/* Vorsorglich: schlaegt jede spaetere display-Regel. Ohne das kann ein Element
   mit eigenem display trotz hidden sichtbar bleiben (im Admin-Panel genau so
   passiert: die Anmeldemaske verdeckte nach dem Login das Panel). */
[hidden] { display: none !important; }
  --bg: #11130e;
  --surface: #191c14;
  --surface-2: #20241a;
  --line: #2e3325;
  --text: #e8e6dc;
  --muted: #9a9b8a;
  --accent: #b7c27a;
  --accent-soft: rgba(183, 194, 122, 0.16);
  --ok: #7fbf6a;
  --warn: #d6a64a;
  --bad: #d0654f;
  --chart-line: #b7c27a;
  --chart-fill: rgba(183, 194, 122, 0.18);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f3ec;
    --surface: #ffffff;
    --surface-2: #f0efe6;
    --line: #dddbcc;
    --text: #1f2118;
    --muted: #666757;
    --accent: #5b6a26;
    --accent-soft: rgba(91, 106, 38, 0.12);
    --ok: #3f8a2e;
    --warn: #a6741a;
    --bad: #b2412b;
    --chart-line: #5b6a26;
    --chart-fill: rgba(91, 106, 38, 0.14);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.02rem; }
h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 8px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { overflow-wrap: anywhere; }
.logo {
  flex: none; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  background: #4c5333; color: #e8e2c8; font-weight: 800; font-size: 1.2rem;
}
.sub { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }
.state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--line); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--ok); }
.pill-bad { color: var(--bad); }
.pill-wait { color: var(--muted); }

main { padding-top: 20px; padding-bottom: 32px; }
.notice { background: var(--surface); border: 1px solid var(--bad); color: var(--text); padding: 10px 14px; border-radius: var(--radius); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.kpi-text { font-size: 1.15rem; padding: 5px 0 3px; overflow-wrap: anywhere; }
.kpi-note { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card > h2 { margin-bottom: 12px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button {
  font: inherit; font-size: 0.8rem; color: var(--muted); background: none; border: 0; padding: 5px 10px;
  border-radius: 6px; cursor: pointer;
}
.seg button[aria-selected="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.chart { width: 100%; height: 240px; position: relative; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-fill); stroke: none; }
.chart .cursor { stroke: var(--muted); stroke-width: 1; }
.chart .dot { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.tip {
  position: absolute; pointer-events: none; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 8px; font-size: 0.8rem; white-space: nowrap; transform: translate(-50%, -110%);
}
.empty { color: var(--muted); font-size: 0.9rem; padding: 12px 0; }

.factions { display: flex; flex-direction: column; gap: 10px; }
.faction-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; font-size: 0.9rem; }
.faction-name { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.faction-meta { color: var(--muted); font-size: 0.82rem; }
.track { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; border-radius: 999px; background: var(--accent); }

.list { list-style: none; padding: 0; margin: 0; counter-reset: pos; }
.list li { counter-increment: pos; display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.list li:last-child { border-bottom: 0; }
.list li::before { content: counter(pos); color: var(--muted); width: 1.4em; flex: none; }
.list .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .val { color: var(--muted); white-space: nowrap; }
.list.is-empty li::before { content: none; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table td.wrap { white-space: normal; min-width: 180px; }
.table .name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-size: 0.78rem; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: 0.88rem; }
.bar-row .track { height: 5px; }

.ranks { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.rank { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.rank strong { display: block; }
.rank span { color: var(--muted); font-size: 0.85rem; }

.method { margin-top: 24px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.method h2 { margin-bottom: 8px; }
.method ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.88rem; }
.method li { margin: 4px 0; }
.method strong { color: var(--text); font-weight: 600; }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }
.foot-inner { display: flex; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
}
@media (max-width: 420px) {
  .kpi-value { font-size: 1.4rem; }
  .chart { height: 200px; }
}

/* --- Verweise im Kopf ------------------------------------------------------------------------ */
.links { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; justify-content: flex-end; }
.knopf {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.85rem;
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.knopf:hover { border-color: var(--accent); color: var(--accent); }
.knopf-discord { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* --- Tagesprofil ----------------------------------------------------------------------------- */
.activity {
  display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px;
  align-items: end; margin-top: 14px; min-height: 110px;
}
.stunde { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.saeule {
  width: 100%; height: 90px; background: var(--surface-2); border-radius: 3px;
  display: flex; align-items: flex-end; overflow: hidden;
}
.saeule.leer { background: repeating-linear-gradient(45deg, var(--surface-2) 0 3px, transparent 3px 6px); }
.saeulenfuellung { width: 100%; background: var(--chart-line); border-radius: 3px; transition: height .4s ease; }
.stunde.jetzt .saeulenfuellung { background: var(--warn); }
.stundenlabel { font-size: 0.68rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Stammschaft ----------------------------------------------------------------------------- */
.bar { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.bar-head { display: flex; justify-content: space-between; font-size: 0.88rem; }
.bar-head strong { font-variant-numeric: tabular-nums; }
.bar-track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }

@media (max-width: 640px) {
  .activity { gap: 2px; }
  .saeule { height: 64px; }
  .stundenlabel { font-size: 0.6rem; }
}

/* --- Melde-Dialog ---------------------------------------------------------------------------- */
#melden { background: transparent; border: none; padding: 16px; max-width: 460px; width: 100%; }
#melden::backdrop { background: rgba(0, 0, 0, 0.6); }
.meldekarte { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.meldekarte label { display: block; font-size: 0.85rem; color: var(--muted); }
.meldekarte select, .meldekarte textarea, .meldekarte input[type=text] {
  width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
}
.meldekarte textarea { resize: vertical; }
.meldezeile { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.unterueberschrift { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin: 16px 0 6px; }
.tabellenhuelle { overflow-x: auto; }
