@font-face {
  font-family: Fraunces;
  src: url("/fonts/Fraunces.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/InstrumentSans.ttf") format("truetype");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --canvas: #fff;
  /* Light text and controls on colored fields. */
  --white: #fff;
  --ink: #191923;
  --muted: #575766;
  --blue: #3439d8;
  --blue-soft: #4b4fdf;
  /* Cobalt used as text, rules and focus on the canvas. */
  --accent: #3439d8;
  --yellow: #f3cf35;
  --green: #d3f26b;
  --on-green: #191923;
  --red: #d83c27;
  --rule: #e1e1e8;
  --line: #9a9aa6;
  --field: #f5f5f8;
  --quiet: #ededf2;
  --serif: Fraunces, Georgia, serif;
  --sans: "Instrument Sans", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #1d1d25;
    --white: #eeede7;
    --ink: #e4e2da;
    --muted: #a2a1ae;
    --blue: #4a4fc9;
    --blue-soft: #5459cc;
    --accent: #9195ee;
    --yellow: #d8bc45;
    --green: #b8cf66;
    --red: #e0654c;
    --rule: #33333e;
    --line: #5e5e6c;
    --field: #25252e;
    --quiet: #2f2f3a;
  }
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
  border-radius: 0;
}
button,
a,
input,
textarea {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
a {
  color: inherit;
  text-underline-offset: 5px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
h1,
h2,
p,
ol,
ul,
dl,
dd {
  margin: 0;
}
ol,
ul {
  padding: 0;
  list-style: none;
}
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header and navigation: plain text; underline marks the current place */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  max-width: 1180px;
  margin: auto;
}
.brand {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 22px;
  letter-spacing: -1px;
  font-weight: 600;
}
.brand-mark {
  width: 12px;
  height: 19px;
  background: var(--red);
}
.app-nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

/* Account: rarely used, so a small control that needs two taps to sign out */
.account {
  position: relative;
}
.account-toggle {
  list-style: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}
.account-toggle::-webkit-details-marker {
  display: none;
}
.account[open] .account-toggle {
  border-color: var(--ink);
  color: var(--ink);
}
.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  display: grid;
  gap: 10px;
  min-width: 190px;
  padding: 14px;
  background: var(--canvas);
  border: 1px solid var(--rule);
  color: var(--muted);
  font-size: 13px;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}
.nav-link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}
.back {
  margin: -6px 0 6px;
}

/* Actions: rectangular filled controls with one geometry */
.action {
  border: 0;
  padding: 11px 16px;
  min-height: 44px;
  background: var(--blue);
  color: var(--white);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
}
.action:hover:not(:disabled) {
  filter: brightness(0.93);
}
.action:active:not(:disabled) {
  transform: translateY(1px);
}
.action.secondary {
  background: var(--quiet);
  color: var(--ink);
}
.action.done {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.action.done:hover:not(:disabled) {
  filter: none;
  background: var(--accent);
  color: var(--canvas);
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Layout */
.main {
  max-width: 1180px;
  margin: auto;
  padding: 0 20px;
  min-height: calc(100svh - 72px);
  display: flex;
  flex-direction: column;
}
.col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.main.single .col {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.main.split .side {
  display: none;
}

/* Lists */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
}
.list-head h1,
.list-head h2 {
  font: 400 30px/1.1 var(--serif);
  letter-spacing: -0.015em;
}
.list-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.toolbar {
  margin: 20px 0 8px;
}
.search {
  display: block;
  margin: 16px 0 4px;
}
.search span,
.field span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.search input,
.field input,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.search input:focus,
.field input:focus,
.field textarea:focus {
  border-bottom-color: var(--accent);
  outline: none;
}
.rows {
  margin-top: 12px;
}
.row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  gap: 12px;
  padding: 20px 0 21px;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  align-items: start;
}
.row-item {
  position: relative;
}
.row-item .row {
  grid-template-columns: 30px minmax(0, 1fr) 28px;
}
.row-done {
  position: absolute;
  top: 10px;
  right: -8px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--accent);
}
.row-done .check {
  box-sizing: content-box;
  padding: 4px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  opacity: 0.75;
}
.row-done:hover .check,
.row-done:focus-visible .check {
  opacity: 1;
  background: var(--accent);
  color: var(--canvas);
}
.rows li:last-child .row {
  border-bottom: 1px solid var(--rule);
}
.rank {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding-top: 5px;
  font-variant-numeric: tabular-nums;
}
.row-title {
  display: block;
  font: 400 20px/1.2 var(--serif);
  overflow-wrap: anywhere;
}
.row-meta {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}
.row-meta b {
  font-weight: 500;
  color: var(--ink);
}
.row-meta .pinned {
  color: var(--accent);
  font-weight: 500;
}
.row-arrow {
  color: var(--accent);
  padding-top: 2px;
}
.row:hover .row-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.row[aria-current="page"] {
  box-shadow: inset 3px 0 var(--accent);
  padding-left: 12px;
}
.empty {
  padding: 24px 0;
  color: var(--muted);
}

