/* ==========================================================================
   JP Smart Work Place - 총무팀 업무 전용 스타일시트 (style.css)
   담당: 김수현 총무 (Kim Su-hyun, General Affairs Team)
   ========================================================================== */

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --sidebar-bg: #fbfcfd;
  --sidebar-border: #e2e8f0;
  --sidebar-text: #334155;
  --sidebar-hover: #f1f5f9;
  
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --success-color: #10b981;
  --success-light: #ecfdf5;
  --warning-color: #f59e0b;
  --warning-light: #fffbeb;
  --danger-color: #ef4444;
  --danger-light: #fef2f2;
  --info-color: #0284c7;
  --info-light: #f0f9ff;
  
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

/* 글자 크기 배율 지원 */
body.font-size-80 { font-size: 11.5px; }
body.font-size-90 { font-size: 13px; }
body.font-size-100 { font-size: 14.5px; }
body.font-size-110 { font-size: 16px; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, "Apple SD Gothic Neo", sans-serif;
  color: var(--text-main);
  background-color: var(--bg-main);
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ================= 앱 전체 레이아웃 ================= */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ================= 좌측 사이드바 (캡처 화면 100% 미러링) ================= */
.sidebar {
  width: 230px;
  min-width: 230px;
  background-color: #ffffff;
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.2s ease, min-width 0.2s ease;
  z-index: 20;
}

.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .sidebar-user-block,
.sidebar.collapsed .menu-section-title,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .caret-down-icon,
.sidebar.collapsed .sidebar-footer .system-info {
  display: none !important;
}

.sidebar.collapsed .sidebar-header {
  padding: 12px 8px;
  justify-content: center;
}

.sidebar.collapsed .menu-item a {
  justify-content: center;
  padding: 9px 0;
}

/* 사이드바 상단 헤더 & 로고 */
.sidebar-header {
  padding: 14px 16px 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-badge {
  width: 32px;
  height: 32px;
  background-color: #2b3952;
  color: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-text h2 {
  font-size: 13.5px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-text p {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* 사이드바 사용자 블록 (캡처 화면 직관적 배치) */
.sidebar-user-block {
  padding: 10px 16px 12px;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
}

.user-block-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.user-block-email {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

/* 메뉴 영역 */
.sidebar-menu-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.sidebar-menu-wrapper::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu-wrapper::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

.menu-section {
  margin-bottom: 14px;
}

.menu-section.focus-section {
  border: 2px solid #ef4444;
  border-radius: 6px;
  padding: 4px;
  background-color: #fffafb;
  margin-bottom: 14px;
}

.menu-section-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  padding: 6px 8px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-operator {
  font-size: 10px;
  background-color: #fee2e2;
  color: #dc2626;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.menu-list {
  list-style: none;
}

.menu-item {
  margin-bottom: 1px;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  color: #334155;
  text-decoration: none;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  font-weight: 500;
}

.menu-item a:hover {
  background-color: #f1f5f9;
  color: var(--primary-color);
}

.menu-item.active a {
  background-color: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
}

.focus-section .menu-item.active a {
  background-color: #eff6ff;
  color: var(--primary-color);
  font-weight: 700;
}

.menu-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  stroke: currentColor;
}

.caret-down-icon {
  margin-left: auto;
  stroke: #94a3b8;
}

/* 사이드바 하단 푸터 */
.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--sidebar-border);
  background-color: #ffffff;
  font-size: 11px;
}

.system-info {
  margin-bottom: 8px;
}

.system-info .version {
  font-weight: 600;
  color: #475569;
}

.system-info .developer {
  font-size: 10px;
  color: #94a3b8;
}

.btn-collapse {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 5px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #475569;
  cursor: pointer;
}
.btn-collapse:hover {
  background-color: #e2e8f0;
}

/* ================= 메인 컨텐츠 영역 ================= */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: #f8fafc;
}

/* 상단 탑 헤더 */
.top-header {
  height: 48px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
}
.breadcrumb .depth1 { color: #64748b; }
.breadcrumb .separator { color: #cbd5e1; font-size: 10px; }
.breadcrumb .depth2 { color: #0f172a; font-weight: 700; }

.operator-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}
.operator-badge-wrap .badge-title {
  font-size: 10px;
  background: #2563eb;
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}
.operator-badge-wrap .badge-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-switcher-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #475569;
}
.account-select {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11.5px;
  background: #fff;
  color: #0f172a;
  font-weight: 600;
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #64748b;
}
.font-size-control select {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11.5px;
  background: #fff;
}

.live-clock {
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  background-color: #f1f5f9;
  padding: 4px 8px;
  border-radius: 4px;
}

/* ================= 뷰 패널 컨테이너 ================= */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.view-panel {
  display: none;
}
.view-panel.active {
  display: block;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= 공통 컴포넌트 ================= */

/* 헤더 바 */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.view-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}
.view-header .view-desc {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* KPI 카드 그리드 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: var(--primary-color);
}
.kpi-card.warning::before { background-color: var(--warning-color); }
.kpi-card.danger::before { background-color: var(--danger-color); }
.kpi-card.success::before { background-color: var(--success-color); }

.kpi-card .kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-card .kpi-value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 6px;
  letter-spacing: -0.5px;
}
.kpi-card .kpi-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* 툴바 & 필터 바 */
.toolbar-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  width: 260px;
}
.search-input-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  width: 100%;
  color: #0f172a;
}
.search-input-box svg {
  stroke: #94a3b8;
}

