:root {
  color-scheme: light;
  --ink: #221f22;
  --muted: #75696d;
  --line: #eadedc;
  --surface: #fffdfb;
  --soft: #faf4f2;
  --brand: #c85b5b;
  --brand-strong: #a8434d;
  --accent: #3c72b8;
  --warn: #b84b4b;
  --ok: #3e7f70;
  --shadow: 0 14px 40px rgba(94, 61, 66, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f8f1ef;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(100%, 920px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--soft);
}

.onboarding {
  display: grid;
  align-content: center;
  min-height: 100vh;
  padding: 28px 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border: 1px solid rgba(200, 91, 91, 0.18);
  border-radius: 16px;
  background: #fff8f5;
  box-shadow: 0 10px 24px rgba(60, 114, 184, 0.14);
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.onboarding h1,
.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.lead {
  max-width: 560px;
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.7;
}

.panel,
.quick-create,
.calendar-panel,
.item-card,
.app-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  display: grid;
  gap: 14px;
  width: min(100%, 520px);
  padding: 18px;
}

.panel h2,
.app-dialog h2 {
  margin: 0;
  font-size: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: #443638;
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #e2cfcf;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(200, 91, 91, 0.15);
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.item-actions button {
  min-height: 42px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 750;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.secondary-button,
.icon-button,
.item-actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-button {
  background: #fff2ef;
  color: #8d2f23;
  border: 1px solid #ecc5ba;
}

.full-width {
  width: 100%;
}

.muted {
  color: var(--muted);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 244, 242, 0.96);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 154px;
}

.icon-button {
  min-width: 58px;
}

.member-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.member-chip,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f4e7e4;
  color: #514347;
  font-size: 12px;
  font-weight: 720;
}

.member-chip strong {
  color: var(--brand);
}

.remembered-member-list {
  display: grid;
  gap: 8px;
}

.remembered-title {
  color: #443638;
  font-size: 13px;
  font-weight: 850;
}

.remembered-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.remembered-member-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f5;
  color: var(--brand);
  padding: 8px 11px;
  font-weight: 800;
}

.remembered-empty {
  margin: 0;
  font-size: 13px;
}

.compact-entry {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-entry button {
  flex: 1 1 150px;
}

.quick-create,
.calendar-panel,
.filter-tabs,
.item-list {
  margin: 16px 18px 0;
}

.quick-create,
.calendar-panel {
  padding: 14px;
}

.voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.voice-header h2 {
  margin: 0;
  font-size: 18px;
}

.voice-button {
  min-width: 74px;
  min-height: 74px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
}

.voice-button.recording {
  background: #8d2f23;
}

.voice-button.processing {
  background: #6e7480;
  cursor: wait;
}

.voice-note {
  min-height: 96px;
  font-size: 17px;
  line-height: 1.55;
}

.simple-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.quick-submit-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) auto;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.quick-submit-row .visibility-create,
.quick-submit-row .simple-actions {
  margin-top: 0;
}

.quick-submit-row .primary-button {
  white-space: nowrap;
}

.visibility-create {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.visibility-create label {
  max-width: 220px;
}

.visibility-members {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f5;
  padding: 9px;
}

.visibility-members > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.member-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  border: 1px solid #eadedc;
  border-radius: 999px;
  background: #fff;
  color: #443638;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 760;
}

.member-checkbox input {
  width: 14px;
  height: 14px;
}

.advanced-create {
  margin-top: 10px;
}

.advanced-create summary {
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 820;
  cursor: pointer;
}

.advanced-create summary::marker {
  color: var(--brand);
}

.input-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.create-grid label {
  gap: 5px;
  min-width: 0;
  font-size: 13px;
}

.create-grid input,
.create-grid select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}

.toggle-label {
  display: inline-flex;
  grid-template-columns: auto;
  align-items: center;
  gap: 8px;
  width: auto;
  font-weight: 700;
}

.toggle-label input {
  width: 18px;
  height: 18px;
}

.custom-label-row {
  display: grid;
  grid-template-columns: 18px minmax(150px, 1fr);
  align-items: center;
  gap: 8px;
  flex: 1 1 320px;
  min-width: 260px;
  margin: 0;
}

.custom-label-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
}

.custom-label-row .custom-label {
  min-width: 0;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-header h2 {
  margin: 0;
  font-size: 18px;
}

.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.calendar-controls button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 820;
}

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

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  text-align: center;
}

.calendar-day {
  display: grid;
  grid-template-rows: auto auto minmax(20px, 1fr);
  align-content: start;
  gap: 2px;
  min-height: 62px;
  border: 1px solid #dce6e1;
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 5px;
  text-align: left;
}