/* Item and conversation pages */
.pane-top {
  padding-top: 12px;
}
.position {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.pane h1 {
  font: 400 27px/1.15 var(--serif);
  letter-spacing: -0.015em;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
/* What Polaris knows */
.field textarea {
  resize: vertical;
  font: inherit;
}
.known {
  display: grid;
  gap: 6px;
  padding: 18px 0 16px;
  border-top: 1px solid var(--rule);
}
.known-list li:last-child {
  border-bottom: 1px solid var(--rule);
}
.known-text {
  font: 400 21px/1.3 var(--serif);
  overflow-wrap: anywhere;
}
.known .button-row {
  margin-top: 4px;
}
.known-add {
  display: grid;
  gap: 10px;
  margin: 28px 0 12px;
}
/* Journal */
.journal-day {
  padding: 18px 0 20px;
  border-top: 1px solid var(--rule);
}
.journal-text {
  font: 400 19px/1.45 var(--serif);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.journal-text + .journal-text {
  margin-top: 12px;
}
.journal-day .thread {
  margin-top: 16px;
}
.facts {
  display: grid;
  gap: 14px;
  margin: 22px 0 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
.facts dt {
  font-size: 12px;
  color: var(--muted);
}
.facts dd {
  margin-top: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.facts dd ul {
  display: grid;
  gap: 4px;
}
.section-label {
  font: 500 12px/1.4 var(--sans);
  color: var(--muted);
  margin-bottom: 6px;
}
.order-box {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
.order-box p {
  font-size: 14px;
  margin-bottom: 14px;
}
.item-foot {
  margin: 28px 0 24px;
}

/* Exchange: messages, replies and structured objects */
.thread {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}
.thread:empty {
  display: none;
}
.you {
  margin-left: 28px;
  padding-left: 14px;
  border-left: 2px solid var(--rule);
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.polaris {
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.polaris .button-row {
  margin-top: 10px;
  white-space: normal;
}
.pending {
  color: var(--muted);
}
.pending::after {
  content: "…";
}
.error {
  color: var(--red);
}
.object {
  background: var(--blue);
  color: var(--white);
  padding: 22px 20px;
}
.object .eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.object h2 {
  font: 400 24px/1.2 var(--serif);
  overflow-wrap: anywhere;
}
.object .support {
  font-size: 14px;
  margin-top: 10px;
}
.object .button-row {
  margin-top: 20px;
}
.object .action {
  background: var(--white);
  color: var(--blue);
}
.object .action.secondary {
  background: var(--blue-soft);
  color: var(--white);
}
.object.success {
  /* Green keeps dark text in both schemes. */
  --ink: var(--on-green);
  --canvas: var(--white);
  background: var(--green);
  color: var(--ink);
}
.object.paper {
  background: var(--field);
  color: var(--ink);
  border-top: 3px solid var(--accent);
}
.object.success .action,
.object.paper .action {
  background: var(--ink);
  color: var(--canvas);
}
.object.success .action.secondary,
.object.paper .action.secondary {
  background: var(--canvas);
  color: var(--ink);
}
.object.settled {
  background: var(--field);
  color: var(--muted);
  border-top: 0;
}
.object .field {
  display: block;
  margin-top: 14px;
}
.reveal {
  animation: appear 0.18s ease-out;
}
@keyframes appear {
  from {
    opacity: 0.3;
    transform: translateY(4px);
  }
}

/* Shared input, docked to the bottom of the current column */
.dock {
  position: sticky;
  bottom: 0;
  margin: auto -20px 0;
  padding: 10px 20px max(12px, env(safe-area-inset-bottom));
  background: var(--canvas);
  border-top: 1px solid var(--rule);
  z-index: 2;
}
.dock.has-sheet {
  border-top: 1px solid var(--ink);
}
.sheet {
  max-height: 48svh;
  overflow: auto;
  padding: 0 0 14px;
}
.sheet-head {
  position: sticky;
  top: 0;
  background: var(--canvas);
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 1;
}
.sheet .thread {
  margin-top: 8px;
}
.input-surface {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--field);
  padding: 6px 6px 6px 14px;
  border-bottom: 1px solid var(--line);
}
.input-surface:focus-within {
  border-bottom-color: var(--accent);
}
textarea {
  flex: 1;
  display: block;
  min-height: 44px;
  max-height: 36svh;
  padding: 10px 0;
  border: 0;
  background: transparent;
  resize: none;
  line-height: 1.5;
}
textarea:focus {
  outline: none;
}
textarea::placeholder,
input::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* Sign-in */
.login {
  max-width: 400px;
  margin: 12svh auto 0;
  padding: 0 20px;
}
.login h1 {
  font: 400 30px/1.15 var(--serif);
  margin: 28px 0 8px;
}
.login form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}
.login .action {
  justify-self: start;
}
.status {
  font-size: 14px;
  min-height: 21px;
}

@media (min-width: 900px) {
  .app-header {
    padding: 20px 32px;
  }
  .main {
    padding: 0 32px;
    min-height: calc(100svh - 84px);
  }
  .main.split {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 64px;
  }
  .main.split .side {
    display: block;
  }
  .side .list-head h2 {
    font-size: 24px;
  }
  .side .row-title {
    font-size: 19px;
  }
  .side .row {
    padding: 16px 0 17px;
  }
  .side .row-done {
    top: 6px;
  }
  .side .row[aria-current="page"] {
    padding-left: 12px;
  }
  .main.split .back {
    display: none;
  }
  .main.split .pane {
    max-width: 680px;
  }
  .dock {
    margin: auto 0 0;
    padding: 12px 0 20px;
  }
  .pane h1 {
    font-size: 32px;
  }
  .list-head h1 {
    font-size: 35px;
  }
  .object {
    padding: 28px;
  }
  .object h2 {
    font-size: 27px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .action:active:not(:disabled) {
    transform: none;
  }
}
