:root{--bg:#0b1220;--card:#111a2e;--muted:#7f8aa3;--text:#e9eefc;--accent:#4f8cff;--good:#2dd4bf;--bad:#fb7185;--warn:#fbbf24;--line:rgba(255,255,255,.08);--shadow:0 12px 30px rgba(0,0,0,.25);--radius:18px;--pad:18px;font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif}*{box-sizing:border-box}body{margin:0;background:radial-gradient(1200px 700px at 15% 10%,#142043 0,var(--bg) 55%);color:var(--text)}a{color:inherit;text-decoration:none}.container{max-width:1280px;margin:0 auto;padding:20px}.container-wide{max-width:1440px}.header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:14px 16px;border:1px solid var(--line);background:rgba(17,26,46,.8);border-radius:var(--radius);box-shadow:var(--shadow);backdrop-filter:blur(8px)}.brand{display:flex;flex-direction:column}.brand h1{margin:0;font-size:18px;letter-spacing:.2px}.brand small{color:var(--muted)}.userbox{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:14px}.pill{padding:6px 10px;border:1px solid var(--line);border-radius:999px;background:rgba(255,255,255,.04);color:var(--text);font-size:13px}.linkbtn{display:inline-block;padding:8px 10px;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.05);font-weight:800;font-size:13px}.linkbtn:hover{background:rgba(255,255,255,.08)}.grid{display:grid;grid-template-columns:1.2fr .8fr;gap:14px;margin-top:14px}@media(max-width:980px){.grid{grid-template-columns:1fr}}.card{border:1px solid var(--line);background:rgba(17,26,46,.8);border-radius:var(--radius);padding:var(--pad);box-shadow:var(--shadow);backdrop-filter:blur(8px)}.card h2{margin:0 0 10px 0;font-size:16px}.muted{color:var(--muted)}.status{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border:1px dashed var(--line);border-radius:14px;background:rgba(255,255,255,.03)}.badge{padding:8px 10px;border-radius:12px;font-weight:700;font-size:13px;border:1px solid var(--line)}.badge.good{background:rgba(45,212,191,.12);color:var(--good)}.badge.bad{background:rgba(251,113,133,.12);color:var(--bad)}.badge.warn{background:rgba(251,191,36,.12);color:var(--warn)}.actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}@media(max-width:520px){.actions{grid-template-columns:1fr}}.btn{width:100%;border:1px solid var(--line);background:rgba(255,255,255,.05);color:var(--text);padding:14px 14px;border-radius:16px;font-weight:800;font-size:15px;cursor:pointer;transition:.12s transform,.12s background}.btn:hover{transform:translateY(-1px);background:rgba(255,255,255,.08)}.btn.primary{background:linear-gradient(180deg,rgba(79,140,255,.35),rgba(79,140,255,.12))}.tablewrap{overflow:auto;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.02)}.table{width:100%;border-collapse:collapse;font-size:14px;min-width:860px}.table th,.table td{padding:10px 10px;border-bottom:1px solid var(--line);text-align:left;white-space:nowrap}.table th{color:var(--muted);font-weight:700;background:rgba(0,0,0,.10);position:sticky;top:0}.rowgood{color:var(--good);font-weight:800}.rowbad{color:var(--bad);font-weight:800}.rowwarn{color:var(--warn);font-weight:900}.kpis{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}@media(max-width:520px){.kpis{grid-template-columns:1fr}}.kpi{padding:12px;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.03)}.kpi .v{font-size:22px;font-weight:900;margin-top:2px}.input{width:100%;border:1px solid var(--line);background:rgba(255,255,255,.04);color:var(--text);padding:10px 12px;border-radius:12px;outline:none}.footer{margin-top:14px;color:var(--muted);font-size:12px;text-align:center}
textarea.input{min-height:90px; resize:vertical;}
.small{font-size:12px}


/* --- Login page tweaks (MVZ Ankerplatz) --- */
.login-hero{
  margin-top:14px;
  padding:16px 18px;
  border:1px solid rgba(125,211,252,.22);
  border-radius:16px;
  background:
    radial-gradient(720px 360px at 8% -30%, rgba(125,211,252,.25), rgba(125,211,252,0) 55%),
    linear-gradient(180deg, rgba(17,26,46,.78), rgba(17,26,46,.58));
  box-shadow:0 16px 32px rgba(0,0,0,.22);
}
.login-hero-title{
  font-size:clamp(1.2rem,2.4vw,1.75rem);
  font-weight:900;
  letter-spacing:.01em;
}
.login-hero-sub{
  margin-top:6px;
  color:var(--muted);
}
.login-hero-badges{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.login-topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:8px;
}
.login-title-block h2{
  margin:0;
  font-size:clamp(1.25rem,2.5vw,1.72rem);
}
.login-logo-wrap{
  display:flex;
  justify-content:center;
  align-items:center;
  margin-bottom:0;
  padding-top:0;
}
.login-logo{
  max-width:240px;
  width:100%;
  height:auto;
  opacity:.94;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,.38));
}
.login-main-card{
  border-color:rgba(125,211,252,.22);
}
.login-form-grid{
  display:grid;
  gap:12px;
  padding:14px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)),
    rgba(6,12,24,.36);
}
.login-submit{
  margin-top:10px;
  min-height:48px;
  font-size:16px;
}
.login-helper-pills{
  margin-top:12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.login-alert-ok{
  border-color:rgba(45,212,191,.34);
}
.login-alert-bad{
  border-color:rgba(251,113,133,.34);
}
/* Dropdown: white text on near-black background, but aligned with dark theme */
.login-select{
  background: rgba(0,0,0,.55);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,.16);
}
.login-select:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(79,140,255,.22);
}
.login-select option{
  background: #0b1220;
  color: #ffffff;
}

/* =========================
   Global Alarm UI
   ========================= */
#alarm-fab{
  position: fixed;
  right: 18px;
  bottom: 96px;
  z-index: 12000;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(251,113,133,.22), rgba(251,113,133,.08));
  color: var(--text);
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 900;
  min-width: 170px;
  text-align: left;
  opacity: 0.96;
  backdrop-filter: blur(6px);
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
}
#alarm-fab:hover{transform:translateY(-1px);background:linear-gradient(180deg,rgba(251,113,133,.30),rgba(251,113,133,.12))}
#alarm-fab:active{transform:translateY(0)}
.alarm-fab-label{display:block;font-size:14px;line-height:1.3;}
.alarm-fab-progress{margin-top:8px;height:6px;border-radius:12px;background:rgba(255,255,255,.15);overflow:hidden;}
.alarm-fab-progress div{height:100%;width:0;background:rgba(251,113,133,.9);transition:width .06s linear;}

