/* Farben und Masse 1:1 aus der Windows-App (Theme-Klasse). */
:root {
  --back: #141418;
  --surface: #1F1F26;
  --hover: #292933;
  --line: #353540;
  --ink: #F0F0F6;
  --muted: #9E9EAE;
  --accent: #A597FF;
  --green: #9AD8B7;
  --error: #FF9CA6;
  --font: "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--back); }
body {
  margin: 0;
  background: var(--back);
  color: var(--ink);
  font: 15px/1.4 var(--font);
  -webkit-tap-highlight-color: transparent;
}
body:has(dialog[open]) { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.grow { flex: 1; }
.error { color: var(--error); font-size: 13px; min-height: 18px; margin: 8px 0; }

/* ---------- Knöpfe (DarkButton) ---------- */

.dbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
  transition: background .12s;
}
.dbtn:hover { background: var(--hover); }
.dbtn.primary { background: var(--accent); color: var(--back); }
.dbtn.primary:hover { background: #B4A9FF; }
.dbtn.danger { color: var(--error); }
.dbtn:disabled { opacity: .55; cursor: default; }
.dbtn.wide { display: flex; width: 100%; }
.dbtn.grow { flex: 1; }
.dbtn.grow2 { flex: 1.35; }
.lead-plus { color: var(--accent); display: inline-flex; }

/* ---------- Seitenaufbau ---------- */

.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page-body {
  flex: 1;
  width: 100%;
  max-width: 1064px;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 28px 24px;
}
.page-body.narrow { max-width: 640px; }
.page-foot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: var(--back);
  padding-bottom: env(safe-area-inset-bottom);
}
.page-foot-inner {
  max-width: 1064px;
  margin: 0 auto;
  padding: 14px 28px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.foot-link { color: var(--muted); font-size: 13px; text-decoration: none; padding: 8px 0; }
.foot-link:hover { color: var(--ink); }

.demo-banner {
  background: #2A2440;
  color: #D6CFFF;
  font-size: 13px;
  text-align: center;
  padding: calc(6px + env(safe-area-inset-top)) 16px 6px;
}

/* ---------- Deine Leute ---------- */

.brand { color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: none; }

/* Menü oben rechts */
.topnav { position: relative; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
details.menu { position: relative; }
details.menu > summary { list-style: none; min-height: 38px; padding: 0 14px; gap: 8px; cursor: pointer; user-select: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { background: var(--hover); }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 260px;
  max-width: calc(100vw - 32px);
  max-height: 72vh;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgb(0 0 0 / .5);
  animation: pop .12s ease-out;
}
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-item.active { color: var(--green); font-weight: 700; }
.menu-item.danger { color: var(--error); }
.update-notice { padding: 0 4px; }
.update-message { margin: 8px 8px 4px; color: var(--accent); font-weight: 700; }
.update-notice > .muted { margin: 0 8px 6px; }
.update-action { color: var(--accent); font-weight: 700; }
.menu-item .ext { color: var(--accent); }
.menu-label { padding: 10px 12px 4px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }

/* Konto-Anfragen */
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--back);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.menu-btn .badge { margin-left: 2px; }
.request-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 8px;
  padding: 12px 16px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: #221F33;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}
.request-banner:hover { background: #2A2640; }
.request-banner > span:last-child { color: var(--accent); font-weight: 600; }
.request .members { margin-bottom: 4px; background: var(--back); }
.request .dlg-buttons { margin-top: 12px; }
.request .dbtn.danger { background: var(--back); }
.switch-auth { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; font-size: 14px; }
.switch-auth .dbtn { min-height: 36px; padding: 0 14px; }
.pending-pulse { width: 46px; height: 46px; margin: 22px auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.home-title { margin: 14px 0 6px; font-size: 36px; line-height: 1.15; font-weight: 700; }
.count { margin: 0; font-size: 14px; }
.empty-note { margin: 12px 0; }

.home-grid { display: grid; gap: 24px; margin-top: 30px; align-items: start; }
@media (min-width: 900px) {
  .home.page-body { padding-left: 36px; }
  .home-grid { grid-template-columns: minmax(0, 785px) 1fr; margin-left: -12px; }
}

.people { display: grid; gap: 10px; }
.person-row {
  display: flex;
  align-items: center;
  gap: 52px;
  min-height: 84px;
  padding: 10px 18px;
  border-radius: 16px;
  background: #29292f;
  border: 1px solid rgba(255, 255, 255, .09);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  text-decoration: none;
  transition: background .12s;
}
.person-row:hover, .person-row:focus-visible { background: #323239; }
.person-row:active { background: #36363e; }
.channel-drag-source { opacity: .3; }
.channel-drag-ghost { position: fixed; top: 0; left: 0; z-index: 1000; pointer-events: none; background: #393941; box-shadow: 0 16px 40px #0008; border-color: var(--accent); cursor: grabbing; }
.channel-dragging, .channel-dragging * { cursor: grabbing !important; user-select: none !important; }
.channel-drag-hint { margin: 0 0 14px; }
.person-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pname { font-size: 20px; line-height: 1.2; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname.has-today { color: var(--green); }
.psub { color: var(--muted); font-size: 14px; }

.add-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  justify-self: center;
  margin-top: 10px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 14px;
}
.add-circle {
  width: 116px; height: 116px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--accent);
  transition: background .12s;
}
.add-person:hover .add-circle { background: var(--hover); }
@media (max-width: 899px) {
  .person-row { gap: 24px; padding: 10px 12px; }
  .add-circle { width: 84px; height: 84px; }
  .add-circle svg { width: 32px; height: 32px; }
}

.portrait {
  width: var(--size, 64px);
  height: var(--size, 64px);
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--line);
  color: var(--muted);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.protected-profile-image { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.protected-profile-image img { pointer-events: none; -webkit-user-drag: none; }
.profile-actions { flex-wrap: wrap; }
.profile-actions .dbtn { white-space: normal; min-width: 0; }
.initials { color: var(--ink); font-weight: 700; font-size: calc(var(--size, 64px) * .36); }

/* ---------- Tagebuch ---------- */

.diary-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.diary-name { flex: 1; min-width: 0; margin: 0; font-size: 30px; line-height: 1.2; font-weight: 700; overflow-wrap: anywhere; }
.head-btn { min-width: 178px; }
@media (max-width: 600px) {
  .diary-name { font-size: 26px; }
  .head-btn { order: 3; flex: 1 1 100%; }
  .page-foot-inner { padding: 12px 16px 16px; flex-wrap: wrap; }
  .page-foot-inner > .dbtn { flex: 1 1 auto; padding: 0 14px; }
  .page-foot-inner > .grow { display: none; }
  .page-body { padding-left: 16px; padding-right: 16px; }
}
.today-line { margin: 22px 0 4px; font-size: 15px; }
.today-status { margin: 0 0 12px; font-size: 24px; font-weight: 700; color: var(--muted); }
.today-status.has-today { color: var(--green); }
.new-entry { min-width: 194px; }
.section-title { margin: 30px 0 14px; font-size: 17px; font-weight: 700; }

.history { display: grid; gap: 6px; }
.day-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
}
.day-head:hover { background: var(--surface); }
.chev { color: var(--accent); display: inline-flex; transition: transform .15s; transform: rotate(-90deg); }
.day-head.open .chev { transform: none; }
.day-title { flex: 1; font-weight: 700; font-size: 14px; }
.day-rows { display: grid; gap: 8px; padding: 0 0 8px 12px; }

.entry-row {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 100px;
  padding: 11px 12px;
  border: 0;
  border-radius: 4px;
  background: var(--surface);
  text-align: left;
  transition: background .12s;
}
.entry-row:hover { background: var(--hover); }
.row-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-title { font-weight: 700; font-size: 15px; }
.row-preview, .row-meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Foto mit festem Rahmen */
.framed {
  position: relative;
  display: block;
  flex: none;
  padding: 4px;
  border: 2px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  overflow: hidden;
}
button.framed { cursor: zoom-in; }
.framed > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.framed > .guide { position: absolute; inset: 10%; width: 80%; height: 80%; }
.row-thumb { width: 78px; height: 78px; }

/* ---------- Gespeicherter Eintrag ---------- */

.entry-title { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.25; }
.who { margin: 8px 0 2px; font-size: 14px; }
.meta { margin: 0; }
.entry-content { display: flex; gap: 24px; margin-top: 22px; align-items: flex-start; }
.main-framed { width: 240px; height: 240px; }
.entry-text { margin: 0; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; flex: 1; }
.gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery-framed { width: 126px; height: 108px; }
@media (max-width: 640px) {
  .entry-content { flex-direction: column; }
  .main-framed { width: 100%; height: auto; aspect-ratio: 1; max-width: 420px; }
}

/* ---------- Einstellungen & Anmelden ---------- */

.card { margin-top: 16px; padding: 18px; border-radius: 12px; background: var(--surface); }
.card h2 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 0 0 12px; font-size: 13px; }
.card .dbtn { background: var(--back); }
.card .dbtn:hover { background: var(--hover); }
.card .dbtn.primary { background: var(--accent); }
.card .field { background: var(--back); }
.row { display: flex; gap: 10px; align-items: stretch; }
.admin-users { display: grid; gap: 12px; }
.admin-users .row { align-items: center; }
.admin-users .user-name { min-width: 0; overflow-wrap: anywhere; }
.user-details-link { display: flex; gap: 10px; align-items: center; min-width: 0; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.user-details-link:hover { background: var(--hover); }
.user-details-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-details { margin: 0; }
.user-details dt { color: var(--muted); font-size: 13px; margin-top: 12px; }
.user-details dd { margin: 3px 0 0; overflow-wrap: anywhere; }

.admin-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.admin-link { justify-content: space-between; text-decoration: none; white-space: normal; text-align: left; padding: 10px 14px; }
.admin-link .ext { color: var(--accent); }

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .home-title { margin-bottom: 8px; }
.login-card .dbtn.wide { margin-top: 4px; }
.demo-hint { margin-top: 16px; }

/* Eingabefeld (NameField) */
.label { display: block; margin: 18px 0 8px; color: var(--muted); font-size: 14px; }
.field { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 4px; background: var(--surface); }
.field:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; }
.field input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 10px 0; }
textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  font-size: 16px;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.check { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* ---------- Dialoge (eigene Fenster in der Windows-App) ---------- */

dialog.modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
dialog.modal::backdrop { background: rgb(5 5 8 / .72); }
.modal-box {
  position: absolute;
  left: 50%; top: 50%;
  translate: -50% -50%;
  width: min(456px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 28px 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--back);
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; scale: .97; } }
.modal.person .modal-box { width: min(476px, calc(100% - 24px)); }
.modal.editor .modal-box { width: min(756px, calc(100% - 24px)); }
.modal.camera .modal-box { width: min(560px, calc(100% - 24px)); }
@media (max-width: 600px) {
  .modal.editor .modal-box, .modal.person .modal-box, .modal.camera .modal-box {
    width: 100%; max-height: 100%; height: 100%;
    border: 0; border-radius: 0;
    padding: calc(20px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
  }
}

.dlg-title { margin: 0 0 14px; font-size: 22px; font-weight: 700; }
.dlg-title.big { font-size: 28px; }
.dlg-text { margin: 0 0 22px; font-size: 14px; }
.dlg-buttons { display: flex; gap: 12px; margin-top: 16px; }
.modal .dbtn.wide { margin-top: 16px; }

.portrait-box { display: grid; place-items: center; margin: 10px 0 18px; }
.btn-pair { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-pair.center { justify-content: center; }
.btn-pair .dbtn { flex: 1; min-width: 150px; }

.members-block { margin-top: 4px; }
.modal select:not(.cam-select) {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
}
.modal select:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.members { display: grid; gap: 2px; border-radius: 6px; background: var(--surface); padding: 6px 12px; }
.member { padding: 8px 0; color: var(--ink); }
.members-block .xsmall { margin: 8px 0 0; }

/* Aufklappbare Tagebuchfreigabe mit Profilbildern und Personensuche. */
.diary-access { margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.access-trigger { display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; list-style: none; border-radius: 12px; }
.access-trigger::-webkit-details-marker { display: none; }
.access-trigger:hover { background: var(--hover); }
.access-heading { display: grid; gap: 5px; flex: 1; min-width: 0; }
.access-heading strong { font-size: 14px; font-weight: 600; }
.access-description { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.access-trigger > svg { flex-shrink: 0; transition: transform .15s; }
.diary-access[open] .access-trigger > svg { transform: rotate(180deg); }
.access-faces { display: flex; align-items: center; padding-left: 6px; }
.access-faces .portrait, .access-more { margin-left: -6px; border: 2px solid var(--surface); }
.access-more { display: grid; place-items: center; height: 26px; min-width: 26px; border-radius: 50%; padding: 0 3px; background: var(--hover); font-size: 10px; }
.access-panel { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.access-mode { display: grid; gap: 8px; padding-top: 14px; font-size: 13px; color: var(--muted); }
.access-panel select:not(.cam-select) { background: var(--back); border-radius: 8px; color: var(--ink); }
.access-hint { margin: 10px 0 14px; }
.access-selected { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; max-height: 124px; overflow-y: auto; }
.access-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: 20px; background: var(--back); font-size: 12px; }
.access-chip:hover { border-color: var(--accent); background: var(--hover); }
.access-chip > span:not(.portrait) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-chip > svg { flex-shrink: 0; }
.access-search { background: var(--back); border: 1px solid var(--line); border-radius: 8px; }
.access-status { margin: 10px 0 6px; }
.access-list { display: grid; max-height: 252px; overflow-y: auto; overscroll-behavior: contain; }
.access-person { min-height: 58px; padding: 8px 4px; border-radius: 8px; color: var(--ink); }
.access-person:hover { background: var(--hover); }
.access-person.fixed { cursor: default; }
.access-person input { flex-shrink: 0; }
.access-person-name { display: grid; gap: 2px; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.access-person-name small, .access-fixed { color: var(--muted); font-size: 11px; }
.access-fixed { max-width: 48px; text-align: right; }
.access-note { margin: 12px 0 0; }
.access-empty { padding: 18px 0; margin: 0; text-align: center; }
@media (max-width: 420px) {
  .access-trigger { flex-wrap: wrap; }
  .access-heading { flex-basis: calc(100% - 30px); }
  .access-faces { order: 1; }
}

/* Eintrag-Fenster */
.editor-title { margin: 0 0 6px; font-size: 27px; font-weight: 700; }
.editor-top { display: flex; gap: 22px; margin-top: 18px; align-items: flex-start; }
.editor-main { width: 208px; height: 208px; }
button.editor-main { cursor: zoom-in; }
div.editor-main { cursor: default; }
.editor-side { flex: 1; min-width: 0; }
.editor-side .muted.small { margin: 8px 0 14px; }
.editor-side .btn-pair .dbtn { min-height: 44px; }
.editor-side .xsmall { margin: 14px 0 0; }
.block-title { margin: 0; font-size: 16px; font-weight: 700; }
.extras-head, .text-head { display: flex; align-items: center; gap: 12px; margin: 22px 0 10px; }
.extras-head .dbtn { min-height: 40px; padding: 0 18px; }
.extras { display: flex; flex-wrap: wrap; gap: 10px; min-height: 60px; }
.extras > p { margin: 0; }
.extra { position: relative; }
.extra-framed { width: 100px; height: 82px; }
.extra-x {
  position: absolute;
  top: 0; right: 0;
  width: 30px; height: 27px;
  border: 0;
  border-radius: 0 3px 0 6px;
  background: var(--back);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
}
.extra-x:hover { background: var(--hover); }
.editor-buttons { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.editor-buttons .dbtn { min-height: 38px; }
@media (max-width: 600px) {
  .editor-top { flex-direction: column; }
  .editor-main { width: 100%; height: auto; aspect-ratio: 1; max-width: 360px; align-self: center; }
  .extras-head { flex-wrap: wrap; }
  .extras-head .block-title { flex: 1 1 100%; }
  .extras-head > .grow { display: none; }
  .extras-head .dbtn { flex: 1; }
  .editor-title { font-size: 24px; }
  .editor-buttons { flex-wrap: wrap; }
}

/* Bildausschnitt */
.crop-wrap { position: relative; width: min(320px, 100%); aspect-ratio: 1; margin: 0 auto; }
.crop-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.crop-canvas:active { cursor: grabbing; }
.crop-wrap > .guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.zoom { display: block; width: min(320px, 100%); margin: 18px auto 4px; accent-color: var(--accent); }

/* Kamera */
.cam-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border: 2px solid var(--line); background: #000; }
.cam-stage.square { aspect-ratio: 1; max-width: 420px; margin: 0 auto; }
.cam-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-stage.mirror .cam-video { transform: scaleX(-1); }
.cam-stage > .guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam-tools { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.cam-select { flex: 1; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.cam-status { margin: 10px 0 0; }
.retry { margin-top: 10px; }

/* Pflichtaufnahme beim Öffnen: bleibt vor allen anderen Dialogen sichtbar. */
dialog.profile-required::backdrop { background: var(--back); }
.profile-required .modal-box { width: min(476px, calc(100% - 24px)); }
.profile-required .dbtn.wide { white-space: normal; padding: 10px 16px; }
.profile-photo-preview { position: relative; width: 180px; height: 180px; margin: 24px auto; border-radius: 50%; background: var(--surface); overflow: hidden; }
.profile-photo-preview > .guide { display: block; width: 100%; height: 100%; }
@media (max-width: 600px) {
  .profile-required .modal-box { width: 100%; max-height: 100%; height: 100%; border: 0; border-radius: 0; padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
}

/* Foto ansehen (PhotoViewer) */
dialog.viewer-dlg::backdrop { background: rgb(0 0 0 / .94); }
.viewer-dlg .modal-box { inset: 0; translate: none; left: 0; top: 0; width: 100%; height: 100%; max-height: none; padding: 0; border: 0; border-radius: 0; background: transparent; }
.viewer { width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-tools { position: absolute; z-index: 2; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 12px; }

.log { margin: 0; padding-left: 20px; max-height: 50vh; overflow-y: auto; font-size: 13px; color: var(--muted); }
.log li { margin: 2px 0; }
.log .ok { color: var(--green); font-weight: 700; }
.log .err { color: var(--error); font-weight: 700; }

#toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 14px;
  text-align: center;
  opacity: 0;
  translate: -50% 12px;
  pointer-events: none;
  transition: opacity .2s, translate .2s;
}
#toast.show { opacity: 1; translate: -50% 0; }

/* Admin archive: portraits in the person picker, responsive image cards. */
.account-list { display: grid; gap: 12px; margin: 20px 0; }
.account-row { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.account-info { display: grid; gap: 4px; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.account-row .portrait { flex-shrink: 0; }
.account-login { display: grid; gap: 14px; margin: 20px 0; }
.account-login input { width: 100%; min-width: 0; }
@media (max-width: 480px) {
  .account-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); }
  .account-select { grid-column: 2; width: 100%; white-space: normal; padding: 8px 14px; }
}
.archive-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.archive-filters { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(180px, 1.5fr) repeat(2, minmax(140px, 1fr)); gap: 14px; }
.archive-filters > label, .archive-filter { display: grid; gap: 8px; font-size: 14px; min-width: 0; }
.archive-filters select, .archive-filters input { width: 100%; min-width: 0; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--surface); color: var(--ink); font: inherit; color-scheme: dark; }
.archive-picker { position: relative; }
.archive-picker > summary { display: flex; width: 100%; min-height: 48px; gap: 10px; list-style: none; text-align: left; }
.archive-picker > summary::-webkit-details-marker { display: none; }
.archive-options { position: absolute; z-index: 8; top: calc(100% + 5px); left: 0; width: max(100%, 260px); max-width: calc(100vw - 48px); max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 10px 30px #0008; }
.archive-option { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 48px; border: 0; padding: 10px 14px; background: transparent; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.archive-option:hover, .archive-option:focus-visible { background: var(--hover); }
.archive-sub { display: block; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin: 20px 0; }
.archive-photo { min-width: 0; margin: 0; overflow: hidden; }
.archive-photo h2 { font-size: 18px; overflow-wrap: anywhere; }
.archive-image { display: block; width: 100%; padding: 0; border: 0; background: var(--back); cursor: zoom-in; }
.archive-image img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.archive-no-picture { display: grid; place-items: center; aspect-ratio: 1; background: var(--back); color: var(--muted); }
@media (max-width: 850px) { .archive-filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .archive-filters { grid-template-columns: 1fr; } .archive-grid { grid-template-columns: 1fr; } }




/* Admin-Prüfung neuer Profilbilder */
.photo-review-image { display: block; width: min(240px, 100%); aspect-ratio: 1; margin: 8px auto 12px; padding: 0; border: 1px solid var(--line, #333); border-radius: 50%; overflow: hidden; background: var(--back); cursor: zoom-in; }
.photo-review-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-review-note { padding: 12px 14px; margin: 0 0 12px; }
