/* ═══════════════════════════════════════
   TeamHub · Theater Meißen · main.css
   ═══════════════════════════════════════ */
:root {
  --bg:       #0d0f14;
  --surface:  #151820;
  --surface2: #1c2030;
  --surface3: #222638;
  --border:   rgba(255,255,255,0.07);
  --gold:     #c9a84c;
  --gold-dim: rgba(201,168,76,0.15);
  --red:      #e05c5c;
  --green:    #4fcf8a;
  --blue:     #5ca8e0;
  --purple:   #9b7ee8;
  --text:     #e8eaf0;
  --muted:    rgba(232,234,240,0.45);
  --r:        12px;
  --r-sm:     8px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }
a { text-decoration: none; color: inherit; }
input, textarea, select, button { font-family: inherit; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

/* ── SHELL ── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width: 250px; min-width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; position: relative;
}
.sidebar::before {
  content: ''; position: absolute; top: -80px; left: -80px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(201,168,76,0.2) 0%, transparent 70%);
  pointer-events: none;
}
.brand { padding: 24px 20px 20px; border-bottom: 1px solid var(--border); }
.brand-sub { font-size: 9px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--gold); font-weight: 500; margin-bottom: 4px; }
.brand-name { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; }
.brand-dot { color: var(--gold); }

.sidenav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-section { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); padding: 14px 10px 5px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--muted); cursor: pointer;
  transition: all .18s; position: relative; margin-bottom: 1px;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--gold-dim); color: var(--gold); font-weight: 500; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 22%; bottom: 22%;
  width: 3px; background: var(--gold); border-radius: 0 3px 3px 0;
}
.ni { font-size: 15px; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 20px; min-width: 18px; text-align: center;
}
.dept-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--muted); cursor: pointer;
  transition: all .18s; margin-bottom: 1px;
}
.dept-pill:hover { background: var(--surface2); color: var(--text); }
.dept-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.av {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #0d0f14; flex-shrink: 0;
}
.av-info { flex: 1; overflow: hidden; }
.av-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-role { font-size: 11px; color: var(--muted); }

/* ── MAIN ── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── TOPBAR ── */
.topbar {
  padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
}
.topbar-title { font-size: 17px; font-weight: 600; }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── BUTTONS ── */
.btn {
  padding: 8px 16px; border-radius: var(--r-sm); font-size: 13px;
  font-weight: 500; cursor: pointer; border: none; transition: all .18s; line-height: 1;
}
.btn-primary { background: var(--gold); color: #0d0f14; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface3); }
.btn-danger { background: rgba(224,92,92,0.2); color: var(--red); border: 1px solid rgba(224,92,92,0.3); }
.btn-danger:hover { background: rgba(224,92,92,0.35); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; color: var(--muted);
  transition: all .15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface3); }

/* ── CONTENT AREA ── */
.content-area { flex: 1; overflow-y: auto; padding: 28px; }
.content-area.no-pad { padding: 0; }

/* ── CARDS ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px 13px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-action { font-size: 12px; color: var(--gold); cursor: pointer; }
.card-body { padding: 20px; }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; letter-spacing: .3px; }
.form-control {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 13px; color: var(--text);
  font-size: 13.5px; outline: none; transition: border .2s;
}
.form-control:focus { border-color: rgba(201,168,76,0.5); }
.form-control option { background: var(--surface2); }
textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-row { display: grid; gap: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── GRID / STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px; position: relative; overflow: hidden;
}
.stat-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.stat-card.c-gold::after { background: var(--gold); }
.stat-card.c-green::after { background: var(--green); }
.stat-card.c-blue::after { background: var(--blue); }
.stat-card.c-purple::after { background: var(--purple); }
.stat-label { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 30px; font-family: 'Playfair Display', serif; font-weight: 700; }
.stat-value.c-gold { color: var(--gold); }
.stat-value.c-green { color: var(--green); }
.stat-value.c-blue { color: var(--blue); }
.stat-value.c-purple { color: var(--purple); }
.stat-change { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* ── BADGES ── */
.badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; white-space: nowrap; display: inline-block; }
.badge-active  { background: rgba(79,207,138,.15); color: var(--green); }
.badge-review  { background: rgba(201,168,76,.15); color: var(--gold); }
.badge-planned { background: rgba(92,168,224,.15); color: var(--blue); }
.badge-blocked { background: rgba(224,92,92,.15); color: var(--red); }
.badge-done    { background: rgba(255,255,255,.07); color: var(--muted); }

