/* 기본 리셋 및 변수 설정 */
:root {
  /* 다크 테마 변수 (기본) */
  --bg-gradient: linear-gradient(135deg, #090d16 0%, #111827 100%);
  --panel-bg: rgba(17, 24, 39, 0.55);
  --panel-border: rgba(255, 255, 255, 0.05);
  --panel-border-hover: rgba(255, 255, 255, 0.12);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #111827;
  
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --primary-hover: #2563eb;
  
  --modal-bg: #111827;
  --modal-header-bg: rgba(17, 24, 39, 0.4);
  --modal-metric-bg: rgba(17, 24, 39, 0.5);
  --modal-metric-border: rgba(255, 255, 255, 0.03);
  --input-bg: rgba(3, 7, 18, 0.4);
  --input-border: rgba(255, 255, 255, 0.05);
  --table-header-bg: rgba(17, 24, 39, 0.85);
  --table-border: rgba(255, 255, 255, 0.03);
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  --active-card-shadow: 0 15px 40px rgba(59, 130, 246, 0.18);
  --badge-not-target-bg: rgba(100, 116, 139, 0.05);
  --badge-not-target-text: #64748b;
  --badge-not-target-border: rgba(100, 116, 139, 0.1);
  --logo-bg: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  --neutral: #4b5563;

  /* 식사 구분 컬러 변수 */
  --breakfast-color: #eab308;
  --lunch-color: #3b82f6;
  --dinner-color: #f97316;
  
  --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  --font-family: 'Outfit', 'Inter', 'Noto Sans KR', sans-serif;
}

[data-theme="light"] {
  /* 라이트 테마 변수 (화이트) */
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(0, 0, 0, 0.07);
  --panel-border-hover: rgba(0, 0, 0, 0.15);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dark: #f8fafc;
  
  --primary: #1d4ed8;
  --primary-glow: rgba(29, 78, 216, 0.15);
  --primary-hover: #1e40af;
  
  --modal-bg: #ffffff;
  --modal-header-bg: rgba(241, 245, 249, 0.7);
  --modal-metric-bg: rgba(241, 245, 249, 0.8);
  --modal-metric-border: rgba(0, 0, 0, 0.04);
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: rgba(0, 0, 0, 0.08);
  --table-header-bg: rgba(241, 245, 249, 0.95);
  --table-border: rgba(0, 0, 0, 0.05);
  --card-shadow: 0 4px 15px rgba(15, 23, 42, 0.08);
  --active-card-shadow: 0 12px 30px rgba(29, 78, 216, 0.15);
  --badge-not-target-bg: rgba(148, 163, 184, 0.1);
  --badge-not-target-text: #475569;
  --badge-not-target-border: rgba(148, 163, 184, 0.2);
  --logo-bg: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);

  /* 라이트 테마 대비 보강용 식사 컬러 */
  --breakfast-color: #a16207; /* 어두운 황갈색 (머스터드) */
  --lunch-color: #1d4ed8;     /* 짙은 파란색 */
  --dinner-color: #ea580c;    /* 짙은 오렌지색 */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  padding: 1.5rem;
  overflow: hidden; /* 메인 화면 스크롤 금지 */
  transition: background 0.4s ease, color 0.4s ease;
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* 상단 조회 헤더 */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.8rem;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  flex-shrink: 0;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.header-top-row {
  display: contents;
}

.header-bottom-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 1.8rem;
  background: var(--logo-bg);
  padding: 0.4rem;
  border-radius: 10px;
  box-shadow: 0 0 15px var(--primary-glow);
  transition: background 0.4s ease;
}

.title-group h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color 0.4s ease;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.auto-refresh-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(17, 24, 39, 0.05); /* 투명하게 변경 */
  border: 1px solid var(--panel-border);
  padding: 0.45rem 0.7rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

#refresh-status {
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

/* 라이트모드 갱신 배지 보완 */
[data-theme="light"] .auto-refresh-badge {
  background: rgba(255, 255, 255, 0.6);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--success-glow);
  animation: pulse 1.5s infinite;
}

