:root{--blue:#102b46;--green:#164b38;--green2:#216b50;--bg:#f2f5f4;--text:#17212b;--muted:#6c7880;--line:#dce4e1;--danger:#9e3030}
*{box-sizing:border-box}html,body{min-height:100%}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",sans-serif;background:var(--bg);color:var(--text);display:flex;flex-direction:column}main{flex:1}
header{min-height:74px;background:var(--blue);color:#fff;display:flex;align-items:center;justify-content:space-between;padding:11px max(18px,calc((100% - 1180px)/2));gap:16px}.header-brand{display:flex;align-items:center;gap:11px}.header-brand b{font-size:19px}.header-brand small{display:block;opacity:.7}nav{display:flex;align-items:center;gap:10px}.username{font-size:13px;opacity:.8}.brandmark{width:54px;height:54px;border-radius:14px;background:var(--green);color:#fff;display:grid;place-items:center;font-weight:850;font-size:20px}.smallmark{width:40px;height:40px;border-radius:10px;font-size:14px}
.container{width:100%;max-width:1180px;margin:34px auto;padding:0 18px}.narrow{max-width:720px}.toolbar{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:18px}h1{margin:0 0 5px;color:var(--blue);font-size:30px}.muted{color:var(--muted);margin:0}.button,button{display:inline-block;border:0;border-radius:9px;padding:11px 16px;background:var(--green);color:#fff;text-decoration:none;font:inherit;font-weight:700;cursor:pointer}.button:hover,button:hover{background:var(--green2)}.button.ghost{background:#ffffff17;border:1px solid #ffffff35}.button.secondary{background:#e4ede9;color:var(--green)}
.panel{background:#fff;border:1px solid var(--line);border-radius:16px;padding:28px;box-shadow:0 8px 28px #173d2d12}.login-page{background:linear-gradient(135deg,var(--blue),#11384a 55%,var(--green));color:var(--text)}.login-wrap{width:100%;display:grid;place-items:center;padding:20px}.login-panel{width:min(460px,100%)}.brand{display:flex;align-items:center;gap:15px;margin-bottom:25px}.brand h1{font-size:25px;margin:0}.brand p{margin:3px 0;color:var(--muted)}
label{display:block;font-weight:650;margin-top:17px}input,textarea,select{width:100%;margin-top:7px;padding:12px 13px;border:1px solid #cad6d2;border-radius:9px;background:#fff;font:inherit}textarea{resize:vertical}input:focus,textarea:focus,select:focus{outline:3px solid #216b5022;border-color:var(--green)}form>button{width:100%;margin-top:22px}.alert{background:#fff0f0;color:#8d2222;padding:12px;border-radius:8px}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px}.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:24px}.form-actions button{width:auto;margin:0}
.filters{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:16px}.filterbar{display:flex;align-items:center;gap:6px;padding:7px;background:#e4ebe8;border-radius:10px;overflow:auto}.filterbar span{padding:7px;color:var(--muted);font-size:13px;font-weight:700;white-space:nowrap}.filterbar a{padding:8px 12px;border-radius:7px;text-decoration:none;color:var(--blue);font-size:14px;font-weight:650;white-space:nowrap}.filterbar a.active{background:var(--blue);color:#fff}
.table-wrap{background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden}table{border-collapse:collapse;width:100%}th,td{text-align:left;padding:14px;border-bottom:1px solid var(--line);vertical-align:top}th{background:#eaf0ee;color:var(--blue);font-size:12px;text-transform:uppercase}tr:last-child td{border-bottom:0}.description{line-height:1.45}.status{display:inline-block;padding:5px 9px;border-radius:99px;font-size:12px;font-weight:800}.status.ask{background:#e5edf5;color:#244e70}.status.yes{background:#dceee5;color:#17523b}.status.no{background:#f4dddd;color:#8b2e2e}.actions{white-space:nowrap}.actions a{font-size:13px;color:var(--green);text-decoration:none;margin-right:8px}.actions .delete{color:var(--danger)}.empty{text-align:center;color:var(--muted);padding:35px}
footer{padding:20px;text-align:center;color:#7a858c;font-size:12px}.login-page footer{color:#ffffffaa}
@media(max-width:760px){header{align-items:flex-start}.username{display:none}.header-brand b{font-size:16px}.container{margin:22px auto;padding:0 13px}.toolbar{align-items:flex-start}.toolbar h1{font-size:25px}.grid2{grid-template-columns:1fr}.filters{display:block}.filterbar{width:100%;margin-bottom:8px}.table-wrap{background:transparent;border:0;overflow:visible}table,tbody,tr,td{display:block}thead{display:none}tr{background:#fff;border:1px solid var(--line);border-radius:13px;margin-bottom:12px;padding:11px}td{border:0;padding:7px 7px 7px 39%;position:relative;min-height:34px}td:before{content:attr(data-label);position:absolute;left:7px;width:34%;font-size:12px;font-weight:800;color:var(--blue)}td.actions{padding:10px 7px 5px}.actions:before{display:none}.empty{padding:24px}.panel{padding:20px}}

.top-actions{display:flex;gap:8px;flex-wrap:wrap}.type{display:inline-block;padding:5px 9px;border-radius:99px;font-size:12px;font-weight:800;white-space:nowrap}.type.practice{background:#dceee5;color:#17523b}.type.event{background:#dce8f4;color:#173f65}.type.meeting{background:#eee5f4;color:#603b72}.modified{font-size:12px;white-space:nowrap;color:#59666d}.modified small{color:#7a858c}.history-intro{margin-bottom:18px}.danger-button{background:#9e3030}.danger-button:hover{background:#7e2222}@media(max-width:760px){.top-actions{justify-content:flex-end}.toolbar{flex-wrap:wrap}}

/* Version 4 overrides */
.type.practice{background:#fff0b8;color:#705500;border:1px solid #e0c35b}.type.event{background:#eadcff;color:#5c2d83;border:1px solid #c2a0e3}.type.meeting{background:#ffe0c2;color:#87460d;border:1px solid #e5a96f}.focused{outline:3px solid #d9b64c;outline-offset:-3px;background:#fffbed}.termin-link{color:var(--green);text-decoration:none}.termin-link:hover{text-decoration:underline}

/* Version 7 – Mobile Optimierung */
@media (max-width:760px){
 body{font-size:15px}
 header{padding:12px 14px;gap:10px;align-items:flex-start;flex-wrap:wrap}
 .header-brand{min-width:0}.header-brand b{font-size:16px;line-height:1.2}.header-brand small{font-size:11px}
 header nav{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px}
 .username{min-width:0;overflow-wrap:anywhere}
 .container{width:auto;margin:0;padding:16px 12px 28px}.narrow{max-width:none}
 .toolbar{display:block}.toolbar h1{margin-bottom:3px}
 .top-actions{margin-top:12px;display:grid;grid-template-columns:1fr 1fr;width:100%}
 .top-actions .button{width:100%;text-align:center;box-sizing:border-box}
 .filters{padding:12px}
 .filterbar{display:flex;overflow-x:auto;flex-wrap:nowrap;gap:6px;padding-bottom:4px;scrollbar-width:thin}
 .filterbar>span,.filterbar>a{flex:0 0 auto;white-space:nowrap}
 .table-wrap{overflow:visible;background:transparent;border:0;box-shadow:none}
 table,thead,tbody,tr,th,td{display:block;width:100%;box-sizing:border-box}
 thead{display:none} tbody{display:grid;gap:12px}
 tbody tr{background:#fff;border:1px solid #d9e0df;border-radius:12px;padding:12px 14px;box-shadow:0 2px 8px rgba(0,0,0,.055);overflow:hidden}
 tbody tr.focused{outline:3px solid #d9b64c;outline-offset:0;background:#fffbed}
 tbody td{border:0;padding:6px 0 6px 42%;min-height:29px;position:relative;overflow-wrap:anywhere}
 tbody td::before{content:attr(data-label);position:absolute;left:0;top:6px;width:38%;font-weight:700;color:#173f65}
 tbody td[data-label="Titel"]{padding:2px 0 10px;font-size:17px;border-bottom:1px solid #edf0ef;margin-bottom:4px}
 tbody td[data-label="Titel"]::before{display:none}
 tbody td[data-label="Beschreibung"]{white-space:normal}
 tbody td.actions{padding:10px 0 0;margin-top:4px;border-top:1px solid #edf0ef;display:flex;gap:7px;flex-wrap:wrap}
 tbody td.actions::before{display:none}
 tbody td.actions a{flex:1 1 auto;text-align:center;padding:9px 8px;border-radius:8px;background:#edf4f1;text-decoration:none;min-width:80px}
 tbody td.actions a.delete{background:#f8e8e8}
 tbody td.empty{padding:18px;text-align:center}tbody td.empty::before{display:none}
 .type,.status{font-size:12px}
 .panel{padding:16px;border-radius:12px}.grid2{display:block}
 input,select,textarea,button,.button{min-height:44px;font-size:16px}
 textarea{min-height:130px}
 .form-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 .form-actions>*{width:100%;box-sizing:border-box;text-align:center}
 footer{padding:14px 10px;font-size:11px;text-align:center}
}
@media (max-width:420px){
 .top-actions{grid-template-columns:1fr}
 tbody td{padding-left:39%}tbody td::before{width:35%}
 .form-actions{grid-template-columns:1fr}
}

/* Version 26 – Hamburger-Menü */
.menu-wrap{position:relative}.menu-toggle{width:44px;height:44px;min-height:44px;padding:0;border:1px solid #ffffff35;background:#ffffff17;color:#fff;border-radius:9px;font-size:24px;line-height:1}.menu-toggle:hover{background:#ffffff28}.menu-dropdown{display:none;position:absolute;right:0;top:50px;z-index:1000;min-width:210px;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 10px 28px #0003;padding:6px}.menu-dropdown.open{display:block}.menu-dropdown a{display:block;padding:11px 12px;border-radius:7px;color:var(--blue);text-decoration:none;font-weight:650;white-space:nowrap}.menu-dropdown a:hover{background:#edf4f1}@media(max-width:760px){header nav{width:auto;margin-left:auto;justify-content:flex-end}.menu-dropdown{position:fixed;right:12px;top:64px}.top-actions{grid-template-columns:1fr 1fr}}@media(max-width:420px){.top-actions{grid-template-columns:1fr}}

.date-range{align-items:center;flex-wrap:wrap}
.date-range label{display:flex;align-items:center;gap:6px;margin:0}
.date-range input[type=date]{width:auto;min-width:145px}
@media(max-width:700px){
 .date-range{align-items:stretch}
 .date-range label{justify-content:space-between;width:100%}
 .date-range input[type=date]{flex:1;max-width:210px}
}

/* V29 kompakte automatische Terminfilter */
.date-range select{min-width:150px;padding:8px 10px;border:1px solid #cfd6df;border-radius:8px;background:#fff}
.date-range input[type=date]{padding:7px 9px}
@media(max-width:700px){
 .date-range label{width:100%;display:grid;grid-template-columns:55px 1fr;align-items:center;gap:8px}
 .date-range input[type=date],.date-range select{width:100%;max-width:none;box-sizing:border-box}
}

/* V31 Mehrfachauswahl Art/Status */
.multi-filter{position:relative}
.multi-filter-toggle{padding:8px 10px;border:1px solid #cfd6df;border-radius:8px;background:#fff;cursor:pointer;white-space:nowrap}
.multi-filter-menu{display:none;position:absolute;z-index:50;top:calc(100% + 4px);left:0;min-width:210px;padding:8px;background:#fff;border:1px solid #cfd6df;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.14)}
.multi-filter.open .multi-filter-menu{display:block}
.multi-filter-menu label{display:flex!important;grid-template-columns:none!important;justify-content:flex-start!important;align-items:center!important;gap:8px!important;width:auto!important;padding:7px 8px;margin:0;border-radius:6px;cursor:pointer}
.multi-filter-menu label:hover{background:#f2f5f8}
.multi-filter-menu input[type=checkbox]{width:auto!important;max-width:none!important;flex:none!important}
@media(max-width:700px){
 .multi-filter{width:100%}
 .multi-filter-toggle{width:100%;text-align:left}
 .multi-filter-menu{position:static;width:100%;box-sizing:border-box;margin-top:4px}
}

/* V32: robuste Filterleiste / schwebende Mehrfachauswahl */
#terminFilter.date-range{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  overflow:visible !important;
  position:relative;
}
#terminFilter.date-range > label{
  display:flex !important;
  align-items:center !important;
  gap:7px !important;
  width:auto !important;
  margin:0 !important;
}
#terminFilter .multi-filter{
  position:relative !important;
  display:inline-block !important;
  width:auto;
  flex:0 0 auto;
}
#terminFilter .multi-filter-toggle{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-width:175px;
  height:42px;
  box-sizing:border-box;
  overflow:visible;
}
#terminFilter .multi-filter-menu{
  display:none !important;
  position:absolute !important;
  left:0 !important;
  top:calc(100% + 5px) !important;
  z-index:1000 !important;
  min-width:220px;
  width:max-content;
  max-width:min(320px,calc(100vw - 24px));
  height:auto !important;
  max-height:none !important;
  overflow:visible !important;
  margin:0 !important;
}
#terminFilter .multi-filter.open > .multi-filter-menu{
  display:block !important;
}
#terminFilter .multi-filter-menu label{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-start !important;
  width:auto !important;
  white-space:nowrap;
}
#terminFilter .multi-filter-menu input[type=checkbox]{
  width:auto !important;
  height:auto !important;
  margin:0 7px 0 0 !important;
}
@media(max-width:700px){
  #terminFilter.date-range{
    display:grid;
    grid-template-columns:1fr;
    overflow:visible !important;
  }
  #terminFilter.date-range > label,
  #terminFilter .multi-filter{
    width:100% !important;
  }
  #terminFilter .multi-filter-toggle{
    width:100%;
  }
  #terminFilter .multi-filter-menu{
    position:absolute !important;
    width:100%;
    min-width:0;
  }
}

/* V33 Mobile Termin-Accordion */
.mobile-termin-summary{display:none}
@media(max-width:700px){
  .termin-row{
    display:block;
    margin:0 0 10px 0;
    border:1px solid #d8e0e5;
    border-radius:10px;
    background:#fff;
    overflow:hidden;
  }
  .termin-row > td{
    display:none !important;
  }
  .termin-row > .mobile-termin-summary{
    display:block !important;
    padding:0 !important;
    border:0 !important;
  }
  .mobile-card-toggle{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:12px 14px;
    border:0;
    background:#fff;
    text-align:left;
    cursor:pointer;
    color:inherit;
  }
  .mobile-card-main{
    min-width:0;
    display:grid;
    grid-template-columns:auto auto 1fr;
    align-items:center;
    gap:10px;
    width:100%;
  }
  .mobile-card-title{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-weight:600;
  }
  .mobile-card-arrow{
    flex:0 0 auto;
    transition:transform .15s ease;
  }
  .termin-row.mobile-open .mobile-card-arrow{
    transform:rotate(180deg);
  }
  .termin-row.mobile-open > td:not(.mobile-termin-summary){
    display:block !important;
    padding:8px 14px !important;
    border-top:1px solid #edf0f2;
  }
  .termin-row.mobile-open > td:not(.mobile-termin-summary)::before{
    font-weight:600;
  }
}
@media(max-width:480px){
  .mobile-card-main{
    grid-template-columns:auto auto;
    gap:4px 10px;
  }
  .mobile-card-title{
    grid-column:1 / -1;
    white-space:normal;
  }
}

/* V35: kompakte, saubere geöffnete Mobile-Card */
@media(max-width:700px){
  .termin-row{
    border-radius:10px;
  }
  .mobile-card-toggle{
    padding:12px 14px !important;
    min-height:72px;
    border-radius:10px;
  }
  .termin-row.mobile-open .mobile-card-toggle{
    border-radius:10px 10px 0 0;
  }

  /* Datum, Zeit und Titel stehen bereits im Card-Kopf und werden unten nicht wiederholt. */
  .termin-row.mobile-open > td.detail-duplicate{
    display:none !important;
  }

  /* Detailzeilen: Beschriftung und Inhalt sauber nebeneinander. */
  .termin-row.mobile-open > td:not(.mobile-termin-summary):not(.detail-duplicate){
    display:grid !important;
    grid-template-columns:105px minmax(0,1fr);
    align-items:start;
    column-gap:10px;
    row-gap:0;
    padding:10px 14px !important;
    min-height:0 !important;
    line-height:1.35;
  }
  .termin-row.mobile-open > td:not(.mobile-termin-summary):not(.detail-duplicate)::before{
    position:static !important;
    display:block !important;
    width:auto !important;
    margin:0 !important;
    padding:0 !important;
    line-height:1.35 !important;
  }
  .termin-row.mobile-open > td:not(.mobile-termin-summary):not(.detail-duplicate) > *{
    min-width:0;
  }

  /* Aktionszelle über die volle Breite, ohne Label-Spalte. */
  .termin-row.mobile-open > td:last-child{
    display:flex !important;
    flex-wrap:wrap;
    gap:8px;
    padding:12px 14px !important;
  }
  .termin-row.mobile-open > td:last-child::before{
    display:none !important;
  }
}
@media(max-width:480px){
  .termin-row.mobile-open > td:not(.mobile-termin-summary):not(.detail-duplicate){
    grid-template-columns:92px minmax(0,1fr);
  }
  .mobile-card-toggle{
    min-height:68px;
  }
}

/* V38: RT-Logo als zuverlässiger Home-Button */
.header-brand .brand-home{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  position:relative;
  z-index:20;
  text-decoration:none !important;
  color:inherit !important;
  cursor:pointer;
  pointer-events:auto !important;
  touch-action:manipulation;
}
.header-brand .brand-home .brandmark{
  pointer-events:none;
}
.header-brand .brand-home:focus-visible{
  outline:3px solid rgba(255,255,255,.9);
  outline-offset:3px;
  border-radius:10px;
}

/* V43: globaler RT-Home-Link */
.brand-home{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  position:relative;
  z-index:50;
  text-decoration:none !important;
  color:inherit !important;
  cursor:pointer;
  pointer-events:auto !important;
  touch-action:manipulation;
}
.brand-home .brandmark{pointer-events:none}

/* V47: Hilfe */
.help-page{display:grid;gap:14px;margin-top:16px}
.help-card{padding:18px}
.help-card h2{margin:0 0 8px}
.help-card p{margin:7px 0;line-height:1.5}
.help-list{display:grid;grid-template-columns:minmax(120px,170px) 1fr;gap:8px 16px;margin:12px 0 0}
.help-list dt{font-weight:700}
.help-list dd{margin:0;line-height:1.45}
@media(max-width:600px){
 .help-card{padding:14px}
 .help-list{grid-template-columns:1fr;gap:3px}
 .help-list dd{margin:0 0 9px}
}

/* V50: robustes Hamburger-Dropdown für Chrome/Brave */
.menu{
  position:relative;
  z-index:1000;
}
.menu-dropdown{
  box-sizing:border-box;
}
@media(max-width:700px){
  .topbar,
  .topbar .container,
  header{
    overflow:visible !important;
  }

  .menu{
    position:relative !important;
    display:block !important;
    flex:0 0 auto !important;
    z-index:1000 !important;
  }

  .menu-dropdown{
    position:absolute !important;
    top:100% !important;
    right:0 !important;
    left:auto !important;

    display:none !important;
    flex-direction:column !important;
    align-items:stretch !important;

    width:240px !important;
    min-width:0 !important;
    max-width:calc(100vw - 32px) !important;
    height:auto !important;

    margin-top:8px !important;
    padding:8px !important;
    box-sizing:border-box !important;

    overflow:hidden !important;
    z-index:2000 !important;
  }

  .menu.open .menu-dropdown,
  .menu-dropdown.open,
  .menu-dropdown.show{
    display:flex !important;
  }

  .menu-dropdown a{
    display:block !important;
    flex:none !important;
    width:auto !important;
    max-width:100% !important;
    min-width:0 !important;

    margin:0 !important;
    padding:11px 12px !important;
    box-sizing:border-box !important;

    white-space:normal !important;
    overflow-wrap:anywhere !important;
    word-break:normal !important;

    line-height:1.3 !important;
    text-align:left !important;
  }
}

/* V54: Zurück bei Terminansicht aus „Letzte Änderungen“ */
.focus-back-wrap{margin:0 0 12px}


/* V56: Mobile Cards – Titelfarbe entspricht dem jeweiligen Status */
@media(max-width:700px){
  .mobile-card-title.ask{color:#244e70 !important}
  .mobile-card-title.yes{color:#17523b !important}
  .mobile-card-title.no{color:#8b2e2e !important}
}

/* V57: eigener Farbstatus für Information */
.status.info{background:#e5e7eb;color:#4b5563;border-color:#cbd5e1}
@media(max-width:700px){
  .mobile-card-title.info{color:#4b5563 !important}
}

/* V59: Desktop-Kurzfassung */
.compact-head,.compact-date,.compact-time,.compact-title,.compact-actions{display:none}
@media(min-width:701px){
  .desktop-compact-toggle{display:inline-flex}

  #terminTable.desktop-compact .normal-head{display:none}
  #terminTable.desktop-compact .compact-head{display:table-row}
  #terminTable.desktop-compact .termin-row>td{display:none}
  #terminTable.desktop-compact .termin-row>.compact-date,
  #terminTable.desktop-compact .termin-row>.compact-time,
  #terminTable.desktop-compact .termin-row>.compact-title,
  #terminTable.desktop-compact .termin-row>.compact-actions{display:table-cell}
  #terminTable.desktop-compact .compact-date{white-space:nowrap;width:120px}
  #terminTable.desktop-compact .compact-time{white-space:nowrap;width:130px}
  #terminTable.desktop-compact .compact-title strong{display:block}
  #terminTable.desktop-compact .compact-title div{margin-top:3px;font-size:.92em;opacity:.78}

  #terminTable.desktop-single-detail .compact-hidden-row{display:none}
  #terminTable.desktop-single-detail .compact-date,
  #terminTable.desktop-single-detail .compact-time,
  #terminTable.desktop-single-detail .compact-title{display:none}
}
@media(max-width:700px){
  .desktop-compact-toggle{display:none !important}
  .compact-head,.compact-date,.compact-time,.compact-title,.compact-actions{display:none !important}
}

/* V63: Art und Status unter Bemerkungen in der Desktop-Standardansicht */
@media(min-width:701px){
  #terminTable.desktop-compact .compact-remarks{
    margin-top:3px;
    font-size:.92em;
    opacity:.78;
  }
  #terminTable.desktop-compact .compact-meta{
    display:flex;
    gap:6px;
    align-items:center;
    flex-wrap:wrap;
    margin-top:6px;
  }
  #terminTable.desktop-compact .compact-meta .type,
  #terminTable.desktop-compact .compact-meta .status{
    font-size:.78em;
  }
}

/* V66: anklickbare Terminzeilen nur für Planner/Admin */
@media(min-width:701px){
  body.planner-clickable #terminTable.desktop-compact .termin-row{cursor:pointer}
}

/* V67: Desktop-Kurzfassung strikt von Mobile-Cards trennen */
@media(max-width:700px){
  #terminTable .compact-date,
  #terminTable .compact-time,
  #terminTable .compact-title,
  #terminTable .compact-meta,
  #terminTable .compact-remarks{
    display:none !important;
  }

}

/* V69: Mobile Cards aufgeräumt und kompakter */
@media(max-width:700px){
  #terminTable .termin-row{
    border-radius:14px;
    overflow:hidden;
  }

  /* Kopfbereich kompakter */
  #terminTable .mobile-summary{
    padding:14px 16px !important;
    min-height:0 !important;
  }

  #terminTable .mobile-summary-date,
  #terminTable .mobile-summary-time{
    font-size:1rem !important;
    line-height:1.25 !important;
  }

  #terminTable .mobile-card-title{
    margin-top:5px !important;
    font-size:1.08rem !important;
    line-height:1.25 !important;
    font-weight:700 !important;
  }

  /* Aufgeklappte Details ruhiger und platzsparender */
  #terminTable .termin-row.open td[data-label]{
    padding-top:10px !important;
    padding-bottom:10px !important;
  }

  #terminTable .termin-row.open td[data-label]::before{
    font-size:.82rem !important;
    line-height:1.2 !important;
    opacity:.82;
  }

  #terminTable .termin-row.open td[data-label="Titel"]{
    display:none !important; /* Titel steht bereits im Card-Kopf */
  }

  #terminTable .termin-row.open td[data-label="Datum"],
  #terminTable .termin-row.open td[data-label="Zeit"]{
    display:none !important; /* Datum/Zeit stehen bereits im Card-Kopf */
  }

  #terminTable .termin-row.open td[data-label="Bemerkungen"]{
    line-height:1.4 !important;
  }

  #terminTable .termin-row.open td[data-label="Art"],
  #terminTable .termin-row.open td[data-label="Status"]{
    min-height:46px;
  }

  /* Aktionsbuttons kompakt in einer Zeile, soweit Displaybreite reicht */
  #terminTable .termin-row.open td:last-child{
    gap:7px !important;
    padding-top:12px !important;
  }

  #terminTable .termin-row.open td:last-child .button,
  #terminTable .termin-row.open td:last-child a{
    padding:9px 12px !important;
    font-size:.9rem !important;
  }
}

/* V70: Mobile aufgeklappt nur noch einspaltig */
@media(max-width:700px){
  #terminTable .termin-row.open td[data-label]{
    display:block !important;
    width:100% !important;
    grid-template-columns:none !important;
  }

  #terminTable .termin-row.open td[data-label]::before{
    display:block !important;
    width:auto !important;
    margin:0 0 4px 0 !important;
  }

  #terminTable .termin-row.open td[data-label="Datum"],
  #terminTable .termin-row.open td[data-label="Zeit"],
  #terminTable .termin-row.open td[data-label="Titel"]{
    display:none !important;
  }

  #terminTable .termin-row.open td[data-label="Bemerkungen"],
  #terminTable .termin-row.open td[data-label="Art"],
  #terminTable .termin-row.open td[data-label="Status"],
  #terminTable .termin-row.open td[data-label="Geändert"]{
    text-align:left !important;
  }
}

