:root {
  --bg: #f4f5f0;
  --surface: #ffffff;
  --text: #1d2420;
  --muted: #5d6a63;
  --line: #d9ddd4;
  --accent: #1f6f4a;
  --accent-text: #ffffff;
  --danger: #a12a2a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141815;
    --surface: #1d2320;
    --text: #e6ebe4;
    --muted: #9aa69f;
    --line: #313a35;
    --accent: #6fcf9b;
    --accent-text: #0e1611;
    --danger: #ff8f8f;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a {
  color: var(--accent);
}
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 16px 64px;
}
h1 {
  font-size: 1.6rem;
  margin: 16px 0 12px;
}
h2 {
  font-size: 1.1rem;
  margin: 28px 0 8px;
}
code {
  font: 0.85em ui-monospace, Menlo, Consolas, monospace;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.top nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1;
}
.top nav a {
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.top nav a[aria-current],
.pills a[aria-current] {
  background: var(--accent);
  color: var(--accent-text);
}
.top form {
  margin: 0;
}

button,
input {
  font: inherit;
}
button {
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button.link {
  padding: 4px 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
}
input[type="search"],
input[type="password"] {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
.search {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.bare main {
  max-width: 360px;
  padding-top: 15vh;
}
.login {
  display: grid;
  gap: 10px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.login h1 {
  margin: 0 0 4px;
}
.error {
  margin: 0;
  color: var(--danger);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.card {
  display: grid;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.card strong {
  font-size: 1.6rem;
}
.card span,
.sub,
.count,
.note,
.empty,
.crumbs {
  color: var(--muted);
}
.sub,
.note,
.crumbs {
  font-size: 0.9rem;
}
.count {
  font-size: 0.7em;
  font-weight: 400;
}
.crumbs {
  margin: 12px 0 0;
  overflow-wrap: anywhere;
}
.badge {
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  vertical-align: middle;
}

.list,
.events,
.tasks {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.list li,
.events li,
.tasks li {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
}
.list li:first-child,
.events li:first-child,
.tasks li:first-child {
  border-top: 0;
}
.letter {
  color: var(--muted);
}
.event {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 4px 16px;
}
.when span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}
.task {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
}
.check {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1px solid var(--muted);
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 18px;
  text-align: center;
}
.task.done > div {
  color: var(--muted);
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pills a {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  text-decoration: none;
}
.pills span {
  opacity: 0.7;
  font-size: 0.8em;
}

.fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 12px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.fields dt {
  color: var(--muted);
}
.fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.pre,
.text {
  white-space: pre-wrap;
}
.text {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  overflow-wrap: anywhere;
}
.events .text,
.tasks .text {
  padding: 8px 10px;
  background: var(--bg);
  font-size: 0.9rem;
}

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
th,
td {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
td:first-child {
  width: 100%;
  min-width: 9rem;
  overflow-wrap: break-word;
}
td:not(:first-child) {
  white-space: nowrap;
}
.num,
.actions {
  text-align: right;
  white-space: nowrap;
}
.records td:first-child {
  width: auto;
}
.records code {
  white-space: pre;
}

.more {
  margin: 14px 0 0;
}
.more summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}
.version {
  margin: 12px 0 0;
  padding: 0 0 0 14px;
  border-left: 3px solid var(--line);
}
.version h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.paths {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--line);
}

@media (max-width: 560px) {
  .event {
    grid-template-columns: 1fr;
  }
  /* Brand and sign-out share the first row; the links get their own. */
  .top {
    justify-content: space-between;
  }
  .top nav {
    order: 3;
    flex-basis: 100%;
  }
  .top nav a {
    padding: 4px 8px;
  }
}
