/* dustinOS – gleiche Sprache wie dustingotte.de (Papiergrau, fette Montserrat, Senfgelb), bookery im Grün der App.
   Die Übersicht füllt immer genau einen Bildschirm: kein Scrollen, weder am iPhone noch am Computer. */
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url("fonts/montserrat-500.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("fonts/montserrat-700.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url("fonts/montserrat-800.woff2") format("woff2"); }

:root {
  --paper: #EEEEEC; --card: #F9F9F7; --border: #DCDCD8; --chip: #E4E4E0;
  --ink: #1C1C1C; --muted: #66665F; --accent: #8A6410; --sun: #E3B94B; --on-sun: #1C1C1C;
  --ok: #1E8A4C; --warn: #B26A00; --bad: #C2332B;
  /* bookery: Salbei aus der App */
  --bk: #47785B; --bk-ink: #FAFCF6; --bk-soft: #CFE0C9; --bk-cell: rgb(255 255 255 / .10); --bk-line: rgb(255 255 255 / .16);
  --display: "Montserrat", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --sans: system-ui, -apple-system, "Helvetica Neue", "Segoe UI", sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 18px 40px -12px rgb(0 0 0 / .14);
  --r: 26px; --gap: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --paper: #141413; --card: #1E1E1C; --border: #2E2E2B; --chip: #2A2A27;
  --ink: #EDEDEA; --muted: #A5A59C; --accent: #E9C46A; --sun: #D9AE3F; --on-sun: #141413;
  --ok: #4CC27E; --warn: #E9A23B; --bad: #FF6B5E;
  --bk: #26382D; --bk-ink: #FAFBFA; --bk-soft: #AFD0BB; --bk-cell: rgb(255 255 255 / .06); --bk-line: rgb(255 255 255 / .10);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 18px 40px -12px rgb(0 0 0 / .6); color-scheme: dark } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.4 var(--sans); }
h1, h2, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Ein Bildschirm ---------- */
body.os { height: 100dvh; overflow: hidden; }
.screen { height: 100%; max-width: 1320px; margin: 0 auto; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: var(--gap); padding: calc(8px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
/* Sehr flache Fenster (Querformat am Handy): lieber scrollen als abschneiden */
@media (max-height: 560px) { body.os { height: auto; overflow: auto; } .screen { height: auto; } }
/* Als App vom Home-Bildschirm legt iOS unter die Statusleiste einen Weichzeichner, der die Kopfzeile verschwimmen ließ.
   Darum dort mehr Abstand nach oben. */
@media (display-mode: standalone) and (max-width: 899px) {
  .screen { padding-top: calc(36px + env(safe-area-inset-top)); }
}

/* ---------- Kopf ---------- */
.bar { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.brand b { font: 800 1.05rem/1 var(--display); letter-spacing: -.01em; }
.brand b span { color: var(--accent); }
.clock { font: 700 .95rem/1 var(--display); font-variant-numeric: tabular-nums; color: var(--muted); margin-right: 4px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--border);
  background: var(--card); cursor: pointer; transition: transform .15s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
.bell.on { background: var(--sun); color: var(--on-sun); border-color: transparent; }
.bell.on svg { fill: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }
.inbox { position: relative; background: var(--sun); color: var(--on-sun); border-color: transparent; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--bad); color: #fff; font: 800 .68rem/18px var(--display); text-align: center; }

/* ---------- Zustand ---------- */
.status { --state: var(--ok); }
.status.bad { --state: var(--bad); }
.status.loading { --state: var(--muted); }
.hello { color: var(--muted); font-size: .85rem; font-weight: 600; }
.status h1 { display: flex; align-items: center; gap: 12px; font: 800 clamp(1.45rem, 4.6vh, 2.6rem)/1.05 var(--display);
  letter-spacing: -.02em; text-transform: uppercase; margin-top: 2px; }
.pulse { position: relative; width: .45em; height: .45em; margin: 0 .05em 0 .1em; flex: none; border-radius: 50%; background: var(--state); }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--state); animation: ping 2.4s cubic-bezier(0, 0, .2, 1) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .5; } 80%, 100% { transform: scale(2.2); opacity: 0; } }
.detail { color: var(--bad); font-weight: 600; font-size: .85rem; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail:empty { display: none; }
.detail.info { color: var(--muted); }

/* ---------- Bento ---------- */
.bento { display: grid; gap: var(--gap); min-height: 0;
  grid-template: "bookery" minmax(0, 1fr) "sites" auto "server" auto / 1fr; }
.now { display: none; }
@media (min-width: 900px) {
  .bento { grid-template: "bookery now" minmax(0, 1fr) "bookery sites" auto "bookery server" auto / 1.55fr 1fr; }
  .tile.now { grid-area: now; display: flex; flex-direction: column; justify-content: flex-end; background: var(--sun); color: var(--on-sun); border-color: transparent; }
  .now-time { font: 800 clamp(3.5rem, 13vh, 8rem)/.85 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
  .now-date { font: 800 1.15rem/1.2 var(--display); text-transform: uppercase; letter-spacing: .02em; margin-top: 12px; }
  .now-sub { font-size: .85rem; font-weight: 600; opacity: .7; margin-top: 4px; }
  .clock { display: none; }
}
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-height: 0; overflow: hidden; }
.tile h2 { font: 800 .7rem/1 var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 10px; }

/* ---------- bookery ---------- */
.bookery { grid-area: bookery; background: var(--bk); color: var(--bk-ink); border-color: transparent; position: relative; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: clamp(14px, 2.4vh, 26px); }
.bk-head { display: flex; align-items: center; gap: 10px; }
.bk-head img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 0 0 1px var(--bk-line); }
.bk-head h2 { font: 600 1.45rem/1 var(--serif); letter-spacing: -.01em; text-transform: none; color: inherit; margin: 0 auto 0 0; }
.bk-build { font-size: .76rem; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--bk-cell); border: 1px solid var(--bk-line); white-space: nowrap; }
.bk-build.bad { background: var(--bad); border-color: transparent; color: #fff; }

/* Oben klein: Tester und Builds. Unten der Platz für Testanfragen und Buchsuche. */
.bk-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.bk-testers .val { display: flex; align-items: baseline; gap: 8px; }
.bk-testers .val > b { font-size: 2rem; letter-spacing: -.03em; }
.bk-testers .cap.sub b { color: var(--bk-ink); }
.bk-testers { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bk-testers > div { min-width: 0; }
.bk-icon { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--bk-cell); border: 1px solid var(--bk-line); color: var(--bk-soft); }
.bk-icon svg { width: 26px; height: 26px; }

.bk-cells { flex: 1; min-height: 0; display: grid; grid-template: minmax(0, 1fr) auto / 1fr; gap: 8px; }
.bk-cell { background: var(--bk-cell); border: 1px solid var(--bk-line); border-radius: 16px; padding: 10px 12px; min-width: 0; }
.cap { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--bk-soft); margin-bottom: 6px; }
.cap.sub { text-transform: none; letter-spacing: 0; font-weight: 500; margin: 6px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val { white-space: nowrap; }
.val b { font: 800 1.35rem/1 var(--display); font-variant-numeric: tabular-nums; }
.val span { color: var(--bk-soft); font-size: .8rem; }
.mini { height: 6px; border-radius: 999px; background: var(--bk-cell); margin-top: 8px; overflow: hidden; }
.mini i { display: block; height: 100%; width: 0; background: var(--sun); border-radius: inherit; transition: width .8s; }
.mini.warn i { background: var(--warn); } .mini.bad i { background: var(--bad); }

/* Testanfragen direkt in der Kachel */
.bk-requests { display: flex; flex-direction: column; min-height: 0; }
.cell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cell-head .cap { margin: 0; }
.pill { padding: 3px 10px; border-radius: 999px; background: var(--sun); color: var(--on-sun); font: 800 .74rem/1.4 var(--display); }
.requests.inline { flex: 1; min-height: 0; overflow-y: auto; margin-top: 4px; }
.requests.inline li { border-top-color: var(--bk-line); padding: 10px 0; }
.requests.inline li:first-child { border-top: 0; }
.requests.inline .who span { color: var(--bk-soft); }
.requests.inline .yes { background: var(--bk-ink); color: var(--bk); }
.requests.inline .no { border-color: var(--bk-line); color: var(--bk-ink); }
.requests.inline li.empty { flex: 1; height: 100%; justify-content: center; color: var(--bk-soft); font: 700 1rem/1.2 var(--display); }

/* Fortschritt des neuesten Builds: bei Apple → verarbeitet → Prüfung → bei Testern */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: -2px 0 8px; }
.steps i { height: 6px; border-radius: 999px; background: rgb(255 255 255 / .18); }
.steps i.done { background: var(--bk-ink); box-shadow: none; }
.steps i.now { background: var(--sun); box-shadow: none; animation: glow 1.4s ease-in-out infinite alternate; }
.steps i.bad { background: var(--bad); box-shadow: none; }
@keyframes glow { from { opacity: .65; } to { opacity: 1; } }
#builds-cap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#builds-cap.busy { color: var(--sun); }
.builds li { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; line-height: 1.55; white-space: nowrap; }
.builds b { font-family: var(--display); font-variant-numeric: tabular-nums; }
.builds span { color: var(--bk-soft); overflow: hidden; text-overflow: ellipsis; }
.builds li.live span { color: var(--bk-ink); font-weight: 700; }
.builds li.bad span { color: #FFB4AC; font-weight: 700; }

/* ---------- Webseiten ---------- */
.sites { grid-area: sites; display: flex; flex-direction: column; }
.list { display: flex; flex-direction: column; justify-content: space-evenly; flex: 1; }
.list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); min-width: 0; }
.list li:first-child { border-top: 0; }
.list .name { flex: 1; min-width: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .name small { color: var(--muted); font-weight: 500; }
.list li.link { padding: 0; }
.list li.link a { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 7px 10px; margin: 0 -10px;
  border-radius: 12px; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, transform .15s; }
.list li.link a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.list li.link a:active { transform: scale(.98); background: color-mix(in srgb, var(--ink) 10%, transparent); }
.list li.link a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.list .open { color: var(--muted); font-weight: 700; flex: none; transition: color .15s, transform .15s; }
.list li.link a:hover .open { color: var(--accent); transform: translate(2px, -2px); }
.meta { display: flex; gap: 6px; flex: none; }
.tag { font-size: .74rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--chip); font-variant-numeric: tabular-nums; }
.tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); } .tag.bad { color: var(--bad); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }

/* ---------- Server ---------- */
.server { grid-area: server; }
.chips { display: flex; gap: 8px; }
.chips li { flex: 1; display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 14px; background: var(--chip);
  font-size: .84rem; font-weight: 650; min-width: 0; white-space: nowrap; }
.chips li span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- Testanfragen ---------- */
.sheet { width: min(100% - 32px, 560px); max-height: min(80dvh, 640px); padding: 18px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet h2 { font: 800 1.15rem/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.sheet-note { color: var(--muted); font-size: .85rem; margin: 8px 0 12px; }
.requests li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.requests li.busy { opacity: .5; }
.requests li.empty { color: var(--muted); }
.who { min-width: 0; flex: 1 1 220px; display: grid; }
.who b { overflow-wrap: anywhere; }
.who span { color: var(--muted); font-size: .8rem; }
.actions { display: flex; gap: 8px; margin-left: auto; }
.actions button { min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer; font: 700 .78rem/1 var(--display); text-transform: uppercase; letter-spacing: .05em; }
.actions .yes { border: 0; background: var(--ink); color: var(--paper); }
.actions .no { border: 1px solid var(--border); background: transparent; }
.actions button:disabled { cursor: progress; }
.signout-actions { margin: 4px 0 0; justify-content: flex-end; }
.signout-form input { width: 100%; min-height: 50px; padding: 0 16px; border-radius: 16px; border: 2px solid var(--border);
  background: var(--paper); color: var(--ink); font-size: 1.05rem; }
.signout-form input:focus { outline: none; border-color: var(--accent); }
#signout .error, #passkeys .error { margin: 8px 0 0; text-align: left; }
.passkey-form { display: grid; gap: 8px; margin-top: 12px; }
.actions .danger { background: var(--bad); color: #fff; }

.error { color: var(--bad); font-weight: 600; text-align: center; font-size: .85rem; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 16px; background: var(--ink); color: var(--paper);
  font-weight: 600; font-size: .88rem; box-shadow: var(--shadow); text-align: center; }
.error:empty { display: none; }

/* ---------- Handy: dichter, damit alles auf einen Bildschirm passt ---------- */
@media (max-width: 899px) {
  :root { --gap: 10px; --r: 22px; }
  .tile { padding: 12px 14px; }
  .tile h2 { margin-bottom: 4px; }
  .bk-cell { padding: 9px 11px; border-radius: 14px; }
  .bk-testers .val > b { font-size: 1.7rem; }
  .bk-icon { display: none; width: 38px; height: 38px; border-radius: 12px; }
  .bk-icon svg { width: 20px; height: 20px; }
  .requests.inline li.empty { font-size: .9rem; }
  .list li { padding: 5px 0; flex: none; }
  .list li.link { padding: 0; }
  .list li.link a { padding: 5px 10px; }
  .chips li { padding: 8px; font-size: .8rem; gap: 6px; }
}
/* Niedrige Handys (iPhone SE, Safari mit Leisten): Nebensächliches weglassen */
@media (max-width: 899px) and (max-height: 700px) {
  .hello { display: none; }
  .bk-head img { width: 32px; height: 32px; border-radius: 9px; }
  .bk-head h2 { font-size: 1.25rem; }
  /* Anfragen haben Vorrang: Builds und Buchsuche weichen */
  .bk-top { grid-template-columns: 1fr; }
  .bk-icon { display: grid; }
  .bk-builds, .bk-search, .bk-requests .cap.sub { display: none; }
}
/* Große Bildschirme: mehr Luft */
@media (min-width: 900px) {
  :root { --gap: 16px; }
  .screen { padding-top: 18px; padding-bottom: 20px; }
  .tile { padding: 20px 22px; }
  .bk-head img { width: 52px; height: 52px; border-radius: 14px; }
  .bk-head h2 { font-size: 2rem; }
  .bk-testers .val > b { font-size: 2.6rem; }
  .bk-testers .val span { font-size: 1rem; }
  .bk-icon { width: 64px; height: 64px; border-radius: 18px; }
  .bk-icon svg { width: 32px; height: 32px; }
  .builds li { font-size: .95rem; line-height: 1.8; }
  .builds b { font-size: 1.05rem; }
  .bk-cell { padding: 14px 16px; }
  .bk-cells { grid-template: minmax(0, 1fr) / minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; }
  .bk-cells > .bk-cell { padding: 18px 20px; border-radius: 20px; }
  .bk-requests .cap, .bk-search .cap { font-size: .78rem; }
  .requests.inline li { padding: 14px 0; }
  .requests.inline .who b { font-size: 1.1rem; }
  .requests.inline li.empty { font-size: 1.35rem; }
  .bk-search { display: flex; flex-direction: column; justify-content: space-between; }
  .bk-search .val b { font-size: clamp(2.6rem, 9vh, 4.6rem); letter-spacing: -.03em; }
  .bk-search .val span { font-size: 1rem; }
  .bk-search .mini { height: 10px; }
  .list .name { font-size: 1.12rem; }
  .list .tag { font-size: .8rem; padding: 4px 10px; }
}

/* ---------- Anmeldung ---------- */
.login { min-height: 100svh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 16px 24px; }
.login-card { width: min(100%, 400px); background: var(--card); border: 1px solid var(--border); border-radius: 26px; padding: 32px 24px; box-shadow: var(--shadow); }
.login-card img { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 18px; }
.login-card h1 { font: 800 2.2rem/1 var(--display); letter-spacing: -.02em; margin: 0 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 22px; }
.login-card form { display: grid; gap: 10px; }
.login-card input { width: 100%; min-height: 54px; padding: 0 16px; border-radius: 16px; border: 2px solid var(--border);
  background: var(--paper); color: var(--ink); font-size: 1.05rem; }
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button { min-height: 54px; border: 0; border-radius: 999px; background: var(--ink); color: var(--paper); cursor: pointer;
  font: 700 .85rem/1 var(--display); text-transform: uppercase; letter-spacing: .07em; }
.login-card button:disabled { opacity: .6; cursor: progress; }
.login-card .passkey-btn { width: 100%; margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: transparent; color: var(--ink); border: 2px solid var(--border); }
.login-card .passkey-btn svg { width: 18px; height: 18px; }
