/* ==============================================================================
   meals.nlink.kr - 우리 아이 급식 & 시간표 & 학사달력 학교 라이프 포털
   김급식 주황색 탈피 & 테마별 상단 배너 100% 동기화 & 고밀도 콤팩트 디자인
   ============================================================================== */

:root {
  /* 기본 테마: 스마트 스카이 (Clean Sky Blue - 토스/애플 감성 프리미엄 라이트) */
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-hover: #E2E8F0;
  
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-sub: #334155;
  
  --border-color: #E2E8F0;
  --border-subtle: #EDF2F7;
  
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --primary-text: #FFFFFF;
  
  --header-gradient: linear-gradient(135deg, #1D4ED8 0%, #0284C7 100%);

  --accent-green: #10B981;
  --accent-green-bg: #ECFDF5;
  --accent-green-text: #065F46;
  
  --accent-danger: #EF4444;
  --accent-danger-bg: #FEF2F2;
  --accent-danger-border: #F87171;
  --accent-danger-text: #991B1B;

  --accent-warning: #F59E0B;
  --accent-warning-bg: #FFFBEB;
  --accent-warning-text: #92400E;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

/* 🌿 프레시 민트 테마 */
[data-theme="mint"] {
  --bg-primary: #F0FDF4;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #DCFCE7;
  --bg-card: #FFFFFF;
  --bg-hover: #BBF7D0;

  --text-main: #064E3B;
  --text-muted: #059669;
  --text-sub: #047857;

  --border-color: #A7F3D0;
  --border-subtle: #D1FAE5;

  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #E6FBF2;
  --primary-text: #FFFFFF;

  --header-gradient: linear-gradient(135deg, #047857 0%, #10B981 100%);

  --accent-green: #10B981;
  --accent-green-bg: #ECFDF5;
  --accent-green-text: #065F46;

  --accent-danger: #EF4444;
  --accent-danger-bg: #FEF2F2;
  --accent-danger-border: #F87171;
  --accent-danger-text: #991B1B;

  --accent-warning: #D97706;
  --accent-warning-bg: #FEF3C7;
  --accent-warning-text: #92400E;

  --shadow-sm: 0 1px 3px rgba(6, 78, 59, 0.08);
  --shadow-md: 0 4px 12px rgba(6, 78, 59, 0.1);
  --shadow-lg: 0 10px 25px rgba(6, 78, 59, 0.14);
}

/* 🍦 소프트 크림 테마 */
[data-theme="cream"] {
  --bg-primary: #FAF6EE;
  --bg-secondary: #FFFDF9;
  --bg-tertiary: #F3ECE0;
  --bg-card: #FFFDF9;
  --bg-hover: #E8DECE;

  --text-main: #382E2B;
  --text-muted: #7C6E65;
  --text-sub: #574B45;

  --border-color: #E6DCCD;
  --border-subtle: #EFE8DC;

  --primary: #A95927;
  --primary-hover: #8C471E;
  --primary-light: #FBEFE7;
  --primary-text: #FFFFFF;

  --header-gradient: linear-gradient(135deg, #7C4A2D 0%, #C26D38 100%);

  --accent-green: #2E8B57;
  --accent-green-bg: #EBF7EE;
  --accent-green-text: #1E5C38;

  --accent-danger: #E04848;
  --accent-danger-bg: #FDECEC;
  --accent-danger-border: #F59393;
  --accent-danger-text: #8E2323;

  --accent-warning: #C68112;
  --accent-warning-bg: #FCF4E4;
  --accent-warning-text: #784A04;

  --shadow-sm: 0 1px 3px rgba(56, 46, 43, 0.07);
  --shadow-md: 0 4px 12px rgba(56, 46, 43, 0.09);
  --shadow-lg: 0 10px 25px rgba(56, 46, 43, 0.12);
}

/* 💜 소프트 라벤더 라이트 테마 (신규 - 우아하고 세련된 파스텔 바이올렛) */
[data-theme="lavender"] {
  --bg-primary: #FAF5FF;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F3E8FF;
  --bg-card: #FFFFFF;
  --bg-hover: #E9D5FF;

  --text-main: #3B0764;
  --text-muted: #7E22CE;
  --text-sub: #6B21A8;

  --border-color: #E9D5FF;
  --border-subtle: #F3E8FF;

  --primary: #7C3AED;
  --primary-hover: #6D28D9;
  --primary-light: #F5F3FF;
  --primary-text: #FFFFFF;

  --header-gradient: linear-gradient(135deg, #6D28D9 0%, #A855F7 100%);

  --accent-green: #059669;
  --accent-green-bg: #ECFDF5;
  --accent-green-text: #065F46;

  --accent-danger: #DC2626;
  --accent-danger-bg: #FEF2F2;
  --accent-danger-border: #F87171;
  --accent-danger-text: #991B1B;

  --accent-warning: #D97706;
  --accent-warning-bg: #FEF3C7;
  --accent-warning-text: #92400E;

  --shadow-sm: 0 1px 3px rgba(59, 7, 100, 0.08);
  --shadow-md: 0 4px 12px rgba(59, 7, 100, 0.1);
  --shadow-lg: 0 10px 25px rgba(59, 7, 100, 0.14);
}

  --accent-warning: #D97706;
  --accent-warning-bg: #FEF3C7;
  --accent-warning-text: #92400E;

  --shadow-sm: 0 1px 3px rgba(136, 19, 55, 0.08);
  --shadow-md: 0 4px 12px rgba(136, 19, 55, 0.1);
  --shadow-lg: 0 10px 25px rgba(136, 19, 55, 0.14);
}

/* 🪐 딥 슬레이트 테마 */
[data-theme="slate"] {
  --bg-primary: #182234;
  --bg-secondary: #233149;
  --bg-tertiary: #334668;
  --bg-card: #233149;
  --bg-hover: #334668;

  --text-main: #FFFFFF;
  --text-muted: #9BB0CD;
  --text-sub: #D1DDEE;

  --border-color: rgba(255, 255, 255, 0.14);
  --border-subtle: rgba(255, 255, 255, 0.08);

  --primary: #38BDF8;
  --primary-hover: #7DD3FC;
  --primary-light: rgba(56, 189, 248, 0.18);
  --primary-text: #0F172A;

  --header-gradient: linear-gradient(135deg, #1E293B 0%, #334668 100%);

  --accent-green: #34D399;
  --accent-green-bg: rgba(16, 185, 129, 0.18);
  --accent-green-text: #A7F3D0;

  --accent-danger: #FB7185;
  --accent-danger-bg: rgba(244, 63, 94, 0.22);
  --accent-danger-border: #F43F5E;
  --accent-danger-text: #FFE4E6;

  --accent-warning: #FBBF24;
  --accent-warning-bg: rgba(245, 158, 11, 0.18);
  --accent-warning-text: #FEF08A;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.55);
}

/* 🌙 미드나잇 다크 테마 */
[data-theme="dark"] {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-tertiary: #334155;
  --bg-card: #1E293B;
  --bg-hover: #334155;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-sub: #CBD5E1;

  --border-color: rgba(255, 255, 255, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);

  --primary: #38BDF8;
  --primary-hover: #7DD3FC;
  --primary-light: rgba(56, 189, 248, 0.15);
  --primary-text: #0F172A;

  --header-gradient: linear-gradient(135deg, #090E17 0%, #1E293B 100%);

  --accent-green: #34D399;
  --accent-green-bg: rgba(16, 185, 129, 0.15);
  --accent-green-text: #A7F3D0;

  --accent-danger: #F87171;
  --accent-danger-bg: rgba(239, 68, 68, 0.2);
  --accent-danger-border: #EF4444;
  --accent-danger-text: #FECACA;

  --accent-warning: #FBBF24;
  --accent-warning-bg: rgba(245, 158, 11, 0.18);
  --accent-warning-text: #FDE68A;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------------
   기본 리셋 & 네이티브 앱 UX (터치 검색 방지)
   ---------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

input, textarea, [contenteditable="true"], .selectable, .selectable-text {
  -webkit-user-select: text;
  user-select: text;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* 컨테이너 */
.app-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-primary);
}

/* ----------------------------------------------------
   상단 고정 헤더
   ---------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.logo-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo-tag {
  font-size: 10px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 5px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon-header {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  transition: all 0.2s ease;
  font-size: 13.5px;
  flex-shrink: 0;
}

.btn-icon-header:active {
  transform: scale(0.92);
  background-color: var(--bg-hover);
}

.btn-pwa-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  flex-shrink: 0;
}

/* 다자녀 원터치 탭 스위처 */
.children-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.children-bar::-webkit-scrollbar {
  display: none;
}

.child-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.child-tab.active {
  background-color: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.child-tab .child-avatar {
  font-size: 13px;
}

.child-tab-add {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  background-color: transparent;
  color: var(--primary);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* ----------------------------------------------------
   상단 학교 & 메타 정보 배너 (테마 100% 동기화)
   ---------------------------------------------------- */
.school-meta-bar {
  background: var(--header-gradient);
  color: #FFFFFF;
  padding: 10px 16px 14px;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  margin-bottom: -6px;
  transition: background 0.3s ease;
}

.school-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.school-name-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.school-name {
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.3px;
}

.school-edit-icon {
  font-size: 12px;
  opacity: 0.85;
}

.school-badge-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.school-grade-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
}

.btn-school-call {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
}

.date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-text {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-today {
  background: #FFFFFF;
  color: var(--text-main);
  font-weight: 800;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s;
}

.btn-today:active {
  transform: scale(0.94);
}

/* ----------------------------------------------------
   ⭐️ 상단 3단 세그먼트 탭: [ 급식 식단 ] [ 우리반 시간표 ] [ 학사 달력 ]
   ---------------------------------------------------- */
.main-tab-nav {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 3px;
  margin: 12px 14px 4px;
  box-shadow: var(--shadow-sm);
}

.main-tab-btn {
  flex: 1;
  padding: 6px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.main-tab-btn.active {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* 뷰 전환 */
.tab-view {
  display: none;
}
.tab-view.active {
  display: block;
}

/* ----------------------------------------------------
   뷰 1: 급식 식단 뷰
   ---------------------------------------------------- */
.allergy-radar-summary {
  margin: 6px 14px 2px;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.radar-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.radar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-end;
}

.radar-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  background: var(--accent-danger-bg);
  color: var(--accent-danger-text);
  border: 1px solid var(--accent-danger-border);
  border-radius: var(--radius-full);
}

.meals-carousel-wrapper {
  position: relative;
  width: 100%;
  padding: 4px 0 10px;
}

.meals-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  padding: 4px 14px 8px;
  scrollbar-width: none;
}
.meals-carousel::-webkit-scrollbar {
  display: none;
}

.meal-card {
  flex: 0 0 calc(100% - 28px);
  max-width: 350px;
  scroll-snap-align: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
}

.meal-card.is-today {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.meal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.card-date-badge {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-date-badge .day-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
}

.meal-card.is-today .card-date-badge .day-tag {
  background: var(--primary);
  color: var(--primary-text);
}

.card-status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.card-status-badge.has-danger {
  background: var(--accent-danger-bg);
  color: var(--accent-danger-text);
  border: 1px solid var(--accent-danger-border);
}

.card-status-badge.is-safe {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* 반찬 리스트 */
.dishes-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.dish-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.dish-item.danger-dish {
  background: var(--accent-danger-bg);
  border-color: var(--accent-danger-border);
}

.dish-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.dish-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  word-break: keep-all;
  line-height: 1.25;
}

.dish-item.danger-dish .dish-name {
  color: var(--accent-danger-text);
}

.dish-allergy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 1px;
}

.allergy-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--text-sub);
  line-height: 1.4;
}

.allergy-tag.danger-tag {
  background: var(--accent-danger);
  color: #FFFFFF;
  font-weight: 800;
}

.dish-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.dish-badge.badge-danger {
  background: var(--accent-danger);
  color: #FFFFFF;
}

.dish-badge.badge-safe {
  background: var(--accent-green-bg);
  color: var(--accent-green-text);
}

.meal-card-footer {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calorie-info {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.btn-nutrition-toggle {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
}

.nutrition-drawer {
  display: none;
  margin-top: 6px;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--text-sub);
  line-height: 1.5;
}

.nutrition-drawer.open {
  display: block;
}

/* ----------------------------------------------------
   ⭐️ 뷰 2: 실시간 시간표 뷰 (Timetable)
   ---------------------------------------------------- */
.timetable-wrapper {
  padding: 6px 14px 16px;
}

.timetable-header-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timetable-class-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.timetable-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.timetable-carousel::-webkit-scrollbar {
  display: none;
}

.timetable-day-card {
  flex: 0 0 calc(100% - 20px);
  max-width: 350px;
  scroll-snap-align: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.timetable-day-card.is-today {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.timetable-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.timetable-date-text {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.period-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.period-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.period-badge {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.subject-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
}

.subject-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--text-muted);
}

/* ----------------------------------------------------
   ⭐️ 뷰 3: 학사 일정 달력 뷰 (Calendar)
   ---------------------------------------------------- */
.calendar-wrapper {
  padding: 6px 14px 20px;
}

.calendar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

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

.calendar-month-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

.calendar-nav-btns {
  display: flex;
  gap: 4px;
}

.btn-cal-nav {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* 달력 요일 헤더 */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cal-weekdays span:first-child { color: var(--accent-danger); }
.cal-weekdays span:last-child { color: var(--primary); }

/* 달력 날짜 그리드 */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

.cal-day-cell:active {
  transform: scale(0.92);
}

.cal-day-cell.other-month {
  color: var(--border-color);
  pointer-events: none;
}

.cal-day-cell.is-sunday {
  color: var(--accent-danger);
}

.cal-day-cell.is-today {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 900;
}

.cal-day-cell.selected {
  background: var(--primary);
  color: var(--primary-text);
}

/* 행사 인디케이터 점 */
.cal-event-dots {
  display: flex;
  gap: 2px;
  position: absolute;
  bottom: 2px;
}

.event-dot {
  width: 4px;
  height: 4px;
  border-radius: var(--radius-full);
}
.event-dot.holiday { background: var(--accent-danger); }
.event-dot.vacation { background: var(--accent-warning); }
.event-dot.event { background: var(--primary); }

/* 선택 날짜 올인원 데일리 브리핑 카드 */
.daily-briefing-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-md);
}

.briefing-header {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.briefing-section-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  margin: 8px 0 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.briefing-event-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

/* ----------------------------------------------------
   하단 빠른 액션 바
   ---------------------------------------------------- */
.quick-action-section {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.action-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.action-text {
  flex: 1;
}

.action-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
}

.action-desc {
  font-size: 10.5px;
  color: var(--text-muted);
}

.btn-action-primary {
  padding: 5px 10px;
  background: var(--primary);
  color: var(--primary-text);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* 교차오염 가이드 */
.safety-disclaimer-box {
  margin: 0 14px 20px;
  padding: 10px 12px;
  background: var(--bg-card);
  border-left: 3px solid var(--accent-warning);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.safety-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-warning-text);
  margin-bottom: 2px;
}

.safety-body {
  font-size: 11px;
  color: var(--text-sub);
  line-height: 1.5;
}

/* 하단 푸터 */
.app-footer {
  margin-top: auto;
  padding: 20px 14px 30px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}

.footer-links button {
  color: var(--text-sub);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-copy {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* ----------------------------------------------------
   모달 공통 스타일
   ---------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

@media (min-width: 480px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 20px 16px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

@media (min-width: 480px) {
  .modal-sheet {
    border-radius: 20px;
    transform: translateY(20px);
  }
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

/* 폼 스타일 */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--primary);
  background: var(--bg-secondary);
}

.form-row {
  display: flex;
  gap: 8px;
}
.form-row .form-group {
  flex: 1;
}

.allergy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.allergy-check-card {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.allergy-check-card.checked {
  background: var(--accent-danger-bg);
  border-color: var(--accent-danger);
  color: var(--accent-danger-text);
  font-weight: 700;
}

.allergy-check-card input[type="checkbox"] {
  display: none;
}

.allergy-icon { font-size: 14px; }
.allergy-label { font-size: 11px; }

.school-search-results {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 6px;
  display: none;
  background: var(--bg-secondary);
}

.school-result-item {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.school-result-name { font-size: 13px; font-weight: 700; color: var(--text-main); }
.school-result-meta { font-size: 10.5px; color: var(--text-muted); }

/* 테마 선택기 모달 */
.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.theme-card-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
}

.theme-card-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.theme-preview-dot {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.theme-card-title { font-size: 12.5px; font-weight: 800; color: var(--text-main); }
.theme-card-desc { font-size: 10px; color: var(--text-muted); }

/* QR 관련 */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  text-align: center;
}

#qrcode-canvas {
  padding: 12px;
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  margin-bottom: 12px;
}

.qr-guide-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
  margin-bottom: 14px;
  width: 100%;
}

.btn-modal-primary {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: var(--primary-text);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* 카메라 비디오 스캐너 */
#qr-reader-container {
  width: 100%;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  margin-bottom: 12px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qr-video {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.scanner-crosshair {
  position: absolute;
  width: 160px;
  height: 160px;
  border: 2px solid var(--primary);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* 토스트 알림 */
.app-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.92);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.app-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 법적 고지 */
.legal-tab-nav {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 12px;
}

.legal-tab-btn {
  flex: 1;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.legal-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.legal-tab-content {
  font-size: 11.5px;
  color: var(--text-sub);
  line-height: 1.6;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}