/* V71: Mobile – Art und Status gemeinsam in einer Zeile */
@media(max-width:700px){
  #terminTable .termin-row.open td[data-label="Art"],
  #terminTable .termin-row.open td[data-label="Status"]{
    display:inline-block !important;
    width:auto !important;
    min-height:0 !important;
    padding-top:8px !important;
    padding-bottom:8px !important;
    margin-right:6px !important;
    vertical-align:middle !important;
  }

  #terminTable .termin-row.open td[data-label="Art"]::before,
  #terminTable .termin-row.open td[data-label="Status"]::before{
    display:none !important;
    content:none !important;
  }
}

/* V72: Mobile Art + Status wirklich in EINEM Feld */
.mobile-type-status{display:none}

@media(max-width:700px){
  #terminTable .termin-row.open td.mobile-type-status{
    display:flex !important;
    width:100% !important;
    box-sizing:border-box !important;
    align-items:center !important;
    flex-wrap:wrap !important;
    gap:8px !important;
    padding-top:8px !important;
    padding-bottom:8px !important;
  }

  /* Die bisherigen getrennten Tabellenfelder auf Mobile nicht mehr anzeigen */
  #terminTable .termin-row.open td[data-label="Art"],
  #terminTable .termin-row.open td[data-label="Status"]{
    display:none !important;
  }

  #terminTable .termin-row.open td.mobile-type-status::before{
    display:none !important;
    content:none !important;
  }
}