.calendar-day.outside-month {
  background: #f0f4f2;
  color: #87938f;
}

.calendar-day.today {
  border-color: var(--accent);
}

.calendar-day.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(49, 92, 86, 0.12);
}

.calendar-day.urgent-deadline {
  border-color: #d84d4d;
  background: #fff1f1;
  box-shadow: inset 0 0 0 1px rgba(216, 77, 77, 0.2);
  animation: calendarPulse 1.25s ease-in-out infinite;
}

.calendar-day.overdue-deadline {
  border-color: #a6afab;
  background: #eef1f0;
  color: #59645f;
}

.calendar-day.urgent-deadline .calendar-count,
.calendar-day.urgent-deadline .calendar-date {
  color: #a92f2f;
}

.calendar-date {
  font-size: 13px;
  font-weight: 850;
}

.calendar-count {
  min-height: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.calendar-day-events {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.calendar-event {
  display: block;
  min-width: 0;
  border-left: 3px solid var(--calendar-owner-color, var(--brand));
  border-radius: 6px;
  background: var(--calendar-owner-bg, #edf5f1);
  color: var(--calendar-owner-color, #264a44);
  padding: 2px 4px;
  font-size: 10px;
  font-weight: 760;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-remind {
  border-left-color: #b66a3c;
  background: #fff3e8;
  color: #7d4426;
}

.calendar-event-deadline {
  border-left-color: var(--calendar-owner-color, #a24d36);
  background: var(--calendar-owner-bg, #fff0ec);
  color: var(--calendar-owner-color, #8b3323);
}

.calendar-event-completed {
  border-left-color: var(--ok);
  background: #eef8f1;
  color: #245c3b;
}

.calendar-event.status-overdue {
  border-left-color: #8a9691;
  background: #edf0ef;
  color: #59645f;
}

.calendar-more {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.calendar-detail {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.calendar-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
}

.calendar-detail-head span,
.calendar-empty {
  color: var(--muted);
  font-size: 13px;
}

.calendar-detail-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.calendar-detail-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px;
  text-align: left;
}

.calendar-detail-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-detail-item small {
  color: var(--muted);
  font-weight: 700;
}

@keyframes calendarPulse {
  0%,
  100% {
    filter: saturate(1);
    box-shadow: inset 0 0 0 1px rgba(216, 77, 77, 0.18);
  }

  50% {
    filter: saturate(1.18);
    box-shadow: inset 0 0 0 1px rgba(216, 77, 77, 0.32), 0 0 0 2px rgba(216, 77, 77, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-day.urgent-deadline {
    animation: none;
  }
}

.filter-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.filter-tabs button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #40504b;
  font-weight: 800;
}

.filter-tabs button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.item-list {
  display: grid;
  gap: 12px;
  padding-bottom: 34px;
}

.item-card {
  padding: 14px;
  box-shadow: none;
}

.item-card.status-due,
.item-card.status-follow_up {
  border-color: #d9997e;
}

.item-card.status-completed {
  border-color: #79b58c;
  background: #f5fbf7;
}

.item-card.status-rejected {
  border-color: #d88a80;
  background: #fff7f5;
}

.item-card.status-overdue {
  border-color: #c8d0cc;
  background: #f1f3f2;
  color: #5a6460;
}

.item-card h2 {
  margin: 9px 0 0;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-timeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  border: 1px solid #dfe8e3;
  border-radius: 8px;
  background: #f8fbf9;
  padding: 7px 8px;
}

.status-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #70807b;
  font-size: 12px;
  font-weight: 780;
  line-height: 1;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #c5d1cc;
}

.status-step.done {
  color: #53645f;
}

.status-step.done .status-dot {
  background: #8aa69d;
}

.status-step.current {
  color: var(--ink);
}

.status-step.current .status-dot {
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(49, 92, 86, 0.14);
}

.status-arrow {
  color: #9aa9a4;
  font-size: 12px;
  line-height: 1;
}

.timeline-completed {
  border-color: #cde8d5;
  background: #f3fbf6;
}

.timeline-completed .status-step.current {
  color: #1f6b3a;
}

.timeline-completed .status-step.current .status-dot {
  background: var(--ok);
}

.timeline-rejected {
  border-color: #edcac4;
  background: #fff7f5;
}

.timeline-rejected .status-step.current {
  color: #a22820;
}

.timeline-rejected .status-step.current .status-dot {
  background: #a22820;
}

.timeline-paused .status-step.current {
  color: #8b541c;
}

.timeline-paused .status-step.current .status-dot {
  background: #b66a3c;
}

.timeline-overdue {
  border-color: #d7ddda;
  background: #f2f4f3;
}

.timeline-overdue .status-step.current {
  color: #5c6762;
}

.timeline-overdue .status-step.current .status-dot {
  background: #7b8782;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-pill {
  background: #e8f2ef;
  color: var(--brand);
}

.attention-pill {
  background: #fff2df;
  color: #8b541c;
}

.money-pill {
  background: #f5e7e1;
  color: #86412d;
}

.visibility-pill {
  background: #edf4ff;
  color: #2f66c5;
}

.warm-tip-pill {
  background: #fff3e5;
  color: #9a5a20;
}

.custom-label-pill {
  background: #f3e8ef;
  color: #8b4565;
}

.repeat-pill {
  background: #eaf3ef;
  color: #2f7d5b;
}

.custom-label {
  min-width: 0;
}

.item-description,
.item-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 12px;
  color: #4f625c;
  font-size: 13px;
  font-weight: 680;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.field-grid div,
.field-grid label {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcfb;
  padding: 9px;
}

.field-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.field-grid strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.field-control {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

.field-control:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(49, 92, 86, 0.16);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.item-actions button {
  min-height: 38px;
  padding: 8px 11px;
}

.item-actions .reject-action {
  border-color: #efc2bc;
  background: #fff3f1;
  color: #9d2f25;
}

.empty-state {
  border: 1px dashed #bbc9c3;
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  text-align: center;
}

.app-dialog {
  width: min(92vw, 560px);
  border: 1px solid var(--line);
  padding: 18px;
}

.app-dialog::backdrop {
  background: rgba(11, 25, 22, 0.35);
}

.detail-form,
#rename-form {
  display: grid;
  gap: 12px;
}

.activity-log {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.activity-log h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.activity-log p {
  margin: 7px 0;
  color: var(--muted);
  font-size: 13px;
}

.activity-log span {
  color: #7a8883;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 20;
  max-width: min(520px, calc(100vw - 28px));
  transform: translateX(-50%);
  border-radius: 8px;
  background: #17211f;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    padding: 14px;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .topbar-actions {
    min-width: 116px;
  }

  .icon-button {
    min-width: 52px;
    padding-inline: 9px;
  }

  .quick-create,
  .calendar-panel,
  .filter-tabs,
  .item-list {
    margin-inline: 12px;
  }

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

  .voice-header {
    align-items: flex-start;
  }

  .input-line {
    grid-template-columns: 1fr;
  }

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

  .calendar-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-controls {
    width: 100%;
  }

  .calendar-controls button {
    flex: 1;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    min-height: 54px;
    padding: 4px;
  }

  .calendar-event {
    padding-inline: 4px;
  }

  .calendar-detail-item {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .calendar-detail-item small {
    grid-column: 2;
  }
}

@media (min-width: 721px) {
  .app-shell {
    width: min(100%, 1080px);
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .member-row {
    gap: 6px;
    margin-top: 7px;
  }

  .quick-create,
  .calendar-panel,
  .filter-tabs,
  .item-list {
    margin: 12px 16px 0;
  }

  .quick-create,
  .calendar-panel,
  .item-card {
    padding: 10px;
  }

  .panel {
    gap: 10px;
    padding: 14px;
  }

  label {
    gap: 4px;
    font-size: 13px;
  }

  input,
  select,
  textarea {
    padding: 7px 9px;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .icon-button,
  .item-actions button {
    min-height: 34px;
    padding: 7px 10px;
  }

  .voice-header {
    margin-bottom: 8px;
  }

  .voice-header h2 {
    font-size: 16px;
  }

  .voice-button {
    min-width: 54px;
    min-height: 54px;
  }

  .voice-note {
    min-height: 62px;
    font-size: 15px;
    line-height: 1.45;
  }

  .calendar-header {
    margin-bottom: 8px;
  }

  .calendar-header h2 {
    font-size: 16px;
  }

  .calendar-day {
    min-height: 52px;
    padding: 4px;
  }

  .advanced-create summary {
    padding: 6px 9px;
  }

  .field-grid {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 6px;
    margin-top: 9px;
  }

  .field-grid div,
  .field-grid label {
    padding: 7px;
  }

  .item-card h2 {
    margin-top: 6px;
    font-size: 16px;
  }

  .status-timeline {
    margin-top: 8px;
    padding: 6px 7px;
  }

  .item-actions {
    gap: 6px;
    margin-top: 10px;
  }
}

@media (max-width: 390px) {
  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .icon-button {
    flex: 1;
  }
}
