/* useEventStack — one stylesheet, no framework, mobile first.
 *
 * Design constraint from the brief: it has to work on a phone, because that is
 * where the person who gets paged at 02:00 is. Every list is a single column
 * until there is genuinely room for two.
 */

:root {
  color-scheme: light dark;
  --bg: #fbfaf8;
  --surface: #ffffff;
  --ink: #16150f;
  --muted: #6b675c;
  --line: #e2ded4;
  --accent: #1f4d3f;
  --ok: #1f6f43;
  --ok-bg: #e6f2ea;
  --bad: #9a2626;
  --bad-bg: #fbe9e9;
  --warn: #8a5a00;
  --warn-bg: #fdf1dd;
  --radius: 10px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --surface: #1d1d16;
    --ink: #f2efe6;
    --muted: #9a9484;
    --line: #33322a;
    --accent: #7fc4a4;
    --ok: #7fc4a4;
    --ok-bg: #1b2b22;
    --bad: #e88a8a;
    --bad-bg: #2e1c1c;
    --warn: #e0b060;
    --warn-bg: #2c2416;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.55 system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  -webkit-text-size-adjust: 100%;
}

main,
#auth,
#marketing {
  max-width: 62rem;
  margin: 0 auto;
}

h1 {
  font-size: 1.6rem;
  margin: 1.5rem 0 0.4rem;
}
h2 {
  font-size: 1.1rem;
  margin: 0 0 0.3rem;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.87rem;
}

/* --- marketing --------------------------------------------------------- */

.hero {
  padding: 3rem 0;
}
.lede {
  font-size: 1.15rem;
  max-width: 40rem;
}
.outcomes {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
  margin: 2rem 0;
}
@media (min-width: 40rem) {
  .outcomes {
    grid-template-columns: repeat(3, 1fr);
  }
}
.outcome {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.outcome h2 {
  font-family: var(--mono);
  font-size: 0.95rem;
}
.outcome.satisfied h2 {
  color: var(--ok);
}
.outcome.violated h2 {
  color: var(--warn);
}
.outcome.breached h2 {
  color: var(--bad);
}
.outcome p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.honest {
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- auth -------------------------------------------------------------- */

#auth form {
  max-width: 24rem;
  margin: 3rem auto;
  display: grid;
  gap: 1rem;
}
label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}
input,
textarea {
  font: inherit;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
textarea {
  font-family: var(--mono);
  font-size: 0.85rem;
}
input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button {
  font: inherit;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  button.primary {
    color: #14140f;
  }
}
.switch {
  font-size: 0.88rem;
}
.error {
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid currentColor;
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
  font-size: 0.88rem;
  white-space: pre-wrap;
}

/* --- app shell --------------------------------------------------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--line);
}
.topbar-actions {
  display: flex;
  gap: 0.5rem;
}
.tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.75rem 0;
  scrollbar-width: none;
}
.tabs button {
  white-space: nowrap;
  border: none;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
}
.tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.list {
  display: grid;
  gap: 0.6rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
.card.satisfied {
  border-left-color: var(--ok);
}
.card.open {
  border-left-color: var(--accent);
}
.card.violated {
  border-left-color: var(--warn);
}
.card.breached {
  border-left-color: var(--bad);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.status {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.status.satisfied {
  color: var(--ok);
  background: var(--ok-bg);
}
.status.open {
  color: var(--accent);
}
.status.violated {
  color: var(--warn);
  background: var(--warn-bg);
}
.status.breached {
  color: var(--bad);
  background: var(--bad-bg);
}
.key {
  font-family: var(--mono);
  font-weight: 600;
}
.meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}
.missing {
  color: var(--bad);
  font-family: var(--mono);
  font-size: 0.9rem;
}
.strategy-tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}
.empty {
  color: var(--muted);
  padding: 2rem 0;
  text-align: center;
}

/* --- dialogs ----------------------------------------------------------- */

dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 1.25rem;
  max-width: min(46rem, 94vw);
  width: 100%;
}
dialog::backdrop {
  background: rgb(0 0 0 / 45%);
}
dialog form {
  display: grid;
  gap: 1rem;
}
menu {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.strategies {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 0.4rem;
  display: grid;
  gap: 0.7rem;
}
.strategies legend {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0 0.4rem;
}
.strategy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.6rem;
  align-items: baseline;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}
.strategy:hover {
  border-color: var(--line);
}
.strategy input {
  grid-row: span 3;
  width: auto;
  margin-top: 0.25rem;
}
.strategy strong {
  font-family: var(--mono);
}
.strategy span,
.strategy em {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.86rem;
  font-style: normal;
}
.strategy em {
  font-size: 0.8rem;
  opacity: 0.8;
}
.strategy:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th,
td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
td.mono {
  font-family: var(--mono);
}