@media(min-width:701px){
  #terminTable td.mobile-type-status{display:none !important}
}

/* V73 FINAL Mobile Card Fix
   Wichtig: Die echte Aufklapp-Klasse heißt .mobile-open (nicht .open). */
@media(max-width:700px){

  /* Desktop-only / duplicated cells never appear in mobile cards */
  #terminTable .termin-row.mobile-open > td.compact-date,
  #terminTable .termin-row.mobile-open > td.compact-time,
  #terminTable .termin-row.mobile-open > td.compact-title,
  #terminTable .termin-row.mobile-open > td.detail-duplicate,
  #terminTable .termin-row.mobile-open > td[data-label="Titel"],
  #terminTable .termin-row.mobile-open > td[data-label="Art"],
  #terminTable .termin-row.mobile-open > td[data-label="Status"]{
    display:none !important;
  }

  /* Bemerkungen: one full-width field, no two-column label/value layout */
  #terminTable .termin-row.mobile-open > td[data-label="Bemerkungen"]{
    display:block !important;
    width:100% !important;
    box-sizing:border-box !important;
    grid-template-columns:none !important;
    text-align:left !important;
    padding:10px 14px !important;
  }

  #terminTable .termin-row.mobile-open > td[data-label="Bemerkungen"]::before{
    display:block !important;
    width:auto !important;
    margin:0 0 4px 0 !important;
  }

  /* Art + Status: exactly ONE shared mobile field */
  #terminTable .termin-row.mobile-open > td.mobile-type-status{
    display:flex !important;
    width:100% !important;
    box-sizing:border-box !important;
    grid-template-columns:none !important;
    align-items:center !important;
    justify-content:flex-start !important;
    flex-wrap:wrap !important;
    gap:8px !important;
    text-align:left !important;
    padding:8px 14px 12px !important;
  }

  #terminTable .termin-row.mobile-open > td.mobile-type-status::before{
    display:none !important;
    content:none !important;
  }

  /* Changed/action rows also use one full-width field */
  #terminTable .termin-row.mobile-open > td[data-label="Geändert"]{
    display:block !important;
    width:100% !important;
    box-sizing:border-box !important;
    grid-template-columns:none !important;
    text-align:left !important;
    padding:10px 14px !important;
  }

  #terminTable .termin-row.mobile-open > td[data-label="Geändert"]::before{
    display:block !important;
    width:auto !important;
    margin:0 0 4px 0 !important;
  }
}

