/* Shared paper, ink and rule colors for the notebook. */
:root {
  color-scheme: dark;
  --canvas: #201e1c;
  --surface: #282520;
  --inside: #332f29;
  --line: #524a3e;
  --text: #f3eadc;
  --muted: #c4b8a5;
  --accent: #f3ad86;
  --accent-text: #2f1e15;
  --selection: #45352a;
  --danger: #ffc0ad;
  --chrome: #201e1cf5;
  --shadow: #120e0b66;
  --app-width: 640px;
  --display-font: ui-serif, Georgia, serif;
  --time-font: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font: 100%/1.48 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

:root[data-theme="light"] {
  color-scheme: light;
  --canvas: #f8f4eb;
  --surface: #fffcf5;
  --inside: #efe7d9;
  --line: #d7ccbb;
  --text: #26221d;
  --muted: #655b4e;
  --accent: #984b32;
  --accent-text: #fffbf6;
  --selection: #efe0ce;
  --danger: #9d392b;
  --chrome: #f8f4ebf5;
  --shadow: #442b191f;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

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

button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

button:disabled, input:disabled, textarea:disabled { opacity: .53; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1, h2, h3, p { margin: 0; }
h1 { font: 500 2.35rem/1.06 var(--display-font); letter-spacing: -.044em; }
h2 { font: 600 1.3rem/1.2 var(--display-font); letter-spacing: -.024em; }
h3 { font-size: .94rem; line-height: 1.35; }
p { color: var(--muted); }
svg { flex: 0 0 auto; display: block; width: 21px; height: 21px; }

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell {
  max-width: var(--app-width);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  padding: 0 max(18px, env(safe-area-inset-right)) calc(88px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.app-bar, .app-actions, .wordmark, .view-heading, .dialog-bar { display: flex; align-items: center; }

.app-bar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  min-height: calc(53px + env(safe-area-inset-top));
}

.wordmark {
  gap: 7px;
  color: var(--text);
  font-size: .82rem;
  font-weight: 650;
  letter-spacing: -.012em;
  white-space: nowrap;
}

.brand-icon, .icon-button, .workspace-action {
  display: inline-grid;
  place-items: center;
}

.brand-icon {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--accent);
}
.brand-icon svg { width: 15px; height: 15px; }
.app-actions { gap: 1px; }
.icon-button { border-radius: 11px; height: 44px; width: 44px; color: var(--muted); flex: 0 0 auto; }
.icon-button:active, .quiet:active { background: var(--inside); }
.tile { border: 1px solid var(--line); color: var(--text); }

.view-heading { min-height: 90px; justify-content: space-between; gap: 10px; padding: 14px 0 14px; }
.view-heading div { min-width: 0; }
.view-heading h1 { overflow-wrap: anywhere; }
.view-heading p { font-size: .82rem; margin-top: 4px; font-weight: 530; }
.view-heading p:empty { display: none; }

.pills {
  display: flex;
  gap: 14px;
  margin: 0 0 16px;
  padding: 1px 2px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }
.pills button {
  white-space: nowrap;
  min-height: 44px;
  padding-inline: 2px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: .82rem;
  font-weight: 580;
}
.pills button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 650; }

#section-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: .85rem;
}
#project-section { max-width: 24rem; flex: 1; }

#search-form {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 0 4px 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
}
#search-form input { padding-inline: 2px; min-width: 0; background: transparent; border: 0; flex: 1; }
#search-form:focus-within { border-color: var(--accent); }
#search-form input:focus-visible { outline: none; }
#search-form input::-webkit-search-cancel-button { -webkit-appearance: none; }

.panel { border: 0; }
.empty { border-top: 1px solid var(--line); padding: 19px 2px 15px; color: var(--muted); font-size: .93rem; }
.empty button { display: flex; padding-inline: 0; margin-top: 5px; }
.content { display: grid; gap: 15px; }
.content[aria-busy="true"] { opacity: .68; }

