@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg: #f0f2f5;
  --sidebar-bg: #1e2a3a;
  --sidebar-hover: #2c3e52;
  --sidebar-active: #2980b9;
  --header-bg: #2c3e52;
  --topbar-bg: #1e2a3a;
  --white: #ffffff;
  --text-main: #2c3e52;
  --text-muted: #7f8c8d;
  --border: #dde1e7;
  --accent-blue: #2980b9;
  --accent-green: #27ae60;
  --accent-orange: #e67e22;
  --accent-red: #e74c3c;
  --row-hover: #eaf4fb;
  --row-alt: #f8fafc;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 6px;
  --font: 'Noto Sans KR', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

/* 팝업 오버레이 스크롤 */
.overlay-open { overflow: hidden !important; }
#receipt-overlay { overflow: hidden; }
#receipt-inner {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ── TOP BAR ── */
.topbar {
  background: var(--topbar-bg);
  color: white;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 100;
}
.topbar-logo {
  font-size: 15px; font-weight: 700; color: white;
  padding: 0 16px;
  border-right: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
  /* ✨ 사이드바와 동일한 200px */
  width: 200px;
  min-width: 200px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  height: 100%;
}
.topbar-nav {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
  padding-left: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 6px;
  padding: 0 18px; height: 100%;
  color: rgba(255,255,255,0.8); font-size: 13px; font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-bottom: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: rgba(41,128,185,0.25); color: white; border-bottom-color: var(--accent-blue); }

/* ✨ 도움말 메뉴 (일반 메뉴 + 외부 링크 ↗ 표시) */
.nav-item.nav-help {
  /* 일반 메뉴와 동일한 스타일 유지 */
}
.nav-item.nav-help .ext-arrow {
  font-size: 11px;
  margin-left: 2px;
  opacity: 0.7;
  transition: all 0.2s ease;
  display: inline-block;
}
.nav-item.nav-help:hover .ext-arrow {
  opacity: 1;
  transform: translate(1px, -1px);
}

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; padding-right: 16px; }
.topbar-user { color: rgba(255,255,255,0.7); font-size: 12px; }
.topbar-btn {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85); padding: 4px 12px; border-radius: 4px;
  font-size: 12px; cursor: pointer; text-decoration: none;
  transition: background 0.15s; font-family: var(--font);
}
.topbar-btn:hover { background: rgba(255,255,255,0.2); color: white; }

/* ── MAIN LAYOUT ── */
.main-layout { display: flex; flex: 1; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  /* ✨ 로고와 너비 통일 (200px) */
  width: 200px;
  min-width: 200px;
  box-sizing: border-box;
  background: var(--sidebar-bg);
  flex-shrink: 0; overflow-y: auto; padding: 10px 0;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.sidebar-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px 7px 18px;
  color: rgba(255,255,255,0.65); font-size: 12px;
  text-decoration: none;
  cursor: pointer; transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,0.9); }
.sidebar-item.active {
  background: rgba(41,128,185,0.2); color: white;
  border-left-color: var(--accent-blue); font-weight: 500;
}
.sidebar-check { font-size: 11px; }
.sidebar-check.done { color: var(--accent-green); }

