/* Optik angelehnt an das Atrium-Theme (Nacht) des Streamlit-Dashboards: atrium_theme.py, utils.COLORS. */
:root {
  --primary: #6D71F5;
  --text: #EDEEF3;
  --muted: #9AA0B4;
  --card: rgba(27, 29, 41, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --grid-empty: #20222E;
  --green: #34C98A;
  --amber: #EFAE4E;
  --red: #E8677A;
  --band: #333650;
  --safe-top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 650px at 12% -8%, rgba(255, 79, 163, 0.14) 0%, transparent 55%),
    radial-gradient(950px 600px at 105% 5%, rgba(76, 224, 179, 0.10) 0%, transparent 55%),
    linear-gradient(180deg, #0b1330 0%, #050813 100%) fixed;
  background-color: #050813;
  min-height: 100vh;
  overscroll-behavior-y: contain; /* eigenes Pull-to-Refresh statt Browser-Neuladen */
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 760px; margin: 0 auto; padding: calc(12px + var(--safe-top)) 16px 32px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.error { color: var(--red); min-height: 1.2em; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0; }
a { color: var(--primary); }

.btn {
  background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.5rem 0.8rem; font: inherit; font-size: 0.9rem; cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn:disabled { opacity: 0.5; }

.login { max-width: 380px; padding-top: calc(15vh + var(--safe-top)); }
.login form { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.login input {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  padding: 0.75rem; font: inherit; font-size: 1rem;
}

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.8rem; }
.actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.banner { border-radius: 12px; padding: 0.6rem 0.8rem; margin-bottom: 0.8rem; font-size: 0.85rem;
  background: rgba(239, 174, 78, 0.12); border: 1px solid rgba(239, 174, 78, 0.35); color: var(--amber); }

.section-title { font-weight: 700; margin: 1.3rem 0 0.6rem; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 0.9rem;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tile { cursor: pointer; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.tile .label { color: var(--muted); font-size: 0.78rem; }
.tile .value { font-size: 1.45rem; font-weight: 800; }
.tile .unit { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.tile .delta { font-size: 0.72rem; color: var(--muted); }
.tile .src { font-size: 0.65rem; color: var(--muted); opacity: 0.75; margin-top: auto; }
.up { color: var(--green); } .down { color: var(--red); }
.note { font-size: 0.68rem; color: var(--amber); }

.light { display: flex; justify-content: space-between; align-items: center; border-radius: 12px; padding: 0.8rem 1rem; margin-top: 0.6rem; font-weight: 600; }

.training { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.5rem; }
.training .head { display: flex; justify-content: space-between; gap: 0.5rem; font-weight: 700; }
.badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.desc { white-space: pre-wrap; font-size: 0.8rem; color: var(--muted); max-height: 9em; overflow: auto; }

.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.heat div { aspect-ratio: 1; border-radius: 3px; background: var(--grid-empty); }
.heat-legend { display: flex; justify-content: space-between; margin-top: 0.4rem; }

.chart { width: 100%; min-height: 240px; }
.donuts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 0.5rem; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 0.35rem 0.8rem; font: inherit; font-size: 0.8rem; }
.seg button.on { background: rgba(109, 113, 245, 0.25); color: var(--text); }

dialog { background: #11131d; color: var(--text); border: 1px solid var(--border); border-radius: 16px; width: min(94vw, 700px); padding: 0.9rem; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }

.ptr { position: fixed; top: calc(-48px + var(--safe-top)); left: 50%; transform: translateX(-50%); width: 40px; height: 40px;
  border-radius: 50%; background: var(--card); border: 1px solid var(--border); display: flex; align-items: center;
  justify-content: center; z-index: 10; transition: top 0.2s; font-size: 1.2rem; }
.ptr.spin .ptr-icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { margin-top: 2rem; text-align: center; }