/* V75: Mobile Card – selektierter/aufgeklappter Kopf besser lesbar */
@media(max-width:700px){
  #terminTable .termin-row.mobile-open .mobile-summary,
  #terminTable .termin-row.mobile-open .mobile-summary *{
    color:#fff !important;
  }

  #terminTable .termin-row.mobile-open .mobile-card-title,
  #terminTable .termin-row.mobile-open .mobile-summary-date,
  #terminTable .termin-row.mobile-open .mobile-summary-time{
    color:#fff !important;
  }
}

/* V76: Datum und Uhrzeit im geöffneten Mobile-Card-Kopf */
@media(max-width:700px){
  #terminTable .termin-row.mobile-open .mobile-card-main > strong,
  #terminTable .termin-row.mobile-open .mobile-card-main > span:not(.mobile-card-title){
    color:#fff !important;
  }
}

/* V78: Seitentitel der Terminübersicht auf Mobile ausblenden */
@media(max-width:700px){
  main.container > h1:first-of-type,
  main.container > h1:first-of-type + .muted{
    display:none !important;
  }
}

/* V79: Termin-Seitentitel auf Mobile gezielt ausblenden */
@media(max-width:700px){
  .appointments-heading{
    display:none !important;
  }
}

/* V80: Mobile – Abstand zwischen Header und Inhalt deutlich reduzieren */
@media(max-width:700px){
  main.container{
    padding-top:6px !important;
    margin-top:0 !important;
  }

  .toolbar{
    margin-top:0 !important;
    padding-top:0 !important;
  }
}

