:root {
  --blue: #0b3d91;
  --accent: #0b3d91;
  --on-accent: #fff;
  --bg: #f4f6fb;
  --surface: #fff;
  --text: #16202e;
  --muted: #5b6880;
  --line: #d9dfec;
  --yes: #1f9d55;
  --no: #d33a3a;
  --maybe: #b8941f;
  --nav-h: 64px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #7aa9ff;
    --on-accent: #0a1020;
    --bg: #0e1420;
    --surface: #172033;
    --text: #e8edf7;
    --muted: #9aa7bf;
    --line: #2a3550;
    --yes: #3ecf7a;
    --no: #ff6b6b;
    --maybe: #e0b84a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

a { color: var(--accent); }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 20px 0 8px; color: var(--muted); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 56px 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--blue);
  color: #fff;
}

.topbar h1 { flex: 1; margin: 0; font-size: 1.1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { border-radius: 6px; }
.switch { position: relative; }
.topbar .icon-btn { color: #fff; }

.menu {
  position: absolute;
  right: 0;
  top: 44px;
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 200px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.2);
}

.menu button {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 8px;
}

.menu button:hover { background: var(--bg); }

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 76px);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: none;
}

.bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.bottom-nav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--accent);
  background: none;
  border: 0;
  border-radius: 50%;
}

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.head-row h2 { margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 96px;
  padding: 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.tile .icon { color: var(--accent); width: 28px; height: 28px; }
.tile.editing.off { opacity: 0.5; }
.tile-controls { display: flex; align-items: center; gap: 2px; margin-top: auto; }
.tile-controls input { margin-left: auto; width: 20px; height: 20px; }

.btn {
  display: inline-block;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
}

.btn.secondary { color: var(--accent); background: transparent; }
.btn.danger { color: var(--no); background: transparent; border-color: var(--no); }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }
.btn.followed { background: var(--yes); border-color: var(--yes); color: #fff; }
.btn:disabled { opacity: 0.6; }

.actions { display: grid; gap: 10px; margin-top: 20px; }
.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }

.card {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chip { padding: 2px 10px; font-size: 0.8rem; color: var(--accent); border: 1px solid var(--line); border-radius: 999px; }
.muted, .empty { color: var(--muted); }
.empty { padding: 24px 0; text-align: center; }

.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; font-size: 0.9rem; color: var(--muted); }

input:not([type="checkbox"]), textarea {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.check { display: flex; align-items: flex-start; gap: 10px; }
.check input { flex: none; width: 22px; height: 22px; margin-top: 1px; }

.status { min-height: 1.4em; margin: 0; }
.status.error { color: var(--no); }
.status.ok { color: var(--yes); }

.legal { overflow-wrap: anywhere; }

/* Feedback sits in the top bar's right corner, so it never covers content. */
.fab {
  position: fixed;
  top: calc(6px + env(safe-area-inset-top));
  right: 6px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #fff;
  background: none;
  border: 0;
}

.fab .icon { width: 22px; height: 22px; }
.fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.sheet {
  width: min(92vw, 420px);
  padding: 20px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.sheet::backdrop { background: rgb(0 0 0 / 0.5); }
.sheet .row { justify-content: flex-end; }
