:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: light;
  --canvas: #f7f5ef;
  --surface: #fffefa;
  --rail: #f0eee6;
  --text: #202821;
  --muted: #59645b;
  --line: #e5e2d7;
  --strong-line: #b6b9ad;
  --accent: #b74310;
  --accent-text: #fff;
  --tint: #ffeede;
  --overview: #ffecd7;
  --green: #205845;
  --green-tint: #e8f1e9;
  --late: #a13824;
  --late-tint: #fae9e2;
  --shadow: 0 8px 26px #4735240a;
  color: var(--text);
  background: var(--canvas);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #1b1f1b;
  --surface: #242a24;
  --rail: #20251f;
  --text: #f8f2e7;
  --muted: #bec7ba;
  --line: #3a4339;
  --strong-line: #738171;
  --accent: #ffa16f;
  --accent-text: #331507;
  --tint: #443122;
  --overview: #493324;
  --green: #a6d8b8;
  --green-tint: #2b4033;
  --late: #ffab96;
  --late-tint: #492e27;
  --shadow: 0 8px 26px #00000014;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 {
  font-size: clamp(2.15rem, 5vw, 3.15rem);
  font-weight: 780;
  line-height: 1.05;
  letter-spacing: -.055em;
}
h2 { font-size: 1.1rem; line-height: 1.3; }
h3 { font-size: .94rem; line-height: 1.35; }
button, input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
button { cursor: pointer; touch-action: manipulation; }
button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
a:focus-visible, pre:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button:disabled { opacity: .58; cursor: wait; }
input { min-width: 0; min-height: 44px; padding: 9px 12px; }
textarea { display: block; min-width: 0; padding: 9px 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 700;
}
.primary:hover { filter: brightness(.96); }

.app {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  width: min(100%, 1380px);
  min-height: 100dvh;
  margin-inline: auto;
}
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100dvh;
  padding: 28px 16px;
  background: var(--rail);
  border-right: 1px solid var(--line);
  z-index: 3;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.13rem;
  font-weight: 780;
  letter-spacing: -.035em;
}
.brand img { flex: none; object-fit: contain; }
.sidebar-brand { margin: 0 5px 30px; }
.mobile-brand, .short-label { display: none; }
.tabs { display: grid; gap: 5px; }
.tab {
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 650;
  text-align: left;
}
.tab.selected {
  color: var(--accent);
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.shell {
  position: relative;
  width: 100%;
  max-width: 1110px;
  min-width: 0;
  padding: 42px clamp(24px, 4vw, 50px) 56px;
}
.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.date-label { color: var(--muted); font-size: .86rem; font-weight: 650; margin-bottom: 5px; }
.date-label:empty { display: none; }
.back-to-chat {
  flex: none;
  min-height: 42px;
  padding: 8px 12px;
  color: var(--green);
  font-size: .87rem;
  font-weight: 680;
}
.back-to-chat span { margin-left: 3px; }

.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 13px 10px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(110deg, var(--overview), var(--surface));
}
.overview-item { display: grid; align-content: center; gap: 3px; padding: 3px 14px; }
.overview-item + .overview-item { border-left: 1px solid var(--line); }
.overview-item strong {
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  font-weight: 770;
  letter-spacing: -.045em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.overview-item span { color: var(--muted); font-size: .84rem; }
.overview-overdue.has-overdue strong { color: var(--late); }
.list-tools {
  display: grid;
  grid-template-columns: max-content minmax(140px, 330px);
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.switch {
  display: flex;
  align-items: stretch;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--rail);
}
.switch button {
  min-height: 37px;
  padding: 6px 11px;
  border-color: transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  font-size: .86rem;
  font-weight: 680;
}
.switch button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.search-field { position: relative; min-width: 0; }
.search-field .glyph {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}
#search { width: 100%; padding-left: 38px; }
#tag-filter {
  grid-column: 1 / -1;
  justify-self: start;
  min-width: 0;
  max-width: min(100%, 250px);
  min-height: 42px;
  padding: 6px 12px;
  font-size: .86rem;
  cursor: pointer;
}

