/* Session-Monitor, Handy-Ansicht.
   Bild: Cockpit bei Nacht. Oben eine einzige Warnleuchte (Master Caution),
   darunter je Session ein Kontrollstreifen wie bei der Flugsicherung.
   Farben aus dem ProzessPilot-Design-System, Schrift B612 (Airbus-Cockpitschrift). */

@font-face { font-family: "B612"; src: url("/static/fonts/B612-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "B612"; src: url("/static/fonts/B612-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("/static/fonts/B612Mono-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --panel: #0A1B2B;        /* Instrumentenbrett */
  --strip: #10263A;        /* Kontrollstreifen */
  --strip-line: #1C3752;
  --ink: #E8F1F8;
  --ink-dim: #8CA3B8;
  --ink-faint: #5B7489;
  --brand: #0A95E0;        /* pp-blue-500: arbeitet */
  --brand-glow: #00BEF0;   /* pp-cyan-500 */
  --amber: #F59E0B;        /* pp-warning-500: wartet auf dich */
  --red: #E5484D;          /* pp-danger-500: Fehler */
  --green: #16A34A;        /* pp-success-500: fertig */
  --green-ink: #5CCB8A;
  --radius-strip: 6px;
  --radius-ann: 14px;
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--panel);
  color: var(--ink);
  font: 400 15px/1.45 "B612", system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand-glow); outline-offset: 2px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 12px var(--gutter) 40px; }

/* Kopfzeile ------------------------------------------------------------ */
.bar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.bar .logo { width: 28px; height: 28px; border-radius: 7px; }
.bar .title { font-weight: 700; font-size: 17px; letter-spacing: 0.01em; }
.link { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-dim); }
.link::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.link[data-ok="1"]::before { background: var(--green-ink); box-shadow: 0 0 6px var(--green); }

