:root {
  color-scheme: light;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #202521;
  background: #eceeea;
  font-synthesis: none;
  --surface: #ffffff;
  --canvas: #f7f7f4;
  --ink: #202521;
  --muted: #6f756f;
  --line: #e1e4df;
  --green: #26715e;
  --green-soft: #e9f3ee;
  --red: #a83d3d;
  --red-soft: #f8eded;
  --amber: #a96718;
  --amber-soft: #fff4de;
  --blue: #37658c;
  --blue-soft: #eaf2f8;
  --shadow: 0 12px 36px rgba(38, 47, 40, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #eceeea;
}

.auth-shell {
  padding-bottom: 0;
}

.auth-main {
  min-height: calc(100vh - 64px);
  padding: 28px 18px;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: 100%;
  max-width: 390px;
  padding: 28px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(38, 47, 40, 0.08);
}

.auth-panel h1 {
  margin: 18px 0 8px;
  font-size: 23px;
  letter-spacing: 0;
}

.auth-panel > p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.auth-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--green);
}

.status-panel {
  text-align: center;
}

.status-panel .auth-mark {
  margin: 0 auto;
}

.form-error {
  margin: -8px 0 14px !important;
  color: var(--red) !important;
  font-size: 13px !important;
}

.field-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.file-control {
  min-height: 48px;
  padding: 9px 10px;
}

.file-control::file-selector-button {
  margin-right: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: #e8ebe7;
}

.event-photo {
  width: min(100%, 280px);
  max-height: 240px;
  margin-top: 10px;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(38, 113, 94, 0.24);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--canvas);
  box-shadow: var(--shadow);
  position: relative;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.app-header {
  height: 64px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 247, 244, 0.96);
  border-bottom: 1px solid rgba(225, 228, 223, 0.75);
}

.brand-lockup {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: white;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.brand-subtitle {
  max-width: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.header-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border-radius: 8px;
}

.icon-button:hover {
  background: #eceeea;
}

.icon-glyph {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  font-size: 19px;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
}

main {
  padding-bottom: 24px;
}

.page-section {
  padding: 18px;
}

.page-section + .page-section {
  padding-top: 0;
}

.person-switcher {
  margin: 6px 18px 16px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #e8ebe7;
  border-radius: 8px;
}

.person-option {
  min-height: 42px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 600;
}

.person-option.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 4px rgba(30, 38, 32, 0.1);
}

.family-hero {
  min-height: 174px;
  position: relative;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: #d8ddd5;
}

.family-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 34%;
}

