body {
    background-color: #B5D692;
    font-family: 'Paperlogy', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

body.p-md-4 {
    font-weight: 500;
    word-break: keep-all;
    max-width: 680px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.footer {
    display: flex;
    justify-content: flex-end;
    /* 내용을 오른쪽 끝으로 */
    padding: 12px 16px;
}

.row {
    padding-bottom: 20px;
}

.family-card {
    border-radius: 20px;
}

.chat-container {
    max-width: 640px;
    height: 100vh;
    margin: auto;
    background: #c4dba9;
    display: flex;
    flex-direction: column;
}

/* 상단 */
.chat-header {
    background: #c4dba9;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.chat-header h5 {
    font-size: 17px;
    font-weight: bold;
    margin: 0;
}

/* 메시지 영역 */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
}

.date-divider {
    text-align: center;
    margin: 10px 0 25px;
}

.date-divider span {
    background: rgba(0, 0, 0, .15);
    color: white;
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 20px;
}

/* 메시지 공통 */
.message-row {
    display: flex;
    margin-bottom: 18px;
    align-items: flex-end;
}

.message-row.me {
    justify-content: flex-end;
}

.profile {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: #fff;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.message-content {
    max-width: 75%;
}

.user-name {
    font-size: 12px;
    margin-bottom: 5px;
    color: #333;
}

.bubble {
    padding: 9px 12px;
    border-radius: 4px 12px 12px 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    background: white;
    color: #222;
    display: inline-block;
}

.me .bubble {
    background: #fffbdc;
    border-radius: 12px 4px 12px 12px;
}

.message-time {
    font-size: 10px;
    color: #555;
    margin: 0 5px 2px;
    white-space: nowrap;
}

/* 입력 영역 */
.chat-footer {
    width: 100%;
    background: #fff;
    padding: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-footer textarea,
.chat-footer input {
    resize: none;
    border: none;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    max-height: 100px;
}

.chat-footer textarea:focus {
    box-shadow: none;
    background: #f5f5f5;
}

.send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #fee500;
    font-size: 18px;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #f5dc00;
}

.app {
    max-width: 480px;
    height: 100dvh;
    margin: auto;
    background: white;
    display: flex;
    flex-direction: column;
}

.header {
    background: #fee500;
    padding: 17px;
}

.room-list {
    flex: 1;
    overflow-y: auto;
}

.room-item {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.room-item:hover,
.room-item.active {
    background: #fffbea;
}

.room-icon {
    width: 48px;
    height: 48px;
    border-radius: 17px;
    background: #f2f2f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.room-avatar {
    padding-right: 14px;
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-info p {
    color: #888;
    font-size: 13px;
    margin: 4px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-time {
    color: #999;
    font-size: 11px;
}

.chat-area {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: #abc1d1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
}

.chat-row {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-end;
}

.chat-row.me {
    justify-content: flex-end;
}

.chat-name {
    font-size: 12px;
    margin-bottom: 4px;
}

.chat-bubble {
    background: white;
    border-radius: 4px 12px 12px 12px;
    padding: 9px 12px;
    font-size: 14px;
    max-width: 250px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.chat-row.me .chat-bubble {
    background: #fee500;
    border-radius: 12px 4px 12px 12px;
}

.chat-time {
    font-size: 10px;
    color: #555;
    margin: 0 5px;
    white-space: nowrap;
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
}

.chat-input textarea {
    resize: none;
    border: none;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 10px 15px;
}

.chat-input textarea:focus {
    box-shadow: none;
}

.send-btn {
    border: none;
    background: #fee500;
    border-radius: 50%;
    width: 42px;
    height: 42px;
}

.empty {
    text-align: center;
    color: #888;
    padding: 50px 15px;
}


/* 상단 헤더 */
.main-header {
    background: #fee500;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title h5 {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

.header-title span {
    font-size: 11px;
    color: #555;
}

.header-icons {
    display: flex;
    gap: 12px;
}

.header-icons button {
    border: none;
    background: transparent;
    font-size: 20px;
}

/* 가로 메뉴 */
.top-menu {
    display: flex;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 0 5px;
}

.menu-item {
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 13px 2px 11px;
    font-size: 12px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.menu-item i {
    font-size: 21px;
}

.menu-item.active {
    color: #222;
    font-weight: bold;
    border-bottom-color: #fee500;
}

.menu-item:hover {
    color: #222;
    background: #fffdf0;
}


/* 가족 목록 전체 */
.family-section {
    padding: 18px 12px;
}

/* 제목 */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title strong {
    font-size: 15px;
}

.section-title small {
    color: #999;
    font-size: 12px;
}

/* 가족 목록 - 한 줄에 5명 */
.family-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    row-gap: 18px;
}

/* 가족 구성원 */
.family-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    min-width: 0;
}

.family-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 27px;
    border: 1px solid #eee;
}

.family-member span {
    font-size: 12px;
    color: #444;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.family-member:hover .family-avatar {
    background: #fff5bf;
    transform: scale(1.05);
    transition: .2s;
}

/*헤더 CSS*/
/* 상단 둥근 카드형 헤더 메뉴 */
.top-nav-card {
    background-color: #ffffff;
    border-radius: 18px;
    padding: 12px 18px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.nav-menu-list {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-menu-item {
    text-decoration: none;
    color: #666666;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.nav-menu-item:hover {
    background-color: #F1F5EC;
    color: #3D5A20;
}

/* ★ 현재 페이지일 때 활성화되는 스타일 */
.nav-menu-item.active {
    border-radius: 0px;
    border-bottom: solid;
    border-color: #8FB369;
    font-weight: 700;
    /* background-color: #8FB369; 
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(143, 179, 105, 0.35); */
}

/* 오른쪽 내 프로필 & 로그아웃 버튼 */
.nav-user-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.my-badge {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3D5A20;
    background-color: #F1F5EC;
    padding: 5px 11px;
    border-radius: 20px;
}

.logout-icon-btn {
    background: none;
    border: none;
    color: #888888;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 4px;
}

.logout-icon-btn:hover {
    color: #191919;
}

.app-wrapper {
    max-width: 680px;
    margin: 0 auto;
}

/* 공통 둥근 흰색 카드 */
.card-box {
    background-color: #ffffff;
    border-radius: 18px;
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 날짜 & 요일 필터 바 */
.today-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.today-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #191919;
    margin: 0;
}

.today-badge {
    background-color: #8FB369;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 5px 12px;
    border-radius: 20px;
}

/* 요일 탭 (상단 조회용) */
.day-tabs {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.day-tab-btn {
    border: 1px solid #E2E5E9;
    background-color: #F8F9FA;
    color: #555555;
    border-radius: 12px;
    padding: 8px 0;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.day-tab-btn.active {
    background-color: #8FB369;
    border-color: #8FB369;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(143, 179, 105, 0.35);
}

/* 새 할 일 입력 폼 */
.todo-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.todo-input-row input {
    border-radius: 12px;
    border: 1px solid #DCE0E5;
    padding: 10px 14px;
    font-size: 0.95rem;
}

.todo-input-row input:focus {
    border-color: #8FB369;
    box-shadow: 0 0 0 3px rgba(143, 179, 105, 0.2);
}

.add-btn {
    background-color: #8FB369;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 0 20px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.add-btn:hover {
    background-color: #7DA157;
}

/* 요일 다중 선택 버튼 (등록용) */
.day-select-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}

.day-check-label {
    flex: 1;
    text-align: center;
    min-width: 36px;
    padding: 6px 0;
    border-radius: 10px;
    border: 1px solid #E2E5E9;
    background-color: #ffffff;
    color: #666666;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}

.day-check-input:checked+.day-check-label {
    background-color: #8FB369;
    border-color: #8FB369;
    color: #191919;
    font-weight: 800;
}

/* 할 일 목록 헤더 */
.list-header-bar {
    background-color: #8FB369;
    color: #ffffff;
    padding: 14px 22px;
    border-radius: 18px 18px 0 0;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.todo-list-body {
    background-color: #ffffff;
    border-radius: 0 0 18px 18px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.todo-item {
    padding: 15px 22px;
    border-bottom: 1px solid #F1F3F5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background-color 0.15s;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item:hover {
    background-color: #FAFAFA;
}

.todo-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    cursor: pointer;
}

.todo-checkbox {
    width: 22px;
    height: 22px;
    accent-color: #8FB369;
    cursor: pointer;
}

.todo-text {
    font-size: 0.98rem;
    color: #191919;
    font-weight: 500;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: #999999;
}

.todo-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.day-tags {
    font-size: 0.75rem;
    color: #5C7A3B;
    background-color: #F1F5EC;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 600;
}

.delete-btn {
    background: none;
    border: none;
    color: #BBBBBB;
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
}

.delete-btn:hover {
    color: #E03131;
}

.empty-todo {
    padding: 50px 20px;
    text-align: center;
    color: #8C8C8C;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
  /* 1. 바깥 여백 축소 (화면을 넓게 쓰기 위해) */
  body {
    padding: 12px 10px;
  }

  .app-wrapper {
    max-width: 100%;
  }

  /* 2. 상단 헤더 메뉴 (작은 화면에서 줄바꿈 및 터치 영역 확보) */
  .top-nav-card {
    padding: 10px 12px;
    border-radius: 14px;
    gap: 8px;
  }

  .nav-menu-list {
    gap: 4px;
  }

  .nav-menu-item {
    padding: 6px 10px;
    font-size: 0.84rem;
    border-radius: 10px;
  }

  .my-badge {
    font-size: 0.78rem;
    padding: 4px 8px;
  }

  /* 3. 공통 카드 박스 패딩 축소 */
  .card-box,
  .family-section {
    padding: 16px 16px;
    border-radius: 15px;
    margin-bottom: 12px;
  }

  /* 4. 가족 구성원 아바타 가로 스크롤 및 크기 조정 */
  .family-list {
    gap: 14px;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

  .family-list::-webkit-scrollbar {
    display: none;
  }

  .member-avatar {
    width: 54px;
    height: 54px;
    font-size: 1.6rem;
  }

  /* 5. 할 일(Todo) 입력창 & 요일 버튼 모바일 최적화 */
  .todo-input-row input {
    font-size: 16px; /* ★ iOS 사파리에서 입력창 터치 시 화면이 강제 확대(줌인)되는 현상 방지 */
    padding: 10px 12px;
  }

  .add-btn {
    padding: 0 16px;
    font-size: 0.9rem;
  }

  .day-select-group {
    gap: 4px;
  }

  .day-check-label {
    min-width: 32px;
    padding: 7px 0;
    font-size: 0.82rem;
  }

  .todo-item {
    padding: 13px 16px;
  }

  .todo-text {
    font-size: 0.92rem;
  }
}