@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/figtree-latin-wght.woff2") format("woff2");
}

:root {
  --bg: #f5f7f5;
  --surface: #ffffff;
  --surface-2: #e8ece9;
  --fg: #1d2622;
  --muted: #66716c;
  --line: #e1e6e2;
  --accent: #3a6b5b;
  --accent-hover: #2f5a4c;
  --on-accent: #ffffff;
  --accent-soft: #e0ebe6;
  --accent-ink: #2b5446;
  --warn-soft: #f6efe2;
  --warn-ink: #7a5a22;
  --danger: #b3264f;
  --danger-soft: #fbe8ee;
  --pink: #e0457b;
  --shadow: rgba(29,38,34,.14);
  --logo-window: #8fbca5;
  --logo-door: #8fbca5;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121715;
    --surface: #1b2220;
    --surface-2: #232c29;
    --fg: #e4ebe8;
    --muted: #93a19b;
    --line: #26302c;
    --accent: #7fb8a3;
    --accent-hover: #97c9b6;
    --on-accent: #0f1a16;
    --accent-soft: #22352e;
    --accent-ink: #9fd0bd;
    --warn-soft: #33291a;
    --warn-ink: #e3c48d;
    --danger: #f28aa8;
    --danger-soft: #3a1e27;
    --pink: #f07aa2;
    --shadow: rgba(0,0,0,.5);
    --logo-window: #e4ebe8;
    --logo-door: #7fb8a3;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); }

h1 {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 1rem 0;
  text-wrap: balance;
}

small { font-size: 0.8125rem; }
.hint, .muted { font-size: 0.9375rem; color: var(--muted); }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

.icon { width: 1.5rem; height: 1.5rem; flex: none; }

/* Top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  color: var(--fg);
  text-decoration: none;
}
.brand-icon { width: 36px; height: 36px; flex: none; color: var(--accent-ink); }
.logo-window { fill: var(--logo-window); }
.logo-door { fill: var(--logo-door); }
.brand-text { display: flex; flex-direction: column; gap: 0.125rem; }
.brand-top { font-size: 0.875rem; font-weight: 500; line-height: 1.1; }
.brand-name { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.brand-tld { font-weight: 500; color: var(--accent); }
.nav { grid-area: nav; display: flex; gap: 0.25rem; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 999px;
  color: var(--fg);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}
.nav a.current { background: var(--accent-soft); color: var(--accent-ink); }
.logout { grid-area: logout; margin: 0; }
@media (max-width: 599px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand logout"
      "nav nav";
    align-items: center;
  }
}

/* Layout helpers */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.card-surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: 0.5rem 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s;
}
.button:hover { background: var(--accent-hover); }
.button.quiet {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  background: none;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 400;
  text-decoration: underline;
}
.button.quiet:hover { background: none; color: var(--fg); }

/* Segmented control */
.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 999px;
}
.segmented a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}
.segmented a.current {
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 1px 3px var(--shadow);
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 0.25rem; }
.field label { font-weight: 600; }
.field .hint { margin: 0; }
.field-error { margin: 0; font-size: 0.9375rem; color: var(--danger); }
input[type="text"], input[type="password"], input[type="number"] {
  font: inherit;
  color: var(--fg);
  padding: 0.75rem;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.has-error input, input.has-error { border-color: var(--danger); }

/* Notices and chips */
.notice {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
}
.notice.success { background: var(--accent-soft); color: var(--accent-ink); }
.notice.error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.chip {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.8125rem;
  font-weight: 600;
}
.chip.new { background: var(--surface); border: 1px solid var(--line); color: var(--fg); }

/* Login */
.login-card {
  max-width: 400px;
  margin: 2rem auto;
  padding: 1.25rem;
}
.login-card h1 { margin-top: 0; }
.login-card .button { width: 100%; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