#alarm-banner{
  position: fixed;
  left: 12px;
  right: 12px;
  top: 10px;
  z-index: 13000;
  display: none;
}
.alarm-banner-inner{
  border:1px solid rgba(251,113,133,.35);
  background: radial-gradient(900px 500px at 18% 20%, rgba(251,113,133,.08), rgba(17,26,46,.92));
  color: var(--text);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 16px 36px rgba(0,0,0,.35);
}
.alarm-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.alarm-title{font-size:18px;font-weight:900;letter-spacing:.5px;}
.alarm-sub{color:var(--muted);margin-top:4px;font-weight:700;}
.alarm-tags{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.alarm-time{margin-top:8px;font-weight:800;}
.alarm-actions{margin-top:12px;display:flex;gap:10px;flex-wrap:wrap;}
.alarm-note{margin-top:10px;font-size:12px;}

#global-banner{
  position: fixed;
  left: 12px;
  right: 12px;
  top: 10px;
  z-index: 12900;
  display: none;
}
.global-banner-inner{
  border:1px solid rgba(245,158,11,.45);
  background: linear-gradient(180deg, rgba(251,191,36,.22), rgba(245,158,11,.18));
  color: #2d1f00;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
.global-banner-title{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .35px;
  text-transform: uppercase;
}
.global-banner-text{
  margin-top: 4px;
  font-weight: 800;
}

/* =========================
   Raumplan – Kalender-Look
   ========================= */

.calwrap{
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
  background: rgba(0,0,0,.14);
}

.calheader{
  display: grid;
  grid-template-columns: 84px repeat(7, minmax(160px, 1fr));
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(0,0,0,.28);
  border-bottom: 1px solid var(--line);
}

.calcorner{
  height: 42px;
  border-right: 1px solid var(--line);
}

.calday{
  height: 42px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  letter-spacing: .2px;
  color: rgba(233,238,252,.92);
  border-right: 1px solid var(--line);
}

.calday:last-child{border-right:0}

.calbody{display:block}

.calrow{
  display: grid;
  grid-template-columns: 84px repeat(7, minmax(160px, 1fr));
}

.caltime{
  height: 54px;
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  padding: 10px 10px 0 10px;
  color: rgba(233,238,252,.65);
  font-weight: 800;
  font-size: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,.10);
}

.calcell{
  height: 54px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
}

.calcell:last-child{border-right:0}

.calempty{height:100%;opacity:.35}

.calevent{
  height: 100%;
  border-radius: 10px;
  display:flex;
  align-items:center;
  padding: 8px 10px;
  font-weight: 900;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,.16);
  /* Safari-safe styling: subtle card + colored left bar */
  background: rgba(255,255,255,.06);
  border-left: 4px solid var(--evbg, rgba(79,140,255,.7));
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}

.calevent.neutral{
  background: rgba(255,255,255,.06);
}

.caledit{display:flex;align-items:center;gap:8px}

.caldot{
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: transparent;
  flex: 0 0 auto;
}

.calselect{
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  outline: none;
  font-weight: 800;
  font-size: 13px;
}

.calselect option{
  background: #0b1220;
  color: #ffffff;
}


