:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --good: #059669;
    --warn: #d97706;
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 280px; background: #111827; color: #fff; padding: 24px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 32px; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--primary); display: grid; place-items: center; font-weight: 800; }
.brand span { display: block; color: #9ca3af; font-size: 13px; }
.nav { display: grid; gap: 8px; }
.nav a { color: #d1d5db; padding: 11px 12px; border-radius: 12px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.main { flex: 1; padding: 28px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page { max-width: 1280px; margin: 0 auto; }
.page.narrow { max-width: 860px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.03em; }
h2 { margin: 0 0 14px; font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.hero-card { margin-bottom: 20px; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { font-size: 34px; }
.danger-soft { background: #fff7f7; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.project-card { display: block; color: inherit; }
.project-card:hover { text-decoration: none; transform: translateY(-2px); transition: .15s ease; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px 16px; border: 0; border-radius: 12px; background: var(--primary); color: white; font-weight: 700; cursor: pointer; }
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #e5e7eb; color: #111827; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: var(--danger); }
.btn.full { width: 100%; }
.actions, .actions-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-flex; align-items: center; width: fit-content; gap: 6px; padding: 4px 9px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 700; }
.badge.good { background: #ecfdf5; color: var(--good); }
.badge.danger { background: #fef2f2; color: var(--danger); }
.badge.warn { background: #fffbeb; color: var(--warn); }
.alert { max-width: 1280px; margin: 0 auto 16px; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; }
.alert-success { border-color: #a7f3d0; background: #ecfdf5; }
.alert-error { border-color: #fecaca; background: #fef2f2; }
.alert-info { border-color: #bfdbfe; background: #eff6ff; }
.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
label { display: grid; gap: 7px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; background: #fff; }
textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.checkbox input { width: auto; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check-grid label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check-grid input { width: auto; }
.table-card { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 13px; }
.list { display: grid; gap: 10px; }
.list.compact { gap: 4px; }
.list-row { display: flex; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; color: inherit; align-items: center; }
.list-row:hover { text-decoration: none; background: #f8fafc; }
.list-row span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.right { text-align: right; }
.ticket-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.prose { line-height: 1.7; color: #374151; }
.comments { display: grid; gap: 12px; margin: 14px 0; }
.comment { border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.comment.internal { background: #fffbeb; border-color: #fde68a; }
.comment-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.comment p { margin-bottom: 0; }
.side-stack { display: grid; gap: 20px; align-content: start; }
.timeline { display: grid; gap: 12px; }
.timeline div { border-left: 3px solid var(--line); padding-left: 12px; }
.timeline span, .timeline small { display: block; color: var(--muted); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); }
.code { background: #111827; color: #e5e7eb; border-radius: 12px; padding: 12px; overflow-x: auto; }
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; margin-bottom: 16px; }
.link-danger { border: 0; background: transparent; color: var(--danger); cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
@media (max-width: 980px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: auto; height: auto; }
    .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.two, .grid.wide-left, .stats-grid, .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .page-head { display: grid; }
}

/* Version 2 UI-Erweiterungen */
.card, .stat, .alert, input, select, textarea, .comment, .list-row, .rich-editor, .mail-preview { border-radius: var(--radius-panel, 8px); }
.btn, .editor-toolbar button, .check-button { border-radius: var(--radius-button, 4px); }
.nav a { display:flex; align-items:center; gap:10px; }
.icon { width:18px; height:18px; display:inline-grid; place-items:center; flex:0 0 auto; }
.icon svg { width:18px; height:18px; fill:currentColor; }
.user-chip { display:inline-flex; align-items:center; gap:10px; color:inherit; }
.avatar { --avatar-bg:#2563eb; --avatar-fg:#fff; display:inline-grid; place-items:center; align-items:center; justify-items:center; width:44px; height:44px; line-height:1; text-align:center; border-radius:50%; background:var(--avatar-bg); color:var(--avatar-fg); font-weight:800; letter-spacing:.02em; flex:0 0 auto; box-shadow: inset 0 0 0 1px rgba(255,255,255,.32); }
.avatar-sm { width:34px; height:34px; font-size:12px; }
.avatar-md { width:44px; height:44px; }
.cards-list { display:grid; gap:16px; }
.cards-three { grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); }
.list-card { color:inherit; }
.list-card:hover { text-decoration:none; transform:translateY(-2px); transition:.15s ease; }
.list-card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.status-badge { border:1px solid transparent; }
.status-soft-row td { background:rgba(255,255,255,.65); }
.status-soft-row:hover td { background:rgba(255,255,255,.92); }
.permission-pills { display:flex; gap:6px; flex-wrap:wrap; margin:-4px 0 10px 58px; }
.permission-pills span { font-size:11px; border:1px solid var(--line); background:#f8fafc; padding:3px 7px; border-radius:999px; color:var(--muted); }
.editor-toolbar { display:flex; gap:6px; flex-wrap:wrap; padding:8px; border:1px solid var(--line); border-bottom:0; background:#f8fafc; }
.editor-toolbar button { border:1px solid var(--line); background:#fff; min-height:30px; padding:4px 8px; cursor:pointer; }
.rich-editor { min-height:130px; border:1px solid var(--line); background:#fff; padding:12px; font-weight:400; line-height:1.6; }
.rich-editor:focus { outline:2px solid #bfdbfe; }
.mail-preview { border:1px solid var(--line); background:#fff; padding:18px; line-height:1.6; }
.checklist-box { border:1px solid var(--line); padding:14px; margin:12px 0; border-radius:var(--radius-panel, 8px); background:#fff; }
.checklist-items { display:grid; gap:6px; margin:10px 0; }
.checklist-item { display:flex; align-items:center; gap:8px; padding:6px 0; }
.checklist-item small { color:var(--muted); margin-left:auto; }
.check-button { width:28px; height:28px; border:1px solid var(--line); background:#fff; color:transparent; cursor:pointer; }
.check-button.done { background:#ecfdf5; color:#047857; border-color:#a7f3d0; }
.done-text { text-decoration:line-through; color:var(--muted); }
.calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px; padding:1px; background:var(--line); overflow:hidden; }
.calendar-head { background:#f8fafc; padding:10px; font-weight:800; color:var(--muted); }
.calendar-day { min-height:135px; background:#fff; padding:10px; display:grid; align-content:start; gap:6px; }
.calendar-day.today { background:#f3f8ff; box-shadow:none; }
.calendar-day.empty { background:#f8fafc; }
.calendar-ticket { display:block; padding:6px; border:1px solid #dbeafe; background:#eff6ff; border-radius:var(--radius-button, 4px); font-size:12px; color:#1d4ed8; }
.calendar-ticket span { color:#64748b; }
.matrix-table th, .matrix-table td { min-width:150px; }
.matrix-table th:first-child { position:sticky; left:0; background:#fff; z-index:1; }
@media (max-width: 980px) {
    .calendar-grid { grid-template-columns:1fr; }
    .calendar-head, .calendar-day.empty { display:none; }
    .calendar-day { min-height:auto; }
    .cards-three { grid-template-columns:1fr; }
}

/* Version 3: filigranere Anmutung, Dashboard, Kalenderjahr, Ticket-Media */
:root { --text:#172033; }
body { font-size:14px; font-weight:400; letter-spacing:-.006em; }
.main { padding:24px 28px; }
h1 { font-size:clamp(24px, 3vw, 34px); font-weight:650; letter-spacing:-.04em; }
h2 { font-size:17px; font-weight:650; letter-spacing:-.02em; }
.card { padding:18px; box-shadow:0 12px 28px rgba(15,23,42,.05); }
.btn { min-height:36px; padding:8px 13px; font-weight:650; }
input, select, textarea { padding:9px 10px; }
.card-head { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:12px; }
.stats-grid-six { grid-template-columns:repeat(6,minmax(0,1fr)); }
.dashboard-grid { display:grid; grid-template-columns:1.35fr .85fr; gap:18px; }
.small-top { margin-top:18px; }
.stat.inline { box-shadow:none; border-radius:var(--radius-panel, 8px); padding:14px; }
.status-breakdown { display:grid; gap:8px; }
.status-meter { display:flex; justify-content:space-between; align-items:center; padding:9px 11px; border:1px solid var(--meter-border); background:var(--meter-bg); color:var(--meter-fg); border-radius:var(--radius-panel, 8px); }
.status-meter strong { font-size:18px; }
.project-mini-grid { display:grid; gap:10px; }
.mini-project { display:flex; align-items:center; gap:10px; padding:10px; border:1px solid var(--line); border-radius:var(--radius-panel, 8px); color:inherit; }
.mini-project:hover { background:#f8fafc; text-decoration:none; }
.mini-project small { display:block; color:var(--muted); margin-top:2px; }
.right .badge + span { margin-top:5px; }
.right span { display:block; color:var(--muted); font-size:12px; }
.rights-panel { border:1px solid var(--line); border-radius:var(--radius-panel, 8px); padding:16px; background:#fbfdff; }
.rights-grid label { align-items:flex-start; }
.rights-grid small { display:block; color:var(--muted); font-size:11px; margin-left:2px; }
.member-edit-box { border:1px solid var(--line); border-radius:var(--radius-panel, 8px); padding:10px; background:#fff; }
.list-row.flat { border:0; padding:0; }
.rights-details { margin-top:8px; }
.rights-details summary { cursor:pointer; color:var(--primary); font-weight:650; }
.no-indent { margin:0; }

.ticket-status-timeline-card, .ticket-media-card { margin-bottom:18px; }
.status-timeline-horizontal { display:flex; overflow-x:auto; gap:0; padding:8px 0 2px; }
.status-step { min-width:150px; position:relative; display:grid; gap:3px; padding:0 18px 0 0; color:var(--status-fg); }
.status-step::before { content:""; position:absolute; top:12px; left:20px; right:0; height:2px; background:var(--status-border); }
.status-step:last-child::before { display:none; }
.status-step > span { width:24px; height:24px; border-radius:50%; border:2px solid var(--status-border); background:var(--status-bg); display:block; position:relative; z-index:1; }
.status-step strong { font-size:12px; line-height:1.2; }
.status-step small { color:var(--muted); font-size:11px; }
.media-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px; margin-bottom:12px; }
.media-tile { display:grid; gap:6px; border:1px solid var(--line); border-left:4px solid var(--primary); border-radius:var(--radius-panel, 8px); padding:12px; color:inherit; background:#fbfdff; }
.media-tile:hover { text-decoration:none; background:#f8fafc; }
.media-icon .icon { color:var(--primary); }
.media-tile small { color:var(--muted); }
.media-upload-form { display:grid; grid-template-columns:minmax(220px,1fr) 180px auto; gap:10px; align-items:center; padding-top:12px; border-top:1px solid var(--line); }

.calendar-page { max-width:1480px; }
.year-calendar-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.month-card.context-month { opacity:.72; }
.month-card h2 { margin-bottom:10px; }
.mini-calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px; background:var(--line); border:1px solid var(--line); overflow:hidden; border-radius:var(--radius-panel, 8px); }
.mini-calendar-grid .calendar-head { padding:6px 7px; font-size:11px; text-align:center; }
.mini-calendar-grid .calendar-day { min-height:92px; padding:6px; gap:4px; }
.calendar-ticket-v3 { display:block; border-left:4px solid var(--customer-color); border-top:1px solid var(--status-border); border-right:1px solid var(--status-border); border-bottom:1px solid var(--status-border); background:var(--customer-bg); color:#172033; border-radius:var(--radius-button, 4px); padding:5px; font-size:11px; line-height:1.25; }
.calendar-ticket-v3:hover { text-decoration:none; filter:saturate(1.08); }
.calendar-ticket-v3 .ticket-line { display:block; color:#172033; }
.project-pill { display:inline-block; margin-top:4px; padding:2px 5px; border:1px solid var(--project-color); background:var(--project-bg); border-radius:999px; color:#172033; font-size:10px; }

@media (max-width: 1200px) {
    .stats-grid-six { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .dashboard-grid, .year-calendar-grid { grid-template-columns:1fr; }
}
@media (max-width: 760px) {
    .stats-grid-six, .stats-grid { grid-template-columns:1fr; }
    .media-upload-form { grid-template-columns:1fr; }
    .mini-calendar-grid { grid-template-columns:1fr; }
    .mini-calendar-grid .calendar-head, .mini-calendar-grid .calendar-day.empty { display:none; }
    .mini-calendar-grid .calendar-day { min-height:auto; }
}

/* Version 4: Kalender-Fokusansichten, Ticket-Meta, E-Mail-Statusprotokoll */
.main { font-weight: var(--ui-font-weight, 380); }
.card, .table-card, .hero-card { backdrop-filter: saturate(1.05); }
.project-pill { border-radius: 4px; }
.calendar-nav-actions { flex-wrap: wrap; }
.calendar-mode-tabs { margin-bottom: 18px; }
.month-card-head { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:10px; }
.month-card-head a:hover { text-decoration:none; }
.calendar-day-top { display:flex; justify-content:space-between; align-items:center; gap:4px; min-height:18px; }
.day-link, .week-link, .month-link { font-weight:700; font-size:11px; color:#334155; border-radius:4px; padding:1px 4px; }
.day-link:hover, .week-link:hover, .month-link:hover { background:#eef2ff; text-decoration:none; }
.week-link, .month-link { color:#64748b; font-weight:650; }
.day-focus-card, .week-focus-card { margin-bottom:18px; }
.calendar-focus-head { display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.calendar-focus-date { font-size:22px; font-weight:720; color:var(--text); }
.calendar-day-focus-list { display:grid; gap:8px; }
.week-focus-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:1px; background:var(--line); border:1px solid var(--line); border-radius:var(--radius-panel, 8px); overflow:hidden; }
.week-focus-day { min-height:190px; background:#fff; padding:10px; display:grid; align-content:start; gap:8px; }
.week-focus-day.today { background:#f3f8ff; box-shadow:none; }
.calendar-timeline-card { margin-top:18px; }
.calendar-timeline-scale { display:flex; justify-content:space-between; color:var(--muted); font-size:11px; margin:0 0 8px 300px; }
.calendar-timeline-list { display:grid; gap:7px; }
.calendar-timeline-row { display:grid; grid-template-columns:280px 1fr; gap:14px; align-items:center; color:inherit; border:1px solid var(--line); border-left:4px solid var(--customer-color); border-radius:var(--radius-panel, 8px); background:linear-gradient(90deg,var(--customer-bg),#fff); padding:8px 10px; }
.calendar-timeline-row:hover { text-decoration:none; background:#f8fafc; }
.calendar-timeline-label { min-width:0; display:grid; gap:1px; }
.calendar-timeline-label strong { font-size:12px; }
.calendar-timeline-label span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12px; }
.calendar-timeline-label small { color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.calendar-timeline-track { position:relative; height:26px; border:1px solid var(--line); background:repeating-linear-gradient(90deg,#f8fafc 0,#f8fafc 8.333%,#fff 8.333%,#fff 16.666%); border-radius:4px; overflow:hidden; }
.calendar-status-segment { position:absolute; top:3px; bottom:3px; display:flex; align-items:center; justify-content:center; border:1px solid; border-radius:4px; padding:0 5px; font-size:10px; line-height:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; min-width:12px; }
.year-mode .mini-calendar-grid .calendar-day { min-height:78px; }

.ticket-page-head { margin-bottom:12px; }
.ticket-identity-strip { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.ticket-identity-card { display:flex; align-items:center; justify-content:space-between; gap:12px; border:1px solid var(--line); border-radius:var(--radius-panel, 8px); background:#fff; padding:13px 14px; box-shadow:0 8px 20px rgba(15,23,42,.035); }
.ticket-identity-card .label { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:2px; }
.ticket-meta-wide { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; width:100%; border:1px solid var(--line); border-radius:var(--radius-panel, 8px); background:linear-gradient(180deg,#fff,#f8fafc); padding:12px; margin-bottom:18px; }
.ticket-meta-wide > div { min-height:58px; display:grid; align-content:center; gap:4px; border:1px solid #e8edf5; border-radius:var(--radius-button, 4px); background:rgba(255,255,255,.78); padding:10px; }
.ticket-meta-wide strong { font-size:14px; font-weight:720; }
.ticket-meta-wide span:not(.badge) { color:var(--muted); font-size:11px; }
.ticket-media-card { width:100%; }
.ticket-media-card .media-grid { grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); }

.email-row-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.email-row-actions form { margin:0; }
.email-detail-head { align-items:flex-start; }
.email-detail-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.email-summary-card { border:1px solid var(--line); border-radius:var(--radius-panel, 8px); background:#fff; padding:14px; display:grid; gap:3px; box-shadow:0 8px 20px rgba(15,23,42,.035); }
.email-summary-card span { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.06em; }
.email-summary-card strong { font-size:15px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.email-summary-card small { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mail-subject-box { display:grid; gap:3px; border:1px solid var(--line); border-radius:var(--radius-panel, 8px); background:#fbfdff; padding:14px; }
.mail-subject-box span { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.06em; }
.compact-timeline div { padding-left:12px; }

@media (max-width: 1100px) {
    .ticket-identity-strip, .ticket-meta-wide, .email-detail-summary { grid-template-columns:1fr 1fr; }
    .week-focus-grid { grid-template-columns:1fr; }
    .calendar-timeline-row { grid-template-columns:1fr; gap:8px; }
    .calendar-timeline-scale { margin-left:0; }
}
@media (max-width: 720px) {
    .ticket-identity-strip, .ticket-meta-wide, .email-detail-summary { grid-template-columns:1fr; }
    .ticket-identity-card { display:grid; }
}


/* Version 5: Kalender-Monatsbreite, Avatare, Features */
.year-calendar-grid.month-single { grid-template-columns: 1fr; }
.year-calendar-grid.month-single .mini-calendar-grid .calendar-day { min-height: 155px; }
.chip-list { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.chip { border:1px solid var(--line); background:#fff; border-radius:var(--radius-panel, 8px); padding:5px 8px; }
.chip form { display:inline; }
.sla-card .ticket-meta { margin-bottom:0; }
.linked-ticket-card { margin-bottom:18px; }
.health-stat strong { color: var(--good); }
.milestone-list { display:grid; gap:10px; }
.milestone-row { display:grid; grid-template-columns:minmax(0,1fr) 160px 52px; gap:10px; align-items:center; border:1px solid var(--line); border-radius:var(--radius-panel, 8px); padding:10px; background:#fff; }
.milestone-row span { display:block; color:var(--muted); font-size:12px; }
.progress { height:10px; background:#eef2f7; border-radius:999px; overflow:hidden; }
.progress span { display:block; height:100%; background:var(--primary); }
.retro-box { border:1px solid var(--line); background:#fbfdff; border-radius:var(--radius-panel, 8px); padding:12px; }
.status-badge, .badge { border-radius: 4px; }
@media (max-width: 760px) { .milestone-row { grid-template-columns:1fr; } }

/* Version 6: Spoofing, gruppierte Menüs, modernes Benutzerlayout */
.grouped-nav { display:grid; gap:14px; }
.nav-group { display:grid; gap:4px; }
.nav-group-title { padding:10px 12px 4px; color:#94a3b8; font-size:11px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.topbar-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.impersonation-banner { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:14px; padding:12px 14px; border:1px solid #fed7aa; background:#fff7ed; color:#9a3412; border-radius:var(--radius-panel, 8px); box-shadow:0 10px 24px rgba(154,52,18,.06); }
.impersonation-banner div { display:grid; gap:2px; }
.impersonation-banner span { font-size:12px; color:#c2410c; }
.profile-head-card { margin-bottom:14px; }
.notification-users-card { margin-bottom:18px; }
.notification-chip-list .chip { max-width:360px; }
.notification-chip-list small { color:var(--muted); }
.btn-mini { padding:4px 7px; min-height:0; font-size:11px; }
.user-related-grid { align-items:start; }
.menu-rights-panel h3 { margin:16px 0 8px; font-size:14px; }
.avatar { display:inline-flex !important; align-items:center !important; justify-content:center !important; font-variant-numeric:tabular-nums; text-shadow:0 1px 1px rgba(0,0,0,.12); }
.avatar-sm { line-height:1 !important; }
.user-chip { align-items:center; }

.layout-modern { --modern-a:#6366f1; --modern-b:#06b6d4; --modern-c:#f0f9ff; background:radial-gradient(circle at top left, rgba(99,102,241,.16), transparent 34%), radial-gradient(circle at top right, rgba(6,182,212,.14), transparent 30%), #f8fafc; }
.layout-modern .sidebar { background:linear-gradient(180deg,#111827,#172554 55%,#0f172a); border-right:0; color:#fff; box-shadow:16px 0 40px rgba(15,23,42,.14); }
.layout-modern .brand-mark { background:linear-gradient(135deg,var(--modern-a),var(--modern-b)); color:#fff; box-shadow:0 8px 28px rgba(99,102,241,.35); }
.layout-modern .brand span, .layout-modern .nav-group-title { color:#cbd5e1; }
.layout-modern .nav a { color:#e5e7eb; border:1px solid transparent; transition:transform .16s ease, background .16s ease, border .16s ease; }
.layout-modern .nav a:hover { transform:translateX(3px); background:rgba(255,255,255,.1); border-color:rgba(255,255,255,.12); text-decoration:none; }
.layout-modern .nav svg { fill:#bfdbfe; }
.layout-modern .main { background:transparent; }
.layout-modern .topbar, .layout-modern .card, .layout-modern .stat, .layout-modern .ticket-identity-card, .layout-modern .email-summary-card { backdrop-filter:blur(12px); background:rgba(255,255,255,.82); border-color:rgba(148,163,184,.25); box-shadow:0 18px 45px rgba(15,23,42,.08); }
.layout-modern .page-head h1 { letter-spacing:-.04em; font-weight:780; }
.layout-modern .btn { background:linear-gradient(135deg,var(--modern-a),var(--modern-b)); box-shadow:0 12px 24px rgba(99,102,241,.18); transition:transform .16s ease, box-shadow .16s ease; }
.layout-modern .btn:hover { transform:translateY(-1px); box-shadow:0 16px 32px rgba(99,102,241,.24); }
.layout-modern .btn-secondary { background:#fff; color:#334155; box-shadow:0 8px 18px rgba(15,23,42,.08); }
.layout-modern .list-row, .layout-modern .mini-project, .layout-modern .calendar-event, .layout-modern .media-tile { transition:transform .16s ease, box-shadow .16s ease; }
.layout-modern .list-row:hover, .layout-modern .mini-project:hover, .layout-modern .calendar-event:hover, .layout-modern .media-tile:hover { transform:translateY(-2px); box-shadow:0 16px 30px rgba(15,23,42,.08); text-decoration:none; }
.layout-modern .stats-grid .stat:nth-child(odd) { background:linear-gradient(180deg,rgba(255,255,255,.92),rgba(240,249,255,.85)); }
.layout-modern .stats-grid .stat:nth-child(even) { background:linear-gradient(180deg,rgba(255,255,255,.92),rgba(238,242,255,.85)); }
.layout-modern .calendar-month-card { box-shadow:0 18px 45px rgba(15,23,42,.08); }
.layout-modern.dashboard-focus .dashboard-grid.small-top:nth-of-type(n+3) { display:none; }
.layout-modern.dashboard-compact .stats-grid-six { grid-template-columns:repeat(3,minmax(0,1fr)); }
.layout-modern.dashboard-compact .stat { padding:12px; }
.layout-modern.dashboard-compact .dashboard-grid { grid-template-columns:1fr; }
@keyframes subtleRise { from { opacity:.84; transform:translateY(4px); } to { opacity:1; transform:none; } }
.layout-modern .card, .layout-modern .stat { animation:subtleRise .24s ease both; }
@media (prefers-reduced-motion: reduce) { .layout-modern .card, .layout-modern .stat, .layout-modern .btn, .layout-modern .nav a, .layout-modern .list-row { animation:none; transition:none; } }

/* Version 7: ruhigeres Modern-Topbar, leichtere Formulargewichte, Admin-Erweiterungen */
.layout-modern .topbar {
    background: transparent !important;
    box-shadow: none !important;
    border-color: transparent !important;
    backdrop-filter: none !important;
    padding-top: 2px;
}
label { font-weight: var(--ui-form-label-weight, 500); }
input, select, textarea { font-weight: 400; }
.btn { font-weight: 560; }
.badge { font-weight: 560; }
strong { font-weight: 620; }
.form-stack strong, label strong { font-weight: 560; }
.credential-actions-card .actions.wrap { flex-wrap: wrap; }
.mail-preview-frame { border:1px solid var(--line); border-radius:var(--radius-panel, 8px); padding:16px; background:#fff; }
.admin-template-grid { align-items:start; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.auth-card { max-width:460px; margin:9vh auto; background:#fff; border:1px solid var(--line); border-radius:var(--radius-panel, 8px); padding:24px; box-shadow:0 18px 45px rgba(15,23,42,.08); }
.actions.wrap { flex-wrap:wrap; }
.badge.good { background:#ecfdf5; color:#047857; border-color:#a7f3d0; }
.badge.danger { background:#fef2f2; color:#b91c1c; border-color:#fecaca; }
code { font-size:12px; white-space:pre-wrap; }

/* Version 8: scrollbar sidebar, direct-permission UX, Mail-Vorschau, Overlays */
.sidebar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.35) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.24); border-radius: 99px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.nav-group-title { position: sticky; top: -24px; background: #111827; z-index: 1; }
.layout-modern .topbar { background: transparent !important; box-shadow: none !important; border: 0 !important; padding-left: 0; padding-right: 0; }
.linked-stats .stat { color: inherit; text-decoration: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.linked-stats .stat:hover { transform: translateY(-2px); border-color: #bfdbfe; box-shadow: 0 18px 45px rgba(37,99,235,.12); }
.linked-stats .stat small { display:block; margin-top:8px; color:var(--primary); font-size:12px; }
.status-meter { color: inherit; text-decoration: none; }
.status-meter:hover { transform: translateY(-1px); text-decoration:none; }
.alert { display:flex; gap:10px; align-items:flex-start; box-shadow: 0 12px 28px rgba(15,23,42,.06); position: relative; animation: slideToast .22s ease-out; }
.alert::before { content:""; width:10px; height:10px; border-radius:50%; background:#64748b; margin-top:5px; flex:0 0 auto; }
.alert-success::before { background:#059669; }
.alert-error::before { background:#dc2626; }
.alert-info::before { background:#2563eb; }
@keyframes slideToast { from { opacity:0; transform: translateY(-6px); } to { opacity:1; transform:none; } }
label { font-weight: var(--ui-form-label-weight, 500); }
input, select, textarea { font-weight: 400; }
.mail-preview-iframe { width:100%; min-height:560px; border:1px solid var(--line); border-radius:var(--radius-panel,8px); background:#f3f4f6; }
.mail-preview-frame { max-width: 640px; margin-left:auto; margin-right:auto; background:#f3f4f6; }
.confirm-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.48); backdrop-filter: blur(5px); display:grid; place-items:center; z-index: 9999; padding: 20px; }
.confirm-dialog { width: min(460px, 100%); background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:0 26px 80px rgba(15,23,42,.22); padding:22px; animation: confirmIn .16s ease-out; }
.confirm-dialog h3 { margin:0 0 8px; font-size:20px; letter-spacing:-.02em; }
.confirm-dialog p { margin:0 0 18px; color:var(--muted); line-height:1.5; }
.confirm-actions { display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap; }
@keyframes confirmIn { from { opacity:0; transform: scale(.98) translateY(4px); } to { opacity:1; transform:none; } }
.auth-blocked-hint { border:1px dashed #fecaca; background:#fff7f7; color:#991b1b; padding:12px; border-radius:var(--radius-panel,8px); }
@media (max-width: 980px) { .sidebar { max-height: 48vh; } .nav-group-title { position: static; } }

/* Version 11: Dark-Layouts und konsistentere Luftigkeit/Gaps */
:root {
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
}
.page { display: grid; gap: var(--space-5); align-content: start; }
.page > .page-head { margin-bottom: 0; }
.hero-card, .small-top, .ticket-status-timeline-card, .ticket-media-card, .linked-ticket-card, .notification-users-card, .calendar-timeline-card, .day-focus-card, .week-focus-card { margin-top: 0; margin-bottom: 0; }
.card { padding: clamp(16px, 1.8vw, 22px); }
.card-head { margin-bottom: var(--space-4); }
.card > :first-child:not(.card-head) { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.grid, .dashboard-grid, .project-grid, .cards-list, .side-stack, .form-stack, .milestone-list, .calendar-timeline-list { gap: var(--space-5); }
.form-grid { gap: var(--space-4) var(--space-5); }
.list { gap: var(--space-3); }
.list.compact { gap: var(--space-2); }
.list-row { padding: var(--space-3); }
.actions, .actions-inline, .topbar-actions, .chip-list { gap: var(--space-3); }
.stats-grid { gap: var(--space-4); }
.stat { padding: clamp(14px, 1.5vw, 20px); }
.page-head { gap: var(--space-4); }
.ticket-meta-wide, .email-detail-summary, .ticket-identity-strip { gap: var(--space-3); }
.rich-editor { padding: var(--space-3); }
th, td { padding: 12px 10px; }

/* Klassischer Dark-Mode */
.layout-dark {
    --bg: #0b1120;
    --panel: #111827;
    --text: #e5edf8;
    --muted: #94a3b8;
    --line: #273244;
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --danger: #fb7185;
    --good: #34d399;
    --warn: #fbbf24;
    --shadow: 0 18px 48px rgba(0,0,0,.34);
    background: var(--bg);
    color: var(--text);
    color-scheme: dark;
}
.layout-classic-dark { background: linear-gradient(180deg, #0b1120 0%, #0f172a 100%); }
.layout-classic-dark .sidebar { background: #020617; border-right: 1px solid #1e293b; }
.layout-classic-dark .brand-mark { background: #1d4ed8; color: #eff6ff; }
.layout-classic-dark .nav-group-title { background: #020617; }
.layout-dark .main { background: transparent; }
.layout-dark .topbar { background: transparent; box-shadow: none; border: 0; }
.layout-dark .card,
.layout-dark .stat,
.layout-dark .table-card,
.layout-dark .ticket-identity-card,
.layout-dark .email-summary-card,
.layout-dark .auth-card,
.layout-dark .comment,
.layout-dark .checklist-box,
.layout-dark .mail-preview,
.layout-dark .member-edit-box,
.layout-dark .rights-panel,
.layout-dark .retro-box,
.layout-dark .milestone-row,
.layout-dark .week-focus-day,
.layout-dark .media-tile,
.layout-dark .mini-project,
.layout-dark .chip,
.layout-dark .list-row,
.layout-dark .mail-subject-box,
.layout-dark .confirm-dialog {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
    box-shadow: var(--shadow);
}
.layout-dark .list-row:hover,
.layout-dark .mini-project:hover,
.layout-dark .media-tile:hover,
.layout-dark .status-soft-row:hover td {
    background: #172033;
}
.layout-dark input,
.layout-dark select,
.layout-dark textarea,
.layout-dark .rich-editor,
.layout-dark .editor-toolbar button,
.layout-dark .check-button {
    background: #0f172a;
    border-color: var(--line);
    color: var(--text);
}
.layout-dark input::placeholder,
.layout-dark textarea::placeholder { color: #64748b; }
.layout-dark .editor-toolbar,
.layout-dark .calendar-head,
.layout-dark .calendar-day.empty,
.layout-dark .permission-pills span,
.layout-dark .progress,
.layout-dark .mail-preview-iframe {
    background: #0f172a;
    border-color: var(--line);
    color: var(--muted);
}
.layout-dark .calendar-grid,
.layout-dark .mini-calendar-grid,
.layout-dark .week-focus-grid,
.layout-dark table th,
.layout-dark table td { border-color: var(--line); }
.layout-dark .calendar-day,
.layout-dark .mini-calendar-grid .calendar-day { background: #111827; }
.layout-dark .calendar-day.today,
.layout-dark .week-focus-day.today { background: rgba(96,165,250,.12); }
.layout-dark .calendar-ticket,
.layout-dark .calendar-ticket-v3,
.layout-dark .project-pill { color: #0f172a; }
.layout-dark .calendar-ticket-v3 .ticket-line { color: #0f172a; }
.layout-dark .calendar-timeline-row { background: linear-gradient(90deg, rgba(30,41,59,.92), rgba(15,23,42,.98)); border-color: var(--line); }
.layout-dark .calendar-timeline-row:hover { background: #172033; }
.layout-dark .calendar-timeline-track { background: repeating-linear-gradient(90deg,#0f172a 0,#0f172a 8.333%,#111827 8.333%,#111827 16.666%); border-color: var(--line); }
.layout-dark .danger-soft { background: rgba(251,113,133,.09); }
.layout-dark .alert { background: #111827; border-color: var(--line); color: var(--text); }
.layout-dark .alert-success { background: rgba(16,185,129,.12); border-color: rgba(52,211,153,.45); }
.layout-dark .alert-error { background: rgba(251,113,133,.12); border-color: rgba(251,113,133,.45); }
.layout-dark .alert-info { background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.45); }
.layout-dark .btn-secondary { background: #1e293b; color: #e5edf8; border: 1px solid #334155; }
.layout-dark .btn-secondary:hover { background: #273244; }
.layout-dark .badge { background: #1e293b; color: #dbeafe; border-color: #334155; }
.layout-dark .badge.good { background: rgba(16,185,129,.14); color: #86efac; border-color: rgba(52,211,153,.42); }
.layout-dark .badge.danger { background: rgba(251,113,133,.14); color: #fecdd3; border-color: rgba(251,113,133,.42); }
.layout-dark .badge.warn { background: rgba(251,191,36,.14); color: #fde68a; border-color: rgba(251,191,36,.42); }
.layout-dark .prose { color: #cbd5e1; }
.layout-dark .code { background: #020617; color: #dbeafe; border: 1px solid var(--line); }
.layout-dark .matrix-table th:first-child { background: #111827; }
.layout-dark a:not(.btn):not(.calendar-ticket-v3):not(.project-pill):not(.list-row):not(.mini-project):not(.media-tile):not(.calendar-timeline-row) { color: #93c5fd; }
.layout-dark .impersonation-banner { background: rgba(251,146,60,.12); border-color: rgba(251,146,60,.42); color: #fed7aa; }
.layout-dark .impersonation-banner span { color: #fdba74; }
.layout-dark .confirm-overlay { background: rgba(2,6,23,.68); }

/* Moderner animierter Dark-Mode */
.layout-modern-dark {
    --modern-a: #818cf8;
    --modern-b: #22d3ee;
    --modern-c: #111827;
    background:
        radial-gradient(circle at 8% 0%, rgba(129,140,248,.22), transparent 36%),
        radial-gradient(circle at 92% 4%, rgba(34,211,238,.18), transparent 30%),
        radial-gradient(circle at 50% 100%, rgba(14,165,233,.10), transparent 42%),
        #020617;
}
.layout-modern-dark .sidebar {
    background: linear-gradient(180deg, rgba(2,6,23,.98), rgba(15,23,42,.96) 48%, rgba(30,27,75,.96));
    border-right: 1px solid rgba(148,163,184,.14);
    box-shadow: 20px 0 55px rgba(0,0,0,.35);
}
.layout-modern-dark .nav-group-title { background: transparent; color: #94a3b8; }
.layout-modern-dark .brand-mark,
.layout-modern-dark .btn:not(.btn-secondary):not(.btn-danger) {
    background: linear-gradient(135deg, var(--modern-a), var(--modern-b));
    color: #020617;
    box-shadow: 0 12px 34px rgba(34,211,238,.22);
}
.layout-modern-dark .card,
.layout-modern-dark .stat,
.layout-modern-dark .ticket-identity-card,
.layout-modern-dark .email-summary-card {
    background: rgba(15,23,42,.78);
    border-color: rgba(148,163,184,.18);
    backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 0 18px 48px rgba(0,0,0,.30);
}
.layout-modern-dark .stats-grid .stat:nth-child(odd),
.layout-modern-dark .stats-grid .stat:nth-child(even) {
    background: linear-gradient(180deg, rgba(30,41,59,.78), rgba(15,23,42,.78));
}
.layout-modern-dark .topbar { background: transparent !important; box-shadow: none !important; border: 0 !important; backdrop-filter: none !important; }
.layout-modern-dark .nav a:hover { background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.22); }
.layout-modern-dark .linked-stats .stat:hover,
.layout-modern-dark .list-row:hover,
.layout-modern-dark .mini-project:hover,
.layout-modern-dark .calendar-event:hover,
.layout-modern-dark .media-tile:hover {
    box-shadow: 0 20px 45px rgba(34,211,238,.12);
}
.layout-modern-dark .btn-secondary { background: rgba(15,23,42,.82); color: #dbeafe; border: 1px solid rgba(148,163,184,.25); }
.layout-modern-dark .btn-danger { color: #fff; }
.layout-modern-dark .day-link,
.layout-modern-dark .week-link,
.layout-modern-dark .month-link { color: #cbd5e1; }
.layout-modern-dark .day-link:hover,
.layout-modern-dark .week-link:hover,
.layout-modern-dark .month-link:hover { background: rgba(96,165,250,.14); }

@media (max-width: 760px) {
    .main { padding: 18px; }
    .page { gap: var(--space-4); }
    .card { padding: 15px; }
    .actions-inline { align-items: stretch; }
    .actions-inline .btn { flex: 1 1 auto; }
}
