@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/source-sans-3-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f6f1ea;
  --panel: #fffdf9;
  --ink: #2c2620;
  --muted: #5c5148;
  --line: #e4d9cc;
  --hover: #f0e8dc;
  --select: #e7efe4;
  --sage: #4f6b4a;
  --walnut: #6a4a36;
  --overdue: #8a3d32;
  --focus: #4f6b4a;
  --type: "Source Sans 3", ui-sans-serif, system-ui, sans-serif;
  --radius: 0.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--type);
  font-size: 0.9375rem;
  line-height: 1.45;
  background: var(--paper);
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mast {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.synth {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.mast-actions {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

.drawer-btn {
  display: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
}

.icon-btn svg {
  width: 1.05rem;
  height: 0.85rem;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  background: var(--hover);
  color: var(--ink);
}

.ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius);
}

.ghost:hover {
  background: var(--hover);
  color: var(--ink);
}

.board {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(15rem, 17.5rem) minmax(0, 1fr) minmax(18rem, 22rem);
  min-height: 0;
}

.pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}

.rail {
  background: transparent;
  border-right: 1px solid var(--line);
}

.detail-pane {
  border-left: 1px solid var(--line);
}

.pane-head,
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 1.1rem 1.15rem 0.45rem;
}

.pane-head h1,
.pane-head h2,
.file-head h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.rail-scroll h2 {
  margin: 1.35rem 0 0.35rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.pane-close {
  display: none;
}

.rail-scroll,
.list-scroll,
.file-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.25rem 1.15rem 1.25rem;
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin: 0.1rem 0;
  padding: 0.4rem 0.5rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
}

.rail-item:hover {
  background: var(--hover);
}

.rail-item.is-on {
  background: var(--select);
  color: var(--sage);
  font-weight: 600;
}

.tab-mark {
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 auto;
  border-radius: 50%;
}

.tab-mark.all {
  box-shadow: inset 0 0 0 1.5px var(--muted);
  background: transparent;
}

.initials {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--hover);
  font-size: 0.8125rem;
  font-weight: 600;
}

.who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.who-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.who-role {
  font-size: 0.8125rem;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 1.15rem 0.45rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8125rem;
}

