:root {
  --bg: #fbfaf7;
  --fg: #1c1b19;
  --muted: #6b6860;
  --line: #e6e2d9;
  --card: #ffffff;
  --accent: #1d4ed8;
  --link: #1a3fae;
  --serif: Charter, 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --fg: #ecebe6;
    --muted: #9c998f;
    --line: #2c2b27;
    --card: #1b1b18;
    --accent: #7aa2ff;
    --link: #9db8ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--sans); }
a { color: var(--link); }
code { font-size: 0.9em; background: var(--line); padding: 0.1em 0.35em; border-radius: 4px; }
.muted { color: var(--muted); }
.narrow { max-width: 720px; margin: 2rem auto; padding: 0 1rem; }
.wide { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }
.center { text-align: center; }

/* Platform bar */
.platform-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 0.4rem; font-weight: 650; }
.brand a { color: var(--fg); text-decoration: none; }
.brand .logo { letter-spacing: -0.02em; font-size: 1.1rem; }
.brand .sep { color: var(--muted); }
.platform-actions { display: flex; align-items: center; gap: 0.5rem; }
.menu { position: relative; }
.icon-button, .avatar {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-button:hover, .icon-button[aria-expanded='true'] { background: var(--line); color: var(--fg); }
.avatar { background: var(--accent); color: #fff; font-weight: 650; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.12); padding: 0.5rem;
}
.popover[hidden] { display: none; }
.app-grid { display: grid; grid-template-columns: repeat(3, 88px); gap: 0.25rem; min-width: 0; }
.app-tile {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 0.7rem 0.25rem;
  border-radius: 10px; text-decoration: none; color: var(--fg); font-size: 0.85rem;
}
.app-tile:hover { background: var(--line); }
.app-tile.placeholder { color: var(--muted); opacity: 0.6; }
.app-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--line); font-size: 1.3rem; }
.app-icon svg { width: 24px; height: 24px; }
.account { display: flex; flex-direction: column; }
.account a { padding: 0.5rem 0.75rem; border-radius: 8px; text-decoration: none; color: var(--fg); }
.account a:hover, .account .menu-item:hover { background: var(--line); }
.account form { margin: 0; }
.account .menu-item { width: 100%; text-align: left; padding: 0.5rem 0.75rem; border-radius: 8px; border: 0; background: none; color: var(--fg); font: inherit; cursor: pointer; }
.account-email { padding: 0.5rem 0.75rem; color: var(--muted); font-size: 0.85rem; border-bottom: 1px solid var(--line); margin-bottom: 0.25rem; }

/* Buttons */
.button {
  display: inline-block; padding: 0.6rem 1.1rem; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; cursor: pointer; font-size: 0.95rem;
}
.button.ghost { background: transparent; color: var(--accent); }
.button.small { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
button.link { background: none; border: 0; color: var(--link); cursor: pointer; padding: 0; font: inherit; }

/* Home */
.home { max-width: 880px; margin: 0 auto; padding: 3rem 1.25rem 2rem; }
.hero h1 { font-family: var(--serif); font-size: clamp(2.4rem, 7vw, 3.6rem); line-height: 1.05; margin: 0.2rem 0 1rem; letter-spacing: -0.02em; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; color: var(--muted); margin: 0; }
.lede { font-size: 1.2rem; max-width: 40rem; color: var(--muted); }
.hero-links { display: flex; gap: 0.6rem; margin-top: 1.5rem; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 3rem 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem 1.4rem; }
.card h2, .tools h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 0.4rem; }
.card p { margin: 0; color: var(--muted); }
.tool-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; }
.tool { display: flex; gap: 0.8rem; align-items: center; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-decoration: none; color: var(--fg); }
.tool:hover { border-color: var(--accent); }
.site-footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2rem 1rem 3rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; }

/* Auth */
.auth-card { max-width: 380px; margin: 4rem auto; padding: 1.75rem; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.auth-card h1 { font-family: var(--serif); font-size: 1.6rem; margin: 0 0 1rem; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.stack label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
.stack input { font: inherit; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }
.stack input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-error { color: #b42318; background: color-mix(in srgb, #b42318 10%, transparent); padding: 0.5rem 0.75rem; border-radius: 8px; margin: 0 0 1rem; }
