:root {
  --bg: #101418;
  --panel: #1a2027;
  --panel-line: #262e37;
  --text: #eef2f5;
  --muted: #8d99a6;
  --accent: #5fb3ff;
  --warn: #ffb35c;
  --done: #5a6672;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.agenda, .todos { scrollbar-width: thin; scrollbar-color: var(--panel-line) transparent; }
.agenda::-webkit-scrollbar, .todos::-webkit-scrollbar { width: 6px; }
.agenda::-webkit-scrollbar-thumb, .todos::-webkit-scrollbar-thumb { background: var(--panel-line); border-radius: 3px; }

button, input { font: inherit; color: inherit; }

/* ---------- Login ---------- */
.login {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-box {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box h1 { font-size: 24px; font-weight: 500; margin: 0 0 8px; }
.login-box input, .todo-add input {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 18px;
  outline: none;
}
.login-box input:focus, .todo-add input:focus { border-color: var(--accent); }
.login-box button, .todo-add button {
  background: var(--accent);
  color: #06121e;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}
.login-error { color: var(--warn); min-height: 1.2em; margin: 0; }

/* ---------- Layout ---------- */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 24px;
  gap: 20px;
}

.top {
  display: flex;
  align-items: center;
  gap: 32px;
  flex: none;
}
.clock {
  font-size: 112px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}
.date { flex: 1; }
.weekday { font-size: 36px; font-weight: 500; }
.fulldate { font-size: 26px; color: var(--muted); margin-top: 2px; }
.week {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
}
.weather { display: flex; align-items: flex-end; gap: 28px; }
.temp { text-align: center; }
.temp-value { font-weight: 300; line-height: 1; white-space: nowrap; }
.temp-now .temp-value { font-size: 72px; }
.temp-side .temp-value { font-size: 44px; color: var(--muted); }
.temp-label { font-size: 16px; color: var(--muted); margin-top: 6px; }

.main {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 20px;
}
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.agenda-panel { flex: 3; }
.todo-panel { flex: 2; }

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 24px; font-weight: 500; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 15px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Termine ---------- */
.agenda {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.day { margin-bottom: 10px; }
.day-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--panel-line);
  margin-bottom: 6px;
}
.day.today .day-title { color: var(--accent); }
.event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 10px 5px 0;
  margin: 3px 0;
  border-radius: 10px;
  overflow: hidden;
}
.event-bar { width: 6px; align-self: stretch; margin: -5px 0; flex: none; }
.event-time {
  width: 100px;
  flex: none;
  font-size: 16px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.event-title { flex: 1; font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
.event-person {
  font-size: 13px;
  font-weight: 600;
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
}
.empty { color: var(--muted); font-size: 18px; padding: 6px 0; }
.notice { color: var(--warn); font-size: 14px; }
.notice:empty { display: none; }

/* ---------- Todos ---------- */
.todo-add { display: flex; gap: 10px; margin-bottom: 10px; }
.todo-add input { flex: 1; min-width: 0; }
.todo-add button { width: 54px; padding: 0; font-size: 28px; line-height: 1; }

.todos {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.todo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--panel-line);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.todo-check {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.todo-title { flex: 1; font-size: 21px; min-width: 0; overflow-wrap: anywhere; }
.todo.done .todo-check { background: var(--accent); border-color: var(--accent); }
.todo.done .todo-check::after {
  content: "";
  width: 8px;
  height: 14px;
  border: solid #06121e;
  border-width: 0 3px 3px 0;
  transform: translateY(-2px) rotate(45deg);
}
.todo.done .todo-title { color: var(--done); text-decoration: line-through; }
.todo-delete {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  padding: 4px 10px;
  cursor: pointer;
}

.offline {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  background: var(--warn);
  color: #1d1200;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Handy / Hochformat ---------- */
@media (max-width: 900px) {
  .app { height: auto; min-height: 100%; padding: 16px; gap: 16px; }
  .top { flex-wrap: wrap; gap: 8px 20px; }
  .clock { font-size: 64px; }
  .weekday { font-size: 24px; }
  .fulldate { font-size: 18px; }
  .weather { gap: 18px; }
  .temp-now .temp-value { font-size: 44px; }
  .temp-side .temp-value { font-size: 28px; }
  .temp-label { font-size: 13px; }
  .main { flex-direction: column; }
  .panel { padding: 14px 16px; }
  .todo-panel { order: -1; }
  .event-time { width: 84px; font-size: 14px; }
  .event-title { font-size: 16px; }
  .todo-title { font-size: 18px; }
}