.pulse-dot.success {
  background-color: var(--success);
  animation: pulse 1.5s infinite;
}

.pulse-dot.danger {
  background-color: var(--danger);
  animation: pulse-danger 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--success-glow); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-danger {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 var(--danger-glow); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.date-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-picker {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}

.date-picker:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  box-shadow: var(--card-shadow);
}

.btn-secondary:hover {
  background: var(--panel-border-hover);
}

/* 테마 버튼 전용 */
.btn-theme {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  box-shadow: none !important;
}

.btn-hamburger {
  display: none;
}

.theme-text-mobile {
  display: none;
}

.menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 85;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.menu-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.header-controls-group-desktop {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.mobile-drawer-menu {
  display: none;
}

.theme-icon {
  display: inline-block;
  transition: transform 0.4s ease;
}

.btn-theme:hover .theme-icon {
  transform: rotate(30deg) scale(1.1);
}

/* 메인 세로 3단 패널 레이아웃 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.meal-panels-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

/* 세로 식사 패널 */
.meal-panel {
  flex: 1;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.5rem 3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: flex 0.5s cubic-bezier(0.25, 0.8, 0.25, 1),
              opacity 0.4s ease,
              background 0.4s ease,
              border-color 0.4s ease,
              box-shadow 0.4s ease;
  z-index: 2;
}

.meal-panel:hover {
  border-color: var(--panel-border-hover);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* 프로그레스 백그라운드 */
.panel-progress-bg {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.07) 0%, rgba(96, 165, 250, 0.03) 100%);
  width: 0%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  pointer-events: none;
}

[data-theme="light"] .panel-progress-bg {
  background: linear-gradient(90deg, rgba(29, 78, 216, 0.06) 0%, rgba(59, 130, 246, 0.02) 100%);
}

/* 비활성 패널 */
.meal-panel.inactive {
  opacity: 0.45;
}

.meal-panel.inactive:hover {
  opacity: 0.75;
}

.meal-panel.inactive .panel-center-value {
  display: none;
}

.meal-panel.inactive .panel-corner-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 3;
}

/* 활성 패널 (강조) */
.meal-panel.active {
  flex: 1.8;
  opacity: 1;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--active-card-shadow);
  z-index: 5;
}

[data-theme="light"] .meal-panel.active {
  border-color: rgba(29, 78, 216, 0.3);
}

.meal-panel.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, #60a5fa, var(--primary));
  z-index: 3;
}

.meal-panel.active .panel-center-value {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  z-index: 3;
}

.meal-panel.active .panel-corner-value {
  display: none;
}

.meal-panel.active .meal-name {
  color: var(--primary);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.2);
  font-size: 1.5rem;
}

[data-theme="light"] .meal-panel.active .meal-name {
  color: var(--primary);
  text-shadow: none;
}

.meal-panel.active .meal-time {
  font-size: 0.95rem;
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

/* 정보 영역 */
.panel-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 3;
  pointer-events: none;
}

.meal-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  transition: var(--transition);
}

.meal-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(17, 24, 39, 0.05);
  border: 1px solid var(--panel-border);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  width: fit-content;
  font-weight: 500;
  transition: var(--transition);
}

/* 가운데 거대 카운터 */
.giant-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  font-family: 'Outfit', sans-serif;
  animation: scale-up 0.5s ease;
}

.counter-numerator {
  font-size: 5rem;
  font-weight: 800;
  color: var(--text-main);
  text-shadow: 0 0 25px var(--primary-glow);
  transition: var(--transition);
}

[data-theme="light"] .counter-numerator {
  text-shadow: none;
  color: var(--primary);
}

.counter-divider {
  font-size: 2.8rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.6;
  margin: 0 0.15rem;
}

.counter-denominator {
  font-size: 3.8rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.75;
}