/* Warnleuchte ---------------------------------------------------------- */
.annunciator {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  margin: 14px 0 22px;
  padding: 20px 20px 18px;
  border-radius: var(--radius-ann);
  border: 1px solid #22415E;
  background: linear-gradient(180deg, #0D2236, #0B1D2F);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 -2px 6px rgba(0, 0, 0, 0.35);
  transition: background-color 0.3s, border-color 0.3s;
}
.ann-head { display: block; margin: 0; font-weight: 700; font-size: 24px; line-height: 1.2; }
.ann-sub { display: block; margin: 6px 0 0; color: var(--ink-dim); font-size: 14px; overflow-wrap: anywhere; }
.ann-hint { display: block; margin: 12px 0 0; font-size: 12px; letter-spacing: 0.02em; opacity: 0.8; }
.ann-sub:empty, .ann-hint:empty { display: none; }

/* Master Caution: eine neue Meldung pulsiert, bis sie quittiert (angetippt) ist. */
.annunciator[data-alert="1"] { cursor: pointer; animation: caution 1.2s ease-in-out infinite; }
.annunciator[data-mood="wait"][data-alert="1"] { --pulse: rgba(245, 158, 11, 0.62); }
.annunciator[data-mood="error"][data-alert="1"] { --pulse: rgba(229, 72, 77, 0.62); }
@keyframes caution {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.32); box-shadow: 0 0 52px var(--pulse), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
}
.annunciator[data-mood="wait"] .ann-hint { color: #FFD27A; }
.annunciator[data-mood="error"] .ann-hint { color: #FFB3B5; }

.annunciator[data-mood="calm"] .ann-head { color: var(--ink-dim); }

.annunciator[data-mood="wait"] {
  border-color: #B87708;
  background: radial-gradient(120% 140% at 50% 0%, #6B4406 0%, #3A2605 55%, #2A1C06 100%);
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.28), inset 0 1px 0 rgba(255, 220, 150, 0.2);
}
.annunciator[data-mood="wait"] .ann-head { color: #FFD27A; text-shadow: 0 0 14px rgba(245, 158, 11, 0.7); }
.annunciator[data-mood="wait"] .ann-sub { color: #F3D9A8; }

.annunciator[data-mood="error"] {
  border-color: #A8323A;
  background: radial-gradient(120% 140% at 50% 0%, #5E1519 0%, #36101A 60%, #2A0E16 100%);
  box-shadow: 0 0 28px rgba(229, 72, 77, 0.3), inset 0 1px 0 rgba(255, 180, 180, 0.15);
}
.annunciator[data-mood="error"] .ann-head { color: #FFB3B5; text-shadow: 0 0 14px rgba(229, 72, 77, 0.7); }
.annunciator[data-mood="error"] .ann-sub { color: #F2C4C6; }

.annunciator[data-mood="work"] { border-color: #145B8C; }
.annunciator[data-mood="work"] .ann-head { color: #BFE8FF; }
/* Der einzige Bewegungsmoment: ein Lichtschein zieht durch die Leuchte,
   solange gearbeitet wird - wie das Logo in der Statuszeile. */
.annunciator[data-mood="work"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(0, 190, 240, 0.16) 45%,
              rgba(10, 149, 224, 0.28) 50%, rgba(0, 190, 240, 0.16) 55%, transparent 70%);
  transform: translateX(-100%);
  animation: sweep 3.4s cubic-bezier(0.45, 0, 0.3, 1) infinite;
  pointer-events: none;
}
@keyframes sweep { to { transform: translateX(100%); } }

.annunciator[data-mood="offline"] { border-color: #2A3C4E; }
.annunciator[data-mood="offline"] .ann-head { color: var(--ink-dim); }

/* Kontrollstreifen ---------------------------------------------------- */
.strips { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.strip {
  --edge: var(--ink-faint);
  background: var(--strip);
  border: 1px solid var(--strip-line);
  border-left: 6px solid var(--edge);
  border-radius: var(--radius-strip);
}
.strip[data-tone="wait"] { --edge: var(--amber); }
.strip[data-tone="error"] { --edge: var(--red); }
.strip[data-tone="work"] { --edge: var(--brand); }
.strip[data-tone="done"] { --edge: var(--green); }

.strip-main {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  row-gap: 3px;
  width: 100%;
  padding: 11px 12px 11px 12px;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  min-height: 44px;
}
.strip-name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.strip-when { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.strip-state { font-size: 13px; color: var(--ink-dim); }
.strip[data-tone="wait"] .strip-state { color: var(--amber); }
.strip[data-tone="error"] .strip-state { color: #FF8A8E; }
.strip[data-tone="work"] .strip-state { color: #6FC8F4; }
.strip[data-tone="done"] .strip-state { color: var(--green-ink); }
.strip-time { font-family: "B612 Mono", ui-monospace, monospace; font-size: 13px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.strip-detail {
  grid-column: 1 / -1;
  color: var(--ink-dim);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.strip-detail:empty { display: none; }
.strip[data-quiet="1"] { opacity: 0.62; }

/* Flugschreiber: die letzten 60 Minuten als feine Spur, rechts ist jetzt. */
.trace {
  grid-column: 1 / -1;
  height: 4px;
  margin-top: 7px;
  border-radius: 2px;
  background-color: #0E2133;
}

/* Lampentest beim Öffnen: alle Leuchten kurz an, dann in ihren Zustand. */
body.lamptest .strip { animation: lamp 900ms ease-out both; animation-delay: calc(var(--i, 0) * 70ms); }
body.lamptest .annunciator { animation: annlamp 1000ms ease-out both; }
@keyframes lamp {
  0% { border-left-color: #FFF1C9; box-shadow: -4px 0 18px rgba(255, 214, 140, 0.6); }
  45% { border-left-color: #FFF1C9; box-shadow: -4px 0 18px rgba(255, 214, 140, 0.45); }
  100% { border-left-color: var(--edge); box-shadow: none; }
}
@keyframes annlamp {
  0% { filter: brightness(1.9) saturate(0.6); box-shadow: 0 0 44px rgba(255, 226, 170, 0.45); }
  40% { filter: brightness(1.5) saturate(0.8); }
  100% { filter: none; }
}

/* Flugbuch ------------------------------------------------------------ */
.logbook { margin-top: 28px; }
.logbook h2 { margin: 0 0 6px; font-size: 16px; }
.logbook p { margin: 0 0 8px; color: var(--ink-dim); font-size: 14px; }
.logbook #logText { color: var(--ink); font-size: 15px; }

.steps { list-style: none; margin: 0; padding: 2px 12px 12px; border-top: 1px dashed var(--strip-line); }
.steps li { display: grid; grid-template-columns: 3.3em 1fr; gap: 10px; padding: 6px 0 0; font-size: 13px; color: var(--ink-dim); overflow-wrap: anywhere; }
.steps time { font-family: "B612 Mono", ui-monospace, monospace; color: var(--ink-faint); }
.steps .again { color: var(--ink-faint); }

.empty { color: var(--ink-dim); padding: 8px 2px; }

/* Benachrichtigungen --------------------------------------------------- */
.push { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--strip-line); }
.push h2 { margin: 0 0 6px; font-size: 16px; }
.push p { margin: 0 0 12px; color: var(--ink-dim); font-size: 14px; }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0 0 14px; padding: 0; border: 0; }
.kinds label { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; }
.kinds input { width: 20px; height: 20px; accent-color: var(--brand); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid #1F4A6E;
  background: #0F2E48;
  cursor: pointer;
}
.btn-main { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn-quiet { background: none; border-color: transparent; color: var(--ink-dim); padding: 0 8px; }
.note { font-size: 13px; color: var(--ink-faint); }

.logout { margin-top: 26px; }

/* Anmeldung ------------------------------------------------------------ */
.login { max-width: 380px; margin: 0 auto; padding: 56px var(--gutter); }
.login img { width: 64px; height: 64px; border-radius: 14px; }
.login h1 { margin: 18px 0 4px; font-size: 24px; }
.login p { margin: 0 0 24px; color: var(--ink-dim); }
.login label { display: block; margin: 0 0 6px; font-size: 14px; color: var(--ink-dim); }
.login input {
  width: 100%;
  min-height: 48px;
  margin: 0 0 16px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #22415E;
  background: var(--strip);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}
.login .btn { width: 100%; }
.login .error { color: #FF8A8E; min-height: 1.4em; margin: 0 0 12px; }

@media (prefers-reduced-motion: reduce) {
  .annunciator[data-mood="work"]::after { animation: none; transform: none; opacity: 0.5; }
  .annunciator { transition: none; }
  .annunciator[data-alert="1"] { animation: none; filter: brightness(1.2); }
  body.lamptest .strip, body.lamptest .annunciator { animation: none; }
}
