/* Jira-Cloud-Darkmode. Alle Farben nur hier in :root, Regeln greifen ausschliesslich ueber var(). */
:root {
  color-scheme: dark;
  --bg: #161a1d;
  --surface: #1d2125;
  --column: #1d2125;
  --card: #22272b;
  --card-hover: #282e33;
  --card-border: #a6c5e229;
  --overlay: #282e33;
  --rail-bg: #101214;
  --rail-text: #9fadbc;
  --rail-active-bg: #2c333a;
  --rail-active-text: #dee4ea;
  --line: #a6c5e229;
  --text: #b6c2cf;
  --text-strong: #dee4ea;
  --muted: #9fadbc;
  --subtlest: #8c9bab;
  --link: #579dff;
  --brand: #579dff;
  --brand-hover: #85b8ff;
  --on-brand: #1d2125;
  --selected-bg: #1c2b41;
  --selected-text: #579dff;
  --btn-bg: #2c333a;
  --btn-hover: #38414a;
  --btn-text: #b6c2cf;
  --disabled-bg: #22272b;
  --disabled-text: #738496;
  --input-bg: #22272b;
  --input-border: #738496;
  --focus: #85b8ff;
  --chip-bg: #22272b;
  --chip-hover: #2c333a;
  --chip-border: #454f59;
  --lozenge-bg: #2c333a;
  --lozenge-text: #b6c2cf;
  --count-bg: #2c333a;
  --type-bug: #e2483d;
  --type-story: #22a06b;
  --type-task: #388bff;
  --icon-glyph: #ffffff;
  --prio-high: #f87168;
  --prio-medium: #fea362;
  --prio-low: #579dff;
  --warn-bg: #332e1b;
  --warn-border: #7f5f01;
  --warn-text: #f5cd47;
  --ok-bg: #1c3329;
  --ok-border: #216e4e;
  --ok-text: #7ee2b8;
  --danger-bg: #42221f;
  --danger-border: #ae2e24;
  --danger-text: #fd9891;
  --tooltip-bg: #dee4ea;
  --tooltip-text: #161a1d;
  --scroll-thumb: #454f59;
  --backdrop: #101214b3;
  --dot-fallback: #8c9bab;
  --mask-on: #000000;
  --mask-off: #00000000;
  --shadow: 0 1px 1px #03040442, 0 0 1px #03040480;
  --shadow-overlay: 0 8px 12px #0304045c, 0 0 1px #03040480;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  accent-color: var(--brand);
  scrollbar-color: var(--scroll-thumb) transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* Layout: Fensterhoehe fix, nur Inhaltsbereiche scrollen */
.app { display: grid; grid-template-columns: 64px 260px minmax(0, 1fr) auto; height: 100vh; overflow: hidden; }
.rail { background: var(--rail-bg); color: var(--rail-text); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; }
.mark { width: 32px; height: 32px; border-radius: 6px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; margin-bottom: 12px; }
.rail-btn { width: 52px; border: 0; background: transparent; color: var(--rail-text); border-radius: 6px; padding: 8px 4px 6px; display: grid; justify-items: center; gap: 4px; }
.rail-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.rail-btn span { font-size: 11px; }
.rail-btn.active, .rail-btn:hover { background: var(--rail-active-bg); color: var(--rail-active-text); }

/* C: Seitenleiste = 100vh, Token oben + Weiteres Repository unten fix, nur die Projektliste scrollt */
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 14px; height: 100vh; min-height: 0; overflow: hidden; }
.side > .token-box, .side > .side-head, .side > .add-repo { flex: none; }
.side-head { padding: 0 6px; }
.side-head strong { font-size: 15px; color: var(--text-strong); }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.repo-list { list-style: none; margin: 0 -4px; padding: 0 4px; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.repo-list button { width: 100%; text-align: left; border: 0; background: transparent; border-radius: 6px; padding: 6px 10px; position: relative; }
.repo-list button strong { display: block; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-list small { display: block; color: var(--muted); font-size: 12px; }
.repo-list button:hover { background: var(--card-hover); }
.repo-list button.active { background: var(--selected-bg); }
.repo-list button.active strong { color: var(--selected-text); }
.repo-list button.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--brand); }
.add-repo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.add-repo label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

