:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #6b7280;
  --border: #e3e6ea;
  --accent: #2f6feb;
  --error: #b42318;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --border: #262a32;
    --accent: #6ea1ff;
    --error: #ff8f85;
  }
}

* { box-sizing: border-box; }

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { font-weight: 650; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }

.site-header nav { display: flex; align-items: center; gap: 1rem; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.site-header nav a:hover { color: var(--text); }
.who { color: var(--muted); font-size: 0.9rem; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.linkish:hover { color: var(--text); }

.page { max-width: 720px; margin: 2.5rem auto; padding: 0 1.25rem; }
/* margin must stay `auto` horizontally, or the 720px column pins to the left. */
.page.centered { display: grid; place-items: center; min-height: 100dvh; margin: 0 auto; }

/* ── HUB: left menu + body ────────────────────────────────────────────── */

/* Fixed height with independent panes: the menu stays put while an app
   scrolls, and the app's sticky tab bars have a scroll container to stick to. */
.hub {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  height: calc(100dvh - 53px); /* viewport minus site header */
}

.hub-nav {
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 0.75rem 0.5rem 2rem;
  overflow-y: auto;
}

.hub-nav-heading {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 1rem 0.7rem 0.4rem;
}

.hub-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.3;
}
.hub-nav-item:hover { background: var(--bg); }
.hub-nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.hub-nav-icon { font-size: 1.05rem; flex-shrink: 0; }
.hub-nav-label { flex: 1; }
.hub-nav-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
}
.hub-nav-item.active .hub-nav-tag { color: #fff; border-color: rgba(255,255,255,0.5); }

.hub-body { min-width: 0; overflow-y: auto; }
.hub-head { padding: 1.75rem 1.75rem 0; }
.hub-head h1 { font-size: 1.3rem; }

.empty-state {
  margin: 1.25rem 1.75rem 2rem;
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.empty-state p + p { margin-top: 0.6rem; }
.empty-state code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.82em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0.75rem;
  padding: 1.25rem 1.75rem 2.5rem;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
.cat-card:hover { border-color: var(--accent); }
.cat-card.is-empty { opacity: 0.62; }
.cat-card-icon { font-size: 1.5rem; }
.cat-card-name { font-weight: 650; letter-spacing: -0.01em; }
.cat-card-blurb { font-size: 0.83rem; color: var(--muted); }
.cat-card-state {
  margin-top: 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.cat-card.is-empty .cat-card-state { color: var(--muted); }

/* Narrow screens: menu becomes a horizontal strip above the content. */
@media (max-width: 720px) {
  .hub { grid-template-columns: 1fr; height: auto; min-height: calc(100dvh - 53px); }
  .hub-body { overflow-y: visible; }
  .hub-nav {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
  }
  .hub-nav-heading { display: none; }
  .hub-nav-item { flex-direction: column; gap: 0.15rem; white-space: nowrap; font-size: 0.7rem; }
  .hub-nav-tag { display: none; }
  .hub-head, .cat-grid, .empty-state { padding-left: 1rem; padding-right: 1rem; }
  .empty-state { margin-left: 1rem; margin-right: 1rem; }
  .app-frame { min-height: 70dvh; }
}

.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
}
.auth-card { max-width: 380px; }

h1 { margin: 0 0 0.35rem; font-size: 1.35rem; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.error { color: var(--error); font-size: 0.9rem; }

label {
  display: block;
  margin: 1rem 0 0.3rem;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--muted);
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

button[type="submit"] {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.65rem;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
}
button[type="submit"]:hover { filter: brightness(1.08); }

.messages { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.messages li {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 0.5rem;
}