.task-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 15px; }
.task-group h2 { margin: 0 0 7px 2px; font-size: .91rem; }
.task-group.overdue h2 { color: var(--late); }
.task-items {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.task {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  padding: 0 5px;
}
.task + .task { border-top: 1px solid var(--line); }
.task.archived { grid-template-columns: 44px minmax(0, 1fr); }
.task-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 10px 5px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  min-width: 0;
  min-height: 44px;
}
.task-main strong { font-size: .99rem; font-weight: 680; line-height: 1.3; overflow-wrap: anywhere; }
.task-main:hover strong { color: var(--accent); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 9px; }
.task-meta small { color: var(--muted); font-size: .79rem; }
.task-meta .late { color: var(--late); }
.task-meta .finished { color: var(--green); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.tags:empty { display: none; }
.tag-chip {
  min-width: 0;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--accent);
  background: var(--tint);
  font-size: .76rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.tag-remove { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; }
.tag-remove span { min-width: 0; }
.tag-remove .glyph { flex: 0 0 18px; }
.task .done, .task .move {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.task .done:hover, .task .move:hover { background: var(--tint); color: var(--accent); }
.complete-circle {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1.5px solid var(--strong-line);
  border-radius: 50%;
  color: var(--green);
}
.done .glyph-check { opacity: .0; }
.done:hover .glyph-check, .done:focus-visible .glyph-check { opacity: 1; }
.archive-marker { justify-self: center; }
.archive-marker.completed { border-color: var(--green); background: var(--green-tint); }
.archive-marker.canceled { border-color: var(--line); color: var(--muted); }
.empty {
  padding: 24px 18px;
  border: 1px dashed var(--line);
  border-radius: 15px;
  color: var(--muted);
  background: var(--surface);
  font-size: .9rem;
}
.notice {
  padding: 11px 13px;
  color: var(--text);
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: .89rem;
  overflow-wrap: anywhere;
}
#notice { margin-bottom: 12px; }

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(270px, 1.05fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.month {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}
.month-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}
.month-toolbar h2 { font-weight: 740; text-transform: capitalize; }
.navigation { display: flex; align-items: center; gap: 4px; }
.today-button { padding: 7px 9px; min-height: 42px; font-size: .78rem; font-weight: 650; }
.icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
}
.weekdays, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.weekdays span { padding: 8px 0; text-align: center; color: var(--muted); font-size: .74rem; }
.day {
  position: relative;
  min-height: 43px;
  border-color: transparent;
  border-radius: 10px;
  padding: 0 0 4px;
  font-variant-numeric: tabular-nums;
}
.day.today { font-weight: 760; color: var(--accent); background: var(--tint); }
.day.marked::after {
  content: "";
  position: absolute;
  height: 4px;
  width: 4px;
  bottom: 6px;
  left: calc(50% - 2px);
  border-radius: 50%;
  background: var(--accent);
}
.day[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 730; }
.day[aria-pressed="true"].marked::after { background: var(--accent-text); }
.day-agenda { min-width: 0; }
.agenda-heading { display: flex; align-items: center; gap: 8px; margin: 5px 0 11px; }
.agenda-heading h2::first-letter { text-transform: uppercase; }
.day-count { font-size: .78rem; color: var(--muted); padding: 3px 7px; background: var(--rail); border-radius: 6px; }

dialog {
  width: min(100% - 24px, 520px);
  max-height: 88dvh;
  overflow: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 23px;
  box-shadow: 0 22px 65px #19191142;
}
dialog::backdrop { background: #19201b84; }
.sheet-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
#detail-title { overflow-wrap: anywhere; font-size: 1.55rem; line-height: 1.16; }
.detail-facts {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--canvas);
}
.detail-facts div { display: flex; gap: 12px; justify-content: space-between; font-size: .86rem; }
.detail-facts dt { color: var(--muted); }
.detail-facts dd { font-weight: 650; text-align: right; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.detail-section { margin-top: 17px; }
.file-list { padding: 0; margin: 7px 0 0; list-style: none; display: grid; gap: 5px; }
.file-list button { width: 100%; padding: 10px 12px; text-align: left; overflow-wrap: anywhere; }
.task-actions { flex-wrap: wrap; }
.task-actions #edit-task { margin-right: auto; }
dialog fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.detail-section form { margin-top: 7px; }
.tag-inputs { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 7px; }
#tag-list { margin-bottom: 7px; }
.tag-inputs button, #comment-form button { min-height: 44px; padding: 8px 12px; }
.comments { display: grid; gap: 6px; margin: 7px 0 0; padding: 0; list-style: none; }
.comment { padding: 9px 11px; border-radius: 10px; background: var(--canvas); }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: .78rem; }
.comment-meta time { color: var(--muted); }
.comment p { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; line-height: 1.45; }
#comment-form fieldset { display: grid; justify-items: end; gap: 7px; }
#comment-form textarea { width: 100%; }
.detail-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.detail-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 13px;
}
.move-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.move-inputs label { display: grid; font-size: .83rem; color: var(--muted); gap: 5px; min-width: 0; }
.move-inputs input { width: 100%; }
.edit-inputs { display: grid; gap: 10px; }
.edit-inputs label { display: grid; gap: 5px; color: var(--muted); font-size: .88rem; }
.edit-inputs input, .edit-inputs textarea { font-size: 1rem; }
#detail-error { margin-top: 12px; }

