.family-body {
  background:
    linear-gradient(145deg, rgba(238, 247, 244, 0.96), rgba(255, 251, 244, 0.92) 54%, rgba(248, 246, 241, 0.98)),
    var(--bg);
}

.family-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 34px;
}

.family-top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -18px -18px 0;
  padding: 16px 18px 0;
  background: rgba(248, 246, 241, 0.88);
  backdrop-filter: blur(22px);
}

.family-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.compact-logo {
  margin-bottom: 0;
}

.family-page-title {
  padding-top: 10px;
  margin-bottom: 12px;
}

.compact-logo .logo-text {
  font-size: 1.9rem;
}

.family-logo-text {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.family-logo-text small {
  color: var(--muted);
  font-size: 0.58em;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.family-page-title h1 {
  margin: 0 0 4px;
  font-size: 1.9rem;
  line-height: 1.12;
  font-weight: 700;
}

.person-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.family-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.main-link {
  font-size: 1rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.family-reset-action {
  display: block;
  width: 100%;
  margin: 0 0 10px;
}

.setup-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--soft);
  border-radius: 12px;
  color: var(--primary-dark);
  font-size: 0.95rem;
  font-weight: 500;
}

.install-hint {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: 10px;
}

.install-hint p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.6;
}

.last-updated {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0.7;
}


.family-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.family-person-switch {
  margin-bottom: 10px;
}

.person-switch-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.person-chip {
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(31, 99, 92, 0.06);
}

.person-chip.is-active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 7px 18px rgba(35, 102, 95, 0.18);
}

.person-chip.is-empty {
  color: var(--muted);
  font-weight: 600;
  cursor: default;
}

.settings-person-list {
  margin-bottom: 10px;
}

.person-manage-item {
  display: grid;
  gap: 6px;
}

.person-remove-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.person-remove-button:hover,
.person-remove-button:focus-visible {
  color: #a64d46;
  text-decoration: underline;
}

.family-card {
  margin-bottom: 10px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.primary-card {
  background: linear-gradient(180deg, rgba(238, 247, 244, 0.92), rgba(248, 251, 250, 0.82));
  border-color: rgba(45, 106, 99, 0.28);
}

.primary-card .metric {
  font-size: 2rem;
}


.metric {
  margin: 0;
  color: var(--accent);
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 700;
}

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

.calendar-day {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border: 1px solid rgba(183, 89, 83, 0.2);
  border-radius: 12px;
  background: #fff0ed;
}

.calendar-day span {
  color: #a64d46;
  font-size: 0.68rem;
  font-weight: 500;
}

.calendar-day.is-complete {
  background: var(--soft);
  border-color: rgba(45, 106, 99, 0.38);
}

.calendar-day.is-complete span {
  color: var(--primary-dark);
}

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

.section-title-row h2,
.family-card h2 {
  margin: 0 0 14px;
  font-size: 1.22rem;
  line-height: 1.25;
}

.family-card h3 {
  margin: 0 0 10px;
}

.section-title-row h2 {
  margin-bottom: 0;
}

.pill {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(238, 247, 244, 0.95);
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 500;
}

.topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topic-list span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-weight: 500;
}

.watch-sign-status {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dark);
  font-size: 1rem;
  font-weight: 800;
}

.watch-sign-status.is-watch {
  background: #fff0ed;
  color: #a64d46;
}

.watch-sign-status.is-waiting {
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border: 1px solid var(--line);
}

.watch-sign-details {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.watch-sign-details p {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.55;
}

.watch-sign-note {
  margin-top: 10px;
  font-size: 0.86rem;
}

.check-list {
  padding-left: 1.2em;
}

.check-list li {
  margin: 10px 0;
}

.family-action {
  margin-top: 16px;
  min-height: 68px;
}

.settings-field {
  margin-bottom: 14px;
}

.settings-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.settings-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
}

.settings-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 102, 95, 0.12);
}

.settings-save {
  margin-top: 6px;
  min-height: 52px;
  font-size: 1rem;
}

.settings-save:disabled {
  opacity: 0.7;
  cursor: default;
}

.sync-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.account-status {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin: 12px 0 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: center;
}

.family-logout-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.account-status.is-linked {
  border-color: rgba(35, 102, 95, 0.24);
  background: rgba(35, 102, 95, 0.1);
  color: var(--primary-dark);
}

.issued-code-box {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(35, 102, 95, 0.18);
  border-radius: 14px;
  background: rgba(35, 102, 95, 0.08);
  text-align: center;
}

.issued-code-box p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.issued-code-box strong {
  color: var(--primary-dark);
  font-size: 2rem;
  letter-spacing: 0.22em;
}

.history-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.family-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(14px);
}

.tab-button {
  min-height: 40px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.tab-button.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(35, 102, 95, 0.2);
}

.history-list li {
  display: grid;
  grid-template-columns: 58px 88px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.history-list li:first-child {
  border-top: 0;
}

.history-list span {
  color: var(--muted);
  font-weight: 400;
}

.history-list strong {
  color: var(--primary-dark);
}

.history-list em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.5;
}

.analysis-loading {
  text-align: center;
  color: var(--muted);
  padding: 1.25rem 0;
  font-size: 0.95rem;
}

.analysis-item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.analysis-item:first-child {
  border-top: none;
  padding-top: 0;
}

.analysis-label {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analysis-value {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--ink);
}

.analysis-alert-item .analysis-label {
  color: #a64d46;
}

.analysis-alert-item .analysis-value {
  color: #a64d46;
}

.analysis-message-item {
  margin-top: 4px;
  padding: 12px 14px;
  background: rgba(238, 247, 244, 0.8);
  border: 1px solid rgba(45, 106, 99, 0.16);
  border-radius: 14px;
}

.analysis-message-item .analysis-label {
  color: var(--primary-dark);
}

.analysis-refresh-btn {
  border: none;
  cursor: pointer;
  background: rgba(238, 247, 244, 0.95);
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 600;
}

.analysis-refresh-btn:hover {
  background: var(--soft);
}

@media (max-width: 720px) {
  .history-list li {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .sync-options {
    grid-template-columns: 1fr;
  }
}
