:root {
  --bg: #f3f5f9;
  --fg: #202d42;
  --muted: #5d6c82;
  --card: #ffffff;
  --line: #dce3ed;
  --accent: #365fd6;
  --accent-fg: #ffffff;
  --err-bg: #fdecec;
  --err-fg: #8a1414;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
.bar {
  display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}
.bar h1 { font-size: 20px; margin: 0; flex: 1; }
main { padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); max-width: 1100px; margin: 0 auto; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid > li { min-width:0; display:flex; }
.tile {
  display: flex; flex-direction: column; gap: 6px;
  min-height: 230px; padding: 22px; width:100%; height:100%;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none;
}
a.tile:hover, a.tile:focus-visible { border-color: var(--accent); outline: none; }
.tile.soon { opacity: .55; cursor: not-allowed; user-select: none; }
.tile-title { font-weight: 600; font-size: 17px; }
.tile-desc { color: var(--muted); font-size: 14px; }
.tile-category { color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.7px; margin-bottom:12px; }
.tile-action { margin-top:auto; padding-top:22px; color:var(--accent); font-size:13px; font-weight:600; }
.badge {
  margin-top: auto; align-self: flex-start;
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}

button, select, input, textarea {
  font: inherit; color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
button { cursor: pointer; min-height: 40px; }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
a.btn {
  color: var(--fg); text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}

[hidden] { display: none !important; }
.account { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; max-width: 75%; }
#account-name { overflow-wrap: anywhere; min-width: 0; }
.account button { flex-shrink: 0; }
.session-status { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); }
a.tile:focus-visible, a.btn:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
@media (max-width: 420px) {
  .bar { flex-wrap: wrap; }
  .account { flex-wrap: wrap; max-width: 100%; margin-left: auto; }
  .account #account-name { max-width: 100%; }
}

/* One light navigation shell for the board, catalog and existing tools. */
.hub-header { background:var(--card); padding:14px 24px; gap:24px; flex-wrap:wrap; }
.hub-brand { display:inline-flex; align-items:center; gap:9px; color:var(--fg); font-size:21px; font-weight:750; text-decoration:none; flex-shrink:0; }
.brand-dot { width:8px; height:8px; border-radius:50%; background:var(--accent); }
.hub-nav { display:flex; gap:4px; align-items:center; }
.hub-nav a { text-decoration:none; color:var(--muted); border-radius:8px; padding:9px 12px; font-size:14px; font-weight:550; white-space:nowrap; }
.hub-nav a:hover { background:#f3f5f9; color:var(--fg); }
.hub-nav a[aria-current="page"] { background:#eaf0ff; color:var(--accent); }
.hub-header .account { margin-left:auto; max-width:none; font-size:13px; }
.hub-header .account button { min-height:36px; padding:6px 11px; font-size:13px; }
.hub-brand:focus-visible,.hub-nav a:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
.catalog-page { max-width:1160px; padding-top:34px; padding-bottom:64px; }
.page-intro { margin-bottom:24px; }
.page-intro h1 { margin:5px 0 10px; font-size:clamp(25px,3vw,34px); line-height:1.25; letter-spacing:-.7px; }
.page-intro p { max-width:720px; color:var(--muted); font-size:14px; line-height:1.6; margin:0; }
.eyebrow,.page-intro .eyebrow { font-size:10px; letter-spacing:1px; font-weight:700; color:var(--muted); }
.page-title-row { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.chat,.downloads { padding-top:30px; }
.chat .page-intro,.downloads .page-intro { margin-bottom:8px; }
@media(max-width:1000px) { .grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:850px) { .hub-header { gap:12px; } .hub-nav { order:3; width:100%; } }
@media(max-width:560px) {
  .grid { grid-template-columns:minmax(0,1fr); }
  .tile { min-height:190px; padding:20px; }
  .hub-header { padding:12px 14px; gap:10px; }
  .hub-nav { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; min-width:0; }
  .hub-nav a { font-size:14px; padding:9px 10px; min-width:0; white-space:normal; }
  .hub-header .account { max-width:70%; }
  .catalog-page { padding:24px 14px 44px; }
}