.family-hero::after {
  content: "";
  position: absolute;
  inset: 56% 0 0;
  background: rgba(21, 26, 22, 0.7);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 18px;
  color: white;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.hero-name {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
}

.hero-meta {
  margin-top: 5px;
  font-size: 13px;
  opacity: 0.9;
}

.status-chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #163f34;
  background: #daf1e6;
  font-size: 12px;
  font-weight: 700;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.overview-item {
  min-width: 0;
  padding: 14px 10px;
  text-align: center;
  position: relative;
}

.overview-item + .overview-item::before {
  content: "";
  width: 1px;
  height: 32px;
  background: var(--line);
  position: absolute;
  left: 0;
  top: 16px;
}

.overview-value {
  display: block;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.overview-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.section-heading span,
.text-button {
  color: var(--muted);
  font-size: 13px;
}

.text-button {
  padding: 6px;
  background: transparent;
}

.progress-block {
  margin-bottom: 14px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.progress-label strong {
  color: var(--green);
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #e2e5e0;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--green);
  transition: width 220ms ease;
}

.task-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.task-row {
  width: 100%;
  min-height: 68px;
  padding: 12px 13px;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 11px;
  align-items: center;
  text-align: left;
  color: var(--ink);
  background: white;
}

.task-row + .task-row {
  border-top: 1px solid var(--line);
}

.task-row:hover {
  background: #fbfcfa;
}

.task-row.readonly {
  cursor: default;
}

.task-check {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: #eff1ee;
}

.task-row.done .task-check {
  color: white;
  background: var(--green);
}

.task-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.task-detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.task-time {
  color: var(--muted);
  font-size: 12px;
}

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

.quick-action {
  min-width: 0;
  padding: 12px 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  font-size: 12px;
}

.action-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
}

.quick-action:nth-child(2) .action-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.quick-action:nth-child(3) .action-icon {
  color: var(--amber);
  background: var(--amber-soft);
}

.quick-action:nth-child(4) .action-icon {
  color: var(--red);
  background: var(--red-soft);
}

.care-note {
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-left: 4px solid var(--amber);
  background: var(--amber-soft);
}

.notice-icon {
  flex: 0 0 auto;
  color: var(--amber);
}

.care-note strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.care-note p {
  margin: 0;
  color: #675331;
  font-size: 12px;
  line-height: 1.6;
}

.timeline {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.event {
  padding: 14px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 11px;
}

.event + .event {
  border-top: 1px solid var(--line);
}

.event-dot {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
}

.event-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.event-title {
  font-size: 14px;
  font-weight: 600;
}

.event-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.event-copy {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 480px);
  height: calc(66px + env(safe-area-inset-bottom));
  padding: 6px 10px env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
}

.nav-button {
  min-width: 0;
  color: var(--muted);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
}

.nav-button.active {
  color: var(--green);
  font-weight: 700;
}

.page-title-block {
  padding: 18px 18px 10px;
}

.page-title-block h1 {
  margin: 0;
  font-size: 22px;
}

.page-title-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.date-strip {
  padding: 6px 18px 16px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.date-cell {
  min-height: 58px;
  padding: 8px 2px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
}

.date-cell strong {
  color: var(--ink);
  font-size: 16px;
}

.date-cell.active {
  color: white;
  background: var(--green);
}

.date-cell.active strong {
  color: white;
}

.summary-banner {
  margin: 0 18px 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #203b33;
  color: white;
}

.summary-banner strong {
  display: block;
  font-size: 15px;
}

.summary-banner span {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,.72);
  font-size: 12px;
}

.summary-number {
  font-size: 26px;
  font-weight: 700;
  white-space: nowrap;
}

.filter-row {
  padding: 0 18px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 18px;
  color: var(--muted);
  background: #e8ebe7;
}

.filter-chip.active {
  color: white;
  background: var(--ink);
}

.trend-panel {
  margin: 0 18px 16px;
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trend-panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.bar-chart {
  height: 96px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 9px;
  align-items: end;
}

.bar-column {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.bar {
  width: 100%;
  max-width: 22px;
  min-height: 8px;
  background: #75a394;
  border-radius: 3px 3px 0 0;
}

.bar-column.today .bar {
  background: var(--red);
}

.bar-column span {
  color: var(--muted);
  font-size: 10px;
}

.family-list {
  margin: 0 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.family-row {
  padding: 14px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
}

.member-copy {
  min-width: 0;
}

.member-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}

.member-action {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.member-action:hover {
  background: #eef0ed;
}

.member-action.danger {
  color: var(--red);
}

.member-action .icon-glyph {
  font-size: 17px;
}

.family-row + .family-row {
  border-top: 1px solid var(--line);
}

.person-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 700;
}

.family-row strong {
  display: block;
  font-size: 14px;
}

.family-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.role-badge {
  padding: 5px 8px;
  border-radius: 4px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  color: white;
  background: var(--green);
}

.secondary-button {
  color: var(--ink);
  background: #eceeea;
}

.danger-button {
  color: white;
  background: var(--red);
}

.full-button {
  width: calc(100% - 36px);
  margin: 16px 18px 0;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(19, 23, 20, 0.5);
}

.sheet {
  width: min(100%, 480px);
  max-height: 88vh;
  overflow-y: auto;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 8px 8px 0 0;
  background: white;
  box-shadow: 0 -12px 36px rgba(0,0,0,.16);
}

.compact-sheet {
  max-height: 440px;
}

@media (max-width: 380px) {
  .family-row {
    grid-template-columns: 42px 1fr;
  }

  .member-side {
    grid-column: 2;
    justify-content: space-between;
  }
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 2px;
  background: #d8dbd7;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 20px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  color: #4d554f;
  font-size: 13px;
  font-weight: 600;
}

.form-control {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid #ccd1cb;
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

textarea.form-control {
  min-height: 92px;
  resize: vertical;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.option-button {
  min-height: 44px;
  padding: 7px;
  border-radius: 8px;
  color: var(--muted);
  background: #f1f2ef;
  border: 1px solid transparent;
}

.option-button.active {
  color: var(--green);
  background: var(--green-soft);
  border-color: #9fc8ba;
  font-weight: 700;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 10px;
  margin-top: 20px;
}

.share-preview {
  padding: 14px;
  margin-bottom: 16px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.share-preview strong {
  display: block;
  font-size: 14px;
}

.share-preview p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.share-link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-link input {
  min-width: 0;
}

.copy-button {
  width: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--green);
}

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 6px;
  color: white;
  background: rgba(26, 32, 28, .94);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.readonly-banner {
  padding: 10px 18px;
  color: #684f1c;
  background: var(--amber-soft);
  border-bottom: 1px solid #ecd6aa;
  text-align: center;
  font-size: 12px;
}

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

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 8px;
    overflow: hidden;
  }

  .bottom-nav {
    bottom: 24px;
    border-radius: 0 0 8px 8px;
  }

  .modal-backdrop {
    align-items: center;
  }

  .sheet {
    border-radius: 8px;
    max-height: 84vh;
  }
}