.user-heading { margin-bottom: 12px; color: var(--muted); font-size: .88rem; }
.member-list {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.member {
  display: grid;
  grid-template-columns: minmax(95px, 1fr) minmax(88px, max-content) minmax(94px, max-content) minmax(105px, 170px);
  align-items: center;
  gap: 12px;
  padding: 14px;
}
.member + .member { border-top: 1px solid var(--line); }
.member-identity, .member-cost { display: grid; gap: 3px; min-width: 0; }
.member-identity { overflow-wrap: anywhere; }
.member small { color: var(--muted); font-size: .78rem; }
.member-status {
  justify-self: start;
  border-radius: 7px;
  padding: 4px 7px;
  background: var(--rail);
  color: var(--muted);
  font-size: .76rem;
}
.member-status.allowed { background: var(--green-tint); color: var(--green); }
.member-status.pending { background: var(--tint); color: var(--accent); }
.member-status.denied, .member-status.revoked { background: var(--late-tint); color: var(--late); }
.member-cost { text-align: right; font-variant-numeric: tabular-nums; }
.member-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.member-actions button { padding: 7px 9px; min-height: 40px; font-size: .8rem; }

.mcp-layout { display: grid; gap: 20px; align-items: start; }
.mcp-panel, .mcp-guide-card {
  display: grid;
  gap: 11px;
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.mcp-panel label, .mcp-saved-key label { color: var(--muted); font-size: .85rem; font-weight: 650; }
.mcp-field, .mcp-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.mcp-field input { flex: 1 1 185px; width: 100%; }
.mcp-field button, .mcp-actions button { min-height: 43px; padding: 7px 10px; font-size: .86rem; }
#mcp-key-result { display: grid; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
.mcp-note { color: var(--muted); font-size: .79rem; }
.mcp-guide { display: grid; gap: 10px; min-width: 0; }
.mcp-guide-apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.mcp-guide-apps button { min-height: 42px; padding: 5px; font-size: .83rem; font-weight: 660; }
.mcp-guide-apps button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--tint); }
.mcp-guide-mode { justify-self: start; }
.mcp-guide-steps { display: grid; gap: 7px; margin: 0; padding-left: 21px; font-size: .91rem; line-height: 1.5; }
.mcp-guide-steps li { padding-left: 2px; overflow-wrap: anywhere; }
.mcp-guide-steps li::marker { color: var(--accent); font-weight: 700; }
.mcp-saved-key { display: grid; gap: 7px; margin: 0; }
.mcp-guide-code { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); }
.mcp-code-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 650;
}
.mcp-code-toolbar button { min-height: 39px; padding: 5px 8px; }
#mcp-code-text {
  margin: 0;
  padding: 9px 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-top: 1px solid var(--line);
  font-size: .81rem;
  line-height: 1.55;
}
.mcp-guide-docs { justify-self: start; color: var(--accent); font-size: .86rem; }

