/* One stylesheet. Light, dark and system, phone first. */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --line: #e2e1dd;
  --ink: #1b1b19;
  --ink-soft: #5f5e59;
  --ink-faint: #8b8a84;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --danger: #a32b28;
  --warn: #8a5a12;

  --s-grey: #8b8a84;
  --s-blue: #2f5d8a;
  --s-amber: #a9741a;
  --s-green: #2c6e49;
  --s-purple: #6a4a8c;
  --s-darkgrey: #4a4a46;
  --s-red: #a32b28;

  --radius: 10px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17181a;
    --surface: #1f2023;
    --surface-2: #26282c;
    --line: #34363b;
    --ink: #e9e9e7;
    --ink-soft: #a9a9a4;
    --ink-faint: #7d7d78;
    --accent: #7aa8d6;
    --accent-ink: #12181f;
    --danger: #e08b88;
    --warn: #d6ab63;

    --s-grey: #8b8a84;
    --s-blue: #7aa8d6;
    --s-amber: #d6ab63;
    --s-green: #6bbf92;
    --s-purple: #b094d6;
    --s-darkgrey: #9a9a95;
    --s-red: #e08b88;
  }
}

:root[data-theme="dark"] {
  --bg: #17181a; --surface: #1f2023; --surface-2: #26282c; --line: #34363b;
  --ink: #e9e9e7; --ink-soft: #a9a9a4; --ink-faint: #7d7d78;
  --accent: #7aa8d6; --accent-ink: #12181f; --danger: #e08b88; --warn: #d6ab63;
  --s-grey: #8b8a84; --s-blue: #7aa8d6; --s-amber: #d6ab63; --s-green: #6bbf92;
  --s-purple: #b094d6; --s-darkgrey: #9a9a95; --s-red: #e08b88;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app { max-width: 720px; margin: 0 auto; padding: var(--gutter); padding-bottom: 64px; }
.loading { color: var(--ink-faint); padding: 40px 0; text-align: center; }

h1 { font-size: 1.35rem; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 24px 0 8px; }
h3 { font-size: 0.8rem; margin: 20px 0 6px; text-transform: uppercase;
     letter-spacing: 0.07em; color: var(--ink-faint); font-weight: 600; }
p { margin: 0 0 12px; }
a { color: var(--accent); }

.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); font-size: 0.86rem; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- controls ---------- */

button, .btn {
  font: inherit; font-size: 0.94rem;
  padding: 9px 14px; min-height: 42px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  cursor: pointer;
}
button:hover { background: var(--surface-2); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.quiet { border-color: transparent; background: transparent; color: var(--ink-soft); }
button.quiet:hover { background: var(--surface-2); }
button.small { min-height: 34px; padding: 5px 10px; font-size: 0.86rem; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
  font: inherit; width: 100%;
  padding: 10px 12px; min-height: 42px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 4px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }

/* ---------- cards and lists ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.tools { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .tools { grid-template-columns: 1fr 1fr; } }
.tool {
  display: block; text-align: left; width: 100%; padding: 18px;
  border-radius: var(--radius); min-height: 92px;
}
.tool strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.tool.soon { opacity: 0.55; cursor: default; }
.tool.soon:hover { background: var(--surface); }

.list { list-style: none; margin: 12px 0 0; padding: 0;
        border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
        background: var(--surface); }
.list li + li { border-top: 1px solid var(--line); }
.item { display: flex; gap: 10px; align-items: center; width: 100%;
        padding: 12px 14px; border: 0; border-radius: 0; background: transparent;
        text-align: left; min-height: 56px; }
.item:hover { background: var(--surface-2); }
.item .name { font-weight: 500; }
.item .org { color: var(--ink-soft); font-size: 0.86rem; }

.pill { display: inline-flex; align-items: center; gap: 5px;
        font-size: 0.78rem; padding: 3px 9px; border-radius: 999px;
        border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft); }
.pill.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* a value you can tap to copy reads as tappable */
.copy { text-decoration: underline dotted; text-underline-offset: 3px; }

.avatar { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 999px;
          background: var(--surface-2); border: 1px solid var(--line);
          display: grid; place-items: center; font-size: 0.7rem; font-weight: 600;
          color: var(--ink-soft); }

/* status marks: a shape as well as a colour */
.mark { flex: 0 0 auto; width: 20px; height: 20px; display: grid; place-items: center; }
.mark svg { width: 17px; height: 17px; }
.s-grey { color: var(--s-grey); } .s-blue { color: var(--s-blue); }
.s-amber { color: var(--s-amber); } .s-green { color: var(--s-green); }
.s-purple { color: var(--s-purple); } .s-darkgrey { color: var(--s-darkgrey); }
.s-red { color: var(--s-red); }

.banner { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px;
          border: 1px solid; font-size: 0.9rem; }
.banner.red { color: var(--danger); border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.banner.warn { color: var(--warn); border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.banner.note { color: var(--ink-soft); border-color: var(--line); background: var(--surface-2); }

.note-block { border: 1px solid var(--line); border-radius: var(--radius);
              padding: 10px 12px; background: var(--surface); }
.note-block .body { white-space: pre-wrap; overflow-wrap: anywhere; }

.history { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.88rem; }
.history li { padding: 7px 0; border-top: 1px solid var(--line); color: var(--ink-soft); }

.topbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }

dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0;
  background: var(--surface); color: var(--ink);
  width: min(520px, calc(100vw - 32px)); max-height: 86vh;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-body { padding: 18px; overflow-y: auto; max-height: calc(86vh - 70px); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end;
                  padding: 12px 18px; border-top: 1px solid var(--line); }

.choice { display: flex; gap: 10px; align-items: center; width: 100%;
          padding: 11px 12px; margin-bottom: 6px; text-align: left; }
.choice.on { border-color: var(--accent); background: var(--surface-2); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
         background: var(--ink); color: var(--bg); padding: 10px 16px;
         border-radius: 999px; font-size: 0.9rem; z-index: 50; max-width: 90vw; }

.empty { text-align: center; color: var(--ink-faint); padding: 36px 12px; }