/* ── DEPT BADGE ── */
.dept-badge { padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 500; display: inline-block; }
.dept-Marketing     { background: rgba(201,168,76,.15); color: var(--gold); }
.dept-Verwaltung    { background: rgba(92,168,224,.15); color: var(--blue); }
.dept-Technik       { background: rgba(79,207,138,.15); color: var(--green); }
.dept-Kartenservice { background: rgba(155,126,232,.15); color: var(--purple); }

/* ── PROGRESS ── */
.progress-bar-wrap { height: 4px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-bar-fill { height: 100%; border-radius: 99px; transition: width .4s; }

/* ── TABLE ── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .15s; cursor: pointer; }
.table tbody tr:hover { background: var(--surface2); }

/* ── ALERT ── */
.alert { padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px; }
.alert-success { background: rgba(79,207,138,.1); border: 1px solid rgba(79,207,138,.3); color: var(--green); }
.alert-error   { background: rgba(224,92,92,.1); border: 1px solid rgba(224,92,92,.3); color: var(--red); }

/* ── MESSAGES LAYOUT ── */
.messages-shell { display: flex; height: 100%; overflow: hidden; }
.conv-panel { width: 270px; min-width: 270px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.conv-panel-header { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.conv-panel-title { font-size: 14px; font-weight: 600; }
.tab-row { display: flex; gap: 2px; padding: 8px 8px; border-bottom: 1px solid var(--border); }
.tab-btn { flex: 1; padding: 5px 6px; border-radius: 7px; font-size: 11.5px; font-weight: 500; color: var(--muted); background: none; border: none; cursor: pointer; transition: all .15s; text-align: center; }
.tab-btn:hover { color: var(--text); background: var(--surface2); }
.tab-btn.active { color: var(--gold); background: var(--gold-dim); }
.search-bar { margin: 8px 12px; display: flex; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px; font-size: 12.5px; color: var(--muted); }
.conv-list { flex: 1; overflow-y: auto; }
.conv-section { font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); padding: 10px 16px 4px; font-weight: 600; }
.conv-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; transition: background .15s; position: relative; }
.conv-item:hover { background: var(--surface2); }
.conv-item.active { background: var(--gold-dim); }
.conv-item.active::before { content: ''; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px; background: var(--gold); border-radius: 0 3px 3px 0; }
.conv-av { position: relative; flex-shrink: 0; }
.online-dot, .offline-dot { position: absolute; bottom: 0; right: 0; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--surface); }
.online-dot { background: var(--green); }
.offline-dot { background: var(--muted); }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.conv-time { font-size: 10.5px; color: var(--muted); }
.unread-badge { background: var(--gold); color: #0d0f14; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; min-width: 18px; text-align: center; }
.group-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

/* Chat panel */
.chat-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { padding: 13px 20px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.chat-header-info { flex: 1; }
.chat-name { font-size: 15px; font-weight: 600; }
.chat-status { font-size: 12px; color: var(--green); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.chat-status .blink { width: 6px; height: 6px; border-radius: 50%; background: var(--green); display: inline-block; animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.messages-area { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 3px; }
.date-sep { text-align: center; font-size: 11px; color: var(--muted); margin: 10px 0; position: relative; }
.date-sep::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.date-sep span { background: var(--bg); padding: 0 12px; position: relative; }
.msg-row { display: flex; align-items: flex-end; gap: 9px; margin-bottom: 2px; }
.msg-row.own { flex-direction: row-reverse; }
.msg-av-sm { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #0d0f14; flex-shrink: 0; }
.msg-av-sm.ghost { opacity: 0; }
.msg-bubble { max-width: 440px; padding: 9px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.msg-bubble.other { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-bubble.own { background: linear-gradient(135deg,rgba(201,168,76,.22),rgba(201,168,76,.12)); border: 1px solid rgba(201,168,76,.28); border-bottom-right-radius: 4px; }
.msg-sender { font-size: 10px; font-weight: 600; color: var(--gold); margin-bottom: 3px; }
.msg-time { font-size: 10px; color: var(--muted); margin-top: 4px; }
.msg-time.right { text-align: right; }
.msg-read { color: var(--blue); }
.system-msg { text-align: center; font-size: 11.5px; color: var(--muted); padding: 5px 14px; background: var(--surface2); border-radius: 20px; margin: 6px auto; width: fit-content; border: 1px solid var(--border); }
.msg-attachment { display: flex; align-items: center; gap: 9px; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; margin-top: 5px; cursor: pointer; transition: background .15s; }
.msg-attachment:hover { background: var(--surface3); }
.attach-icon { font-size: 20px; }
.attach-name { font-size: 12.5px; font-weight: 500; }
.attach-size { font-size: 11px; color: var(--muted); }
.typing-row { display: flex; align-items: center; gap: 9px; padding: 4px 0 2px 35px; }
.typing-dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: tdot 1.2s infinite; margin-right: 2px; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes tdot { 0%,80%,100%{transform:scale(1);opacity:.4} 40%{transform:scale(1.3);opacity:1} }
.chat-input-area { padding: 12px 20px 16px; background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0; }
.input-toolbar { display: flex; gap: 5px; margin-bottom: 8px; }
.tool-btn { padding: 4px 10px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--border); color: var(--muted); font-size: 12px; cursor: pointer; transition: all .15s; }
.tool-btn:hover { color: var(--text); background: var(--surface3); }
.input-row { display: flex; gap: 9px; align-items: flex-end; }
.input-box { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 11px; padding: 10px 14px; font-size: 13.5px; color: var(--text); resize: none; line-height: 1.5; min-height: 42px; max-height: 120px; outline: none; transition: border .2s; }
.input-box:focus { border-color: rgba(201,168,76,.4); }
.input-box::placeholder { color: var(--muted); }
.send-btn { width: 40px; height: 40px; border-radius: 10px; background: var(--gold); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: all .2s; flex-shrink: 0; }
.send-btn:hover { filter: brightness(1.12); transform: scale(1.05); }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 10px; }
.chat-empty .big-icon { font-size: 48px; opacity: .3; }

/* Mail */
.mail-shell { display: flex; height: 100%; overflow: hidden; }
.mail-list-panel { width: 320px; min-width: 320px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.mail-item { padding: 13px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.mail-item:hover { background: var(--surface2); }
.mail-item.active { background: var(--gold-dim); border-left: 3px solid var(--gold); }
.mail-item.unread .mail-item-subject { font-weight: 600; color: var(--text); }
.mail-item-from { font-size: 12px; font-weight: 500; margin-bottom: 3px; }
.mail-item-subject { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item-date { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.mail-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.mail-view-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.mail-view-subject { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.mail-view-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; }
.mail-view-body { flex: 1; overflow-y: auto; padding: 24px; font-size: 14px; line-height: 1.7; }
.mail-compose { background: var(--surface); border-top: 1px solid var(--border); padding: 16px 20px; }

/* Kanban */
.kanban-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 20px; overflow-x: auto; }
.kanban-col { background: var(--surface2); border-radius: var(--r); padding: 14px; min-height: 300px; }
.kanban-col-title { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.kanban-count { background: var(--surface); padding: 1px 7px; border-radius: 20px; font-size: 10px; }
.kanban-task { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 11px 13px; margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.kanban-task:hover { border-color: rgba(201,168,76,.4); }
.kanban-task-title { font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.add-task-btn { width: 100%; padding: 8px; border-radius: 8px; background: var(--surface); border: 1px dashed var(--border); color: var(--muted); font-size: 12.5px; cursor: pointer; transition: all .15s; margin-top: 6px; }
.add-task-btn:hover { color: var(--gold); border-color: rgba(201,168,76,.4); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 36px; position: relative; overflow: hidden; }
.login-box::before { content: ''; position: absolute; top: -60px; left: -60px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(201,168,76,.2) 0%, transparent 70%); pointer-events: none; }
.login-logo { font-family: 'Playfair Display', serif; font-size: 24px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 28px; letter-spacing: .5px; }

/* Responsive */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .sidebar { width: 200px; min-width: 200px; }
}

/* MOBILE RESPONSIVE - TeamHub */
.hamburger{display:none;background:none;border:none;color:var(--text);font-size:22px;cursor:pointer;padding:6px;border-radius:8px;flex-shrink:0;}
.sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:99;}
.sidebar-overlay.active{display:block;}
.msg-delete-btn{display:none;background:rgba(224,92,92,.15);border:1px solid rgba(224,92,92,.3);color:#e05c5c;border-radius:6px;padding:2px 7px;font-size:11px;cursor:pointer;flex-shrink:0;align-self:flex-end;margin-bottom:4px;}
.msg-row:hover .msg-delete-btn{display:block;}
@media(max-width:768px){
  .hamburger{display:flex;align-items:center;justify-content:center;}
  .sidebar{position:fixed;left:-260px;top:0;bottom:0;z-index:100;width:260px!important;min-width:260px!important;transition:left .25s;box-shadow:4px 0 24px rgba(0,0,0,.4);}
  .sidebar.open{left:0;}
  .topbar{padding:10px 14px;gap:8px;}
  .topbar-sub{display:none;}
  .stats-grid{grid-template-columns:repeat(2,1fr);gap:10px;}
  .stat-value{font-size:22px;}
  .content-area{padding:12px;}
  .table thead{display:none;}
  .table tr{display:flex;flex-direction:column;background:var(--surface2);border-radius:10px;margin-bottom:10px;padding:12px;border:1px solid var(--border);}
  .table td{border:none;padding:3px 0;font-size:13px;}
  .messages-shell{flex-direction:column;height:calc(100vh - 48px);}
  .conv-panel{width:100%!important;min-width:unset!important;border-right:none;display:none;height:100%;}
  .conv-panel.mobile-show{display:flex;}
  .mail-shell{flex-direction:column;}
  .mail-list-panel{width:100%!important;min-width:unset!important;max-height:44vh;border-right:none;border-bottom:1px solid var(--border);}
  .kanban-board{grid-template-columns:1fr;padding:12px;}
  .form-row.cols-2,.form-row.cols-3{grid-template-columns:1fr;}
  .msg-bubble{max-width:85vw;}
  .msg-delete-btn{display:block!important;}
}


/* ── MOBILE FIX ── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: -260px; top: 0; bottom: 0;
    z-index: 100; width: 260px !important; min-width: 260px !important;
    transition: left .25s; box-shadow: 4px 0 24px rgba(0,0,0,.4);
  }
  .sidebar.open { left: 0; }
  .hamburger { display: flex !important; align-items: center; justify-content: center; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar-sub { display: none; }
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .content-area { padding: 12px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }

  /* Messages - wichtig: volle Höhe */
  .messages-shell {
    display: flex !important;
    flex-direction: row !important;
    height: calc(100vh - 48px) !important;
  }
  .conv-panel {
    position: fixed !important;
    left: -100% !important;
    top: 0; bottom: 0;
    width: 100% !important;
    min-width: unset !important;
    z-index: 50;
    transition: left .25s;
    background: var(--surface);
  }
  .conv-panel.mobile-show {
    left: 0 !important;
  }
  .chat-panel {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
  }
  .messages-area {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
  }
  .chat-input-area { flex-shrink: 0; }
  .msg-bubble { max-width: 80vw; }

  /* Mail */
  .mail-shell { flex-direction: column; }
  .mail-list-panel { width: 100% !important; min-width: unset !important; max-height: 40vh; border-right: none; border-bottom: 1px solid var(--border); }

  /* Kanban */
  .kanban-board { grid-template-columns: 1fr; }
}

/* ── MOBILE FULLSCREEN ── */
@media (max-width: 768px) {

  /* App Shell */
  body { overflow: hidden; }
  .app-shell { flex-direction: column; height: 100dvh; }

  /* Sidebar als Drawer */
  .sidebar {
    position: fixed; left: -100%; top: 0; bottom: 0;
    z-index: 200; width: 85% !important; min-width: unset !important;
    transition: left .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 32px rgba(0,0,0,.6);
  }
  .sidebar.open { left: 0 !important; }
  .sidebar-overlay { z-index: 199; }
  .hamburger { display: flex !important; align-items: center; justify-content: center; width: 40px; height: 40px; font-size: 20px; }

  /* Main Content */
  .main-content { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; }

  /* Topbar */
  .topbar { padding: 12px 14px; gap: 10px; min-height: 52px; flex-shrink: 0; }
  .topbar-title { font-size: 16px; }
  .topbar-sub { display: none; }
  .topbar-actions { gap: 8px; }
  .topbar-actions .btn { padding: 9px 12px; font-size: 13px; }

  /* Content */
  .content-area { padding: 14px; overflow-y: auto; flex: 1; }
  .stats-grid { grid-template-columns: repeat(2,1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 28px; }
  .stat-label { font-size: 10px; }

  /* Forms */
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .form-control { padding: 12px 14px; font-size: 15px; }
  .btn { padding: 11px 18px; font-size: 14px; }

  /* ── MESSAGES FULLSCREEN ── */
  .messages-shell {
    flex-direction: column !important;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
  }

  /* Conv Panel - Fullscreen */
  .conv-panel {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    min-width: unset !important;
    z-index: 10;
    border-right: none !important;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    display: flex !important;
  }
  .conv-panel.mobile-show {
    transform: translateX(0) !important;
  }

  /* Chat Panel - Fullscreen */
  .chat-panel {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 9;
  }

  /* Back Bar */
  #mobile-back-bar {
    padding: 14px 16px !important;
    font-size: 15px !important;
    min-height: 50px;
    flex-shrink: 0;
  }

  /* Chat Header */
  .chat-header { padding: 12px 16px; flex-shrink: 0; }
  .chat-name { font-size: 16px; }

  /* Messages Area */
  .messages-area {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 14px 12px !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Bubbles */
  .msg-bubble { max-width: 78vw; font-size: 15px; padding: 10px 14px; }
  .msg-av-sm { width: 30px !important; height: 30px !important; font-size: 11px !important; }

  /* Input Area */
  .chat-input-area { padding: 10px 12px 16px; flex-shrink: 0; }
  .input-toolbar { gap: 6px; margin-bottom: 8px; }
  .tool-btn { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
  .input-box { font-size: 16px; padding: 12px 14px; border-radius: 14px; }
  .send-btn { width: 46px; height: 46px; font-size: 18px; border-radius: 12px; flex-shrink: 0; }

  /* Conv List Items */
  .conv-item { padding: 14px 16px; }
  .conv-name { font-size: 15px; }
  .conv-preview { font-size: 13px; }
  .av { width: 42px !important; height: 42px !important; font-size: 14px !important; }
  .group-icon { width: 42px !important; height: 42px !important; font-size: 20px !important; }
  .tab-btn { padding: 9px 8px; font-size: 13px; }
  .conv-section { padding: 12px 16px 6px; font-size: 10px; }

  /* ── MAIL FULLSCREEN ── */
  .mail-shell { flex-direction: column; flex: 1; min-height: 0; }
  .mail-list-panel {
    width: 100% !important; min-width: unset !important;
    max-height: 42vh; border-right: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .mail-view { flex: 1; min-height: 0; overflow-y: auto; }
  .mail-item { padding: 14px 16px; }
  .mail-item-subject { font-size: 14px; }
  .mail-view-body { padding: 16px; }

  /* Kanban */
  .kanban-board { grid-template-columns: 1fr; padding: 14px; gap: 14px; }

  /* Table → Cards */
  .table thead { display: none; }
  .table tr { display: flex; flex-direction: column; background: var(--surface2); border-radius: 12px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--border); }
  .table td { border: none; padding: 4px 0; font-size: 14px; }
}

/* ── MOBILE INPUT + BACK FIX ── */
@media (max-width: 768px) {
  #chat-input-area {
    position: sticky !important;
    bottom: 0 !important;
    background: var(--surface) !important;
    z-index: 20 !important;
    padding-bottom: env(safe-area-inset-bottom, 16px) !important;
  }
  #mobile-back-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    background: var(--surface) !important;
    display: flex !important;
  }
  .chat-panel {
    overflow-y: auto !important;
  }
  .messages-area {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 200px !important;
    padding-bottom: 10px !important;
  }
}