/* Dashboard helpers */
.span-2{grid-column:1/-1}
.news-card .news-list{max-height:420px;overflow:auto;padding-right:6px}
.news-item{padding:12px;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.03)}
.news-item-head{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.news-title{font-weight:900}

/* Page-specific helper: shift a whole grid a bit left (desktop) */
.grid-left{
  margin-left:-96px;
  margin-right:48px;
}
@media (max-width: 720px){
  .grid-left{
    margin-left:0;
    margin-right:0;
  }
}

/* Page-specific helper: nudge a block slightly left for wider content (desktop only) */
.card-left{
  margin-left:-12px;
  margin-right:12px;
}
@media (max-width: 720px){
  .card-left{
    margin-left:0;
    margin-right:0;
  }
}

/* Login extras (Wetter + Wusstest du schon?) */
#login-extras-panel .login-extras-grid{display:flex;gap:12px;align-items:stretch;margin-top:10px}
#login-extras-panel .login-extras-grid .news-item{flex:1;min-width:0;margin-top:0 !important}
/* Only stack on very small screens; on desktop keep side-by-side */
@media (max-width: 640px){
  #login-extras-panel .login-extras-grid{flex-direction:column}
}

/* =========================
   Kalender (Zeiterfassung)
   ========================= */

.rowblocked td{background:rgba(255,255,255,.03)}
.rowinactive td{opacity:.45}

/* lightweight dialog (Admin-Kalender) */
dialog.dlg{
  border:1px solid var(--line);
  border-radius:18px;
  padding:0;
  background:rgba(17,26,46,.95);
  color:var(--text);
  box-shadow:var(--shadow);
  max-width:720px;
  width:calc(100% - 24px);
}
dialog.dlg::backdrop{background:rgba(0,0,0,.55)}
.dlgform{padding:18px}

/* Login page: login card (left) + info block (right).
   IMPORTANT: Keep side-by-side for typical desktop widths; only stack on truly small screens.
   The right block should be slightly narrower than the login card. */
.login-split{display:flex;gap:18px;align-items:flex-start;margin-top:14px;flex-wrap:nowrap}
/* Left card can shrink a bit, but keeps a comfortable minimum */
.login-left{flex:1 1 560px;min-width:460px;max-width:640px}
/* Right block: narrower, fixed-ish width, but can shrink if needed */
.login-right{flex:0 1 360px;min-width:320px;max-width:420px}
@media(max-width:760px){
  .login-split{flex-direction:column}
  .login-left,.login-right{max-width:none;min-width:0}
  .login-topline{
    flex-direction:column;
    align-items:flex-start;
  }
}


/* Login: one-card layout (Umfrage/Hinweise im selben Feld wie Login, rechts daneben) */
.login-onecard{margin-top:14px}
.login-main-card{max-width:1040px}
.login-inner-split{display:flex;gap:18px;align-items:flex-start;margin-top:10px}
.login-inner-left{flex:1 1 auto;min-width:360px}
.login-inner-right{flex:0 1 420px;min-width:280px;max-width:420px}
/* Keep the right-side panels next to the login on typical desktop/laptop widths.
   Only stack on truly small screens. */
@media(max-width:420px){
  .login-inner-split{flex-direction:column}
  .login-inner-left,.login-inner-right{max-width:none;min-width:0}
}
.login-side-panels{
  display:flex;
  gap:14px;
  align-items:flex-start;
}
.login-side-panels .panel{flex:1;min-width:0}
@media (max-width: 900px){
  .login-side-panels{flex-direction:column}
}

/* =========================
   Design refresh (visual only)
   ========================= */

:root{
  --bg-2:#0e1936;
  --bg-3:#15254a;
  --accent-2:#22d3ee;
  --accent-3:#60a5fa;
  --focus:#7dd3fc;
}

@keyframes app-fade-up{
  from{opacity:0;transform:translateY(16px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes app-glow-drift{
  0%{transform:translate3d(0,0,0) scale(1)}
  50%{transform:translate3d(18px,-14px,0) scale(1.06)}
  100%{transform:translate3d(0,0,0) scale(1)}
}
@keyframes app-shimmer{
  from{transform:translateX(-120%)}
  to{transform:translateX(140%)}
}

body{
  min-height:100vh;
  background:
    radial-gradient(900px 620px at 8% 0%, rgba(79,140,255,.22), transparent 58%),
    radial-gradient(980px 640px at 92% 2%, rgba(34,211,238,.16), transparent 60%),
    linear-gradient(138deg, var(--bg) 0%, var(--bg-2) 52%, var(--bg-3) 100%);
}
body::before,
body::after{
  content:"";
  position:fixed;
  inset:auto;
  width:38vw;
  height:38vw;
  border-radius:999px;
  filter:blur(70px);
  pointer-events:none;
  z-index:-1;
  opacity:.28;
  animation:app-glow-drift 14s ease-in-out infinite;
}
body::before{
  top:-12vw;
  left:-8vw;
  background:radial-gradient(circle, rgba(96,165,250,.55) 0%, rgba(96,165,250,0) 72%);
}
body::after{
  right:-10vw;
  top:24vh;
  background:radial-gradient(circle, rgba(45,212,191,.45) 0%, rgba(45,212,191,0) 74%);
  animation-duration:17s;
  animation-delay:-4s;
}

.container{
  animation:app-fade-up .38s ease both;
}

.header{
  border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(180deg, rgba(17,26,46,.92), rgba(17,26,46,.74));
  box-shadow:
    0 24px 48px rgba(0,0,0,.30),
    inset 0 1px 0 rgba(255,255,255,.08);
}

.card{
  position:relative;
  border:1px solid rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(17,26,46,.90), rgba(17,26,46,.74));
  box-shadow:
    0 18px 44px rgba(0,0,0,.24),
    inset 0 1px 0 rgba(255,255,255,.08);
  transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  animation:app-fade-up .46s ease both;
}
.card:hover{
  transform:translateY(-2px);
  box-shadow:
    0 24px 48px rgba(0,0,0,.30),
    inset 0 1px 0 rgba(255,255,255,.10);
  border-color:rgba(125,211,252,.26);
}
.card::before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:1px;
  background:linear-gradient(90deg, rgba(125,211,252,0), rgba(125,211,252,.65), rgba(34,211,238,0));
  opacity:.68;
}

.grid .card:nth-child(2){animation-delay:.03s}
.grid .card:nth-child(3){animation-delay:.06s}
.grid .card:nth-child(4){animation-delay:.09s}
.grid .card:nth-child(5){animation-delay:.12s}
.grid .card:nth-child(6){animation-delay:.15s}

.btn{
  position:relative;
  overflow:hidden;
  border-radius:14px;
  transition:transform .14s ease, background .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.btn::after{
  content:"";
  position:absolute;
  top:0;
  left:0;
  width:46%;
  height:100%;
  background:linear-gradient(105deg, rgba(255,255,255,0), rgba(255,255,255,.26), rgba(255,255,255,0));
  transform:translateX(-140%);
  pointer-events:none;
}
.btn:hover::after{
  animation:app-shimmer .66s ease;
}
.btn:hover{
  transform:translateY(-1px);
  border-color:rgba(125,211,252,.40);
  box-shadow:0 12px 22px rgba(0,0,0,.24);
}
.btn.primary{
  background:
    linear-gradient(180deg, rgba(79,140,255,.48), rgba(79,140,255,.20)),
    linear-gradient(90deg, rgba(34,211,238,.18), rgba(34,211,238,0));
  border-color:rgba(125,211,252,.38);
}

.linkbtn{
  border-radius:11px;
  border-color:rgba(255,255,255,.14);
  transition:transform .14s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.linkbtn:hover{
  transform:translateY(-1px);
  border-color:rgba(125,211,252,.42);
  box-shadow:0 10px 18px rgba(0,0,0,.22);
}

/* Top navigation rail in headers */
.header{
  position:sticky;
  top:calc(env(safe-area-inset-top, 0px) + 10px);
  z-index:120;
}
.brand h1{
  font-size:clamp(1.05rem,1.8vw,1.46rem);
  letter-spacing:.01em;
  margin-bottom:2px;
  background:linear-gradient(90deg, #dbeafe 0%, #93c5fd 42%, #67e8f9 100%);
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}
.brand small{
  letter-spacing:.02em;
  opacity:.92;
}

.userbox div[style*="margin-top:8px"][style*="display:flex"][style*="gap:8px"],
.nav-rail{
  margin-top:12px !important;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08);
}
.nav-rail{
  display:flex;
  flex-wrap:nowrap;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  width:100%;
}
.nav-quick{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  flex:1 1 auto;
  min-width:0;
}
.nav-links{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  flex:1 1 auto;
  min-width:0;
}
.nav-rail .linkbtn,
.userbox div[style*="margin-top:8px"][style*="display:flex"][style*="gap:8px"] .linkbtn{
  background:
    linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.02)),
    rgba(15,23,42,.36);
}
.nav-rail a[href="/logout"],
.userbox div[style*="margin-top:8px"][style*="display:flex"][style*="gap:8px"] a[href="/logout"]{
  padding:8px 12px;
  border-radius:10px;
}
.nav-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(125,211,252,.38);
  background:linear-gradient(180deg, rgba(79,140,255,.34), rgba(79,140,255,.13));
  color:var(--text);
  border-radius:10px;
  padding:8px 12px;
  font-weight:800;
  font-size:13px;
  cursor:pointer;
}

.tablewrap{
  border-color:rgba(255,255,255,.10);
  background:rgba(5,10,23,.35);
}
.table tr{
  transition:background .16s ease;
}
.table tbody tr:hover{
  background:rgba(125,211,252,.08);
}
.table th{
  backdrop-filter:blur(5px);
}

.kpi{
  border-color:rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}
.kpi .v{
  text-shadow:0 6px 16px rgba(0,0,0,.28);
}

.status{
  border:1px solid rgba(125,211,252,.24);
  background:
    linear-gradient(180deg, rgba(125,211,252,.08), rgba(125,211,252,.02)),
    rgba(255,255,255,.02);
}

.input,
select.input,
textarea.input{
  border-color:rgba(255,255,255,.16);
  background:rgba(6,12,24,.52);
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.input:focus,
select.input:focus,
textarea.input:focus{
  border-color:rgba(125,211,252,.65);
  box-shadow:0 0 0 3px rgba(125,211,252,.18);
  background:rgba(6,12,24,.66);
}

.pill.ok{
  background:rgba(45,212,191,.14);
  color:var(--good);
  border-color:rgba(45,212,191,.35);
}

@media (max-width:980px){
  .header{
    align-items:stretch;
    top:8px;
  }
  .userbox{
    width:100%;
    align-items:stretch !important;
  }
  .userbox div[style*="margin-top:8px"][style*="display:flex"][style*="gap:8px"],
  .nav-rail{
    justify-content:flex-start !important;
    flex-wrap:wrap !important;
  }
  .nav-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    order:2;
  }
  .nav-quick{
    order:1;
    width:100%;
    justify-content:flex-start;
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:none;
    -ms-overflow-style:none;
  }
  .nav-quick::-webkit-scrollbar{display:none}
  .nav-links{
    width:100%;
    display:none;
    gap:8px;
    padding-top:2px;
    order:3;
  }
  .nav-rail.nav-open .nav-links{
    display:flex;
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    scrollbar-width:none;
    -ms-overflow-style:none;
  }
  .nav-rail.nav-open .nav-links::-webkit-scrollbar{
    display:none;
  }
  .nav-links .linkbtn,
  .nav-quick .linkbtn,
  .nav-links a[href="/logout"],
  .userbox div[style*="margin-top:8px"][style*="display:flex"][style*="gap:8px"] .linkbtn,
  .userbox div[style*="margin-top:8px"][style*="display:flex"][style*="gap:8px"] a[href="/logout"]{
    flex:0 0 auto;
    white-space:nowrap;
  }
}

@media (min-width:981px){
  .nav-toggle{
    display:none;
  }
  .nav-quick{
    flex:0 1 auto;
    max-width:60%;
  }
  .nav-links{
    flex:1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce){
  *{
    animation:none !important;
    transition:none !important;
    scroll-behavior:auto !important;
  }
}

@media print{
  body::before,
  body::after{
    display:none !important;
  }
  .header{
    position:static !important;
  }
}

/* Final polish overrides for stronger visual contrast */
.container{
  max-width:1380px;
  padding:22px;
}
.grid{
  gap:18px;
}
.actions{
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
}
.news-item{
  border-color:rgba(125,211,252,.18);
  background:
    linear-gradient(180deg, rgba(125,211,252,.10), rgba(125,211,252,.03)),
    rgba(255,255,255,.02);
}
.footer{
  margin-top:18px;
  padding:12px 14px;
  border:1px solid rgba(255,255,255,.10);
  border-radius:12px;
  background:rgba(255,255,255,.03);
}

@media (max-width:640px){
  .container{
    padding:14px;
  }
  .card{
    padding:14px;
  }
}

/* =========================
   Navigation v3 (no filter)
   ========================= */
.nav-rail{
  position:relative;
  gap:10px;
}
.nav-quick{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
  flex:1 1 auto;
  min-width:0;
}
.nav-tools{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  align-items:center;
  flex:0 0 auto;
}
.nav-trigger{
  border:1px solid rgba(125,211,252,.40);
  background:linear-gradient(180deg, rgba(56,189,248,.30), rgba(56,189,248,.10));
  color:var(--text);
  border-radius:12px;
  padding:9px 12px;
  font-weight:800;
  font-size:13px;
  cursor:pointer;
  transition:transform .15s ease, border-color .15s ease, background .15s ease;
}
.nav-trigger:hover{
  transform:translateY(-1px);
  border-color:rgba(125,211,252,.62);
  background:linear-gradient(180deg, rgba(56,189,248,.38), rgba(56,189,248,.14));
}
.nav-logout{
  border:1px solid rgba(251,113,133,.34) !important;
  background:linear-gradient(180deg, rgba(251,113,133,.18), rgba(251,113,133,.04)) !important;
  color:#ffd5dd !important;
  padding:9px 12px !important;
  border-radius:12px !important;
}

.nav-panel{
  position:absolute;
  top:calc(100% + 10px);
  right:0;
  width:min(940px, calc(100vw - 48px));
  max-height:min(72vh, 680px);
  overflow:auto;
  padding:14px;
  border-radius:16px;
  border:1px solid rgba(125,211,252,.28);
  background:
    radial-gradient(900px 340px at 0% 0%, rgba(125,211,252,.16), rgba(125,211,252,0) 58%),
    linear-gradient(180deg, rgba(17,26,46,.96), rgba(17,26,46,.90));
  box-shadow:0 24px 50px rgba(0,0,0,.35);
  z-index:140;
  display:none;
}
.nav-panel-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
  padding-bottom:10px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.nav-panel-title{
  font-weight:900;
  letter-spacing:.01em;
  font-size:16px;
}
.nav-panel-links{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(220px, 1fr));
  gap:8px;
}
.nav-panel-source{
  display:none !important;
}
.nav-panel-link{
  display:block;
  border:1px solid rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border-radius:12px;
  padding:10px 12px;
  font-weight:700;
  transition:transform .15s ease, border-color .15s ease, background .15s ease;
}
.nav-panel-link:hover{
  transform:translateY(-1px);
  border-color:rgba(125,211,252,.48);
  background:linear-gradient(180deg, rgba(125,211,252,.16), rgba(125,211,252,.05));
}
.nav-panel-logout{
  border-color:rgba(251,113,133,.38);
  color:#ffd8de;
}
.nav-panel-backdrop{
  position:fixed;
  inset:0;
  background:rgba(3,8,20,.45);
  z-index:130;
  display:none;
}
.nav-rail.nav-open .nav-panel{
  display:block;
  animation:app-fade-up .22s ease;
}
.nav-rail.nav-open .nav-panel-backdrop{
  display:block;
}

/* =========================
   Login polish v2
   ========================= */
.login-main-card{
  position:relative;
  overflow:hidden;
}
.login-main-card::after{
  content:"";
  position:absolute;
  right:-16%;
  top:-40%;
  width:42%;
  height:180%;
  pointer-events:none;
  background:linear-gradient(180deg, rgba(56,189,248,.10), rgba(56,189,248,0));
  transform:rotate(14deg);
}
.login-inner-split{
  gap:22px;
}
.login-inner-left{
  position:relative;
  z-index:2;
}
.login-inner-right{
  position:relative;
  z-index:2;
}

@media (max-width:980px){
  .nav-quick{
    width:100%;
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    justify-content:flex-start;
    scrollbar-width:none;
    -ms-overflow-style:none;
  }
  .nav-quick::-webkit-scrollbar{
    display:none;
  }
  .nav-tools{
    width:100%;
    justify-content:space-between;
  }
  .nav-panel{
    position:fixed;
    left:12px;
    right:12px;
    top:auto;
    bottom:12px;
    width:auto;
    max-height:78vh;
    border-radius:18px;
  }
  .nav-panel-links{
    grid-template-columns:1fr;
  }
}

@media (max-width:680px){
  .login-logo{
    max-width:170px;
  }
  .login-title-block h2{
    font-size:1.18rem;
  }
}

body.is-pwa-compact{
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(56,189,248,.16), rgba(56,189,248,0) 60%),
    linear-gradient(180deg, #0b1220 0%, #0d172b 100%);
}
body.is-pwa-compact .container{
  max-width:100%;
  padding:10px 10px calc(env(safe-area-inset-bottom, 0px) + 92px);
}
body.is-pwa-compact .header{
  position:sticky;
  top:calc(env(safe-area-inset-top, 0px) + 8px);
  z-index:30;
  border-radius:16px;
  background:linear-gradient(180deg, rgba(15,23,42,.96), rgba(17,26,46,.92));
  box-shadow:0 14px 30px rgba(0,0,0,.28);
}
body.is-pwa-compact .brand h1{font-size:1.05rem}
body.is-pwa-compact .brand small{font-size:.82rem}
body.is-pwa-compact .grid{gap:10px;margin-top:10px}
body.is-pwa-compact .card{
  border-radius:16px;
  padding:12px;
  background:linear-gradient(180deg, rgba(17,26,46,.88), rgba(15,23,42,.78));
  box-shadow:0 10px 24px rgba(0,0,0,.22);
}
body.is-pwa-compact .status,
body.is-pwa-compact .kpi,
body.is-pwa-compact .news-item{border-radius:14px}
body.is-pwa-compact .tablewrap{
  border-radius:14px;
  -webkit-overflow-scrolling:touch;
}
body.is-pwa-compact .table{min-width:720px}
body.is-pwa-compact .btn,
body.is-pwa-compact .linkbtn{
  min-height:46px;
  border-radius:14px;
}
body.is-pwa-compact .login-main-card{
  padding:14px;
  border-radius:18px;
}
body.is-pwa-compact .login-logo{
  width:min(100%, 190px);
  max-width:190px;
}
body.is-pwa-compact .login-form-grid{
  padding:12px;
  border-radius:14px;
}
body.is-pwa-compact .footer{padding-bottom:4px}

.pwa-dock{
  position:fixed;
  left:12px;
  right:12px;
  bottom:calc(env(safe-area-inset-bottom, 0px) + 10px);
  z-index:60;
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:8px;
  padding:10px;
  border:1px solid rgba(148,163,184,.24);
  border-radius:18px;
  background:
    linear-gradient(180deg, rgba(15,23,42,.94), rgba(17,26,46,.92)),
    radial-gradient(720px 180px at 50% 0%, rgba(56,189,248,.12), rgba(56,189,248,0) 70%);
  backdrop-filter:blur(14px);
  box-shadow:0 18px 36px rgba(0,0,0,.34);
}
.pwa-dock-link{
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.05);
  color:var(--text);
  font-size:13px;
  font-weight:900;
}
.pwa-dock-link:hover{background:rgba(255,255,255,.09)}
.pwa-dock-home{
  border-color:rgba(251,191,36,.54);
  background:linear-gradient(180deg, rgba(251,191,36,.24), rgba(251,191,36,.10));
  color:#fff3bf;
}
.pwa-dock-menu{
  cursor:pointer;
  font-family:inherit;
}