.filter-select {
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 12px;
  color: #334155;
  outline: none;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}
.btn-secondary {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: #334155;
}
.btn-secondary:hover {
  background-color: #f1f5f9;
}
.btn-success {
  background-color: var(--success-color);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #059669;
}
.btn-danger {
  background-color: var(--danger-color);
  color: #ffffff;
}
.btn-outline-primary {
  background-color: transparent;
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.btn-outline-primary:hover {
  background-color: var(--primary-light);
}
.btn-xs {
  padding: 2px 6px;
  font-size: 11px;
}

/* 데이터 테이블 컨테이너 */
.table-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  max-height: calc(100vh - 280px);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.custom-table thead {
  position: sticky;
  top: 0;
  background-color: #f8fafc;
  z-index: 5;
  border-bottom: 2px solid var(--border-color);
}

.custom-table th {
  padding: 9px 12px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  font-size: 11.5px;
}

.custom-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  white-space: nowrap;
}

.custom-table tbody tr:hover {
  background-color: #f8fafc;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* 뱃지 */
.pill-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
}
.pill-badge.unpaid { background-color: #fee2e2; color: #b91c1c; }
.pill-badge.partial { background-color: #fef3c7; color: #b45309; }
.pill-badge.promised { background-color: #dbeafe; color: #1d4ed8; }
.pill-badge.overdue { background-color: #f43f5e; color: #ffffff; }
.pill-badge.paid { background-color: #d1fae5; color: #047857; }
.pill-badge.normal { background-color: #e2e8f0; color: #475569; }

.pill-badge.success { background-color: #d1fae5; color: #047857; }
.pill-badge.waiting { background-color: #fef3c7; color: #b45309; }
.pill-badge.error { background-color: #fee2e2; color: #b91c1c; }

/* 금액 하이라이트 */
.amount-danger {
  font-weight: 700;
  color: #dc2626;
}
.amount-success {
  font-weight: 700;
  color: #059669;
}
.amount-primary {
  font-weight: 700;
  color: #2563eb;
}

/* 카드형 그리드 (회사·팀 관리용) */
.company-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.company-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}
.company-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.company-box-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.company-meta-row {
  display: flex;
  gap: 12px;
  font-size: 11.5px;
  color: #64748b;
  margin-bottom: 6px;
}

/* 모달 레이아웃 */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-dialog {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 540px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(15px); }
  to { transform: translateY(0); }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.btn-close-modal {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
}
.btn-close-modal:hover { color: #0f172a; }

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  background-color: #f8fafc;
}

.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12.5px;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary-color);
}

/* 토스트 알림 */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-msg {
  background: #1e293b;
  color: #ffffff;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideToast 0.2s ease;
}
@keyframes slideToast {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