/* V81: Mobile Alle-Cards-Steuerung */
.mobile-card-controls{display:none}
@media(max-width:700px){
  .mobile-card-controls{
    display:flex;
    justify-content:flex-end;
    margin:0 0 8px 0;
  }
  .mobile-card-controls .button{
    padding:7px 11px;
    font-size:.88rem;
  }
}

/* V81: Art-/Status-Auswahl in geschlossenem UND geöffnetem Zustand lesbar.
   Nur Formulare/Filter; Badges in Cards/Tabellen bleiben unverändert. */
select[name="type"],
select[name="status"],
#typeFilter,
#statusFilter,
select.art-select,
select.status-select{
  color:#1f2937 !important;
  background-color:#fff !important;
}

select[name="type"] option,
select[name="status"] option,
#typeFilter option,
#statusFilter option,
select.art-select option,
select.status-select option{
  color:#1f2937 !important;
  background:#fff !important;
}

/* V82: Mobile Card Header – auch nach „Alle aufklappen“ sicher lesbar */
@media(max-width:700px){
  #terminTable .termin-row.mobile-open .mobile-card-header,
  #terminTable .termin-row.mobile-open .mobile-card-header *,
  #terminTable .termin-row.mobile-open .mobile-card-main,
  #terminTable .termin-row.mobile-open .mobile-card-main *{
    color:#fff !important;
  }

  #terminTable .termin-row.mobile-open .mobile-card-header a,
  #terminTable .termin-row.mobile-open .mobile-card-header button{
    color:#fff !important;
  }
}

