/* ============================================================
   AERIMS — 농업환경자원 평가 통합 플랫폼
   Design System v3 (토양정보형 / KRDS)  —  공유 스타일시트
   ------------------------------------------------------------
   ▣ 이 파일 1개가 전 화면의 단일 진실원(Single Source of Truth)이다.
     로그인 · 대시보드 · 자료등록 3화면이 모두 이 파일만 링크한다.
   ▣ 색/간격/타이포를 바꾸려면 §1 토큰만 수정하면 전 화면이 함께 바뀐다.
   ▣ 순서:  §1 토큰  →  §2 리셋  →  §3 공통 컴포넌트  →  §4 셸(GNB/LNB/Footer)
            →  §5 로그인  →  §6 대시보드  →  §7 자료등록(폼)  →  §8 반응형
   ============================================================ */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");

/* ─────────────────────────────────────────────
   §1. 디자인 토큰  ← 여기만 고치면 전 화면 일괄 변경
   ───────────────────────────────────────────── */
:root {
  /* 브랜드 / 핵심 색 — 재사용 시맨틱 토큰 (primary·secondary·accent) */
  --primary:         #245ea8;   /* 주 색상 — 조회 버튼·Primary 액션 (LNB 섹션/활성 강조) */
  --primary-hover:   #2b6cbf;   /* primary hover */
  --secondary:       #0f2744;   /* 보조 — 다크 navy (섹션 헤더·로그인 버튼) */
  --secondary-hover: #15355c;   /* secondary hover */
  --accent:          #16a34a;   /* 강조 — 그린(성공·포인트) */

  /* ↓ 레거시 토큰 — 위 시맨틱 토큰을 참조(단일 출처) */
  --nav-dark:      var(--secondary);        /* 다크 navy (로그인 버튼·섹션 헤더) */
  --nav-dark-2:    var(--secondary-hover);  /* navy hover */
  --gnb-blue:      #004098;   /* GNB active · 로고 (강조용 진한 블루 — 유지) */
  --primary-700:   var(--primary);          /* Primary 버튼 (= --primary) */
  --primary-600:   var(--primary-hover);
  --chart-blue:    #3b82f6;

  /* 표면 / 경계 / 배경 */
  --page-bg:       #f4f6f8;   /* 본문 배경 */
  --surface:       #ffffff;   /* 카드 */
  --surface-2:     #f8fafc;   /* 입력/연한 영역 */
  --border:        #e2e8f0;   /* 카드·테이블 경계 */
  --border-strong: #cbd5e1;

  /* 텍스트 */
  --text:          #1f2937;
  --text-sub:      #64748b;
  --text-muted:    #94a3b8;

  /* 상태 색 — 파스텔 면 + 가독성 있는 글자색 (전체 UI 톤과 맞춤) */
  --ok:            #2e7d32;   /* 정상·증가 글자/아이콘 */
  --ok-bg:         #e8f5e9;   /* 정상 면 */
  --danger:        #c62828;   /* 이상·감소 글자/아이콘 */
  --danger-bg:     #fdecea;   /* 위험 면 */
  --warn:          #b45309;   /* 대기·경고 글자/아이콘 */
  --warn-bg:       #fff6e5;   /* 경고 면 */
  --info:          #245ea8;   /* 정보 글자 (= primary) */
  --info-bg:       #eef4fb;   /* 정보·LNB active 면 */

  /* 로그인 자연 그라데이션 */
  --login-green-1: #2f6b3f;
  --login-green-2: #6aa84f;

  /* 타이포 */
  --font: "Pretendard","Noto Sans KR","Malgun Gothic","맑은 고딕",system-ui,sans-serif;
  --font-serif: "Nanum Myeongjo","Noto Serif KR","Batang","바탕",Georgia,serif; /* 명조 — 히어로 헤드라인 강조용 믹스매치 */
  --fs-xs: 12px;  --fs-sm: 13px;  --fs-base: 15px;  --fs-md: 16px;
  --fs-lg: 19px;  --fs-xl: 24px;  --fs-2xl: 29px;

  /* 간격 / 모양 */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --radius:    8px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,39,68,.06);
  --shadow:    0 2px 10px rgba(15,39,68,.08);
  --shadow-lg: 0 8px 28px rgba(15,39,68,.16);

  /* 셸 치수 */
  --gnb-h: 58px;
  --lnb-w: 232px;
  --content-max: 1320px;

  /* 모션 — 전 화면 애니메이션 일관성 토큰 (framer-motion 대신 CSS transition 기반) */
  --motion-fast: 150ms;   /* 호버·포커스 등 즉각 반응 */
  --motion-base: 250ms;   /* 기본 등장·전환 */
  --motion-slow: 400ms;   /* 큰 요소·강조 연출 */
  --motion-ease: cubic-bezier(0.4, 0, 0.2, 1);  /* 표준 ease (KRDS 권장곡선) */
}

