:root{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --border:#e7e9f1;
  --text:#111827;
  --muted:#6b7280;
  --shadow:0 6px 18px rgba(17,24,39,.06), 0 1px 2px rgba(17,24,39,.06);

  --accent:#8bc34a;        /* HV green */
  --accent2:#a6d96a;
  --accent-soft:#eef7df;

  --btn-dark:#3f3f46;
  --btn-dark-hover:#2f2f35;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  color:var(--text);
  background:var(--bg);
}
a{color:inherit;text-decoration:none}
a:hover{text-decoration:underline}

.app-shell{display:flex;min-height:100vh}
.sidebar{
  width:320px;
  flex-shrink:0;
  background:var(--panel);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
}
.sb-top{padding:16px 16px 10px}
.logo{
  display:flex;align-items:center;gap:10px;
  font-weight:900;letter-spacing:.02em;
}
.logo-badge{
  width:38px;height:38px;border-radius:12px;
  border:1px solid var(--border);
  display:grid;place-items:center;
  box-shadow:0 1px 2px rgba(0,0,0,.04);
  background:#fff;
}
.logo small{display:block;color:var(--muted);font-weight:700;margin-top:2px;letter-spacing:0}
.sb-dd{
  margin-top:14px;
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
}
.sb-dd form{display:flex;gap:8px;align-items:center}
.sb-dd select{
  flex:1;min-width:0;border:0;background:transparent;outline:none;
  font-weight:800;color:#111827;
  text-overflow:ellipsis;white-space:nowrap;overflow:hidden;
}

