/* [디자인 수정] Professional B2B SaaS 테마 */
:root {
  --bg-color: #f8fafc;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  
  --text-main: #1e293b;
  --text-sub: #64748b;
  
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  
  --card-bg: #FFFFFF;
  --border-radius: 16px;
  --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --card-border: 1px solid #e2e8f0;
}

body { margin: 0; font-family: "Pretendard Variable", Pretendard, sans-serif; background-color: var(--bg-color); color: var(--text-main); display: flex; height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* 사이드바 애니메이션 및 접힘 상태 스타일 추가 */
.sidebar { width: 220px; background: var(--sidebar-bg); padding: 32px 20px; display: flex; flex-direction: column; z-index: 10; box-shadow: 2px 0 10px rgba(0,0,0,0.1); transition: width 0.3s ease, padding 0.3s ease; }
.sidebar.collapsed { width: 76px; padding: 32px 16px; }
.sidebar.collapsed .logo-text { display: none; }
.sidebar.collapsed .nav-container { display: none; }
.sidebar.collapsed .btn-sidebar-toggle svg { transform: rotate(180deg); }

/* 로고 영역 재배치 */
.logo { font-size: 22px; font-weight: 800; margin-bottom: 40px; color: #ffffff; display: flex; justify-content: space-between; align-items: center; width: 100%; box-sizing: border-box; letter-spacing: 0.5px; }
.logo-left { display: flex; align-items: center; gap: 12px; }
.logo span.logo-icon, .login-card .logo span { color: var(--accent); font-size: 24px; }

/* 토글 버튼 스타일 */
.btn-sidebar-toggle { background: transparent; border: none; color: #94a3b8; cursor: pointer; padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-sidebar-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item { padding: 12px 16px; margin-bottom: 6px; border-radius: 12px; cursor: pointer; color: var(--sidebar-text); font-weight: 600; font-size: 14px; transition: all 0.2s ease; display: flex; align-items: center; }
.nav-item:hover:not(.active) { background: var(--sidebar-hover); color: #f1f5f9; }
.nav-item.active { background: var(--accent); color: #FFFFFF; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.header { display: flex; justify-content: space-between; align-items: center; padding: 28px 40px; background: var(--bg-color); }
.title { font-size: 26px; font-weight: 800; color: var(--text-main); letter-spacing: -0.5px; }

.controls-wrapper { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.controls-top { display: flex; align-items: center; gap: 12px; }
.ad-filter-select { padding: 10px 16px; border-radius: 10px; border: 1px solid #cbd5e1; background: #FFFFFF; color: var(--text-main); font-family: inherit; font-size: 13px; font-weight: 600; outline: none; cursor: pointer; min-width: 160px; transition: border-color 0.2s; }
.ad-filter-select:focus { border-color: var(--accent); }
.date-filter { display: flex; align-items: center; gap: 8px; background: #FFFFFF; padding: 10px 16px; border-radius: 10px; border: 1px solid #cbd5e1; }
.date-filter input { border: none; background: transparent; color: var(--text-main); font-family: inherit; font-size: 13px; font-weight: 600; outline: none; cursor: pointer; width: 190px; text-align: center; }
.btn-export { background: var(--accent); color: white; border: none; padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: 0.2s; }
.btn-export:hover { background: var(--accent-hover); }

.controls-bottom { display: flex; gap: 6px; }
.btn-quick-date { background: #FFFFFF; border: 1px solid #e2e8f0; color: var(--text-sub); padding: 6px 14px; border-radius: 8px; font-size: 12px; cursor: pointer; font-weight: 600; transition: all 0.2s; }
.btn-quick-date:hover { background: #f1f5f9; color: var(--text-main); }
.btn-quick-date.active { background: var(--accent); border-color: var(--accent); color: white; }

.content-scroll { flex: 1; padding: 0 40px 40px 40px; overflow-y: auto; }

.grid-scorecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 24px; }
.card { background: var(--card-bg); padding: 24px; border-radius: var(--border-radius); box-shadow: var(--card-shadow); border: var(--card-border); display: flex; flex-direction: column; }
.scorecard-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.scorecard-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }

.icon-blue { background: #eff6ff; color: #3b82f6; }
.icon-red { background: #fef2f2; color: #ef4444; }
.icon-green { background: #ecfdf5; color: #10b981; }
.icon-orange { background: #fffbeb; color: #f59e0b; }

.card-title { font-size: 14px; color: var(--text-sub); font-weight: 600; margin: 0; }
.card-value { font-size: 28px; font-weight: 800; color: var(--text-main); line-height: 1.2; }
.breakdown-text { font-size: 13px; font-weight: 500; color: var(--text-sub); margin-top: 16px; padding-top: 16px; border-top: 1px dashed #e2e8f0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.breakdown-text b { color: var(--text-main); font-weight: 700; }

.grid-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 24px; }
.grid-charts-full { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 24px; }
.chart-container { position: relative; height: 100%; width: 100%; min-height: 280px; margin-top: 16px; }

.chart-header { display: flex; justify-content: space-between; align-items: center; }
.btn-toggle { background: #f1f5f9; border: 1px solid transparent; padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-sub); cursor: pointer; margin-left: 4px; transition: 0.2s; }
.btn-toggle.active { background: #ffffff; border-color: #cbd5e1; color: var(--text-main); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

.table-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.table-title { font-size: 16px; font-weight: 700; color: var(--text-main); }
.table-wrapper { overflow-x: auto; padding: 0; }
table { width: 100%; min-width: 1200px; border-collapse: collapse; }
th { color: var(--text-sub); font-size: 12px; font-weight: 600; text-transform: uppercase; padding: 14px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; text-align: left; }
td { padding: 14px 16px; color: var(--text-main); font-weight: 500; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
tbody tr:hover { background-color: #f8fafc; }
.row-total td { font-weight: 700; color: var(--accent) !important; border-top: 2px solid #cbd5e1; background: #ffffff; }

.loading { display: flex; justify-content: center; align-items: center; height: 100%; font-size: 15px; font-weight: 600; color: var(--text-sub); }

.ai-dashboard { display: flex; flex-direction: column; gap: 24px; padding-bottom: 40px; }
.ai-card-base { background: #ffffff; border-radius: var(--border-radius); padding: 28px; box-shadow: var(--card-shadow); border: var(--card-border); }
.ai-summary-banner { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: #ffffff; border-radius: var(--border-radius); padding: 32px; box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3); position: relative; overflow: hidden; }
.ai-summary-banner::after { content: ''; position: absolute; top: -50%; right: -10%; width: 300px; height: 300px; background: radial-gradient(circle, rgba(59,130,246,0.2) 0%, rgba(0,0,0,0) 70%); border-radius: 50%; }
.ai-summary-banner span { font-size: 14px; font-weight: 600; color: #94a3b8; display: flex; align-items: center; gap: 8px; }
.ai-summary-banner p { margin: 12px 0 0 0; font-size: 20px; font-weight: 700; line-height: 1.5; color: #ffffff; word-break: keep-all; position: relative; z-index: 1; }
.ai-grid-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ai-highlight-card { display: flex; align-items: center; gap: 20px; padding: 24px; }
.ai-icon-wrapper { font-size: 28px; background: #f1f5f9; width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1; }
.best .ai-icon-wrapper { background: #eff6ff; }
.worst .ai-icon-wrapper { background: #fef2f2; }

.ai-card-content h4 { margin: 0; font-size: 13px; color: var(--text-sub); font-weight: 600; }
.ai-card-content p { margin: 6px 0 0 0; font-size: 18px; font-weight: 700; color: var(--text-main); }
.ai-section h3 { margin: 0 0 16px 0; font-size: 16px; color: var(--text-main); font-weight: 700; }
.ai-text-content { font-size: 14px; line-height: 1.6; color: #475569; font-weight: 500; white-space: pre-wrap; }
.ai-action-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; padding: 20px 24px; font-size: 15px; font-weight: 600; color: #1e40af; line-height: 1.6; white-space: pre-wrap; }
.row-saturday td { color: #3b82f6 !important; font-weight: 700; }
.row-sunday td { color: #ef4444 !important; font-weight: 700; }
/* 로그인 화면 스타일 */
.login-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: var(--bg-color);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999;
}

.login-card {
  background: var(--card-bg);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: var(--card-border);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card .logo {
  justify-content: center;
  margin-bottom: 24px;
  color: var(--text-main);
}

.login-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.login-card p {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-field {
  margin-bottom: 20px;
}

.login-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.login-input:focus {
  border-color: var(--accent);
}

.btn-login {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-login:hover {
  background: var(--accent-hover);
}

.error-msg {
  color: #ef4444;
  font-size: 13px;
  margin-top: 12px;
  display: none; /* 초기에는 숨김 */
  font-weight: 500;
}

/* 로그인 전 본문 숨김 */
.main-dashboard-content {
  display: none;
}
/* 로그인 통과 전에는 대시보드 본문을 숨김 */
.main-dashboard-content {
  display: none; 
  width: 100%;    /* 추가: 가로 화면 꽉 차게 */
  height: 100vh;  /* 추가: 세로 화면 꽉 차게 */
}