@keyframes scale-up {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 구석 서브 카운터 */
.panel-corner-value {
  text-align: right;
  pointer-events: none;
}

.corner-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.corner-val {
  font-size: 1.8rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
}

/* -------------------------------------------------------------
 * 통합 상세 팝업 모달창 디자인
 * ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--modal-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  width: 95%;
  max-width: 1300px;
  height: 88vh;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(30px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.4s ease,
              background 0.4s ease,
              border-color 0.4s ease;
}

.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--modal-header-bg);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.modal-title-group h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition);
}

.btn-close-modal:hover {
  color: var(--text-main);
  transform: rotate(90deg);
}

.modal-body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 0;
  flex: 1;
}

/* 모달 상단 통계 현황판 */
.modal-summary-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.summary-metric {
  background: var(--modal-metric-bg);
  border: 1px solid var(--modal-metric-border);
  padding: 1.2rem;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.summary-metric.success {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.15);
}

.summary-metric.danger {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.15);
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-val {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  margin-top: 0.2rem;
}

/* 필터 툴바 구성 */
.modal-filter-toolbar {
  background: var(--modal-header-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.modal-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.modal-search-wrapper .search-icon {
  position: absolute;
  left: 0.8rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

#modal-search-name {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  padding: 0.5rem 1rem 0.5rem 2.2rem;
  border-radius: 8px;
  outline: none;
  font-family: var(--font-family);
  font-size: 0.85rem;
  width: 220px;
  transition: var(--transition);
}

#modal-search-name:focus {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  width: 260px;
}

.modal-filter-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.filter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* 통합 그리드 스크롤 컨테이너 */
.modal-grid-wrapper {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.03);
  transition: border-color 0.4s ease;
}

.modal-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.modal-data-table th {
  background: var(--table-header-bg);
  padding: 1rem 1.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.modal-data-table td {
  padding: 0.85rem 1.2rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-main);
  vertical-align: middle;
  transition: border-color 0.4s ease;
}

.modal-data-table tbody tr {
  transition: background-color 0.2s ease;
}

.modal-data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .modal-data-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* 모달 기사 이름 강조 */
.driver-name-cell {
  font-weight: 600;
  color: var(--text-main);
}

/* 필터 버튼 디자인 */
.btn-group {
  display: flex;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 0.2rem;
  border-radius: 8px;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.btn-filter {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.4rem 0.9rem;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-filter:hover {
  color: var(--text-main);
}

.btn-filter.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* 식사 뱃지 */
.meal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  min-width: 82px;
  justify-content: center;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.meal-badge.eaten {
  background: rgba(16, 185, 129, 0.08);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.15);
}

[data-theme="light"] .meal-badge.eaten {
  color: #059669;
}

.meal-badge.missing {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

[data-theme="light"] .meal-badge.missing {
  color: #dc2626;
}

.meal-badge.not-target {
  background: var(--badge-not-target-bg);
  color: var(--badge-not-target-text);
  border: 1px solid var(--badge-not-target-border);
}

.tag-time-text {
  font-size: 0.72rem;
  display: block;
  font-weight: 400;
  font-family: 'Outfit', sans-serif;
  margin-top: 0.05rem;
}

/* 근무반 뱃지 */
.shift-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.shift-badge.morning {
  background: rgba(59, 130, 246, 0.08);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.15);
}

[data-theme="light"] .shift-badge.morning {
  color: #2563eb;
}

.shift-badge.afternoon {
  background: rgba(245, 158, 11, 0.08);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.15);
}

[data-theme="light"] .shift-badge.afternoon {
  color: #d97706;
}

.shift-badge.extra {
  background: rgba(147, 51, 234, 0.08);
  color: #a855f7;
  border: 1px solid rgba(147, 51, 234, 0.15);
}

[data-theme="light"] .shift-badge.extra {
  color: #7c3aed;
}

.badge-extra-driver {
  font-size: 0.68rem;
  background: rgba(147, 51, 234, 0.15);
  color: #a855f7;
  border: 1px solid rgba(147, 51, 234, 0.25);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
  display: inline-block;
  font-weight: 600;
}

[data-theme="light"] .badge-extra-driver {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.18);
}


