/* Mitarbeiter-App */
html, body { touch-action: manipulation; }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }

.bg-deco { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .55; }
.bg-deco svg { width: 100%; height: 100%; }
.bg-deco path { fill: none; stroke-linecap: square; }
.bg-deco .roof { stroke: rgba(31, 44, 81, .06); stroke-width: 14; stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.6s .2s var(--ease) forwards; }
.bg-deco .floor { stroke: rgba(192, 205, 11, .16); stroke-width: 10; stroke-dasharray: 500; stroke-dashoffset: 500; animation: draw 1.6s .6s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.view { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.view.enter { animation: viewIn .45s var(--ease); }
/* nur einblenden (ohne Verschieben), damit die Seite nie kurz überläuft */
@keyframes viewIn { from { opacity: 0; } }

.container { width: min(100% - 32px, 980px); margin: 0 auto; }
.container.narrow { width: min(100% - 32px, 560px); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }

/* ---------------- Auswahl */
.hero { text-align: center; padding: calc(28px + env(safe-area-inset-top)) 16px 18px; }
.logo-wrap { display: inline-block; overflow: hidden; }
.logo { width: min(78vw, 380px); height: auto; display: block; animation: logoIn 1s .1s var(--ease) both; }
@keyframes logoIn { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.hero-sub { margin: .6rem 0 0; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; font-size: .78rem; color: var(--muted); animation: fade 1s .5s both; }
.clock { font-size: clamp(2.6rem, 11vw, 3.6rem); font-weight: 800; color: var(--navy); letter-spacing: -.02em; margin-top: .3rem; animation: fade 1s .6s both; }
.date { color: var(--muted); font-weight: 500; animation: fade 1s .7s both; }

.search {
  display: flex; align-items: center; gap: .6rem; background: #fff; border-radius: 16px; padding: .2rem 1rem;
  box-shadow: var(--shadow); margin: 1rem 0 1.1rem; color: var(--muted); border: 1.5px solid transparent; transition: border-color .2s;
}
.search:focus-within { border-color: var(--navy); }
.search input { border: 0; outline: 0; flex: 1; padding: .8rem 0; background: transparent; font-size: 1.05rem; color: var(--text); }

.emp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
@media (max-width: 420px) { .emp-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.emp {
  background: var(--card); border: 0; border-radius: var(--radius); padding: 1.1rem .7rem .95rem;
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: .55rem;
  transition: transform .2s var(--spring), box-shadow .2s; position: relative;
  animation: cardIn .5s var(--ease) both;
}
.emp:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.emp:active { transform: scale(.96); }
.emp .name { font-weight: 650; text-align: center; line-height: 1.2; }
.emp .name small { display: block; font-weight: 500; color: var(--muted); }
.emp .status-dot { position: absolute; top: 12px; right: 12px; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(63, 155, 75, .6); animation: pulse 2s infinite; }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(63, 155, 75, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 155, 75, 0); } }

.avatar {
  --h: 220; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 750; font-size: 1.2rem; color: #fff; letter-spacing: .02em;
  background: linear-gradient(135deg, hsl(var(--h) 45% 32%), hsl(calc(var(--h) + 30) 50% 45%));
  flex-shrink: 0;
}
.avatar.big { width: 92px; height: 92px; font-size: 2rem; box-shadow: 0 10px 30px rgba(31, 44, 81, .25); animation: pop .5s var(--spring); }
.avatar.xs { width: 30px; height: 30px; font-size: .75rem; }

.empty { text-align: center; color: var(--muted); }

/* ---------------- PIN */
#view-pin { padding-bottom: 0; }
.pin-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: calc(24px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); position: relative; max-width: 420px; margin: 0 auto; }
.pin-wrap h1 { margin: .9rem 0 .1rem; color: var(--navy); font-size: 1.6rem; }
.back { position: absolute; left: 12px; top: calc(16px + env(safe-area-inset-top)); background: #fff; border: 0; border-radius: 50%; width: 46px; height: 46px; display: grid; place-items: center; box-shadow: var(--shadow); color: var(--navy); }
.pin-dots { display: flex; gap: 16px; margin: 1.4rem 0 1.6rem; min-height: 20px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--navy); transition: background .2s, transform .25s var(--spring); }
.pin-dots span.on { background: var(--navy); transform: scale(1.15); }
.pin-dots.ok span { background: var(--lime); border-color: var(--lime); transform: scale(1.25); }
.pin-dots.err span { border-color: var(--danger); background: var(--danger); }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 16px 22px; }
.key { user-select: none; -webkit-user-select: none;
  width: 78px; height: 78px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow);
  font-size: 1.8rem; font-weight: 600; color: var(--navy); transition: transform .12s, background .15s;
}
.key:active { transform: scale(.9); background: var(--lime-soft); }
.key.fn { background: transparent; box-shadow: none; font-size: 1rem; color: var(--muted); }
.pin-error { color: var(--danger); font-weight: 600; min-height: 1.4em; margin-top: 1rem; text-align: center; }

