/* ═══════════════════════════════════════════════════════════
   포도 아지트 🍇 공통 스타일
   메인 색상: 보라(#7C3AED 계열) + 청포도(#84CC16 계열)
   모던 + 적당히 귀여운 디자인, 백지 공간 최소화
   ═══════════════════════════════════════════════════════════ */

/* ─── 기본 리셋 및 폰트 ─── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Pretendard', -apple-system, 'Noto Sans KR', 'Hiragino Sans', sans-serif;
  /* 은은한 보라~청포도 그라데이션 배경 (백지 느낌 제거) */
  background: linear-gradient(135deg, #F3E8FF 0%, #EDE9FE 35%, #ECFCCB 100%);
  min-height: 100vh;
  color: #3B0764;
}

/* ─── 배경에 떠다니는 장식 포도/이모지 ─── */
.bg-deco {
  position: fixed; font-size: 80px; opacity: 0.12; z-index: 0;
  user-select: none; pointer-events: none;
  animation: floaty 8s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-18px) rotate(5deg); }
}

/* ─── 로그인 카드 (첫 화면) ─── */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 20px; position: relative; z-index: 1;
}
.login-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 32px; padding: 52px 48px; width: 100%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(124, 58, 237, 0.18), 0 4px 12px rgba(132, 204, 22, 0.1);
  border: 2px solid #E9D5FF;
  text-align: center;
}
.site-logo { font-size: 56px; font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(90deg, #7C3AED, #84CC16);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.site-logo-sub { color: #7C3AED; font-size: 18px; font-weight: 700; margin-top: 4px; }
.big-grape { font-size: 120px; line-height: 1.1; margin: 14px 0;
  filter: drop-shadow(0 8px 16px rgba(124, 58, 237, 0.3));
  animation: floaty 5s ease-in-out infinite; display: inline-block; }
.welcome-msg { color: #6D28D9; font-weight: 700; font-size: 21px; margin-top: 4px; }
.welcome-sub { color: #8B5CF6; font-size: 15px; margin: 8px 0 24px; }

/* ─── 입력 필드 ─── */
.grape-input {
  width: 100%; padding: 16px 18px; border-radius: 16px;
  border: 2px solid #DDD6FE; background: #FAF5FF; font-size: 17px;
  margin-bottom: 12px; outline: none; transition: all 0.2s; color: #3B0764;
}
.grape-input:focus { border-color: #8B5CF6; background: #fff; box-shadow: 0 0 0 4px #EDE9FE; }
.grape-input.ok { border-color: #84CC16; background: #F7FEE7; }
.grape-input.bad { border-color: #F87171; background: #FEF2F2; }

/* 아이디 입력 + @funnygrape.com 표시용 (회원가입) */
.id-with-domain { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.id-with-domain .grape-input { margin-bottom: 0; flex: 1; }
.id-domain { color: #8B5CF6; font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ─── 버튼 ─── */
.grape-btn {
  width: 100%; padding: 17px; border: none; border-radius: 16px;
  font-size: 18px; font-weight: 800; cursor: pointer; transition: all 0.15s;
  background: linear-gradient(90deg, #7C3AED, #9333EA); color: #fff;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
}
.grape-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(124, 58, 237, 0.45); }
.grape-btn:active { transform: translateY(0); }
.grape-btn.green { background: linear-gradient(90deg, #65A30D, #84CC16); box-shadow: 0 6px 16px rgba(101, 163, 13, 0.35); }
.grape-btn.gray { background: #E9D5FF; color: #6D28D9; box-shadow: none; }
.grape-btn.small { width: auto; padding: 9px 16px; font-size: 13px; border-radius: 10px; }
.grape-btn.danger { background: linear-gradient(90deg, #DC2626, #F87171); box-shadow: 0 6px 16px rgba(220, 38, 38, 0.3); }
.grape-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── 메시지 박스 ─── */
.msg-box { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; font-weight: 600;
  margin: 10px 0; text-align: left; white-space: pre-line; display: none; }
.msg-box.error { background: #FEF2F2; color: #B91C1C; border: 1.5px solid #FECACA; }
.msg-box.success { background: #F7FEE7; color: #4D7C0F; border: 1.5px solid #D9F99D; }
.msg-box.info { background: #EDE9FE; color: #6D28D9; border: 1.5px solid #DDD6FE; }

/* ─── 필드 힌트 (닉네임 다국어 안내 등) ─── */
.field-hint { font-size: 12px; color: #84CC16; background: #F7FEE7; border-radius: 8px;
  padding: 8px 10px; margin: -4px 0 10px; text-align: left; font-weight: 600;
  border: 1px dashed #BEF264; }
.field-label { display: block; text-align: left; font-size: 13px; font-weight: 800;
  color: #6D28D9; margin: 10px 0 6px; }

/* ─── 링크 ─── */
.grape-link { color: #7C3AED; font-size: 13.5px; font-weight: 700; text-decoration: none; }
.grape-link:hover { text-decoration: underline; }

/* ─── 로그인 방식 전환 탭 ─── */
.login-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.login-tabs button {
  flex: 1; padding: 11px 8px; border-radius: 12px; border: 2px solid #DDD6FE;
  background: #FAF5FF; font-size: 13.5px; font-weight: 800; cursor: pointer; color: #7C3AED;
  transition: all 0.15s;
}
.login-tabs button.on { background: linear-gradient(90deg, #7C3AED, #9333EA); color: #fff; border-color: #7C3AED; }
.login-tabs button.on.admin { background: linear-gradient(90deg, #B45309, #F59E0B); border-color: #B45309; }

/* ─── 상단 공통 헤더 ─── */
.grape-header {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px);
  padding: 12px 22px; box-shadow: 0 2px 16px rgba(124, 58, 237, 0.12);
  position: sticky; top: 0; z-index: 100; border-bottom: 2px solid #EDE9FE;
}
.grape-logo { display: flex; align-items: baseline; gap: 6px; text-decoration: none; font-size: 22px; }
.grape-logo span { font-weight: 900; background: linear-gradient(90deg, #7C3AED, #84CC16);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.grape-logo small { color: #A78BFA; font-size: 11px; font-weight: 700; }
.grape-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.grape-nav a {
  text-decoration: none; color: #6D28D9; font-size: 13px; font-weight: 700;
  padding: 8px 11px; border-radius: 10px; transition: all 0.15s;
}
.grape-nav a:hover { background: #EDE9FE; }
.grape-nav a.active { background: linear-gradient(90deg, #7C3AED, #9333EA); color: #fff; }
.grape-nav a.disabled { opacity: 0.35; }
.grape-nav a.admin-menu { background: #FEF3C7; color: #B45309; border: 1.5px dashed #F59E0B; }
.grape-nav a.admin-menu.active { background: linear-gradient(90deg, #B45309, #F59E0B); color: #fff; }
.grape-user { display: flex; align-items: center; gap: 10px; }
.grape-user-info { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.grape-user-info .nick { font-weight: 800; color: #3B0764; font-size: 14px; }
.grape-user-info .title { font-size: 11px; color: #84CC16; font-weight: 800;
  background: #F7FEE7; padding: 3px 8px; border-radius: 20px; border: 1px solid #D9F99D; }
.logout-btn { border: none; background: #EDE9FE; color: #6D28D9; font-weight: 700;
  font-size: 12px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.logout-btn:hover { background: #DDD6FE; }

/* ─── 본문 컨테이너 ─── */
.page-wrap { max-width: 1080px; margin: 0 auto; padding: 26px 20px; position: relative; z-index: 1; }
.page-title { font-size: 26px; font-weight: 900; color: #5B21B6; margin-bottom: 4px; }
.page-sub { color: #8B5CF6; font-size: 14px; margin-bottom: 22px; font-weight: 600; }

/* ─── 카드 ─── */
.grape-card {
  background: rgba(255, 255, 255, 0.92); border-radius: 20px; padding: 24px;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.1); border: 2px solid #F3E8FF;
  margin-bottom: 18px;
}
.grape-card h3 { color: #6D28D9; font-size: 17px; margin-bottom: 14px; }

/* ─── 메인 페이지 메뉴 그리드 ─── */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.menu-tile {
  background: #fff; border-radius: 18px; padding: 22px 14px; text-align: center;
  text-decoration: none; border: 2px solid #EDE9FE; transition: all 0.15s;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.08);
}
.menu-tile:hover { transform: translateY(-4px); border-color: #C4B5FD;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.18); }
.menu-tile .icon { font-size: 38px; }
.menu-tile .label { display: block; margin-top: 8px; font-weight: 800; color: #5B21B6; font-size: 14px; }
.menu-tile.disabled { opacity: 0.4; }
.menu-tile.admin-tile { background: #FFFBEB; border-color: #FDE68A; }

/* ─── 메인 히어로 (포도 일러스트 + 명언) ─── */
.hero {
  text-align: center; padding: 34px 20px 26px;
  background: linear-gradient(135deg, rgba(237, 233, 254, 0.8), rgba(236, 252, 203, 0.8));
  border-radius: 24px; border: 2px solid #E9D5FF; margin-bottom: 22px;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.1);
}
.hero .quote { font-size: 24px; font-weight: 800; color: #5B21B6; margin-top: 16px; line-height: 1.5; }
.hero .cheer { font-size: 14px; color: #4D7C0F; font-weight: 600; margin-top: 8px; }

/* ─── 테이블 (관리자 페이지) ─── */
.grape-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.grape-table th { background: #EDE9FE; color: #5B21B6; padding: 10px 8px; text-align: left;
  font-size: 12px; white-space: nowrap; }
.grape-table td { padding: 10px 8px; border-bottom: 1px solid #F3E8FF; color: #3B0764; }
.grape-table tr:hover td { background: #FAF5FF; }
.grape-table th:first-child { border-radius: 10px 0 0 10px; }
.grape-table th:last-child { border-radius: 0 10px 10px 0; }

/* ─── 상태 뱃지 ─── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 800; }
.badge.active { background: #F7FEE7; color: #4D7C0F; border: 1px solid #D9F99D; }
.badge.pending { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.badge.suspended { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.badge.banned { background: #37373b; color: #eee; }

/* ─── 관리자 탭 ─── */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-tabs button {
  padding: 10px 18px; border-radius: 12px; border: 2px solid #FDE68A;
  background: #FFFBEB; font-weight: 800; font-size: 13.5px; color: #B45309; cursor: pointer;
}
.admin-tabs button.on { background: linear-gradient(90deg, #B45309, #F59E0B); color: #fff; }

/* ─── 모달 ─── */
.modal-bg { position: fixed; inset: 0; background: rgba(59, 7, 100, 0.45);
  display: none; align-items: center; justify-content: center; z-index: 500; padding: 20px; }
.modal-box { background: #fff; border-radius: 22px; padding: 28px; width: 100%; max-width: 440px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); max-height: 85vh; overflow-y: auto; }
.modal-box h3 { color: #6D28D9; margin-bottom: 16px; }

/* ─── 토글 스위치 (권한 관리용) ─── */
.perm-toggle { display: inline-flex; align-items: center; gap: 5px; margin: 3px 6px 3px 0;
  background: #FAF5FF; padding: 5px 10px; border-radius: 10px; border: 1px solid #EDE9FE;
  font-size: 12px; font-weight: 700; color: #6D28D9; cursor: pointer; user-select: none; }
.perm-toggle input { accent-color: #7C3AED; }

/* ─── 반응형 ─── */
@media (max-width: 720px) {
  .grape-header { padding: 10px 12px; gap: 8px; }
  .grape-nav a { font-size: 11.5px; padding: 6px 8px; }
  .grape-user-info .nick { display: none; }
}

/* ═══════════════════════════════════════════
   2단계: 친구 / 일기장 / 출첵 전용 스타일
   ═══════════════════════════════════════════ */

/* ─── 2단 레이아웃 (일기장: 달력 | 작성) ─── */
.two-col { display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* ─── 친구 목록 한 줄 ─── */
.friend-row { display: flex; align-items: center; justify-content: space-between;
  padding: 11px 6px; border-bottom: 1px solid #F3E8FF; gap: 10px; flex-wrap: wrap; }
.friend-row:last-child { border-bottom: none; }
.friend-info { display: flex; align-items: center; gap: 11px; }
.friend-nick { font-weight: 900; color: #5B21B6; font-size: 15px; }
.friend-sub { font-size: 12px; color: #A78BFA; }
.friend-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.friend-pending { font-size: 12px; color: #CA8A04; font-weight: 800;
  background: #FEFCE8; border: 1px solid #FEF08A; border-radius: 8px; padding: 5px 9px; }
.empty-msg { color: #A78BFA; font-size: 13.5px; text-align: center; padding: 14px 0; font-weight: 600; }

/* ─── 달력 공통 ─── */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 900; color: #5B21B6; font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week { text-align: center; font-size: 12px; font-weight: 800; color: #8B5CF6; padding: 4px 0; }
.cal-week.sun { color: #F87171; }
.cal-day { position: relative; aspect-ratio: 1; border-radius: 12px; background: #FAF5FF;
  border: 1.5px solid #F3E8FF; display: flex; flex-direction: column; align-items: center;
  justify-content: center; cursor: pointer; transition: all 0.15s; min-height: 44px; }
.cal-day:hover { background: #EDE9FE; transform: scale(1.05); }
.cal-day .num { font-size: 12px; font-weight: 700; color: #6D28D9; }
.cal-day .mark { font-size: 16px; line-height: 1; margin-top: 1px; }
.cal-day.today { border: 2px solid #84CC16; background: #F7FEE7; }
.cal-day.has { background: #EDE9FE; border-color: #C4B5FD; }
.cal-day.has.berry { background: linear-gradient(135deg, #EDE9FE, #F3E8FF); }
.hint-msg { font-size: 12px; color: #A78BFA; margin-top: 10px; font-weight: 600; }

/* ─── 출첵: 달력 주인 탭 (나 + 친구들) ─── */
.owner-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.owner-tab { border: 2px solid #DDD6FE; background: #FAF5FF; color: #6D28D9;
  border-radius: 12px; padding: 8px 14px; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: all 0.15s; }
.owner-tab:hover { background: #EDE9FE; }
.owner-tab.active { background: linear-gradient(90deg, #7C3AED, #9333EA); color: #fff; border-color: #7C3AED; }

/* ═══════════════════════════════════════════
   3단계: 개인 저장소 / 임시 공유 전용 스타일
   ═══════════════════════════════════════════ */

/* ─── 저장소 상단 4개 탭 ─── */
.storage-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 18px; }
.storage-tabs button {
  padding: 11px 20px; border-radius: 14px; border: 2px solid #DDD6FE;
  background: #FAF5FF; font-weight: 800; font-size: 14px; color: #6D28D9;
  cursor: pointer; transition: all 0.15s;
}
.storage-tabs button:hover { background: #EDE9FE; }
.storage-tabs button.on { background: linear-gradient(90deg, #7C3AED, #9333EA); color: #fff; border-color: #7C3AED; }

/* ─── 폴더 선택 바 (셀렉트 + 버튼 한 줄 배치) ─── */
.folder-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grape-input.slim { width: auto; min-width: 130px; padding: 9px 12px; font-size: 14px; margin-bottom: 0; }

/* ─── 항목 한 줄 (메모/파일/공유 목록 공용) ─── */
.item-row { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px; border-bottom: 1px solid #F3E8FF; gap: 10px; flex-wrap: wrap;
  border-radius: 10px; transition: background 0.15s; }
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: #FAF5FF; }
.item-name { font-weight: 800; color: #5B21B6; font-size: 14px; flex: 1; min-width: 140px;
  word-break: break-all; }
.item-sub { font-size: 12px; color: #A78BFA; white-space: nowrap; }
.memo-item { cursor: pointer; }

/* ─── 용량/개수 현황 표시 ─── */
.limit-info { font-size: 12.5px; color: #4D7C0F; font-weight: 700; background: #F7FEE7;
  border: 1px dashed #BEF264; border-radius: 10px; padding: 7px 12px; margin: 12px 0 8px;
  display: inline-block; }

/* ─── HTML 뷰어 모달 (넓게) ─── */
.viewer-box { max-width: 920px; }

/* ═══════════ 4단계: 포도 수다방 (채팅) ═══════════ */
/* 채팅 메시지 목록 상자 (스크롤) */
.chat-box { height: 55vh; min-height: 320px; overflow-y: auto;
  padding: 10px 6px; display: flex; flex-direction: column; gap: 10px; }
/* 메시지 한 줄 (아바타 + 본문) */
.chat-msg { display: flex; gap: 8px; align-items: flex-start; max-width: 82%; }
/* 내 메시지는 오른쪽 정렬 + 아바타 순서 반전 */
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
/* 작은 포도 아바타 */
.chat-ava { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  background: #F3E8FF; overflow: hidden; }
.chat-ava img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
/* 닉네임 + 말풍선 묶음 */
.chat-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chat-msg.mine .chat-body { align-items: flex-end; }
/* 닉네임 (작게) */
.chat-nick { font-size: 12px; color: #7C3AED; font-weight: 700; }
/* 말풍선 (상대: 흰색 / 나: 보라색) */
.chat-bubble { background: #fff; border: 1px solid #E9D5FF; border-radius: 4px 14px 14px 14px;
  padding: 8px 12px; font-size: 14px; line-height: 1.5; word-break: break-word;
  white-space: pre-wrap; box-shadow: 0 1px 3px rgba(124,58,237,0.08); }
.chat-msg.mine .chat-bubble { background: #7C3AED; color: #fff; border: none;
  border-radius: 14px 4px 14px 14px; }
/* 시간 + 삭제 버튼 줄 */
.chat-time { font-size: 11px; color: #A78BFA; }
/* 관리자 전용 메시지 삭제 버튼 */
.chat-del { background: none; border: none; cursor: pointer; font-size: 12px;
  opacity: 0.5; padding: 0 2px; }
.chat-del:hover { opacity: 1; }
/* 입력 바 (하단 고정 느낌) */
.chat-input-bar { display: flex; gap: 8px; margin-top: 10px; }
.chat-input-bar .grape-input { flex: 1; margin: 0; }

/* ═══════════ 4단계: P2P 통화/화상 ═══════════ */
/* 통화 상태 카드 */
.call-bar { padding: 14px 18px; }
.call-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 14px; color: #6B21A8; }
/* 통화 참여자 배지 */
.call-member-badge { background: #ECFCCB; color: #4D7C0F; border: 1px solid #BEF264;
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
/* 영상/음성 타일 격자 (최대 3인) */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px; margin: 12px 0; }
/* 참여자 한 명 타일 */
.video-tile { position: relative; background: #1E1B2E; border-radius: 14px;
  overflow: hidden; aspect-ratio: 4/3; display: flex; align-items: center;
  justify-content: center; }
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
/* 타일 하단 이름표 */
.tile-label { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,0.55);
  color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
/* 음성 통화 시 큰 포도 아이콘 */
.voice-icon { font-size: 56px; }

/* ═══════════ 5단계: 포도 메일함 ═══════════ */
/* 안 읽은 메일은 굵게 + 연보라 배경 */
.mail-row.unread { background: #F3E8FF; }
.mail-row.unread .item-name { font-weight: 800; }
.mail-row { cursor: pointer; }
.mail-row:hover { background: #EDE9FE; }

/* ═══════════════════════════════════════════
   전면 개편: 공통 신규 스타일
   ═══════════════════════════════════════════ */

/* ─── 로고: 큰 "포도 아지트" + 작은 funnygrape.com ─── */
.site-logo-domain { color: #A78BFA; font-size: 14px; font-weight: 700; letter-spacing: 1px; margin-top: 2px; }

/* ─── 언어 선택 드롭다운 (작게) ─── */
.lang-switch { border: 1.5px solid #DDD6FE; background: #FAF5FF; color: #6D28D9;
  border-radius: 10px; padding: 6px 8px; font-size: 12px; font-weight: 700; cursor: pointer; outline: none; }
.lang-switch:hover { background: #EDE9FE; }
/* 로그인/가입 페이지용 우상단 플로팅 */
.lang-float { position: fixed; top: 14px; right: 16px; z-index: 200; }

/* ─── 드롭다운 라벨 (탭/폴더/친구 표시) ─── */
.select-label { font-size: 12px; font-weight: 800; color: #8B5CF6; margin-right: 2px; white-space: nowrap; }
.select-group { display: inline-flex; align-items: center; gap: 5px; }

/* ═══════════ 메일함: 사이드바 + 전체 화면 읽기 ═══════════ */
.mail-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .mail-layout { grid-template-columns: 1fr; } }
/* 왼쪽 사이드바 */
.mail-side { background: rgba(255,255,255,0.92); border: 2px solid #F3E8FF; border-radius: 18px;
  padding: 14px; box-shadow: 0 8px 28px rgba(124,58,237,0.1); position: sticky; top: 80px; }
.mail-side .compose-btn { width: 100%; margin-bottom: 12px; }
.mail-side-menu { display: flex; flex-direction: column; gap: 4px; }
.mail-side-menu button { text-align: left; border: none; background: none; padding: 10px 12px;
  border-radius: 12px; font-size: 14px; font-weight: 800; color: #6D28D9; cursor: pointer;
  transition: all 0.15s; display: flex; justify-content: space-between; align-items: center; }
.mail-side-menu button:hover { background: #F3E8FF; }
.mail-side-menu button.on { background: linear-gradient(90deg, #7C3AED, #9333EA); color: #fff; }
.mail-count { font-size: 11px; background: #F87171; color: #fff; border-radius: 999px;
  padding: 1px 8px; font-weight: 800; }
.mail-side-menu button.on .mail-count { background: rgba(255,255,255,0.3); }
/* 메일 목록 행 (표 형태) */
.mail-list-row { display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  border-bottom: 1px solid #F3E8FF; cursor: pointer; transition: background 0.12s; }
.mail-list-row:hover { background: #EDE9FE; }
.mail-list-row.unread { background: #F5F0FF; }
.mail-list-row.unread .mail-subj { font-weight: 900; color: #4C1D95; }
.mail-from { font-weight: 800; color: #6D28D9; font-size: 13px; width: 130px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.mail-subj { flex: 1; font-size: 14px; color: #3B0764; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.mail-date { font-size: 12px; color: #A78BFA; white-space: nowrap; }
/* 읽음 확인 배지 */
.receipt-badge { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.receipt-badge.read { background: #F7FEE7; color: #4D7C0F; border: 1px solid #D9F99D; }
.receipt-badge.unread { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
.receipt-badge.na { background: #F3F4F6; color: #6B7280; border: 1px solid #E5E7EB; }
/* 메일 읽기 전체 화면 영역 */
.mail-read-head { border-bottom: 2px solid #EDE9FE; padding-bottom: 14px; margin-bottom: 16px; }
.mail-read-subj { font-size: 22px; font-weight: 900; color: #4C1D95; margin-bottom: 8px; word-break: break-all; }
.mail-read-meta { font-size: 13px; color: #8B5CF6; font-weight: 600; display: flex; gap: 14px; flex-wrap: wrap; }
.mail-read-body { font-size: 15px; line-height: 1.8; color: #3B0764; white-space: pre-wrap;
  word-break: break-word; min-height: 200px; padding: 6px 2px; }

/* ═══════════ 일기장: 중앙 대형 + 사이드 달력 ═══════════ */
.diary-layout { display: grid; grid-template-columns: 1fr 290px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .diary-layout { grid-template-columns: 1fr; }
  .diary-side { order: -1; } }
/* 일기 본문 카드 (노트 느낌) */
.diary-main { background: linear-gradient(180deg, #FFFDF8, #FFF9F0);
  border: 2px solid #F5E0C3; border-radius: 22px; padding: 30px 34px;
  box-shadow: 0 10px 34px rgba(180, 120, 60, 0.12); min-height: 480px; position: relative; }
.diary-date-title { font-size: 24px; font-weight: 900; color: #92400E;
  border-bottom: 2px dashed #FDE68A; padding-bottom: 10px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.diary-textarea { width: 100%; min-height: 340px; border: none; background: transparent;
  outline: none; resize: vertical; font-size: 16px; line-height: 2.0; color: #451A03;
  font-family: inherit;
  background-image: repeating-linear-gradient(transparent, transparent 31px, #F3E4C8 31px, #F3E4C8 32px);
  background-attachment: local; }
.diary-view-text { font-size: 16px; line-height: 2.0; color: #451A03; white-space: pre-wrap;
  word-break: break-word; min-height: 200px; }
/* 일기 사진 (글과 어우러지도록) */
.diary-photo { max-width: 62%; border-radius: 14px; border: 5px solid #fff;
  box-shadow: 0 8px 22px rgba(120, 70, 20, 0.22); transform: rotate(-1.2deg);
  float: right; margin: 4px 0 14px 20px; }
@media (max-width: 600px) { .diary-photo { max-width: 100%; float: none; margin: 10px 0; transform: none; } }
/* AES 암호화 안내 배지 */
.secure-note { font-size: 12px; color: #4D7C0F; font-weight: 700; background: #F7FEE7;
  border: 1px dashed #BEF264; border-radius: 999px; padding: 5px 14px; display: inline-block; }
/* 일기 없는 날 표시 */
.diary-empty { text-align: center; padding: 90px 20px; color: #B45309; font-weight: 800; font-size: 17px; }
.diary-empty .big { font-size: 60px; display: block; margin-bottom: 14px; }
/* 사이드 달력 (작게) */
.diary-side .cal-day { min-height: 34px; border-radius: 9px; }
.diary-side .cal-day .num { font-size: 11px; }
.diary-side .cal-day .mark { font-size: 12px; }

/* ═══════════ 수다방: 방 목록 + 카톡형 채팅 ═══════════ */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .chat-layout { grid-template-columns: 1fr; } }
/* 방 목록 한 줄 */
.room-row { display: flex; align-items: center; gap: 10px; padding: 12px 10px;
  border-radius: 14px; cursor: pointer; transition: background 0.13s; border-bottom: 1px solid #F3E8FF; }
.room-row:hover { background: #F3E8FF; }
.room-row.on { background: #EDE9FE; border: 1.5px solid #C4B5FD; }
.room-icon { width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, #EDE9FE, #ECFCCB);
  display: flex; align-items: center; justify-content: center; font-size: 21px; flex-shrink: 0; }
.room-info { flex: 1; min-width: 0; }
.room-name { font-weight: 900; color: #4C1D95; font-size: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.room-last { font-size: 12px; color: #A78BFA; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-meta { font-size: 11px; color: #C4B5FD; text-align: right; flex-shrink: 0; }
/* 채팅방 상단 바 */
.chatroom-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 2px solid #EDE9FE; padding-bottom: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.chatroom-title { font-size: 18px; font-weight: 900; color: #4C1D95; }
.chatroom-members { font-size: 12px; color: #8B5CF6; font-weight: 600; }

/* ═══════════ 출석: 큰 공유 달력 + 사이드 패널 ═══════════ */
.attend-layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
@media (max-width: 860px) { .attend-layout { grid-template-columns: 1fr; } }
/* 큰 달력 칸 */
.attend-cal .cal-day { min-height: 76px; border-radius: 14px; justify-content: flex-start; padding-top: 7px; }
.attend-cal .cal-day .num { font-size: 13px; }
.attend-cal .cal-day .mark { font-size: 22px; margin-top: 2px; }
.attend-count { font-size: 10.5px; color: #6D28D9; font-weight: 800; background: #EDE9FE;
  border-radius: 999px; padding: 1px 7px; margin-top: 3px; }
.attend-cal .cal-day.selected { border: 2.5px solid #7C3AED; background: #EDE9FE; }
/* 사이드: 한마디 쓰기 + 날짜 상세 */
.attend-side { position: sticky; top: 80px; }
.attend-entry { display: flex; align-items: flex-start; gap: 9px; padding: 10px 4px;
  border-bottom: 1px solid #F3E8FF; }
.attend-entry:last-child { border-bottom: none; }
.attend-entry .who { font-weight: 900; color: #5B21B6; font-size: 13.5px; }
.attend-entry .word { font-size: 13px; color: #3B0764; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.attend-hidden-note { font-size: 12px; color: #A78BFA; font-weight: 700; background: #FAF5FF;
  border: 1px dashed #DDD6FE; border-radius: 10px; padding: 8px 10px; margin-top: 8px; text-align: center; }

/* ═══════════ 저장소: 폴더 패널 ═══════════ */
.storage-layout { display: grid; grid-template-columns: 230px 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .storage-layout { grid-template-columns: 1fr; } }
.folder-panel { background: rgba(255,255,255,0.92); border: 2px solid #F3E8FF; border-radius: 18px;
  padding: 14px; box-shadow: 0 8px 28px rgba(124,58,237,0.1); }
.folder-panel h4 { color: #6D28D9; font-size: 14px; margin-bottom: 10px; }
.folder-item { display: flex; align-items: center; gap: 7px; padding: 9px 10px; border-radius: 12px;
  cursor: pointer; font-size: 13.5px; font-weight: 800; color: #5B21B6; transition: background 0.13s; }
.folder-item:hover { background: #F3E8FF; }
.folder-item.on { background: linear-gradient(90deg, #7C3AED, #9333EA); color: #fff; }
.folder-item .cnt { margin-left: auto; font-size: 11px; opacity: 0.7; }
.folder-actions { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.folder-actions button { flex: 1; min-width: 60px; border: 1.5px solid #DDD6FE; background: #FAF5FF;
  color: #6D28D9; border-radius: 10px; padding: 7px 4px; font-size: 11.5px; font-weight: 800; cursor: pointer; }
.folder-actions button:hover { background: #EDE9FE; }
/* 메모: 저장됨 보기 모드 */
.memo-saved-view { background: #FAF5FF; border: 2px solid #EDE9FE; border-radius: 14px;
  padding: 16px 18px; font-size: 14.5px; line-height: 1.7; color: #3B0764;
  white-space: pre-wrap; word-break: break-word; min-height: 120px; }
.saved-badge { font-size: 11px; font-weight: 900; color: #4D7C0F; background: #F7FEE7;
  border: 1px solid #D9F99D; border-radius: 999px; padding: 3px 10px; }

/* ═══════════ HTML 전체 화면 뷰어 ═══════════ */
.html-viewer-full { position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 400;
  background: #fff; display: none; flex-direction: column; }
.html-viewer-bar { display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: #4C1D95; color: #fff; flex-shrink: 0; }
.html-viewer-bar .fname { font-weight: 800; font-size: 14px; }
.html-viewer-bar button { border: none; background: rgba(255,255,255,0.18); color: #fff;
  border-radius: 10px; padding: 8px 18px; font-weight: 800; cursor: pointer; font-size: 13px; }
.html-viewer-bar button:hover { background: rgba(255,255,255,0.3); }
.html-viewer-full iframe { flex: 1; border: none; width: 100%; background: #fff; }

/* ═══════════ 관리자 열람 UI ═══════════ */
.admin-view-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #FFFBEB; border: 2px dashed #FDE68A; border-radius: 14px;
  padding: 10px 14px; margin-bottom: 14px; }
.admin-view-bar .label { font-size: 13px; font-weight: 900; color: #B45309; }
.view-pre { background: #FAF5FF; border: 1.5px solid #EDE9FE; border-radius: 12px;
  padding: 14px; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap;
  word-break: break-word; max-height: 55vh; overflow-y: auto; color: #3B0764; }

/* ═══════════ 프로필: 설정 섹션 ═══════════ */
.setting-section { border-top: 2px dashed #EDE9FE; margin-top: 18px; padding-top: 16px; }
.setting-section h4 { color: #6D28D9; font-size: 15px; margin-bottom: 10px; }
.danger-zone { border: 2px dashed #FECACA; background: #FEF2F2; border-radius: 16px; padding: 16px; margin-top: 20px; }
.danger-zone h4 { color: #B91C1C; }

/* ═══════════ 통화 중 배너 (인스타그램 스타일, 요청사항) ═══════════ */
.call-live-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(90deg, #ECFDF5, #F0FDF4); border: 2px solid #86EFAC;
  border-radius: 14px; padding: 9px 14px; margin: 0 0 10px;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.15); }
.call-live-dot { width: 10px; height: 10px; border-radius: 50%; background: #22C55E;
  animation: livePulse 1.2s ease-in-out infinite; flex-shrink: 0; }
@keyframes livePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } }
.call-live-text { font-size: 13px; font-weight: 800; color: #15803D; flex: 1; min-width: 120px; }
.call-live-full { font-size: 12px; color: #B45309; font-weight: 700; }
/* 방 목록의 통화 중 작은 배지 */
.room-call-badge { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 900;
  color: #15803D; background: #ECFDF5; border: 1px solid #86EFAC; border-radius: 999px;
  padding: 1px 8px; vertical-align: middle; }

/* ═══════════ 모바일 반응형 전면 보강 (요청사항) ═══════════ */
/* 패드(세로)~큰 폰: 태블릿 구간 */
@media (max-width: 1024px) {
  .page-wrap { padding: 20px 14px; }
}
/* 폰 구간: 모든 페이지 공통 다듬기 */
@media (max-width: 720px) {
  html { -webkit-text-size-adjust: 100%; } /* iOS 가로 회전 시 글자 확대 방지 */
  .page-wrap { padding: 14px 10px; }
  .page-title { font-size: 21px; }
  .page-sub { font-size: 12.5px; margin-bottom: 14px; }
  .grape-card { padding: 16px 14px; border-radius: 16px; }
  /* 헤더: 로고 축소 + 메뉴 가로 스크롤 (줄바꿈 난립 방지) */
  .grape-logo { font-size: 18px; }
  .grape-logo small { display: none; }
  .grape-nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; }
  .grape-nav::-webkit-scrollbar { display: none; }
  .grape-nav a { white-space: nowrap; flex-shrink: 0; }
  .grape-user-info .title { display: none; }
  /* 버튼/입력: 터치 크기 확보 */
  .grape-btn { padding: 12px 16px; font-size: 14px; }
  .grape-input, select.grape-input { font-size: 16px; } /* iOS 자동 확대(줌) 방지: 16px 이상 */
  /* 테이블: 가로 스크롤로 깨짐 방지 */
  .grape-table { display: block; overflow-x: auto; white-space: nowrap; }
  /* 모달: 화면에 꽉 차게 */
  .modal-box { padding: 20px 16px; max-height: 92vh; }
  /* 채팅: 목록이 위, 대화가 아래 (chat-layout은 800px에서 1열로 이미 전환됨) */
  .chat-box { height: 48vh; min-height: 260px; }
  .chatroom-head { flex-wrap: wrap; }
  .room-list-collapse { max-height: 180px; overflow-y: auto; } /* 방 목록 높이 제한 */
  /* 저장소: 폴더 패널을 가로 스크롤 칩으로 */
  .folder-panel { padding: 10px; }
  .folder-panel h4 { margin-bottom: 6px; }
  .storage-layout > .folder-panel [id$="-folder-list"] { display: flex; gap: 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .folder-item { flex-shrink: 0; white-space: nowrap; }
  /* 파일 행: 버튼이 아래 줄로 자연스럽게 떨어지게 */
  .item-row { flex-wrap: wrap; }
  .item-row .friend-actions { width: 100%; justify-content: flex-end; }
  /* 일기: 사진 전체 폭 (600px 규칙과 동일하게 통일) */
  .diary-photo { max-width: 100%; float: none; margin: 10px 0; transform: none; }
  /* 출첵/일기 달력: 칸 축소 */
  .cal-grid { gap: 2px; }
  /* 관리자 탭 가로 스크롤 */
  .admin-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-tabs button { white-space: nowrap; flex-shrink: 0; padding: 9px 13px; }
  /* 전체화면 뷰어 상단바 */
  .html-viewer-bar { padding: 8px 10px; }
  .html-viewer-bar .fname { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; max-width: 60vw; }
}
/* 아주 작은 폰 */
@media (max-width: 400px) {
  .grape-nav a { font-size: 11px; padding: 6px 6px; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); }
}