/* 스크롤바 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(3, 7, 18, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 120, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 120, 120, 0.3);
}

/* 반응형 미디어 쿼리 */
@media (max-width: 1024px) {
  body {
    overflow-y: auto;
  }
  
  .app-container {
    height: auto;
  }
  
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .header-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .meal-panels-container {
    height: 600px;
  }
  
  .meal-panel {
    padding: 1.2rem 1.8rem;
  }
  
  .meal-panel.active {
    flex: 1.3;
  }
  
  .meal-panel.active .meal-name {
    font-size: 1.2rem;
  }
  
  .giant-counter {
    font-size: 3rem;
  }
  
  .modal-card {
    height: 95vh;
  }
  
  .modal-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  #modal-search-name {
    width: 100%;
  }
  
  #modal-search-name:focus {
    width: 100%;
  }
  
  .modal-summary-panel {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
}

/* 실시간 토스트 알림 - 화면 정중앙 대형 오버레이 */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1000;
  pointer-events: none;
}

.toast-notification {
  pointer-events: auto;
  background: var(--panel-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 2px solid rgba(59, 130, 246, 0.25);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  border-radius: 24px;
  padding: 1.8rem 3rem;
  min-width: 520px;
  max-width: 750px;
  display: flex;
  align-items: center;
  gap: 1.8rem;
  color: var(--text-main);
  transform: translateY(40px) scale(0.92);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
}

[data-theme="light"] .toast-notification {
  border-color: rgba(29, 78, 216, 0.2);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
}

.toast-notification.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast-notification.hide {
  transform: translateY(-40px) scale(0.95);
  opacity: 0;
}

.toast-icon {
  font-size: 3.2rem;
  background: rgba(16, 185, 129, 0.15);
  padding: 0.8rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  line-height: 1.35;
}

.toast-title .highlight-name {
  color: var(--success);
}

[data-theme="light"] .toast-title .highlight-name {
  color: #059669;
}

.toast-desc {
  font-size: 1.15rem;
  color: var(--text-muted);
}

/* 메인 패널 기사/기타 서브 통계 스타일 */
.meal-sub-stats {
  display: flex;
  gap: 0.8rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--panel-border);
  width: fit-content;
  transition: var(--transition);
}

[data-theme="light"] .meal-sub-stats {
  background: rgba(0, 0, 0, 0.03);
}

.meal-sub-stats strong {
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  margin-left: 0.2rem;
}

/* 활성 패널일 때 서브 통계 영역도 하이라이트 */
.meal-panel.active .meal-sub-stats {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.18);
}

[data-theme="light"] .meal-panel.active .meal-sub-stats {
  background: rgba(29, 78, 216, 0.05);
  border-color: rgba(29, 78, 216, 0.12);
}

/* 상세 모달 테이블 기사/기타 그룹 구분 헤더 행 */
.table-section-title {
  background: rgba(59, 130, 246, 0.07) !important;
  color: var(--primary) !important;
  font-weight: 700 !important;
  text-align: left;
  padding: 0.7rem 1.2rem !important;
  font-size: 0.85rem !important;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--table-border);
}

[data-theme="light"] .table-section-title {
  background: rgba(29, 78, 216, 0.05) !important;
}

.table-section-title.section-extra {
  background: rgba(147, 51, 234, 0.07) !important;
  color: #a855f7 !important;
}

[data-theme="light"] .table-section-title.section-extra {
  background: rgba(124, 58, 237, 0.05) !important;
  color: #7c3aed !important;
}

/* 상세 모달 요약 카드 서브 정보 스타일 */
.metric-sub-val {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
  margin-top: 0.35rem;
  text-align: center;
}

/* ==========================================================================
   주간 식수 통계 전용 스타일
   ========================================================================== */
.weekly-modal-card,
.monthly-modal-card {
  max-width: 1100px;
  width: 95%;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

.weekly-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  flex: 1;
  padding: 1.5rem;
}

.weekly-nav-container {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 0.35rem 0.8rem;
  border-radius: 20px;
}

.weekly-date-range {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  text-align: center;
}

