/* =========================================================
   스킨: finly — 운영 CMS 전용 (body[data-skin="finly"])
   밝은 사이드바 · 인사말 헤더 · 라벤더 라운드 컨테이너 · 라이트/다크
   색은 이 파일 상단 변수만 바꾸면 된다.
   ========================================================= */
@font-face { font-family: "Poppins"; src: url("../../fonts/poppins-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../../fonts/poppins-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../../fonts/poppins-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* ---------- 라이트 ---------- */
body[data-skin="finly"] {
  --f-bg: #eef1f2;
  --f-frame: #dddcf5;
  --f-card: #ffffff;
  --f-card-soft: #f5f5fa;
  --f-text: #1d1d24;
  --f-sub: #6c6c7a;
  --f-muted: #a2a2b0;
  --f-line: #ececf2;
  --f-pill: #ffffff;
  --f-toggle-bg: #5b5b60;

  --f-purple: #8c7cf0;
  --f-primary: var(--f-purple);   /* 포인트 색: 시스템별로 바뀜 */
  --f-primary-2: #c4b8ff;
  --f-yellow: #f6bd2b;
  --f-lime: #d3f45b;
  --f-teal: #1f9b97;
  --f-sky: #a8c7fb;
  --f-red: #ef4a5a;
  --f-green: #2bb673;

  /* 공통 토큰을 스킨 값으로 덮어쓴다 → 기존 컴포넌트가 그대로 따라온다 */
  --font-text: "Poppins", "HyundaiText", "Malgun Gothic", sans-serif;
  --font-head: "Poppins", "HyundaiText", "Malgun Gothic", sans-serif;
  --c-bg: var(--f-bg);
  --c-surface: var(--f-card);
  --c-line: var(--f-line);
  --c-line-strong: var(--f-line);
  --c-text: var(--f-text);
  --c-sub: var(--f-sub);
  --c-muted: var(--f-muted);
  --c-primary: var(--f-primary);
  --c-primary-soft: rgba(140, 124, 240, .14);
  --c-accent: var(--f-primary);
  --c-ok: #16956a;   --c-ok-soft: rgba(43, 182, 115, .14);
  --c-info: #5b49d6; --c-info-soft: rgba(140, 124, 240, .16);
  --c-warn: #b07800; --c-warn-soft: rgba(246, 189, 43, .2);
  --c-err: #d93848;  --c-err-soft: rgba(239, 74, 90, .14);
  --c-off: #8b8b98;  --c-off-soft: rgba(139, 139, 152, .14);
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: none;
}

/* ---------- 리서치 데이터 대시보드: 파랑 포인트 ---------- */
body[data-skin="finly"][data-system="research"] {
  --f-frame: #dbe4f7;
  --f-primary: #4c7df0;
  --f-primary-2: #9fbaf9;
  --c-primary: var(--f-primary);
  --c-primary-soft: rgba(76, 125, 240, .14);
  --c-accent: var(--f-primary);
  --c-info: #2f5fd0;
  --c-info-soft: rgba(76, 125, 240, .16);
}
body[data-skin="finly"][data-system="research"][data-theme="dark"] {
  --f-frame: #444851;
  --c-info: #9fbaf9;
}

/* ---------- 다크 ---------- */
body[data-skin="finly"][data-theme="dark"] {
  --f-bg: #3a3a3a;
  --f-frame: #474747;
  --f-card: #2d2d2d;
  --f-card-soft: #363636;
  --f-text: #f2f2f4;
  --f-sub: #b4b4bc;
  --f-muted: #85858f;
  --f-line: #424242;
  --f-pill: #4a4a4a;
  --f-toggle-bg: #d6d6d9;
  --c-ok: #4fd39a;
  --c-info: #b3a8ff;
  --c-warn: #f6c94f;
  --c-err: #ff7a86;
  --c-off: #a6a6b0;
}

body[data-skin="finly"] { font-weight: 400; }

/* ---------- 셸 ---------- */
.app--finly {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);   /* 내용이 길어도 화면 높이를 넘지 않게 */
  height: 100vh;
  background: var(--f-bg);
}

.app--finly .sidebar {
  background: transparent;
  color: var(--f-text);
  padding: 22px 18px 18px 26px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 0; overflow-y: auto;
  scrollbar-width: none;               /* 스크롤 막대 숨김 (작은 화면에서는 휠로 스크롤) */
}
.app--finly .sidebar::-webkit-scrollbar { display: none; }
.app--finly .brand { display: flex; align-items: center; gap: 6px; color: var(--f-text); margin-bottom: 18px; }
.app--finly .brand:hover { text-decoration: none; }
.app--finly .brand__icon { color: var(--f-primary); width: 22px; height: 22px; }
.app--finly .brand__name { font-size: 20px; font-weight: 400; letter-spacing: -.01em; }

.app--finly .sidebar__actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 16px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 999px;
  background: var(--f-pill); color: var(--f-text);
  font-size: var(--fs-md);
}
.pill-btn:hover { text-decoration: none; filter: brightness(.97); }
.pill-btn .lucide { width: 15px; height: 15px; }

