/* Trainz Team Portal – gleiche Formensprache wie das Stellwerk, ruhiger und zum Lesen gemacht */

:root {
  --slate: #1c2733;
  --slate-2: #2a3644;
  --paper: #f3f5f7;
  --surface: #ffffff;
  --line: #d9dfe5;
  --text: #17212b;
  --muted: #5b6876;
  --blue: #0b4f8a;
  --blue-bg: #e6eef7;
  --green: #1d7a4c;
  --amber: #b77d00;
  --red: #b3261e;
  --font-display: "DIN Alternate", "Bahnschrift", "D-DIN", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--font-body); color: var(--text); background: var(--paper); display: flex; flex-direction: column; min-height: 100vh; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
h2 { font-size: 1.3rem; }
p { margin: 0 0 .9rem; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.wrap { width: min(100% - 2rem, 780px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { display: block; font-size: .85rem; color: var(--muted); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; }
.empty { color: var(--muted); }

/* ---------- Kopf & Fuß ---------- */

.top { background: var(--slate); color: #c9d2db; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font: 600 1.2rem var(--font-display); }
.lamps { display: inline-flex; flex-direction: column; gap: 2px; padding: 4px; background: #0f161e; border-radius: 8px; }
.lamps span { width: 7px; height: 7px; border-radius: 50%; background: #34404d; }
.lamps span:nth-child(3) { background: #3ecf7f; box-shadow: 0 0 5px #3ecf7f; }
.nav { display: flex; align-items: center; gap: .25rem 1rem; flex-wrap: wrap; font-size: .95rem; }
.nav a { color: #c9d2db; text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: #fff; }
.nav a[aria-current] { color: #fff; border-bottom-color: #3ecf7f; }
.nav form.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: #9fb0c1; cursor: pointer; text-decoration: underline; }
.linkish:hover { color: #fff; }

.main { flex: 1; padding: 2.5rem 0 4rem; }
.foot { border-top: 1px solid var(--line); background: var(--surface); font-size: .9rem; color: var(--muted); }
.foot-inner { display: flex; justify-content: space-between; gap: 1rem; padding: 1.2rem 0; flex-wrap: wrap; }
.foot nav { display: flex; gap: 1.2rem; }
.foot a { color: var(--muted); }

/* ---------- Blog ---------- */

.hero { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 3px solid var(--slate); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 56ch; }
.posts { list-style: none; margin: 0; padding: 0; }
.posts li { padding: 1.4rem 0; border-bottom: 1px solid var(--line); }
.posts h2 { font-size: 1.45rem; margin-bottom: .4rem; }
.posts h2 a { color: var(--text); text-decoration: none; }
.posts h2 a:hover { color: var(--blue); }
.posts p:last-child { margin: 0; color: var(--muted); }
.meta { font-size: .88rem; color: var(--muted); margin-bottom: .3rem; font-variant-numeric: tabular-nums; }
.pager { display: flex; justify-content: space-between; margin-top: 2rem; }

.prose { line-height: 1.7; }
.prose > * { max-width: 68ch; }
.prose h1 { margin-bottom: 1.2rem; }
.prose h2 { margin-top: 2rem; }
.prose h3, .prose h4 { font-size: 1.1rem; margin-top: 1.5rem; }
.prose img { max-width: 100%; height: auto; border-radius: var(--r); }
.prose pre { background: var(--slate); color: #dfe6ec; padding: 1rem; border-radius: var(--r); overflow: auto; font-size: .88rem; }
.prose code { background: var(--blue-bg); padding: .05em .3em; border-radius: 3px; font-size: .9em; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 1.2rem 0; padding: .2rem 1.1rem; border-left: 3px solid var(--blue); color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---------- Konto ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.4rem 1.5rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 600px; }
.card.danger { border-color: #e7b9b5; }
.card h2 { margin-bottom: .8rem; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.head h1 { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.tiles a { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--r); text-decoration: none; color: var(--text); }
.tiles a:hover { border-color: var(--slate-2); border-left-color: var(--blue); }
.tiles strong { font-family: var(--font-display); font-size: 1.08rem; }
.tiles span { font-size: .88rem; color: var(--muted); }

.list { list-style: none; margin: 0 0 1rem; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list form { margin: 0; }

.badge { display: inline-block; font-size: .8rem; padding: .15rem .6rem; border-radius: 999px; background: var(--blue-bg); color: var(--blue); }
.badge.new { background: #fbf3e0; color: #7a5300; }

.thread { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 1.25rem; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1.1rem; max-width: 90%; }
.msg header { margin-bottom: .3rem; }
.msg header .small { display: inline; }
.msg p { white-space: pre-line; margin: 0; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--blue-bg); border-color: #c9d9ea; }
.msg.team { border-left: 4px solid var(--green); }

/* ---------- Formulare ---------- */

.stack { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .92rem; font-weight: 500; }
label.check { flex-direction: row; align-items: flex-start; gap: .55rem; font-weight: 400; }
label.check input { margin-top: .3rem; }
input:not([type=checkbox]):not([type=file]), textarea {
  font: 400 1rem/1.45 var(--font-body); color: var(--text); width: 100%;
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
input[type=file] { font: inherit; }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--blue); flex: none; }
input:focus, textarea:focus { border-color: var(--blue); outline: 2px solid var(--blue-bg); outline-offset: 0; }
textarea { resize: vertical; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
fieldset.checks { border: 1px solid var(--line); border-radius: 6px; padding: .8rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
fieldset.checks legend { font: 600 .95rem var(--font-display); padding: 0 .3rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 500 .95rem/1 var(--font-body); padding: .7rem 1.1rem; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--slate-2); }
.btn.sm { padding: .45rem .75rem; font-size: .88rem; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #083f6f; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-outline { color: var(--red); border-color: #e7b9b5; }
.btn.apple { background: #000; border-color: #000; color: #fff; }
.top .btn.apple { border-color: #fff3; }

.notice { padding: .8rem 1rem; border-radius: 6px; border-left: 4px solid; background: var(--surface); margin-bottom: 1rem; }
.notice.ok  { border-color: var(--green); background: #e8f4ee; }
.notice.err { border-color: var(--red); background: #fbeceb; }

@media (max-width: 640px) {
  .tiles, .grid3 { grid-template-columns: 1fr; }
  .msg { max-width: 100%; }
  .top-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- Robustheit auf kleinen Bildschirmen ---------- */
.prose, .card, .msg, .posts, h1, h2 { overflow-wrap: anywhere; }
.prose pre { max-width: 100%; white-space: pre; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.prose table { display: block; max-width: 100%; overflow-x: auto; }
img, video, iframe { max-width: 100%; }

/* Sichere Bereiche (iPhone mit Notch / Home-Leiste, Querformat) */
.top-inner, .foot-inner, .main { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.foot-inner { padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .main { padding-top: 1.5rem; padding-bottom: 3rem; }
  .card { padding: 1.1rem 1rem; }
  /* Navigation als eine wischbare Zeile statt mehrerer Umbrüche */
  .nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 1.1rem; padding-bottom: .2rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav form { flex: none; }
  .head { align-items: flex-start; }
  .head .btn, .card .btn, .stack .btn { width: 100%; }
  .list li { align-items: flex-start; }
  .list li form, .list li form .btn { width: 100%; }
  .posts h2 { font-size: 1.25rem; }
  .foot-inner { flex-direction: column; }
}

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .nav a { padding: .5rem 0; }
}
@media (max-width: 640px) {
  /* Hinweis, dass die Navigation wischbar ist */
  .nav { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); padding-right: 1.5rem; }
}

/* =====================================================================
   Ideen, Schottersteine, bekannte Probleme
   ===================================================================== */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.small.inline { display: inline; }
.plain { white-space: pre-line; overflow-wrap: anywhere; }
.stone { width: 1.15em; height: 1em; vertical-align: -.15em; flex: none; }
.stone.big { width: 56px; height: 48px; }

.tabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--line); margin: 1.2rem 0 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: .55rem 0; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--blue); }
.sort { margin: -.3rem 0 1rem; }

.balance { margin: 0 0 .8rem; }
.balance > a { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text); }
.wink { display: flex; gap: .6rem; align-items: flex-start; font-size: .92rem; color: var(--muted); background: var(--surface); border: 1px dashed #c4cdd6; border-radius: var(--r); padding: .75rem .9rem; margin: 0 0 1rem; }
.wink .stone { margin-top: .2rem; }

/* Statusabzeichen */
.badge.st-open, .badge.st-known { background: #fbf3e0; color: #7a5300; }
.badge.st-planned, .badge.st-progress { background: var(--blue-bg); color: var(--blue); }
.badge.st-done, .badge.st-fixed { background: #e8f4ee; color: var(--green); }
.badge.st-pending { background: #eef1f4; color: var(--muted); }
.badge.st-rejected, .badge.st-declined, .badge.st-merged, .badge.st-wontfix { background: #eef1f4; color: var(--muted); }

/* Ideenliste */
.ideas { list-style: none; margin: 0; padding: 0; }
.idea { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 1rem; align-items: start; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.ideas .idea:last-child { border-bottom: 0; }
.score { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .55rem .3rem; }
.score strong { display: block; font: 600 1.45rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.score span { display: block; font-size: .72rem; color: var(--muted); line-height: 1.25; margin-top: .15rem; }
.idea-body h1, .idea-body h2 { margin: 0 0 .3rem; }
.idea-body h2 { font-size: 1.15rem; }
.idea-body h2 a { color: var(--text); text-decoration: none; }
.idea-body h2 a:hover { color: var(--blue); }
.excerpt { color: var(--muted); margin: 0 0 .4rem; font-size: .95rem; }
.idea .meta { margin: 0; }

.vote { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; width: 104px; }
.vote form { margin: 0; }
.vote-btn { width: 100%; min-width: 46px; min-height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; font-size: 1rem; cursor: pointer; color: var(--muted); }
.vote-btn:hover { border-color: var(--slate-2); color: var(--text); }
.vote-btn.up[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.vote-btn.down[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.vote-btn.undo { font-size: .75rem; min-height: 30px; border-style: dashed; }

.idea-detail .idea { border-bottom: 0; padding-top: 0; }
.idea-detail .idea-body h1 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
.team-note { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--r); padding: .9rem 1.1rem; margin: 1rem 0; }
.team-note .plain { margin: .3rem 0 0; }

/* Schotterstein-Konto */
.stone-account { display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; background: var(--slate); color: #c9d2db; border-radius: var(--r); padding: 1.3rem 1.5rem; margin: 1rem 0; }
.stone-balance { display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: .9rem; align-items: center; }
.stone-balance .stone { grid-row: span 2; }
.stone-balance strong { font: 600 2.6rem/1 var(--font-display); color: #fff; font-variant-numeric: tabular-nums; }
.stone-balance span { font-size: .9rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; font-size: .95rem; }
.facts dt { color: #9fb0c1; }
.facts dd { margin: 0; color: #fff; }
.facts .small { color: #9fb0c1; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: .8rem; align-items: start; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.ledger li:last-child { border-bottom: 0; }
.amt { font: 600 1.1rem/1.3 var(--font-display); text-align: right; font-variant-numeric: tabular-nums; }
.amt.plus { color: var(--green); }
.amt.minus { color: var(--red); }
.ledger .when { white-space: nowrap; display: inline; }

/* Bekannte Probleme */
.bugs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.bug { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; scroll-margin-top: 1rem; }
.bug:target { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.bug header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.bug h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.workaround { background: #e8f4ee; border-radius: 6px; padding: .7rem .9rem; margin: .4rem 0 .8rem; }
.workaround .plain { margin: .2rem 0 0; }
.list li > .badge { flex: none; }
.list li .small { display: block; }

@media (max-width: 640px) {
  .idea { grid-template-columns: 62px minmax(0, 1fr); }
  .idea .vote { grid-column: 1 / -1; flex-direction: row; width: auto; }
  .idea .vote form { flex: 1; }
  .stone-account { gap: 1rem; }
  .ledger li { grid-template-columns: 2.6rem minmax(0, 1fr); }
  .ledger .when { grid-column: 2; }
  .bug header { flex-direction: column; gap: .3rem; }
}

/* Versionen in bekannten Problemen und Bug-Formular */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
select { font: 400 1rem/1.45 var(--font-body); color: var(--text); width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.versions { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin: 0 0 .6rem; }
.versions > span { display: inline-flex; align-items: baseline; gap: .35rem; font: 600 .9rem var(--font-display); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: .2rem .6rem; font-variant-numeric: tabular-nums; }
.versions > span.fixed { background: #e8f4ee; border-color: #c3e2d0; color: var(--green); }
@media (max-width: 640px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
