/* AI 시트 패널 (.sh-) */
.sh-root { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.sh-head .sh-title { font-weight: 700; }
.sh-head .sh-saved { font-size: 12px; white-space: nowrap; }
.sh-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; flex-wrap: wrap; }
.sh-bar .grow { flex: 1; }
.sh-views { display: inline-flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
.sh-views button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px; padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.sh-views button svg.lucide { width: 15px; height: 15px; }
.sh-views button.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.sh-count { font-size: 11px; color: var(--muted); }
.sh-count:empty { display: none; }
.sh-dot { width: 6px; height: 6px; border-radius: 50%; background: #1E9E6A; display: inline-block; }
.sh-dot[hidden] { display: none; }
.sh-tools { display: inline-flex; align-items: center; gap: 2px; }
.sh-tools[hidden] { display: none; }
.sh-tools .btn svg.lucide { width: 15px; height: 15px; }
.sh-info { font-size: 12px; white-space: nowrap; }

.sh-main { flex: 1; min-height: 0; overflow: auto; outline: none; background: var(--surface-2); }
.sh-main.is-grid { background: var(--surface); }
.sh-pad { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* 격자 */
.sh-grid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; user-select: none; }
.sh-grid th, .sh-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0 8px; height: 30px; min-width: 96px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.sh-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-2); font-weight: 700; padding-right: 2px; }
.sh-grid thead th > .sh-colname { cursor: pointer; display: inline-block; max-width: calc(100% - 26px); overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.sh-grid thead th:hover > .sh-colname { color: var(--text); }
.sh-colbtn { float: right; border: 0; background: none; color: var(--muted); cursor: pointer; width: 22px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; opacity: .45; }
.sh-colbtn svg.lucide { width: 14px; height: 14px; }
.sh-grid th:hover .sh-colbtn { opacity: 1; }
.sh-colbtn:hover { background: var(--border); }
.sh-grid .sh-corner { position: sticky; left: 0; top: 0; z-index: 3; min-width: 44px; width: 44px; background: var(--surface-2); }
.sh-grid .sh-rownum { position: sticky; left: 0; z-index: 1; min-width: 44px; width: 44px; background: var(--surface-2); color: var(--muted); font-weight: 500; text-align: center; font-size: 12px; cursor: pointer; }
.sh-grid .sh-rownum:hover { color: var(--text); background: var(--border); }
.sh-grid td { background: var(--surface); color: var(--text); cursor: cell; }
.sh-grid td.sh-num { text-align: right; font-variant-numeric: tabular-nums; }
.sh-grid td.is-sel { background: color-mix(in srgb, #1E9E6A 11%, var(--surface)); }
.sh-grid td.is-cur { box-shadow: inset 0 0 0 2px #1E9E6A; }
.sh-grid td.is-editing { padding: 0; overflow: visible; box-shadow: inset 0 0 0 2px #1E9E6A; }
.sh-input { display: block; width: 100%; min-width: 160px; height: 30px; border: 0; outline: none; resize: none; padding: 6px 8px; font: inherit; color: var(--text); background: var(--surface); box-shadow: 0 4px 14px rgba(0, 0, 0, .12); position: relative; z-index: 4; line-height: 18px; }
.sh-root.is-readonly .sh-grid td { cursor: default; }
.sh-empty { padding: 30px 16px; color: var(--muted); text-align: center; font-size: 14px; }
.sh-more { margin: 12px 16px; }

/* 시트 탭 */
.sh-sheets { display: flex; align-items: stretch; gap: 2px; padding: 0 8px; border-top: 1px solid var(--border); background: var(--surface-2); flex: none; overflow-x: auto; min-height: 36px; }
.sh-sheets[hidden] { display: none; }
.sh-tab { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0 12px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; border-top: 2px solid transparent; margin-top: -1px; }
.sh-tab:hover { color: var(--text); background: var(--surface); }
.sh-tab.is-active { color: var(--text); font-weight: 700; background: var(--surface); border-top-color: #1E9E6A; }
.sh-tab-x { display: inline-flex; color: var(--muted); border-radius: 4px; }
.sh-tab-x:hover { color: var(--danger, #c0392b); background: var(--surface-2); }
.sh-tab svg.lucide { width: 14px; height: 14px; }
.sh-tab-add { padding: 0 10px; }

/* 메뉴 */
.sh-menu { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, .15)); padding: 5px; min-width: 190px; }
.sh-menu .menu-item { font-size: 13px; padding: 7px 10px; }
.sh-menu .menu-item svg.lucide { width: 15px; height: 15px; color: var(--muted); }
.sh-menu .menu-item.danger, .sh-menu .menu-item.danger svg.lucide { color: var(--danger, #c0392b); }
.sh-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

/* 차트 */
.sh-chart-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sh-chart-top small { font-size: 12px; }
.sh-chart-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.sh-chart-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sh-pad > .card + .card, .sh-chart-list > .card + .card { margin-top: 0; }
.sh-chart-head { display: flex; align-items: center; gap: 8px; }
.sh-chart-head .grow { flex: 1; min-width: 0; }
.sh-chart-title { height: 34px !important; font-weight: 700; border-color: transparent !important; padding: 0 6px !important; }
.sh-chart-title:hover, .sh-chart-title:focus { border-color: var(--border-2) !important; }
.sh-chart-head select, .sh-chart-opts select { height: 32px; width: auto; font-size: 13px; padding: 0 8px; border-radius: 8px; }
.sh-chart-opts { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12px; color: var(--text-2); }
.sh-chart-opts label { display: inline-flex; align-items: center; gap: 5px; }
.sh-ys { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.sh-check input { accent-color: #1E9E6A; width: auto; height: auto; }
.sh-chart-box { position: relative; height: 280px; }
.sh-chart-msg { margin: 0; padding: 40px 10px; text-align: center; }

/* 분석 */
.sh-ana-head h3 { margin: 2px 0 6px; font-size: 17px; }
.sh-ana-head p { margin: 0 0 8px; font-size: 14px; }
.sh-summary { font-size: 14px; margin: 8px 0; }
.sh-steps { margin: 6px 0; font-size: 13px; color: var(--muted); }
.sh-steps summary { cursor: pointer; }
.sh-steps pre { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 12px; overflow: auto; max-height: 240px; color: var(--text-2); }
.sh-ana-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sh-ana-table { max-height: 520px; overflow: auto; }
.sh-ana-table .table td.sh-num { text-align: right; font-variant-numeric: tabular-nums; }
.sh-ana-table .table th { position: sticky; top: 0; }
.sh-note { margin: 0; font-size: 12px; }

@media (max-width: 860px) {
  .sh-chart-list { grid-template-columns: 1fr; }
  .sh-tools .btn { padding: 0 8px; }
  .sh-info { display: none; }
  .sh-head .sh-saved { display: none; }
}
