:root {
  --bg: #e4d9cf;
  --paper: #ffffff;
  --ink: #1c1613;
  --muted: #4a403a;
  --faint: #5e534c;
  --gold: #8d4e2f;
  --gold-deep: #5c3018;
  --line: #b89a86;
  --wash: #f4ebe4;
  --soon-bg: #fff1cc;
  --soon-line: #b8860b;
  --late-bg: #fde2dc;
  --late-line: #b42318;
  --shadow: 0 8px 22px rgba(50, 30, 20, 0.12);
  --font: "Montserrat", sans-serif;
  --serif: "Cormorant", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #f3e4d8;
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.top {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 28px 16px;
  background: var(--paper);
  border-bottom: 1px solid #e7d5c6;
  position: sticky;
  top: 0;
  z-index: 30;
}

.logo {
  display: block;
  height: 62px;
  width: auto;
}

.titles {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex: 1;
  min-width: 0;
}

.who-block {
  display: flex;
  align-items: baseline;
  gap: 18px;
  min-width: 0;
}

.title-sep {
  align-self: center;
  flex: none;
  width: 1px;
  height: 28px;
  background: var(--gold);
  opacity: 0.45;
}

.who {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

.who-name {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}

.who-dot {
  flex: none;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
}

.who-login {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--gold);
}

h1 {
  margin: 0;
  font-size: 44px;
  line-height: 0.9;
  white-space: nowrap;
}

.hypothesis,
.view-note,
.legend {
  margin: 8px 0 0;
  max-width: 680px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.toolbar {
  padding: 12px 28px 0;
}

.people-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.people-nav button,
.chips button,
.quiet,
.remove,
.solid,
.text-btn {
  border: 0;
  background: transparent;
  font: inherit;
}

.people-nav button {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0 8px;
  border-bottom: 1px solid transparent;
  color: var(--faint);
  font-size: 15px;
}

.people-nav button.is-current {
  color: var(--gold-deep);
  border-bottom-color: var(--gold);
}

.people-nav button:hover,
.quiet:hover,
.chips button:hover {
  color: var(--gold-deep);
}

.people-nav button:disabled,
.people-nav button:disabled:hover {
  color: var(--faint);
  cursor: default;
}

.view-note {
  margin-top: 4px;
}

main {
  padding: 8px 28px 48px;
}

.strip {
  margin: 8px 0 18px;
}

.strip h2,
.later-block h2,
.week-move h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.card-row,
.later-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.week-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin: 6px 0 14px;
}

.week-move,
.week-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.week-side {
  justify-content: flex-end;
  max-width: 460px;
}

.legend {
  margin: 0;
  text-align: right;
}

#color-hint {
  flex: 1 1 100%;
}

#color-hint:empty {
  display: none;
}

.hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 0;
  max-width: 680px;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.hint span {
  flex: 1;
  min-width: 0;
}

.hint-x {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 18px;
  line-height: 1;
}

.hint-x:hover {
  color: var(--ink);
}

.week-side .hint {
  margin: 0;
}

.text-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  border-color: var(--gold-deep);
  font-size: 13px;
  padding: 8px 12px;
  white-space: nowrap;
}

.text-btn:hover,
.text-btn.is-armed,
.text-btn.is-on {
  border-color: var(--gold);
  color: var(--gold-deep);
}

.week {
  display: grid;
  gap: 12px;
  align-items: start;
}

.day {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 8px 12px;
}

.day.is-weekend {
  background: rgba(255, 255, 255, 0.2);
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.day-head h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1;
}

.day.is-today h3 {
  border-bottom: 1px solid var(--gold);
}

.day-num {
  color: var(--faint);
  font-size: 12px;
}

.day-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid #8d7364;
  box-shadow: var(--shadow);
  padding: 10px 12px 12px;
  color: var(--ink);
}

.card.is-soon {
  background: var(--soon-bg);
  border-color: var(--soon-line);
}

.card.is-late {
  background: var(--late-bg);
  border-color: var(--late-line);
}

.card.is-done {
  background: #f7f7f7;
  border-color: #ececec;
  box-shadow: none;
  color: #8d8d8d;
}

.card-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}