/* ---------------- Startseite */
.topbar {
  display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--line);
}
.logo-sm { height: 34px; width: auto; }
.logout { display: flex; align-items: center; gap: .5rem; background: none; border: 1.5px solid var(--line); border-radius: 999px; padding: .25rem .8rem .25rem .25rem; font-size: .88rem; font-weight: 600; color: var(--navy); }
.greet { margin: 1.3rem 0 .1rem; font-size: 1.7rem; color: var(--navy); }
.greet-sub { margin: 0 0 1rem; }

.card { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 1.3rem; margin-bottom: 1rem; animation: cardIn .5s var(--ease) both; }
.card h2 { margin: 0 0 .8rem; font-size: 1.15rem; color: var(--navy); }
.card h3 { margin: 0; font-size: 1rem; color: var(--navy); }
.big-btn { width: 100%; padding: 1.05em; font-size: 1.15rem; border-radius: 16px; margin-top: .4rem; }
.hint { color: var(--muted); font-size: .85rem; text-align: center; margin: .6rem 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

.alert { border: 2px solid var(--warn); background: linear-gradient(180deg, #fffaf0, #fff); position: relative; }
.alert-icon { font-size: 2rem; animation: wiggle 1.4s ease-in-out infinite; display: inline-block; }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-14deg); } 80% { transform: rotate(12deg); } 90% { transform: rotate(-6deg); } }

