:root {
  --paper: #fffaf4;
  --surface: #ffffff;
  --surface-soft: #f4f8f2;
  --ink: #26322f;
  --muted: #64736d;
  --line: #deded5;
  --sage: #5c816d;
  --sage-deep: #355c4c;
  --coral: #e66b55;
  --coral-soft: #fff0ec;
  --blue: #2f75a8;
  --blue-soft: #edf6fb;
  --amber: #d99d3d;
  --amber-soft: #fff7df;
  --danger: #b5483c;
  --shadow: 0 18px 55px rgba(38, 50, 47, 0.14);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgba(230, 107, 85, 0.12), transparent 28rem),
    linear-gradient(135deg, #fffaf4 0%, #eef6f0 48%, #fdf5e3 100%);
}

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

button {
  min-height: 2.5rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  overflow-wrap: anywhere;
  white-space: normal;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: var(--blue);
}

.app-start {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.58fr);
  align-items: stretch;
}

.start-art {
  position: relative;
  min-height: 100vh;
  padding: clamp(1.25rem, 3vw, 3rem);
  display: flex;
  align-items: flex-end;
  background-image:
    linear-gradient(90deg, rgba(23, 35, 31, 0.72) 0%, rgba(23, 35, 31, 0.43) 46%, rgba(23, 35, 31, 0.05) 100%),
    url("/assets/care-moment.png");
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

.start-copy {
  max-width: 41rem;
  padding-bottom: clamp(1rem, 3vw, 3rem);
}

.brand-line {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  letter-spacing: 0;
  min-width: 0;
}

.brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--sage-deep);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.brand-mark svg {
  width: 1.45rem;
  height: 1.45rem;
}

.start-copy h1 {
  margin: 1.1rem 0 0.45rem;
  font-size: clamp(2.55rem, 6.6vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.start-copy p {
  max-width: 34rem;
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
}

.start-panel {
  min-height: 100vh;
  padding: clamp(1rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  background: rgba(255, 250, 244, 0.96);
  border-left: 1px solid rgba(255, 255, 255, 0.45);
}

.panel-card {
  width: min(100%, 30rem);
  margin: 0 auto;
  padding: clamp(1.1rem, 3vw, 1.55rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0;
  color: var(--sage-deep);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-card h2,
.section-head h2,
.side-section h2,
.owner-panel h2 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.panel-card p {
  color: var(--muted);
  line-height: 1.5;
}

.language-select,
.date-input,
.field input,
.field select,
.field textarea,
.inline-field input,
.inline-field select,
.task-edit input,
.task-edit select,
.task-edit textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  min-height: 2.65rem;
  padding: 0.62rem 0.72rem;
  outline: none;
}

.language-select {
  width: auto;
  min-width: 8.5rem;
}

.field textarea,
.task-edit textarea {
  min-height: 5.8rem;
  resize: vertical;
  line-height: 1.42;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin: 0.82rem 0;
}

.inline-field {
  min-width: 0;
  display: grid;
  gap: 0.4rem;
}

.field span,
.inline-field span,
.task-edit label span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.inline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.66rem 0.9rem;
  font-weight: 800;
  min-width: 0;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--sage-deep);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(53, 92, 76, 0.22);
}

.btn-secondary {
  background: var(--surface-soft);
  color: var(--sage-deep);
  border-color: rgba(92, 129, 109, 0.25);
}

.btn-coral {
  background: var(--coral);
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  color: var(--sage-deep);
  border-color: var(--line);
}

.btn-danger {
  background: #fff4f1;
  color: var(--danger);
  border-color: rgba(181, 72, 60, 0.3);
}

.btn-small {
  min-height: 2.15rem;
  padding: 0.42rem 0.65rem;
  font-size: 0.88rem;
}

.saved-box,
.generated-link {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(47, 117, 168, 0.24);
  border-radius: 8px;
  background: var(--blue-soft);
}

.generated-link code {
  display: block;
  margin: 0.55rem 0;
  padding: 0.58rem;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: #ffffff;
  color: #174f74;
}

.error-text {
  margin: 0.65rem 0 0;
  color: var(--danger);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(222, 222, 213, 0.8);
  background: rgba(255, 250, 244, 0.92);
  backdrop-filter: blur(16px);
}

.topbar .brand-line {
  color: var(--ink);
}

.recipient-title {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.recipient-title strong {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.recipient-title span {
  color: var(--muted);
  font-size: 0.86rem;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.top-actions > label,
.top-actions > .btn {
  flex: 0 1 auto;
}

.workspace {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 1rem;
}

.care-main,
.care-side {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.day-band,
.side-section,
.archive-panel,
.owner-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 36px rgba(38, 50, 47, 0.08);
}

.day-band {
  overflow: hidden;
}

.day-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 1.1rem;
  background:
    linear-gradient(90deg, rgba(53, 92, 76, 0.92), rgba(47, 117, 168, 0.72)),
    url("/assets/care-moment.png");
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

.day-hero > * {
  min-width: 0;
}

.section-head {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.section-head h2,
.task-title h3,
.owner-block h3,
.panel-card h2 {
  overflow-wrap: anywhere;
}

.section-head p,
.side-section p,
.owner-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.42;
}

.day-hero .section-head p {
  color: rgba(255, 255, 255, 0.84);
}

.day-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
}

.date-input {
  width: 11rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 1rem;
  background: rgba(244, 248, 242, 0.86);
  border-bottom: 1px solid var(--line);
}

.summary-item {
  min-height: 5.4rem;
  padding: 0.8rem;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(92, 129, 109, 0.18);
}

.summary-item strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
}

.summary-item span {
  display: block;
  margin-top: 0.32rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.task-list {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-width: 0;
}

.task-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
}

.task-title {
  min-width: 0;
}

.task-title h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.task-title p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  line-height: 1.42;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.22rem 0.48rem;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--sage-deep);
  font-size: 0.78rem;
  font-weight: 800;
}

.chip-blue {
  background: var(--blue-soft);
  color: #174f74;
}

.chip-amber {
  background: var(--amber-soft);
  color: #805512;
}

.chip-coral {
  background: var(--coral-soft);
  color: var(--danger);
}

.status-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
  min-width: min(19rem, 100%);
}