.card.is-done .card-title {
  color: #8d8d8d;
  font-weight: 400;
}

.card-meta,
.card-flag {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.later-card {
  width: min(280px, 100%);
}

.add-day {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 6px;
  border: 1.5px solid var(--gold-deep);
  background: #fff;
  color: var(--gold-deep);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
}

.add-day:hover {
  background: var(--gold-deep);
  color: #fff;
}

.later-block {
  margin-top: 28px;
}

.week-group {
  margin-top: 16px;
}

.week-group h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.empty-note {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 13px;
}

#overlay[hidden] {
  display: none;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 22, 19, 0.46);
}

.panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: auto;
  width: min(440px, 100%);
  overflow: auto;
  background: var(--paper);
  border-left: 1px solid #e7d5c6;
  box-shadow: -12px 0 40px rgba(70, 50, 40, 0.06);
  padding: 28px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.panel-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-top h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.05;
}

.title-line {
  position: relative;
  min-width: 0;
}

.title-line h2,
.panel-title {
  width: 100%;
}

.title-line:has(#edit-title:not([hidden])) h2 {
  padding-right: 22px;
}

#edit-title {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 0;
}

.panel-title {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--gold);
  resize: none;
  overflow: hidden;
}

.panel-title::placeholder {
  color: #c4b2a6;
}

.panel-title:focus {
  outline: none;
}

.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b0a49c;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--gold-deep);
}

.inline-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
}

.note-view {
  position: relative;
  min-height: 28px;
  padding: 2px 32px 0 0;
}

.note-view p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  white-space: pre-wrap;
}

.note-view p.is-empty {
  color: var(--faint);
}

.note-pencil {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 0;
}

#note-edit textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
  background: transparent;
  color: var(--ink);
}

#note-edit textarea:focus {
  outline: none;
  border-color: var(--gold);
}

#reassign.is-faint {
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
}

.date-btn {
  align-self: flex-start;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.date-btn:hover,
.date-btn:focus {
  outline: none;
  border-bottom-color: var(--gold);
}

.date-btn:disabled {
  color: var(--muted);
  cursor: default;
}

.calendar {
  position: fixed;
  z-index: 55;
  width: 292px;
  padding: 12px 12px 14px;
  background: var(--paper);
  border: 1px solid #e7d5c6;
  box-shadow: var(--shadow);
}

.calendar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-bar p {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--gold);
}

.calendar-bar .icon-btn {
  margin-top: 0;
  font-size: 22px;
  line-height: 1;
}

.calendar-week,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-week {
  margin-top: 8px;
}

.calendar-week span {
  text-align: center;
  color: var(--faint);
  font-size: 11px;
  padding: 4px 0;
}

.calendar-days button {
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.calendar-days button.is-out {
  color: #c4b2a6;
}

.calendar-days button.is-today {
  box-shadow: inset 0 0 0 1px var(--gold);
}

.calendar-days button.is-picked {
  background: var(--gold-deep);
  color: white;
  box-shadow: none;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.composer-bar .icon-btn {
  margin-top: 0;
}

.composer-send {
  margin-left: auto;
}

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

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

.assignee-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.panel-person {
  margin: 0;
  color: var(--faint);
  font-size: 13px;
}

#assignee-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
}

#assignee-name.is-empty {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--faint);
}

.quiet {
  padding: 0;
  color: var(--gold-deep);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.close {
  flex: none;
  padding-top: 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}

.links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span,
.thread-block h3 {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}

.field input,
.field textarea,
#entry-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 8px 0;
}

.field textarea,
#entry-input {
  border: 1px solid var(--line);
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field textarea:focus,
#entry-input:focus {
  outline: none;
  border-color: var(--gold);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.chips button {
  padding: 0;
  color: #b0a49c;
  font-size: 13px;
}

.chips button.is-current {
  color: var(--gold-deep);
}

.thread-block h3 {
  margin: 0 0 8px;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.entry {
  background: var(--wash);
  padding: 10px 12px;
}

.entry b {
  display: block;
  font-weight: 500;
  color: var(--ink);
  font-size: 13px;
}

.entry time {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
}

.entry p {
  margin: 6px 0 0;
  color: #6d625c;
}

.entry-files {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 8px;
}

.entry-files a {
  color: var(--gold-deep);
  font-size: 14px;
}

.file-pick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 13px;
}

