/* ───────── 2026-11-18 (v=31) 추가 화면 ─────────
 *  다이어그램 새 디자인 · 차트 통계 · 차트 카드 버튼(그래프 · 통계 · ⋮) · 그래프 Y축 설정범위/자동
 *  app.css 다음에 읽음 (같은 이름은 여기 것이 우선) */

/* ── 차트 카드: [그래프] [통계] [⋮] ── */
.sq-btn.sq-stats { background: #C98A00; }
.sq-btn.sq-stats:active { background: #A87300; }
.sq-btn.sq-more { width: 38px; background: #E6EBEE; color: var(--teal-dark); }
.sq-btn.sq-more:active { background: #D3DADE; }

/* ── 그래프: Y축 설정범위 / 자동 (그림 오른쪽 위), 통계 버튼 ── */
.y-seg { position: absolute; right: 8px; top: 8px; z-index: 6; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 1px 5px rgba(0,0,0,.2); }
.y-seg span { padding: 0 6px 0 8px; font-size: 12px; font-weight: 800; color: #5F6B76; }
.y-seg button { min-height: 30px; padding: 0 11px; border: 0; border-radius: 15px; background: none; color: #5F6B76; font-size: 13px; font-weight: 700; }
.y-seg button.on { background: var(--navy); color: #fff; }
.plot-wrap .rotate-hint { top: auto; bottom: 30px; }
.graph-top .g-stats { color: #FFD27A; }

/* ═════════ 다이어그램 ═════════ */
body.bg-dg { background: #EEF2F3; }
.dg { max-width: 1280px; margin: 0 auto; padding: 10px calc(8px + var(--safe-r)) calc(28px + var(--safe-b)) calc(8px + var(--safe-l)); color: #1F2A33; }
@media (min-width: 900px) { .dg { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; } }
.dg-leg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 2px 10px; font-size: 16px; color: #3D4A55; }
.dg-leg i { display: inline-block; width: 14px; height: 14px; margin-right: 6px; border-radius: 3px; vertical-align: -2px; }
.dg-cards { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.dg-cards::-webkit-scrollbar { display: none; }
.dg-node { flex: none; width: 200px; display: grid; gap: 6px; padding: 10px 12px 8px 14px; border: 1px solid #E1E7EA; border-radius: 12px; background: #fff; text-align: left; box-shadow: inset 4px 0 0 var(--sc); color: inherit; }
.dg-node.on { border: 2px solid var(--sc); padding: 9px 11px 7px 13px; }
.dg-nh { display: flex; align-items: center; gap: 6px; }
.dg-nh b { flex: 1; min-width: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg-nh em { flex: none; padding: 2px 8px; border-radius: 10px; font-size: 14px; font-style: normal; font-weight: 800; }
.dg-n3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.dg-n3 small { display: block; font-size: 14px; color: #8A949D; }
.dg-n3 b { font-size: 19px; font-variant-numeric: tabular-nums; }
.dg-n3 b small { display: inline; font-size: 12px; font-weight: 500; }
.dg-nt { font-size: 13px; color: #9AA3AB; font-style: italic; text-align: right; }
.dg-nt.stale, .dg-time.stale { color: #C62828; font-style: normal; font-weight: 700; }

.dg-board { position: relative; width: 100%; aspect-ratio: 100 / 115; max-height: 80vh; border-radius: 14px; overflow: hidden; border: 1px solid #E1E7EA; background: #317CC0; cursor: crosshair; touch-action: manipulation; }
@media (min-width: 900px) { .dg-board { aspect-ratio: 4 / 3; } }
.dg-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.dg-ov { position: absolute; inset: 0; background-image: linear-gradient(to right, rgba(255,255,255,.28) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,.28) 1px, transparent 1px); background-size: 10% 11.111%; }
.dg-hl, .dg-vl { position: absolute; pointer-events: none; }
.dg-hl { left: 0; right: 0; height: 0; border-top: 2px dashed #fff; }
.dg-vl { top: 0; bottom: 0; width: 0; border-left: 2px dashed #fff; }
.dg-tag { position: absolute; z-index: 3; padding: 3px 8px; border-radius: 6px; background: rgba(31,42,51,.9); color: #fff; font-size: 15px; font-weight: 800; pointer-events: none; font-variant-numeric: tabular-nums; }
.dg-tag-t { right: 4px; transform: translateY(calc(-100% - 4px)); }
.dg-tag-r { bottom: 4px; transform: translateX(4px); }
.dg-pt { position: absolute; z-index: 2; width: 18px; height: 18px; margin: -9px 0 0 -9px; padding: 0; border: 2.5px solid #1F2A33; border-radius: 50%; background: #fff; }
.dg-pt::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; }     /* 손가락으로 누르기 쉽게 */
.dg-pt.on { width: 30px; height: 30px; margin: -15px 0 0 -15px; border: 3px solid #1F2A33; background: radial-gradient(circle, #1F2A33 0 4px, transparent 5px), radial-gradient(circle, transparent 0 8px, #fff 9px 11px, transparent 12px); z-index: 4; }
.dg-lbl { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); padding: 3px 9px; border-radius: 11px; background: #fff; color: #1F2A33; font-size: 14px; font-weight: 800; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.3); pointer-events: none; }
.dg-probe { position: absolute; z-index: 3; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2.5px solid #1F2A33; border-radius: 50%; background: #FFD27A; pointer-events: none; }
.dg-ptag { position: absolute; z-index: 5; transform: translate(12px, calc(-100% - 10px)); padding: 6px 10px; border-radius: 8px; background: rgba(31,42,51,.93); color: #fff; font-size: 15px; font-weight: 800; white-space: nowrap; pointer-events: none; }
.dg-ptag small { font-size: 13px; font-weight: 600; opacity: .85; }
.dg-board .hdg { left: 10px; top: 10px; width: clamp(120px, 34%, 200px); }
.hdg .ok-c { fill: #2E7D32; stroke: #fff; stroke-width: 5; }
.hdg .ok-v { fill: none; stroke: #fff; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.dg-msg { position: absolute; inset: 0; z-index: 7; display: grid; place-content: center; padding: 20px; text-align: center; color: #fff; font-weight: 700; background: rgba(0,0,0,.25); }
.dg-hint { margin: 6px 0 0; text-align: center; font-size: 14px; color: #8A949D; }

.dg-card { margin-top: 12px; padding: 14px; border: 1px solid #E1E7EA; border-radius: 14px; background: #fff; }
@media (min-width: 900px) { .dg-right .dg-card:first-child { margin-top: 0; } }
.dg-card h2 { margin: 0; font-size: 22px; }
.dg-card h3 { margin: 0 0 8px; font-size: 19px; }
.dg-card h3 small { margin-left: 6px; font-size: 14px; font-weight: 500; color: #8A949D; }
.dg-time { margin: 2px 0 0; font-size: 15px; color: #8A949D; font-style: italic; }
.dg-status { margin-top: 10px; padding: 10px 14px 12px; border-left: 4px solid; border-radius: 10px; }
.dg-status b { font-size: 22px; }
.dg-status p { margin: 4px 0 0; font-size: 16px; line-height: 1.55; color: #3D4A55; }
.dg-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.dg-3 > div { min-width: 0; padding: 10px; border: 1px solid #DDE4E8; border-radius: 10px; }
.dg-3 small { display: block; font-size: 15px; color: #6B7782; }
.dg-3 b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dg-3 b small { display: inline; font-size: 14px; font-weight: 500; color: #8A949D; }
.dg-3 span { font-size: 13px; color: #8A949D; }
.dg-range { margin-top: 8px; padding: 12px; border: 1px solid #DDE4E8; border-radius: 10px; }
.dg-rh { display: flex; align-items: center; gap: 8px; }
.dg-rh span { flex: 1; font-size: 15px; color: #6B7782; }
.dg-rh b { font-size: 21px; color: #2E7D32; white-space: nowrap; }
.dg-bar { position: relative; height: 14px; margin-top: 8px; }
.dg-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 8px; border-radius: 4px; background: #E3E8EB; }
.dg-bar .ok { position: absolute; top: 3px; height: 8px; background: #77B64B; }
.dg-bar .now { position: absolute; top: 0; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; }
.dg-bax { display: flex; justify-content: space-between; font-size: 12px; color: #9AA3AB; }
.dg-range p { margin: 6px 0 0; font-size: 16px; line-height: 1.55; color: #3D4A55; }
.dg-dew { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: #FFF4E5; color: #9A5B00; font-size: 16px; line-height: 1.55; }
.dg-leaf { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.dg-leaf > div:first-child { flex: 1; min-width: 0; }
.dg-leaf b { display: block; font-size: 18px; }
.dg-leaf small { font-size: 14px; color: #8A949D; }
.dg-step { flex: none; display: flex; align-items: center; height: 48px; padding: 3px; border: 1px solid #DDE4E8; border-radius: 10px; }
.dg-step button { width: 42px; height: 100%; border: 0; border-radius: 8px; background: none; font-size: 22px; font-weight: 700; }
.dg-step button:active { background: #E6ECEF; }
.dg-step b { min-width: 58px; text-align: center; font-size: 18px; }
.dg-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 12px; padding: 4px; border-radius: 10px; background: #EEF2F4; }
.dg-seg button { min-height: 44px; border: 0; border-radius: 8px; background: none; color: #8A949D; font-size: 17px; font-weight: 800; }
.dg-seg button.on { background: #fff; color: #1F2A33; box-shadow: 0 0 0 1px #DDE4E8; }
.dg-rows { margin-top: 6px; }
.dg-row { display: flex; align-items: center; gap: 8px; padding: 12px 8px; border-top: 1px solid #EDF1F3; }
.dg-row:first-child { border-top: 0; }
.dg-row b { flex: none; min-width: 64px; font-size: 18px; }
.dg-row span { flex: 1; min-width: 0; font-size: 16px; color: #6B7782; }
.dg-row em { flex: none; font-style: normal; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dg-row em small { font-size: 14px; font-weight: 500; color: #8A949D; }
.dg-row.hl { border-radius: 8px; background: #E3F2F1; border-top-color: transparent; }
.dg-row.hl em { color: #00796B; }
.dg-row.hl + .dg-row { border-top-color: transparent; }
.dg-hsvg { display: block; width: 100%; height: auto; cursor: pointer; }
.dg-hsvg .dg-grid { stroke: #E9EEF1; stroke-width: 1; }
.dg-hsvg .dg-ax { fill: #7B8790; font-size: 12px; }
.dg-hsvg .dg-band { fill: #4E9A2E; font-size: 12px; font-weight: 800; }
.dg-hsvg .dg-line { fill: none; stroke: #3C78B4; stroke-width: 2.5; }
.dg-hsvg .dg-pick { stroke: #9AA3AB; stroke-width: 1.5; }
.dg-histtip { margin: 4px 0 0; text-align: center; font-size: 15px; color: #6B7782; }
.dg-ok { margin-top: 4px; padding: 12px; border-radius: 10px; }
.dg-ok small { display: block; font-size: 15px; color: #6B7782; }
.dg-ok > b { font-size: 30px; }
.dg-ok > b small { display: inline; font-size: 16px; color: #8A949D; }
.dg-share { display: flex; height: 10px; margin-top: 6px; border-radius: 5px; overflow: hidden; background: #E3E8EB; }
.dg-ok p { margin: 6px 0 0; font-size: 15px; line-height: 1.55; color: #3D4A55; }

/* ═════════ 통계 ═════════ */
.st { max-width: 980px; color: #1F2A33; padding-bottom: calc(40px + var(--safe-b)); }
.st-period { margin: 0 2px 8px; font-size: 15px; color: #6B7782; }
.st-box { padding: 12px; border: 1px solid #E1E7EA; border-radius: 14px; background: #fff; display: grid; gap: 8px; }
.st-row { display: flex; align-items: center; gap: 8px; }
.st-row > span { flex: none; width: 70px; font-size: 16px; font-weight: 800; color: #3D4A55; }
.st-item { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 50px; padding: 0 12px; border: 1px solid #DDE4E8; border-radius: 10px; background: #fff; font-size: 17px; font-weight: 600; text-align: left; }
.st-item svg.i { flex: none; width: 20px; height: 20px; color: #6B7782; }
.st-seg { flex: 1; display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: #EEF2F4; }
.st-seg button { flex: 1; min-height: 42px; border: 0; border-radius: 8px; background: none; color: #8A949D; font-size: 16px; font-weight: 800; white-space: nowrap; }
.st-seg button.on { background: #fff; color: #1F2A33; box-shadow: 0 0 0 1px #DDE4E8; }
.st-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
@media (min-width: 760px) { .st-cards { grid-template-columns: repeat(4, 1fr); } }
.st-c { min-width: 0; padding: 12px; border: 1px solid #E1E7EA; border-radius: 14px; background: #fff; }
.st-c.day { background: #FFF6E6; border-color: #F1D9A8; }
.st-c.day > b { color: #A86B00; }
.st-c.night { background: #EEF3FB; border-color: #C9D6EC; }
.st-c.night > b { color: #3D5A8A; }
.st-c > b { display: block; font-size: 16px; color: #3D4A55; }
.st-c strong { display: block; margin-top: 4px; font-size: 28px; font-variant-numeric: tabular-nums; }
.st-c strong small { font-size: 15px; font-weight: 500; color: #8A949D; }
.st-c > span { font-size: 14px; color: #6B7782; }
.st-card { margin-top: 10px; padding: 12px; border: 1px solid #E1E7EA; border-radius: 14px; background: #fff; }
.st-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 15px; color: #3D4A55; }
.st-leg i { display: inline-block; width: 12px; height: 12px; margin-right: 5px; vertical-align: -1px; }
.st-leg i.ln { width: 18px; height: 3px; vertical-align: 3px; }
.st-leg i.dash { height: 0; border-top: 3px dashed currentColor; background: none; }
.st-svg { display: block; width: 100%; height: auto; margin-top: 6px; cursor: pointer; }
.st-svg .st-grid { stroke: #E9EEF1; stroke-width: 1; }
.st-svg .st-ax { fill: #7B8790; font-size: 12px; }
.st-svg .st-ax.r { fill: #B5451B; }
.st-tip { margin: 2px 0 0; text-align: center; font-size: 15px; color: #6B7782; }
.st-tip b { color: #1F2A33; }
.st-tablecard { padding: 0; overflow: hidden; }
.st-table { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.st-table th { padding: 11px 6px; background: #F4F7F8; color: #8A949D; font-weight: 800; }
.st-table th.d { color: #A86B00; } .st-table th.n { color: #3D5A8A; }
.st-table td { padding: 12px 6px 2px; text-align: center; }
.st-table th:first-child, .st-table td.dt { text-align: left; padding-left: 12px; }
.st-table th:last-child, .st-table td.df { text-align: right; padding-right: 12px; }
.st-table td.dt { font-weight: 800; white-space: nowrap; }
.st-table td.dt.sat { color: #2B6CB0; } .st-table td.dt.sun { color: #C62828; }
.st-table td.df { color: #B5451B; font-weight: 800; }
.st-table td em { display: block; font-size: 12px; font-style: normal; color: #8A949D; }
.st-table tr.sub td { padding: 2px 12px 11px; text-align: left; font-size: 13px; color: #8A949D; border-bottom: 1px solid #EDF1F3; }
.st-table tbody tr.sub:last-child td { border-bottom: 0; }
.st-foot { margin: 12px 2px 0; font-size: 14px; line-height: 1.6; color: #6B7782; }
.st-foot em { padding: 1px 6px; border-radius: 6px; background: #EEF2F4; font-style: normal; font-weight: 700; }

/* ═════════ 통계 [분석] 탭 (2026-11-19, v=32) — 농가모니터링 웹과 같은 탭 모양 ═════════ */
.an-tabs { display: flex; gap: 4px; margin: 0 0 10px; padding: 4px; border: 1px solid #D6DEE2; border-radius: 14px; background: #fff; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.an-tabs::-webkit-scrollbar { display: none; }
.an-tabs button { flex: 1 0 auto; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: none; color: #4A5864; font-size: 15px; font-weight: 800; white-space: nowrap; }
.an-tabs button.on { background: #0B7C8B; color: #fff; box-shadow: 0 2px 6px rgba(11, 124, 139, .35); }
.st-itembox { margin-bottom: 10px; }
#stAna > .st-period { margin-top: 0; }
.an-head { display: flex; align-items: center; gap: 10px; }
.an-head > div { flex: 1; min-width: 0; }
.an-head b { display: block; font-size: 15px; color: #6B7782; }
.an-head strong { display: block; margin-top: 2px; font-size: 21px; color: #1F2A33; }
.an-head strong em { font-style: normal; font-size: 15px; font-weight: 600; color: #6B7782; }
.an-head strong.none { font-size: 18px; color: #B5451B; }
.an-head small { display: block; margin-top: 2px; font-size: 14px; color: #8A949D; }
.an-btn { flex: none; min-height: 44px; padding: 0 14px; border: 1px solid #0B7C8B; border-radius: 10px; background: #fff; color: #0B7C8B; font-size: 15px; font-weight: 800; }
.an-cards .st-c strong { font-size: 26px; }
.st-c.an-in { background: #EAF7F0; border-color: #BFE3CF; } .st-c.an-in > b { color: #2E7D57; }
.st-c.an-lo > b { color: #3D7CC9; } .st-c.an-hi > b { color: #D9534F; }
.st-c.an-dew { background: #E6F4F5; border-color: #B6DDE1; } .st-c.an-dew > b { color: #0B7C8B; }
.an-ttl { display: block; font-size: 16px; color: #3D4A55; }
.an-ttl.pad { padding: 12px 12px 4px; }
.an-days { display: grid; gap: 8px; margin-top: 10px; }
.an-day { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.an-day .dt { flex: none; width: 78px; font-weight: 800; white-space: nowrap; }
.an-day .dt.sat { color: #2B6CB0; } .an-day .dt.sun { color: #C62828; }
.an-bar { flex: 1; display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #EEF2F4; }
.an-bar i { display: block; height: 100%; }
.an-v { flex: none; width: 82px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.an-v small { display: block; font-size: 12px; font-weight: 500; color: #8A949D; }
.an-why { color: #B5451B; font-size: 16px; line-height: 1.5; }
.an-min p { margin: 6px 0 0; font-size: 16px; line-height: 1.5; }
.an-table td { padding: 11px 4px; }
.an-table td.dt em { display: block; font-size: 12px; font-weight: 500; color: #8A949D; }
.an-table td em { font-size: 12px; font-style: normal; color: #8A949D; }
.an-table tr.me td { background: #F2FAFB; }
.an-table td.nodata { color: #8A949D; }
.an-table tbody tr td { border-bottom: 1px solid #EDF1F3; }
.an-lines p { margin: 4px 0; font-size: 16px; }
.an-note { margin: 6px 0 0; font-size: 15px; color: #6B7782; line-height: 1.5; }
.an-sum pre { margin: 0; white-space: pre-wrap; word-break: keep-all; font: 16px/1.65 inherit; font-family: inherit; color: #1F2A33; }
.an-sum-btns { display: flex; gap: 8px; margin-top: 10px; }
.an-sum-btns .btn { flex: 1; }
/* 범위 · 결로 기준 입력창 (2026-11-19 b: 창 안에 가로 스크롤 생기던 것 고침) */
.sheet-box { overflow-x: hidden; }
.an-in2 { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 14px; }
.an-in2 label { flex: 1 1 0; min-width: 0; display: grid; gap: 6px; font-size: 16px; font-weight: 700; color: #3D4A55; }
.an-in2 input { width: 100%; min-width: 0; min-height: 52px; padding: 0 12px; border: 1.5px solid #B9C2C9; border-radius: 10px; font-size: 20px; text-align: center; background: #fff; }
.an-in2 > span, .an-in2 > em { flex: none; padding-bottom: 14px; font-style: normal; font-weight: 700; font-size: 17px; color: #6B7782; }
.an-btns { flex-wrap: wrap; }
.an-btns .btn { flex: 1 1 0; min-width: 0; min-height: 52px; padding: 0 10px; font-size: 16px; line-height: 1.25; white-space: normal; word-break: keep-all; }
.an-btns .btn-navy { flex-basis: 100%; font-size: 18px; }
@media print {
	.top, .an-tabs, .st-itembox, .an-sum-btns, .st-foot { display: none !important; }
	.an-sum { border: 0; }
}
.an-table { font-size: 15px; }
.an-table th { white-space: nowrap; font-size: 14px; padding: 10px 3px; }
.an-table td b { font-weight: 800; }