.glyph {
  position: relative;
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
}
.glyph::before, .glyph::after { position: absolute; content: ""; }
.glyph-list::before {
  top: 8px; left: 6px; width: 11px; height: 1.7px;
  border-radius: 1px; background: currentColor;
  box-shadow: 0 -5px currentColor, 0 5px currentColor;
}
.glyph-list::after {
  top: 8px; left: 1px; width: 2px; height: 2px;
  border-radius: 50%; background: currentColor;
  box-shadow: 0 -5px currentColor, 0 5px currentColor;
}
.glyph-calendar {
  background:
    linear-gradient(currentColor, currentColor) 5px 0 / 1.5px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 11px 0 / 1.5px 5px no-repeat;
}
.glyph-calendar::before { inset: 3px 1px 1px; border: 1.6px solid currentColor; border-radius: 3px; }
.glyph-calendar::after { top: 8px; left: 3px; right: 3px; height: 1.5px; background: currentColor; }
.glyph-users::before { top: 1px; left: 6px; width: 6px; height: 6px; border: 1.6px solid currentColor; border-radius: 50%; }
.glyph-users::after { top: 9px; left: 2px; right: 2px; height: 8px; border: 1.6px solid currentColor; border-radius: 7px 7px 3px 3px; }
.glyph-link::before, .glyph-link::after { width: 11px; height: 6px; border: 1.6px solid currentColor; border-radius: 5px; transform: rotate(-43deg); }
.glyph-link::before { top: 7px; left: 0; }
.glyph-link::after { top: 4px; right: 0; }
.glyph-search::before { left: 1px; top: 1px; width: 11px; height: 11px; border: 1.7px solid currentColor; border-radius: 50%; }
.glyph-search::after { top: 11px; left: 10px; width: 6px; height: 1.7px; border-radius: 1px; background: currentColor; transform: rotate(45deg); transform-origin: left center; }
.glyph-left::before, .glyph-right::before { top: 5px; left: 6px; width: 8px; height: 8px; border-right: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; }
.glyph-left::before { transform: rotate(135deg); }
.glyph-right::before { left: 3px; transform: rotate(-45deg); }
.glyph-check::before { left: 6px; top: 3px; width: 6px; height: 10px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(43deg); }
.glyph-close::before, .glyph-close::after { top: 8px; left: 3px; width: 12px; height: 1.6px; background: currentColor; }
.glyph-close::before { transform: rotate(45deg); }
.glyph-close::after { transform: rotate(-45deg); }

@media (min-width: 1130px) {
  .mcp-layout { grid-template-columns: minmax(230px, .75fr) minmax(0, 1.25fr); }
}
@media (max-width: 890px) {
  .calendar-layout { grid-template-columns: 1fr; gap: 16px; }
  .member { grid-template-columns: minmax(0, 1fr) minmax(85px, max-content); gap: 8px; }
  .member-cost { grid-column: 2; grid-row: 1; }
  .member-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (min-width: 701px) {
  .list-tools { grid-template-columns: max-content minmax(0, 1fr) minmax(140px, 330px); }
  .list-tools .search-field { grid-column: 3; }
  #tag-filter { grid-column: 2; grid-row: 1; }
}
@media (max-width: 700px) {
  .app { display: block; }
  .sidebar {
    position: fixed;
    inset: auto 0 0;
    min-height: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 5px 8px max(5px, env(safe-area-inset-bottom));
    background: var(--surface);
    box-shadow: 0 -4px 22px #3225150c;
  }
  .tabs { display: flex; gap: 3px; }
  .tab {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 50px;
    padding: 4px;
    font-size: .73rem;
    text-align: center;
  }
  .tab.selected { box-shadow: none; background: var(--tint); border-color: transparent; }
  .sidebar-brand, .wide-label { display: none; }
  .short-label { display: inline; }
  .mobile-brand { display: flex; min-height: 42px; margin-bottom: 11px; font-size: .96rem; }
  .shell { padding: max(13px, env(safe-area-inset-top)) 16px calc(81px + env(safe-area-inset-bottom)); }
  .back-to-chat { position: absolute; top: max(13px, env(safe-area-inset-top)); right: 16px; }
  .masthead { margin-bottom: 15px; }
  .overview { margin-bottom: 13px; padding: 10px 3px; }
  .overview-item { padding-inline: 9px; }
  .overview-item span { font-size: .76rem; }
  .list-tools { grid-template-columns: max-content minmax(0, 1fr); gap: 7px; margin-bottom: 14px; }
  .month { padding: 11px; }
  .today-button, .icon, .day { min-height: 44px; }
  .icon { width: 44px; }
  dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 19px 16px max(18px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }
  .detail-actions button { flex: 1; }
  .tag-remove { min-height: 40px; }
}
@media (max-width: 360px) {
  .shell { padding-inline: 12px; }
  .back-to-chat { right: 12px; }
  .list-tools .search-field { grid-column: 1 / -1; grid-row: 2; }
  .list-tools .switch { justify-self: start; }
  #tag-filter { grid-column: 2; grid-row: 1; }
  .task-actions button .glyph { display: none; }
  .month-toolbar h2 { font-size: .91rem; }
  .month-toolbar .navigation { gap: 3px; }
  .month-toolbar .today-button { padding-inline: 6px; }
}