.weekly-year-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  margin-bottom: 0.2rem;
  display: block;
}

.weekly-month-day-range {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1;
  white-space: nowrap;
}

.btn-nav {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: var(--transition);
}

.btn-nav:hover {
  color: var(--primary);
  background: var(--panel-border-hover);
}

.weekly-chart-wrapper {
  background: var(--modal-metric-bg);
  border: 1px solid var(--modal-metric-border);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  height: 380px;
  width: 100%;
  flex-shrink: 0;
}

.chart-inner-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.chart-inner-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.weekly-table-wrapper {
  background: var(--modal-metric-bg);
  border: 1px solid var(--modal-metric-border);
  border-radius: 16px;
  overflow: auto;
  border: 1px solid var(--table-border);
  flex-shrink: 0;
}

.weekly-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: center;
}

.weekly-data-table th, 
.weekly-data-table td {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--table-border);
  vertical-align: middle;
}

.weekly-data-table th {
  background: var(--table-header-bg);
  color: var(--text-main);
  font-weight: 600;
}

.weekly-data-table th.header-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.4rem;
}

.weekly-data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .weekly-data-table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

/* 식사별 헤더 구분 컬러 */
.header-breakfast {
  border-bottom: 2px solid var(--breakfast-color) !important;
}
.header-lunch {
  border-bottom: 2px solid var(--lunch-color) !important;
}
.header-dinner {
  border-bottom: 2px solid var(--dinner-color) !important;
}

/* 요일별 스타일 */
.weekly-data-table td.weekly-sunday {
  color: var(--danger);
  font-weight: 600;
}
.weekly-data-table td.weekly-saturday {
  color: var(--primary);
  font-weight: 600;
}

/* 총합계 강조 */
.weekly-total-row {
  background: rgba(59, 130, 246, 0.08) !important;
  font-weight: 700;
}
.weekly-total-row td {
  color: var(--primary) !important;
}

[data-theme="light"] .weekly-total-row {
  background: rgba(29, 78, 216, 0.05) !important;
}

@media (max-width: 1024px) {
  .weekly-modal-card {
    height: 95vh;
  }
  
  .weekly-chart-wrapper {
    height: 280px;
  }
}

/* 타이틀 밥 아이콘 및 애니메이션 (배경 없음) */
.title-group h1 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-rice-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  flex-shrink: 0;
}

.title-rice-icon:hover {
  transform: scale(1.12) rotate(-5deg);
}

.steam {
  animation: steam-rise-title 2s infinite ease-in-out;
  opacity: 0;
  stroke: var(--text-muted); /* 텍스트 서브 컬러 연동 */
  stroke-dasharray: 10;
  stroke-dashoffset: 10;
}

/* 라이트 테마 시 스팀 색상 조정 */
[data-theme="light"] .steam {
  stroke: #475569;
}

.steam-1 {
  animation-delay: 0.2s;
}

.steam-2 {
  animation-delay: 0.7s;
}

.steam-3 {
  animation-delay: 1.2s;
}