.task-row, .project-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.task-row:first-child, .project-row:first-child { border-top: 1px solid var(--line); }
.task-row[data-focused="true"] .complete { color: var(--accent); }
.complete { width: 42px; min-height: 46px; color: var(--muted); }
.complete svg { width: 22px; height: 22px; }
.complete[aria-pressed="true"] { color: var(--accent); }
.task-open, .project-open {
  flex: 1;
  min-height: 57px;
  min-width: 0;
  text-align: left;
  padding: 9px 5px 9px 1px;
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-wrap: anywhere;
}
.task-open > div, .project-open > div { flex: 1; min-width: 0; }
.task-open:active, .project-open:active { background: var(--inside); }
.task-title { display: block; font-size: 1rem; line-height: 1.32; font-weight: 570; }
.task-row[data-done="true"] .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.task-meta[data-late="true"] { color: var(--danger); }
.task-open svg, .project-open > svg:last-child { color: var(--muted); width: 16px; height: 16px; }
.project-open { padding-inline: 4px 5px; gap: 13px; }
.project-open > svg:first-child { color: var(--muted); }

.group-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 35px; margin: 0 0 5px; }
.group-heading h2 { font-size: 1.1rem; line-height: 1.3; overflow-wrap: anywhere; }

.focus-strip {
  padding: 5px 0 7px 12px;
  border-left: 2px solid var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.focus-strip h2 { font: 600 .73rem/1.3 -apple-system, BlinkMacSystemFont, system-ui, sans-serif; color: var(--accent); }
.focus-strip .focus-title {
  color: var(--text);
  display: block;
  font: 500 1.46rem/1.1 var(--display-font);
  min-height: 44px;
  text-align: left;
  overflow-wrap: anywhere;
}
.focus-content { min-width: 0; }
.focus-strip .quiet { padding-inline: 6px; }
.focus-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; }

.bottom-wrap {
  position: fixed;
  inset: auto 0 0;
  z-index: 3;
  background: var(--chrome);
  border-top: 1px solid var(--line);
  padding: 5px max(16px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.bottom-bar { max-width: calc(var(--app-width) - 36px); margin-inline: auto; display: grid; grid-template-columns: repeat(3, 1fr) 49px; align-items: center; gap: 4px; }
.bottom-bar button { min-height: 52px; border-radius: 11px; font-size: .68rem; color: var(--muted); font-weight: 570; display: grid; place-content: center; justify-items: center; gap: 2px; }
.bottom-bar button[aria-current="page"] { color: var(--accent); }
.bottom-bar button[aria-current="page"] span svg { stroke-width: 2; }
.bottom-bar button span { display: grid; place-items: center; width: 40px; height: 24px; }
.bottom-bar .add { background: var(--accent); color: var(--accent-text); min-height: 46px; border-radius: 50%; width: 46px; justify-self: end; }
.bottom-bar .add svg { width: 24px; height: 24px; }

.primary, .secondary, .quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 640;
}
.primary { background: var(--accent); color: var(--accent-text); }
.primary:active, .add:active { filter: brightness(.91); }
.secondary { background: var(--inside); border-color: var(--line); }
.secondary:active { background: var(--selection); }
.quiet { color: var(--accent); }
.danger { color: var(--danger); }
.mini { font-size: .8rem; min-height: 44px; }
.mini svg { width: 17px; height: 17px; }
.more { display: flex; margin: 12px auto 0; }
.callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--danger);
  font-size: .88rem;
  background: var(--surface);
  border-left: 2px solid var(--danger);
  padding: 8px 10px;
  margin-bottom: 12px;
}

.pairing {
  max-width: 390px;
  margin: min(11vh, 85px) auto 0;
  padding-inline: 4px;
}
.pairing h1 { font-size: 2rem; }
.pairing p { margin-top: 8px; font-size: .9rem; }
.pairing form { display: grid; gap: 8px; margin-top: 22px; }
.pairing button[type="submit"] { margin-top: 5px; }

dialog {
  max-width: min(calc(100% - 26px), 540px);
  max-height: calc(100dvh - 26px);
  color: var(--text);
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 12px 50px var(--shadow);
  padding: 0;
  width: 100%;
}

dialog::backdrop { background: #0009; }
.dialog-shell { margin: 0; }
.dialog-bar {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.dialog-bar h2 { flex: 1; min-width: 0; font-size: 1.28rem; }
dialog:focus-visible { outline: none; }

#editor { overflow: hidden; }
#task-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 28px);
}
#task-form .dialog-bar { position: static; flex: none; }
#task-form .editor-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-padding-block: 10px;
}
#save-task { min-inline-size: 7.5rem; }

