:root {
  --fg: #1d2330;
  --muted: #5b6475;
  --bg: #ffffff;
  --line: #d9dde5;
  --accent: #2456c9;
  --ok: #1d7a46;
  --bad: #b3261e;
  --warn: #8a5a00;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e9ef;
    --muted: #a3abba;
    --bg: #14171d;
    --line: #2e3440;
    --accent: #8fb0ff;
    --ok: #6fd39b;
    --bad: #ff8a80;
    --warn: #f0c060;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 44rem;
  padding: 1.5rem 1rem 3rem;
  font: 16px/1.5 system-ui, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
}

h1 { margin: 0 0 0.5rem; font-size: 1.6rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.5rem; }
.who { margin: 0 0 0.5rem; color: var(--muted); }

button {
  font: inherit;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
button:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

#status { min-height: 1.5rem; margin: 1rem 0; }
#status[data-outcome="ok"] { color: var(--ok); }
#status[data-outcome="refused"],
#status[data-outcome="invalid"],
#status[data-outcome="error"] { color: var(--bad); }
#status[data-outcome="conflict"],
#status[data-outcome="missing"],
#status[data-outcome="signed-out"] { color: var(--warn); }

.toolbar { display: flex; align-items: center; gap: 0.75rem; }

#notes { list-style: none; padding: 0; margin: 0; }
#notes li {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
#notes label { flex: 1; font-weight: 600; }
/* Below the editor and its button: someone else changed what this user is editing. */
#notes .conflict { order: 1; flex-basis: 100%; margin: 0; color: var(--warn); }
#notes .conflict[hidden] { display: none; }

.live { color: var(--muted); font-size: 0.9rem; }
.live[data-state="live"] { color: var(--ok); }
.live[data-state="retrying"],
.live[data-state="exhausted"],
.live[data-state="terminal"] { color: var(--warn); }

label { display: block; margin-bottom: 0.5rem; }
textarea, input {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.4rem;
  font: inherit;
  font-weight: normal;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
}

footer { margin-top: 3rem; color: var(--muted); font-size: 0.9rem; }
a { color: var(--accent); }
