/* ============================================================
   노리공간 통합 운영관리 시스템 — Custom CSS
   ============================================================ */

:root {
  --sidebar-w:        240px;
  --sidebar-bg:       #1A3C5E;
  --sidebar-hover:    rgba(255,255,255,.08);
  --sidebar-active:   #2E86AB;
  --topbar-h:         56px;
  --accent:           #2E86AB;
  --primary:          #1A3C5E;
  --green:            #1B5E20;
  --amber:            #7B3F00;
  --surface:          #F4F6F9;
  --card-bg:          #FFFFFF;
  --border:           #E0E0E0;
  --text-muted:       #6C757D;
  --radius:           10px;
  --shadow-sm:        0 1px 4px rgba(0,0,0,.08);
  --shadow:           0 2px 12px rgba(0,0,0,.10);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
       background: var(--surface); color: #2D2D2D; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--primary); }

/* ── 사이드바 ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1000; transition: transform .25s ease;
  overflow-y: auto; overflow-x: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.brand-logo { font-size: 22px; color: #64B5F6; }
.brand-name { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -.5px; }
.sidebar-toggle-btn { background: none; border: none; color: #fff; margin-left: auto; font-size: 18px; cursor: pointer; padding: 0; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; background: rgba(0,0,0,.2);
}
.user-avatar {
  width: 36px; height: 36px; background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-avatar-sm {
  width: 28px; height: 28px; background: var(--accent); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; margin-right: 6px;
}
.user-name  { font-size: 13px; font-weight: 600; color: #fff; }
.user-role  { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 2px; }

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: rgba(255,255,255,.4);
               text-transform: uppercase; padding: 14px 20px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: rgba(255,255,255,.8);
  border-radius: 0; transition: all .15s; font-size: 13.5px; cursor: pointer;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-item i { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }

/* ── 메인 래퍼 ─────────────────────────────────────────────── */
.main-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

/* ── 탑바 ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  position: sticky; top: 0; z-index: 900; box-shadow: var(--shadow-sm);
}
.topbar-toggle { background: none; border: none; font-size: 20px; color: var(--text-muted);
                 cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.topbar-toggle:hover { background: var(--surface); }
.topbar-breadcrumb { display: flex; align-items: center; gap: 6px; flex: 1; font-size: 13px; }
.topbar-breadcrumb a { color: var(--text-muted); }
.topbar-breadcrumb .sep { color: var(--border); font-size: 10px; }
.topbar-breadcrumb .current { font-weight: 600; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon { font-size: 18px; color: var(--text-muted); padding: 6px; border-radius: 6px; }
.topbar-icon:hover { background: var(--surface); color: var(--primary); }
.topbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.topbar-user { background: none; border: none; display: flex; align-items: center;
               font-size: 13px; font-weight: 500; cursor: pointer; padding: 6px 10px;
               border-radius: 8px; color: #2D2D2D; }
.topbar-user:hover { background: var(--surface); }

/* ── 콘텐츠 ────────────────────────────────────────────────── */
.content-area { flex: 1; padding: 24px; }

/* ── 페이지 헤더 ───────────────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--primary); margin: 0 0 4px; }
.page-header p  { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ── 카드 ──────────────────────────────────────────────────── */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow-sm); }
.card-header { background: transparent; border-bottom: 1px solid var(--border);
               padding: 14px 20px; font-size: 14px; font-weight: 600; color: var(--primary); }
.card-body { padding: 20px; }
.card-footer { background: transparent; border-top: 1px solid var(--border); padding: 12px 20px; }

