/* =====================================================
   퇴직연금 수익률 분석 시스템 - 통합 스타일시트 v3
   ===================================================== */

/* === 기본 리셋 & 폰트 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a56db;
  --primary-dark: #1341b0;
  --primary-light: #e8f0fe;
  --dc-color: #2563eb;
  --dc-light: #eff6ff;
  --dc-border: #93c5fd;
  --irp-color: #7c3aed;
  --irp-light: #f5f3ff;
  --irp-border: #c4b5fd;
  --profit-color: #16a34a;
  --profit-bg: #f0fdf4;
  --loss-color: #dc2626;
  --loss-bg: #fef2f2;
  --neutral-color: #64748b;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-sub: #64748b;
  --text-muted: #94a3b8;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.05), 0 10px 40px rgba(0,0,0,0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* =====================================================
   헤더
   ===================================================== */
.main-header {
  background: linear-gradient(135deg, #1a56db 0%, #1e40af 50%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(26,86,219,0.35);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 12px;
}

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

.logo-icon { font-size: 1.6rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.header-logo h1 { font-size: 1rem; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.header-logo p { font-size: 0.68rem; opacity: 0.8; white-space: nowrap; }

.header-nav { display: flex; gap: 6px; flex-shrink: 0; }

.nav-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 8px;
  color: rgba(255,255,255,0.85); text-decoration: none;
  font-size: 0.82rem; font-weight: 500; transition: var(--transition);
  white-space: nowrap;
}
.nav-btn:hover { background: rgba(255,255,255,0.15); color: white; }
.nav-btn.active { background: rgba(255,255,255,0.22); color: white; font-weight: 700; }

/* =====================================================
   메인 레이아웃
   ===================================================== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* =====================================================
   날짜 섹션
   ===================================================== */
.date-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.date-picker-area { flex: 1; min-width: 260px; }

/* 날짜 모드 탭 */
.date-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.date-mode-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white; color: var(--text-sub);
  font-size: 0.83rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition);
}
.date-mode-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.date-mode-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.date-text-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.today-date-text { font-size: 1.2rem; font-weight: 700; color: var(--text); }

.today-day-badge {
  display: inline-block;
  background: var(--primary);
  color: white; font-size: 0.73rem;
  font-weight: 700; padding: 2px 10px;
  border-radius: 20px;
}
.today-day-badge.weekend { background: #ef4444; }
.today-day-badge.holiday { background: #f97316; }

.holiday-notice {
  display: flex; align-items: center; gap: 8px;
  background: #fef3c7; border: 1px solid #fcd34d;
  border-radius: 8px; padding: 8px 14px;
  font-size: 0.83rem; color: #92400e;
  margin-top: 8px;
}

/* 과거 모드 */
.past-date-row { display: flex; flex-direction: column; gap: 10px; }
.past-date-picker-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 8px 14px;
  width: fit-content;
}
.past-date-input {
  border: none; background: transparent;
  font-size: 1rem; font-weight: 700;
  color: var(--text); font-family: inherit;
  cursor: pointer;
}
.past-date-input:focus { outline: none; }

.past-quick-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-date-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 7px;
  border: 1.5px solid var(--border);
  background: white; color: var(--text-sub);
  font-size: 0.78rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition);
}
.quick-date-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.today-quick-btn { border-color: var(--primary); color: var(--primary); }
.today-quick-btn:hover { background: var(--primary); color: white; }