/* V83: Mobile Cards – Aufklappen entspricht exakt dem Einzelklick */
@media(max-width:700px){
  #terminTable .termin-row.mobile-open .mobile-card-main{
    min-height:0 !important;
    height:auto !important;
    padding-top:12px !important;
    padding-bottom:12px !important;
  }

  #terminTable .termin-row.mobile-open .mobile-card-header{
    min-height:0 !important;
    height:auto !important;
  }
}

/* V84: Alle auf/zu stabil; echten Card-Kopf (.mobile-card-main) sichtbar halten */
@media(max-width:700px){
  #terminTable .termin-row.mobile-open .mobile-card-main{
    display:grid !important;
    min-height:0 !important;
    height:auto !important;
    opacity:1 !important;
    visibility:visible !important;
    padding-top:12px !important;
    padding-bottom:12px !important;
  }

  #terminTable .termin-row.mobile-open .mobile-card-main > strong,
  #terminTable .termin-row.mobile-open .mobile-card-main > span,
  #terminTable .termin-row.mobile-open .mobile-card-title{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    color:#fff !important;
  }
}

/* V85: Mobile Card-Header kontrastabhängig statt pauschal weiß */
@media(max-width:700px){
  /* Light Mode / Standard: dunkle Schrift auf hellem Card-Kopf */
  #terminTable .termin-row.mobile-open .mobile-card-main,
  #terminTable .termin-row.mobile-open .mobile-card-main *,
  #terminTable .termin-row.mobile-open .mobile-card-title{
    color:#17212b !important;
  }
}