/* ── 통계 카드 ─────────────────────────────────────────────── */
.stat-card { border-radius: var(--radius); padding: 20px; color: #fff; position: relative; overflow: hidden; }
.stat-card .stat-label { font-size: 12px; opacity: .85; font-weight: 500; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; margin: 4px 0; }
.stat-card .stat-sub   { font-size: 12px; opacity: .75; }
.stat-card .stat-icon  { position: absolute; right: 16px; top: 16px; font-size: 40px; opacity: .2; }
.stat-blue   { background: linear-gradient(135deg, #1A3C5E, #2E86AB); }
.stat-green  { background: linear-gradient(135deg, #1B5E20, #2E7D32); }
.stat-amber  { background: linear-gradient(135deg, #7B3F00, #F57C00); }
.stat-teal   { background: linear-gradient(135deg, #00695C, #00897B); }
.stat-purple { background: linear-gradient(135deg, #4A235A, #7B1FA2); }
.stat-red    { background: linear-gradient(135deg, #7B1515, #C62828); }

/* ── 테이블 ────────────────────────────────────────────────── */
.table { font-size: 13.5px; }
.table th { background: #F8FAFC; font-weight: 600; font-size: 12px;
            text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted);
            border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { vertical-align: middle; border-bottom: 1px solid #F0F0F0; }
.table-hover tbody tr:hover { background: #F8FAFF; cursor: pointer; }
.table-actions { white-space: nowrap; }

/* ── 뱃지 ──────────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 4px; }

/* ── 브랜드 태그 ───────────────────────────────────────────── */
.brand-tag { display: inline-block; font-size: 11px; padding: 2px 8px;
             border-radius: 99px; font-weight: 600; white-space: nowrap; margin: 1px; }
.brand-pokaeye  { background: #E3F2FD; color: #1565C0; }
.brand-gachap   { background: #E8F5E9; color: #1B5E20; }
.brand-bandai   { background: #FFF3E0; color: #7B3F00; }
.brand-life4cut { background: #F3E5F5; color: #4A235A; }
.brand-crane    { background: #E0F2F1; color: #00695C; }
.brand-saju     { background: #FFEBEE; color: #7B1515; }

/* ── 탭 ────────────────────────────────────────────────────── */
.nav-tabs .nav-link { font-size: 13px; color: var(--text-muted); border: none;
                      border-bottom: 2px solid transparent; padding: 10px 16px; }
.nav-tabs .nav-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.nav-tabs .nav-link.active { color: var(--primary); font-weight: 600;
                              border-bottom-color: var(--primary); background: transparent; }
.tab-content { padding-top: 20px; }

/* ── 폼 ────────────────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.form-control, .form-select { font-size: 13.5px; border-radius: 8px; border: 1px solid var(--border);
                               padding: 8px 12px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,134,171,.15); }
.form-text { font-size: 11px; }
.required::after { content: ' *'; color: #DC3545; }

/* ── 버튼 ──────────────────────────────────────────────────── */
.btn { font-size: 13px; border-radius: 8px; padding: 7px 16px; font-weight: 500; }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-primary  { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── 지점 상세 헤더 ────────────────────────────────────────── */
.branch-hero { background: var(--primary); color: #fff; border-radius: var(--radius);
               padding: 24px 28px; margin-bottom: 20px; }
.branch-hero h2 { font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.branch-hero .meta { font-size: 13px; opacity: .8; }
.branch-hero .actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── CS 댓글 ────────────────────────────────────────────────── */
.comment-wrap { display: flex; gap: 12px; margin-bottom: 16px; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
                  display: flex; align-items: center; justify-content: center;
                  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.comment-avatar.branch { background: var(--green); }
.comment-body { background: #F8FAFF; border: 1px solid var(--border); border-radius: var(--radius);
                padding: 12px 16px; flex: 1; }
.comment-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.comment-text { font-size: 13.5px; line-height: 1.6; }

/* ── 정산서 ─────────────────────────────────────────────────── */
.settlement-table tfoot td { font-weight: 700; background: #F8FAFC; }

/* ── 로그인 ─────────────────────────────────────────────────── */
.login-page { min-height: 100vh; background: var(--primary); display: flex;
              align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px;
              box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo  { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon { font-size: 40px; color: var(--accent); }
.login-logo h1 { font-size: 20px; font-weight: 800; color: var(--primary); margin: 8px 0 2px; }
.login-logo p  { font-size: 12px; color: var(--text-muted); }

/* ── 반응형 ─────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
}

/* ── 유틸 ──────────────────────────────────────────────────── */
.text-primary-custom { color: var(--primary) !important; }
.bg-light-blue { background: #EBF5FB; }
.fw-600 { font-weight: 600; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.gap-8 { gap: 8px; }
.rounded-10 { border-radius: var(--radius); }
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; border: 1px solid var(--border); padding: 5px 10px; font-size: 13px; }
.dataTables_wrapper .dataTables_length select { border-radius: 8px; border: 1px solid var(--border); padding: 4px 8px; font-size: 13px; }

/* ── 설정 서브 메뉴 ─────────────────────────────────────────── */
.nav-sub { margin: 0; background: rgba(0,0,0,0.08); border-radius: 0 0 8px 8px; }
.nav-sub-item {
  padding: 8px 12px 8px 38px !important;
  font-size: 12.5px !important;
  color: #CBD5E1 !important;
  border-left: 3px solid transparent;
  display: flex !important;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.15s;
}
.nav-sub-item i { font-size: 12px !important; color: #94A3B8; flex-shrink:0; }
.nav-sub-item span { color: #CBD5E1; }
.nav-sub-item.active {
  color: #fff !important;
  border-left-color: #2E86AB;
  background: rgba(46,134,171,0.18) !important;
}
.nav-sub-item.active i,
.nav-sub-item.active span { color: #fff !important; }
.nav-sub-item:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.08) !important;
}
.nav-sub-item:hover span,
.nav-sub-item:hover i { color: #fff !important; }

/* 현장점검 피드백 댓글 */
.comment-wrap.field-report {
  border-left: 3px solid #7C3AED;
  background: rgba(139, 92, 246, 0.04);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 8px;
}

/* ─── 상단 빠른메뉴 ────────────────────────────────────── */
.topbar-quickmenu {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
}
.topbar-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity .15s;
}
.topbar-quick-btn:hover { opacity: .85; }
.topbar-quick-btn.primary  { background: var(--accent);  color:#fff; }
.topbar-quick-btn.warning  { background: #F59E0B; color:#fff; }
.topbar-quick-btn.success  { background: #10B981; color:#fff; }

/* ─── 사이드바 brand 링크 정렬 ─────────────────────────── */
.sidebar-brand a {
  color: inherit;
}
.sidebar-brand a .brand-name {
  font-weight: 800;
  font-size: 16px;
}

/* ─── sidebar-user 숨김 ─────────────────────────────────── */
.sidebar-user { display: none !important; }

/* ─── 카드 서브메뉴 들여쓰기 ───────────────────────────── */
#cardsnav .nav-item {
  padding-left: 36px !important;
  font-size: 12.5px;
}