.past-date-notice {
  padding: 8px 14px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.past-date-notice.info { background: var(--primary-light); color: var(--primary); border: 1px solid var(--dc-border); }
.past-date-notice.warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.past-date-notice.exists { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }

/* 기록 상태 박스 */
.record-status-box {
  display: flex; gap: 16px;
  padding: 14px 18px;
  background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.status-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.status-label { font-size: 0.72rem; color: var(--text-sub); white-space: nowrap; }
.status-badge {
  font-size: 0.78rem; font-weight: 700;
  padding: 3px 12px; border-radius: 20px; white-space: nowrap;
}
.status-badge.pending { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.status-badge.done { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* =====================================================
   ① 통합 요약 카드 - 항상 1줄 3칸
   ===================================================== */
.summary-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  min-width: 0;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.summary-card.total  { border-left: 4px solid var(--primary); }
.summary-card.profit { border-left: 4px solid var(--profit-color); }
.summary-card.daily  { border-left: 4px solid #f59e0b; }

.summary-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.summary-card.total  .summary-icon { background: var(--primary-light); color: var(--primary); }
.summary-card.profit .summary-icon { background: var(--profit-bg); color: var(--profit-color); }
.summary-card.daily  .summary-icon { background: #fffbeb; color: #d97706; }

.summary-info { flex: 1; min-width: 0; }
.summary-label { font-size: 0.7rem; color: var(--text-sub); font-weight: 500; margin-bottom: 2px; white-space: nowrap; }
.summary-value { font-size: 0.95rem; font-weight: 600; color: var(--text); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-sub { font-size: 0.65rem; color: var(--text-sub); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================
   ② DC/IRP 개별 수익 현황 패널
   ===================================================== */
.acct-summary-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.acct-summary-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.acct-summary-card.dc-summary { border-top: 4px solid var(--dc-color); }
.acct-summary-card.irp-summary { border-top: 4px solid var(--irp-color); }

.acct-summary-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
}
.acct-summary-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.acct-summary-account { font-size: 0.72rem; color: var(--text-muted); margin-left: auto; }

.acct-summary-body {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.acct-stat-box {
  padding: 12px 10px;
  border-right: 1px solid var(--border);
  text-align: center;
  min-width: 0;
}
.acct-stat-box:last-child { border-right: none; }
.acct-stat-box.highlight-daily { background: #fffbeb; }
.acct-stat-box.highlight-total { background: var(--profit-bg); }

.acct-stat-label { font-size: 0.65rem; color: var(--text-sub); font-weight: 500; margin-bottom: 3px; }
.acct-stat-value { font-size: 0.95rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-stat-value.profit { color: var(--profit-color); }
.acct-stat-value.loss   { color: var(--loss-color); }
.acct-stat-value.neutral { color: var(--text-muted); }
.acct-stat-sub { font-size: 0.62rem; color: var(--text-sub); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================
   계좌 배지
   ===================================================== */
.account-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800;
  padding: 3px 12px; border-radius: 6px;
  flex-shrink: 0;
}
.account-badge.dc  { background: var(--dc-color); color: white; }
.account-badge.irp { background: var(--irp-color); color: white; }

/* =====================================================
   섹션 타이틀
   ===================================================== */
.section-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
  margin-bottom: 18px;
}
.section-title i { color: var(--primary); }

.input-date-badge {
  font-size: 0.75rem; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; margin-left: 4px;
}
.input-date-badge.today-badge { background: var(--primary); color: white; }
.input-date-badge.past-badge { background: #d97706; color: white; }

/* =====================================================
   입력 섹션
   ===================================================== */
.input-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.accounts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* === 계좌 카드 === */
.account-card {
  border-radius: var(--radius);
  padding: 20px;
  border: 2px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.account-card.dc-card  { background: linear-gradient(135deg, #f8fbff 0%, #eff6ff 100%); border-color: var(--dc-border); }
.account-card.irp-card { background: linear-gradient(135deg, #faf8ff 0%, #f5f3ff 100%); border-color: var(--irp-border); }
.account-card.past-mode { opacity: 0.95; border-style: dashed; }

.account-card-header {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.account-title-info { flex: 1; }
.account-title-info h3 { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.account-number { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.account-prev-info { text-align: right; }
.prev-label { font-size: 0.68rem; color: var(--text-muted); }
.prev-value { font-size: 0.85rem; font-weight: 700; color: var(--text-sub); }

/* === 입력 그룹 === */
.input-group { margin-bottom: 14px; }
.input-group label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; color: var(--text-sub);
  margin-bottom: 6px;
}
.input-group label i { color: var(--text-muted); }
.required { color: #ef4444; font-size: 0.8rem; }
.optional-badge {
  font-size: 0.65rem; font-weight: 600;
  background: var(--bg); color: var(--text-muted);
  padding: 1px 7px; border-radius: 10px;
  border: 1px solid var(--border);
}

.input-wrapper { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: white; overflow: hidden; }
.input-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }

.input-prefix { padding: 0 10px; font-size: 0.9rem; color: var(--text-sub); font-weight: 600; white-space: nowrap; }

.value-input, .memo-input {
  width: 100%; padding: 10px 12px;
  border: none; background: transparent;
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  font-family: inherit; outline: none;
}
.memo-input { border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: white; }
.memo-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.input-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* === 실시간 결과 박스 === */
.live-result {
  border-radius: 10px; padding: 14px 16px;
  margin: 14px 0; border: 1px solid;
}
.dc-result  { background: rgba(37,99,235,0.04); border-color: rgba(37,99,235,0.18); }
.irp-result { background: rgba(124,58,237,0.04); border-color: rgba(124,58,237,0.18); }

.result-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 0.83rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.result-row:last-child { border-bottom: none; }
.result-row.highlight { font-weight: 700; padding-top: 8px; }
.result-value { font-weight: 600; font-size: 0.95rem; }
.result-value.profit { color: var(--profit-color); }
.result-value.loss   { color: var(--loss-color); }
.result-value.neutral { color: var(--text-muted); }

/* === 저장 버튼 === */
.save-section { margin-top: 22px; text-align: center; }

.save-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white; font-size: 1rem; font-weight: 700;
  border: none; cursor: pointer; font-family: inherit;
  box-shadow: 0 4px 16px rgba(26,86,219,0.35);
  transition: var(--transition);
  min-width: 220px;
}
.save-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,86,219,0.4); }
.save-btn:active { transform: translateY(0); }
.save-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.save-btn.saved { background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); box-shadow: 0 4px 16px rgba(22,163,74,0.35); }
.save-btn.past-mode { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); box-shadow: 0 4px 16px rgba(217,119,6,0.35); }

.save-notice { font-size: 0.75rem; color: var(--text-muted); margin-top: 10px; }

/* =====================================================
   최근 기록 테이블
   ===================================================== */
.recent-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.recent-table-wrap { overflow-x: auto; }

.recent-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.85rem;
}
.recent-table th {
  padding: 10px 12px; background: var(--bg);
  font-weight: 700; color: var(--text-sub);
  border-bottom: 2px solid var(--border);
  white-space: nowrap; text-align: center;
}
.recent-table td {
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  text-align: center; vertical-align: middle;
}
.recent-table tr:last-child td { border-bottom: none; }
.recent-table tr:hover { background: var(--bg); }
.no-data { text-align: center !important; color: var(--text-muted); padding: 30px !important; }

/* 수익/손실 색상 */
.profit-text { color: var(--profit-color) !important; font-weight: 700; }
.loss-text   { color: var(--loss-color) !important; font-weight: 700; }
.neutral-text { color: var(--text-muted); }

/* =====================================================
   토스트
   ===================================================== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 20px; border-radius: 12px;
  background: #1e293b; color: white;
  font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 9999; transition: opacity 0.3s ease;
  max-width: 380px;
}
.toast.hidden { display: none; }
.toast.success { background: #15803d; }
.toast.error   { background: #dc2626; }
.toast.warning { background: #d97706; }

/* =====================================================
   모달
   ===================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: white; border-radius: 20px;
  padding: 36px 40px; max-width: 500px; width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}

.modal-header { text-align: center; margin-bottom: 28px; }
.modal-icon { font-size: 2.5rem; color: var(--primary); display: block; margin-bottom: 12px; }
.modal-header h2 { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.modal-header p { font-size: 0.85rem; color: var(--text-sub); line-height: 1.6; }

.modal-body { display: flex; flex-direction: column; gap: 18px; }
.setup-group { display: flex; flex-direction: column; gap: 8px; }
.setup-group label { font-size: 0.85rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }

.date-input {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 0.95rem; font-family: inherit;
  color: var(--text); cursor: pointer; outline: none;
}
.date-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }

.modal-footer { margin-top: 28px; display: flex; gap: 10px; justify-content: center; }

.modal-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 32px; border-radius: 10px;
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: inherit; border: none;
  transition: var(--transition);
}
.modal-btn.primary { background: var(--primary); color: white; }
.modal-btn.primary:hover { background: var(--primary-dark); }
.modal-btn.secondary { background: var(--bg); color: var(--text-sub); border: 1.5px solid var(--border); }
.modal-btn.secondary:hover { background: var(--border); }

/* =====================================================
   분석 페이지 - 통계 그리드
   ===================================================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
  min-width: 0;
}
.stat-box:nth-child(1) { border-top: 3px solid var(--primary); }
.stat-box:nth-child(2) { border-top: 3px solid var(--profit-color); }
.stat-box:nth-child(3) { border-top: 3px solid #f59e0b; }
.stat-box:nth-child(4) { border-top: 3px solid var(--loss-color); }
.stat-label { font-size: 0.68rem; color: var(--text-sub); font-weight: 500; margin-bottom: 5px; white-space: nowrap; }
.stat-val { font-size: 0.95rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-val.profit-text { color: var(--profit-color) !important; font-weight: 600; }
.stat-val.loss-text   { color: var(--loss-color)   !important; font-weight: 600; }
.stat-sub { font-size: 0.65rem; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =====================================================
   분석 페이지 - 차트 카드
   ===================================================== */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-title {
  font-size: 0.92rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.chart-title i { color: var(--primary); }

.chart-container { height: 280px; position: relative; }
.chart-container-lg { height: 360px; position: relative; }

/* 탭 내비게이션 */
.tab-nav {
  display: flex; gap: 4px;
  background: var(--bg); border-radius: 10px;
  padding: 4px; margin-bottom: 20px;
  width: fit-content;
}

.tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  border: none; background: transparent;
  color: var(--text-sub); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { background: rgba(26,86,219,0.08); color: var(--primary); }
.tab-btn.active { background: white; color: var(--primary); box-shadow: 0 1px 6px rgba(0,0,0,0.1); }

.chart-panel.hidden { display: none; }

/* 기간/계좌 필터 버튼 */
.period-btn, .account-filter-btn {
  padding: 7px 14px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white; color: var(--text-sub);
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition);
  white-space: nowrap;
}
.period-btn.active, .account-filter-btn.active {
  background: var(--primary); color: white; border-color: var(--primary);
}
.period-btn:hover:not(.active), .account-filter-btn:hover:not(.active) {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}

/* =====================================================
   기록 조회 페이지
   ===================================================== */
.filter-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 0.78rem; font-weight: 600; color: var(--text-sub); white-space: nowrap; }

.filter-select, .filter-date {
  padding: 7px 12px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white; color: var(--text);
  font-size: 0.82rem; font-family: inherit;
  outline: none; cursor: pointer;
}
.filter-select:focus, .filter-date:focus { border-color: var(--primary); }

.filter-btn {
  padding: 7px 14px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white; color: var(--text-sub);
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition);
}
.filter-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.filter-btn.primary { background: var(--primary); color: white; border-color: var(--primary); }
.filter-btn.primary:hover { background: var(--primary-dark); }

/* 전체 기록 테이블 */
.full-table-wrap { overflow-x: auto; }
.full-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.82rem;
}
.full-table th {
  padding: 10px 12px; background: var(--bg);
  font-weight: 700; color: var(--text-sub);
  border-bottom: 2px solid var(--border);
  white-space: nowrap; text-align: center;
  cursor: pointer;
}
.full-table th:hover { color: var(--primary); }
.full-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  text-align: center; vertical-align: middle;
  white-space: nowrap;
}
.full-table tr:hover { background: #f8fafc; }

/* 수정/삭제 버튼 */
.action-btn {
  padding: 4px 10px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 600;
  cursor: pointer; border: 1.5px solid;
  font-family: inherit; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 4px;
}
.action-btn.edit { color: var(--primary); border-color: var(--dc-border); background: var(--dc-light); }
.action-btn.edit:hover { background: var(--primary); color: white; }
.action-btn.delete { color: var(--loss-color); border-color: #fca5a5; background: var(--loss-bg); }
.action-btn.delete:hover { background: var(--loss-color); color: white; }

/* 페이지네이션 */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 18px;
}
.page-btn {
  padding: 6px 12px; border-radius: 7px;
  border: 1.5px solid var(--border);
  background: white; color: var(--text-sub);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition);
}
.page-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =====================================================
   유틸리티
   ===================================================== */
.hidden { display: none !important; }

/* =====================================================
   KOSPI 배너
   ===================================================== */
.kospi-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius); padding: 14px 22px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  border: 1px solid #334155;
  flex-wrap: wrap; gap: 10px;
}
.kospi-banner-left {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.kospi-banner-left i {
  color: #f59e0b; font-size: 1.2rem;
}
.kospi-title {
  font-size: 0.82rem; font-weight: 800; color: #94a3b8;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.kospi-index {
  font-size: 1.25rem; font-weight: 700; color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.kospi-change {
  font-size: 0.88rem; font-weight: 600;
  padding: 2px 10px; border-radius: 20px;
  background: rgba(255,255,255,0.07);
}
.kospi-banner-right {
  display: flex; align-items: center; gap: 12px;
}
.kospi-meta {
  font-size: 0.72rem; color: #64748b; font-weight: 500;
}
.kospi-status {
  font-size: 0.72rem; font-weight: 600;
  background: rgba(245,158,11,0.15); color: #f59e0b;
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid rgba(245,158,11,0.3);
}

/* =====================================================
   KOSPI 비교 차트 - 기준 버튼
   ===================================================== */
.kospi-base-btn {
  padding: 5px 14px; border-radius: 8px; border: 1.5px solid var(--border);
  background: white; color: var(--text-sub);
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: var(--transition);
}
.kospi-base-btn:hover  { border-color: #f59e0b; color: #d97706; }
.kospi-base-btn.active { background: #f59e0b; color: white; border-color: #f59e0b; }

/* =====================================================
   KOSPI 요약 통계 행
   ===================================================== */
.kospi-stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; margin-top: 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.kospi-stat-item {
  padding: 14px 16px; text-align: center;
  border-right: 1px solid var(--border);
  background: var(--card-bg);
}
.kospi-stat-item:last-child { border-right: none; }
.kospi-stat-item.beat    { background: var(--profit-bg); }
.kospi-stat-item.behind  { background: #fef2f2; }
.kospi-stat-label {
  font-size: 0.68rem; color: var(--text-sub); font-weight: 600;
  margin-bottom: 6px; white-space: nowrap;
}
.kospi-stat-label i { margin-right: 3px; }
.kospi-stat-val {
  font-size: 0.95rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kospi-stat-sub {
  font-size: 0.68rem; color: var(--text-muted); margin-top: 4px;
}

@media (max-width: 900px) {
  .kospi-stat-row { grid-template-columns: repeat(2, 1fr); }
  .kospi-stat-item:nth-child(2) { border-right: none; }
  .kospi-stat-item:nth-child(3),
  .kospi-stat-item:nth-child(4) { border-top: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .kospi-stat-row { grid-template-columns: 1fr; }
  .kospi-stat-item { border-right: none !important; border-bottom: 1px solid var(--border); }
  .kospi-stat-item:last-child { border-bottom: none; }
  .kospi-banner { flex-direction: column; align-items: flex-start; }
}

/* KOSPI 추정 모드 배너 */
.kospi-banner.sim-mode {
  background: linear-gradient(135deg, #2d2a1e 0%, #1c1a0e 100%);
  border-color: #f59e0b;
  opacity: 0.88;
}

/* KOSPI 추정 안내 박스 */
.kospi-sim-notice-box {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: #92400e;
}
.kospi-sim-notice-box.hidden { display: none !important; }

/* CSV 내보내기 버튼 */
.export-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 8px;
  background: var(--profit-bg); color: var(--profit-color);
  border: 1.5px solid #86efac; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: var(--transition);
  text-decoration: none;
}
.export-btn:hover { background: var(--profit-color); color: white; }

/* =====================================================
   반응형
   ===================================================== */
@media (max-width: 900px) {
  .summary-section { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .acct-summary-section { grid-template-columns: 1fr; }
  .accounts-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-value { font-size: 0.95rem; }
}

@media (max-width: 640px) {
  .header-inner { padding: 0 14px; height: 56px; }
  .header-logo p { display: none; }
  .nav-btn { padding: 6px 10px; font-size: 0.76rem; }
  .main-content { padding: 16px 14px; gap: 16px; }
  .summary-section { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .input-section { padding: 18px 16px; }
  .accounts-grid { grid-template-columns: 1fr; }
  .acct-summary-body { grid-template-columns: 1fr; }
  .acct-stat-box { border-right: none; border-bottom: 1px solid var(--border); }
  .acct-stat-box:last-child { border-bottom: none; }
  .save-btn { width: 100%; justify-content: center; }
  .recent-section { padding: 18px 14px; }
  .tab-nav { width: 100%; }
  .tab-btn { flex: 1; justify-content: center; font-size: 0.76rem; padding: 7px 10px; }
}

/* =====================================================
   인쇄 버튼
   ===================================================== */
.print-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white; color: var(--text-sub);
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: var(--transition); text-decoration: none;
  white-space: nowrap;
}
.print-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* =====================================================
   인쇄 미디어 쿼리 (A4 세로 기준)
   ===================================================== */
@media print {
  /* 공통 인쇄 숨김 */
  .main-header,
  .no-print,
  .save-section,
  .date-mode-tabs,
  .past-quick-btns,
  .past-date-notice,
  .pagination,
  #toast,
  .modal-overlay,
  .action-btn,
  .export-btn,
  .filter-btn,
  .filter-bar .filter-btn.primary,
  button[onclick*="print"],
  .print-btn {
    display: none !important;
  }

  /* 페이지 여백 */
  @page {
    size: A4 portrait;
    margin: 15mm 12mm 15mm 12mm;
  }

  body {
    background: white !important;
    font-size: 10pt;
    color: #000 !important;
  }

  .main-content {
    max-width: 100% !important;
    padding: 0 !important;
    gap: 14pt !important;
  }

  /* 카드/섹션 */
  .summary-card,
  .acct-summary-card,
  .input-section,
  .recent-section,
  .chart-card,
  .stat-box,
  .filter-bar {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    border-radius: 6pt !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* 요약 카드 3칸 유지 */
  .summary-section {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8pt !important;
  }

  /* DC/IRP 패널 */
  .acct-summary-section {
    grid-template-columns: 1fr 1fr !important;
    gap: 8pt !important;
  }

  /* 입력 폼 2열 */
  .accounts-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10pt !important;
  }

  /* 통계 그리드 */
  .stat-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* 차트 크기 조정 */
  .chart-container    { height: 180pt !important; }
  .chart-container-lg { height: 220pt !important; }

  /* 테이블 */
  .recent-table,
  .full-table {
    font-size: 8pt !important;
  }
  .recent-table th, .recent-table td,
  .full-table th,  .full-table td {
    padding: 5pt 6pt !important;
  }

  /* 색상 유지 */
  .profit-text { color: #16a34a !important; }
  .loss-text   { color: #dc2626 !important; }

  /* 헤더 인쇄용 */
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 14pt;
    border-bottom: 2px solid #1a56db;
    padding-bottom: 8pt;
  }
  .print-header h1 {
    font-size: 14pt; font-weight: 900; color: #1a56db;
  }
  .print-header p {
    font-size: 9pt; color: #666; margin-top: 3pt;
  }
}
