:root {
  --bg: #f5f3ef; --card: #ffffff; --ink: #1d2433; --muted: #6b7280; --line: #e5e1d8;
  --brand: #1f3a5f; --brand-2: #2c5282; --accent: #b8860b; --accent-soft: #fbf3dc;
  --ok: #2f7d4f; --ok-soft: #e6f4ea; --err: #b42318; --err-soft: #fdecea;
  --deploy: #6b46c1; --deploy-soft: #efe9fb; --support: #0f766e; --support-soft: #e3f4f2;
  --radius: 12px; --shadow: 0 1px 2px rgba(20,25,40,.06), 0 4px 16px rgba(20,25,40,.05);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--brand-2); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .2rem 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; }
h3 { font-size: .95rem; margin: 0 0 .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; }
.wrap.wide { max-width: 1240px; }
.wrap.narrow { max-width: 440px; padding-top: 10vh; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.pre { white-space: pre-wrap; margin: 0 0 1rem; }
.req { color: var(--err); }
kbd { background: #fff; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .8em; }
code { background: #f1efe9; padding: 2px 6px; border-radius: 5px; font-size: .85em; word-break: break-all; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar a { color: #dbe4f0; text-decoration: none; }
.brand { font-weight: 700; color: #fff !important; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { padding: 6px 12px; border-radius: 8px; }
.topbar nav a.on, .topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.me { display: flex; gap: 14px; align-items: center; font-size: .9rem; }
.me form { margin: 0; }
.me .linkbtn { color: #dbe4f0; }

/* Cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow-x: auto; }
.form section { padding: 8px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.form section:last-of-type { border-bottom: 0; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .8rem; margin-right: 6px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
label small, legend small { font-weight: 400; color: var(--muted); }
input:not([type=radio]):not([type=checkbox]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; color: inherit;
  border: 1px solid #d6d1c5; border-radius: 8px; background: #fff; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(44,82,130,.15); }
textarea { resize: vertical; }
.fixed-field { margin-bottom: 14px; }
.fixed-label { display: block; font-weight: 600; font-size: .9rem; }
.fixed-value { display: block; margin-top: 5px; padding: 10px 12px; border-radius: 8px; background: #f1efe9; border: 1px solid var(--line); color: var(--ink); }
.emailcell form { margin: 0; }
.emailcell input { min-width: 220px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.missing { animation: shake .35s; } .missing input, .missing select, .missing textarea, fieldset.missing .chip span { border-color: var(--err) !important; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0; font-weight: 500; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 8px 14px; border: 1px solid #d6d1c5; border-radius: 999px; background: #fff; transition: all .12s; }
.chip:hover span { border-color: var(--brand-2); }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(44,82,130,.25); }
.chips.small .chip span { padding: 6px 12px; font-size: .88rem; }
.urgency .u-hoch input:checked + span { background: #c2410c; border-color: #c2410c; }
.urgency .u-kritisch input:checked + span { background: var(--err); border-color: var(--err); }
.urgency .u-niedrig input:checked + span { background: #64748b; border-color: #64748b; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid #cfc9bb; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { background: transparent; }
.btn.big { padding: 12px 24px; font-size: 1rem; }
.btn.small { padding: 4px 10px; font-size: .82rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); cursor: pointer; text-decoration: underline; }

/* Public */
body.public { background: linear-gradient(180deg, #e9e4d8 0, var(--bg) 320px); }
.hero { padding: 16px 0 12px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent); margin: 0; }
.lead { color: var(--muted); margin: 0 0 8px; }
.dropzone { border: 2px dashed #cfc9bb; border-radius: var(--radius); padding: 20px; text-align: center; background: #fcfbf8; transition: all .15s; }
.dropzone.over { border-color: var(--brand-2); background: #eef3f9; }
.dz-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.thumbs:empty { display: none; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 100px; object-fit: cover; display: block; }
.thumb span { display: block; font-size: .75rem; color: var(--muted); padding: 2px 6px; }
.thumb .rm { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.submitbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.submitbar .hint { margin: 0; }
.done { text-align: center; padding: 40px 24px; }
.done .check { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 28px; margin: 0 auto 12px; }
.ticketno { font-size: 1.8rem; font-weight: 700; color: var(--brand); margin: 0 0 12px; }
.small-h { font-size: 1rem; }
.login h1 { margin-bottom: 16px; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b7dfc4; color: #1d5a37; }
.flash.error { background: var(--err-soft); border-color: #f5c2bd; color: var(--err); }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* Backend */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead h1 { margin: 0; }
.filters { display: flex; gap: 8px; }
.filters input, .filters select { margin: 0; width: auto; min-width: 200px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: #7a5a06; font-size: .78rem; text-align: center; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf9f6; }
.table td { padding: 12px 14px; border-bottom: 1px solid #f0ede6; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.tickets tbody tr { cursor: pointer; }
.table.tickets tbody tr:hover { background: #faf8f3; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.table .subj { font-weight: 600; }
.table a { text-decoration: none; }
tr.inactive td { opacity: .55; }
.clip { font-weight: 400; color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge.big { padding: 5px 14px; font-size: .9rem; }
.s-neu { background: var(--accent-soft); color: #7a5a06; }
.s-deploying { background: var(--deploy-soft); color: var(--deploy); }
.s-support { background: var(--support-soft); color: var(--support); }
.s-erledigt { background: var(--ok-soft); color: var(--ok); }
.s-abgelehnt { background: #eef0f3; color: #4b5563; }
.urg { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.urg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.urg.u-normal::before { background: #3b82f6; }
.urg.u-hoch::before { background: #ea580c; } .urg.u-hoch { color: #c2410c; }
.urg.u-kritisch::before { background: var(--err); box-shadow: 0 0 0 3px rgba(180,35,24,.2); } .urg.u-kritisch { color: var(--err); }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-size: .9rem; }
.headbadges { display: flex; gap: 12px; align-items: center; }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; margin: 0; }
.facts.one { grid-template-columns: 1fr; }
.facts.one div { display: flex; justify-content: space-between; border-bottom: 1px solid #f0ede6; padding-bottom: 8px; }
.facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.facts dd.warn { color: var(--err); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gallery a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; text-decoration: none; color: var(--muted); font-size: .8rem; }
.gallery img { width: 100%; height: 150px; object-fit: cover; display: block; background: #f1efe9; }
.gallery span { display: block; padding: 4px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.targets { display: grid; gap: 8px; margin-bottom: 14px; }
.target { display: flex; gap: 10px; align-items: center; margin: 0; padding: 12px; border: 1px solid #d6d1c5; border-radius: 10px; cursor: pointer; }
.target small { display: block; font-weight: 400; color: var(--muted); }
.target:has(input:checked) { border-color: var(--brand); background: #eef3f9; }
.target:has(input[value=deploying]:checked) { border-color: var(--deploy); background: var(--deploy-soft); }
.target:has(input[value=support]:checked) { border-color: var(--support); background: var(--support-soft); }
.target:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.assign .due { display: none; }
.assign:has(input[value=deploying]:checked) .due { display: block; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.assigned { background: #faf9f6; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0 0 10px 14px; border-left: 2px solid var(--line); margin-left: 4px; position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand-2); }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input:not([type=checkbox]) { flex: 1; min-width: 180px; margin: 0; }
.inline-form label.check { margin: 0; }
.linkcell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; margin-left: 12px; }
.rename { margin: 0; }
.rename input { border-color: transparent !important; background: transparent !important; padding: 4px 6px !important; margin: 0 !important; font-weight: 600; }
.rename input:hover, .rename input:focus { border-color: #d6d1c5 !important; background: #fff !important; }
.row { display: flex; gap: 10px; margin-top: 12px; }
.row form { margin: 0; }

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 12px; overflow-x: auto; }
  .me a { display: none; }
}
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .filters { flex-direction: column; width: 100%; }
  .filters input, .filters select { width: 100%; }
  .submitbar .btn { width: 100%; justify-content: center; }
  h1 { font-size: 1.35rem; }
}
