:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 14px;
  --border: #334155;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0) 16px 0;
  height: calc(56px + env(safe-area-inset-top, 0));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; letter-spacing: 0.3px; }
.nav { display: flex; gap: 14px; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a:hover { color: var(--text); }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom, 0));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card.error { border-color: var(--danger); color: #fecaca; }
.card.ok { border-color: var(--ok); }

h1 { font-size: 22px; margin: 6px 0 16px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, textarea, select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px; /* 16px avoids iOS zoom-on-focus */
}
textarea { min-height: 80px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  background: var(--accent-2);
  color: #04263a;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  margin-top: 16px;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0; }
.link-btn:hover { color: var(--text); }

.row { display: flex; gap: 10px; align-items: center; }
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--border);
}
.banner {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  font-size: 14px;
}
.banner.warn { border-color: #b45309; color: #fde68a; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
td.flag { color: var(--danger); }

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.session-item:last-child { border-bottom: none; }
.session-item .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.session-item .subj { font-weight: 600; }

.todo {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.todo.done .body { text-decoration: line-through; color: var(--muted); }
.todo input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; }
.todo .body { flex: 1; }
.spin { opacity: 0.6; }