.sb-nav{padding:6px 10px;display:flex;flex-direction:column;gap:6px}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;
  border-radius:12px;
  color:#111827;
  font-weight:800;
  font-size:14px;
}
.nav-item svg{width:18px;height:18px;color:#6b7280}
.nav-item:hover{background:#f3f4f6;text-decoration:none}
.nav-item.active{
  background:linear-gradient(90deg,var(--accent) 0%, var(--accent2) 100%);
  color:#fff;
  box-shadow:0 6px 16px rgba(139,195,74,.25);
}
.nav-item.active svg{color:#fff}
.badge{
  margin-left:auto;
  display:inline-flex;align-items:center;justify-content:center;
  min-width:22px;height:18px;
  padding:0 6px;border-radius:999px;
  font-size:12px;font-weight:900;
  border:1px solid rgba(0,0,0,.06);
  background:#fff;
  color:#111827;
}
.badge.green{
  background:rgba(139,195,74,.15);
  color:#2f5b12;
  border-color:rgba(139,195,74,.35);
}

.sb-bottom{
  margin-top:auto;
  padding:14px 16px;
  border-top:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;gap:10px;
}
.userchip{
  display:flex;align-items:center;gap:10px;
  background:#f8fafc;border:1px solid var(--border);
  padding:10px 12px;border-radius:14px;flex:1;
}
.avatar{
  width:34px;height:34px;border-radius:999px;
  background:rgba(139,195,74,.25);
  display:grid;place-items:center;
  font-weight:900;color:#2f5b12;
}
.userchip .meta{line-height:1.1}
.userchip .meta b{display:block;font-size:13px}
.userchip .meta span{display:block;font-size:12px;color:var(--muted);font-weight:800}
.iconbtn{
  width:40px;height:40px;border-radius:12px;
  border:1px solid var(--border);
  background:#fff;cursor:pointer;
  display:grid;place-items:center;
}
.iconbtn:hover{background:#f3f4f6}

.main{flex:1;display:flex;flex-direction:column}
.topbar{
  height:64px;
  display:flex;align-items:center;justify-content:flex-end;
  padding:0 24px;
}
.pill{
  display:inline-flex;align-items:center;gap:8px;
  border:1px solid var(--border);
  background:#fff;
  padding:10px 12px;border-radius:12px;
  font-weight:900;font-size:13px;color:#111827;
}
.pill svg{width:16px;height:16px;color:#6b7280}

.container{max-width:1200px;margin:0 auto;padding:0 24px 24px}
.page-title{margin:6px 0 6px;font-size:28px;font-weight:800;letter-spacing:-.02em}
.page-sub{margin:0 0 14px;color:var(--muted);font-weight:800;font-size:13px}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
}
.card .hd{padding:16px 18px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;gap:12px}
.card .bd{padding:16px 18px}

.grid{display:grid;gap:14px}
.grid2{grid-template-columns:1fr 1fr}
.grid3{grid-template-columns:1fr 1fr 1fr}
.grid4{grid-template-columns:repeat(4, minmax(0,1fr))}
@media(max-width:1100px){.grid4{grid-template-columns:1fr 1fr}}
@media(max-width:900px){
  .sidebar{display:none}
  .container{padding:0 14px 14px}
  .topbar{padding:0 14px}
  .grid2,.grid3,.grid4{grid-template-columns:1fr}
}

.muted{color:var(--muted);font-size:13px;font-weight:800}
.small{font-size:12px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.hr{height:1px;background:var(--border);margin:12px 0}

.inp,.sel,.ta{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:11px 12px;
  font-size:14px;
  background:#fff;
  outline:none;
}
.ta{min-height:110px;resize:vertical}

.btn{
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  font-weight:900;
  font-size:14px;
  cursor:pointer;
  display:inline-flex;align-items:center;gap:8px;
}
.btn:hover{background:#f3f4f6}
.btn.dark{
  background:var(--btn-dark);
  border-color:var(--btn-dark);
  color:#fff;
}
.btn.dark:hover{background:var(--btn-dark-hover)}
.btn.green-outline{
  border-color:rgba(139,195,74,.55);
  background:#fff;
  color:#2f5b12;
}
.btn.green-outline:hover{background:var(--accent-soft)}

.table{width:100%;border-collapse:collapse}
.table th,.table td{padding:12px 10px;border-bottom:1px solid var(--border);text-align:left;font-size:14px}
.table th{color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.02em}

.flash{
  padding:12px 14px;border-radius:14px;border:1px solid var(--border);background:#fff;
}
.flash.ok{border-color:rgba(34,197,94,.35);background:#f0fdf4}
.flash.err{border-color:rgba(239,68,68,.35);background:#fff1f2}

.stat{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:16px 18px;
}
.stat .n{font-size:26px;font-weight:800;letter-spacing:-.02em}
.stat .lbl{color:var(--muted);font-size:13px;font-weight:900}
.iconbubble{
  width:48px;height:48px;border-radius:18px;
  display:grid;place-items:center;
  background:#eef2ff;border:1px solid var(--border);
}
.iconbubble.orange{background:#fff3e8}
.iconbubble.blue{background:#eaf2ff}
.iconbubble.green{background:#eafaf0}
.iconbubble.purple{background:#f2eaff}
.iconbubble svg{width:22px;height:22px;color:#111827}

.listitem{
  display:flex;gap:14px;align-items:flex-start;
  padding:16px 18px;
}
.listitem:hover{background:#fbfbfd}
.listitem + .listitem{border-top:1px solid var(--border)}
.li-title{font-weight:800}
.li-sub{margin-top:4px;color:var(--muted);font-size:13px;font-weight:800}
.pills{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:10px}
.pilltag{
  font-size:12px;font-weight:900;
  padding:4px 10px;border-radius:999px;
  border:1px solid var(--border);background:#fff;color:#111827;
}
.pilltag.green{background:rgba(139,195,74,.15);border-color:rgba(139,195,74,.35);color:#2f5b12}
.pilltag.gray{background:#f3f4f6}

/* --- Tasks UI (Base44-like) --- */
.toolbar{
  display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;
  margin:10px 0 14px;
}
.searchbar{
  display:flex;gap:10px;align-items:center;flex:1;
  background:#fff;border:1px solid var(--border);border-radius:14px;
  padding:10px 12px;
  box-shadow:0 1px 2px rgba(17,24,39,.04);
  min-width:260px;
}
.searchbar input{
  border:0;outline:none;background:transparent;width:100%;
  font-weight:900;font-size:14px;color:#111827;
}
.searchbar svg{width:18px;height:18px;color:#6b7280}
.tabs{
  display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  background:#fff;border:1px solid var(--border);border-radius:14px;padding:6px;
  box-shadow:0 1px 2px rgba(17,24,39,.04);
}
.tab{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 10px;border-radius:12px;
  font-weight:800;font-size:13px;color:#111827;
  border:1px solid transparent;
}
.tab:hover{background:#f3f4f6;text-decoration:none}
.tab.active{
  background:rgba(139,195,74,.18);
  border-color:rgba(139,195,74,.35);
  color:#2f5b12;
}
.tab .count{
  min-width:18px;height:18px;border-radius:999px;
  display:inline-flex;align-items:center;justify-content:center;
  font-size:12px;font-weight:800;
  background:#f3f4f6;color:#111827;
}
.tab.active .count{background:#fff;border:1px solid rgba(139,195,74,.25)}
.taskgrid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:14px;
}
@media(max-width:1100px){.taskgrid{grid-template-columns:repeat(2, minmax(0,1fr));}}
@media(max-width:900px){.taskgrid{grid-template-columns:1fr;}}
.taskcard{
  background:#fff;border:1px solid var(--border);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:14px 14px 12px;
  display:flex;flex-direction:column;gap:10px;
}
.taskcard:hover{transform:translateY(-1px);transition:.12s ease; }
.taskcard .top{display:flex;align-items:flex-start;gap:12px}
.taskicon{
  width:44px;height:44px;border-radius:18px;
  background:rgba(139,195,74,.18);
  border:1px solid rgba(139,195,74,.35);
  display:grid;place-items:center;
  flex:0 0 auto;
}
.taskicon svg{width:22px;height:22px;color:#2f5b12}
.tasktitle{font-weight:800;line-height:1.15}
.taskmeta{margin-top:4px;color:var(--muted);font-size:12px;font-weight:900}
.taskdesc{color:#374151;font-size:13px;font-weight:700;line-height:1.35;white-space:pre-wrap}
.taskfooter{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:auto}
.statuspill{
  font-size:12px;font-weight:800;
  padding:4px 10px;border-radius:999px;
  border:1px solid var(--border);
  background:#f3f4f6;color:#111827;
}
.statuspill.open{background:#fff3e8}
.statuspill.work{background:#eaf2ff}
.statuspill.offer{background:#f2eaff}
.statuspill.done{background:#eafaf0}

/* auth */
input.inp:-webkit-autofill,
input.inp:-webkit-autofill:hover,
input.inp:-webkit-autofill:focus{
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px #fff inset;
  transition: background-color 5000s ease-in-out 0s;
}

/* ===== PREMIUM LOGIN ===== */

body {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5f3e8 100%);
}

.premium-card {
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
  border-radius: 22px;
  transition: all .3s ease;
}

.premium-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.12);
}

.premium-logo {
  max-width: 260px;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.15));
  animation: fadeIn 1s ease forwards;
}

.btn.dark {
  transition: all .25s ease;
}

.btn.dark:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.inp:focus {
  border-color: #8bc34a !important;
  box-shadow: 0 0 0 3px rgba(139,195,74,0.25);
}

@keyframes fadeIn {
  from { opacity:0; transform:translateY(-10px); }
  to { opacity:1; transform:translateY(0); }
}


/* ===== LUXURY LOGIN (Apple/Stripe/Notion-ish) ===== */
/* Subtle, high-end white background */
body.lux-login,
.lux-login body {
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(139,195,74,0.10) 0%, rgba(139,195,74,0.0) 55%),
    radial-gradient(900px 500px at 90% 15%, rgba(59,130,246,0.06) 0%, rgba(59,130,246,0.0) 60%),
    #f7f8fb;
}

/* center wrapper */
.lux-wrap{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:56px 20px;
}

/* high-end card */
.lux-card{
  max-width:520px;
  width:100%;
  text-align:center;
  padding:54px 44px 40px;
  background:rgba(255,255,255,0.86);
  border:1px solid rgba(15,23,42,0.08);
  border-radius:26px;
  box-shadow:
    0 30px 80px rgba(2,6,23,0.10),
    0 2px 0 rgba(255,255,255,0.8) inset;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position:relative;
}

/* subtle top highlight */
.lux-card:before{
  content:"";
  position:absolute;
  inset:-1px;
  border-radius:26px;
  pointer-events:none;
  background:linear-gradient(180deg, rgba(255,255,255,0.90), rgba(255,255,255,0.35));
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  -webkit-mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  padding:1px;
  box-sizing:border-box;
  opacity:.45;
}

/* logo */
.lux-logo{
  max-width:280px;
  width:100%;
  height:auto;
  filter: drop-shadow(0 10px 22px rgba(2,6,23,0.14));
}

/* typography tweaks */
.lux-title{
  font-size:30px;
  font-weight:800;
  letter-spacing:-0.02em;
  margin:18px 0 8px;
  color:#0f172a;
}
.lux-sub{
  font-size:14px;
  font-weight:800;
  color:#475569;
  margin:0 0 26px;
}

/* form */
.lux-form{
  text-align:left;
  display:grid;
  gap:16px;
}
.lux-label{
  font-size:12px;
  font-weight:800;
  color:#334155;
  margin-bottom:6px;
}
.lux-input{
  width:100%;
  border-radius:16px;
  padding:12px 14px;
  border:1px solid rgba(15,23,42,0.10);
  background:rgba(255,255,255,0.92);
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset;
  font-weight:850;
}
.lux-input:focus{
  outline:none;
  border-color: rgba(15,23,42,0.22) !important;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.14);
}

/* button (Stripe-ish) */
.lux-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:100%;
  border-radius:18px;
  padding:12px 14px;
  font-weight:800;
  letter-spacing:-0.01em;
  background:#0b1220;
  color:#fff;
  border:1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 26px rgba(2,6,23,0.20);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.lux-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(2,6,23,0.26);
  filter: brightness(1.03);
}
.lux-btn:active{
  transform: translateY(0px);
}

/* footer links */
.lux-link{
  display:inline-block;
  margin-top:18px;
  color:#475569;
  font-weight:900;
  text-decoration:none;
}
.lux-link:hover{
  color:#0f172a;
  text-decoration:underline;
}

.lux-foot{
  margin-top:30px;
  color:#64748b;
  font-size:12px;
  font-weight:850;
}

/* Remove browser autofill yellow */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus{
  -webkit-text-fill-color:#0f172a;
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: 0 0 0px 1000px rgba(255,255,255,0.92) inset !important;
  border:1px solid rgba(15,23,42,0.10);
}


/* Sidebar logo (image) */
.logo.logo-img{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px 6px 12px;
}

/* ULMEO Sprachassistent - Aktivierungs-Button (HV+ Logo + Mikrofon-Grafik,
   assets/img/ulmeo-button.png). Die feste Hoehe + overflow:hidden auf
   .ulmeo-badge-inner schneidet den weissen Rand der Grafik oben/unten ab,
   sodass nur die Pille sichtbar bleibt. Aktiv = gruener Leucht-/Puls-Ring,
   siehe .ulmeo-active/.ulmeo-listening (Logik in app/views/_layout.php). */
.ulmeo-badge{
  display:block;
  width:100%;
  border:none;
  background:none;
  border-radius:999px;
  padding:0;
  cursor:pointer;
  position:relative;
}
.ulmeo-badge-inner{
  width:100%;
  height:84px;
  display:flex;align-items:center;justify-content:center;
  border-radius:999px;
  overflow:hidden;
  transition:box-shadow .15s ease;
}
.ulmeo-icon{
  width:100%;
  height:auto;
  display:block;
}
.ulmeo-badge:hover .ulmeo-badge-inner{
  box-shadow:0 6px 16px rgba(2,6,23,.12);
}
.ulmeo-badge.ulmeo-active .ulmeo-badge-inner{
  box-shadow:0 0 0 3px rgba(139,195,74,.45), 0 6px 16px rgba(2,6,23,.12);
}
.ulmeo-badge.ulmeo-listening::after{
  content:'';
  position:absolute; inset:0;
  border-radius:999px;
  border:2px solid #8bc34a;
  animation:ulmeo-pulse 1.3s ease-out infinite;
}
@keyframes ulmeo-pulse{
  0%{ transform:scale(.96); opacity:.9; }
  100%{ transform:scale(1.12); opacity:0; }
}

.sb-top{ position:relative; }
.ulmeo-panel{
  position:absolute; top:104px; left:0;
  z-index:40;
  width:290px; max-width:calc(100vw - 24px);
  background:#fff; border:1px solid #e5e7eb; border-radius:14px;
  box-shadow:0 14px 32px rgba(15,23,42,.16);
  padding:14px;
}
.ulmeo-panel-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:8px;
  margin-bottom:8px;
}
.ulmeo-panel-head b{ color:#2f5b12; font-size:14px; }
.ulmeo-status{ font-size:11px; color:#6b7280; font-weight:700; }
.ulmeo-answer{
  min-height:18px; font-size:13px; color:#111827; line-height:1.5;
  white-space:pre-wrap;
}


/* Tasks: completed -> visually subdued */
.taskcard.is-done{
  opacity: .72;
  filter: grayscale(.18);
  box-shadow: none !important;
}
.taskcard.is-done:hover{
  opacity: .82;
  filter: grayscale(.08);
}
.taskcard.is-done .tasktitle{ color: #334155; }
.taskcard.is-done .taskmeta{ color: #64748b; }
.taskcard.is-done .pilltag.done{
  opacity:.75;
}


/* Assign users (Dashboards) - premium list */
.assign-row{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:12px 14px;
  border:1px solid rgba(15,23,42,0.08);
  border-radius:16px;
  background:#fff;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.assign-row:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(2,6,23,0.08);
  background: rgba(255,255,255,0.92);
}
.assign-row.is-assigned{
  border-color: rgba(139,195,74,0.28);
  background: rgba(139,195,74,0.06);
}
.assign-row .assign-cb{
  margin-top:3px;
  transform: scale(1.05);
}
.assign-top{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.assign-name{
  font-weight:800;
}
.assign-email{
  margin-top:2px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 100%;
}


/* Compact admin lists (Users/Dashboards) */
.mini-details{
  border:1px solid rgba(15,23,42,0.08);
  border-radius:18px;
  background:#fff;
  overflow:hidden;
}
.mini-details summary{
  list-style:none;
}
.mini-details summary::-webkit-details-marker{ display:none; }
.mini-summary{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 14px;
  cursor:pointer;
  transition: background .12s ease;
}
.mini-summary:hover{
  background: rgba(15,23,42,0.02);
}
.mini-left{ min-width:0; }
.mini-title{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  font-weight:800;
}
.mini-right{
  flex:0 0 auto;
}
.mini-body{
  padding:12px 14px 14px;
  border-top:1px solid rgba(15,23,42,0.06);
  background: rgba(255,255,255,0.9);
}

/* Ticket zusammenfuehren: Live-Suche nach dem Ziel-Ticket */
.merge-picker{
  position:relative;
  max-width:420px;
}
.merge-suggestions{
  position:absolute;
  left:0; right:0; top:calc(100% + 4px);
  z-index:20;
  background:#fff;
  border:1px solid rgba(15,23,42,0.12);
  border-radius:12px;
  box-shadow:0 10px 30px rgba(15,23,42,0.14);
  max-height:260px;
  overflow-y:auto;
  padding:6px;
}
.merge-suggestion{
  display:flex;
  flex-direction:column;
  gap:2px;
  width:100%;
  text-align:left;
  padding:8px 10px;
  border:none;
  background:none;
  border-radius:8px;
  cursor:pointer;
  font:inherit;
  color:inherit;
}
.merge-suggestion:hover{
  background: rgba(15,23,42,0.05);
}
.merge-suggestion-main{
  font-weight:700;
}


/* Tasks: collapse completed in tasks view */
.done-fold{
  border:1px solid rgba(15,23,42,0.08);
  border-radius:18px;
  background:rgba(255,255,255,0.9);
  overflow:hidden;
}
.done-fold summary{ list-style:none; }
.done-fold summary::-webkit-details-marker{ display:none; }
.done-fold-sum{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  cursor:pointer;
  user-select:none;
}
.done-fold-sum:hover{
  background: rgba(15,23,42,0.02);
}
.done-fold-body{
  padding: 12px 14px 14px;
  border-top:1px solid rgba(15,23,42,0.06);
}
.done-fold-arrow{ flex:0 0 auto; color:var(--muted); transition:transform .15s ease; }
.done-fold[open] .done-fold-arrow{ transform:rotate(90deg); }

/* === Fine Luxury Typography v1 === */
:root{
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15,23,42,0.06);
  --border2: rgba(15,23,42,0.08);
  --shadow1: 0 8px 24px rgba(2,6,23,0.05);
  --shadow2: 0 10px 26px rgba(2,6,23,0.08);
}

html, body{
  font-weight: 400;
  letter-spacing: .01em;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,h2,h3,h4,.h1,.h2,.h3,.title{
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Make most "heavy" labels calmer */
strong, b{
  font-weight: 600;
}

.muted, .small.muted{
  color: var(--muted);
}

/* Cards */
.card{
  border: 1px solid var(--border);
  box-shadow: var(--shadow1);
}

/* Details/compact rows */
.mini-details,
.done-fold{
  border: 1px solid var(--border);
}
.mini-summary:hover,
.done-fold-sum:hover{
  background: rgba(15,23,42,0.018);
}

/* Buttons: lighter, cleaner */
.btn{
  font-weight: 500;
  border: 1px solid var(--border2);
  background: #fff;
}
.btn:hover{
  box-shadow: var(--shadow2);
  transform: translateY(-1px);
}
.btn.dark{
  font-weight: 600;
}

/* Inputs */
.inp, .sel, .ta{
  border: 1px solid var(--border2);
}
.inp::placeholder, .ta::placeholder{
  color: rgba(100,116,139,0.9);
}

/* Pills / tags */
.pilltag{
  font-size: 12px;
  font-weight: 500;
  padding: 3px 8px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.03);
}
.pilltag.green{
  background: rgba(139,195,74,0.10);
  border-color: rgba(139,195,74,0.20);
}

/* Tables */
.tbl thead th{
  border-bottom: 1px solid var(--border);
}
.tbl tbody td{
  border-bottom: 1px solid var(--border);
}


/* Reports: subtle done rows */
.row-done{ opacity:.72; }


/* Reports: dashboard grouping row */
.dash-group td{
  background: rgba(15,23,42,0.02);
  border-top: 1px solid rgba(15,23,42,0.06);
  border-bottom: 1px solid rgba(15,23,42,0.06);
}


/* Task status accents (new) */


/* Status badges (Premium, subtle) */
.badge{
  letter-spacing:.02em;
  backdrop-filter:saturate(140%) blur(4px);
  box-shadow: 0 1px 0 rgba(15,23,42,0.06);
}
.badge.open{
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.18);
  color: rgba(30,64,175,0.95);
}
.badge.work{
  background: rgba(245,158,11,0.10);
  border-color: rgba(245,158,11,0.22);
  color: rgba(146,64,14,0.95);
}
.badge.done{
  background: rgba(17,24,39,0.06);
  border-color: rgba(17,24,39,0.12);
  color: rgba(17,24,39,0.62);
}
.row-done{opacity:.72}


/* Comment meta + role icon */
.comment-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.comment-ico{
  width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;
  border-radius:999px;
  font-size:10px;
  border:1px solid rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.9);
}
.comment-ico.user{
  color: rgba(88,28,135,0.95);
  background: rgba(168,85,247,0.10);
  border-color: rgba(168,85,247,0.22);
}
.comment-ico.admin{
  color: rgba(6,95,70,0.95);
  background: rgba(16,185,129,0.10);
  border-color: rgba(16,185,129,0.22);
}
.comment-role{
  margin-left:2px;
  padding:2px 8px;
  border-radius:999px;
  font-size:11px;
  border:1px solid rgba(15,23,42,0.08);
  background: rgba(15,23,42,0.03);
  color: rgba(17,24,39,0.65);
}


/* Posteingang: TOPdesk-artige Ticketuebersicht (Filter-Sidebar + Tabelle + Detail) */
.td-inbox{
  margin-top:4px;
  --td-cyan:#E3F6FB;
  --td-cyan-line:#3EB1CC;
  --td-green:#0DA570;
}

.td-layout{
  display:grid;
  grid-template-columns: 340px 1fr;
  gap:16px;
  align-items:start;
}

/* Einfaches zentriertes Modal (z.B. "Neue Antwort"-Liste) */
.simple-modal-backdrop{
  position:fixed; inset:0;
  background:rgba(15,23,42,.45);
  display:flex; align-items:flex-start; justify-content:center;
  padding:64px 20px;
  z-index:80;
}
.simple-modal-backdrop[hidden]{ display:none; }
.simple-modal{
  background:#fff;
  border-radius:18px;
  box-shadow:0 30px 80px rgba(2,6,23,.28);
  max-width:640px; width:100%;
  max-height:80vh;
  overflow:auto;
  padding:20px 22px;
}
.simple-modal-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin-bottom:14px;
  padding-bottom:12px;
  border-bottom:1px solid var(--border);
}
.new-reply-item{
  display:block;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 14px;
  color:inherit;
}
.new-reply-item:hover{ background:#fbfbfd; text-decoration:none; border-color:rgba(245,158,11,.4); }
.new-reply-top{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:4px; }
.new-reply-subject{ font-weight:800; font-size:14px; }
.new-reply-snippet{ margin-top:2px; color:var(--muted); font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.new-reply-snippet b{ color:#374151; font-weight:800; }

/* Ticket-Tabelle */
.td-table-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  overflow:auto;
  max-height:calc(100vh - 230px);
}
.td-table{ width:100%; border-collapse:collapse; font-size:12px; }
.td-table thead th{
  position:sticky; top:0;
  background:var(--td-cyan);
  color:#0b5566;
  text-align:left;
  font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.03em;
  padding:7px 10px;
  border-bottom:2px solid var(--td-cyan-line);
  z-index:1;
}
.td-col-status{ width:22px; }
.td-col-date{ width:82px; }
.td-table tbody tr.td-row{
  cursor:pointer;
  border-bottom:1px solid var(--border);
  outline:none;
}
.td-table tbody tr.td-row:hover{ background:rgba(62,177,204,0.06); }
.td-table tbody tr.td-row.active{ background:var(--td-cyan); box-shadow:inset 3px 0 0 var(--td-cyan-line); }
.td-table tbody tr.td-row:focus-visible{ box-shadow:inset 0 0 0 2px var(--td-cyan-line); }
.td-table td{ padding:6px 10px; vertical-align:top; }
.td-col-status{ padding-top:10px; }
.td-row-dot{
  display:inline-block;
  width:7px;height:7px;border-radius:999px;
  background:#94a3b8;
}
.td-row-dot.status-open{ background:#3b82f6; }
.td-row-dot.status-work{ background:#f59e0b; }
.td-row-dot.status-done{ background:#94a3b8; }
.td-row-topline{ display:flex; align-items:center; gap:6px; margin-bottom:1px; }
.td-row-no{ font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:10px; font-weight:800; color:var(--muted); }
.td-row-subject{
  font-weight:800; font-size:12px; line-height:1.25;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px;
}
.td-row.active .td-row-subject{ color:#0b5566; }
.td-row-snippet{
  font-size:11px; color:var(--muted); margin-top:1px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px;
}
.td-row-snippet b{ color:#374151; font-weight:800; }
.td-row-snippet .tk-avatar{ width:14px; height:14px; font-size:8px; vertical-align:-3px; margin-right:2px; }
.td-col-date{ color:var(--muted); font-size:10px; font-weight:800; white-space:nowrap; padding-top:8px; }

/* Detailpanel */
.td-detail{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:20px 22px;
  position:sticky;
  top:14px;
  max-height:calc(100vh - 230px);
  overflow-y:auto;
}
.td-panel-head{
  display:flex; justify-content:space-between; align-items:flex-start; gap:12px;
  flex-wrap:wrap;
  padding-bottom:14px;
  border-bottom:1px solid var(--border);
}
.td-panel-no{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12px; font-weight:800; color:var(--td-cyan-line);
  margin-bottom:2px;
}
.td-panel-title{ margin:0; font-size:15px; font-weight:800; letter-spacing:-.01em; }
.td-panel-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}
.td-delete-form{ margin:0; }
.td-delete-btn{
  color:#b91c1c;
  border-color:rgba(185,28,28,0.25);
}
.td-delete-btn:hover{
  background:rgba(185,28,28,0.08);
  border-color:rgba(185,28,28,0.4);
}
.td-delete-btn svg{ display:block; }

.td-thread{
  margin-top:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.td-msg{
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px 14px;
  font-size:14px;
  line-height:1.5;
  max-width:92%;
}
.td-msg-in{
  background:#eef2f7;
  border-color:#ccd6e3;
  margin-right:auto;
}
.td-msg-out{
  background:var(--td-cyan);
  border-color:var(--td-cyan-line);
  margin-left:auto;
}
.td-msg-meta{
  margin:0 0 6px;
  font-size:12px;
  font-weight:800;
  color:var(--muted);
}
.td-msg-from{ font-weight:900; color:#1e293b; }
.td-msg-out .td-msg-from{ color:#0b5566; }
.td-msg-when{ font-weight:700; color:var(--muted); margin-left:2px; }
.td-msg-body{ white-space:pre-wrap; }

/* Bereinigtes HTML einer Mail (Outlook-aehnliche Darstellung) */
.td-msg-html{
  max-width:100%;
  overflow-x:auto;
  font-size:14px;
  line-height:1.5;
  color:#1f2937;
}
.td-msg-html img{ max-width:100%; height:auto; }
.td-msg-html table{ border-collapse:collapse; max-width:100%; }
.td-msg-html td, .td-msg-html th{ padding:4px 6px; }
.td-msg-html blockquote{
  margin:8px 0 8px 10px;
  padding-left:10px;
  border-left:3px solid var(--border);
  color:var(--muted);
}
.td-msg-html a{ color:#0b5566; text-decoration:underline; }
.td-msg-html p{ margin:0 0 10px; }
.td-msg-html p:last-child{ margin-bottom:0; }

.td-msg-attachments{
  display:flex; flex-wrap:wrap; gap:8px;
  margin-top:12px;
  padding-top:12px;
  border-top:1px dashed var(--border);
}
.attachment-chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#f8fafc;
  font-size:12px; font-weight:800;
  color:#334155;
}
.attachment-chip:hover{ background:#eef2f7; text-decoration:none; border-color:#cbd5e1; }
.attachment-chip svg{ flex:0 0 auto; color:#64748b; }

.td-assign{ margin-top:16px; }
.td-replyform{ margin-top:8px; }
.td-replyform label{ display:block; margin-top:10px; margin-bottom:4px; font-size:12px; font-weight:800; color:var(--muted); }
.td-replybox{ margin-top:18px; padding-top:16px; border-top:1px solid var(--border); }

/* Grosse Symbol-Buttons (Outlook-Ribbon-Stil) fuer die Ticket-Hauptaktionen */
.td-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
  padding-top:14px;
  padding-bottom:2px;
  border-top:1px solid var(--border);
}
.td-toolbar form{ display:contents; }
.td-toolbar-btn{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:3px;
  min-width:58px;
  padding:7px 10px 6px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  color:#334155;
  font-size:10px;
  font-weight:800;
  cursor:pointer;
  line-height:1.2;
}
.td-toolbar-btn svg{ width:16px; height:16px; display:block; }
.td-toolbar-btn:hover{ background:#f3f4f6; border-color:#cbd5e1; }
.td-toolbar-btn.primary{ background:var(--td-cyan,#E3F6FB); border-color:var(--td-cyan-line,#3EB1CC); color:#0b5566; }
.td-toolbar-btn.primary:hover{ filter:brightness(0.97); }
.td-toolbar-btn.danger{ color:#b91c1c; border-color:rgba(185,28,28,0.25); }
.td-toolbar-btn.danger:hover{ background:rgba(185,28,28,0.08); border-color:rgba(185,28,28,0.4); }
.td-toolbar-btn:disabled{ opacity:.45; cursor:not-allowed; }
.td-forward-attachments{ display:flex; flex-direction:column; gap:6px; margin-top:6px; }
.td-forward-attachments label{ display:flex; align-items:center; gap:7px; margin:0; font-size:13px; font-weight:600; color:#334155; }

.td-empty{
  padding:70px 20px;
  text-align:center;
  color:var(--muted);
}
.td-empty svg{ color:#cbd5e1; margin-bottom:10px; }
.td-empty p{ margin:0; font-weight:800; font-size:13px; }

@media(max-width:1300px){
  .td-layout{ grid-template-columns: 300px 1fr; }
  .td-row-subject, .td-row-snippet{ max-width:180px; }
}
@media(max-width:1100px){
  .td-layout{ grid-template-columns:1fr; }
  .td-table-card{ max-height:340px; }
  .td-detail{ position:static; max-height:none; }
  .td-row-subject, .td-row-snippet{ max-width:none; }
}

/* Posteingang: Liste oben (moeglichst klein) + Ansichtsfenster darunter
   (moeglichst gross), statt nebeneinander. Nur hier per Zusatzklasse
   ".td-layout-stacked" aktiv - "Neue Leads" (leads.php) nutzt dieselben
   Grundklassen weiterhin nebeneinander. */
.td-layout.td-layout-stacked{
  display:flex;
  flex-direction:column;
  height:calc(100vh - 140px);
}
.td-layout.td-layout-stacked .td-table-card,
.td-layout.td-layout-stacked .td-detail{
  flex:1 1 0;
  min-height:0;
  max-height:none;
  position:static;
}
/* Liste als schlanke Zeilen mit nur Absender, Betreff und Datum. */
.td-layout.td-layout-stacked .td-table{
  table-layout:fixed;
}
.td-layout.td-layout-stacked .td-table thead th{
  padding:5px 10px;
  font-size:9px;
}
.td-layout.td-layout-stacked .td-table td{
  padding:5px 10px;
  vertical-align:middle;
}
.td-layout.td-layout-stacked .td-col-sender{
  width:18%;
  font-weight:800;
  font-size:11px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.td-layout.td-layout-stacked .td-col-subject{
  font-size:11px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.td-layout.td-layout-stacked .td-col-date{
  width:120px;
  font-size:10px;
  white-space:nowrap;
}
.td-layout.td-layout-stacked .tk-col-action{
  width:36px;
}
@media(max-width:1100px){
  .td-layout.td-layout-stacked{ height:calc(100vh - 120px); }
}

/* ===== Ticket-Uebersicht (Figma-Vorlage): KPI-Kacheln + Ticket-Tabelle ===== */
.kpi-row{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:14px;
  margin-bottom:16px;
}
@media(max-width:900px){.kpi-row{grid-template-columns:1fr 1fr;}}
@media(max-width:520px){.kpi-row{grid-template-columns:1fr;}}
.kpi-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:16px 18px;
  display:flex;
  align-items:center;
  gap:14px;
}
.kpi-icon{
  width:44px;height:44px;border-radius:14px;
  display:grid;place-items:center;
  flex:0 0 auto;
}
.kpi-icon svg{width:20px;height:20px;display:block}
.kpi-icon .tk-avatar{width:100%;height:100%;font-size:16px}
.kpi-icon.blue{background:#eaf2ff;color:#1d4ed8}
.kpi-icon.yellow{background:#fff7e0;color:#b45309}
.kpi-icon.green{background:#eafaf0;color:#0f7a4d}
.kpi-icon.red{background:#fdeceb;color:#b91c1c}
.kpi-icon.neutral{background:#f1f5f9;color:#334155}

/* Statistik-Seite */
.legend-dot{ width:9px; height:9px; border-radius:999px; display:inline-block; flex:0 0 auto; }
.stat-bar{
  display:flex; gap:2px;
  height:10px; min-width:120px;
  border-radius:999px;
  background:#f1f5f9;
  overflow:hidden;
}
.stat-bar span{ display:block; height:100%; }
.trend-row{ display:flex; align-items:center; gap:10px; padding:4px 0; }
.trend-label{ width:66px; flex:0 0 auto; font-size:12px; font-weight:800; color:var(--muted); text-align:right; }
.trend-bar-track{ flex:1; background:#f1f5f9; border-radius:999px; height:14px; overflow:hidden; }
.trend-bar-fill{ display:block; height:100%; background:#10b981; border-radius:999px; min-width:2px; }
.trend-count{ width:26px; flex:0 0 auto; font-size:12px; font-weight:900; text-align:right; color:#0f7a4d; }
.kpi-n{font-size:24px;font-weight:800;letter-spacing:-.02em;line-height:1.1}
.kpi-lbl{color:var(--muted);font-size:12px;font-weight:800;margin-top:2px}

/* KPI-Kachel als klickbarer Filter (Posteingang: Alle Tickets / Neue Antwort / je Bearbeiter) */
button.kpi-card.kpi-filter{
  appearance:none; -webkit-appearance:none;
  font:inherit; text-align:left; cursor:pointer;
  width:100%;
}
.kpi-filter:hover{ box-shadow:0 10px 26px rgba(2,6,23,.10); transform:translateY(-1px); transition:.12s ease; }
.kpi-filter.active{
  background:var(--td-cyan, #E3F6FB);
  border-color:var(--td-cyan-line, #3EB1CC);
  box-shadow:0 0 0 2px rgba(62,177,204,.18);
}
.kpi-filter.active .kpi-lbl{ color:#0b5566; }

/* Posteingang: kompaktere KPI-Kacheln im Seitenkopf (nur hier, siehe
   admin/inbox.php - andere Seiten nutzen .kpi-card unveraendert ueber
   partials/kpis.php) */
.kpi-row-compact{ margin-bottom:12px; gap:10px; }
.kpi-row-compact .kpi-card{ padding:10px 12px; gap:10px; }
.kpi-row-compact .kpi-icon{ width:32px; height:32px; border-radius:10px; }
.kpi-row-compact .kpi-icon svg{ width:15px; height:15px; }
.kpi-row-compact .kpi-icon .tk-avatar{ font-size:12px; }
.kpi-row-compact .kpi-n{ font-size:18px; }
.kpi-row-compact .kpi-lbl{ font-size:11px; }

.tk-table-wrap{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  overflow:auto;
}
.tk-table{width:100%;border-collapse:collapse;font-size:13px}
.tk-table thead th{
  text-align:left;
  font-size:11px;font-weight:900;text-transform:uppercase;letter-spacing:.03em;
  color:var(--muted);
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  background:#f8fafc;
  white-space:nowrap;
}
.tk-table td{padding:8px 12px;border-bottom:1px solid var(--border);vertical-align:middle}
.tk-table tbody tr.tk-row:hover{background:#fbfbfd}
.tk-row.is-done{opacity:.7}
.tk-col-id{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;font-weight:800;color:var(--muted);white-space:nowrap}
.tk-col-subject{font-weight:700;max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tk-col-date{color:var(--muted);font-size:12px;font-weight:800;white-space:nowrap}
.tk-col-action{white-space:nowrap;text-align:right}
.tk-reporter{display:flex;align-items:center;gap:8px;font-weight:700}
.tk-avatar{
  width:26px;height:26px;border-radius:999px;
  display:inline-flex;align-items:center;justify-content:center;
  font-size:11px;font-weight:900;
  flex:0 0 auto;
}
.tk-avatar-empty{background:#f1f5f9;color:#94a3b8}
.tk-edit-row td{background:#f8fafc;padding:16px 18px}
.tk-delete-btn{color:#b91c1c;border-color:rgba(185,28,28,.25)}
.tk-delete-btn:hover{background:rgba(185,28,28,.08);border-color:rgba(185,28,28,.4)}
.iconbtn.small{width:32px;height:32px;border-radius:9px}
.iconbtn.small svg{width:15px;height:15px;display:block}
/* .iconbtn setzt display:grid (macht den Button block-level) - ohne diesen
   expliziten Flex-Wrapper stehen Bearbeiten/Loeschen (Tickets im Dashboard/
   Report) untereinander statt nebeneinander, was die Zeile unnoetig hoch macht. */
.tk-action-btns{ display:flex; flex-direction:row; align-items:center; gap:4px; justify-content:flex-end; }
.tk-action-btns form{ display:flex; margin:0; }
.tk-action-btns .iconbtn.small{ width:28px; height:28px; }
.tk-action-btns .iconbtn.small svg{ width:13px; height:13px; }

/* Mehrfachauswahl in Ticket-Tabellen (Checkboxen + Sammelleiste, siehe
   ticket_table.php/ticket_table_rows.php). */
.tk-col-check{ width:24px; }
.tk-select, .tk-select-all{ width:15px; height:15px; margin:0; cursor:pointer; }
.tk-bulkbar{
  display:flex; align-items:center; flex-wrap:wrap; gap:10px;
  padding:10px 16px; background:#f0f7e8; border-bottom:1px solid var(--border);
  font-size:12px;
}
.tk-bulkbar .tk-bulk-count{ color:#2f5b12; font-weight:600; margin-right:auto; }
.tk-bulk-form{ display:flex; align-items:center; gap:6px; margin:0; }
.tk-bulk-form .sel{ font-size:12px; padding:5px 8px; }

/* Vertragslaufzeiten (admin/contracts.php): geordnete Tabelle mit Objekt als
   erster Spalte und einem gruenen Streifen unter der Kopfzeile. Alle
   Angaben durchgehend klein und normalgewichtig (kein Fett, keine grossen
   Schriftgroessen) - nur die Kopfzeile ist dezent hervorgehoben. */
.contract-table-wrap{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  overflow:auto;
}
.contract-table{ width:100%; border-collapse:collapse; font-size:12px; font-weight:400; color:#374151; }
.contract-table thead th{
  text-align:left;
  font-size:11px; font-weight:600; color:var(--muted);
  padding:10px 12px;
  border-bottom:3px solid #8bc34a;
  background:#f8fafc;
  white-space:nowrap;
}
.contract-table td{ padding:6px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.contract-table tbody tr:not(.contract-group-row):hover td{ background:#fbfbfd; }
.contract-col-note{ max-width:220px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--muted); }
.contract-edit-row td{ background:#f8fafc; padding:14px 16px; }
/* Gruppen-Kopfzeile je Liegenschaft (admin/contracts.php): fasst die
   darunterliegenden Vertraege desselben Objekts zusammen. */
.contract-group-row td{
  padding:8px 12px; font-size:12px; font-weight:600; color:#374151;
  background:#f8fafc; border-bottom:1px solid var(--border);
  text-decoration:underline;
}
.contract-table tbody + tbody .contract-group-row td{ border-top:1px solid var(--border); }
/* BJ/Modell/Typ Heizung (admin/contracts.php): nur bei Kategorie "Wartung
   Heizung" sichtbar (siehe JS-Toggle in _layout.php). Display gehoert in die
   Stylesheet-Regel statt in ein inline style="display:flex" - ein inline
   style wuerde die [hidden]-Regel des Browsers (display:none) sonst immer
   ueberschreiben, egal ob das hidden-Attribut gesetzt ist. */
.contract-heating-fields{ display:flex; gap:16px; flex-wrap:wrap; margin-top:8px; }
.contract-heating-fields[hidden]{ display:none; }

/* Upload-Fortschritt: erscheint automatisch bei jedem Formular mit
   enctype="multipart/form-data", sobald mindestens eine Datei ausgewaehlt ist
   (siehe _layout.php, Datei-Uploads ueberall im Portal - Dateiverwaltung,
   Mitteilungen, Ticket-Anhaenge bei Antworten/Weiterleiten/Neue E-Mail). */
.upload-progress-overlay{
  position:fixed; inset:0;
  background:rgba(15,23,42,.45);
  display:flex; align-items:center; justify-content:center;
  z-index:200;
}
.upload-progress-box{
  background:#fff;
  border-radius:18px;
  box-shadow:0 30px 80px rgba(2,6,23,.28);
  padding:26px 30px;
  width:320px;
  max-width:calc(100vw - 40px);
  text-align:center;
}
.upload-progress-label{ font-size:13px; font-weight:800; color:#1f2937; margin-bottom:14px; }
.upload-progress-track{
  height:10px;
  border-radius:999px;
  background:#eef1f6;
  overflow:hidden;
}
.upload-progress-bar{
  height:100%;
  width:0%;
  background:var(--accent,#8bc34a);
  border-radius:999px;
  transition:width .15s ease;
}
.upload-progress-pct{ margin-top:8px; font-size:12px; font-weight:800; color:var(--muted); }

/* Status (admin/status.php): eine Zeile je Objekt, nur Checkboxen. Kopfzeile
   bleibt beim Scrollen der Zeilen stehen (analog .td-table-card im Posteingang). */
.status-table-wrap{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  overflow:auto;
  max-height:calc(100vh - 230px);
}
.status-table{ width:100%; border-collapse:collapse; font-size:12px; font-weight:400; color:#374151; }
.status-table thead th{
  position:sticky;
  top:0;
  z-index:1;
  text-align:center;
  font-size:11px; font-weight:600; color:var(--muted);
  padding:10px 8px;
  border-bottom:3px solid #8bc34a;
  background:#f8fafc;
  white-space:nowrap;
}
.status-table td{ padding:6px 8px; border-bottom:1px solid var(--border); text-align:center; vertical-align:middle; }
.status-table tbody tr:hover td{ background:#fbfbfd; }
.status-table input[type="checkbox"]{ width:15px; height:15px; margin:0; cursor:pointer; }
.status-col-object{ text-align:left !important; white-space:nowrap; }
/* .iconbtn setzt display:grid (macht den Button block-level) - ohne diesen
   expliziten Flex-Wrapper stehen Bearbeiten/Loeschen untereinander statt
   nebeneinander, was die Zeile unnoetig hoch macht. */
.contract-action-btns{ display:flex; flex-direction:row; align-items:center; gap:4px; justify-content:flex-end; }
.contract-action-btns form{ display:flex; margin:0; }
.contract-action-btns .iconbtn.small{ width:28px; height:28px; }
.contract-action-btns .iconbtn.small svg{ width:13px; height:13px; }

/* Billing run: results table usability */
.tbl{
  width: 100%;
}
.tbl thead th{
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}
/* Make the results section breathe a bit when stacked */
.results-box{
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 14px;
}

/* ===== Kalender ===== */
.cal-toolbar{
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  margin:14px 0 16px;
}
.cal-nav{ display:flex; align-items:center; gap:10px; }
.cal-month-label{ font-size:18px; font-weight:800; min-width:170px; text-align:center; letter-spacing:-.01em; }
.cal-legend{ display:flex; gap:14px; margin-left:auto; }
.cal-legend-item{ display:flex; align-items:center; gap:6px; font-size:12px; font-weight:800; color:var(--muted); }

.cal-grid{
  display:grid;
  grid-template-columns:repeat(7, minmax(0,1fr));
  gap:8px;
}
.cal-weekday{
  text-align:center;
  font-size:11px; font-weight:900; text-transform:uppercase; letter-spacing:.04em;
  color:var(--muted);
  padding-bottom:4px;
}
.cal-day{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  min-height:112px;
  padding:8px;
  display:flex; flex-direction:column; gap:6px;
  box-shadow:var(--shadow);
}
.cal-day-out{ opacity:.45; box-shadow:none; }
.cal-day-today{ border-color:rgba(139,195,74,.6); box-shadow:0 0 0 2px rgba(139,195,74,.18); }
.cal-day-head{ display:flex; align-items:center; justify-content:space-between; }
.cal-day-num{ font-size:13px; font-weight:800; }
.cal-day-today .cal-day-num{
  background:var(--accent); color:#fff;
  width:22px; height:22px; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:12px;
}
.cal-day-add{
  border:none; background:none; cursor:pointer;
  width:18px; height:18px; border-radius:6px;
  color:var(--muted); font-size:14px; line-height:1;
  opacity:0; transition:opacity .12s ease;
  display:flex; align-items:center; justify-content:center;
}
.cal-day:hover .cal-day-add{ opacity:1; }
.cal-day-add:hover{ background:#f3f4f6; color:#111827; }
.cal-day-items{
  display:flex; flex-direction:column; gap:4px;
  overflow-y:auto;
  max-height:120px;
}
.cal-chip{
  display:flex; align-items:center; gap:5px;
  padding:3px 6px;
  border-radius:8px;
  font-size:11px; font-weight:800;
  color:inherit; text-decoration:none;
  overflow:hidden;
  white-space:nowrap;
}
.cal-chip:hover{ text-decoration:none; filter:brightness(0.97); }
.cal-chip-event{ background:rgba(59,130,246,.10); color:#1d4ed8; }
.cal-chip-due{ background:rgba(245,158,11,.12); color:#92400e; }
.cal-chip-contract{ background:rgba(139,92,246,.12); color:#6d28d9; }
.cal-chip-text{ overflow:hidden; text-overflow:ellipsis; flex:1; min-width:0; }
.cal-dot{ width:6px; height:6px; border-radius:999px; flex:0 0 auto; }
.cal-dot-event{ background:#3b82f6; }
.cal-dot-due{ background:#f59e0b; }
.cal-dot-contract{ background:#8b5cf6; }
.cal-chip-delete-form{ margin:0; flex:0 0 auto; }
.cal-chip-x{
  border:none; background:none; cursor:pointer;
  color:inherit; opacity:.5; font-size:13px; line-height:1;
  padding:0 2px;
}
.cal-chip-x:hover{ opacity:1; }

@media(max-width:1000px){
  .cal-grid{ grid-template-columns:repeat(7, minmax(90px,1fr)); overflow-x:auto; }
  .cal-legend{ margin-left:0; }
}

/* Karteikarten im Look der Mitteilungs-/Dokument-E-Mails (EmailTemplate.php):
   heller Kopfbereich, gruener Akzentbalken, Karten fuer Inhalte. Volle Version
   fuer Mitteilungen (.mail-card), reduzierte Version ohne Kopfbereich/Akzent
   fuer Dateien (.mail-item-list / .mail-item). */
.mail-card{
  background:#fff; border:1px solid #e5e7eb; border-radius:14px;
  overflow:hidden; margin-bottom:16px;
}
.mail-card-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:14px;
  padding:20px 24px; background:#f6f7fb;
}
.mail-card-title{
  font-size:18px; font-weight:800; color:#111827; line-height:1.35;
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
}
.mail-card-date{ font-size:12px; color:#6b7280; font-weight:700; white-space:nowrap; text-align:right; }
.mail-card-accent{ height:5px; background-color:#8bc34a; }
.mail-card-body{ padding:22px 24px; }
.mail-card-line{ margin:0 0 14px; font-size:13px; color:#374151; }
.mail-card-text{ margin:0 0 18px; font-size:14px; color:#111827; line-height:1.55; white-space:pre-wrap; }
.mail-card-section{
  margin:0 0 10px; font-size:12px; font-weight:800; color:#111827;
  text-transform:uppercase; letter-spacing:.03em;
}
.mail-item{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  border:1px solid #e5e7eb; border-radius:10px; padding:12px 14px; margin-bottom:8px;
}
.mail-item:last-child{ margin-bottom:0; }
.mail-item-title{ font-weight:700; color:#2f5b12; font-size:14px; }
.mail-item-sub{ font-size:12px; color:#6b7280; margin-top:2px; }
.mail-item-meta{ font-size:12px; color:#6b7280; }
.mail-item-dl{
  display:flex; align-items:center; justify-content:center;
  width:30px; height:30px; border-radius:8px; flex:0 0 auto;
  color:#3f3f46; border:1px solid #e5e7eb; background:#fff;
}
.mail-item-dl:hover{ background:#f6f7fb; }

.mail-item-list .mail-item{ margin-bottom:10px; }
.mail-item-list .mail-item:last-child{ margin-bottom:0; }

/* Mitteilungen (messages/index.php): Liste links + Objekt-Infokarte
   (Passfoto + Objektname/Baujahr/Ansprechpartner/...) rechts daneben. */
.messages-layout{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap:20px;
  align-items:start;
}
@media(max-width:900px){
  .messages-layout{ grid-template-columns:1fr; }
  .object-card{ order:-1; }
}
.object-card{ position:sticky; top:14px; }
.object-card .card{ overflow:hidden; }
.object-card-photo{
  width:100%; height:200px; object-fit:cover; display:block;
}
.object-card-photo-placeholder{
  display:grid; place-items:center;
  background:#f1f5f9; color:#94a3b8;
}
.object-card-list{ margin:0; }
.object-card-list dt{
  font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.03em;
  color:var(--muted); margin-top:12px;
}
.object-card-list dt:first-child{ margin-top:0; }
.object-card-list dd{ margin:2px 0 0; font-size:14px; font-weight:600; color:#111827; }
.object-card-list dd a{ color:#0b5566; }

/* Dateien (files/index.php): volle .mail-card-Optik (Kopfbereich + gruener
   Akzentbalken) statt der reduzierten Version, aber als aufklappbare <details>
   (eine Karte je Kategorie) und in kleinerer Schrift, da hier oft viele
   Eintraege auf einmal sichtbar sind. */
details.mail-card > summary.mail-card-head{
  cursor:pointer;
  list-style:none;
  user-select:none;
}
details.mail-card > summary.mail-card-head::-webkit-details-marker{ display:none; }
details.mail-card > summary.mail-card-head:hover{ background:#eef0f6; }
.mail-card-fold-arrow{ flex:0 0 auto; color:var(--muted); transition:transform .15s ease; }
details.mail-card[open] .mail-card-fold-arrow{ transform:rotate(90deg); }

.mail-card.compact .mail-card-head{ padding:12px 16px; }
.mail-card.compact .mail-card-title{ font-size:13px; gap:6px; }
.mail-card.compact .mail-card-date{ font-size:11px; }
.mail-card.compact .mail-card-body{ padding:12px 16px 14px; }
.mail-card.compact .mail-item{ padding:9px 12px; margin-bottom:6px; }
.mail-card.compact .mail-item-title{ font-size:12px; }
.mail-card.compact .mail-item-sub,
.mail-card.compact .mail-item-meta{ font-size:10.5px; }
.mail-card.compact .mail-item-dl{ width:26px; height:26px; }
.mail-card.compact .mail-item-dl svg{ width:13px; height:13px; }

/* =====================================================================
   Posteingang im Stil von Spark / Airmail (admin/inbox.php)
   Anordnung je Nutzer (Posteingang > Einstellungen > Ansicht):
   .mx-layout-top | -left | -right | -bottom, Listengroesse per Trenner
   (--mx-list-size, im Browser gemerkt). Nur unter .mx-* - "Neue Leads"
   nutzt die td-*-Grundklassen weiterhin unveraendert.
   ===================================================================== */
.mx-inbox{
  --mx-accent:#2563eb;
  --mx-accent-soft:#eaf1ff;
  --mx-list-bg:#f8f9fc;
  --mx-line:#eceef4;
  --mx-text-2:#475569;
}

.mx-layout{
  --mx-list-size:380px;
  display:flex;
  height:calc(100vh - 220px);
  min-height:460px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.mx-layout.mx-layout-left{ flex-direction:row; }
.mx-layout.mx-layout-right{ flex-direction:row-reverse; }
.mx-layout.mx-layout-top{ flex-direction:column; }
.mx-layout.mx-layout-bottom{ flex-direction:column-reverse; }
.mx-layout.mx-resizing{ user-select:none; cursor:col-resize; }
.mx-layout.mx-resizing.mx-stack{ cursor:row-resize; }
.mx-layout.mx-resizing iframe{ pointer-events:none; }

/* --- Nachrichtenliste --- */
.mx-list{
  flex:0 0 var(--mx-list-size);
  min-width:0; min-height:0;
  display:flex; flex-direction:column;
  background:var(--mx-list-bg);
}
.mx-list-head{
  display:flex; align-items:center; gap:10px;
  padding:12px 14px 10px;
  border-bottom:1px solid var(--mx-line);
}
.mx-search{
  flex:1; min-width:0;
  display:flex; align-items:center; gap:8px;
  height:34px; padding:0 12px;
  background:#fff;
  border:1px solid var(--mx-line);
  border-radius:10px;
  transition:border-color .12s, box-shadow .12s;
}
.mx-search:focus-within{ border-color:var(--mx-accent); box-shadow:0 0 0 3px rgba(37,99,235,.12); }
.mx-search svg{ width:15px; height:15px; color:#94a3b8; flex:0 0 auto; }
.mx-search input{ flex:1; min-width:0; border:0; outline:none; background:transparent; font:inherit; font-size:13px; color:var(--text); }
.mx-list-count{
  flex:0 0 auto;
  min-width:26px; padding:2px 8px;
  border-radius:999px;
  background:#e8ebf2;
  color:var(--mx-text-2);
  font-size:11px; font-weight:800; text-align:center;
}
.mx-list-scroll{
  flex:1; min-height:0;
  overflow-y:auto;
  padding:6px 8px 10px;
}
.mx-list-empty{ padding:40px 12px; text-align:center; color:var(--muted); font-size:13px; font-weight:700; }

/* Listeneintrag: Avatar | Absender + Datum / Betreff / Vorschau */
.mx-item{
  position:relative;
  display:grid;
  grid-template-columns:36px minmax(0,1fr);
  gap:10px;
  padding:10px 12px 10px 14px;
  margin-bottom:2px;
  border-radius:12px;
  cursor:pointer;
  outline:none;
  transition:background .1s;
}
.mx-item[hidden]{ display:none; }
.mx-item:hover{ background:#eef1f7; }
.mx-item.active{ background:var(--mx-accent-soft); }
.mx-item:focus-visible{ box-shadow:inset 0 0 0 2px var(--mx-accent); }
.mx-item.is-new::before{
  content:""; position:absolute; left:4px; top:22px;
  width:7px; height:7px; border-radius:999px;
  background:var(--mx-accent);
}
.mx-item-avatar .tk-avatar{ width:36px; height:36px; font-size:14px; }
.mx-item-main{ min-width:0; display:flex; flex-direction:column; gap:1px; }
.mx-item-top{ display:flex; align-items:baseline; gap:6px; min-width:0; }
.mx-item-sender{
  flex:1; min-width:0;
  font-size:13.5px; font-weight:600; color:#1e293b;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.mx-item.is-new .mx-item-sender, .mx-item.is-new .mx-item-subject{ font-weight:800; color:#0f172a; }
.mx-item-count{
  flex:0 0 auto;
  font-size:10px; font-weight:800; color:var(--mx-text-2);
  border:1px solid #d6dbe6; border-radius:6px; padding:0 5px; line-height:15px;
}
.mx-item-date{ flex:0 0 auto; font-size:11.5px; color:#94a3b8; font-weight:600; white-space:nowrap; }
.mx-item.is-new .mx-item-date{ color:var(--mx-accent); font-weight:800; }
.mx-item-subject{
  font-size:13px; font-weight:600; color:#334155;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.mx-item-snippet{
  font-size:12.5px; line-height:1.4; color:#7b8494;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}
.mx-item-tags{ display:flex; align-items:center; gap:5px; margin-top:4px; flex-wrap:wrap; }
.mx-tag{
  font-size:10px; font-weight:800; line-height:16px;
  padding:0 6px; border-radius:6px;
  background:#eef1f6; color:#64748b;
}
.mx-tag-no{ font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-weight:700; background:transparent; padding:0; color:#a0a8b6; }
.mx-tag-work{ background:#fff4dd; color:#a16207; }
.mx-tag-done{ background:#eef1f6; color:#94a3b8; }
.mx-tag-user{ background:transparent; padding:0; }
.mx-tag-user .tk-avatar{ width:16px; height:16px; font-size:8px; }

/* Schnellaktion (Loeschen) erscheint beim Ueberfahren - wie in Spark */
.mx-item-actions{
  position:absolute; right:8px; bottom:8px;
  margin:0;
  opacity:0; pointer-events:none;
  transition:opacity .1s;
}
.mx-item:hover .mx-item-actions, .mx-item:focus-within .mx-item-actions{ opacity:1; pointer-events:auto; }
.mx-item-action{
  display:grid; place-items:center;
  width:28px; height:28px;
  border:1px solid var(--mx-line); border-radius:8px;
  background:#fff; color:#94a3b8; cursor:pointer;
  box-shadow:0 1px 2px rgba(15,23,42,.06);
}
.mx-item-action:hover{ color:#dc2626; border-color:rgba(220,38,38,.3); background:#fff5f5; }

/* Oben/unten-Anordnung: kompakte einzeilige Eintraege (Airmail-Stil) */
.mx-stack .mx-item{ grid-template-columns:28px minmax(0,1fr); padding:7px 12px 7px 16px; align-items:center; }
.mx-stack .mx-item-avatar .tk-avatar{ width:28px; height:28px; font-size:12px; }
.mx-stack .mx-item.is-new::before{ top:50%; margin-top:-3px; }
.mx-stack .mx-item-main{
  display:grid;
  grid-template-columns:minmax(120px,22%) minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
}
.mx-stack .mx-item-top{ display:contents; }
.mx-stack .mx-item-sender{ grid-column:1; grid-row:1; }
.mx-stack .mx-item-count{ display:none; }
.mx-stack .mx-item-date{ grid-column:3; grid-row:1; min-width:52px; text-align:right; }
.mx-stack .mx-item-subject{ grid-column:2; grid-row:1; }
.mx-stack .mx-item-snippet{ display:none; }
.mx-stack .mx-item-tags{ display:none; }
.mx-stack .mx-item-actions{ bottom:auto; top:50%; transform:translateY(-50%); right:70px; }

/* --- Trenner (mit der Maus verschiebbar) --- */
.mx-splitter{
  flex:0 0 auto;
  position:relative;
  background:var(--mx-line);
  outline:none;
  z-index:2;
  touch-action:none;
}
.mx-side .mx-splitter{ width:1px; cursor:col-resize; }
.mx-stack .mx-splitter{ height:1px; cursor:row-resize; }
/* grosszuegige, unsichtbare Greifflaeche */
.mx-splitter::before{ content:""; position:absolute; }
.mx-side .mx-splitter::before{ top:0; bottom:0; left:-5px; right:-5px; }
.mx-stack .mx-splitter::before{ left:0; right:0; top:-5px; bottom:-5px; }
.mx-splitter span{
  position:absolute; left:50%; top:50%;
  transform:translate(-50%,-50%);
  border-radius:999px;
  background:#cbd2df;
  opacity:0; transition:opacity .12s, background .12s;
}
.mx-side .mx-splitter span{ width:4px; height:36px; }
.mx-stack .mx-splitter span{ width:36px; height:4px; }
.mx-splitter:hover span, .mx-splitter:focus-visible span, .mx-resizing .mx-splitter span{ opacity:1; }
.mx-resizing .mx-splitter, .mx-splitter:focus-visible{ background:var(--mx-accent); }
.mx-resizing .mx-splitter span{ background:var(--mx-accent); }

/* --- Lesebereich --- */
.mx-read{
  flex:1 1 0;
  min-width:0; min-height:0;
  overflow-y:auto;
  background:#fff;
  container-type:inline-size;
}
.mx-read .td-panel[hidden]{ display:none; }
.mx-read .td-empty{ height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:40px 20px; }
.mx-read .td-empty[hidden]{ display:none; }

/* schwebende Symbolleiste oben im Lesebereich */
.mx-read .mx-read-toolbar{
  position:sticky; top:0; z-index:3;
  display:flex; align-items:center; flex-wrap:wrap; gap:4px;
  margin:0; padding:10px 16px;
  border-top:0;
  border-bottom:1px solid var(--mx-line);
  background:rgba(255,255,255,.88);
  backdrop-filter:saturate(1.6) blur(10px);
  -webkit-backdrop-filter:saturate(1.6) blur(10px);
}
.mx-read .mx-read-toolbar .td-toolbar-btn{
  flex-direction:row; gap:6px;
  min-width:0; height:32px; padding:0 10px;
  border:0; border-radius:8px;
  background:transparent;
  color:var(--mx-text-2);
  font-size:12.5px; font-weight:600;
}
.mx-read .mx-read-toolbar .td-toolbar-btn svg{ width:17px; height:17px; }
.mx-read .mx-read-toolbar .td-toolbar-btn:hover{ background:#f1f4f9; color:#0f172a; }
.mx-read .mx-read-toolbar .td-toolbar-btn.primary{ background:var(--mx-accent); color:#fff; }
.mx-read .mx-read-toolbar .td-toolbar-btn.primary:hover{ filter:brightness(1.08); }
.mx-read .mx-read-toolbar .td-toolbar-btn.danger{ color:#b91c1c; }
.mx-read .mx-read-toolbar .td-toolbar-btn.danger:hover{ background:#fff1f1; }
.mx-toolbar-spacer{ flex:1; }
@container (max-width:620px){
  .mx-read .mx-read-toolbar .td-toolbar-btn:not(.primary) span{ display:none; }
}
@container (max-width:420px){
  .mx-read .mx-read-toolbar .td-toolbar-btn span{ display:none; }
  .mx-read .mx-read-toolbar .badge{ display:none; }
}

.mx-read-body{ padding:22px 28px 32px; max-width:980px; }
@container (max-width:520px){ .mx-read-body{ padding:18px 16px 24px; } }
.mx-read .mx-read-subject{ font-size:21px; font-weight:750; letter-spacing:-.015em; line-height:1.3; color:#0f172a; }
.mx-read-chips{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:10px; }
.mx-chip{
  display:inline-flex; align-items:center; gap:5px;
  height:24px; padding:0 9px;
  border-radius:999px;
  background:#f1f4f9;
  color:var(--mx-text-2);
  font-size:11.5px; font-weight:700;
}
.mx-chip svg{ color:#94a3b8; }
.mx-chip .tk-avatar{ width:16px; height:16px; font-size:8px; margin-left:-4px; }
.mx-chip-no{ font-family:ui-monospace,SFMono-Regular,Menlo,monospace; background:transparent; padding:0 4px 0 0; color:#94a3b8; }

/* Verlauf: Nachrichten als ruhige Karten statt Sprechblasen */
.mx-read .td-thread{ margin-top:22px; gap:14px; }
.mx-read .td-msg{
  max-width:none; margin:0;
  padding:16px 18px;
  border:1px solid var(--mx-line);
  border-radius:14px;
  background:#fff;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.mx-read .td-msg-out{ background:#f7faff; border-color:#dbe6fb; }
.mx-read .td-msg-meta{
  display:flex; align-items:center; gap:10px;
  margin:0 0 12px;
  font-size:13px; font-weight:400;
}
.mx-read .td-msg-meta .tk-avatar{ width:32px; height:32px; font-size:13px; }
.mx-msg-who{ flex:1; min-width:0; display:flex; flex-wrap:wrap; align-items:baseline; column-gap:6px; }
.mx-read .td-msg-from{ font-weight:700; color:#0f172a; }
.mx-read .td-msg-out .td-msg-from{ color:#1e3a8a; }
.mx-msg-addr{ font-size:12px; color:#94a3b8; overflow-wrap:anywhere; }
.mx-read .td-msg-when{ flex:0 0 auto; margin:0; font-size:12px; font-weight:500; color:#94a3b8; white-space:nowrap; }
.mx-read .td-msg-body, .mx-read .td-msg-html{ font-size:14px; line-height:1.6; color:#1f2937; }

.mx-read .td-replybox{
  margin-top:18px; padding:16px 18px;
  border:1px solid #dbe6fb; border-radius:14px;
  background:#fbfcff;
}
.mx-read .mini-details{ margin-top:20px; }

/* --- Einstellungen: Auswahl der Ansicht --- */
.mx-layout-picker{ display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px; }
@media(max-width:900px){ .mx-layout-picker{ grid-template-columns:1fr 1fr; } }
.mx-layout-option{ display:block; margin:0; cursor:pointer; }
.mx-layout-option input{ position:absolute; opacity:0; pointer-events:none; }
.mx-layout-card{
  display:flex; flex-direction:column; gap:10px; height:100%;
  padding:12px;
  border:1.5px solid var(--border);
  border-radius:14px;
  background:#fff;
  transition:border-color .12s, box-shadow .12s;
}
.mx-layout-option:hover .mx-layout-card{ border-color:#cbd5e1; }
.mx-layout-option input:checked + .mx-layout-card{ border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,.14); }
.mx-layout-option input:focus-visible + .mx-layout-card{ outline:2px solid #2563eb; outline-offset:2px; }
.mx-layout-label{ font-size:12.5px; font-weight:700; color:#334155; line-height:1.35; }
.mx-layout-option input:checked + .mx-layout-card .mx-layout-label{ color:#1d4ed8; }
.mx-layout-preview{
  display:flex; gap:4px;
  height:84px; padding:5px;
  border-radius:9px;
  background:#eef1f6;
}
.mx-preview-left{ flex-direction:row; }
.mx-preview-right{ flex-direction:row-reverse; }
.mx-preview-top{ flex-direction:column; }
.mx-preview-bottom{ flex-direction:column-reverse; }
.mx-pv-list, .mx-pv-read{ display:flex; flex-direction:column; gap:3px; padding:5px; border-radius:6px; background:#fff; overflow:hidden; }
.mx-pv-list{ flex:0 0 36%; background:#f8faff; }
.mx-pv-read{ flex:1; }
.mx-pv-list i{ display:block; height:5px; border-radius:3px; background:#bfd0f5; flex:0 0 auto; }
.mx-pv-list i:first-child{ background:#2563eb; }
.mx-pv-read b{ display:block; height:6px; width:60%; border-radius:3px; background:#94a3b8; flex:0 0 auto; }
.mx-pv-read i{ display:block; height:4px; border-radius:2px; background:#e2e8f0; flex:0 0 auto; }
.mx-pv-read i:last-child{ width:70%; }
.mx-preview-top .mx-pv-list i:nth-child(n+3), .mx-preview-bottom .mx-pv-list i:nth-child(n+3){ display:none; }
.mx-preview-top .mx-pv-read i:nth-child(n+4), .mx-preview-bottom .mx-pv-read i:nth-child(n+4){ display:none; }

/* Seiten mit voller Breite (z.B. Posteingang, siehe _layout.php $isFullWidth):
   kein 1200px-Limit, schmalere Raender und niedrigere Kopfleiste. */
.main-full{ min-width:0; }
.main-full .topbar{ height:48px; }
.main-full .container{ max-width:none; margin:0; padding:0 20px 16px; }
@media(max-width:900px){ .main-full .container{ padding:0 12px 12px; } }

/* --- Posteingang: Dashboard-Spalte vor der Nachrichtenliste (Drag & Drop) ---
   .mx-shell traegt jetzt den Karten-Rahmen, .mx-layout liegt rahmenlos darin. */
.mx-shell{
  display:flex;
  align-items:flex-start;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.mx-shell > .mx-layout{ flex:1; min-width:0; border:0; border-radius:0; box-shadow:none; }

.mx-dash{
  flex:0 0 var(--mx-dash-size, 220px);
  min-width:0; min-height:0;
  display:flex; flex-direction:column;
  background:#f3f5fa;
  overflow:hidden;
}
.mx-dash-head{ display:flex; flex-direction:column; gap:1px; padding:14px 14px 8px; }
.mx-dash-title{ font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--mx-text-2); }
.mx-dash-hint{ font-size:11.5px; color:#94a3b8; }
.mx-dash-filter{
  display:flex; align-items:center; gap:6px;
  margin:0 10px 6px; height:30px; padding:0 10px;
  background:#fff; border:1px solid var(--mx-line); border-radius:9px;
}
.mx-dash-filter:focus-within{ border-color:var(--mx-accent); box-shadow:0 0 0 3px rgba(37,99,235,.12); }
.mx-dash-filter svg{ width:13px; height:13px; color:#94a3b8; flex:0 0 auto; }
.mx-dash-filter input{ flex:1; min-width:0; border:0; outline:none; background:transparent; font:inherit; font-size:12.5px; color:var(--text); }
.mx-dash-scroll{ flex:1; min-height:0; overflow-y:auto; padding:2px 8px 10px; }

.mx-dash-item{
  display:flex; align-items:center; gap:8px;
  width:100%; margin:0 0 2px; padding:7px 10px;
  background:transparent; border:1px dashed transparent; border-radius:10px;
  font:inherit; font-size:13px; font-weight:600; color:#334155; text-align:left;
  cursor:pointer;
  transition:background .1s, border-color .1s, transform .1s;
}
.mx-dash-item[hidden]{ display:none; }
.mx-dash-item:hover{ background:#e8ecf4; }
.mx-dash-item:focus-visible{ outline:2px solid var(--mx-accent); outline-offset:-2px; }
.mx-dash-item.is-current{ background:var(--mx-accent-soft); color:#1d4ed8; cursor:default; }
.mx-dash-icon{ flex:0 0 auto; color:#94a3b8; }
.mx-dash-item.is-current .mx-dash-icon{ color:var(--mx-accent); }
.mx-dash-name{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mx-dash-count{
  flex:0 0 auto; min-width:20px; padding:1px 6px;
  border-radius:999px; background:#e2e7f0;
  font-size:10.5px; font-weight:800; color:var(--mx-text-2); text-align:center;
}

/* Waehrend ein Ticket gezogen wird: Ziele hervorheben */
.mx-dash.is-drop-active .mx-dash-item:not(.is-current){ border-color:#c7d4ee; background:#fff; }
.mx-dash.is-drop-active .mx-dash-item.is-over{
  border-style:solid; border-color:var(--mx-accent);
  background:var(--mx-accent-soft); color:#1d4ed8;
  transform:translateX(3px);
}
.mx-dash-item.is-over .mx-dash-icon{ color:var(--mx-accent); }
.mx-item[draggable="true"]{ cursor:grab; }
.mx-item.is-dragging{ opacity:.45; }

/* Hinweis im "Zuordnen"-Fenster nach einem Drop */
.mx-drop-notice{
  display:flex; align-items:flex-start; gap:8px;
  margin:0 0 12px; padding:10px 12px;
  border-radius:10px; background:#eaf1ff; color:#1e3a8a;
  font-size:13px; line-height:1.45;
}
.mx-drop-notice[hidden]{ display:none; }
.mx-drop-notice svg{ flex:0 0 auto; margin-top:1px; }
.sel.mx-attention{ border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,.14); }

/* Schmale Bildschirme: kein Drag & Drop - Zuordnen ueber den Button im Ticket */
/* Trenner zwischen Dashboard-Spalte und Nachrichtenliste - Optik wie
   .mx-splitter im Liste/Lesebereich-Trenner, aber immer senkrecht. */
.mx-dash-splitter{ width:1px; align-self:stretch; cursor:col-resize; }
.mx-dash-splitter::before{ top:0; bottom:0; left:-5px; right:-5px; }
.mx-dash-splitter span{ width:4px; height:36px; }
.mx-shell.mx-dash-resizing{ user-select:none; cursor:col-resize; }
.mx-shell.mx-dash-resizing iframe{ pointer-events:none; }
.mx-dash-resizing .mx-dash-splitter{ background:var(--mx-accent); }
.mx-dash-resizing .mx-dash-splitter span{ opacity:1; background:var(--mx-accent); }

@media(max-width:900px){ .mx-dash, .mx-dash-splitter{ display:none; } }

/* --- Posteingang: "Magic A" (KI-Antwortvorschlag) --- */
.td-toolbar-btn.mx-magic-btn{ color:#7c3aed; }
.td-toolbar-btn.mx-magic-btn:hover:not(:disabled){ background:#f5f0ff; color:#6d28d9; }
.td-toolbar-btn.mx-magic-btn:disabled{ opacity:.45; cursor:not-allowed; }
.td-toolbar-btn.mx-magic-btn.is-loading{ opacity:1; cursor:progress; }
.td-toolbar-btn.mx-magic-btn.is-loading svg{ animation:mx-magic-wiggle .9s ease-in-out infinite; }
@keyframes mx-magic-wiggle{ 0%,100%{ transform:rotate(0); } 50%{ transform:rotate(-14deg) scale(1.08); } }

.mx-magic-status{
  margin:2px 0 6px; padding:8px 11px;
  border-radius:9px; font-size:12.5px; line-height:1.4;
}
.mx-magic-status[hidden]{ display:none; }
.mx-magic-status.busy{ background:#f5f0ff; color:#6d28d9; }
.mx-magic-status.ok{ background:#f5f0ff; color:#5b21b6; }
.mx-magic-status.err{ background:#fff1f2; color:#be123c; }
.ta.mx-magic-loading{
  color:transparent;
  background:linear-gradient(90deg, #f8f7ff 0%, #ede9fe 50%, #f8f7ff 100%);
  background-size:200% 100%;
  animation:mx-magic-shimmer 1.2s linear infinite;
}
@keyframes mx-magic-shimmer{ from{ background-position:200% 0; } to{ background-position:0 0; } }
@media (prefers-reduced-motion: reduce){
  .td-toolbar-btn.mx-magic-btn.is-loading svg, .ta.mx-magic-loading{ animation:none; }
}

/* --- Posteingang: "Termin" (Termin aus Verlauf in den Kalender) --- */
.td-toolbar-btn.mx-appt-btn{ color:#0f766e; }
.td-toolbar-btn.mx-appt-btn:hover:not(:disabled){ background:#effcf9; color:#0d5f59; }
.mx-appt-row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.mx-appt-row label{ display:block; }
@media(max-width:520px){ .mx-appt-row{ grid-template-columns:1fr; } }
.mx-appt-list{ display:flex; flex-direction:column; gap:6px; margin:0 0 12px; }
.mx-appt-list[hidden]{ display:none; }
.mx-appt-choice{
  display:block; width:100%; text-align:left;
  padding:8px 11px; border-radius:9px;
  border:1px solid var(--border, #e5e7eb); background:#fff;
  font:inherit; font-size:13px; color:#334155; cursor:pointer;
}
.mx-appt-choice:hover{ border-color:#99d5cc; background:#f6fdfb; }
.mx-appt-choice.active{ border-color:#0f766e; background:#effcf9; color:#0d5f59; box-shadow:0 0 0 2px rgba(15,118,110,.12); }
.mx-appt-choice b{ font-weight:800; margin-right:4px; }

/* --- To do: Button im Posteingang + Seite /admin/todos --- */
.td-toolbar-btn.mx-todo-btn{ color:#b45309; }
.td-toolbar-btn.mx-todo-btn:hover:not(:disabled){ background:#fff8eb; color:#92400e; }
.mx-todo-added{ margin:0 0 12px; padding-left:20px; font-size:13.5px; line-height:1.6; color:#334155; }
.mx-todo-added[hidden]{ display:none; }


.todo-list{
  margin-top:12px;
  background:var(--panel, #fff); border:1px solid var(--border, #e5e7eb);
  border-radius:16px; box-shadow:var(--shadow); overflow:hidden;
}
.todo-item{ display:flex; align-items:flex-start; gap:12px; padding:12px 14px; border-bottom:1px solid #eef0f4; }
.todo-item:last-child{ border-bottom:0; }
.todo-item:hover{ background:#fafbfd; }
.todo-check{ margin:0; }
.todo-checkbox{
  display:grid; place-items:center;
  width:22px; height:22px; margin-top:1px; padding:0;
  border:2px solid #cbd5e1; border-radius:7px; background:#fff;
  color:transparent; cursor:pointer;
  transition:border-color .12s, background .12s, color .12s;
}
.todo-checkbox:hover{ border-color:#16a34a; color:#86efac; }
.todo-item.is-done .todo-checkbox{ background:#16a34a; border-color:#16a34a; color:#fff; }
.todo-main{ flex:1; min-width:0; }
.todo-title{ font-size:14.5px; font-weight:600; color:#0f172a; line-height:1.4; }
.todo-item.is-done .todo-title{ color:#94a3b8; text-decoration:line-through; font-weight:500; }
.todo-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:6px 12px; margin-top:4px; font-size:12px; color:#64748b; }
.todo-due{ font-weight:700; }
.todo-item.is-overdue .todo-due{ color:#dc2626; }
.todo-person{ display:inline-flex; align-items:center; gap:5px; }
.todo-person .tk-avatar{ width:18px; height:18px; font-size:9px; }
.todo-ticket{ color:#2563eb; text-decoration:none; font-weight:600; }
.todo-ticket:hover{ text-decoration:underline; }
.todo-object{
  display:inline-flex; align-items:center; gap:4px;
  padding:1px 8px; border-radius:999px;
  background:#eef4ff; color:#1e40af; font-weight:700;
}
.todo-object.is-none{ background:#f1f4f9; color:#94a3b8; font-weight:600; }
.todo-item.is-done .todo-object{ background:#f1f4f9; color:#64748b; }
.todo-actions{ display:flex; align-items:center; gap:6px; flex:0 0 auto; }
.todo-actions form{ margin:0; }

/* --- Adressbuch: Button + Kontaktkarte rechts im Posteingang --- */
.td-toolbar-btn.mx-contact-btn{ color:#0369a1; }
.td-toolbar-btn.mx-contact-btn:hover:not(:disabled){ background:#eff8ff; color:#075985; }
.mx-contacts-result{ margin:0 0 12px; padding-left:20px; font-size:13.5px; line-height:1.6; color:#334155; }
.mx-contacts-result[hidden]{ display:none; }

/* Lesebereich: Mailtext links, Kontaktkarte rechts; schmal -> untereinander */
.mx-read-cols{ display:flex; align-items:flex-start; }
.mx-read-cols > .mx-read-body{ flex:1 1 auto; min-width:0; }
.mx-contact-aside{
  flex:0 0 250px;
  position:sticky; top:64px;
  margin:18px 16px 18px 0; padding:14px;
  border:1px solid var(--mx-line); border-radius:14px;
  background:#fbfcfe;
  font-size:12.5px; color:#334155;
}
@container (max-width:760px){
  .mx-read-cols{ flex-direction:column; }
  .mx-contact-aside{ position:static; flex:none; align-self:stretch; margin:0 16px 22px; }
}
.mx-cc-title{ font-size:10.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:#94a3b8; margin-bottom:10px; }
.mx-cc-title-sub{ margin:16px 0 8px; padding-top:12px; border-top:1px solid var(--mx-line); }
.mx-cc-contact + .mx-cc-contact{ margin-top:12px; padding-top:12px; border-top:1px dashed var(--mx-line); }
.mx-cc-head{ display:flex; align-items:center; gap:9px; }
.mx-cc-head .tk-avatar{ width:34px; height:34px; font-size:13px; flex:0 0 auto; }
.mx-cc-contact:not(.is-sender) .mx-cc-head .tk-avatar{ width:26px; height:26px; font-size:11px; }
.mx-cc-id{ min-width:0; }
.mx-cc-name{ font-size:14px; font-weight:750; color:#0f172a; line-height:1.3; overflow-wrap:anywhere; }
.mx-cc-contact:not(.is-sender) .mx-cc-name{ font-size:13px; }
.mx-cc-sub{ font-size:11.5px; color:#64748b; margin-top:1px; }
.mx-cc-fields{ display:grid; grid-template-columns:auto 1fr; gap:4px 10px; margin:10px 0 0; }
.mx-cc-fields dt{ color:#94a3b8; font-weight:700; font-size:11px; padding-top:1px; }
.mx-cc-fields dd{ margin:0; min-width:0; overflow-wrap:anywhere; }
.mx-cc-fields a{ color:#0369a1; text-decoration:none; }
.mx-cc-fields a:hover{ text-decoration:underline; }
.mx-cc-note{ color:#475569; }
.mx-cc-edit{ display:inline-block; margin-top:9px; font-size:11.5px; font-weight:700; color:#64748b; text-decoration:none; }
.mx-cc-edit:hover{ color:#0369a1; }
.mx-cc-empty{ line-height:1.5; color:#475569; }
.mx-cc-empty span{ display:block; margin-top:6px; color:#94a3b8; font-size:12px; }

/* --- Adressbuch-Seite /admin/contacts --- */
.ab-search{ --mx-line:#e3e7ef; --mx-accent:#2563eb; background:#fff; }
.ab-nowrap{ white-space:nowrap; }
.ab-zip-row{ grid-template-columns:120px 1fr; }

/* To do: erledigte To-dos zusammengefasst und zugeklappt unter der Liste */
.todo-done-group{ margin-top:18px; }
.todo-done-group > summary{
  display:inline-flex; align-items:center; gap:7px;
  padding:7px 12px; border-radius:10px;
  font-size:13px; font-weight:750; color:#475569;
  cursor:pointer; list-style:none; user-select:none;
}
.todo-done-group > summary::-webkit-details-marker{ display:none; }
.todo-done-group > summary:hover{ background:#f1f4f9; color:#0f172a; }
.todo-done-chevron{ transition:transform .15s; }
.todo-done-group[open] .todo-done-chevron{ transform:rotate(90deg); }
.todo-done-count{
  min-width:22px; padding:1px 7px; border-radius:999px;
  background:#e8ebf2; color:#475569; font-size:11px; font-weight:800; text-align:center;
}
.todo-done-group > .todo-list{ margin-top:8px; opacity:.92; }

/* --- Neue Mitteilung: Empfaenger aus dem Adressbuch --- */
.msg-ab{ border:1px solid var(--border, #e5e7eb); border-radius:12px; background:var(--bg-soft, #f9fafb); }
.msg-ab-tools{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:10px; border-bottom:1px solid var(--border, #e5e7eb); }
.msg-ab-tools .inp{ flex:1 1 200px; margin:0; }
.msg-ab-list{ max-height:240px; overflow-y:auto; padding:4px 0; }
.msg-ab-item{
  display:grid; grid-template-columns:auto minmax(0,1fr) minmax(0,1.2fr) auto; align-items:center; gap:10px;
  padding:7px 12px; margin:0; cursor:pointer; font-size:13px; font-weight:400;
}
.msg-ab-item[hidden]{ display:none; }
.msg-ab-item:hover{ background:#eef1f7; }
.msg-ab-name{ font-weight:650; color:#0f172a; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.msg-ab-mail{ color:#475569; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.msg-ab-obj{ font-size:11px; font-weight:700; color:#64748b; background:#e8ebf2; border-radius:6px; padding:1px 6px; white-space:nowrap; }
.msg-ab-empty{ padding:10px 12px; }
@media(max-width:640px){ .msg-ab-item{ grid-template-columns:auto 1fr; } .msg-ab-mail, .msg-ab-obj{ grid-column:2; } }

/* Adressbuch: Filterleiste + kompakte Liste (Optik wie Vertragslaufzeiten) */
.ab-filter{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:16px; }
.ab-filter .inp{ flex:0 1 320px; margin:0; }
.ab-filter .sel{ flex:0 1 300px; margin:0; }
.ab-filter-count{ margin-left:auto; }
.ab-list td{ white-space:nowrap; }
.ab-list .ab-col-name{ font-weight:600; color:#111827; }
.ab-list .ab-col-trunc{ max-width:200px; overflow:hidden; text-overflow:ellipsis; }
.ab-list a{ color:#0369a1; text-decoration:none; }
.ab-list a:hover{ text-decoration:underline; }