@keyframes steam-rise-title {
  0% {
    stroke-dashoffset: 10;
    opacity: 0;
    transform: translateY(2px);
  }
  30% {
    opacity: 0.8;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* ==========================================================================
   모바일 및 태블릿 완벽 대응 반응형 스타일 (Viewport <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: 0.6rem;
    overflow-y: auto; /* 모바일 세로 스크롤 허용 */
    height: auto;
    min-height: 100vh;
  }

  .app-container {
    height: auto;
    gap: 0.8rem;
  }

  /* 1. 헤더 영역 최적화 (2단 수직 배열 및 햄버거 드로워 적용) */
  .app-header {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.8rem 1rem !important;
    gap: 0.8rem !important;
  }

  .header-top-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
  }

  .header-left {
    display: flex !important;
    align-items: center !important;
    gap: 0.8rem !important;
    width: auto !important;
  }

  .title-group h1 {
    font-size: 1.15rem;
    justify-content: flex-start;
  }

  .header-bottom-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 0.6rem !important;
    margin-top: 0.2rem !important;
  }

  /* 햄버거 메뉴 버튼 모바일 스타일 (미니멀 서클 패널화) */
  .btn-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    padding: 0;
    transition: var(--transition);
  }

  [data-theme="light"] .btn-hamburger {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .btn-hamburger:active {
    transform: scale(0.92);
  }

  .hamburger-bar {
    width: 18px;
    height: 1.5px;
    background-color: var(--text-main);
    transition: all 0.3s ease;
    border-radius: 1px;
  }

  .btn-hamburger.open .hamburger-bar:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
  }
  .btn-hamburger.open .hamburger-bar:nth-child(2) {
    opacity: 0;
  }
  .btn-hamburger.open .hamburger-bar:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
  }

  /* 데스크톱용 컨트롤 그룹 모바일에서 비활성화 */
  .header-controls-group-desktop {
    display: none !important;
  }

  /* 모바일용 오버레이 사이드 드로워 메뉴 (글래스모피즘 & 명품 곡률 적용) */
  .mobile-drawer-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: rgba(17, 24, 39, 0.82) !important;
    backdrop-filter: blur(30px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(190%) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
    box-shadow: -15px 0 45px rgba(0, 0, 0, 0.4);
    display: flex !important;
    flex-direction: column;
    padding: 2.5rem 1.4rem 1.8rem 1.4rem;
    z-index: 95;
    transition: right 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  }

  [data-theme="light"] .mobile-drawer-menu {
    background: rgba(255, 255, 255, 0.82) !important;
    border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: -15px 0 40px rgba(15, 23, 42, 0.12);
  }

  .mobile-drawer-menu.open {
    right: 0;
  }

  /* 드로워 내부 헤더 영역 */
  .drawer-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 0.4rem;
  }

  .drawer-title-group h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
  }

  .drawer-title-group p {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.1rem;
  }

  .drawer-divider {
    height: 1px;
    background: linear-gradient(to right, var(--panel-border), transparent);
    margin: 0.5rem 0 1.5rem 0;
  }

  /* 드로워 바디 (메뉴 목록) */
  .drawer-body {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
  }

  /* 우아한 리스트 아이템 버튼 스타일 */
  .drawer-menu-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    padding: 0.9rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
  }

  [data-theme="light"] .drawer-menu-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
  }

  .drawer-menu-item:active {
    transform: scale(0.96);
  }

  .drawer-menu-item:hover,
  .drawer-menu-item:focus {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.25);
    outline: none;
  }

  .drawer-menu-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
  }

  .drawer-menu-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.3px;
  }

  /* 드로워 푸터 영역 */
  .drawer-footer {
    padding: 1rem 0.4rem 0.5rem 0.4rem;
    border-top: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .drawer-company-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 2.5px;
    opacity: 0.65;
    padding: 0.5rem 0.4rem;
    text-align: center;
  }

  .auto-refresh-badge {
    padding: 0.45rem 0.60rem;
    font-size: 0.75rem;
    margin: 0 !important;
    flex: none !important;
    height: 34px;
    display: inline-flex;
    align-items: center;
  }

  #refresh-status {
    font-size: 0.78rem !important;
  }

  .date-selector-wrapper {
    flex: 1 !important;
    display: flex;
    gap: 0.5rem;
  }

  .date-picker {
    flex: 1;
    text-align: center;
    font-size: 0.8rem;
    padding: 0.45rem 0.6rem;
    height: 34px;
  }

  .date-selector-wrapper #btn-refresh {
    flex: 1;
    min-width: auto;
  }

  .btn {
    flex: 1;
    min-width: 100px;
    font-size: 0.8rem;
    padding: 0.45rem 0.8rem;
  }

  /* 타원형 찌그러짐 현상 해결: flex 확장 방지 및 완전 원형 유지 */
  .btn-theme {
    flex: none !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  /* 2. 메인 식사 카드 3단 배열 모바일 최적화 (세로 적층) */
  .meal-panels-container {
    flex-direction: column;
    height: auto;
    gap: 0.8rem;
  }

  .meal-panel {
    flex: none !important; /* 모바일은 flex 비율 확장 비활성 */
    height: 160px;
    padding: 1.2rem 1.5rem;
    flex-direction: row; /* 모바일에서도 좌우 흐름 유지하되 콤팩트화 */
    align-items: center;
    border-radius: 16px;
  }

  .meal-panel.active {
    height: 200px;
    border-color: rgba(59, 130, 246, 0.5);
    padding: 1.2rem 0.8rem !important;
  }

  /* 활성 표시 세로선 -> 가로선 변경 */
  .meal-panel.active::after {
    width: 100%;
    height: 4px;
    left: 0;
    top: 0;
    bottom: auto;
  }

  .meal-name {
    font-size: 1.1rem;
  }

  .meal-panel.active .meal-name {
    font-size: 1.2rem !important;
  }

  .meal-time {
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
  }

  /* 활성 카드는 기사/기타 서브 통계를 세로 스택으로 배치하여 가로폭 대폭 절약! */
  .meal-panel.active .meal-sub-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    margin-top: 0.25rem;
  }

  .sub-stat-item {
    font-size: 0.72rem;
  }

  /* 모바일 글씨 크기 조정: 세 자리 수 "123 / 456"이 줄바꿈 없이 한 줄에 나오도록 조율 */
  .giant-counter {
    display: inline-flex !important;
    align-items: baseline !important;
    gap: 0.15rem !important;
    white-space: nowrap !important;
  }

  .counter-numerator {
    font-size: 3.3rem !important;
    letter-spacing: -1px;
  }

  .counter-divider {
    font-size: 2.0rem !important;
    margin: 0 0.05rem !important;
  }

  .counter-denominator {
    font-size: 2.6rem !important;
    letter-spacing: -0.5px;
  }

  .corner-val {
    font-size: 1.5rem;
  }

  /* 3. 모달 팝업 반응형 최적화 & 정돈 */
  .modal-card {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0; /* 모바일 화면 꽉 채우기 */
    position: relative;
  }

  .modal-header {
    padding: 1rem;
    position: relative;
  }

  .modal-title-group h2 {
    font-size: 1.15rem;
    white-space: nowrap; /* 글자가 잘리지 않고 한 줄에 나오도록 강제 */
    padding-right: 40px; /* 우측 닫기 버튼과의 겹침 방지 여백 */
    max-width: 100%;
  }

  .modal-subtitle {
    font-size: 0.75rem;
  }

  /* 닫기 버튼 모바일 슬림화 및 안전 배치 */
  .btn-close-modal {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem !important;
    padding: 0.2rem;
    line-height: 1;
  }

  .btn-close-modal:hover {
    transform: translateY(-50%) rotate(90deg);
  }

  .modal-body {
    padding: 0.8rem;
    gap: 0.8rem;
  }

  /* 수치 요약 영역 모바일 조밀 정돈 */
  .modal-summary-panel {
    grid-template-columns: repeat(3, 1fr); /* 3열 조밀 유지 */
    gap: 0.4rem;
  }

  .summary-metric {
    padding: 0.6rem 0.4rem;
    border-radius: 10px;
  }

  .metric-label {
    font-size: 0.72rem;
  }

  .metric-val {
    font-size: 1.15rem; /* 텍스트 겹침 방지 축소 */
    margin-top: 0.15rem;
  }

  .metric-sub-val {
    font-size: 0.65rem;
    margin-top: 0.1rem;
    line-height: 1.2;
  }

  /* 상세 모달 필터바 세로 스택 & 정돈 */
  .modal-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 0.8rem;
    gap: 0.7rem;
    border-radius: 12px;
  }

  .modal-search-wrapper {
    width: 100%;
  }

  #modal-search-name {
    width: 100% !important;
    padding: 0.45rem 1rem 0.45rem 2.2rem;
    font-size: 0.8rem;
  }

  .modal-filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    width: 100%;
  }

  .filter-label {
    font-size: 0.75rem;
    margin-left: 0.2rem;
  }

  .btn-group {
    width: 100%;
    border-radius: 6px;
  }

  .btn-filter {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0.3rem;
    font-size: 0.72rem;
    border-radius: 4px;
  }

  /* 테이블 가로 스크롤 강제 */
  .modal-grid-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
  }

  .modal-data-table th,
  .modal-data-table td {
    padding: 0.6rem 0.7rem;
    font-size: 0.75rem;
    white-space: nowrap; /* 가로 가독성 확보 */
  }

  .meal-badge {
    min-width: 65px;
    font-size: 0.68rem;
    padding: 0.2rem 0.4rem;
  }

  /* 4. 주간 통계 모달 모바일 겹침 방지 정돈 */
  .weekly-modal-card {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  /* 주간/월간 모달 헤더는 요소가 많으므로 수직 배치 처리 */
  .weekly-modal-card .modal-header,
  .monthly-modal-card .modal-header {
    flex-direction: column;
    align-items: center;
    padding: 1.2rem 1rem;
    gap: 0.8rem;
    text-align: center;
  }

  .weekly-modal-card .modal-title-group,
  .monthly-modal-card .modal-title-group {
    width: 100%;
  }

  .weekly-modal-card .modal-title-group h2,
  .monthly-modal-card .modal-title-group h2 {
    font-size: 1.15rem;
    max-width: 100%;
    text-align: center;
  }

  /* 주간/월간 닫기 버튼 고정 위치 */
  .weekly-modal-card .btn-close-modal,
  .monthly-modal-card .btn-close-modal {
    position: absolute;
    right: 1rem;
    top: 1rem;
    transform: none;
    font-size: 1.8rem !important;
  }

  .weekly-nav-container {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-radius: 16px;
    margin: 0 auto;
  }

  .weekly-date-range {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: auto !important;
  }

  .weekly-year-label {
    font-size: 0.68rem !important;
    margin-bottom: 0.1rem;
    color: var(--text-muted);
  }

  .weekly-month-day-range {
    font-size: 0.95rem !important;
    font-weight: 700;
    white-space: nowrap !important;
  }

  .btn-nav {
    flex: 0 0 auto !important;
    font-size: 0.78rem !important;
    padding: 0.35rem 0.65rem !important;
    border-radius: 8px !important;
    background: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text-main) !important;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  .weekly-modal-body {
    padding: 0.8rem;
    gap: 0.8rem;
    overflow-y: auto !important;
    display: flex;
    flex-direction: column;
    flex: 1;
  }

  .weekly-chart-wrapper {
    height: 200px;
    padding: 0.6rem;
    border-radius: 12px;
    flex-shrink: 0 !important;
  }

  /* 모바일 월간 그래프 가로 터치 스크롤 지원 (뭉침 원천 방지 및 스와이프 촉감 향상) */
  .weekly-chart-wrapper:has(#monthly-chart-container) {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* 캔버스 도화지 자체를 CSS로 인장하지 않고, 감싸는 컨테이너를 넓혀 폰트 찌그러짐 원천 차단 */
  #monthly-chart-container {
    min-width: 800px;
    height: 100%;
  }

  #weekly-chart-container {
    width: 100%;
    height: 100%;
  }

  /* 월간 모바일 그래프용 반투명 슬림 스크롤바 디자인 */
  .weekly-chart-wrapper:has(#monthly-chart-container)::-webkit-scrollbar {
    height: 5px;
  }

  .weekly-chart-wrapper:has(#monthly-chart-container)::-webkit-scrollbar-track {
    background: transparent;
  }

  .weekly-chart-wrapper:has(#monthly-chart-container)::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.35);
    border-radius: 10px;
  }

  [data-theme="light"] .weekly-chart-wrapper:has(#monthly-chart-container)::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.2);
  }

  .weekly-table-wrapper {
    border-radius: 12px;
  }

  .weekly-data-table th, 
  .weekly-data-table td {
    padding: 0.45rem 0.35rem;
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .weekly-data-table th.header-sub {
    font-size: 0.65rem;
    padding: 0.2rem;
  }
}