.app--finly .nav-group { margin-bottom: 4px; }
.app--finly .nav-group__label { padding: 2px 12px; color: var(--f-muted); font-size: var(--fs-xs); }
.app--finly .nav-link {
  gap: 10px; padding: 4px 12px; margin: 1px 0;
  color: var(--f-text); border-left: 0; border-radius: 999px;
  font-size: 16px;
}
.app--finly .nav-link:hover { background: var(--f-card-soft); }
.app--finly .nav-link__label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app--finly .nav-link__icon { width: 20px; height: 20px; flex: none; }
.app--finly .nav-link__chevron { width: 15px; height: 15px; display: none; }
.app--finly .nav-link.is-active { background: var(--f-primary); color: #fff; }
.app--finly .nav-link.is-active .nav-link__chevron { display: block; }
.app--finly .nav-link.is-active .tag-dot { display: none; }
.app--finly .tag-dot { width: 6px; height: 6px; }

.app--finly .sidebar__foot { display: flex; flex-direction: column; gap: 10px; }
.app--finly .sidebar__legend { border-top: 0; padding: 0 12px; color: var(--f-sub); font-size: var(--fs-sm); }
.switch-link { display: flex; align-items: center; gap: 10px; color: var(--f-text); font-size: var(--fs-md); padding: 0 6px; }
.switch-link:hover { text-decoration: none; }
.switch-link__icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--f-primary); color: #fff;
}
.switch-link__icon .lucide { width: 16px; height: 16px; }

/* 작업 영역 */
.app--finly .workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 18px 26px 24px 10px; }
.app--finly .topbar {
  height: auto; padding: 4px 4px 16px; background: transparent; border: 0;
}
.topbar__greeting { font-size: 30px; font-weight: 400; letter-spacing: -.01em; }
.app--finly .topbar__right { gap: 10px; }

