/* visioncode Support – ruhiges, eigenes Mini-CSS */
:root {
  --bg: #f6f6f4; --surface: #ffffff; --border: #e4e2dd; --border-strong: #d2cfc8;
  --text: #1d1c1a; --muted: #6f6b64; --primary: #1f4e5f; --primary-hover: #17404e; --primary-soft: #e6eff2;
  --danger: #b42318; --danger-soft: #fdecea;
  --st-offen: #e8eef9; --st-offen-t: #2a4a85;
  --st-in_arbeit: #fff1db; --st-in_arbeit-t: #8a5300;
  --st-wartet: #efeaf7; --st-wartet-t: #5b3f8c;
  --st-erledigt: #e5f3ea; --st-erledigt-t: #22683d;
  --radius: 8px; --shadow: 0 1px 2px rgba(20, 20, 15, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { 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); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin: 0 0 .75rem; font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mini { font-size: .8rem; } .strong { font-weight: 600; }
.text-danger { color: var(--danger); }
.count { display: inline-block; min-width: 1.6em; padding: 0 .45em; border-radius: 99px; background: #ecebe7; color: var(--muted); font-size: .8rem; font-weight: 600; text-align: center; vertical-align: middle; }

/* Topbar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: var(--primary); box-shadow: inset -5px -5px 0 rgba(255,255,255,.25); }
.crumb-sep { color: var(--border-strong); }
.project-name { font-weight: 600; color: var(--primary); }
.project-switch { font: inherit; font-weight: 600; color: var(--primary); border: 1px solid var(--border); border-radius: 6px; padding: .25rem .4rem; background: var(--surface); max-width: 14rem; }
.mainnav { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.mainnav > a:not(.btn) { padding: .35rem .65rem; border-radius: 6px; color: var(--muted); font-weight: 500; }
.mainnav > a:not(.btn):hover { background: #f1f0ec; text-decoration: none; color: var(--text); }
.mainnav > a.active { color: var(--text); background: #efeee9; }
.usermenu { position: relative; margin-left: .25rem; }
.usermenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; padding: .2rem .3rem; border-radius: 99px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-name { font-size: .9rem; color: var(--muted); }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.08); min-width: 190px; padding: .35rem; display: flex; flex-direction: column; }
.usermenu-panel a, .usermenu-panel .linklike { padding: .45rem .6rem; border-radius: 6px; color: var(--text); text-align: left; width: 100%; font-size: .92rem; }
.usermenu-panel a:hover, .usermenu-panel .linklike:hover { background: #f3f2ee; text-decoration: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; flex: none; }
.avatar-sm { width: 22px; height: 22px; font-size: .72rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.container-wide, .topbar-wide { max-width: 1500px; }
.page-head { margin-bottom: 1rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; }
.page-head h1 { flex: 1 1 auto; }
.detail-head { display: block; }
.detail-head .nr { color: var(--muted); font-weight: 500; }

/* Buttons & Forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; font: inherit; font-weight: 550; padding: .5rem .9rem; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; line-height: 1.2; }
.btn:hover { background: #f4f3ef; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #efc6c1; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .32rem .65rem; font-size: .88rem; }
.btn-block { width: 100%; margin-top: .5rem; }
.mainnav .btn-primary { color: #fff; margin-left: .25rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], select, textarea {
  font: inherit; color: var(--text); width: 100%; padding: .5rem .65rem; border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; }
textarea { resize: vertical; min-height: 6rem; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid #8fb3c1; outline-offset: 1px; border-color: var(--primary); }
label { display: block; font-weight: 550; font-size: .9rem; }
label > input, label > select, label > textarea { margin-top: .3rem; font-weight: 400; }
label.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 400; margin: 0 1rem .4rem 0; cursor: pointer; }
label.check input { width: auto; margin: 0; accent-color: var(--primary); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 550; font-size: .9rem; margin-bottom: .4rem; padding: 0; }
.stack > * + * { margin-top: .85rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.narrow { max-width: 560px; }
.auth-card { max-width: 400px; margin: 3rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.75rem; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 1rem; }

.flash { padding: .65rem .9rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid; font-size: .93rem; }
.flash-ok { background: var(--st-erledigt); border-color: #c4e3cf; color: var(--st-erledigt-t); }
.flash-err { background: var(--danger-soft); border-color: #f3c3bd; color: var(--danger); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* Badges */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eeede9; color: var(--muted); white-space: nowrap; }
.st-offen { background: var(--st-offen); color: var(--st-offen-t); }
.st-in_arbeit { background: var(--st-in_arbeit); color: var(--st-in_arbeit-t); }
.st-wartet { background: var(--st-wartet); color: var(--st-wartet-t); }
.st-erledigt { background: var(--st-erledigt); color: var(--st-erledigt-t); }
.prio { font-size: .8rem; font-weight: 600; white-space: nowrap; color: var(--muted); }
.prio::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .35rem; vertical-align: 1px; background: #b9b5ad; }
.prio-hoch { color: #a3361a; } .prio-hoch::before { background: #d4512f; }
.prio-normal::before { background: #7f9aa5; }
.prio-niedrig::before { background: #d7d4cd; }
.chip { display: inline-block; padding: .05rem .45rem; margin: 0 .2rem .2rem 0; border-radius: 4px; background: #f0efeb; font-size: .8rem; white-space: nowrap; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

/* Filter */
.filters { display: flex; flex-wrap: wrap; gap: .5rem .6rem; align-items: center; margin-bottom: 1rem; }
.filters label { margin: 0; }
.filters select, .filters input[type=search] { margin: 0; padding: .4rem .55rem; font-size: .9rem; }
.filters .f-search { flex: 1 1 220px; max-width: 320px; }
.filters select { width: auto; }
.filters label.check { margin: 0 .2rem; font-size: .9rem; }
.filters .reset { font-size: .88rem; }
html.js .filters button[type=submit] { display: none; }

/* Liste */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table.tickets { width: 100%; border-collapse: collapse; }
table.tickets th, table.tickets td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid #efeee9; vertical-align: middle; }
table.tickets th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fbfbf9; white-space: nowrap; }
table.tickets tbody tr:last-child td { border-bottom: 0; }
table.tickets tbody tr:hover { background: #fcfcfa; }
table.tickets .c-nr { width: 4.5rem; white-space: nowrap; color: var(--muted); }
table.tickets .c-title a { color: var(--text); font-weight: 550; }
table.tickets tr.overdue { box-shadow: inset 3px 0 0 var(--danger); background: #fffafa; }
table.tickets tr.done .c-title a { color: var(--muted); }
.sort { color: inherit; } .sort-active { color: var(--text); }
.table-wrap .plain { box-shadow: none; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: .85rem; align-items: start; }
.col { background: #efeee9; border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: .1rem .2rem .55rem; }
.col-count { font-size: .8rem; color: var(--muted); font-weight: 600; }
.col-body { min-height: 120px; display: flex; flex-direction: column; gap: .5rem; border-radius: 6px; transition: background .12s; }
.col-body.drag-over { background: #e2e6e3; outline: 2px dashed #9fb7bf; outline-offset: 2px; }
.card-t { background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: .6rem .7rem; box-shadow: var(--shadow); cursor: grab; }
.card-t.dragging { opacity: .45; }
.card-t.overdue { border-color: #f0b8b1; box-shadow: inset 3px 0 0 var(--danger); }
.card-t.saving { opacity: .6; }
.card-t-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; }
.card-t-nr { font-size: .8rem; color: var(--muted); font-weight: 600; }
.card-t-title { display: block; color: var(--text); font-weight: 550; line-height: 1.35; word-wrap: break-word; }
.card-t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin-top: .45rem; font-size: .8rem; }
.card-t-meta .chip { font-size: .75rem; }
.card-t-move { margin-top: .45rem; display: none; }
.card-t-move select { padding: .25rem .4rem; font-size: .82rem; }
@media (hover: none), (pointer: coarse) { .card-t-move { display: block; } .hint-dnd { display: none; } }

/* Detail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.detail-side { position: sticky; top: 4.2rem; }
.detail-side .stack { margin-bottom: 1rem; }
.prose { word-wrap: break-word; overflow-wrap: anywhere; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: .45rem .9rem; margin: 0 0 1rem; font-size: .92rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.files { list-style: none; margin: 0 0 1rem; padding: 0; }
.files li { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid #efeee9; }
.files li:last-child { border-bottom: 0; }
.thumb { width: 48px; height: 48px; border-radius: 5px; overflow: hidden; background: #f0efeb; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-pdf { color: var(--danger); background: var(--danger-soft); }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-info a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.upload input[type=file] { font-size: .88rem; max-width: 100%; }
.timeline { list-style: none; margin: 0 0 1rem; padding: 0; }
.timeline li { padding: .55rem 0; }
.tl-comment { border: 1px solid var(--border); border-radius: 7px; padding: .65rem .8rem !important; margin: .5rem 0; background: #fdfdfc; }
.tl-head { display: flex; align-items: center; gap: .45rem; margin-bottom: .35rem; }
.tl-activity { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; font-size: .88rem; color: var(--muted); padding: .3rem 0 !important; }
.tl-activity strong { color: var(--text); font-weight: 600; }
.tl-activity .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); margin-right: .2rem; }
.comment-form { border-top: 1px solid #efeee9; padding-top: 1rem; }

/* Admin */
.onetime input { margin-top: .5rem; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.userlist { display: flex; flex-direction: column; }
.userrow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.5fr) auto; gap: .75rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid #efeee9; }
.userrow:last-child { border-bottom: 0; }
.userrow.inactive { opacity: .6; }
.userrow-projects { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; }
.userrow-projects label.check { margin: 0 .6rem 0 0; font-size: .9rem; }
.userrow-actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.project-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); color: var(--text); }
.project-card:hover { border-color: var(--primary); text-decoration: none; }
.project-card-name { display: block; font-weight: 650; font-size: 1.05rem; margin-bottom: .5rem; }
.project-card-stats { display: flex; gap: 1rem; font-size: .88rem; color: var(--muted); }
.project-card-stats strong { color: var(--text); }

/* Mobil */
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; order: -1; }
  .tl-activity .dot { display: none; }
  .board { grid-template-columns: repeat(4, minmax(250px, 82vw)); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .5rem; }
  .col { scroll-snap-align: start; }
  .userrow { grid-template-columns: 1fr; }
  .userrow-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .container { padding: 1rem .75rem 3rem; }
  .topbar-inner { padding: .5rem .75rem; gap: .4rem; }
  .usermenu-name { display: none; }
  .mainnav { width: 100%; margin-left: 0; order: 3; }
  .mainnav .usermenu { margin-left: auto; }
  .topbar-inner > .usermenu { margin-left: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .filters .f-search { flex-basis: 100%; max-width: none; }
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  table.tickets, table.tickets tbody, table.tickets tr, table.tickets td { display: block; width: 100%; }
  table.tickets thead { display: none; }
  table.tickets tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .6rem; padding: .55rem .75rem; display: grid; grid-template-columns: auto 1fr; gap: .15rem .6rem; }
  table.tickets td { border: 0; padding: .1rem 0; }
  table.tickets td.c-nr { width: auto; grid-row: 1; }
  table.tickets td.c-title { grid-column: 2; grid-row: 1; }
  table.tickets td:not(.c-nr):not(.c-title) { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: center; font-size: .88rem; }
  table.tickets td:not(.c-nr):not(.c-title)::before { content: attr(data-label); color: var(--muted); font-size: .78rem; min-width: 6.5rem; }
  table.tickets td:empty { display: none; }
  table.tickets tr.overdue { box-shadow: inset 3px 0 0 var(--danger); }
}

/* Kommentare bearbeiten/löschen (02.10.2026) */
.tl-actions { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.tl-actions form { display: inline; margin: 0; }
.comment-edit { display: none; margin-top: .5rem; }
.comment-edit:target { display: flex; }
.tl-comment:has(.comment-edit:target) > .tl-body { display: none; }