/* ── CONTENT ── */
.content {
  flex: 1; display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  padding: 12px; gap: 10px;
}
/* ── PAGE HEADER ── */
.page-header {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.page-title {
  font-size: 15px; font-weight: 700; color: var(--text-main);
  display: flex; align-items: center; gap: 6px;
}
.page-title::before {
  content: ''; display: inline-block;
  width: 4px; height: 18px;
  background: var(--accent-blue); border-radius: 2px;
}
.page-header-right { margin-left: auto; display: flex; gap: 6px; }

/* ── TOOLBAR ── */
.toolbar {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 4px;
  overflow: hidden; background: #f8fafc;
}
.search-box input {
  border: none; outline: none; padding: 5px 10px;
  font-size: 12px; width: 160px; background: transparent;
  font-family: var(--font); color: var(--text-main);
}
.toolbar-divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.toolbar-right { margin-left: auto; display: flex; gap: 6px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.15s; font-family: var(--font); white-space: nowrap;
  text-decoration: none;
}
.btn-primary   { background: #2980b9; color: white; border-color: #2471a3; }
.btn-secondary { background: #7f8c8d; color: white; border-color: #6c7a7d; }
.btn-success   { background: #27ae60; color: white; border-color: #229954; }
.btn-warning   { background: #e67e22; color: white; border-color: #ca6f1e; }
.btn-danger    { background: #e74c3c; color: white; border-color: #cb4335; }
.btn-outline   { background: white; color: var(--text-main); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }

/* ── STAT CARDS ── */
.stat-cards { display: flex; gap: 10px; flex-shrink: 0; }
.stat-card {
  flex: 1; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  box-shadow: var(--shadow);
}
.stat-card-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-card-value { font-size: 28px; font-weight: 700; color: var(--text-main); }

/* ── TABLE PANEL ── */
.table-panel {
  flex: 1; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.table-wrap { flex: 1; overflow: auto; min-height: 0; }
.table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: #c8d0da; border-radius: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead tr { background: #2c3e52; color: white; position: sticky; top: 0; z-index: 10; }
th {
  padding: 9px 8px; font-weight: 600; font-size: 11.5px;
  white-space: nowrap; border-right: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}
th:last-child { border-right: none; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; cursor: pointer; }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--row-hover); }
td {
  padding: 7px 8px; white-space: nowrap; color: var(--text-main);
  text-align: center; border-right: 1px solid #eef0f3;
}
td:last-child { border-right: none; }
td.td-left { text-align: left; }
td.td-name { font-weight: 600; color: var(--accent-blue); }
input[type="checkbox"] { accent-color: var(--accent-blue); cursor: pointer; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-red    { background: #fee2e2; color: #dc2626; }

/* ── TABLE FOOTER ── */
.table-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; border-top: 1px solid var(--border);
  background: #f8fafc; flex-shrink: 0;
}
.footer-info { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.footer-info span { color: var(--accent-blue); font-weight: 700; }
.footer-actions { display: flex; gap: 6px; }

/* ── FORM PANEL ── */
.form-panel {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow);
}
.form-section { margin-bottom: 20px; }
.form-section-title {
  font-size: 13px; font-weight: 600; color: var(--text-main);
  margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  border: 1px solid var(--border); border-radius: 4px;
  padding: 6px 10px; font-size: 12px; font-family: var(--font);
  color: var(--text-main); outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent-blue); }
.form-group textarea { resize: vertical; min-height: 70px; }
.required::after { content: ' *'; color: var(--accent-red); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow: hidden; min-width: 400px; max-width: 90vw;
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-header {
  background: var(--header-bg); color: white;
  padding: 12px 16px; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  background: none; border: none; color: white;
  font-size: 18px; cursor: pointer; padding: 0 4px;
}
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; background: #f8fafc;
}

/* ── STATUS BAR ── */
.statusbar {
  background: var(--header-bg); color: rgba(255,255,255,0.8);
  font-size: 12px; padding: 5px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; border-top: 2px solid var(--accent-orange);
}
.statusbar-center { color: var(--accent-orange); font-weight: 600; }
.statusbar-right a {
  color: #5dade2; text-decoration: none; font-weight: 600;
  padding: 2px 10px; border: 1px solid #5dade2; border-radius: 3px;
}

/* ── ALERTS ── */
.alert {
  padding: 10px 14px; border-radius: 4px; font-size: 13px;
  margin-bottom: 10px;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger  { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── PAGINATION ── */
.pagination { display: flex; gap: 4px; align-items: center; }
.page-btn {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px;
  background: white; font-size: 12px; cursor: pointer; color: var(--text-main);
  text-decoration: none; transition: background 0.15s;
}
.page-btn:hover, .page-btn.active {
  background: var(--accent-blue); color: white; border-color: var(--accent-blue);
}

/* ── TABS ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab-btn {
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); background: none; border: none;
  border-bottom: 3px solid transparent; cursor: pointer;
  font-family: var(--font); transition: color 0.15s;
}
.tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
.tab-btn:hover { color: var(--text-main); }
.tab-content { display: none; }
.tab-content.show { display: block; }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { width: 0 !important; min-width: 0 !important; overflow: hidden; }
  .topbar-logo { width: auto; min-width: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-cards { flex-wrap: wrap; }
}

/* ── 사이드바 중메뉴 (그룹 헤더) ── */
.sidebar-group-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  background: rgba(255,255,255,0.05);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 2px;
  letter-spacing: 0.3px;
}
.sidebar-group-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}
.sidebar-group-link.group-active {
  border-left-color: var(--accent-blue);
  color: white;
  background: rgba(41,128,185,0.15);
}

/* 소메뉴 들여쓰기 */
.sidebar-item {
  padding-left: 24px !important;
}

/* 구분선 */
.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 3px 0;
}

/* ── 알림 벨 ── */
.topbar-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 16px;
  text-decoration: none;
  color: rgba(255,255,255,0.7);
  transition: background 0.15s;
  cursor: pointer;
}
.topbar-bell:hover     { background: rgba(255,255,255,0.12); color: white; }
.topbar-bell.bell-active { background: rgba(41,128,185,0.3); color: white; }
.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: #e74c3c;
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 1px solid #1e2a3a;
}


/* ═══════════════════════════════════════════════════
   📖 홈 전용 사이드바 스타일 - 기존 사이드바 디자인 통일
   - sidebar-group-link / sidebar-item 과 동일한 느낌
   - 좌측 강조바 (border-left) 스타일 유지
═══════════════════════════════════════════════════ */

.sidebar-home {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
}

/* 섹션 그룹 헤더 (기존 .sidebar-group-link 스타일 차용) */
.sidebar-home .home-section {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
}

.sidebar-home .home-section-title {
  display: flex;
  align-items: center;
  padding: 8px 14px 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.05);
  border-left: 3px solid transparent;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

/* 공통 링크 기본 스타일 (기존 .sidebar-item과 비슷하게) */
.sidebar-home a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 24px !important;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-home a:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.9);
}

/* 빠른 시작 단계 */
.sidebar-home .home-step.done {
  color: rgba(255,255,255,0.4);
  text-decoration: line-through !important;
}
.sidebar-home .home-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(201, 168, 76, 0.3);
  color: #f0d98a;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.sidebar-home .home-step.done .step-num {
  background: rgba(42, 143, 95, 0.4);
  color: #8FE1B0;
}

/* 오늘 할 일 (긴급은 주황 강조바) */
.sidebar-home .home-task.urgent {
  border-left-color: #E67E22;
  background: rgba(230, 126, 34, 0.08);
  color: rgba(255,255,255,0.9);
}
.sidebar-home .home-task.urgent:hover {
  background: rgba(230, 126, 34, 0.18);
  color: #fff;
}
.sidebar-home .home-task .task-icon {
  font-size: 13px;
  flex-shrink: 0;
}

/* 바로가기 & 도움말 */
.sidebar-home .home-shortcut .sc-icon {
  font-size: 12px;
  width: 18px;
  flex-shrink: 0;
  text-align: center;
}