:root {
  --blue: #0C66E4;
  --blue-dark: #0055CC;
  --blue-light: #E9F2FF;
  --text: #172B4D;
  --text-sub: #44546F;
  --text-faint: #626F86;
  --border: #DCDFE4;
  --bg: #FFFFFF;
  --bg-col: #F7F8F9;
  --bg-hover: #F1F2F4;
  --green: #1F845A;
  --green-bg: #DCFFF1;
  --red: #AE2E24;
  --red-bg: #FFECEB;
  --yellow: #FFD000;
  --dep-bg: #0A1E5E;
  --shadow: 0 1px 1px rgba(9,30,66,.25), 0 0 1px rgba(9,30,66,.31);
  --shadow-lg: 0 8px 12px rgba(9,30,66,.15), 0 0 1px rgba(9,30,66,.31);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/20px var(--font); color: var(--text); background: var(--bg); }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.spacer { flex: 1; }

/* Top navigation */
.topnav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 4px; }
.logo:hover { background: var(--bg-hover); }
.logo-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--blue); color: #fff; font-weight: 700; font-size: 10px; letter-spacing: -.3px; }
.logo-text { font-weight: 700; font-size: 16px; color: var(--text); }
.topnav-links { display: flex; gap: 2px; }
.topnav-links a { padding: 6px 10px; border-radius: 3px; color: var(--text-sub); font-weight: 500; position: relative; }
.topnav-links a:hover { background: var(--bg-hover); }
.topnav-links a.active { color: var(--blue); }
.topnav-links a.active::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -11px; height: 3px; background: var(--blue); border-radius: 2px 2px 0 0; }
.chev { font-size: 10px; }
.search { display: flex; align-items: center; gap: 6px; border: 1px solid #8590A2; border-radius: 4px; padding: 0 8px; height: 32px; color: var(--text-faint); width: 200px; }
.search input { border: 0; outline: 0; font: inherit; color: var(--text); width: 100%; background: transparent; }
.iconbtn { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--text-sub); }
.iconbtn:hover { background: var(--bg-hover); }
.iconbtn.light { color: #fff; }
.iconbtn.light:hover { background: rgba(255,255,255,.15); }
.badge { position: absolute; top: 0; right: 0; background: #C9372C; color: #fff; font-size: 10px; line-height: 14px; min-width: 14px; border-radius: 7px; padding: 0 3px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #6E5DC6; color: #fff; font-size: 12px; font-weight: 600; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border: 2px solid #fff; margin-left: -6px; }
.avatar.a2 { background: #E2483D; } .avatar.a3 { background: #22A06B; }
#menuBtn { display: none; }

.btn { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 12px; border: 0; border-radius: 3px; font-weight: 500; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { background: #8FB8F6; cursor: progress; }
.btn-subtle { background: transparent; color: var(--text-sub); }
.btn-subtle:hover { background: var(--bg-hover); }

/* Layout */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar { width: 240px; flex: none; background: var(--bg-col); border-right: 1px solid var(--border); padding: 16px 8px; }
.project { display: flex; gap: 10px; align-items: center; padding: 8px; margin-bottom: 16px; }
.project-icon { width: 32px; height: 32px; display: grid; place-items: center; background: #fff; border-radius: 4px; box-shadow: var(--shadow); }
.project-name { font-weight: 600; }
.project-sub { font-size: 12px; color: var(--text-faint); }
.side-section { font-size: 11px; font-weight: 700; color: var(--text-faint); padding: 12px 8px 4px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 3px; color: var(--text-sub); }
.side-item span { width: 18px; text-align: center; }
.side-item:hover { background: #E9EBEE; }
.side-item.active { background: var(--blue-light); color: var(--blue); font-weight: 500; position: relative; }
.side-item.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 2px 2px 0; background: var(--blue); }
.side-item.disabled { opacity: .6; }
.side-item em { margin-left: auto; font-style: normal; }
.side-foot { margin: 24px 8px 0; font-size: 11px; color: var(--text-faint); }

.lozenge { display: inline-block; font-size: 11px; font-weight: 700; line-height: 16px; padding: 0 4px; border-radius: 3px; text-transform: uppercase; }
.lz-grey { background: #DCDFE4; color: var(--text-sub); }
.lz-blue { background: #CCE0FF; color: var(--blue-dark); }
.lz-green { background: var(--green-bg); color: #216E4E; }
.lz-red { background: var(--red-bg); color: var(--red); }
.lz-yellow { background: #FFF7D6; color: #7F5F01; }

.main { flex: 1; min-width: 0; padding: 20px 32px 40px; }
.breadcrumbs { color: var(--text-faint); font-size: 14px; }
.board-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.board-head h1 { margin: 0; font-size: 24px; line-height: 28px; font-weight: 600; }
.board-actions { margin-left: auto; display: flex; gap: 8px; }

/* Departure board */
.departure { display: grid; grid-template-columns: auto 1fr auto auto; grid-template-rows: auto auto; gap: 4px 20px; align-items: center; background: var(--dep-bg); color: #fff; border-radius: 6px; padding: 12px 18px 0; margin-bottom: 16px; overflow: hidden; font-family: "Helvetica Neue", Arial, sans-serif; }
.dep-time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dep-train { font-size: 18px; font-weight: 700; }
.dep-via { font-size: 13px; opacity: .8; }
.dep-delay { background: #fff; color: #C9372C; font-weight: 700; padding: 2px 8px; border-radius: 3px; font-size: 16px; }
.dep-platform { text-align: center; line-height: 1; }
.dep-platform small { display: block; font-size: 10px; opacity: .8; }
.dep-platform b { font-size: 28px; }
.dep-ticker { grid-column: 1 / -1; margin: 8px -18px 0; background: var(--yellow); color: #000; overflow: hidden; white-space: nowrap; font-weight: 600; font-size: 13px; padding: 3px 0; }
.dep-ticker span { display: inline-block; padding-left: 100%; animation: ticker 32s linear infinite; }
@keyframes ticker { to { transform: translateX(-100%); } }

.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.avatars { display: flex; padding-left: 6px; margin-right: 8px; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 3px; padding: 4px 10px; color: var(--text-sub); }
.chip:hover { background: var(--bg-hover); }
.hint { color: var(--text-faint); font-size: 12px; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 8px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bg-col); border-radius: 6px; min-height: 360px; display: flex; flex-direction: column; }
.col-head { padding: 12px 12px 8px; font-size: 12px; font-weight: 600; color: var(--text-sub); letter-spacing: .02em; }
.col-head .count { font-weight: 400; margin-left: 4px; }
.col-body { padding: 0 6px 6px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.col.dragover { outline: 2px dashed var(--blue); outline-offset: -2px; }
.col[data-status="closed"] .col-head { color: var(--green); }

.card { background: #fff; border-radius: 4px; box-shadow: var(--shadow); padding: 10px 12px; cursor: pointer; animation: arrive .45s cubic-bezier(.2,.8,.2,1); }
.card:hover { background: #F7F8F9; }
.card-title { margin-bottom: 10px; word-break: break-word; }
.card.closed .card-title { color: var(--text-sub); }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sub); }
.card-meta .key { font-weight: 500; }
.card.closed .key { text-decoration: line-through; }
.card-meta .avatar { width: 22px; height: 22px; font-size: 9px; margin-left: auto; background: var(--dep-bg); }
.card .res { margin: -4px 0 8px; font-size: 12px; color: var(--green); }
.card.pending { position: relative; overflow: hidden; }
.card.pending::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 40%; background: var(--blue); animation: load 1.2s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes arrive { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.prio { font-size: 13px; }
.type-icon { width: 16px; height: 16px; display: inline-grid; place-items: center; border-radius: 3px; font-size: 10px; color: #fff; }
.t-bug { background: #E2483D; } .t-story { background: #22A06B; } .t-aufgabe { background: #1D7AFC; } .t-epic { background: #8270DB; } .t-weiche { background: #E56910; }

/* Modal */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(9,30,66,.54); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 4px; box-shadow: var(--shadow-lg); width: 100%; max-width: 600px; display: flex; flex-direction: column; }
.modal-wide { max-width: 920px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 8px; }
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 500; }
.modal-body { padding: 8px 24px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--border); margin-top: 8px; }
.required-note { color: var(--text-faint); font-size: 12px; margin: 0 0 12px; }
.req { color: #C9372C; }
.modal label { display: block; font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: 14px; }
.modal input:not([type=checkbox]), .modal select, .modal textarea { display: block; width: 100%; margin-top: 4px; font: 14px/20px var(--font); color: var(--text); background: var(--bg-col); border: 2px solid var(--border); border-radius: 3px; padding: 6px 8px; transition: background .1s, border-color .1s; }
.modal input:focus, .modal select:focus, .modal textarea:focus { outline: 0; background: #fff; border-color: var(--blue); }
.modal select:disabled { color: var(--text-faint); }
.modal textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal label.check { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.error { color: var(--red); background: var(--red-bg); padding: 8px 10px; border-radius: 3px; }

/* Detail view */
.detail-grid { display: grid; grid-template-columns: 1fr 280px; gap: 24px; padding: 8px 24px 24px; }
.detail-key { color: var(--text-faint); font-size: 14px; display: flex; gap: 6px; align-items: center; }
.detail-title { font-size: 22px; line-height: 28px; font-weight: 500; margin: 6px 0 16px; word-break: break-word; }
.detail-h { font-weight: 600; margin: 16px 0 6px; }
.detail-desc { white-space: pre-wrap; color: var(--text); word-break: break-word; }
.ansage-box { background: var(--dep-bg); color: #fff; border-radius: 6px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.ansage-box p { margin: 0; font-size: 15px; line-height: 22px; }
.ansage-box .btn { background: var(--yellow); color: #000; flex: none; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; gap: 10px; padding: 8px 0; color: var(--text-sub); font-size: 13px; }
.activity .avatar { width: 28px; height: 28px; font-size: 10px; background: var(--dep-bg); }
.side-panel { border: 1px solid var(--border); border-radius: 4px; }
.side-panel .sp-head { padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; }
.sp-row { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 8px 12px; font-size: 13px; }
.sp-row > :first-child { color: var(--text-faint); font-weight: 600; }
.status-btn { display: inline-flex; align-items: center; gap: 4px; background: var(--green-bg); color: #216E4E; font-weight: 700; font-size: 12px; text-transform: uppercase; padding: 4px 8px; border-radius: 3px; }

/* Announcer */
.announcer { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; width: min(680px, calc(100% - 32px)); display: flex; align-items: center; gap: 14px; background: var(--dep-bg); color: #fff; border-radius: 8px; box-shadow: var(--shadow-lg); padding: 14px 16px; border-bottom: 4px solid var(--yellow); animation: slideup .3s ease-out; }
@keyframes slideup { from { transform: translate(-50%, 30px); opacity: 0; } }
.speaker { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: #000; }
.announcer.playing .speaker { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255,208,0,.2); } }
.announcer-text { flex: 1; min-width: 0; }
.announcer-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--yellow); }
.announcer-line { font-size: 15px; line-height: 21px; max-height: 84px; overflow-y: auto; }

.toast { position: fixed; left: 24px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 70; background: var(--text); color: #fff; padding: 12px 16px; border-radius: 4px; box-shadow: var(--shadow-lg); max-width: min(420px, calc(100% - 48px)); }

/* Responsive */
@media (max-width: 1000px) {
  .topnav-links, .search { display: none; }
  .board { grid-template-columns: repeat(4, 240px); }
}
@media (max-width: 760px) {
  #menuBtn { display: grid; }
  .sidebar { position: fixed; top: 56px; bottom: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { padding: 16px; }
  .departure { grid-template-columns: 1fr auto; padding: 10px 14px 0; }
  .dep-time, .dep-platform { display: none; }
  .dep-ticker { margin: 8px -14px 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .hint, #resetBtn { display: none; }
  .logo-text { display: none; }
  .modal-foot .check { display: none; }
}