@media (min-width:861px){
  .pwa-dock{display:none !important}
}

/* =========================
   UI refinement 2026-03-03
   ========================= */

@keyframes ui-float-soft{
  0%{transform:translate3d(0,0,0)}
  50%{transform:translate3d(0,-8px,0)}
  100%{transform:translate3d(0,0,0)}
}
@keyframes ui-pulse-soft{
  0%{opacity:.55}
  50%{opacity:.9}
  100%{opacity:.55}
}
@keyframes ui-drift-lines{
  from{transform:translateY(0)}
  to{transform:translateY(-40px)}
}

/* Header navigation: clearer hierarchy and more symmetric layout */
.nav-rail{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  align-items:center;
  gap:12px;
  width:100%;
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,.24);
  background:linear-gradient(180deg, rgba(30,41,59,.72), rgba(15,23,42,.64));
}
.nav-quick{
  justify-content:flex-start;
  align-items:center;
  gap:9px;
  flex-wrap:wrap;
  min-width:0;
  max-width:none;
}
.nav-center{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
}
.nav-tools{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:8px;
  min-width:fit-content;
}
.nav-trigger-primary{
  min-width:164px;
  min-height:42px;
  border-radius:14px;
  font-weight:900;
  font-size:14px;
  letter-spacing:.02em;
  border:1px solid rgba(125,211,252,.62);
  background:
    linear-gradient(180deg, rgba(56,189,248,.44), rgba(56,189,248,.18)),
    linear-gradient(90deg, rgba(125,211,252,.26), rgba(125,211,252,0));
  box-shadow:0 12px 24px rgba(2,132,199,.22);
}
.nav-trigger-primary:hover{
  border-color:rgba(125,211,252,.9);
  box-shadow:0 14px 26px rgba(2,132,199,.30);
}
.nav-start-btn{
  min-height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(251,191,36,.60) !important;
  background:
    linear-gradient(180deg, rgba(251,191,36,.30), rgba(251,191,36,.14)),
    linear-gradient(90deg, rgba(254,240,138,.20), rgba(254,240,138,0)) !important;
  color:#fff7d1 !important;
  font-weight:900;
  box-shadow:0 10px 22px rgba(202,138,4,.18);
}
.nav-start-btn:hover{
  border-color:rgba(251,191,36,.9) !important;
  box-shadow:0 12px 24px rgba(202,138,4,.26);
}
.nav-tools .nav-logout{
  min-height:42px;
  display:inline-flex;
  align-items:center;
  border:1px solid rgba(251,113,133,.48) !important;
  background:linear-gradient(180deg, rgba(251,113,133,.32), rgba(251,113,133,.12)) !important;
  color:#ffe5eb !important;
  font-weight:900;
}
.nav-panel{
  right:0;
}

