:root {
  color-scheme: light;
}

.todo-page {
  --todo-control-height: 44px;
  --todo-control-radius: 12px;
  --todo-card-radius: 16px;
  --todo-control-border: var(--line);
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

.todo-page button,
.todo-page input,
.todo-page select,
.todo-page textarea {
  font: inherit;
}

.todo-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  min-height: 70px;
  padding: 10px max(24px, calc((100vw - 1320px) / 2));
  align-items: center;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.todo-back,
.todo-brand,
.todo-header .secondary-btn,
.todo-hero .primary-btn,
.todo-form-actions .primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.todo-back {
  width: fit-content;
  color: var(--muted);
  text-decoration: none;
}

.todo-back:hover {
  color: var(--brand);
}

.todo-brand {
  justify-content: center;
  font-size: 19px;
  font-weight: 550;
}

.todo-brand > img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.todo-header .secondary-btn {
  justify-self: end;
}

.todo-main {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 50px 0 72px;
}

.todo-page.todo-embedded {
  min-height: auto;
  overflow: visible;
  background: transparent;
}

.todo-page.todo-embedded .todo-header {
  display: none;
}

.todo-page.todo-embedded .todo-main {
  width: 100%;
  padding: 0 0 56px;
}

.todo-page.todo-embedded .todo-hero {
  align-items: start;
}

.todo-page.todo-embedded .todo-hero .eyebrow,
.todo-page.todo-embedded .todo-hero .primary-btn {
  display: none;
}

.todo-page.todo-embedded .todo-hero p {
  max-width: none;
}

.todo-hero {
  display: flex;
  margin-bottom: 24px;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.todo-hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 550;
  letter-spacing: -0.04em;
}

.todo-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.todo-hero .primary-btn {
  flex: none;
}

.todo-summary {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.todo-summary button {
  display: flex;
  min-height: 98px;
  padding: 20px 22px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(75, 55, 48, 0.04);
}

.todo-summary button:hover,
.todo-summary button:focus-visible {
  color: var(--brand);
  border-color: rgba(207, 75, 69, 0.35);
}

.todo-summary strong {
  color: var(--ink);
  font-size: 30px;
  font-weight: 550;
}

.todo-workspace-nav {
  display: flex;
  margin-bottom: 22px;
  padding: 6px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 8px 24px rgba(75, 55, 48, 0.04);
}

.todo-view-tabs {
  display: inline-flex;
  gap: 4px;
}

.todo-view-tabs button {
  min-height: 42px;
  padding: 0 22px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.todo-view-tabs button.active {
  color: var(--brand);
  background: var(--brand-pale);
}

.todo-sync-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.todo-sync-actions > span {
  color: var(--muted);
  font-size: 14px;
}

.todo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.todo-editor,
.todo-list-panel {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.todo-editor[hidden] {
  display: none;
}

.todo-list-panel[hidden] {
  display: none;
}

.todo-panel-heading,
.todo-list-heading {
  display: flex;
  margin-bottom: 22px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.todo-panel-heading h2,
.todo-list-heading h2 {
  margin: 5px 0 0;
  font-size: 26px;
  font-weight: 550;
}

.todo-icon-btn,
.todo-task-icon {
  display: inline-grid;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.todo-icon-btn {
  width: 40px;
  height: 40px;
}

.todo-icon-btn:hover,
.todo-task-icon:hover {
  color: var(--brand);
}

.todo-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.todo-field > small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.todo-modal-open {
  overflow: hidden;
}

.todo-calendar-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(31, 35, 41, 0.4);
}

.todo-calendar-modal[hidden] {
  display: none;
}

.todo-calendar-dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  padding: 22px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 55px rgba(50, 43, 40, 0.18);
}

.todo-calendar-heading,
.todo-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.todo-calendar-heading h2 {
  margin: 3px 0 0;
  font-size: 24px;
}

.todo-calendar-nav {
  margin: 18px 0 10px;
}

.todo-calendar-nav strong {
  font-size: 18px;
  font-weight: 550;
}

.todo-calendar-weekdays,
.todo-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.todo-calendar-weekdays span {
  padding: 6px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.todo-calendar-day {
  display: grid;
  min-width: 0;
  min-height: 54px;
  padding: 6px 2px;
  place-content: center;
  gap: 2px;
  color: var(--ink);
  background: #fff;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}

.todo-calendar-day:hover {
  color: var(--brand);
  background: var(--brand-pale);
}

.todo-calendar-day.outside {
  color: #aaa3a0;
}

.todo-calendar-day.selected {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.todo-calendar-day strong {
  font-size: 16px;
  font-weight: 550;
}

.todo-calendar-day small {
  min-height: 17px;
  font-size: 11px;
  line-height: 1.2;
}

.todo-calendar-time {
  margin-top: 16px;
}

.todo-field {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 550;
}

.todo-field-full {
  margin-bottom: 16px;
}

.todo-page input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.todo-page select,
.todo-page textarea {
  box-sizing: border-box;
  width: 100%;
  height: var(--todo-control-height);
  min-height: var(--todo-control-height);
  padding: 0 14px;
  color: var(--ink);
  background-color: #fff;
  border: 1px solid var(--todo-control-border);
  border-radius: var(--todo-control-radius);
  outline: none;
}

.todo-page select {
  appearance: none;
  padding: 0 44px 0 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f7785' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
}

.todo-page input[type="number"] {
  appearance: textfield;
}

.todo-page input[type="number"]::-webkit-inner-spin-button,
.todo-page input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.todo-page input::placeholder,
.todo-page textarea::placeholder {
  color: #aaa3a0;
}

.todo-field textarea {
  height: auto;
  min-height: 92px;
  padding: 11px 14px;
  resize: vertical;
}

.todo-page input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
.todo-page select:focus,
.todo-page textarea:focus {
  border-color: rgba(207, 75, 69, 0.65);
  box-shadow: 0 0 0 3px rgba(207, 75, 69, 0.09);
}

.todo-page input:disabled,
.todo-page select:disabled,
.todo-page textarea:disabled {
  color: #a39d99;
  background-color: #f0ecea;
  cursor: not-allowed;
  opacity: 1;
}

.todo-date-input {
  position: relative;
  display: block;
}

.todo-date-input input {
  padding-right: 48px !important;
}

.todo-date-input input::-webkit-calendar-picker-indicator {
  opacity: 0;
  pointer-events: none;
}

.todo-date-picker-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  display: inline-grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  transform: translateY(-50%);
  cursor: pointer;
}

.todo-date-picker-btn:hover,
.todo-date-picker-btn:focus-visible {
  color: var(--brand);
  outline: none;
}

.todo-form-error {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--brand);
}

.todo-reminder-preview {
  margin: 16px 0;
  padding: 13px 15px;
  color: var(--brand);
  line-height: 1.65;
  background: var(--brand-pale);
  border: 1px solid #f2d0cc;
  border-radius: var(--todo-control-radius);
}

.todo-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.todo-form-actions .primary-btn,
.todo-form-actions .secondary-btn {
  min-width: 116px;
  margin: 0;
}

.todo-status {
  color: var(--muted);
  font-size: 14px;
}

.todo-toolbar {
  display: flex;
  margin-bottom: 20px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.todo-tabs {
  display: inline-flex;
  padding: 5px;
  gap: 3px;
  background: #f1edeb;
  border-radius: 12px;
  scrollbar-width: none;
}

.todo-tabs::-webkit-scrollbar {
  display: none;
}

.todo-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  white-space: nowrap;
}

.todo-tabs button.active {
  color: var(--brand);
  font-weight: 550;
  background: #fff;
  box-shadow: 0 2px 8px rgba(75, 55, 48, 0.05);
}

.todo-filters {
  display: grid;
  width: min(440px, 100%);
  grid-template-columns: 1fr 160px;
  gap: 10px;
}

.todo-list {
  display: grid;
  gap: 18px;
}

.todo-task {
  display: grid;
  padding: 18px;
  align-items: start;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  background: #fbf9f8;
  border: 1px solid transparent;
  border-radius: 14px;
}

.todo-task.is-focused {
  border-color: rgba(207, 75, 69, 0.5);
  box-shadow: 0 0 0 3px rgba(207, 75, 69, 0.08);
}

.todo-task.is-overdue {
  background: #fff7f5;
}

.todo-task.is-completed {
  opacity: 0.68;
}

.todo-task-check {
  display: grid;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  padding: 0;
  place-items: center;
  color: transparent;
  background: #fff;
  border: 1px solid #cfc9c6;
  border-radius: 7px;
}

.todo-task-check.checked {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.todo-task-main h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 550;
  line-height: 1.45;
}

.todo-task.is-completed h3 {
  text-decoration: line-through;
}

.todo-task-meta,
.todo-task-badges,
.todo-task-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.todo-task-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.todo-task-badges {
  margin-top: 10px;
}

.todo-task-badges span {
  padding: 4px 9px;
  color: var(--muted);
  font-size: 13px;
  background: #f0ecea;
  border-radius: 999px;
}

.todo-task-badges .priority-p0,
.todo-task-badges .priority-p1,
.todo-task-badges .overdue-badge {
  color: var(--brand);
  background: var(--brand-pale);
}

.todo-task-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
  white-space: pre-wrap;
}

.todo-reminder-grid {
  display: grid;
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.todo-reminder-builder,
.todo-interval-builder {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--todo-card-radius);
}

.todo-interval-builder {
  display: grid;
  align-content: start;
  gap: 14px;
}

.todo-reminder-builder-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.todo-reminder-builder-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 550;
}

.todo-reminder-builder-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.todo-reminder-builder-heading > span {
  flex: 0 0 auto;
  color: var(--brand);
  font-size: 14px;
}

.todo-reminder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.todo-reminder-chips > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 7px 5px 12px;
  color: var(--brand);
  background: var(--brand-pale);
  border: 1px solid #f2c8c4;
  border-radius: 999px;
  font-size: 14px;
}

.todo-reminder-chips > .todo-reminder-chip {
  width: 100%;
  justify-content: space-between;
  padding: 10px 10px 10px 13px;
  border-radius: var(--todo-control-radius);
}

.todo-reminder-chip-content {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.todo-reminder-chip-content strong {
  color: var(--brand);
  font-weight: 550;
}

.todo-reminder-chip-content small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.todo-reminder-chips button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: currentColor;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.todo-reminder-empty {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.todo-reminder-add,
.todo-custom-interval {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.todo-reminder-add {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.todo-reminder-add input {
  width: 100%;
}

.todo-reminder-add select {
  width: 100%;
  min-width: 0;
}

.todo-reminder-add > label:not(.todo-reminder-mini),
.todo-reminder-add > button {
  align-self: end;
}

.todo-reminder-add > button.secondary-btn {
  width: 100%;
  height: var(--todo-control-height);
  min-height: var(--todo-control-height);
  padding: 0 14px;
  color: var(--brand);
  background: #fff;
  border: 1px solid var(--todo-control-border);
  border-radius: var(--todo-control-radius);
  box-shadow: none;
}

.todo-reminder-add > button.secondary-btn:hover,
.todo-reminder-add > button.secondary-btn:focus-visible {
  background: var(--brand-pale);
  border-color: rgba(207, 75, 69, 0.45);
}

.todo-reminder-add input,
.todo-reminder-add select,
.todo-custom-interval input,
.todo-custom-interval select,
.todo-field input,
.todo-field select,
.todo-filters input,
.todo-filters select {
  height: var(--todo-control-height);
  min-height: var(--todo-control-height);
  border: 1px solid var(--todo-control-border);
  border-radius: var(--todo-control-radius);
}

.todo-reminder-mini {
  display: grid;
  gap: 5px;
}

.todo-reminder-mini > span {
  color: var(--muted);
  font-size: 13px;
}

.todo-custom-interval[hidden] {
  display: none;
}

.todo-custom-interval > span {
  color: var(--ink);
}

.todo-custom-interval input {
  width: 100px;
}

.todo-custom-interval select {
  min-width: 110px;
}

.todo-custom-interval small {
  flex: 1 1 260px;
  color: var(--muted);
  line-height: 1.5;
}

.todo-task-actions {
  justify-content: flex-end;
}

.todo-task-icon {
  width: 34px;
  height: 34px;
}

.todo-empty {
  padding: 55px 20px;
  color: var(--muted);
  text-align: center;
}

.todo-empty svg {
  color: var(--brand);
}

.todo-empty h3 {
  margin: 13px 0 7px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 550;
}

.todo-empty p {
  margin: 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;
}

@media (max-width: 900px) {
  .todo-header {
    grid-template-columns: 1fr auto;
  }

  .todo-brand {
    display: none;
  }

  .todo-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .todo-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .todo-workspace-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .todo-sync-actions {
    justify-content: space-between;
  }

  .todo-tabs {
    overflow-x: auto;
  }

  .todo-filters {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .todo-header {
    padding: 10px 16px;
  }

  .todo-header .secondary-btn {
    min-height: 40px;
    padding: 0 12px;
  }

  .todo-main {
    width: min(100% - 28px, 1320px);
    padding-top: 30px;
  }

  .todo-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .todo-hero .primary-btn {
    width: 100%;
  }

  .todo-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .todo-summary button {
    min-height: 80px;
    padding: 16px;
  }

  .todo-editor,
  .todo-list-panel {
    padding: 18px;
    border-radius: 15px;
  }

  .todo-list-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .todo-list-heading h2 {
    white-space: nowrap;
  }

  .todo-tabs {
    width: 100%;
  }

  .todo-tabs button {
    padding: 0 14px;
  }

  .todo-form-grid,
  .todo-reminder-grid,
  .todo-filters {
    grid-template-columns: 1fr;
  }

  .todo-task {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .todo-task-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .todo-reminder-builder,
  .todo-interval-builder {
    padding: 15px;
  }

  .todo-reminder-add {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .todo-reminder-add input,
  .todo-reminder-add select,
  .todo-reminder-add button {
    width: 100%;
    min-width: 0;
  }

  .todo-view-tabs,
  .todo-view-tabs button,
  .todo-sync-actions .secondary-btn {
    width: 100%;
  }

  .todo-view-tabs button {
    flex: 1 1 50%;
  }

  .todo-calendar-modal {
    padding: 10px;
  }

  .todo-calendar-dialog {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }

  .todo-calendar-weekdays,
  .todo-calendar-grid {
    gap: 3px;
  }

  .todo-calendar-day {
    min-height: 48px;
  }

  .todo-sync-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