@media(max-width:700px) and (prefers-color-scheme:dark){
  /* Dark Mode: helle Schrift auf dunklem Card-Kopf */
  #terminTable .termin-row.mobile-open .mobile-card-main,
  #terminTable .termin-row.mobile-open .mobile-card-main *,
  #terminTable .termin-row.mobile-open .mobile-card-title{
    color:#fff !important;
  }
}

/* V86: Geöffneter Mobile-Card-Kopf bekommt eigenes festes Kontrastpaar.
   Nicht mehr vom Browser-/Dark-Mode abhängig. */
@media(max-width:700px){
  #terminTable .termin-row.mobile-open .mobile-card-main{
    background:#176b4a !important;
    color:#fff !important;
  }

  #terminTable .termin-row.mobile-open .mobile-card-main > strong,
  #terminTable .termin-row.mobile-open .mobile-card-main > span,
  #terminTable .termin-row.mobile-open .mobile-card-main .mobile-card-title,
  #terminTable .termin-row.mobile-open .mobile-card-main *{
    color:#fff !important;
  }
}

/* V88: geöffnet und selektiert sind zwei getrennte Zustände */
@media(max-width:700px){
  /* Bulk-geöffnet / nicht selektiert: normale Kopfgestaltung beibehalten.
     Die V86-Hervorhebung von mobile-open wird neutralisiert. */
  #terminTable .termin-row.mobile-open:not(.mobile-selected) .mobile-card-main{
    background:initial !important;
    color:initial !important;
  }
  #terminTable .termin-row.mobile-open:not(.mobile-selected) .mobile-card-main > strong,
  #terminTable .termin-row.mobile-open:not(.mobile-selected) .mobile-card-main > span,
  #terminTable .termin-row.mobile-open:not(.mobile-selected) .mobile-card-main .mobile-card-title,
  #terminTable .termin-row.mobile-open:not(.mobile-selected) .mobile-card-main *{
    color:initial !important;
  }

  /* Nur die einzeln angeklickte/selektierte Card hervorheben. */
  #terminTable .termin-row.mobile-selected .mobile-card-main{
    background:#176b4a !important;
    color:#fff !important;
  }
  #terminTable .termin-row.mobile-selected .mobile-card-main > strong,
  #terminTable .termin-row.mobile-selected .mobile-card-main > span,
  #terminTable .termin-row.mobile-selected .mobile-card-main .mobile-card-title,
  #terminTable .termin-row.mobile-selected .mobile-card-main *{
    color:#fff !important;
  }
}

