:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #37352f;
  --muted: #787774;
  --line: #e9e9e7;
  --card: #ffffff;
  --card-hover: #f7f7f5;
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.08);
  --primary: #2383e2;
  --primary-text: #ffffff;
  --danger: #d44c47;
  --field: #ffffff;

  --gray-bg: #f6f5f4;   --gray-pill: #e3e2e0;   --gray-text: #504f4c;
  --purple-bg: #f9f6fb; --purple-pill: #e8deee; --purple-text: #6940a5;
  --pink-bg: #fcf5f8;   --pink-pill: #f5e0e9;   --pink-text: #ad1a72;
  --orange-bg: #fcf7f3; --orange-pill: #fadec9; --orange-text: #a3551b;
  --yellow-bg: #fcfaf3; --yellow-pill: #fbeeb8; --yellow-text: #8a6a10;
  --green-bg: #f5f9f6;  --green-pill: #dbeddb;  --green-text: #2b7a4b;
  --blue-bg: #f4f8fb;   --blue-pill: #d3e5ef;   --blue-text: #1f6aa5;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #191919;
    --text: #e6e6e4;
    --muted: #9b9a97;
    --line: #2f2f2f;
    --card: #252525;
    --card-hover: #2c2c2c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --field: #202020;

    --gray-bg: #202020;   --gray-pill: #373737;   --gray-text: #c4c3c0;
    --purple-bg: #211d26; --purple-pill: #3c2d49; --purple-text: #c9a8ef;
    --pink-bg: #261c21;   --pink-pill: #4e2c3c;   --pink-text: #f0a3c8;
    --orange-bg: #261f1a; --orange-pill: #5c3b23; --orange-text: #f1b183;
    --yellow-bg: #25221a; --yellow-pill: #564328; --yellow-text: #eccb7a;
    --green-bg: #1a231e;  --green-pill: #2b4632;  --green-text: #8fd3a5;
    --blue-bg: #1a2128;   --blue-pill: #28456c;   --blue-text: #8cc0f0;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 6px;
  padding: 5px 10px;
}
button:hover { background: var(--card-hover); }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
button.primary:hover { filter: brightness(1.08); }
button.quiet, a.quiet { border-color: transparent; background: none; color: var(--muted); text-decoration: none; }
button.quiet:hover, a.quiet:hover { background: var(--card-hover); color: var(--text); }
button.danger { color: var(--danger); }
a.quiet { padding: 5px 10px; border-radius: 6px; }

.error { color: var(--danger); }
.empty { color: var(--muted); }

/* Header */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 20px 32px 8px;
}
.top h1 { font-size: 28px; margin: 0 16px 0 0; }
.views { display: flex; gap: 4px; flex-wrap: wrap; }
.view { border-color: transparent; background: none; color: var(--muted); }
.view.active { background: var(--gray-pill); color: var(--text); }
#filter {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: 6px;
  padding: 5px 10px;
  width: 180px;
}

/* Boards */

main { padding: 0 32px 48px; }
.board h2 { font-size: 20px; margin: 24px 0 10px; }
.columns {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: flex-start;
}
.column {
  flex: 0 0 260px;
  border-radius: 10px;
  padding: 8px;
  background: var(--col-bg);
}
.column-head { display: flex; align-items: center; gap: 8px; margin: 2px 4px 8px; font-size: 13px; font-weight: 500; }
.count { color: var(--col-text); opacity: 0.8; font-weight: 400; }
.column-body { min-height: 8px; display: flex; flex-direction: column; gap: 6px; }

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}

.card {
  background: var(--card);
  border-radius: 6px;
  box-shadow: var(--shadow), 0 0 0 1px var(--line);
  padding: 8px 10px;
  cursor: pointer;
}
.card:hover { background: var(--card-hover); }
.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.card.dragging { opacity: 0.4; }
.card-title { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.card-meta {
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.has-notes { font-size: 13px; }
.drop-marker { height: 3px; border-radius: 2px; background: var(--primary); }

.add, .more {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 6px;
  border: none;
  background: none;
  color: var(--col-text);
  opacity: 0.85;
}
.add:hover, .more:hover { background: var(--col-pill); opacity: 1; }

.pill-gray, .color-gray { --col-bg: var(--gray-bg); --col-pill: var(--gray-pill); --col-text: var(--gray-text); }
.pill-purple, .color-purple { --col-bg: var(--purple-bg); --col-pill: var(--purple-pill); --col-text: var(--purple-text); }
.pill-pink, .color-pink { --col-bg: var(--pink-bg); --col-pill: var(--pink-pill); --col-text: var(--pink-text); }
.pill-orange, .color-orange { --col-bg: var(--orange-bg); --col-pill: var(--orange-pill); --col-text: var(--orange-text); }
.pill-yellow, .color-yellow { --col-bg: var(--yellow-bg); --col-pill: var(--yellow-pill); --col-text: var(--yellow-text); }
.pill-green, .color-green { --col-bg: var(--green-bg); --col-pill: var(--green-pill); --col-text: var(--green-text); }
.pill-blue, .color-blue { --col-bg: var(--blue-bg); --col-pill: var(--blue-pill); --col-text: var(--blue-text); }
.pill { background: var(--col-pill); color: var(--col-text); }

/* Dialogs */

dialog {
  border: none;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  width: min(640px, calc(100vw - 32px));
  padding: 24px;
}
dialog::backdrop { background: rgba(15, 15, 15, 0.45); }
dialog h2 { margin: 0 0 12px; font-size: 20px; }

.title-input {
  width: 100%;
  border: none;
  background: none;
  font-size: 22px;
  font-weight: 700;
  padding: 0 0 12px;
  outline: none;
}
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
}
.fields label, .notes-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fields label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--text); padding-top: 18px; }
.fields select, .fields input[type="date"], textarea {
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
  color: var(--text);
}
textarea { width: 100%; resize: vertical; line-height: 1.5; }
.meta { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; }
.spacer { flex: 1; }

.archived-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.archived-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  border-radius: 8px;
  padding: 8px 14px;
  margin: 0;
  max-width: calc(100vw - 32px);
}

/* Sign in */

body.sign-in { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.sign-in-form { display: flex; flex-direction: column; gap: 8px; width: min(320px, 100%); }
.sign-in-form h1 { margin: 0 0 12px; font-size: 28px; }
.sign-in-form label { font-size: 12px; color: var(--muted); }
.sign-in-form input {
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: 6px;
  padding: 8px 10px;
}
.sign-in-form .error { margin: 0; }
.sign-in-form button { margin-top: 8px; padding: 8px; }

@media (max-width: 700px) {
  .top { padding: 16px 16px 4px; }
  .top h1 { font-size: 22px; width: 100%; }
  #filter { margin-left: 0; flex: 1; width: auto; min-width: 120px; }
  main { padding: 0 16px 32px; }
  .column { flex-basis: 240px; }
  dialog { padding: 16px; }
}