.editor-body, .settings-body, .naming-body { padding: 16px 16px calc(17px + env(safe-area-inset-bottom)); }
.editor-body > *, .settings-body > *, .naming-body > * { margin-bottom: 15px; }
.editor-body > input { margin-bottom: 5px; }
.editor-body > label, .naming-body > label { margin-bottom: 4px; }

label { color: var(--muted); font-size: .82rem; font-weight: 590; }
.block-label { display: block; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
legend { color: var(--text); margin-bottom: 7px; padding: 0; font-size: .9rem; font-weight: 660; }
.field-group { padding: 4px 0 11px; border-bottom: 1px solid var(--line); }
.field-group .field-grid + .field-grid { margin-top: 7px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field-grid label { display: grid; min-width: 0; gap: 4px; }
#placement:has(#section-field[hidden]) { display: block; }

input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea {
  color: var(--text);
  min-height: 44px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  width: 100%;
  min-width: 0;
  font-size: max(16px, .94rem);
  font-weight: 450;
}
input::placeholder, textarea::placeholder { opacity: 1; color: var(--muted); }
input[type="date"], input[type="datetime-local"] { padding-inline: 6px; min-inline-size: 0; }
input[type="date"]::-webkit-date-and-time-value, input[type="datetime-local"]::-webkit-date-and-time-value { text-align: start; }
textarea { resize: vertical; }
input.title-input { font: 500 1.35rem/1.22 var(--display-font); padding-block: 10px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.toggle { display: flex; align-items: center; gap: 9px; min-height: 44px; }

.step-row, .file-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.step-row label { display: grid; min-height: 44px; min-width: 36px; place-content: center; }
.step-row input[type="text"] { flex: 1; }
.file-row .filename { min-width: 0; flex: 1; text-align: left; min-height: 44px; padding-inline: 6px; font-size: 14px; overflow-wrap: anywhere; }
.file-picker { position: relative; color: var(--text); cursor: pointer; }
.file-picker:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.file-picker input { position: absolute; inset: 0; opacity: 0; width: 100%; }
.file-row + .file-picker, #step-rows + button { margin-top: 3px; }
.comment { margin-bottom: 7px; padding: 9px 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; }
.comment p { color: var(--text); font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment small { display: block; color: var(--muted); margin-top: 5px; }
#editor-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line); }
#theme-options label { min-height: 51px; padding-inline: 8px; display: flex; align-items: center; gap: 9px; color: var(--text); }
#theme-options label + label { border-top: 1px solid var(--line); }
#theme-options input { margin-left: auto; }
.install-help p, .confirmation p { margin-top: 8px; font-size: .88rem; }
.naming-body { display: grid; }
.naming-body .primary { justify-self: start; }
.confirmation { padding: 18px; }
.confirmation > div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 17px; }
.error { color: var(--danger); }

.snack {
  position: fixed;
  z-index: 4;
  inset: auto 16px calc(72px + env(safe-area-inset-bottom));
  width: fit-content;
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--inside);
  box-shadow: 0 3px 14px var(--shadow);
  font-size: .82rem;
}

.no-script { max-width: var(--app-width); margin: 15px auto; padding-inline: 16px; }

@media (max-width: 600px) {
  .calendar-dialog {
    inset: 0;
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
}
@media (max-width: 375px) {
  .shell { padding-inline: 12px; }
  .editor-body { padding-inline: 10px; }
}
@media (max-width: 460px) {
  .field-grid:has(input[type="datetime-local"]) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 350px) {
  .field-grid:has(#task-repeat) { grid-template-columns: minmax(0, 1fr); }
}

#view-back { min-height: 44px; margin: 0 0 -7px -7px; padding: 0 7px; }
#view-back svg { width: 14px; height: 14px; }
@media (max-width: 600px) {
  .calendar-dialog {
    position: fixed;
    top: var(--visible-top, 0px);
    bottom: auto;
    height: var(--visible-height, 100dvh);
  }
  .calendar-dialog .dialog-bar { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .calendar-dialog .editor-body { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
}
@media (max-width: 600px), (pointer: coarse) and (max-height: 600px) {
  #editor {
    position: fixed;
    inset: 0 0 auto;
    max-width: none;
    max-height: none;
    height: var(--visible-height, 100dvh);
    margin: 0;
    border: 0;
    border-radius: 0;
    transform: translateY(var(--visible-top, 0px));
  }
  #task-form { height: 100%; max-height: none; }
  #task-form .dialog-bar { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  #task-form .editor-body { padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
