: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) */
.badge.wait{opacity:.9;}
.badge.exec{opacity:.9;}


/* 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.wait{
  background: rgba(168,85,247,0.10);
  border-color: rgba(168,85,247,0.22);
  color: rgba(88,28,135,0.95);
}
.badge.exec{
  background: rgba(16,185,129,0.10);
  border-color: rgba(16,185,129,0.22);
  color: rgba(6,95,70,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: 500px 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:13px; }
.td-table thead th{
  position:sticky; top:0;
  background:var(--td-cyan);
  color:#0b5566;
  text-align:left;
  font-size:11px; font-weight:900; text-transform:uppercase; letter-spacing:.03em;
  padding:10px 12px;
  border-bottom:2px solid var(--td-cyan-line);
  z-index:1;
}
.td-col-status{ width:28px; }
.td-col-date{ width:100px; }
.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:10px 12px; vertical-align:top; }
.td-col-status{ padding-top:15px; }
.td-row-dot{
  display:inline-block;
  width:9px;height:9px;border-radius:999px;
  background:#94a3b8;
}
.td-row-dot.status-open{ background:#3b82f6; }
.td-row-dot.status-work{ background:#f59e0b; }
.td-row-dot.status-wait{ background:#a855f7; }
.td-row-dot.status-exec{ background:#10b981; }
.td-row-dot.status-done{ background:#94a3b8; }
.td-row-topline{ display:flex; align-items:center; gap:8px; margin-bottom:2px; }
.td-row-no{ font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11px; font-weight:800; color:var(--muted); }
.td-row-subject{
  font-weight:800; font-size:13px; line-height:1.3;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:340px;
}
.td-row.active .td-row-subject{ color:#0b5566; }
.td-row-snippet{
  font-size:12px; color:var(--muted); margin-top:2px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:340px;
}
.td-row-snippet b{ color:#374151; font-weight:800; }
.td-row-snippet .tk-avatar{ width:16px; height:16px; font-size:9px; vertical-align:-3px; margin-right:2px; }
.td-col-date{ color:var(--muted); font-size:12px; font-weight:800; white-space:nowrap; padding-top:11px; }

/* 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:19px; 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:5px;
  min-width:78px;
  padding:10px 14px 8px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#fff;
  color:#334155;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
  line-height:1.2;
}
.td-toolbar-btn svg{ width:22px; height:22px; 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: 420px 1fr; }
  .td-row-subject, .td-row-snippet{ max-width:260px; }
}
@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; }

.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; }

/* 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; }