.status-btn {
  min-height: 2.3rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  min-width: 0;
}

.status-btn.active.done {
  border-color: rgba(92, 129, 109, 0.55);
  background: var(--surface-soft);
  color: var(--sage-deep);
}

.status-btn.active.skipped {
  border-color: rgba(217, 157, 61, 0.55);
  background: var(--amber-soft);
  color: #805512;
}

.status-btn.active.attention {
  border-color: rgba(230, 107, 85, 0.52);
  background: var(--coral-soft);
  color: var(--danger);
}

.task-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  min-width: 0;
}

.task-note input {
  min-height: 2.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

.byline {
  color: var(--muted);
  font-size: 0.82rem;
}

.side-section,
.archive-panel,
.owner-panel {
  padding: 1rem;
}

.owner-panel {
  grid-column: 1 / -1;
}

.archive-panel {
  display: grid;
  gap: 0.9rem;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.55rem;
}

.archive-day {
  min-height: 5.4rem;
  display: grid;
  gap: 0.22rem;
  align-content: center;
  justify-items: start;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.archive-day strong,
.archive-day span,
.archive-day em {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.archive-day strong {
  font-size: 0.95rem;
}

.archive-day span,
.archive-day em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 700;
}

.archive-day.active {
  border-color: rgba(92, 129, 109, 0.65);
  background: var(--surface-soft);
  color: var(--sage-deep);
}

.log-form,
.observation-form {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.log-list,
.observation-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.log-item,
.observation-item {
  display: grid;
  gap: 0.4rem;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.rating-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.38rem;
}

.rating-field legend {
  padding: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.34rem;
}

.rating-choice {
  min-width: 0;
  cursor: pointer;
}

.rating-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-choice span {
  min-height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.rating-faces .rating-choice span {
  font-size: 1.28rem;
}

.rating-choice input:checked + span {
  border-color: rgba(92, 129, 109, 0.72);
  background: var(--surface-soft);
  color: var(--sage-deep);
  box-shadow: inset 0 0 0 1px rgba(92, 129, 109, 0.18);
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.metric-pill {
  min-height: 1.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--sage-deep);
  font-size: 0.84rem;
  font-weight: 800;
}

.privacy-note {
  padding: 1rem;
  border: 1px solid rgba(92, 129, 109, 0.24);
  border-radius: 8px;
  background: rgba(244, 248, 242, 0.82);
}

.privacy-note h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.privacy-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.privacy-note.compact {
  margin-top: 1rem;
  padding: 0.75rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.log-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.log-message {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.42;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed rgba(92, 129, 109, 0.45);
  border-radius: 8px;
  background: rgba(244, 248, 242, 0.62);
  color: var(--muted);
  line-height: 1.45;
}

.owner-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.owner-block {
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.owner-block:first-child {
  padding-top: 0;
  border-top: 0;
}

.owner-block:nth-child(3) {
  grid-column: 1 / -1;
}

.owner-block h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.task-edit {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.task-edit:first-of-type {
  border-top: 0;
}

.task-edit label {
  display: grid;
  gap: 0.35rem;
}

.member-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-width: 0;
}

.member-row strong {
  display: block;
}

.member-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  max-width: min(26rem, calc(100vw - 2rem));
  padding: 0.8rem 0.95rem;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(0.6rem);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(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: 1020px) {
  .app-start {
    grid-template-columns: 1fr;
  }

  .start-art {
    min-height: 44vh;
    align-items: flex-end;
  }

  .start-panel {
    min-height: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .owner-grid {
    grid-template-columns: 1fr;
  }

  .owner-block:nth-child(3) {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .topbar,
  .day-hero,
  .task-top,
  .task-note,
  .member-row {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .day-controls {
    justify-content: flex-start;
  }

  .top-actions > label,
  .top-actions > .btn,
  .day-controls > .btn,
  .day-controls > .date-input,
  .actions-row > .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .summary-strip,
  .inline-grid {
    grid-template-columns: 1fr;
  }

  .status-group {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .start-copy h1 {
    font-size: clamp(2.25rem, 16vw, 4rem);
  }

  .language-select,
  .date-input {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .workspace,
  .task-list,
  .summary-strip {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .topbar,
  .day-hero,
  .side-section,
  .archive-panel,
  .owner-panel,
  .panel-card {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .start-panel {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .summary-item {
    min-height: 4.5rem;
  }
}
