* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "Pretendard","Noto Sans KR","맑은 고딕","Malgun Gothic",sans-serif; background: #f4f6f9; color: #222; }
header { background: #1f3a5f; color: #fff; padding: 14px 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
header h1 { margin: 0; font-size: 18px; flex: 0 0 auto; }
.tabs { display: flex; gap: 4px; flex: 1 1 auto; }
.tab { background: transparent; color: #cfd9e6; border: 1px solid transparent; padding: 6px 14px; border-radius: 6px 6px 0 0; cursor: pointer; font-size: 14px; }
.tab:hover { background: rgba(255,255,255,.08); color: #fff; }
.tab.active { background: #f4f6f9; color: #1f3a5f; font-weight: 600; }
.header-actions { display: flex; gap: 6px; align-items: center; }
.save-status { color: #cfd9e6; font-size: 12px; margin-right: 8px; }
.header-actions button { background: #2d5285; color: #fff; border: 0; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.header-actions button:hover { background: #3a66a3; }

main { padding: 18px 22px 60px; max-width: 1500px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card { background: #fff; border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card h2 { margin: 0 0 10px; font-size: 16px; color: #1f3a5f; border-left: 4px solid #2d5285; padding-left: 8px; }
.hint { color: #666; font-size: 12px; margin: 2px 0 10px; }
.hint code { background: #eef1f5; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.row { display: flex; gap: 12px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.row label { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.row input, .row select { padding: 4px 8px; border: 1px solid #c0c8d4; border-radius: 4px; font-size: 13px; }
.row button { background: #2d5285; color: #fff; border: 0; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.row button:hover { background: #3a66a3; }

.table-wrap { overflow-x: auto; margin: 6px 0; }
table { border-collapse: collapse; min-width: 100%; font-size: 12px; }
th { background: #e7edf5; color: #1f3a5f; padding: 6px 8px; border: 1px solid #c4cedc; text-align: center; white-space: nowrap; }
td { padding: 0; border: 1px solid #d6dce6; }
td input, td select { width: 100%; border: 0; padding: 6px 8px; font-size: 12px; background: transparent; outline: none; }
td input:focus, td select:focus { background: #fffbe6; }
td.num input { text-align: right; }
td.sum { text-align: right; padding: 6px 8px; background: #f0f4f9; color: #555; font-weight: 600; }
td .row-del { background: none; border: 0; color: #c44; cursor: pointer; font-size: 14px; padding: 4px 8px; }
.add-row { margin-top: 6px; background: #d8e2f0; color: #1f3a5f; border: 1px dashed #6a8ab8; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.add-row:hover { background: #c8d6ea; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; }
.chart-card { background: #fff; border-radius: 8px; padding: 12px 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06); display: flex; flex-direction: column; min-height: 360px; }
.chart-card.wide { grid-column: span 2; }
.chart-card > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; background: transparent; color: inherit; padding: 0; box-shadow: none; }
.chart-card h3 { margin: 0; font-size: 14px; color: #1f3a5f; }
.chart-actions button { background: #1f3a5f; color: #fff; border: 0; padding: 4px 10px; border-radius: 3px; font-size: 11px; cursor: pointer; margin-left: 4px; }
.chart-actions button:hover { background: #2d5285; }
.chart-card canvas { flex: 1; max-height: 320px; }

textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 10px; border: 1px solid #c0c8d4; border-radius: 4px; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f3a5f; color: #fff; padding: 10px 18px; border-radius: 4px; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 999; }
#toast.show { opacity: 1; }

@media (max-width: 900px) {
  .chart-card.wide { grid-column: span 1; }
}