/* V88 DEBUG – Headerfarbe, bewusst nur DEBUG */
body.debug-build > header,
body.debug-build .topbar,
body.debug-build .topbar > .container {
  background-color:#AEEBE4 !important;
  background-image:none !important;
}
body.debug-build > header,
body.debug-build > header .header-brand,
body.debug-build > header .header-brand *,
body.debug-build > header .username,
body.debug-build > header nav {
  color:#17212b !important;
}
body.debug-build > header .menu-toggle {
  color:#17212b !important;
  border-color:rgba(23,33,43,.22) !important;
  background:rgba(255,255,255,.38) !important;
}


/* V91 DEBUG: Planner/Admin-Schnellaktionen mit Änderungsinfo */
@media(min-width:701px){
  #terminTable .compact-actions-head{width:170px;text-align:center;white-space:nowrap}
  #terminTable.desktop-compact .compact-actions{
    width:170px;
    padding:8px 10px;
    text-align:center;
    white-space:nowrap;
    vertical-align:middle;
  }
  #terminTable .compact-action{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:30px;
    height:30px;
    margin:0 2px;
    border:1px solid #cbd8d3;
    border-radius:7px;
    background:#f6faf8;
    color:var(--green);
    text-decoration:none;
    vertical-align:middle;
  }
  #terminTable .compact-action:hover{background:#e6f1ec;border-color:#a9c2b8}
  #terminTable .compact-action svg{width:16px;height:16px;fill:currentColor;display:block}
  #terminTable .compact-action-delete{color:var(--danger);background:#fff7f7;border-color:#e7caca}
  #terminTable .compact-action-delete:hover{background:#f8e8e8;border-color:#d7a8a8}
  #terminTable .compact-action-icons{display:block;white-space:nowrap}
  #terminTable .compact-modified{margin-top:6px;line-height:1.25;font-size:10px;color:#69767d;white-space:normal;text-align:center}
  #terminTable .compact-modified span{display:block}
  #terminTable .compact-modified small{display:block;margin-top:2px;font-size:10px;color:#7c878d}
}