/* Login cleanup + centered logo + richer visuals */
.login-topline{
  justify-content:center;
  margin-bottom:14px;
}
.login-logo-wrap{
  width:100%;
  justify-content:center;
  text-align:center;
}
.login-logo{
  max-width:290px;
  width:min(100%, 290px);
  margin:0 auto;
}
.login-title-block,
.login-helper-pills{
  display:none !important;
}
.login-main-card{
  position:relative;
  overflow:hidden;
  border:1px solid rgba(125,211,252,.28);
  background:
    radial-gradient(900px 380px at 8% -10%, rgba(56,189,248,.18), rgba(56,189,248,0) 60%),
    linear-gradient(180deg, rgba(17,26,46,.88), rgba(17,26,46,.72));
}
.login-main-card::before{
  content:"";
  position:absolute;
  left:-120px;
  top:-160px;
  width:360px;
  height:360px;
  border-radius:999px;
  pointer-events:none;
  background:radial-gradient(circle, rgba(34,211,238,.26), rgba(34,211,238,0) 70%);
  animation:ui-float-soft 8s ease-in-out infinite;
}
.login-decor{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:hidden;
  z-index:1;
}
.login-decor-orb{
  position:absolute;
  border-radius:999px;
  filter:blur(2px);
}
.login-decor-orb-a{
  width:180px;
  height:180px;
  right:-30px;
  top:14%;
  background:radial-gradient(circle, rgba(56,189,248,.25), rgba(56,189,248,0) 72%);
  animation:ui-float-soft 10s ease-in-out infinite;
}
.login-decor-orb-b{
  width:220px;
  height:220px;
  right:14%;
  bottom:-110px;
  background:radial-gradient(circle, rgba(96,165,250,.24), rgba(96,165,250,0) 72%);
  animation:ui-float-soft 12s ease-in-out infinite;
  animation-delay:-3s;
}
.login-decor-grid{
  position:absolute;
  right:-80px;
  top:-40px;
  width:360px;
  height:360px;
  border-radius:999px;
  background:
    repeating-linear-gradient(0deg, rgba(148,163,184,.16) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(90deg, rgba(148,163,184,.12) 0 1px, transparent 1px 14px);
  opacity:.20;
  animation:ui-drift-lines 18s linear infinite;
}
.login-main-card > *:not(.login-decor){
  position:relative;
  z-index:2;
}

/* Dashboard visual hero */
.dashboard-hero{
  margin-top:14px;
  overflow:hidden;
  border:1px solid rgba(125,211,252,.26);
  background:
    radial-gradient(900px 360px at 0% 0%, rgba(56,189,248,.14), rgba(56,189,248,0) 60%),
    linear-gradient(180deg, rgba(17,26,46,.84), rgba(17,26,46,.72));
}
.dashboard-hero-visual-only{
  padding:12px;
}
.dashboard-hero-main{
  display:grid;
  grid-template-columns:minmax(0,1.2fr) minmax(240px,.8fr);
  gap:16px;
  align-items:stretch;
}
.dashboard-hero-copy h2{
  margin:4px 0 8px 0;
  font-size:clamp(1.18rem,1.9vw,1.5rem);
}
.dashboard-hero-eyebrow{
  display:inline-flex;
  align-items:center;
  border:1px solid rgba(125,211,252,.36);
  border-radius:999px;
  padding:5px 10px;
  font-size:12px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:#dbeafe;
  background:rgba(56,189,248,.14);
}
.dashboard-hero-metrics{
  margin-top:12px;
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:10px;
}
.dashboard-hero-metric{
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  padding:10px 12px;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.01));
}
.dashboard-hero-metric .label{
  color:#9fb0cd;
  font-size:12px;
  font-weight:700;
}
.dashboard-hero-metric .value{
  margin-top:4px;
  font-weight:900;
}
.dashboard-hero-visual{
  position:relative;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:linear-gradient(160deg, rgba(15,23,42,.52), rgba(30,41,59,.78));
  overflow:hidden;
  min-height:150px;
}
.dashboard-orb{
  position:absolute;
  border-radius:999px;
  filter:blur(2px);
}
.dashboard-orb-a{
  width:130px;
  height:130px;
  left:14px;
  top:18px;
  background:radial-gradient(circle, rgba(56,189,248,.36), rgba(56,189,248,0) 72%);
  animation:ui-float-soft 7s ease-in-out infinite;
}
.dashboard-orb-b{
  width:190px;
  height:190px;
  right:-36px;
  top:-26px;
  background:radial-gradient(circle, rgba(79,140,255,.32), rgba(79,140,255,0) 72%);
  animation:ui-float-soft 9s ease-in-out infinite;
  animation-delay:-2s;
}
.dashboard-orb-c{
  width:140px;
  height:140px;
  right:34px;
  bottom:-52px;
  background:radial-gradient(circle, rgba(45,212,191,.34), rgba(45,212,191,0) 72%);
  animation:ui-pulse-soft 6s ease-in-out infinite;
}
.dashboard-grid-lines{
  position:absolute;
  inset:-30% -20%;
  background:
    repeating-linear-gradient(0deg, rgba(148,163,184,.16) 0 1px, transparent 1px 16px),
    repeating-linear-gradient(90deg, rgba(148,163,184,.13) 0 1px, transparent 1px 16px);
  opacity:.22;
  animation:ui-drift-lines 18s linear infinite;
}

