/* Fira-Schriften lokal: WOFF2-Dateien bei Bedarf nach assets/fonts/ hochladen.
   Fallback bleibt Systemschrift, solange keine Fira-Dateien vorhanden sind. */
@font-face{font-family:'Fira Sans';src:local('Fira Sans Regular'),url('fonts/FiraSans-Regular.woff2') format('woff2');font-style:normal;font-weight:400;font-display:swap}
@font-face{font-family:'Fira Sans';src:local('Fira Sans Bold'),url('fonts/FiraSans-Bold.woff2') format('woff2');font-style:normal;font-weight:700 900;font-display:swap}
@font-face{font-family:'Fira Sans Condensed';src:local('Fira Sans Condensed Regular'),url('fonts/FiraSansCondensed-Regular.woff2') format('woff2');font-style:normal;font-weight:400;font-display:swap}
@font-face{font-family:'Fira Sans Condensed';src:local('Fira Sans Condensed Bold'),url('fonts/FiraSansCondensed-Bold.woff2') format('woff2');font-style:normal;font-weight:700 900;font-display:swap}
@font-face{font-family:'Fira Mono';src:local('Fira Mono Regular'),url('fonts/FiraMono-Regular.woff2') format('woff2');font-style:normal;font-weight:400;font-display:swap}
:root{color-scheme:dark;--bg:#0b101d;--surface:#141c2d;--surface2:#1a2437;--line:rgba(222,231,255,.10);--text:#f3f7ff;--muted:#96a5bd;--accent:#88a8ff;--accent-glow:rgba(111,149,255,.17);--green:#70d5b8;--danger:#ff7d91;--radius:25px;--shadow:0 14px 38px rgba(1,3,12,.16)}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:"Fira Sans","Segoe UI",Roboto,Arial,sans-serif;font-size:16px;-webkit-font-smoothing:antialiased}button,input{font:inherit}button{cursor:pointer}a{color:var(--accent)}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid var(--accent);outline-offset:3px}body.light{color-scheme:light;--bg:#f0f3f9;--surface:#fff;--surface2:#f4f6fc;--line:rgba(39,55,88,.12);--text:#1c2a46;--muted:#687a97;--accent:#416fd7;--accent-glow:#e9efff;--green:#0c8870;--shadow:0 14px 38px rgba(36,56,98,.07)}
#app{height:100dvh;min-height:550px;display:flex;flex-direction:column;padding:clamp(14px,1.55vw,30px);gap:clamp(12px,1.05vw,20px)}.topbar{display:flex;align-items:center;justify-content:space-between;padding:0 5px;gap:15px;min-height:62px}.top-title{display:flex;align-items:center;gap:14px}.top-title strong{font-size:clamp(21px,1.55vw,30px);display:block;letter-spacing:-.025em}.eyebrow{display:block;font-size:clamp(10px,.7vw,14px);font-weight:750;letter-spacing:.15em;color:var(--muted);margin-bottom:6px}.brand-symbol{width:64px;height:64px;display:grid;place-items:center;border-radius:17px;background:linear-gradient(135deg,#86aaff,#6e6cdb);color:white;font-size:42px;font-weight:700;box-shadow:0 6px 30px rgba(90,120,245,.24)}.brand-symbol.small{width:51px;height:51px;border-radius:15px;font-size:33px}.top-actions{display:flex;gap:8px;align-items:center}.connection{color:var(--muted);font-size:clamp(12px,.8vw,16px);margin-right:10px}.connection.ok::before,.connection.stale::before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--green);margin-right:8px}.connection.stale::before{background:#f4c272}.icon-button,.today-btn,.text-button{color:var(--text);border:1px solid var(--line);background:var(--surface2);border-radius:13px;min-width:44px;min-height:44px;display:inline-grid;place-items:center;padding:0 12px;text-decoration:none;font-size:25px;line-height:1}.icon-button:hover,.today-btn:hover,.text-button:hover{background:var(--accent-glow)}.text-button{font-size:13px;color:var(--accent);border:0}.today-btn{font-size:14px;padding:0 17px;font-weight:700}.layout{display:grid;grid-template-columns:minmax(290px,.95fr) minmax(380px,1.33fr) minmax(310px,1.12fr);gap:clamp(12px,1vw,21px);flex:1;min-height:0}.layout>section{min-width:0;border:1px solid var(--line);background:var(--surface);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}.today-panel{display:flex;flex-direction:column;padding:clamp(22px,2.2vw,45px);background:radial-gradient(ellipse at 5% 0%,var(--accent-glow),transparent 67%),var(--surface)!important}.date-line{text-transform:capitalize;font-weight:650;font-size:clamp(23px,2vw,37px);color:var(--muted);letter-spacing:-.035em;margin-top:clamp(8px,2.2vh,33px)}.clock{display:flex;align-items:baseline;font-weight:750;font-variant-numeric:tabular-nums;font-size:clamp(67px,6.3vw,125px);letter-spacing:-.08em;line-height:1.18;margin:8px 0 0;white-space:nowrap}
/* Gleiche Schrift und Textbasis wie die Ziffern; die exakte optische Mitte berechnet JS aus den tatsächlichen Glyphenmaßen. */
.clock-colon{display:block;flex:0 0 auto;line-height:inherit;letter-spacing:-.045em;transform:translateY(var(--clock-colon-offset,-.10em));opacity:1}
.clock-colon.clock-colon-off{opacity:0}.long-date{font-size:clamp(20px,1.7vw,34px);color:var(--muted);margin-bottom:auto}.focus-wrap{border-top:1px solid var(--line);margin-top:40px;padding-top:28px}.focus-wrap .eyebrow{color:var(--accent)}.focus-title{font-size:clamp(23px,2vw,39px);line-height:1.13;letter-spacing:-.045em;font-weight:750;overflow-wrap:anywhere;max-height:4.5em;overflow:hidden}.focus-time{font-size:clamp(15px,1.12vw,21px);margin-top:15px;color:var(--muted)}.bottom-today{margin-top:26px;padding-top:16px;border-top:1px solid var(--line);display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-size:clamp(12px,.85vw,15px)}.calendar-panel,.agenda-panel{padding:clamp(19px,1.55vw,31px);display:flex;flex-direction:column}.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:clamp(20px,2vh,30px)}.panel-heading h2{font-size:clamp(24px,1.85vw,35px);line-height:1.1;letter-spacing:-.045em;margin:0}.month-controls{display:flex;gap:7px;align-items:center}.weekdays,.month-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:7px}.weekdays{font-size:clamp(12px,.86vw,16px);color:var(--muted);font-weight:650;text-align:center;padding-bottom:15px}.month-grid{grid-template-rows:repeat(6,minmax(0,1fr));flex:1;min-height:0}.day{display:flex;align-items:center;justify-content:flex-start;flex-direction:column;padding:clamp(6px,.7vw,12px) 2px 4px;border-radius:13px;border:1px solid transparent;background:transparent;color:var(--text);min-width:0;position:relative;font-weight:650;font-variant-numeric:tabular-nums;font-size:clamp(17px,1.15vw,23px)}.day:hover{background:var(--surface2)}.day.other{color:var(--muted);opacity:.38}.day.today .day-number{background:var(--accent);color:#07152c}.day.selected{background:var(--accent-glow);border-color:var(--accent)}.day-number{display:grid;place-items:center;border-radius:50%;width:clamp(28px,2vw,40px);height:clamp(28px,2vw,40px)}.dots{display:flex;gap:3px;justify-content:center;margin-top:clamp(4px,.55vw,11px);max-width:100%;overflow:hidden}.dot{display:block;width:clamp(5px,.44vw,8px);height:clamp(5px,.44vw,8px);border-radius:50%;flex-shrink:0}.legend{display:flex;align-items:center;flex-wrap:wrap;gap:14px;padding-top:18px;min-height:39px}.legend-item{display:flex;align-items:center;gap:7px;color:var(--muted);font-size:clamp(12px,.8vw,15px)}.legend-item .dot{width:9px;height:9px}.agenda-scroller{min-height:0;flex:1;overflow:auto;scrollbar-color:var(--line) transparent;scrollbar-width:thin;padding-right:5px}.agenda-items{display:flex;flex-direction:column;gap:12px}.agenda-date{padding:19px 3px 1px;color:var(--muted);font-size:clamp(12px,.85vw,15px);text-transform:uppercase;letter-spacing:.10em;font-weight:800}.agenda-date:first-child{padding-top:0}.event{display:grid;grid-template-columns:clamp(68px,5.3vw,98px) minmax(0,1fr);gap:clamp(12px,.9vw,18px);background:var(--surface2);border-radius:15px;padding:clamp(14px,1vw,20px);border:1px solid var(--line);border-left:4px solid var(--eventcolor)}.event-time{font-size:clamp(15px,.95vw,19px);font-weight:800;font-variant-numeric:tabular-nums;padding-top:3px}.event-time small{display:block;font-size:12px;color:var(--muted);font-weight:500;margin-top:4px}.event-title{font-weight:750;font-size:clamp(17px,1.14vw,23px);line-height:1.17;overflow-wrap:anywhere}.event-meta{font-size:clamp(12px,.77vw,15px);color:var(--muted);margin-top:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.empty{color:var(--muted);padding:20px 0}.footer{display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:clamp(11px,.72vw,14px);padding:0 5px;min-height:20px}
.auth-page{min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:24px;background:radial-gradient(ellipse at 28% 4%,rgba(79,101,193,.17),transparent 60%),var(--bg)}.auth-panel,.admin-panel{width:min(100%,520px);background:var(--surface);border:1px solid var(--line);border-radius:24px;padding:clamp(22px,3vw,45px);box-shadow:var(--shadow)}.auth-panel h1,.admin-panel h1{font-size:32px;letter-spacing:-.04em;margin:22px 0 8px}.auth-panel h2{font-size:20px;margin-top:30px}.auth-panel p,.admin-panel p{color:var(--muted);line-height:1.5}.auth-panel form,.admin-panel form{display:flex;flex-direction:column;gap:19px;margin-top:30px}.auth-panel label,.admin-panel label{display:flex;flex-direction:column;gap:8px;font-size:14px;color:var(--muted);font-weight:700}.auth-panel input,.admin-panel input:not([type=checkbox]):not([type=color]){width:100%;border:1px solid var(--line);border-radius:12px;background:var(--surface2);color:var(--text);padding:13px 15px;min-height:47px}.auth-panel input[type=color],.admin-panel input[type=color]{height:47px;width:84px;background:var(--surface2);border:1px solid var(--line);border-radius:10px;padding:6px}.primary{background:var(--accent);color:var(--bg);font-weight:750;border:0;padding:14px 21px;border-radius:12px;min-height:50px}.primary:hover{filter:brightness(1.08)}.hint{font-size:13px}.error{background:#522b35;border:1px solid #a64e66;color:white!important;padding:14px;border-radius:10px}.success{background:#153f38;border:1px solid #33836e;color:#defbf1!important;padding:14px;border-radius:10px}.admin-panel{width:min(100%,860px);margin:24px auto}.admin-panel fieldset{border:1px solid var(--line);border-radius:17px;margin:0;padding:20px}.admin-panel legend{color:var(--text);font-size:17px;font-weight:800;padding:0 8px}.fields-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.span2{grid-column:span 2}.remove-choice{flex-direction:row!important;align-items:center;margin-top:18px}
@media(max-width:1200px){.layout{grid-template-columns:minmax(250px,.8fr) minmax(330px,1.2fr)}.agenda-panel{grid-column:1/-1;min-height:350px}.agenda-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.agenda-date{grid-column:1/-1}.event{grid-template-columns:75px 1fr}#app{height:auto;min-height:100dvh}.calendar-panel{min-height:550px}.today-panel{min-height:550px}.agenda-scroller{overflow:visible}}@media(max-width:760px){#app{padding:12px}.layout{display:flex;flex-direction:column}.today-panel{min-height:350px}.date-line{margin-top:0}.clock{font-size:80px}.focus-wrap{margin-top:26px}.calendar-panel{min-height:530px}.agenda-items{display:flex}.agenda-panel{min-height:400px}.topbar{align-items:flex-start}.top-actions{gap:4px;flex-wrap:wrap;justify-content:flex-end}.connection{width:100%;text-align:right;margin-right:0}.icon-button{min-width:39px;min-height:39px}.top-title .eyebrow{font-size:9px}.top-title strong{font-size:21px}.brand-symbol.small{width:42px;height:42px}.calendar-panel,.agenda-panel{padding:17px}.panel-heading h2{font-size:25px}.month-grid{min-height:340px}.day{font-size:16px}.fields-grid{grid-template-columns:1fr}.span2{grid-column:span 1}}
@media (prefers-reduced-motion: no-preference){.day,.icon-button,.event{transition:background-color .18s,border-color .18s,transform .18s}}@media(orientation:portrait) and (min-width:761px){.layout{display:flex;flex-direction:column}.today-panel{min-height:380px}.calendar-panel{min-height:550px}.agenda-panel{min-height:500px}#app{height:auto}}

/* Typografische Spezialisierung: prägnante Überschriften, zuverlässige Ziffern */
.top-title strong,.panel-heading h2,.agenda-date,.eyebrow{font-family:'Fira Sans Condensed','Fira Sans',Arial,sans-serif}
.clock,.event-time,.day-number,.bottom-today{font-family:'Fira Mono','Fira Sans',monospace;letter-spacing:-.045em}
/* Fehlerdiagnose auf dem Wanddisplay direkt ablesbar */
#app{position:relative}
.sync-errors{position:absolute;z-index:10;top:clamp(72px,7vh,105px);right:clamp(14px,1.55vw,30px);width:min(625px,calc(100% - 30px));max-height:52vh;overflow:auto;padding:14px 18px;border:1px solid #d79a3f;border-radius:16px;background:#30291c;color:#fff4db;box-shadow:0 14px 42px rgba(0,0,0,.35);font-size:15px}
.sync-errors[hidden]{display:none}.sync-errors summary{font-weight:700;cursor:pointer}.sync-errors>a{display:inline-block;margin-top:10px;color:#aaccff}.sync-error-list{display:flex;flex-direction:column;gap:9px;margin-top:11px}.sync-error-entry{display:flex;flex-direction:column;gap:3px;border-top:1px solid rgba(255,255,255,.15);padding-top:8px}.sync-error-entry small{font-size:13px;color:#f9daad;line-height:1.4}
.settings-section{border-top:1px solid var(--line);margin-top:28px;padding-top:24px}.settings-section h2{font-size:21px;margin:0 0 9px}.secondary-button{display:inline-flex;border:1px solid var(--line);padding:12px 16px;background:var(--surface2);color:var(--text);font-weight:700;border-radius:12px;text-decoration:none;min-height:44px;align-items:center;justify-content:center}.secondary-button:hover{background:var(--accent-glow)}
.diagnostic-item{padding:15px 18px;background:var(--surface2);border-radius:14px;border:1px solid var(--line);margin:15px 0}.diagnostic-item h3{margin:0 0 10px}.diagnostic-item p{margin:7px 0}.diagnostic-item code{font-family:'Fira Mono',monospace;overflow-wrap:anywhere}.diagnostic-ok{color:var(--green)!important;font-weight:700}.diagnostic-fail{color:var(--danger)!important;font-weight:700}

/* Pull-to-Refresh: eigene Wischgeste statt reinem Browser-Neuladen */
body.dashboard{overscroll-behavior-y:contain}
.pull-refresh{position:fixed;z-index:25;left:50%;top:calc(env(safe-area-inset-top, 0px) + 16px);transform:translateX(-50%);max-width:calc(100vw - 24px);padding:12px 20px;border:1px solid var(--line);border-radius:100px;background:var(--surface);color:var(--text);box-shadow:0 10px 34px rgba(0,0,0,.26);font-family:'Fira Sans',Arial,sans-serif;font-weight:700;font-size:14px;text-align:center;white-space:nowrap;pointer-events:none}
.pull-refresh[hidden]{display:none}

/* Version 1.1.7: Wochentag, Uhr und Datum zentral in der Kopfzeile */
.topbar{gap:clamp(12px,1.5vw,26px);min-height:clamp(84px,8.5vh,134px)}
.top-title{flex:0 1 auto;min-width:0}
.top-title>div{min-width:0}
.top-title strong{white-space:nowrap}
.header-datetime{display:flex;align-items:center;justify-content:center;gap:clamp(18px,2vw,42px);min-width:0;flex:1 1 auto}
.header-date{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-width:0}
.header-date .date-line{margin:0;color:var(--text);font-family:'Fira Sans Condensed','Fira Sans',sans-serif;font-size:clamp(21px,1.65vw,33px);font-weight:750;line-height:1.1}
.header-date .long-date{margin:6px 0 0;color:var(--muted);font-size:clamp(13px,1.05vw,20px);white-space:nowrap;line-height:1.3}
.header-datetime .clock{margin:0;font-size:clamp(52px,4.5vw,88px);line-height:1.1;flex:0 0 auto}
.top-actions{flex:0 0 auto}
/* Der freie Platz links ist jetzt für den nächsten Termin reserviert. */
.today-panel{justify-content:space-between}
.today-panel .focus-wrap{margin-top:0;padding-top:0;border:0;display:flex;flex-direction:column;justify-content:center;flex:1}
.today-panel .focus-title{font-size:clamp(26px,2.4vw,46px)}
.today-panel .bottom-today{margin-top:clamp(20px,2vh,35px)}
/* Hochgeladene Logos proportional und ohne Beschnitt. */
.brand-symbol.has-logo{background:var(--surface2);box-shadow:none;border:1px solid var(--line);padding:4px}
.brand-symbol.has-logo img{display:block;max-width:100%;max-height:100%;width:100%;height:100%;object-fit:contain}
.brand-symbol.auth-brand.has-logo{width:95px;height:95px}
.branding-settings{margin-top:8px;margin-bottom:22px}
.branding-preview{display:inline-flex;width:140px;height:100px;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:14px;background:var(--surface2);padding:8px}
.branding-preview img{max-width:100%;max-height:100%;object-fit:contain}
.branding-form,.branding-remove{margin-top:12px!important}
.branding-form label{min-width:0}
.branding-form input[type=file]{width:100%}
.branding-form button,.branding-remove button{align-self:flex-start}
/* Querformat mit begrenzter CSS-Breite: Uhr unter der Marken-/Aktionszeile. */
@media (max-width:1350px){
  .topbar{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"brand actions" "datetime datetime";row-gap:12px;align-items:center}
  .top-title{grid-area:brand}
  .header-datetime{grid-area:datetime;justify-content:center;gap:clamp(16px,5vw,65px);padding:3px 0 7px}
  .top-actions{grid-area:actions;justify-self:end}
  .header-datetime .clock{font-size:clamp(56px,8vw,94px)}
  .header-date .date-line{font-size:clamp(23px,2.8vw,34px)}
  .header-date .long-date{font-size:clamp(15px,1.8vw,23px)}
}
/* Tablets im Hochformat: alle Informationen voll nutzbar, kein seitliches Abschneiden. */
@media (orientation:portrait){
  #app{height:auto;min-height:100dvh}
  .layout{display:flex;flex-direction:column}
  .today-panel{min-height:210px}
  .calendar-panel{min-height:525px}
  .agenda-panel{min-height:430px}
  .agenda-items{display:flex;flex-direction:column}
  .agenda-scroller{overflow:visible}
  .header-datetime{justify-content:space-between}
}
@media (max-width:760px){
  .topbar{padding:2px 0}
  .header-datetime{gap:10px;justify-content:space-between}
  .header-datetime .clock{font-size:clamp(40px,10vw,68px)}
  .header-date .date-line{font-size:clamp(18px,5vw,26px)}
  .header-date .long-date{font-size:clamp(12px,3vw,16px);white-space:normal}
  .today-panel{min-height:185px;padding:20px}
  .today-panel .focus-title{font-size:clamp(24px,6vw,34px)}
  .calendar-panel{min-height:495px}
  .agenda-panel{min-height:360px}
  .top-title strong{font-size:clamp(18px,4vw,22px)}
  .connection{font-size:12px}
}
@media (max-width:390px){
  .top-title .eyebrow{display:none}
  .top-title strong{font-size:17px}
  .connection{font-size:11px}
  .header-datetime .clock{font-size:40px}
  .header-date .date-line{font-size:18px}
}

/* 1.1.8: Links nur das eigene Logo. Uhr und Datum auf breiten Anzeigen mittig. */
@media (min-width:1351px){
  .topbar{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}
  .top-title{justify-self:start}
  .header-datetime{justify-self:center;flex:none}
  .top-actions{justify-self:end}
}

/* 1.1.9: Kopfzeile auf Tablets und großen Bildschirmen einzeilig nutzen.
   Das Datum und die Uhr stehen genau zwischen Logo und Aktionen. */
.topbar{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  grid-template-areas:"brand datetime actions";
  gap:clamp(10px,1.2vw,24px);
  align-items:center;
  min-height:clamp(65px,7.5vh,104px);
}
.top-title{grid-area:brand;justify-self:start;min-width:0}
.header-datetime{
  grid-area:datetime;
  justify-self:center;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:clamp(12px,1.5vw,32px);
  flex:none;
  padding:0;
  min-width:0;
}
.header-date{flex:0 1 auto;min-width:0}
.header-date .date-line{font-size:clamp(19px,1.85vw,31px);line-height:1.1}
.header-date .long-date{font-size:clamp(13px,1.1vw,19px);white-space:nowrap;line-height:1.2;margin-top:4px}
.header-datetime .clock{font-size:clamp(47px,4.55vw,86px);line-height:1.12;margin:0;flex:0 0 auto}
.top-actions{grid-area:actions;justify-self:end;flex-wrap:nowrap;min-width:0}
/* Auf mittelgroßen Tablets bleibt das Statussymbol erhalten,
   ohne die wichtige Datums-/Uhrzeitanzeige zu verdrängen. */
@media(max-width:1150px){
 .top-actions .connection{font-size:0;line-height:0;width:12px;min-width:12px;margin-right:2px;white-space:nowrap}
 .top-actions .connection::before{content:"";display:inline-block;width:10px;height:10px;border-radius:50%;background:var(--muted);margin-right:0}
 .top-actions .connection.ok::before{background:var(--green)}
 .top-actions .connection.stale::before{background:#f4c272}
}
@media(max-width:760px){
 .topbar{min-height:66px;align-items:center;gap:9px}
 .header-datetime{gap:10px;justify-content:center}
 .header-date .date-line{font-size:clamp(17px,2.7vw,21px)}
 .header-date .long-date{font-size:clamp(12px,2vw,15px);white-space:nowrap}
 .header-datetime .clock{font-size:clamp(39px,6.5vw,48px)}
 .top-actions{gap:4px}
}
/* Sehr schmale Geräte (Smartphone) behalten zwei Zeilen,
   damit Datum und Uhr nicht über Bedienelemente laufen. */
@media(max-width:560px){
 .topbar{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"brand actions" "datetime datetime";row-gap:10px}
 .header-datetime{justify-self:center;justify-content:center;padding:1px 0 5px}
 .header-datetime .clock{font-size:clamp(43px,11.5vw,62px)}
 .header-date .date-line{font-size:clamp(19px,5vw,24px)}
 .header-date .long-date{font-size:clamp(12px,3.2vw,16px)}
}
/* Kalenderzahlen für die Wandansicht – deutlich größer als bisher.
   Der Tageskreis passt sich dem verfügbaren Zellenplatz an. */
.day{font-size:clamp(24px,1.75vw,33px);padding-top:clamp(4px,.5vw,9px)}
.day-number{width:min(clamp(40px,2.65vw,52px),100%);height:auto;aspect-ratio:1;line-height:1}
@media(max-width:760px){
 .day{font-size:clamp(23px,4vw,27px);padding:4px 1px 2px}
 .day-number{width:min(clamp(38px,6.1vw,46px),100%)}
 .dots{margin-top:3px}
}

/* 1.1.10 – Wand-Tablet: Kein Seitenscrollen in Hoch- UND Querformat.
   Ausgerichtet auf die verfügbare CSS-Viewporthöhe (auch Android WebAPK).
   Ausschließlich die Terminliste scrollt, wenn sie mehr Termine enthält. */
@media (min-width:521px) {
 body.dashboard{width:100%;height:100%;overflow:hidden}
 body.dashboard{overscroll-behavior:none}
 body.dashboard #app{
   height:100vh;height:100dvh;min-height:0;max-height:100dvh;
   overflow:hidden;
   padding:clamp(8px,1.05vw,19px);
   padding-top:max(8px,env(safe-area-inset-top));
   padding-bottom:max(8px,env(safe-area-inset-bottom));
   gap:clamp(6px,.85vh,12px);
 }
 body.dashboard .layout{display:grid;flex:1 1 auto;min-height:0;overflow:hidden;gap:clamp(7px,.8vw,16px)}
 body.dashboard .layout>section{min-height:0;min-width:0;overflow:hidden;border-radius:clamp(12px,1.3vw,24px)}
 body.dashboard .calendar-panel,body.dashboard .agenda-panel{padding:clamp(9px,1.05vw,21px);min-height:0}
 body.dashboard .calendar-panel{display:flex;flex-direction:column}
 body.dashboard .agenda-panel{display:flex;flex-direction:column}
 body.dashboard .agenda-scroller{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin}
 body.dashboard .agenda-items{display:flex;flex-direction:column;gap:clamp(5px,.7vh,12px)}
 body.dashboard .agenda-date{padding:clamp(6px,1vh,15px) 2px 0}
 body.dashboard .event{padding:clamp(7px,.75vw,14px);gap:clamp(6px,.7vw,12px);grid-template-columns:clamp(60px,5vw,88px) minmax(0,1fr)}
 body.dashboard .event-title{font-size:clamp(15px,1.05vw,22px)}
 body.dashboard .event-meta{margin-top:3px}
 body.dashboard .panel-heading{margin-bottom:clamp(6px,1vh,13px);flex:0 0 auto}
 body.dashboard .weekdays{padding-bottom:clamp(5px,.9vh,10px);flex:0 0 auto}
 body.dashboard .month-grid{flex:1 1 auto;min-height:0;min-width:0;grid-template-rows:repeat(6,minmax(0,1fr));gap:clamp(1px,.4vw,6px)}
 body.dashboard .day{min-height:0;padding:clamp(1px,.35vh,5px) 1px 1px;align-items:center;justify-content:flex-start;font-size:clamp(22px,1.8vw,33px)}
 body.dashboard .day-number{width:min(100%,clamp(30px,2.65vw,52px));height:auto;max-height:calc(100% - 9px);aspect-ratio:1;flex:0 1 auto}
 body.dashboard .dots{margin-top:clamp(2px,.25vh,5px);gap:2px;flex-shrink:0}
 body.dashboard .dot{width:clamp(4px,.35vw,7px);height:clamp(4px,.35vw,7px)}
 body.dashboard .legend{min-height:0;padding-top:clamp(3px,.55vh,10px);gap:4px 12px;flex:0 0 auto;max-height:clamp(15px,4.2vh,48px);overflow:hidden}
 body.dashboard .legend-item{font-size:clamp(10px,.72vw,14px)}
 body.dashboard .today-panel{padding:clamp(11px,1.4vw,28px);min-height:0;justify-content:space-between}
 body.dashboard .today-panel .focus-wrap{min-height:0;display:flex;flex-direction:column;justify-content:center;overflow:hidden}
 body.dashboard .today-panel .focus-title{font-size:clamp(19px,1.85vw,38px);max-height:3.4em;overflow:hidden}
 body.dashboard .today-panel .focus-time{font-size:clamp(12px,1vw,19px);margin-top:clamp(4px,.9vh,12px)}
 body.dashboard .bottom-today{margin-top:clamp(5px,1vh,14px);padding-top:clamp(5px,.75vh,12px);flex:0 0 auto}
 body.dashboard .footer{display:none}
 body.dashboard .topbar{flex:0 0 auto;min-height:0;height:auto;padding:0 2px;gap:clamp(5px,1vw,18px)}
 body.dashboard .icon-button{min-width:clamp(35px,3.5vw,44px);min-height:clamp(35px,3.5vw,44px);padding:0 clamp(6px,.7vw,12px)}
 /* Fehlermeldungen als schwebendes, intern scrollbarers Panel statt Höhenverbrauch. */
 body.dashboard .sync-errors:not([hidden]){position:fixed;z-index:30;top:clamp(66px,10vh,104px);left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));max-height:60dvh;overflow:auto;box-shadow:0 12px 35px rgba(0,0,0,.35)}
}
/* Querformat: drei nebeneinanderliegende Zonen ohne Seiten-Scrollen. */
@media (min-width:870px) and (orientation:landscape) {
 body.dashboard .layout{grid-template-columns:minmax(0,.72fr) minmax(0,1.42fr) minmax(0,.95fr);grid-template-rows:minmax(0,1fr);grid-template-areas:'focus calendar agenda'}
 body.dashboard .today-panel{grid-area:focus}
 body.dashboard .calendar-panel{grid-area:calendar}
 body.dashboard .agenda-panel{grid-area:agenda;grid-column:auto}
}
/* Schmaleres Querformat: Fokus als schmale Zeile, Kalender und Termine unten. */
@media (min-width:521px) and (max-width:869px) and (orientation:landscape) {
 body.dashboard .layout{grid-template-columns:minmax(0,1.45fr) minmax(0,.95fr);grid-template-rows:clamp(65px,15dvh,115px) minmax(0,1fr);grid-template-areas:'focus focus' 'calendar agenda'}
 body.dashboard .today-panel{grid-area:focus;flex-direction:row;align-items:center;gap:16px}
 body.dashboard .today-panel .focus-wrap{flex:1 1 auto;min-width:0}
 body.dashboard .today-panel .bottom-today{flex:0 0 auto;align-self:center;border:0;margin:0;padding:0;display:block}
 body.dashboard .today-panel .bottom-today span{display:block;text-align:right}
 body.dashboard .calendar-panel{grid-area:calendar}
 body.dashboard .agenda-panel{grid-area:agenda;grid-column:auto}
}
/* Hochformat: Fokus schmal oben, Kalender als Hauptfläche und Terminliste darunter. */
@media (min-width:521px) and (orientation:portrait) {
 body.dashboard .layout{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:clamp(95px,12dvh,152px) minmax(0,1.38fr) minmax(0,.88fr);grid-template-areas:'focus' 'calendar' 'agenda'}
 body.dashboard .today-panel{grid-area:focus;flex-direction:row;align-items:center;gap:clamp(8px,2vw,20px)}
 body.dashboard .today-panel .focus-wrap{flex:1 1 65%;min-width:0}
 body.dashboard .today-panel .focus-title{font-size:clamp(20px,3.3vw,32px);max-height:2.35em}
 body.dashboard .today-panel .bottom-today{border:0;padding:0;margin:0;flex:0 0 30%;display:flex;flex-direction:column;text-align:right;gap:4px}
 body.dashboard .calendar-panel{grid-area:calendar}
 body.dashboard .agenda-panel{grid-area:agenda;grid-column:auto}
 body.dashboard .header-datetime{min-width:0}
 body.dashboard .header-datetime .clock{font-size:clamp(42px,6vw,65px)}
 body.dashboard .topbar{grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:'brand datetime actions'}
 body.dashboard .top-actions{min-width:0;flex-wrap:nowrap}
 body.dashboard .connection{font-size:0;line-height:0;min-width:10px;width:10px;margin-right:0}
 body.dashboard .connection::before{content:'';display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--muted);margin:0}
 body.dashboard .connection.ok::before{background:var(--green)}
 body.dashboard .connection.stale::before{background:#f4c272}
}
@media (min-width:521px) and (max-width:680px) and (orientation:portrait) {
 body.dashboard .topbar{column-gap:5px}
 body.dashboard .top-actions{gap:3px}
 body.dashboard .header-datetime{gap:clamp(5px,1vw,9px)}
 body.dashboard .header-date .date-line{font-size:clamp(17px,3vw,22px)}
 body.dashboard .header-date .long-date{font-size:clamp(11px,2.1vw,14px)}
 body.dashboard .header-datetime .clock{font-size:clamp(41px,7.8vw,52px)}
 body.dashboard .brand-symbol.small{width:38px;height:38px;font-size:26px}
 body.dashboard .month-controls{gap:4px}
 body.dashboard .month-controls .icon-button{min-width:36px;min-height:36px}
 body.dashboard .today-btn{min-height:36px;padding:0 10px}
 body.dashboard .panel-heading h2{font-size:clamp(23px,4.6vw,30px)}
 body.dashboard .day{font-size:clamp(23px,4.4vw,29px)}
 body.dashboard .day-number{width:min(100%,clamp(34px,6.7vw,45px))}
}
/* Kompakte Tablet-Höhen – Kalenderzellen und Kopfzeile bleiben funktionsfähig. */
@media (min-width:521px) and (max-height:700px) {
 body.dashboard #app{padding:6px;gap:6px}
 body.dashboard .topbar{min-height:0}
 body.dashboard .top-actions .icon-button{min-width:34px;min-height:34px;font-size:22px}
 body.dashboard .brand-symbol.small{width:37px;height:37px;font-size:25px}
 body.dashboard .header-date .date-line{font-size:clamp(17px,2vw,24px)}
 body.dashboard .header-date .long-date{font-size:clamp(11px,1.4vw,16px)}
 body.dashboard .header-datetime .clock{font-size:clamp(38px,4.6vw,56px)}
 body.dashboard .panel-heading{margin-bottom:3px}
 body.dashboard .panel-heading h2{font-size:clamp(19px,2.2vw,28px)}
 body.dashboard .weekdays{padding-bottom:3px}
 body.dashboard .day{font-size:clamp(20px,2.05vw,27px)}
 body.dashboard .day-number{width:min(100%,clamp(28px,2.5vw,37px))}
 body.dashboard .legend{max-height:25px;padding-top:2px}
 body.dashboard .calendar-panel,body.dashboard .agenda-panel{padding:9px}
 body.dashboard .today-panel{padding:10px}
}

/* 1.1.12 – Nur Dashboard im Querformat: 1.1.10 Dreispalten-Layout.
   Einstellungs-/Diagnose-/Updater-Seiten behalten normalen Dokument-Scroll. */
@media (orientation: landscape) and (min-width:600px) {
  body.dashboard {
    width:100%;height:100vh;height:100dvh;overflow:hidden;
    overscroll-behavior:none;
  }
  body.dashboard #app {
    display:flex;flex-direction:column;
    height:100vh;height:100dvh;min-height:0;max-height:100dvh;
    overflow:hidden;
  }
  body.dashboard .topbar {flex:0 0 auto;min-height:0}
  body.dashboard .layout {
    display:grid;flex:1 1 0;min-width:0;min-height:0;width:100%;
    grid-template-columns:minmax(0,.72fr) minmax(0,1.42fr) minmax(0,.95fr);
    grid-template-rows:minmax(0,1fr);
    grid-template-areas:'focus calendar agenda';
    overflow:hidden;
  }
  body.dashboard .today-panel {
    grid-area:focus;display:flex;flex-direction:column;
    align-items:stretch;min-width:0;min-height:0;
  }
  body.dashboard .today-panel .focus-wrap {
    flex:1 1 auto;min-height:0;overflow:hidden;display:flex;
    flex-direction:column;justify-content:center;
  }
  body.dashboard .today-panel .bottom-today {
    flex:0 0 auto;display:flex;flex-direction:column;
    align-items:flex-start;min-width:0;
  }
  body.dashboard .today-panel .bottom-today span{max-width:100%;overflow:hidden;text-overflow:ellipsis}
  body.dashboard .calendar-panel {grid-area:calendar;min-width:0;min-height:0;overflow:hidden}
  body.dashboard .agenda-panel {grid-area:agenda;grid-column:auto;min-width:0;min-height:0;overflow:hidden}
  body.dashboard .layout>section {min-width:0;min-height:0;max-height:100%;overflow:hidden}
  body.dashboard .month-grid{min-height:0;height:0;flex:1 1 0;grid-template-rows:repeat(6,minmax(0,1fr))}
  body.dashboard .agenda-scroller {
    display:block;flex:1 1 0;min-height:0;height:0;
    overflow-x:hidden;overflow-y:auto;
    overscroll-behavior:contain;touch-action:pan-y;
    -webkit-overflow-scrolling:touch;
  }
  body.dashboard .footer{display:none}
}
@media (orientation: landscape) and (min-width:600px) and (max-width:869px) {
  body.dashboard .layout{grid-template-columns:minmax(0,.68fr) minmax(0,1.42fr) minmax(0,.90fr)}
  body.dashboard .today-panel{padding:clamp(6px,.9vw,12px)}
  body.dashboard .today-panel .focus-title{font-size:clamp(14px,2vw,21px)}
  body.dashboard .today-panel .focus-time{font-size:12px}
  body.dashboard .today-panel .bottom-today{font-size:10px}
  body.dashboard .calendar-panel,body.dashboard .agenda-panel{padding:clamp(5px,.8vw,10px)}
  body.dashboard .month-controls{gap:2px}
  body.dashboard .month-controls .icon-button,body.dashboard .today-btn{min-width:24px;min-height:27px;padding:0 4px;font-size:13px}
  body.dashboard .panel-heading h2{font-size:clamp(14px,2.2vw,20px)}
  body.dashboard .day{font-size:clamp(13px,2vw,18px)}
  body.dashboard .day-number{width:min(100%,clamp(17px,3.5vh,32px))}
  body.dashboard .legend{max-height:20px;overflow:hidden}
  body.dashboard .event{grid-template-columns:minmax(0,1fr);gap:3px}
  body.dashboard .event-time{font-size:11px}
  body.dashboard .event-time small{display:none}
  body.dashboard .event-title{font-size:clamp(12px,1.8vw,16px)}
  body.dashboard .topbar{gap:4px}
  body.dashboard .header-datetime{gap:5px}
  body.dashboard .header-datetime .clock{font-size:clamp(30px,5vw,42px)}
  body.dashboard .header-date .date-line{font-size:clamp(13px,2vw,18px)}
  body.dashboard .header-date .long-date{font-size:clamp(10px,1.3vw,12px)}
  body.dashboard .top-actions{gap:3px}
  body.dashboard .top-actions .icon-button{min-width:30px;min-height:30px;padding:0 4px;font-size:20px}
}
@media (orientation:landscape) and (min-width:600px) and (max-height:500px){
 body.dashboard .bottom-today{display:none!important}
 body.dashboard .topbar{max-height:50px}
 body.dashboard .calendar-panel .legend{max-height:17px}
 body.dashboard .panel-heading{margin-bottom:2px}
}
/* Unabhängig vom Dashboard: Verwaltungsseiten müssen jederzeit scrollbar sein. */
html{overflow-y:auto}
body.auth-page {height:auto;min-height:100dvh;overflow-x:hidden;overflow-y:auto}