.search-pill, .date-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--f-pill); color: var(--f-text); font-size: var(--fs-sm);
}
.search-pill { width: 190px; color: var(--f-sub); }
.search-pill input { border: 0; outline: 0; background: transparent; width: 100%; font-size: var(--fs-sm); color: var(--f-text); }
.date-pill .lucide { color: var(--f-primary); }
.search-pill .lucide, .date-pill .lucide { width: 17px; height: 17px; flex: none; }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 2px;
  height: 36px; padding: 3px; border: 0; border-radius: 999px;
  background: var(--f-toggle-bg); cursor: pointer;
}
.theme-toggle__opt { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #e6e6e9; }
.theme-toggle__opt .lucide { width: 16px; height: 16px; }
body[data-theme="light"] .theme-toggle__opt--sun,
body[data-theme="dark"] .theme-toggle__opt--moon { background: #fff; color: #3a3a3a; }
body[data-theme="dark"] .theme-toggle__opt--sun { color: #5b5b60; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--f-primary), var(--f-primary-2));
  color: #fff; font-size: 12px;
}
.app--finly .mock-flag { background: var(--f-pill); color: var(--f-sub); }

/* 라벤더 컨테이너 */
.app--finly .main {
  flex: 1; overflow-y: auto;
  background: var(--f-frame);
  border-radius: 36px;
  padding: 22px;
}
.app--finly .page { max-width: none; gap: 14px; }
.app--finly .page-head { padding: 2px 6px 4px; gap: 4px; }
.app--finly .page-head__crumb { font-size: var(--fs-xs); }
.app--finly .page-head__title h1 { font-size: 20px; font-weight: 400; }
.app--finly .page-head__purpose { font-size: var(--fs-sm); }
.app--finly .callout { border-radius: var(--radius-sm); }
.app--finly .page-body { gap: 14px; }

/* ---------- 컴포넌트 ---------- */
.app--finly .card { border: 0; padding: 20px 20px; }
.app--finly .card__title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 400; }
.app--finly .card__icon { width: 17px; height: 17px; color: var(--f-sub); }
.app--finly .placeholder { border: 1.5px dashed var(--f-muted); background: transparent; }
.app--finly .placeholder__list li { background: var(--f-card); }

.app--finly .stat { gap: 4px; }
.app--finly .stat__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.app--finly .stat__label { color: var(--f-text); font-size: var(--fs-sm); }
.app--finly .stat__value { font-size: 30px; font-weight: 400; color: var(--f-text); line-height: 1.2; }
.app--finly .stat__sub { color: var(--f-sub); }
.stat__corner {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.4px solid var(--f-primary); color: var(--f-primary);
}
.stat__corner .lucide { width: 13px; height: 13px; }
.stat__trend { font-size: var(--fs-xs); }
.stat__trend--up { color: var(--f-primary); }
.stat__trend--down { color: var(--f-red); }

.app--finly .table th { background: transparent; color: var(--f-muted); font-size: var(--fs-xs); }
.app--finly .table td { border-bottom-color: var(--f-line); }
.app--finly .table tbody tr:hover { background: var(--f-card-soft); }
.app--finly .chip { background: var(--f-card); color: var(--f-sub); border-radius: 999px; padding: 0 8px; }
.app--finly .tag { border-radius: 999px; }
body[data-skin="finly"][data-theme="dark"] .tag--confirmed { color: #c9d2e3; }
body[data-skin="finly"][data-theme="dark"] .tag--proposal { color: #6fe0c3; }
body[data-skin="finly"][data-theme="dark"] .tag--review { color: #f6c94f; }
.app--finly .bar { height: 5px; background: var(--f-line); }
.app--finly .bar__fill { background: var(--f-primary); border-radius: 3px; }
.app--finly .btn { border-radius: 999px; }

/* ---------- 현장 현황 레이아웃 ---------- */
.ov { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; }
.ov__left, .ov__right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ov__bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.chart-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chart-title { width: 100%; text-align: center; font-size: 18px; font-weight: 400; margin-bottom: 10px; }
.legend-inline { display: flex; gap: 18px; font-size: var(--fs-sm); }
.legend-inline span { display: inline-flex; align-items: center; gap: 8px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.range-text { font-size: var(--fs-xs); color: var(--f-sub); display: flex; gap: 10px; }
.chart-box { position: relative; height: 240px; }

/* 이벤트 목록 */
.event-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.event-list__icon { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; }
.event-list__icon .lucide { width: 15px; height: 15px; }
.event-list__text { flex: 1; min-width: 0; }
.event-list__title { display: block; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-list__time { display: block; font-size: 11px; color: var(--f-muted); }
.event-list__value { font-size: var(--fs-xs); white-space: nowrap; }
.tone-err { background: var(--f-red); }   .text-err { color: var(--c-err); }
.tone-warn { background: var(--f-yellow); } .text-warn { color: var(--c-warn); }
.tone-ok { background: var(--f-green); }  .text-ok { color: var(--c-ok); }
.tone-info { background: var(--f-primary); } .text-info { color: var(--c-info); }
.card-rule { border: 0; border-top: 1px solid var(--f-line); margin: 0 0 6px; }

/* 도넛 */
.donut-box { position: relative; height: 200px; margin: 6px 0 14px; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center strong { font-size: 18px; font-weight: 500; }
.donut-center span { font-size: 11px; color: var(--f-sub); }
.donut-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; font-size: var(--fs-xs); }
.donut-legend li { display: flex; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.donut-legend b { display: block; font-weight: 400; color: var(--f-sub); }
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--f-text); }
.month-nav .lucide { width: 16px; height: 16px; color: var(--f-sub); }

/* 존 칩 */
.zone-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.zone-chip { padding: 10px 12px; border-radius: 12px; background: var(--f-card-soft); }
.zone-chip__name { font-size: var(--fs-sm); }
.zone-chip__dots { display: flex; gap: 4px; margin-top: 6px; }
.zone-chip__dots i { width: 8px; height: 8px; border-radius: 50%; }

/* 진행 목록 */
.goal-list li { margin-bottom: 14px; }
.goal-list li:last-child { margin-bottom: 0; }
.goal-list__row { display: flex; justify-content: space-between; font-size: var(--fs-sm); margin-bottom: 6px; }

@media (max-width: 1180px) {
  .ov { grid-template-columns: 1fr; }
}