/* Global banner readability */
.global-banner-inner{
  border:1px solid rgba(251,191,36,.74);
  background:
    linear-gradient(180deg, rgba(30,41,59,.96), rgba(15,23,42,.96)),
    radial-gradient(680px 240px at 0% 0%, rgba(251,191,36,.18), rgba(251,191,36,0) 60%);
  color:#ffffff;
  border-radius:14px;
  padding:12px 16px;
  box-shadow:0 14px 28px rgba(0,0,0,.34);
}
.global-banner-title{
  color:#fbbf24;
  font-size:12px;
  font-weight:900;
  letter-spacing:.06em;
}
.global-banner-text{
  margin-top:6px;
  color:#ffffff;
  font-size:15px;
  line-height:1.45;
  font-weight:900;
}

@media (max-width:980px){
  .nav-rail{
    grid-template-columns:auto 1fr auto;
    gap:8px;
    align-items:center;
  }
  .nav-center{
    order:2;
    justify-content:center;
    width:100%;
  }
  .nav-tools{
    order:3;
    width:auto;
    justify-content:flex-end;
  }
  .nav-tools .nav-logout{
    width:auto;
    min-width:0;
    justify-content:center;
  }
  .nav-quick{
    order:1;
    width:auto;
    display:none;
  }
  .nav-quick::-webkit-scrollbar{
    display:none;
  }
  .nav-trigger-primary{
    width:auto;
    max-width:none;
    min-width:112px;
    min-height:40px;
  }
  .nav-start-btn{
    min-width:88px;
    min-height:40px;
  }
  .dashboard-hero-main{
    grid-template-columns:1fr;
  }
  .dashboard-hero-metrics{
    grid-template-columns:1fr;
  }
}

@media (max-width:680px){
  .login-logo{
    max-width:220px;
  }
}

/* PWA / Mobile tweaks */
@media (max-width:860px){
  .container{padding:12px;}
  .header{flex-direction:column;align-items:flex-start;}
  .userbox{width:100%;align-items:flex-start !important;}
  .brand h1{font-size:22px;}
  .card{padding:14px;}
  .grid{display:grid;grid-template-columns:1fr !important;gap:12px;}
  .linkbtn{
    padding:10px 12px;
    min-height:42px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }
  .btn{width:100%;text-align:center;}
  .actions{flex-direction:column;align-items:stretch;}
  .ai-chat{height:50vh;}
  /* iOS: prevent input zoom on focus */
  input, select, textarea{font-size:16px;}
  .input, select.input, textarea.input{font-size:16px;}
  /* Keep enough space for iOS home indicator */
  body{padding-bottom:calc(env(safe-area-inset-bottom, 0px) + 10px);}
}

/* Mobile: navigation panel should feel like an app screen */
@media (max-width:860px){
  .nav-rail{
    grid-template-columns:auto 1fr auto;
    padding:10px;
    gap:8px;
  }
  .nav-center{
    justify-content:center;
    gap:8px;
  }
  .nav-start-btn,
  .nav-trigger-primary,
  .nav-tools .nav-logout{
    min-height:38px;
    min-width:0;
    padding:10px 12px;
    font-size:13px;
    border-radius:12px;
  }
  .nav-trigger-primary{
    min-width:84px;
  }
  .nav-panel{
    position:fixed;
    left:12px;
    right:12px;
    top:calc(env(safe-area-inset-top, 0px) + 12px);
    bottom:calc(env(safe-area-inset-bottom, 0px) + 12px);
    width:auto;
    max-height:none;
    overflow:auto;
  }
  .nav-panel-links{
    grid-template-columns:1fr;
  }
  .nav-panel-link{
    padding:14px 14px;
    min-height:48px;
    display:flex;
    align-items:center;
    justify-content:space-between;
  }
  .nav-panel-head{
    position:sticky;
    top:0;
    background:linear-gradient(180deg, rgba(17,26,46,.98), rgba(17,26,46,.92));
    z-index:2;
    margin:-14px -14px 12px -14px;
    padding:14px;
    border-bottom:1px solid rgba(255,255,255,.10);
    border-radius:16px 16px 0 0;
  }
  .dashboard-hero{
    display:none;
  }
}