/* ─────────────────────────────────────────────
   §2. 리셋 / 베이스
   ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--page-bg);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
table { border-collapse: collapse; width: 100%; }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* 브랜드 로고 (공통) */
.brand { display: flex; flex-direction: column; justify-content: center; line-height: 1; }
.brand .logo { display: flex; align-items: center; gap: 6px; }
.brand .logo b {
  font-size: 22px; font-weight: 800; color: var(--gnb-blue); letter-spacing: .4px;
}
.brand .sub { font-size: var(--fs-sm); color: var(--text-sub); margin-top: 3px; letter-spacing: -.2px; }

/* ─────────────────────────────────────────────
   §3. 공통 컴포넌트
   ───────────────────────────────────────────── */

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  font-size: var(--fs-base); font-weight: 600;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: #eef2f6; }
.btn svg { flex-shrink: 0; }
/* 변형 버튼: .btn:hover 배경(#eef2f6)이 덮어쓰지 않도록 변형별 :hover 배경·색 명시 */
.btn--primary { background: var(--primary-700); border-color: var(--primary-700); color: #fff; }
.btn--primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn--navy { background: var(--nav-dark); border-color: var(--nav-dark); color: #fff; }
.btn--navy:hover { background: var(--nav-dark-2); border-color: var(--nav-dark-2); color: #fff; }
/* 엑셀: 글자=본문색, 아이콘=녹색 사각 배경 + 흰 스트로크 */
.btn--excel {
  --excel-green: #217346;
  --excel-green-hover: #185c37;
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--excel:hover {
  background: var(--surface-2);
  border-color: #94a3b8;
  color: var(--text);
  filter: none;
}
.btn--excel:active {
  background: #eef2f6;
  border-color: #64748b;
  color: var(--text);
}
.btn--excel svg {
  width: 18px !important;
  height: 18px !important;
  padding: 3px;
  box-sizing: border-box;
  border-radius: 4px;
  background: var(--excel-green);
  stroke: #fff !important;
  fill: none !important;
  color: #fff;
  flex-shrink: 0;
}
.btn--excel:hover svg {
  background: var(--excel-green-hover);
  stroke: #fff !important;
  color: #fff;
}
.btn--excel.btn--sm svg {
  width: 16px !important;
  height: 16px !important;
  padding: 2px;
  border-radius: 3px;
}
.btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; filter: none; }
.btn--outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn--outline:hover { background: var(--surface); border-color: var(--primary-700); color: var(--primary-700); }
.btn--ghost { background: transparent; color: var(--text-sub); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--lg { height: 46px; font-size: var(--fs-md); padding: 0 22px; }
.btn--sm { height: 30px; font-size: var(--fs-sm); padding: 0 11px; }
.btn--block { width: 100%; }

/* 액션 그룹: 엑셀은 항상 맨 오른쪽 (신규/탐지실행 등 주 액션 뒤) */
.actions,
.page-head .actions,
.card__head .actions,
.meta .actions,
.map-panel__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.actions .btn--excel,
.page-head .actions .btn--excel,
.card__head .actions .btn--excel,
.meta .actions .btn--excel,
.map-panel__actions .btn--excel {
  order: 99;
}

/* 카드 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card__title {
  font-size: var(--fs-md); font-weight: 700;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card__body { padding: 18px; }

/* 페이지 헤더
   업계 관례(Red Hat UX 등): 레이아웃 타이틀 ↔ 본문 간격 ≈ 16px
   내부 crumb ↔ h1 ≈ 2~4px (8px 그리드) */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap;
}
.page-head > :first-child { flex: 1 1 360px; min-width: 0; }
.page-head h1 {
  font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.4px;
  line-height: 1.2; margin: 0;
}
.page-head .crumb {
  font-size: var(--fs-sm); color: var(--text-muted);
  margin: 0 0 2px; line-height: 1.3;
}
.page-head .desc {
  font-size: var(--fs-sm); color: var(--text-sub);
  margin: 4px 0 0; line-height: 1.4;
}
.page-head .meta { display: none !important; }
.page-head .actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; flex: 0 0 auto; }

/* 폼 필드 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  font-family: var(--font); font-size: var(--fs-base); color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary-700); background: #fff;
  box-shadow: 0 0 0 3px rgba(36,94,168,.10);
}
.input:read-only { background: #eef2f6; color: var(--text-sub); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px;
}
.input-icon-wrap { position: relative; }
.input-icon-wrap .ic {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); display: flex; pointer-events: none;
}
.input-icon-wrap .input { padding-left: 34px; }

/* 배지 / pill */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); font-weight: 700; line-height: 1;
  padding: 4px 9px; border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--text-sub);
}
.badge--ok     { background: var(--ok-bg);     color: var(--ok); }
.badge--warn   { background: var(--warn-bg);   color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info   { background: var(--info-bg);   color: var(--info); }

/* 테이블 */
.table th, .table td {
  padding: 0 12px; height: 44px; text-align: left;
  font-size: var(--fs-base); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table thead th {
  background: #f1f5f9; color: var(--text-sub); font-weight: 700;
  font-size: var(--fs-sm); position: sticky; top: 0;
}
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table .val-bad { color: var(--danger); font-weight: 700; }
.table .val-good { color: var(--ok); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.main__inner > .table-wrap,
.main__inner > section > .table-wrap,
.main__inner > form > .table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.main__inner > .table-wrap .table,
.main__inner > section > .table-wrap .table,
.main__inner > form > .table-wrap .table {
  background: var(--surface);
}
.main__inner > section:has(> .table-wrap):not(.card):not(.filter-bar) {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.main__inner > section:has(> .table-wrap):not(.card):not(.filter-bar) > .table-wrap {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.main__inner > section:has(> .table-wrap):not(.card):not(.filter-bar) > .pager {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 0 18px;
}

/* 필터바 — 기본 한 줄 우선(넓을 때 nowrap), 좁으면 반응형 줄바꿈 */
.filter-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
/* 하위 호환: --single 은 기본과 동일(명시용) */
.filter-bar--single { }
.main__inner > .filter-bar,
.main__inner > form:has(> .filter-bar) {
  margin-bottom: var(--sp-4);
}
.filter-bar .field {
  min-width: 0;
  max-width: none;
  /* flex: 1 1 0; */
}
.filter-bar .field--date,
.filter-bar .field:has(.js-date-range),
.filter-bar .field:has(.js-date) {
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
}
.filter-bar .field--search,
.filter-bar .field--wide,
.filter-bar .field:has(.input--search),
.filter-bar .field:has(.input--point) {
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 280px;
}
.filter-bar .input--search { max-width: 100%; width: 100%; }
.filter-bar .filter-actions {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-left: 0;
  flex: 0 0 auto;
}
.filter-bar .select,
.filter-bar .input {
  width: 100%;
  min-width: 0;
}
/* 일자 범위 (시작 ~ 종료) */
.field-range {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.field-range .sep {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  flex: 0 0 auto;
}
.field-range .input,
.field-range .flatpickr-input,
.field-range .form-control {
  min-width: 0;
  width: 7.6rem;
  flex: 0 0 auto;
}
/* flatpickr 입력 정렬 — 디자인 시스템 input 과 동일 톤 */
input.flatpickr-input[readonly],
input.form-control.input,
.input.flatpickr-input {
  cursor: pointer;
  background-color: var(--surface-2);
}
.flatpickr-calendar {
  font-family: inherit;
  box-shadow: var(--shadow-md, 0 8px 24px rgba(15, 23, 42, .12));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover {
  background: var(--primary, #245ea8);
  border-color: var(--primary, #245ea8);
}
@media (max-width: 1100px) {
  .filter-bar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .filter-bar .field {
    flex: 1 1 calc(33.333% - 10px);
    min-width: 140px;
  }
}
@media (max-width: 900px) {
  .filter-bar .field {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    max-width: none;
  }
  .filter-bar .filter-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  .field-range .input,
  .field-range .flatpickr-input,
  .field-range .form-control {
    width: 100%;
    flex: 1 1 0;
  }
}
@media (max-width: 480px) {
  .filter-bar .field {
    flex: 1 1 100%;
  }
  .filter-bar .filter-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .filter-bar .filter-actions .btn {
    flex: 0 0 auto;
    min-width: 0;
  }
}

/* KPI 카드 — V08: 작은 모노 아이콘을 우측 배치
   DOM 순서는 아이콘→본문 유지, row-reverse 로 시각상 우측 아이콘 */
.kpi {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-direction: row-reverse;
  gap: 10px;
  padding: 14px 16px 12px;
}
.kpi__icon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
  /* 인라인 컬러 배경(레거시 시안) 무력화 → 모노톤 */
  background: var(--surface-2) !important;
  border: 1px solid var(--border);
  color: var(--text-sub);
}
.kpi__icon svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  fill: none;
}
/* 텍스트 블록이 좁은 카드에서 줄어들 수 있도록(넘침 대신 말줄임) */
.kpi > div:not(.kpi__icon) { min-width: 0; flex: 1; }
.kpi__label {
  font-size: var(--fs-xs);
  font-weight: 400;
  color: var(--text-sub);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi__value {
  font-size: clamp(20px, 1.2vw + 12px, 26px);
  font-weight: 600; letter-spacing: -.6px; line-height: 1.15;
  margin-top: 2px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* KPI 수치 옆 단위 (%, g/cm³, kg/ha 등) — 숫자보다 작게, 색은 숫자와 동일 */
.kpi__value .kpi__unit,
.kpi__value .unit,
.kpi__value small {
  font-size: 0.55em;
  font-weight: 600;
  letter-spacing: 0;
  color: inherit;
  margin-left: 0.15em;
  vertical-align: 0.12em;
}
.kpi__delta {
  font-size: 11.5px; margin-top: 3px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi__delta.up { color: var(--ok); }
.kpi__delta.dn { color: var(--danger); }
/* 전년대비/목표대비 등 라벨은 중립 — 뒤 증감 수치만 up/dn 색 */
.kpi__delta .kpi__delta-label {
  color: var(--text-muted);
  font-weight: 400;
}
/* 769~1024px: GridStack이 아직 12컬럼이라 KPI 카드가 25%로 좁아짐 —
   카드 내용을 압축해 고정 행 높이(gs-h=2)를 넘겨 델타 줄이 잘리던 것 방지 */
@media (max-width: 1024px) {
  .kpi { gap: 8px; padding: 12px 12px; }
  .kpi__icon { width: 26px; height: 26px; border-radius: 7px; }
  .kpi__value { font-size: 20px; }
  .kpi__delta { font-size: 11px; }
}

/* 페이지네이션 */
.pager { display: flex; justify-content: center; gap: 4px; padding: 16px 0 4px; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text-sub);
}
.pager a:hover { border-color: var(--primary-700); color: var(--primary-700); }
.pager .is-active { background: var(--primary-700); border-color: var(--primary-700); color: #fff; font-weight: 700; }

/* 스테퍼 */
.stepper { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.stepper .step {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text-sub);
  font-size: var(--fs-base); font-weight: 600;
}
.stepper .step .n {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--border); color: var(--text-sub); font-size: var(--fs-sm); font-weight: 700;
}
.stepper .step.is-active { border-color: var(--primary-700); color: var(--primary-700); background: var(--info-bg); }
.stepper .step.is-active .n { background: var(--primary-700); color: #fff; }
.stepper .step.is-done .n { background: var(--ok); color: #fff; }

/* 섹션 제목 */
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-md); font-weight: 700; margin-bottom: var(--sp-3);
  padding-left: 10px; border-left: 3px solid var(--primary-700);
}

/* ─────────────────────────────────────────────
   §4. 셸 — GNB / LNB / Footer
   ───────────────────────────────────────────── */
.gnb {
  height: var(--gnb-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-8);
  padding: 0 clamp(16px, 3vw, 32px); position: sticky; top: 0; z-index: 30;
}
.gnb__tabs { display: flex; gap: 4px; flex: 1; }
.gnb__tabs a {
  padding: 0 14px; height: var(--gnb-h); display: inline-flex; align-items: center;
  font-size: var(--fs-base); font-weight: 600; color: var(--text-sub);
  border-bottom: 3px solid transparent;
}
.gnb__tabs a:hover { color: var(--gnb-blue); }
.gnb__tabs a.is-active { color: var(--gnb-blue); border-bottom-color: var(--gnb-blue); }
.gnb__util { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-sub); }
.gnb__util .user { font-weight: 700; color: var(--text); }
.gnb__util .icon-btn {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-sub);
}

.layout { display: flex; flex: 1; min-height: 0; }

/* LNB — V07 Icon Tiles (designSystem 확정안)
   소프트 그라데이션 섹션 · 아이콘 타일 · soft active */
.lnb {
  width: var(--lnb-w); flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.lnb__section {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0; padding: 14px 14px 10px;
  color: var(--primary);
  background: linear-gradient(180deg, var(--info-bg), #fff);
  border-bottom: 1px solid #e8eef6;
  border-radius: 0;
  font-size: 15px; font-weight: 700;
}
.lnb__section .l { display: flex; align-items: center; gap: 9px; min-width: 0; }
.lnb__section .chev { display: none; } /* 장식 꺽쇠 미사용 */
/* lnb_*.jsp 섹션 아이콘 stroke="#fff"(구 V01) → 라이트 헤더에서 currentColor */
.lnb__section svg { stroke: currentColor; }
.lnb__menu { padding: 8px 10px 0; flex: 1; overflow-y: auto; }
.lnb__menu a {
  display: flex; align-items: center; gap: 10px;
  height: auto; padding: 8px 10px; margin-bottom: 2px;
  font-size: 14px; font-weight: 500; line-height: 1.35;
  color: #334155;
  border-left: none; border-radius: 8px;
}
.lnb__menu a .ic {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #64748b; margin-top: 0;
  background: none; border-radius: 0;
}
.lnb__menu a .ic svg { width: 18px; height: 18px; }
.lnb__menu a:hover { background: #f8fafc; color: #334155; }
.lnb__menu a.is-active {
  background: #eef4fc; color: #1d4ed8;
  border-left: none; font-weight: 700;
}
.lnb__menu a.is-active .ic { background: none; color: #1d4ed8; }
.lnb__help {
  margin: auto 12px 12px; padding: 10px 12px;
  background: #f8fafc; border: 1px solid #eef2f6;
  border-radius: 8px; font-size: var(--fs-sm); color: var(--text-sub);
}
.lnb__help b,
.lnb__help .h {
  display: block; color: #1e3a5f; font-size: 14px; font-weight: 700; margin: 0 0 4px;
}
.lnb__help .p { font-size: 12.5px; color: var(--text-sub); margin: 0 0 10px; line-height: 1.45; }
.lnb__help .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lnb__help .btn {
  height: auto; margin-top: 0; width: auto;
  background: #fff; border: 1px solid #c7d7ee; color: var(--primary);
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.lnb__help .btn:hover { background: #fff; border-color: var(--primary); color: var(--primary); }
.lnb__foot {
  padding: 14px 16px; border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.6;
}

.main {
  flex: 1; min-width: 0; padding: var(--sp-6) clamp(16px, 3vw, 32px);
  overflow-x: hidden;
}
.main__inner { max-width: var(--content-max); margin: 0 auto; }

.footer {
  background: #eef2f6; border-top: 1px solid var(--border);
  padding: 12px clamp(16px, 3vw, 32px);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--text-sub);
}
.footer a:hover { color: var(--primary-700); }
.footer .sep { color: var(--border-strong); margin: 0 6px; }

/* ─────────────────────────────────────────────
   §5. 로그인
   ───────────────────────────────────────────── */
.login-header {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 clamp(20px, 4vw, 52px); flex-shrink: 0;
}
.login-header .logo-area { flex: 1; }
.login-header .header-nav { display: flex; align-items: center; gap: 18px; font-size: 14.5px; color: var(--text-sub); }
.login-header .header-nav a:hover { color: var(--gnb-blue); }
.login-header .vbar { width: 1px; height: 11px; background: var(--border); }

.login-body { flex: 1; display: flex; min-height: 0; }

.login-left { flex: 0 0 58%; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.login-left .bg { position: absolute; inset: 0; }
.login-left .bg img { width: 100%; height: 100%; object-fit: cover; }
.login-left .overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(135% 105% at 0% 0%, rgba(4,20,8,.66) 0%, rgba(4,20,8,0) 54%),
    linear-gradient(135deg, rgba(15,55,20,.48), rgba(47,107,63,.30));
}
.login-left .content { position: relative; z-index: 5; display: flex; flex-direction: column; height: 100%; padding: 52px 56px 36px; }
.login-left .headline { color: #fff; font-family: var(--font-serif); font-size: 30px; font-weight: 700; line-height: 1.5; letter-spacing: -.2px; margin-bottom: 14px; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.login-left .subline { color: rgba(255,255,255,.82); font-size: 16px; line-height: 1.7; max-width: 30em; text-shadow: 0 1px 5px rgba(0,0,0,.32); }

.login-map { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; margin-top: 12px; }
.login-map .map-img { width: clamp(290px, 30vw, 420px); max-height: 372px; object-fit: contain; filter: grayscale(1) contrast(1.05) brightness(1.02) drop-shadow(0 6px 16px rgba(0,0,0,.22)); opacity: .92; }
.login-stats { position: absolute; inset: 0; pointer-events: none; }
.login-stats .stat {
  position: absolute; background: rgba(255,255,255,.96); border-radius: 10px;
  padding: 11px 15px; min-width: 124px; box-shadow: var(--shadow-lg); pointer-events: auto;
}
.login-stats .ic { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; margin-bottom: 5px; }
.login-stats .lbl { font-size: 11px; color: var(--text-sub); }
.login-stats .val { font-size: 21px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; }
.login-stats .dl { font-size: 11px; margin-top: 2px; }
.login-stats .dl.up { color: var(--ok); } .login-stats .dl.dn { color: var(--danger); }
.login-stats .tl { top: 8%; left: 4%; }  .login-stats .tr { top: 8%; right: 4%; }
.login-stats .bl { bottom: 8%; left: 4%; } .login-stats .br { bottom: 8%; right: 4%; }

.login-right { flex: 0 0 42%; background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 44px 56px; overflow-y: auto; }
.login-box { width: 100%; max-width: 352px; }
.login-box h2 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.4px; }
.login-box .desc { font-size: 15px; color: var(--text-muted); margin: 6px 0 26px; }
.login-box .field { margin-bottom: 16px; }
.login-box .btn-login { margin-top: 22px; }
.login-links { display: flex; justify-content: center; margin-top: 13px; }
.login-links a { font-size: var(--fs-sm); color: var(--text-sub); padding: 0 10px; }
.login-links a:not(:last-child) { border-right: 1px solid var(--border); }
.login-links a:hover { color: var(--primary-700); }
.divider { display: flex; align-items: center; gap: 8px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: var(--fs-xs); color: var(--text-muted); }
.login-notice { margin-top: 26px; }
.login-notice .nt { font-size: var(--fs-sm); font-weight: 700; margin-bottom: 9px; display: flex; align-items: center; gap: 5px; }
.login-notice .nt::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-notice li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.login-notice li:last-child { border-bottom: none; }
.login-notice .n-title { font-size: var(--fs-sm); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-notice .n-date { font-size: var(--fs-xs); color: var(--text-muted); }

/* ─────────────────────────────────────────────
   §6. 대시보드
   ───────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin: var(--sp-5) 0; }
.dash-grid { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.dash-grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--sp-4); }

/* 지도 mock */
.map-card { position: relative; }
.map-card .legend {
  position: absolute; right: 14px; bottom: 14px; background: rgba(255,255,255,.94);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: var(--fs-xs);
}
.map-card .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* 도넛 (conic-gradient mock) */
.donut { width: 150px; height: 150px; border-radius: 50%; margin: 4px auto 10px; position: relative;
  background: conic-gradient(var(--primary-700) 0 46%, var(--chart-blue) 46% 72%, var(--ok) 72% 88%, var(--warn) 88% 100%); }
.donut::after { content: ""; position: absolute; inset: 28px; background: var(--surface); border-radius: 50%; }
.donut .donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut .donut-c b { font-size: var(--fs-xl); font-weight: 800; }
.donut .donut-c span { font-size: var(--fs-xs); color: var(--text-sub); }
.legend-list li { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); padding: 4px 0; }
.legend-list i { width: 10px; height: 10px; border-radius: 2px; }
.legend-list .v { margin-left: auto; font-weight: 700; }

/* 막대 mock */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: var(--fs-sm); }
.bar-row .bl { width: 56px; color: var(--text-sub); flex-shrink: 0; }
.bar-row .track { flex: 1; height: 10px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--chart-blue); border-radius: var(--radius-pill); }
.bar-row .bv { width: 44px; text-align: right; font-weight: 700; flex-shrink: 0; }

/* ─────────────────────────────────────────────
   §7. 자료등록 (복잡한 폼)
   ───────────────────────────────────────────── */
.form-layout { display: grid; grid-template-columns: 1fr 300px; gap: var(--sp-4); align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-section + .form-section { margin-top: var(--sp-5); }

/* 분석항목 입력 그리드(수치 다수) */
.analyte-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.analyte {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--surface-2);
}
.analyte label { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-sub); margin-bottom: 6px; }
.analyte label .unit { color: var(--text-muted); font-size: var(--fs-xs); }
.analyte .input { height: 36px; background: #fff; }
.analyte.is-bad .input { border-color: var(--danger); }
.analyte.is-bad label { color: var(--danger); }

/* 주소+지도 */
.addr-row { display: grid; grid-template-columns: 120px 130px 1fr auto; gap: var(--sp-2); align-items: end; }
.map-mock {
  height: 260px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background:
    linear-gradient(0deg, rgba(59,130,246,.06), rgba(59,130,246,.06)),
    repeating-linear-gradient(0deg, #eef3f8 0 23px, #e6edf5 23px 24px),
    repeating-linear-gradient(90deg, #eef3f8 0 23px, #e6edf5 23px 24px);
  position: relative; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: var(--fs-sm);
}
.map-mock .pin { position: absolute; color: var(--danger); }

/* 우측 요약 사이드카드 */
.side-card .row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: var(--fs-sm); }
.side-card .row:last-child { border-bottom: none; }
.side-card .row .k { color: var(--text-sub); }
.side-card .row .v { font-weight: 600; text-align: right; }

.form-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-5); }

/* ─────────────────────────────────────────────
   §8. 반응형
   ───────────────────────────────────────────── */
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid .map-card { grid-column: span 2; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .analyte-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .dash-grid-2 { grid-template-columns: 1fr; }
  .dash-grid .map-card { grid-column: auto; }
  .form-layout { grid-template-columns: 1fr; }
  .lnb { display: none; }
}
@media (max-width: 760px) {
  .login-body { flex-direction: column; }
  .login-left { flex: 0 0 auto; min-height: 300px; }
  .login-right { flex: 1; padding: 28px 22px; }
  .login-left .map-img { width: 200px; }
  .form-grid, .analyte-grid { grid-template-columns: 1fr 1fr; }
  .addr-row { grid-template-columns: 1fr 1fr; }
  .gnb { gap: var(--sp-4); }
  .gnb__tabs { display: none; }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .form-grid, .analyte-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
   §9. 마이크로 인터랙션  (사용자 조작에 대한 반응만 / 등장 애니메이션 없음)
   ------------------------------------------------
   ▣ 방침: 업무용 MPA 대시보드는 "등장(scroll-reveal) 모션"을 쓰지 않는다.
     새로고침마다 반복돼 피곤하고 데이터 가독을 늦추기 때문(framer-motion·SPA가 답이 아님).
   ▣ 대신 hover/focus/active 등 "직접 조작했을 때만" 반응하는 모션으로 native 느낌을 준다.
   ▣ 토큰: --motion-fast/base, --motion-ease (§1).  접근성: prefers-reduced-motion 존중.
   ───────────────────────────────────────────── */

/* 카드 — hover 시 살짝 떠오름(데이터를 가리지 않는 미세 lift) */
.card {
  transition: box-shadow var(--motion-fast) var(--motion-ease),
              transform var(--motion-fast) var(--motion-ease),
              border-color var(--motion-fast) var(--motion-ease);
}
.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}
/* 지도 카드는 Leaflet 좌표 기준이 흔들리지 않게 lift 제외(그림자만) */
.card.map-card:hover { transform: none; }

/* 버튼 — 눌렀을 때(active) 살짝 가라앉는 피드백 */
.btn { transition: background var(--motion-fast) var(--motion-ease),
                   border-color var(--motion-fast) var(--motion-ease),
                   color var(--motion-fast) var(--motion-ease),
                   transform var(--motion-fast) var(--motion-ease); }
.btn:active { transform: translateY(1px); }

/* 새로고침 아이콘 — hover 시 한 바퀴(조작 의도 명확) */
.refresh svg { transition: transform var(--motion-base) var(--motion-ease); }
.refresh:hover svg { transform: rotate(180deg); }

/* 막대그래프 fill — 폭 변화(조회 결과 갱신)를 부드럽게 */
.bar-row .fill, .sstat-fill { transition: width var(--motion-slow) var(--motion-ease); }

/* 테이블 행 — hover 강조에 부드러운 전환 (배경색 규칙은 §3 유지) */
.table tbody tr { transition: background var(--motion-fast) var(--motion-ease); }

/* 접근성: 모션 줄이기 설정 시 모든 마이크로 인터랙션 비활성 */
@media (prefers-reduced-motion: reduce) {
  .card, .card:hover, .btn, .refresh svg, .bar-row .fill, .sstat-fill, .table tbody tr {
    transition: none;
    transform: none;
  }
}