.chip:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.chip.is-on {
  border-color: var(--sage);
  background: var(--select);
  color: var(--sage);
  font-weight: 600;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task {
  display: grid;
  grid-template-columns: 1.35rem 1.2rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: start;
  padding: 0.7rem 0.5rem;
  border-radius: var(--radius);
}

.task:hover {
  background: var(--hover);
}

.task.is-selected {
  background: var(--select);
}

.task.is-done .task-title {
  text-decoration: line-through;
  color: var(--muted);
}

.task.is-dragging {
  opacity: 0.5;
}

.task.is-drop {
  box-shadow: inset 0 2px 0 var(--sage);
}

.grip {
  width: 1.35rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.grip:active {
  cursor: grabbing;
}

.grip svg {
  width: 0.7rem;
  height: 0.95rem;
  fill: currentColor;
}

.check {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.15rem;
}

.check input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.check span:not(.sr-only) {
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--line);
  border-radius: 0.25rem;
  background: var(--panel);
}

.check input:checked + span:not(.sr-only) {
  border-color: var(--sage);
  background: var(--sage);
}

.check input:checked + span:not(.sr-only)::after {
  content: "";
  display: block;
  width: 0.28rem;
  height: 0.5rem;
  margin: 0.05rem auto 0;
  border-right: 1.5px solid var(--panel);
  border-bottom: 1.5px solid var(--panel);
  transform: rotate(40deg);
}

.task-main {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.task-title {
  font-weight: 600;
  font-size: 1rem;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.proj {
  padding-left: 0.75rem;
  background: radial-gradient(circle at 0.2rem 0.55rem, var(--tab) 0.18rem, transparent 0.2rem);
}

.due-overdue {
  color: var(--overdue);
  font-weight: 600;
}

.empty {
  margin: 1.5rem 0.2rem;
  color: var(--muted);
}

.empty[hidden],
.task-list[hidden] {
  display: none;
}

.composer {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0.85rem 1.15rem 0.65rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.composer-row {
  display: flex;
  gap: 0.45rem;
}

.composer-preview {
  margin: 0.45rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.composer-preview[hidden],
.composer-ac[hidden] {
  display: none;
}

.composer-ac {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0.25rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  max-height: 12rem;
  overflow: auto;
}

.composer-ac button {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.4rem 0.65rem;
  border: 0;
  background: transparent;
  text-align: left;
}

.composer-ac button:hover,
.composer-ac button.is-on {
  background: var(--select);
}

.ac-hint {
  color: var(--muted);
  font-size: 0.8125rem;
}

#new-title,
textarea,
select,
input[type="date"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
}

#new-title {
  flex: 1;
}

#new-title:focus,
textarea:focus,
select:focus,
input[type="date"]:focus {
  border-color: var(--sage);
  outline: none;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 0.85rem) 1rem, calc(100% - 0.55rem) 1rem;
  background-size: 0.28rem 0.28rem, 0.28rem 0.28rem;
  background-repeat: no-repeat;
  padding-right: 1.6rem;
}

.file-head {
  padding: 0.35rem 0 0.2rem;
}

.file-head h2 {
  font-size: 1.25rem;
}

.fields {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0 0;
}

.fields div {
  display: grid;
  gap: 0.25rem;
}

.fields dt {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.fields dd {
  margin: 0;
}

.rule-label {
  margin: 1.2rem 0 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.assign-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.assign {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8125rem;
}

.assign.is-on {
  border-color: var(--sage);
  background: var(--select);
  color: var(--sage);
}

.notes,
.clips {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note,
.clip {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.note p {
  margin: 0.2rem 0 0;
}

.note-head,
.size,
.mute {
  font-size: 0.8125rem;
  color: var(--muted);
}

.clip {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.clip svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}

.comment-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.attach-btn,
.comment-form .chip {
  justify-self: start;
}

.attach-btn {
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius);
  color: var(--muted);
}

.attach-btn:hover {
  color: var(--ink);
  background: var(--hover);
}

.empty-file {
  margin-top: 1.25rem;
  color: var(--muted);
}

.account-pane {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(22rem, 92vw);
  z-index: 9;
  background: var(--panel);
  transform: translateX(105%);
  transition: transform 180ms var(--ease);
  box-shadow: -4px 0 24px rgba(44, 38, 32, 0.08);
}

.account-pane.is-open {
  transform: none;
}

.account-card {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.2rem;
}

.account-nav {
  display: grid;
  gap: 0.25rem;
}

.account-nav button,
.settings-form label {
  width: 100%;
  text-align: left;
}

.settings-form {
  display: grid;
  gap: 0.65rem;
}

.settings-form .rule-label {
  margin-top: 0;
}

.signed-out {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
  background: var(--paper);
  color: var(--ink);
}

.signed-out[hidden] {
  display: none;
}

.signed-out .wordmark {
  font-size: 1.25rem;
}

.signed-out p {
  margin: 0;
  color: var(--muted);
  max-width: 22rem;
}

body.drawer-account::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(44, 38, 32, 0.28);
  z-index: 8;
}

@media (max-width: 1040px) {
  .drawer-btn,
  .pane-close {
    display: inline-flex;
  }

  .board {
    grid-template-columns: 1fr;
  }

  .rail,
  .detail-pane {
    position: fixed;
    top: 0;
    bottom: 0;
    width: min(22rem, 92vw);
    z-index: 8;
    background: var(--panel);
    transform: translateX(-105%);
    transition: transform 180ms var(--ease);
    box-shadow: 4px 0 24px rgba(44, 38, 32, 0.08);
  }

  .detail-pane {
    right: 0;
    left: auto;
    transform: translateX(105%);
    box-shadow: -4px 0 24px rgba(44, 38, 32, 0.08);
  }

  .rail.is-open,
  .detail-pane.is-open {
    transform: none;
  }

  body.drawer-rail::after,
  body.drawer-file::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(44, 38, 32, 0.28);
    z-index: 7;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rail,
  .detail-pane,
  .account-pane {
    transition: none;
  }
}