/* Buttons und Eingaben */
input, select, textarea { background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 4px; padding: 7px 10px; color: var(--text-strong); min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--subtlest); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 0; background: var(--btn-bg); color: var(--btn-text); border-radius: 4px; padding: 0 12px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--btn-hover); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); }
.btn[aria-disabled="true"], .btn[aria-disabled="true"]:hover, .btn:disabled, .btn:disabled:hover { background: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }
.hint-wrap { position: relative; display: inline-flex; }
.hint-wrap:not([data-hint=""]):hover::after, .hint-wrap:not([data-hint=""]):focus-within::after { content: attr(data-hint); position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; background: var(--tooltip-bg); color: var(--tooltip-text); font-size: 12px; padding: 4px 8px; border-radius: 3px; white-space: nowrap; pointer-events: none; }

/* B: Kopf in einer Zeile, darunter Chip-Zeile */
.main { min-width: 0; display: flex; flex-direction: column; overflow: auto; container-type: inline-size; }
.main-head { position: sticky; top: 0; z-index: 3; background: var(--bg); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); min-height: 57px; }
.top-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1 1 auto; white-space: nowrap; }
.space { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumb-sep { color: var(--subtlest); }
.top h1 { margin: 0; font-size: 20px; font-weight: 600; color: var(--text-strong); }
.top-actions { display: flex; gap: 8px; align-items: center; flex: 0 1 auto; min-width: 0; }
.search { display: flex; align-items: center; gap: 6px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: 4px; padding: 0 8px; height: 32px; flex: 0 1 260px; min-width: 140px; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search svg { width: 16px; height: 16px; stroke: var(--muted); fill: none; stroke-width: 1.8; flex: none; }
.search input { border: 0; background: transparent; width: 100%; padding: 6px 0; outline: none; }
.filters { display: flex; align-items: center; gap: 12px; padding: 10px 20px; min-width: 0; }
.chip-group, .chip-scroll { display: flex; align-items: center; gap: 6px; }
.chip-group { flex: none; }
.chip-scroll { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chip-scroll.fade-end { mask-image: linear-gradient(to right, var(--mask-on) calc(100% - 40px), var(--mask-off)); }
.chip-group-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 2px; flex: none; }
.chip-divider { width: 1px; height: 20px; background: var(--line); flex: none; }
.chip-empty { color: var(--muted); font-size: 12px; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--chip-border); border-radius: 14px; background: var(--chip-bg); color: var(--text); font-size: 13px; white-space: nowrap; flex: none; cursor: pointer; user-select: none; }
.chip:hover { background: var(--chip-hover); }
.chip[aria-pressed="true"], .chip:has(input:checked) { background: var(--selected-bg); border-color: var(--brand); color: var(--selected-text); font-weight: 600; }
.chip[aria-pressed="true"]::after, .chip:has(input:checked)::after { content: "\2713"; font-size: 12px; }
.chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip .type-icon { width: 14px; height: 14px; }
.chip.reset { border-style: dashed; color: var(--muted); }
.chip.reset:hover { color: var(--text-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--dot-fallback)); flex: none; }
.filters-end { display: flex; align-items: center; gap: 12px; flex: none; margin-left: auto; }
.meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
@container (max-width: 760px) { .btn-label { display: none; } .top-title .space, .top-title .crumb-sep { display: none; } }

/* Hinweise */
.notice { margin: 4px 20px 12px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: 6px; padding: 9px 12px; }
.notice.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.notice.error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }

/* D: Board, Spalten, Karten */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(216px, 1fr); gap: 12px; padding: 4px 20px 20px; overflow-x: auto; align-items: start; flex: 1 0 auto; }
.column { background: var(--column); border-radius: 8px; min-height: 240px; padding: 8px; }
.column.over { outline: 2px solid var(--brand); }
.column header { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px 6px; min-height: 40px; }
.column h2 { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.count { background: var(--count-bg); color: var(--text); border-radius: 10px; padding: 1px 7px; font-size: 12px; font-weight: 600; }
.col-add { margin-left: auto; width: 26px; height: 26px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.col-add svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.col-add:hover { background: var(--btn-hover); color: var(--text-strong); }
.col-add[aria-disabled="true"] { color: var(--disabled-text); cursor: not-allowed; }
.col-add[aria-disabled="true"]:hover { background: transparent; }
.cards { display: grid; gap: 6px; min-height: 80px; }
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: 6px; box-shadow: var(--shadow); padding: 10px 12px; display: grid; gap: 10px; cursor: grab; }
.card:hover { background: var(--card-hover); }
.card.fresh { outline: 2px solid var(--brand); outline-offset: -1px; }
.card h3 { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 400; color: var(--text-strong); overflow-wrap: anywhere; }
.card footer { display: flex; align-items: center; gap: 6px; min-height: 24px; }
.card footer .key { margin-right: auto; }
.key { margin: 0; color: var(--subtlest); font-size: 12px; font-weight: 600; }
.labels { display: flex; flex-wrap: wrap; gap: 4px; }
.lozenge { font-size: 11px; font-weight: 600; border-radius: 3px; padding: 1px 5px; background: var(--lozenge-bg); color: var(--lozenge-text); text-transform: uppercase; letter-spacing: .02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.type-icon { display: inline-grid; width: 16px; height: 16px; flex: none; }
.type-icon svg { width: 100%; height: 100%; }
.type-icon.bug .ic-bg { fill: var(--type-bug); }
.type-icon.story .ic-bg { fill: var(--type-story); }
.type-icon.task .ic-bg { fill: var(--type-task); }
.ic-fg { fill: var(--icon-glyph); }
.ic-line { fill: none; stroke: var(--icon-glyph); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.prio { display: inline-grid; width: 16px; height: 16px; flex: none; }
.prio svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.prio.high { color: var(--prio-high); }
.prio.medium { color: var(--prio-medium); }
.prio.low { color: var(--prio-low); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--lozenge-bg); object-fit: cover; }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; margin: 0; }

/* Liste */
.list { padding: 4px 20px 20px; }
.row { width: 100%; display: grid; grid-template-columns: 16px 90px minmax(0, 1fr) 140px 120px; gap: 12px; align-items: center; background: var(--card); color: var(--text); border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.row:hover { background: var(--card-hover); }
.row strong { font-weight: 500; color: var(--text-strong); }
.row .assignee, .row .status { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container (max-width: 760px) { .row { grid-template-columns: 16px 80px minmax(0, 1fr); } .row .assignee, .row .status { display: none; } }

/* Detail */
.detail { width: min(420px, 100vw); height: 100vh; background: var(--surface); border-left: 1px solid var(--line); padding: 16px 20px 28px; overflow: auto; }
.detail-bar { display: flex; justify-content: space-between; align-items: center; }
#close-detail, .icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 4px; }
#close-detail:hover, .icon-btn:hover { background: var(--btn-hover); color: var(--text-strong); }
.detail-key { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.detail h2 { margin: 6px 0 16px; font-size: 20px; font-weight: 600; color: var(--text-strong); }
.detail h3 { font-size: 14px; color: var(--text-strong); margin: 20px 0 4px; }
.facts { display: grid; grid-template-columns: 100px 1fr; gap: 8px 10px; margin: 0 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }
.detail-body, .comment { white-space: pre-wrap; line-height: 1.5; }
.comment { border-top: 1px solid var(--line); padding: 10px 0; }
.comment p { margin: 4px 0 0; }
.comment small { color: var(--muted); }

/* A: Dialog Issue anlegen */
dialog.modal { border: 1px solid var(--card-border); border-radius: 8px; padding: 0; background: var(--overlay); color: var(--text); box-shadow: var(--shadow-overlay); width: min(560px, 94vw); max-height: 92vh; }
dialog.modal::backdrop { background: var(--backdrop); }
.dialog { padding: 20px 24px; display: grid; gap: 16px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-head h2 { margin: 2px 0 0; font-size: 20px; font-weight: 600; color: var(--text-strong); }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0; margin-bottom: 6px; }
.field > span { margin-bottom: 0; }
.field small { font-weight: 400; color: var(--subtlest); }
.field em { color: var(--danger-text); font-style: normal; }
.field textarea { resize: vertical; min-height: 110px; line-height: 1.45; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.field input[aria-invalid="true"] { border-color: var(--danger-border); }
.segmented { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.seg { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--chip-border); border-radius: 4px; background: var(--chip-bg); cursor: pointer; }
.seg:hover { background: var(--chip-hover); }
.seg:has(input:checked) { background: var(--selected-bg); border-color: var(--brand); color: var(--selected-text); font-weight: 600; }
.seg:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip-pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 136px; overflow-y: auto; scrollbar-width: thin; padding: 2px; }
.chip-pick .chip { position: relative; }
.create-status { margin: 0; font-size: 12px; color: var(--muted); }
.form-error { margin: 0; background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); border-radius: 4px; padding: 8px 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 860px) { .app { grid-template-columns: 64px minmax(0, 1fr); } .side { display: none; } .detail { position: fixed; inset: 0 0 0 auto; z-index: 4; } .row { grid-template-columns: 16px 80px minmax(0, 1fr); } .row .assignee, .row .status { display: none; } .filters { flex-wrap: wrap; } }