/* =========================
   PWA layout pass (2026-03-04)
   Login + Dashboard proportions only
   ========================= */
@media (max-width:980px){
  .container{
    max-width:100%;
    padding:12px;
  }
  .header{
    border-radius:14px;
    padding:12px;
  }
  .brand h1{
    font-size:1.1rem;
  }
  .brand small{
    font-size:.88rem;
  }

  .login-onecard{
    margin-top:10px;
  }
  .login-main-card{
    max-width:100%;
    border-radius:16px;
    padding:14px;
  }
  .login-topline{
    justify-content:center;
  }
  .login-logo{
    width:min(100%, 210px);
    max-width:210px;
  }
  .login-inner-split{
    flex-direction:column;
    gap:12px;
  }
  .login-inner-left,
  .login-inner-right{
    min-width:0;
    max-width:none;
    width:100%;
  }
  .login-side-panels{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
  }
  .login-form-grid{
    padding:12px;
    gap:10px;
  }
  .login-submit{
    min-height:46px;
  }

  .grid{
    gap:10px;
    margin-top:10px;
  }
  .card{
    border-radius:14px;
    padding:12px;
  }
  .kpis{
    grid-template-columns:1fr;
    gap:8px;
  }
  .kpi .v{
    font-size:1.8rem;
  }
  .actions{
    grid-template-columns:1fr;
    gap:8px;
  }
  .btn{
    min-height:46px;
    border-radius:14px;
  }
  .tablewrap{
    border-radius:12px;
  }
}

@media (max-width:640px){
  .container{
    padding:10px;
  }
  .header{
    gap:8px;
  }
  .userbox{
    width:100%;
    align-items:stretch !important;
  }
  .userbox > div{
    width:100%;
  }
  .userbox a.linkbtn,
  .userbox .linkbtn{
    flex:1 1 auto;
    justify-content:center;
  }
  .login-main-card{
    padding:12px;
  }
  .login-logo{
    max-width:180px;
  }
  .footer{
    font-size:11px;
  }
  .pwa-dock{
    left:10px;
    right:10px;
    gap:6px;
    padding:8px;
  }
  .pwa-dock-link{
    min-height:46px;
    padding:9px 8px;
    font-size:12px;
  }
}

/* =========================
   PWA clean navigation (slide-out only)
   ========================= */
body.is-pwa-compact .header .nav-rail{
  display:none !important;
}
body.is-pwa-compact .header{
  position:static;
  top:auto;
  padding:10px 12px;
}
body.is-pwa-compact .container{
  max-width:1100px;
  margin:0 auto;
  padding:10px 10px 18px;
}
body.is-pwa-compact .grid{
  gap:12px;
}
body.is-pwa-compact .table{
  min-width:660px;
}
body.is-pwa-compact .table th,
body.is-pwa-compact .table td{
  padding:10px 8px;
  font-size:13px;
}
body.is-pwa-compact .card{
  padding:12px;
}

.pwa-fab-menu{
  position:fixed;
  right:14px;
  top:calc(env(safe-area-inset-top, 0px) + 14px);
  z-index:180;
  border:1px solid rgba(125,211,252,.55);
  background:
    linear-gradient(180deg, rgba(56,189,248,.42), rgba(56,189,248,.18)),
    linear-gradient(90deg, rgba(125,211,252,.22), rgba(125,211,252,0));
  color:#dff7ff;
  border-radius:14px;
  min-height:42px;
  min-width:94px;
  padding:10px 14px;
  font-weight:900;
  font-size:13px;
  letter-spacing:.01em;
  box-shadow:0 12px 30px rgba(2,132,199,.34);
}

.pwa-slide-backdrop{
  position:fixed;
  inset:0;
  z-index:170;
  background:rgba(2,6,23,.56);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease;
}

.pwa-slide-menu{
  position:fixed;
  top:0;
  right:0;
  height:100dvh;
  width:min(90vw, 360px);
  z-index:175;
  border-left:1px solid rgba(148,163,184,.26);
  background:
    radial-gradient(680px 260px at 100% 0%, rgba(56,189,248,.18), rgba(56,189,248,0) 62%),
    linear-gradient(180deg, rgba(12,20,36,.98), rgba(12,20,36,.95));
  box-shadow:-24px 0 50px rgba(0,0,0,.38);
  transform:translateX(102%);
  transition:transform .22s ease;
  display:flex;
  flex-direction:column;
}

.pwa-slide-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:14px 14px 12px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.pwa-slide-title{
  font-size:16px;
  font-weight:900;
  color:#dbeafe;
}
.pwa-slide-close{
  border:1px solid rgba(148,163,184,.28);
  border-radius:10px;
  background:rgba(255,255,255,.05);
  color:#e2e8f0;
  min-height:34px;
  min-width:34px;
  font-size:20px;
  line-height:1;
}

.pwa-slide-links{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  padding:12px;
  overflow:auto;
}
.pwa-slide-link{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  min-height:48px;
  border:1px solid rgba(148,163,184,.24);
  border-radius:12px;
  padding:12px;
  font-weight:800;
  color:var(--text);
  background:linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
}
.pwa-slide-link:hover{
  border-color:rgba(125,211,252,.48);
  background:linear-gradient(180deg, rgba(125,211,252,.18), rgba(125,211,252,.05));
}

body.pwa-slide-open .pwa-slide-backdrop{
  opacity:1;
  pointer-events:auto;
}
body.pwa-slide-open .pwa-slide-menu{
  transform:translateX(0);
}

@media (min-width:861px){
  .pwa-fab-menu,
  .pwa-slide-menu,
  .pwa-slide-backdrop{
    display:none !important;
  }
}

@media (max-width:640px){
  .pwa-fab-menu{
    right:10px;
    top:calc(env(safe-area-inset-top, 0px) + 10px);
    min-height:40px;
    min-width:86px;
    padding:8px 12px;
  }
  .pwa-slide-menu{
    width:min(94vw, 340px);
  }
  body.is-pwa-compact .table{
    min-width:600px;
  }
}

/* =========================
   PWA page-by-page layout pass
   ========================= */
body.is-pwa-compact .brand small{
  display:none;
}
body.is-pwa-compact .header{
  margin-bottom:10px;
}
body.is-pwa-compact .footer{
  margin-bottom:10px;
}

