/* J.A.R.V.I.S. PWA — HUD-Look angelehnt an die Desktop-App (src/renderer/src/styles.css),
   aber als schmales, gestapeltes Layout fürs Handy statt des breiten 3-Spalten-Grids. */
:root {
  --cy: #7fe6ff;
  --cy2: #4a90c8;
  --red: #ff4d5e;
  --org: #ff9a3c;
  --grn: #5dffa0;
  --ln: rgba(90, 150, 230, 0.26);
  --pnl: rgba(10, 22, 46, 0.6);
  --ink: #cfe4ff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(130% 100% at 50% 0%, #0b1e3a 0%, #071528 55%, #030b18 100%);
  color: var(--ink);
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
}

.deck {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* Header */
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  flex: 0 0 auto;
}
.hdr .l {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #dff6ff;
  text-shadow: 0 0 14px rgba(90, 210, 255, 0.6);
}
.hdr .l small {
  display: block;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--cy2);
  margin-top: 2px;
}
.hdr .c {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #eafaff;
  line-height: 1;
}
.hdr .c .date {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--cy2);
  text-transform: uppercase;
  margin-top: 3px;
}
.hdr .chips { display: flex; gap: 6px; }
.chip {
  border: 1px solid var(--ln);
  padding: 3px 7px;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--cy);
  background: rgba(6, 20, 28, 0.5);
  white-space: nowrap;
}
.chip.on { border-color: var(--grn); color: var(--grn); box-shadow: 0 0 10px rgba(90, 255, 160, 0.25); }
.chip.al { border-color: var(--red); color: var(--red); }
.chip.mut { border-color: rgba(120, 140, 170, 0.4); color: #9fb4cc; }

.termin {
  margin: 0 12px 9px;
  border: 1px solid var(--ln);
  background: rgba(10, 24, 48, 0.55);
  padding: 6px 12px;
  flex: 0 0 auto;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.termin .lb { font-size: 9px; letter-spacing: 2px; color: var(--cy2); }
.termin .val { font-size: 12px; color: #dff0ff; min-height: 15px; }
.termin .val b { color: #eafaff; }
.termin .val.empty { opacity: .5; }

/* Scrollbarer Mittelbereich: Kern + alle HUD-Panels gestapelt */
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 220, 255, 0.35) transparent;
}
.scroll::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(120, 220, 255, 0.3); border-radius: 3px; }

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
#stage { display: flex; }
#orb { width: min(52vw, 46vh); height: min(52vw, 46vh); cursor: pointer; }

.money { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.mtile {
  border: 1px solid var(--ln);
  background: rgba(6, 20, 28, 0.5);
  padding: 7px 8px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.mtile .lb { font-size: 9px; letter-spacing: 1px; color: var(--cy2); }
.mtile .num { font-size: 18px; font-weight: 800; color: #eafaff; }
.mtile .num.up { color: var(--grn); }
.mtile .sub { font-size: 9px; color: var(--org); }

/* Panels (System Load, Netzwerk, Prozesse, Tagesübersicht, MCN-Kurs, KI-System, Brief …) */
.panel {
  background: var(--pnl);
  border: 1px solid var(--ln);
  padding: 8px 11px;
  position: relative;
  flex: 0 0 auto;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: inset 0 0 18px rgba(20, 120, 170, 0.06);
}
.panel h3 { font-size: 10px; letter-spacing: 1.5px; color: var(--cy); text-transform: uppercase; margin-bottom: 5px; font-weight: 700; }
.panel::before, .panel::after {
  content: ''; position: absolute; width: 12px; height: 12px; pointer-events: none;
  border-color: var(--cy); opacity: 0.4;
}
.panel::before { top: 4px; left: 4px; border-top: 1px solid; border-left: 1px solid; }
.panel::after { bottom: 4px; right: 4px; border-bottom: 1px solid; border-right: 1px solid; }
.panel .ph { font-size: 11px; color: rgba(180, 210, 230, 0.5); margin-top: 2px; }

.netrow { display: flex; justify-content: space-between; font-size: 11px; color: #9fc0e0; margin-top: 3px; }
.netrow b { color: #eafaff; font-weight: 700; }

.overview { display: flex; flex-direction: column; }
.ovrow {
  display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px;
  padding: 5px 2px; font-size: 12px; border-bottom: 1px solid rgba(90, 150, 230, 0.09);
}
.ovrow:last-child { border-bottom: none; }
.ovrow .ic { text-align: center; font-size: 13px; }
.ovrow .lbl { color: #bcd3ea; letter-spacing: 0.4px; }
.ovrow .val { color: #eafaff; font-weight: 600; text-align: right; }
.ovrow .val.mut { color: #6f89a6; font-weight: 400; }

.kv { display: flex; flex-direction: column; }
.krow { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 2px; border-bottom: 1px solid rgba(90, 150, 230, 0.09); }
.krow:last-child { border-bottom: none; }
.krow span { color: #93aec8; letter-spacing: 0.4px; }
.krow b { color: #eafaff; font-weight: 700; }
.krow b.bad { color: var(--red); }

table.proc { width: 100%; border-collapse: collapse; font-size: 11px; }
table.proc td { padding: 3px 2px; border-bottom: 1px solid rgba(120, 220, 255, 0.08); letter-spacing: 0.3px; }
table.proc td.n { text-align: right; color: #eafaff; }
table.proc td.g { color: var(--grn); text-align: right; }
table.proc td.rd { color: var(--org); text-align: right; }

/* Ticker */
.ticker {
  display: flex; align-items: center; border: 1px solid var(--red);
  background: rgba(40, 8, 12, 0.55); overflow: hidden; white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  flex: 0 0 auto; margin: 0 0 9px;
}
.ticker .tag { flex: 0 0 auto; background: var(--red); color: #160406; font-weight: 800; font-size: 10px; letter-spacing: 1.5px; padding: 5px 10px; }
.ticker .track-wrap { flex: 1; min-width: 0; overflow: hidden; padding-left: 10px; }
.ticker .track {
  display: inline-block; white-space: nowrap; color: #ffcfd4; font-size: 11px;
  letter-spacing: 0.05em; animation: scroll 30s linear infinite; will-change: transform;
}
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Bottom: Protokoll + Eingabe — immer sichtbar, eigener Scroll */
.bottom { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; padding: 0 12px calc(10px + env(safe-area-inset-bottom)); }
.proto { max-height: 32vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(120, 220, 255, 0.4) transparent; }
.proto::-webkit-scrollbar { width: 6px; }
.proto::-webkit-scrollbar-thumb { background: rgba(120, 220, 255, 0.35); border-radius: 3px; }
.line { display: flex; gap: 8px; align-items: baseline; margin: 4px 0; animation: f .2s; }
.line .who { flex: 0 0 40px; font-size: 9px; letter-spacing: 1px; color: var(--cy); font-weight: 700; }
.line.jarvis .who { color: var(--org); }
.line.action .who { color: var(--grn); }
.line .msg { font-size: 13px; line-height: 1.4; color: #eafaff; white-space: pre-wrap; word-break: break-word; }
.line.action .msg { font-family: 'Consolas', monospace; font-size: 11px; color: #9fe8c4; opacity: 0.85; }
.line.error { color: #ff8a8a; font-size: 12px; }
.proto .ph { font-size: 11px; color: rgba(180, 210, 230, 0.5); }
@keyframes f { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.act {
  padding: 9px 14px; font-size: 13px; border-radius: 0; background: rgba(255, 170, 60, 0.16);
  color: #ffe6c4; border: 1px solid rgba(255, 170, 60, 0.45); box-shadow: 0 0 12px rgba(255, 170, 60, 0.15);
}
.act:active { background: rgba(255, 170, 60, 0.3); }

.inp {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--ln);
  background: rgba(8, 24, 34, 0.7); padding: 8px 10px; flex: 0 0 auto;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.inp input {
  flex: 1; background: transparent; border: none; outline: none; color: #eafaff; font-size: 15px;
}
.inp input::placeholder { color: rgba(120, 170, 210, 0.5); }
.inp button { border: none; background: transparent; cursor: pointer; }
.inp .send { color: var(--cy); font-size: 11px; letter-spacing: 1.5px; font-weight: 700; padding: 0 4px; }
.inp #mic, .inp #cam { font-size: 20px; padding: 4px 8px; color: var(--cy); }
.inp #mic.hf { color: var(--grn); text-shadow: 0 0 10px var(--grn); }
.inp #mic.rec { color: var(--red); animation: p 1s infinite; }
@keyframes p { 50% { opacity: .5; } }
#photo { display: none; }

/* Zugangs-Gate (E-Mail-Login) */
#gate {
  position: fixed; inset: 0; background: #04060a; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px; z-index: 10;
}
#gate .box {
  border: 1px solid var(--ln); background: var(--pnl); padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 360px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
#gate .tt { letter-spacing: 6px; color: var(--cy); font-size: 13px; font-weight: 700; }
#gate p { opacity: .75; text-align: center; font-size: 13px; }
#gate input { width: 100%; padding: 13px; border: 1px solid var(--ln); background: #0a1420; color: #e6f4ff; font-size: 16px; outline: none; }
#gate button { width: 100%; padding: 13px; border: none; background: var(--cy); color: #04121c; font-weight: 700; letter-spacing: 1px; cursor: pointer; }
#gate button:disabled { opacity: .5; }

/* Kopf-Buttons (Einkaufsliste / Abmelden) */
#listBtn, #logoutBtn {
  position: fixed; top: calc(env(safe-area-inset-top) + 8px); z-index: 6;
  width: 40px; height: 40px; padding: 0; font-size: 18px;
  background: rgba(90, 200, 255, 0.14); color: var(--cy); border: 1px solid rgba(90, 200, 255, 0.4);
}
#listBtn { right: 12px; }
#logoutBtn { left: 12px; }

/* Einkaufslisten-Panel (Overlay) */
#list {
  position: fixed; inset: 0; z-index: 20; background: radial-gradient(130% 100% at 50% 0%, #0b1e3a 0%, #071528 55%, #030b18 100%);
  display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  transform: translateX(100%); transition: transform .28s ease; visibility: hidden;
}
#list.open { transform: translateX(0); visibility: visible; }
.lhead { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.lhead h2 { flex: 1; font-size: 16px; letter-spacing: 4px; font-weight: 700; color: var(--cy); text-shadow: 0 0 14px rgba(90, 200, 255, 0.3); }
.lclose { width: 38px; height: 38px; padding: 0; font-size: 18px; background: rgba(90, 200, 255, 0.14); color: var(--cy); border: 1px solid rgba(90, 200, 255, 0.4); }
.lbar { display: flex; gap: 8px; padding: 0 14px 12px; }
#litem { flex: 1; background: rgba(10, 22, 34, 0.8); border: 1px solid var(--ln); padding: 13px; color: #e6f4ff; font-size: 16px; outline: none; }
#ladd { width: 44px; border: 1px solid var(--ln); background: var(--cy); color: #04121c; font-size: 20px; font-weight: 700; }
#litems { flex: 1; overflow-y: auto; padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 13px; background: rgba(10, 22, 34, 0.6); border: 1px solid var(--ln); animation: f .2s; }
.li .cb { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--cy2); background: transparent; color: #04121c; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.li.done .cb { background: var(--cy); border-color: var(--cy); }
.li .nm { flex: 1; font-size: 15px; color: #dbefff; word-break: break-word; }
.li .qty { opacity: .6; font-size: 12px; margin-left: 6px; }
.li.done .nm { text-decoration: line-through; color: rgba(150, 180, 205, .5); }
.li .del { flex: 0 0 auto; width: 32px; height: 32px; padding: 0; font-size: 15px; background: transparent; color: rgba(255, 120, 120, .75); border: 1px solid rgba(255, 120, 120, .35); }
.lempty { opacity: .5; text-align: center; padding: 32px 12px; font-size: 13px; }
.lclear { margin: 0 14px 12px; padding: 11px; font-size: 13px; background: rgba(90, 200, 255, .12); color: #9fdcff; border: 1px solid var(--ln); }