/* Zeitwähler */
.start-card { text-align: center; padding: 1.6rem 1.3rem 1.1rem; }
.tp { display: flex; align-items: center; justify-content: center; gap: 1.1rem; }
.tp-time { font-size: clamp(4rem, 19vw, 5.2rem); font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -.04em; display: flex; align-items: baseline; }
.tp-time span:not(.tp-sep) { display: inline-block; min-width: 2ch; }
.tp-time .bump { animation: bump .25s var(--spring); }
@keyframes bump { 50% { transform: scale(1.06); } }
.tp-sep { color: var(--lime); margin: 0 .02em; animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.tp-step {
  width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff;
  color: var(--navy); font-size: 1.6rem; line-height: 1; display: grid; place-items: center; flex-shrink: 0;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform .12s, background .2s, border-color .2s;
}
.tp-step:active { transform: scale(.9); background: var(--lime-soft); border-color: var(--lime); }
.tp-status { display: flex; align-items: center; justify-content: center; gap: .5rem; margin: .9rem 0 1.1rem; min-height: 1.9rem; }
.tp-pill { font-size: .88rem; font-weight: 600; color: var(--muted); padding: .3em .85em; border-radius: 999px; background: var(--bg); transition: background .2s, color .2s; }
.tp-pill.changed { background: var(--navy-soft); color: var(--navy); }
.tp-pill.warn { background: var(--warn-soft); color: #8a5300; }
.tp-reset { border: 0; background: none; color: var(--navy); font-weight: 600; font-size: .85rem; text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 2px; text-underline-offset: 3px; padding: .3em .2em; animation: fade .3s; }
.reason-field { margin: 0 0 .9rem; animation: cardIn .3s var(--ease); }
.reason-field .input { min-height: 0; font-size: 16px; }
.meta { display: flex; align-items: center; justify-content: center; gap: .45rem; flex-wrap: wrap; color: var(--muted); font-size: .8rem; margin: .8rem 0 0; }
.meta .sep { opacity: .5; }

.geo { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.geo .spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--navy); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.geo.ok { color: var(--ok); }
.geo.err { color: #a06200; }

/* Läuft */
.working-card { text-align: center; background: linear-gradient(180deg, #fff, #fbfcf2); }
.live { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ok); background: #e2f3e4; padding: .35em .9em; border-radius: 999px; font-size: .88rem; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
.ring-wrap { position: relative; width: min(68vw, 240px); aspect-ratio: 1; margin: 1rem auto .6rem; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--navy-soft); stroke-width: 14; }
.ring-fg { fill: none; stroke: url(#ringGrad); stroke-width: 14; stroke-linecap: round; stroke-dasharray: 603; stroke-dashoffset: 603; transition: stroke-dashoffset 1s var(--ease); filter: drop-shadow(0 0 6px rgba(192, 205, 11, .55)); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.elapsed { font-size: 3rem; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.work-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .4rem 0 .6rem; }
.work-meta div { display: flex; flex-direction: column; gap: .15rem; }
.work-meta b { font-size: 1.1rem; color: var(--navy); }
.feierabend { margin-top: .6rem; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; animation: cardIn .5s .1s var(--ease) both; }
.stat b { font-size: 1.5rem; color: var(--navy); }

.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.link { background: none; border: 0; color: var(--navy); font-weight: 700; padding: .3rem 0; text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.days { list-style: none; margin: 0; padding: 0; }
.days li { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .8rem; align-items: center; padding: .75rem 0; border-top: 1px solid var(--line); animation: cardIn .4s var(--ease) both; }
.days li:first-child { border-top: 0; }
.days .d { font-weight: 700; color: var(--navy); min-width: 3.4em; }
.days .d small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.days .t { color: var(--muted); font-size: .92rem; }
.days .h { font-weight: 750; color: var(--navy); text-align: right; }
.days .flags { grid-column: 2 / 4; display: flex; gap: .3rem; flex-wrap: wrap; }
.days .none { color: var(--muted); text-align: center; display: block; padding: 1rem 0; }

/* ---------------- Overlays */
.overlay { position: fixed; inset: 0; z-index: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.start-overlay { background: radial-gradient(circle at 50% 40%, #2c3d6e, var(--navy)); color: #fff; animation: fade .3s; }
.start-overlay h2 { font-size: 2.2rem; margin: 1rem 0 .3rem; animation: cardIn .5s .5s var(--ease) both; }
.start-overlay p { opacity: .85; font-size: 1.1rem; animation: cardIn .5s .65s var(--ease) both; }
.check { width: 130px; height: 130px; }
.check circle { fill: none; stroke: var(--lime); stroke-width: 6; stroke-dasharray: 330; stroke-dashoffset: 330; animation: draw .7s var(--ease) forwards; }
.check path { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 90; stroke-dashoffset: 90; animation: draw .45s .55s var(--ease) forwards; }
.overlay.out { animation: fadeOut .4s forwards; }
@keyframes fadeOut { to { opacity: 0; } }

.end-overlay {
  --ground-h: clamp(36px, 8vh, 80px);
  background: linear-gradient(180deg, #121a33 0%, #1f2c51 55%, #2b3c6b 100%);
  color: #fff; overflow: hidden; animation: fade .4s;
  justify-content: flex-start; align-items: center;
  padding: calc(clamp(20px, 7vh, 80px) + env(safe-area-inset-top)) 16px var(--ground-h);
}
.end-overlay .night { position: absolute; inset: 0; pointer-events: none; }
.end-overlay .star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: 0; animation: twinkle 2.6s var(--d) ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .15; } 50% { opacity: .9; } }
.end-overlay .moon {
  position: absolute; right: 12%; top: 7%; width: 46px; height: 46px; border-radius: 50%;
  box-shadow: inset -11px 3px 0 0 #f3f0d8; opacity: 0; transform: translateY(16px);
  animation: moonUp 1.6s .3s var(--ease) forwards; filter: drop-shadow(0 0 12px rgba(243, 240, 216, .35));
}
@keyframes moonUp { to { opacity: 1; transform: none; } }

/* Szene füllt den Platz unter dem Text und steht immer auf der Bodenlinie */
.end-overlay .site-wrap { position: relative; flex: 1 1 auto; align-self: stretch; min-height: 120px; max-height: 56vh; margin: 2vh -16px 0; }
.end-overlay .site { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.end-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--ground-h); background: #10172d; z-index: 1;
}
.end-ground::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--lime);
  transform-origin: left; transform: scaleX(0); animation: groundIn 1.2s var(--ease) forwards;
}
@keyframes groundIn { to { transform: scaleX(1); } }
.site .far { fill: #18223f; }
.site .wall { fill: #24335e; }
.site .slab { stroke: #3a4c80; stroke-width: 3; }
.site .win { fill: #ffd36b; filter: drop-shadow(0 0 4px rgba(255, 211, 107, .6)); animation: lightOff .35s var(--d) forwards; }
@keyframes lightOff { to { fill: #1a2547; filter: none; } }
.site .scaffold { stroke: #7f8fb8; stroke-width: 1.6; opacity: .55; fill: none; }
.site .roofline { stroke: #fff; stroke-width: 4; stroke-linecap: square; stroke-dasharray: 170; stroke-dashoffset: 170; animation: draw 1s .2s var(--ease) forwards; }
.site .lattice { stroke: var(--lime); stroke-width: 2; fill: none; }
.site .jib { stroke: var(--lime); stroke-width: 2; fill: none; }
.site .cab { fill: var(--lime); }
.site .counter { fill: #8d9708; }
.site .beacon { fill: #ff4d4d; animation: beacon 1.2s steps(1) infinite; }
@keyframes beacon { 50% { fill: #5a1d1d; } }
.site .trolley { fill: #d3df3a; }
.site .cable { stroke: #c9cfdf; stroke-width: 1.2; }
.site .hookshape { fill: none; stroke: #c9cfdf; stroke-width: 2.4; stroke-linecap: round; }
.site .hook { animation: trolleyIn 2.4s .5s var(--ease) forwards; }
@keyframes trolleyIn { to { transform: translateX(-16px); } }
.site .cable { transform-box: fill-box; transform-origin: top; animation: reelIn 2.4s .5s var(--ease) forwards; }
@keyframes reelIn { to { transform: scaleY(.16); } }
.site .hookshape { animation: hookUp 2.4s .5s var(--ease) forwards; }
@keyframes hookUp { to { transform: translateY(-80px); } }

.end-content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; order: -1; flex: none; }

/* Querformat mit wenig Höhe (Handy quer): Text links, Baustelle rechts */
@media (orientation: landscape) and (max-height: 560px) {
  .end-overlay { flex-direction: row; align-items: stretch; padding: calc(16px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) var(--ground-h) max(16px, env(safe-area-inset-left)); }
  .end-overlay .end-content { flex: 0 0 46%; justify-content: center; }
  .end-overlay .site-wrap { margin: 0; max-height: none; }
  .end-overlay .end-badge { font-size: .68rem; }
  .end-overlay .end-content h2 { font-size: 1.25rem; margin: .45rem 0 .55rem; }
  .end-overlay .end-hours { padding: .45rem 1.4rem .55rem; border-radius: 18px; }
  .end-overlay .end-hours span { font-size: 2.2rem; }
  .end-overlay .end-hours small { font-size: .78rem; margin-top: .2rem; }
  .end-overlay .end-content p { margin: .5rem 0 .1rem; font-size: .85rem; }
  .end-overlay .end-content .btn { padding: .55em 1.2em; min-width: 140px; }
  .end-overlay .moon { right: auto; left: 46%; top: 8%; width: 38px; height: 38px; }
}
/* Große Bildschirme: alles etwas größer */
@media (min-width: 900px) and (min-height: 700px) {
  .end-overlay .end-content h2 { font-size: 2.4rem; }
  .end-overlay .end-hours span { font-size: 4.6rem; }
  .end-overlay .end-badge { font-size: .9rem; }
}
.end-badge {
  font-size: .78rem; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: var(--navy);
  background: var(--lime); padding: .4em 1em .4em 1.3em; border-radius: 999px; animation: pop .5s .15s var(--spring) both;
}
.end-content h2 { font-size: 1.9rem; margin: .9rem 0 1.1rem; animation: cardIn .6s .3s var(--ease) both; }
.end-hours {
  display: flex; flex-direction: column; align-items: center; padding: 1rem 2.4rem 1.1rem; border-radius: 24px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); animation: pop .6s .5s var(--spring) both;
}
.end-hours span { font-size: 3.8rem; font-weight: 800; line-height: 1; color: var(--lime); letter-spacing: -.02em; }
.end-hours small { color: rgba(255, 255, 255, .75); margin-top: .35rem; font-size: .88rem; }
.end-content p { max-width: 340px; color: rgba(255, 255, 255, .8); margin: 1rem 0 .4rem; animation: fade .6s .9s both; }
.end-content .btn { margin-top: .5rem; min-width: 170px; animation: fade .6s 1.1s both; }

.confirm-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; background: var(--bg); border-radius: 14px; padding: .8rem; text-align: center; }
.confirm-sum b { display: block; font-size: 1.2rem; color: var(--navy); }
.confirm-sum span { font-size: .78rem; color: var(--muted); }

/* Standort: Erklärung & Hilfe */
.geo-fix { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--navy); text-decoration: underline; text-decoration-color: var(--lime); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
.geo-intro { text-align: center; }
.geo-pin { position: relative; width: 64px; height: 64px; margin: .2rem auto .6rem; }
.geo-pin svg { position: relative; z-index: 1; animation: pinDrop .6s var(--spring) both; }
.geo-ring { position: absolute; left: 50%; bottom: 2px; width: 34px; height: 10px; margin-left: -17px; border-radius: 50%; border: 2px solid var(--lime); animation: ringPulse 1.8s .5s ease-out infinite; opacity: 0; }
@keyframes pinDrop { from { transform: translateY(-24px); opacity: 0; } }
@keyframes ringPulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }
.geo-points { list-style: none; padding: 0; margin: .8rem 0 1rem; text-align: left; display: grid; gap: .6rem; }
.geo-points li { position: relative; padding-left: 1.6rem; color: var(--text); line-height: 1.4; }
.geo-points li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--lime-soft); color: #5d6400; font-size: .75rem; font-weight: 800; display: grid; place-items: center; }
.geo-next { background: var(--bg); border-radius: 12px; padding: .7rem .9rem; font-size: .92rem; color: var(--muted); margin: 0 0 .4rem; }
.geo-steps { margin: 0 0 .4rem; padding-left: 1.3rem; display: grid; gap: .55rem; line-height: 1.4; }
.geo-steps li::marker { color: var(--navy); font-weight: 800; }

/* Bei offener Erfolgsanzeige: Hintergrund dunkel (auch im Scrollleisten-Streifen) und nicht scrollbar */
html:has(.end-overlay:not([hidden])), html:has(.start-overlay:not([hidden])) { background: #141d38; overflow: hidden; scrollbar-gutter: auto; }

/* ---------------- Sprache */
.flag { display: block; width: 100%; height: 100%; }
.lang-corner { position: absolute; top: calc(14px + env(safe-area-inset-top)); inset-inline-end: 14px; z-index: 5; }
.hero { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 1.5px solid var(--line); background: #fff; color: var(--navy);
  border-radius: 999px; padding: .3rem .55rem .3rem .4rem; font-weight: 700; font-size: .8rem; letter-spacing: .04em;
  box-shadow: var(--shadow); transition: transform .15s, border-color .2s;
}
.lang-btn:active { transform: scale(.95); }
.lang-btn:hover { border-color: var(--navy); }
.lang-btn .lang-flag, .lang-item .lang-flag { width: 24px; height: 16px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); flex-shrink: 0; }
.topbar .lang-btn { box-shadow: none; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }

.lang-modal h2 { margin-bottom: 1rem; }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
@media (max-width: 360px) { .lang-list { grid-template-columns: 1fr; } }
.lang-item {
  display: flex; align-items: center; gap: .7rem; padding: .8rem .9rem; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; font-weight: 650; font-size: 1.02rem; color: var(--text); text-align: start; transition: border-color .2s, background .2s, transform .12s;
}
.lang-item:active { transform: scale(.97); }
.lang-item .lang-flag { width: 30px; height: 20px; }
.lang-item.active { border-color: var(--navy); background: var(--navy-soft); }
.lang-check { margin-inline-start: auto; color: var(--navy); font-weight: 800; }

/* ---------------- Rechts-nach-links (Arabisch) */
.back { left: auto; inset-inline-start: 12px; }
[dir="rtl"] .back svg { transform: scaleX(-1); }
.keypad, .tp, .pin-dots, .elapsed, .clock, .tp-time, .end-hours span { direction: ltr; }
.geo-points li { padding-left: 0; padding-inline-start: 1.6rem; }
.geo-points li::before { left: auto; inset-inline-start: 0; }
.geo-steps { padding-left: 0; padding-inline-start: 1.3rem; }
[dir="rtl"] body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, -apple-system, Roboto, Arial, sans-serif; }

/* Fahne immer links – auch bei Arabisch */
.lang-btn, .lang-item, .lang-list { direction: ltr; }
.lang-item .lang-name { unicode-bidi: plaintext; }
.lang-check { margin-left: auto; margin-inline-start: 0; }

.emp .test-tag { position: absolute; top: 10px; inset-inline-start: 10px; font-size: .62rem; font-weight: 800; letter-spacing: .08em; color: #5b3a96; background: #efe7fb; padding: .15em .5em; border-radius: 999px; }

/* Büro-Knopf (wichtig für die installierte App ohne Adresszeile) */
.office-corner { position: absolute; top: calc(14px + env(safe-area-inset-top)); inset-inline-start: 14px; z-index: 5; }
.office-btn {
  display: inline-flex; align-items: center; gap: .35rem; padding: .38rem .7rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: rgba(255, 255, 255, .7); color: var(--muted);
  font-weight: 700; font-size: .78rem; text-decoration: none; transition: color .2s, border-color .2s, background .2s;
}
.office-btn:hover, .office-btn:active { color: var(--navy); border-color: var(--navy); background: #fff; }