/* Dashboard */
body.is-pwa-compact.page-dashboard .grid{
  grid-template-columns:1fr !important;
  gap:12px;
}
body.is-pwa-compact.page-dashboard .span-2{
  grid-column:auto !important;
}
body.is-pwa-compact.page-dashboard .kpis{
  grid-template-columns:1fr;
}
body.is-pwa-compact.page-dashboard .actions{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}
body.is-pwa-compact.page-dashboard #room-now-card .table{
  min-width:520px;
}

/* Kalender */
body.is-pwa-compact.page-calendar .card > div[style*="justify-content:space-between"]{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:10px !important;
}
body.is-pwa-compact.page-calendar form[action="/calendar"]{
  width:100%;
  display:grid !important;
  grid-template-columns:1fr 1fr;
  gap:8px !important;
}
body.is-pwa-compact.page-calendar form[action="/calendar"] .btn{
  grid-column:1 / -1;
}
body.is-pwa-compact.page-calendar .kpi{
  min-width:0 !important;
  flex:1 1 100%;
}
body.is-pwa-compact.page-calendar .table{
  min-width:900px;
}

/* Raumplan */
body.is-pwa-compact.page-raumplan .card > div[style*="justify-content:space-between"]{
  grid-template-columns:1fr !important;
}
body.is-pwa-compact.page-raumplan form[action="/raumplan/room/add"],
body.is-pwa-compact.page-raumplan form[action="/raumplan/location/add"],
body.is-pwa-compact.page-raumplan form[action="/raumplan/staff/add"]{
  display:grid !important;
  grid-template-columns:1fr !important;
  width:100%;
}
body.is-pwa-compact.page-raumplan .calwrap{
  overflow:auto;
  border-radius:12px;
}
body.is-pwa-compact.page-raumplan .calbody,
body.is-pwa-compact.page-raumplan .calheader{
  min-width:860px;
}

/* Chat */
body.is-pwa-compact.page-chat .chatlayout{
  grid-template-columns:1fr !important;
  gap:10px !important;
}
body.is-pwa-compact.page-chat .chatmessages{
  height:54dvh !important;
}
body.is-pwa-compact.page-chat .chatbubble{
  max-width:92% !important;
}
body.is-pwa-compact.page-chat .chatform{
  grid-template-columns:1fr !important;
}

/* Requests */
body.is-pwa-compact.page-requests .grid{
  grid-template-columns:1fr !important;
  gap:12px;
}
body.is-pwa-compact.page-requests form[action="/requests/new"] > div,
body.is-pwa-compact.page-requests form[action="/absences/new"] > div{
  grid-template-columns:1fr !important;
}
body.is-pwa-compact.page-requests .table{
  min-width:820px;
}

/* Assistant pages */
body.is-pwa-compact.page-assistant .ai-input{
  display:grid !important;
  grid-template-columns:1fr !important;
}
body.is-pwa-compact.page-assistant .ai-input textarea{
  min-height:120px !important;
}
body.is-pwa-compact.page-assistant .ai-chat{
  height:58dvh !important;
}
body.is-pwa-compact.page-admin-ai form[action="/admin/assistant/save"] > div[style*="grid-template-columns:1fr 1fr"]{
  grid-template-columns:1fr !important;
}

@media (max-width:640px){
  body.is-pwa-compact.page-calendar form[action="/calendar"]{
    grid-template-columns:1fr;
  }
  body.is-pwa-compact.page-calendar .table{
    min-width:820px;
  }
  body.is-pwa-compact.page-requests .table{
    min-width:760px;
  }
  body.is-pwa-compact.page-chat .chatmessages{
    height:50dvh !important;
  }
}

/* =========================
   Global PWA fit across remaining pages
   ========================= */
body.is-pwa-compact .container{
  max-width:1100px;
  margin:0 auto;
}
body.is-pwa-compact .header{
  border-radius:14px;
}
body.is-pwa-compact .header .brand h1{
  font-size:1.25rem;
  line-height:1.2;
}
body.is-pwa-compact .header .userbox{
  width:100%;
  align-items:flex-start !important;
}
body.is-pwa-compact .header .userbox > div{
  width:100%;
}
body.is-pwa-compact .card{
  border-radius:14px;
}
body.is-pwa-compact .card h2{
  font-size:1.05rem;
}
body.is-pwa-compact .btn,
body.is-pwa-compact .linkbtn{
  min-height:44px;
}
body.is-pwa-compact .input,
body.is-pwa-compact textarea.input,
body.is-pwa-compact select.input{
  min-height:42px;
  font-size:16px;
}

/* Inline-grid forms used in many templates: force single-column on mobile */
body.is-pwa-compact .card form[style*="grid-template-columns"]{
  grid-template-columns:1fr !important;
}
body.is-pwa-compact .card div[style*="grid-template-columns"]{
  grid-template-columns:1fr !important;
}

/* Common inline flex rows: allow safe wrapping */
body.is-pwa-compact .card div[style*="display:flex"][style*="gap"]{
  flex-wrap:wrap !important;
}

/* Improve table readability globally */
body.is-pwa-compact .tablewrap{
  overflow:auto;
  border-radius:12px;
}
body.is-pwa-compact .table{
  min-width:720px;
}
body.is-pwa-compact .table th,
body.is-pwa-compact .table td{
  vertical-align:top;
  line-height:1.35;
}

/* Admin pages: dense forms and long rows */
body.is-pwa-compact[data-page-key^="admin"] .grid{
  grid-template-columns:1fr !important;
}
body.is-pwa-compact[data-page-key^="admin"] .card{
  padding:12px;
}
body.is-pwa-compact[data-page-key^="admin"] form[style*="grid-template-columns"]{
  grid-template-columns:1fr !important;
}
body.is-pwa-compact[data-page-key^="admin"] .table{
  min-width:780px;
}

/* Tester / forms pages are usually table heavy */
body.is-pwa-compact[data-page-key^="tester"] .table,
body.is-pwa-compact[data-page-key^="tests"] .table,
body.is-pwa-compact[data-page-key^="fragebogen"] .table{
  min-width:860px;
}

/* Library + inventory + export + statistics pages */
body.is-pwa-compact[data-page-key^="library"] .table,
body.is-pwa-compact[data-page-key^="inventory"] .table,
body.is-pwa-compact[data-page-key^="export"] .table,
body.is-pwa-compact[data-page-key*="stat"] .table{
  min-width:820px;
}

@media (max-width:860px){
  body.is-pwa-compact .container{
    padding-top:8px;
  }
  body.is-pwa-compact .header{
    padding:10px;
  }
  body.is-pwa-compact .card{
    padding:11px;
  }
  body.is-pwa-compact .table{
    min-width:680px;
  }
}

@media (max-width:640px){
  body.is-pwa-compact .header .brand h1{
    font-size:1.12rem;
  }
  body.is-pwa-compact .table{
    min-width:620px;
  }
  body.is-pwa-compact[data-page-key^="admin"] .table{
    min-width:700px;
  }
  body.is-pwa-compact[data-page-key^="tester"] .table,
  body.is-pwa-compact[data-page-key^="tests"] .table,
  body.is-pwa-compact[data-page-key^="fragebogen"] .table{
    min-width:760px;
  }
}