.file-pick input {
  font: inherit;
  font-size: 12px;
  color: var(--muted);
}

.entry-file-names {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.file-store-title {
  margin-top: 28px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(120px, 1fr) auto auto auto;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}

.file-row .quiet {
  justify-self: end;
}

.next-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.next-box p {
  margin: 8px 0 0;
  font-size: 13px;
  color: #8a7568;
}

.solid {
  align-self: flex-start;
  background: var(--gold);
  color: white;
  padding: 10px 14px;
  font-size: 13px;
}

.solid:hover {
  background: var(--gold-deep);
}

#draft-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 4px;
}

.remove {
  color: #c9a39c;
  font-size: 13px;
  padding: 0;
}

.remove:hover,
.remove.is-armed {
  color: #b42318;
}

#close-only.is-armed {
  color: var(--gold-deep);
}

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

@media (max-width: 980px) {
  .top {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .titles {
    flex: 1 1 220px;
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .title-sep {
    height: 22px;
  }

  .who-name,
  .who-dot {
    font-size: 24px;
  }

  .who-login {
    font-size: 18px;
  }

  h1 {
    white-space: normal;
  }

  .account {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .top,
  .toolbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .week-bar,
  .week-side {
    align-items: flex-start;
    flex-direction: column;
  }

  .legend,
  .week-side .hint {
    text-align: left;
  }

  .week {
    grid-template-columns: 1fr 1fr !important;
  }

  h1 {
    font-size: 36px;
  }

  .panel {
    width: 100%;
    padding: 22px 18px 28px;
  }
}

.account {
  display: flex;
  align-items: flex-end;
  gap: 28px;
  margin-left: auto;
}

.sections {
  display: flex;
  align-items: center;
  gap: 22px;
}

a.section {
  text-decoration: none;
}

.section {
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  padding: 4px 0 7px;
  color: var(--faint);
  font: inherit;
  font-size: 15px;
}

.section.is-current {
  color: var(--gold-deep);
  border-bottom-color: var(--gold);
}

.section:hover {
  color: var(--gold-deep);
}

.cabinet-logout {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-tabs {
  margin: 4px 0 18px;
}

#cabinet-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.confirm-shade {
  position: absolute;
  inset: 0;
  background: rgba(28, 22, 19, 0.46);
}

.confirm-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid #e7d5c6;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}

.confirm-card h2 {
  margin: 0 0 22px;
  font-size: 36px;
  line-height: 1;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 18px;
}

.screen {
  padding: 8px 28px 48px;
}

.sheet {
  max-width: 720px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px 24px 28px;
}

.sheet-wide {
  max-width: 980px;
}

.sheet h2 {
  margin: 0 0 16px;
  font-size: 32px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.check input {
  accent-color: var(--gold-deep);
}

.user-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(120px, 1.1fr) auto auto auto auto;
  gap: 10px 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.user-row input[type="text"] {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 0;
}

.user-row input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
}

.add-user-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold-deep);
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.1;
  cursor: pointer;
}

.add-user-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid currentColor;
}

.add-user-toggle[aria-expanded="true"]::before {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  border-bottom: 0;
}

.new-user {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 18px;
}

.form-error,
.login-error {
  margin: 0;
  color: #8a4b42;
  font-size: 13px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid #e7d5c6;
  box-shadow: var(--shadow);
  padding: 28px 28px 32px;
}

.login-card h1 {
  font-size: 40px;
  white-space: normal;
}

.login-card p {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.danger {
  border: 1px solid #8a3e32;
  background: #fff;
  color: #8a3e32;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
}

.danger.is-armed,
.danger:hover {
  background: #8a3e32;
  color: #fff;
}

.report-done {
  margin: 0;
  color: #6d625c;
  white-space: pre-wrap;
}

@media (max-width: 800px) {
  .user-row {
    grid-template-columns: 1fr 1fr;
  }

  .account {
    width: 100%;
    margin-left: 0;
  }

  .screen {
    padding-left: 16px;
    padding-right: 16px;
  }
}
