/*
 * Pamore Health brand: the one owner of colour, type and base components.
 * Loaded by the web app (index.html) and by every page the server renders
 * itself (OAuth sign-in and consent), so they can never drift apart.
 * Dark-first: an athletic, near-black surface with an ember accent and a teal
 * second colour for "on track" states. Light mode redefines the same tokens.
 */
:root {
  --bg: #09090a;
  --bg-raise: #0f0f11;
  --surface: #151517;
  --surface-2: #1d1d20;
  --surface-3: #26262a;
  --line: #2a2a2f;
  --line-strong: #3a3a40;
  --text: #f4f4f5;
  --text-2: #c9c9ce;
  --muted: #8a8a93;
  --faint: #5c5c64;
  --accent: #ff5a1f;
  --accent-hover: #ff7340;
  --accent-ink: #ffffff;
  --accent-soft: rgb(255 90 31 / 0.14);
  --accent-2: #1fc8a9;
  --accent-2-soft: rgb(31 200 169 / 0.14);
  --danger: #ff6159;
  --danger-soft: rgb(255 97 89 / 0.12);
  --ok: #33d17a;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 12px 32px -12px rgb(0 0 0 / 0.7);
  --radius: 16px;
  --radius-sm: 10px;
  /* Third-party sign-in buttons follow their providers' published styles. */
  --provider-bg: #131314;
  --provider-line: #8e918f;
  --provider-text: #e3e3e3;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f2f4;
    --bg-raise: #ffffff;
    --surface: #ffffff;
    --surface-2: #f5f5f7;
    --surface-3: #ebebef;
    --line: #e3e3e8;
    --line-strong: #cfcfd6;
    --text: #121214;
    --text-2: #3a3a40;
    --muted: #6b6b75;
    --faint: #a0a0a8;
    --accent: #f04e0e;
    --accent-hover: #d94409;
    --accent-soft: rgb(240 78 14 / 0.1);
    --accent-2: #0d9e85;
    --accent-2-soft: rgb(13 158 133 / 0.1);
    --danger: #d92d20;
    --danger-soft: rgb(217 45 32 / 0.08);
    --ok: #12a150;
    --shadow: 0 1px 2px rgb(16 16 20 / 0.04), 0 8px 24px -12px rgb(16 16 20 / 0.12);
    --provider-bg: #ffffff;
    --provider-line: #747775;
    --provider-text: #1f1f1f;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.3rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
h4 { font-size: 0.95rem; font-weight: 650; margin-top: 8px; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
pre { margin: 0; background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; font-size: 0.82rem; color: var(--text-2); }
::selection { background: var(--accent); color: var(--accent-ink); }

/* type */
.eyebrow { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.display { font-size: 3.4rem; font-weight: 250; letter-spacing: -0.03em; line-height: 1; }
.big { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.84rem; }
.center { text-align: center; }
.error { color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.9rem; }
.ok { color: var(--ok); }
.accent { color: var(--accent); }

/* stat: a small label over a value, the basic unit of every summary */
.stats { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.stat { display: grid; gap: 1px; }
.stat > span { font-size: 0.74rem; color: var(--muted); }
.stat > strong { font-size: 1.2rem; font-weight: 550; letter-spacing: -0.01em; }

/* surfaces */
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, white 2%), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid; gap: 14px; align-content: start;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* forms */
label { display: grid; gap: 6px; font-size: 0.8rem; font-weight: 550; color: var(--muted); flex: 1; }
label.inline { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap; font-weight: 500; color: var(--text-2); font-size: 0.9rem; }
input, select, textarea {
  font: inherit; font-size: 0.95rem; color: var(--text); width: 100%;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; }
textarea { resize: vertical; }

/* buttons */
button, a.button {
  font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px;
  text-decoration: none; transition: background 0.15s, border-color 0.15s, transform 0.08s, color 0.15s;
}
button:hover, a.button:hover { background: var(--surface-3); border-color: var(--line-strong); text-decoration: none; }
button:active, a.button:active { transform: scale(0.98); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: default; transform: none; }
button.primary, a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, a.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--danger); background: transparent; }
button.danger:hover { background: var(--danger-soft); border-color: transparent; }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-2); }
button.link { border: none; background: none; color: var(--accent); padding: 4px; font-weight: 550; }
button.link:hover { background: none; text-decoration: underline; }
.block { display: flex; width: 100%; }
.lg { padding: 13px 22px; font-size: 0.98rem; }

/* sign in with a third party: one button style, the provider's own mark */
a.button.provider { background: var(--provider-bg); border-color: var(--provider-line); color: var(--provider-text); font-weight: 550; }
a.button.provider:hover { filter: brightness(0.96); }
a.button.provider img { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* brand mark + wordmark */
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.86rem; color: var(--text); }
.wordmark img { width: 30px; height: 30px; }
.wordmark b { color: var(--accent); font-weight: 800; }

/* lists */
.plain { list-style: none; padding: 0; margin: 0; display: grid; }
.plain > li { padding: 12px 0; border-top: 1px solid var(--line); }
.plain > li:first-child { border-top: none; }
.plain > li.row { display: flex; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.teal { background: var(--accent-2-soft); color: var(--accent-2); }

.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: center; }
.row.center { align-items: center; }

/* standalone server pages (OAuth sign-in and consent) */
.standalone { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.standalone > .card { width: min(420px, 100%); gap: 16px; padding: 28px; }
.standalone .wordmark { justify-self: center; margin-bottom: 4px; }
.standalone .scopes { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.standalone .scopes li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text-2); }
.standalone .scopes label { margin: 0; color: var(--text-2); font-size: 0.92rem; font-weight: 500; }
.standalone .row > button { flex: 1; }
.standalone form { display: grid; gap: 14px; }
.standalone h1 { font-size: 1.35rem; }
.standalone .card > p { color: var(--text-2); }
