*{box-sizing:border-box;margin:0;padding:0;}
body{font-family:sans-serif;background:#f8f8f6;color:#1a1a18;}
header{background:#1a1a7a;color:white;padding:1.5rem 2rem;display:flex;align-items:center;justify-content:space-between;}
header h1{font-size:22px;font-weight:500;}
header p{font-size:12px;opacity:0.65;margin-top:3px;}
.ver{font-size:11px;background:rgba(255,255,255,0.15);padding:3px 10px;border-radius:4px;}

.tab-content{display:none;padding:2rem;max-width:960px;}
.tab-content.active{display:block;}

/* 서브탭 */
.subtab-row{display:flex;gap:0;margin-bottom:1.5rem;border-bottom:1px solid #e0e0e0;}
.subtab-row button{padding:8px 18px;border:none;background:none;cursor:pointer;font-size:13px;color:#888;border-bottom:2px solid transparent;}
.subtab-row button.active{color:#1a1a7a;border-bottom-color:#1a1a7a;font-weight:500;}
.subpanel{display:none;} .subpanel.active{display:block;}

.section-title{font-size:12px;font-weight:500;color:#888;text-transform:uppercase;letter-spacing:.06em;margin:0 0 12px;}
.formula-box{background:white;border:1px solid #e0e0e0;border-left:3px solid #1a1a7a;border-radius:0 6px 6px 0;padding:12px 16px;margin-bottom:1.5rem;font-size:13px;color:#555;line-height:1.8;}
.formula-box code{font-family:monospace;color:#1a1a18;}
.input-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px;margin-bottom:1.5rem;}
.input-group{display:flex;flex-direction:column;gap:6px;}
.input-group label{font-size:13px;color:#555;}
.input-group input,.input-group select{padding:8px 10px;border:1px solid #ccc;border-radius:6px;font-size:14px;}
.input-hint{font-size:11px;color:#999;}
.result-card{background:white;border:1px solid #e0e0e0;border-radius:10px;padding:1.25rem;margin-bottom:1rem;}
.result-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px;margin-top:12px;}
.metric{background:#f8f8f6;border-radius:6px;padding:12px 14px;border:1px solid #e8e8e8;}
.metric-label{font-size:12px;color:#888;margin-bottom:4px;}
.metric-value{font-size:18px;font-weight:500;}
.metric-unit{font-size:11px;color:#aaa;margin-left:2px;}
.check-row{display:flex;align-items:center;gap:8px;font-size:13px;padding:6px 0;border-bottom:1px solid #f0f0f0;}
.check-row:last-child{border-bottom:none;}
.badge{font-size:11px;padding:2px 8px;border-radius:6px;font-weight:500;}
.badge-ok{background:#e8f5e9;color:#2e7d32;}
.badge-err{background:#ffebee;color:#c62828;}
.badge-na{background:#f5f5f5;color:#aaa;}
canvas{border:1px solid #e0e0e0;border-radius:6px;background:#fafafa;}
table{width:100%;font-size:13px;border-collapse:collapse;}
th{text-align:left;padding:6px 8px;border-bottom:1px solid #e0e0e0;color:#888;font-weight:500;}
td{padding:5px 8px;border-bottom:1px solid #f0f0f0;}
.row-add{display:flex;gap:8px;align-items:flex-end;margin-bottom:1rem;flex-wrap:wrap;}
.row-add input{width:90px;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;}
button{padding:8px 16px;border:1px solid #ccc;border-radius:6px;background:white;cursor:pointer;font-size:13px;}
button:hover{background:#f0f0f0;}
.btn-primary{background:#1a1a7a;color:white;border-color:#1a1a7a;}
.btn-primary:hover{background:#12126a;}
.btn-danger{color:#c62828;}
.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:1rem;}
.toolbar select{height:36px;border:1px solid #ccc;border-radius:6px;background:white;color:#1a1a18;padding:0 10px;font-size:13px;min-width:200px;}
.toolbar label{font-size:13px;color:#555;}
.summary-bar{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;margin:1rem 0;}
.sum-card{background:white;border:1px solid #e0e0e0;border-radius:6px;padding:10px 14px;}
.sum-label{font-size:11px;color:#888;margin-bottom:3px;}
.sum-value{font-size:16px;font-weight:500;}
.btn-row{display:flex;gap:8px;margin-top:1rem;flex-wrap:wrap;}
.code-desc{font-size:11px;color:#1a1a7a;margin-bottom:1rem;}

/* Tabulator 오버라이드 */
.tabulator{border:1px solid #e0e0e0!important;border-radius:10px!important;overflow:hidden;font-size:13px;}
.tabulator .tabulator-header{background:#f8f8f6!important;border-bottom:1px solid #e0e0e0!important;}
.tabulator .tabulator-header .tabulator-col{background:#f8f8f6!important;border-right:1px solid #e0e0e0!important;color:#888!important;font-weight:500;font-size:12px;}
.tabulator .tabulator-row{background:white!important;border-bottom:1px solid #f0f0f0!important;}
.tabulator .tabulator-row:hover{background:#fafaf8!important;}
.tabulator .tabulator-row .tabulator-cell{border-right:1px solid #f0f0f0!important;color:#1a1a18!important;padding:6px 8px!important;}
.tabulator .tabulator-row.tabulator-row-even{background:#f8f8f6!important;}
.badge-ok-sm{background:#e8f5e9;color:#2e7d32;padding:1px 7px;border-radius:4px;font-size:11px;font-weight:500;}
.badge-err-sm{background:#ffebee;color:#c62828;padding:1px 7px;border-radius:4px;font-size:11px;font-weight:500;}
.badge-na-sm{background:#f5f5f5;color:#aaa;padding:1px 7px;border-radius:4px;font-size:11px;}

footer{text-align:center;padding:2rem;color:#aaa;font-size:12px;border-top:1px solid #e0e0e0;margin-top:2rem;}

/* ===== 사이드바 레이아웃 ===== */
.layout {
  display: flex;
  min-height: calc(100vh - 60px);
}
.sidebar {
  width: 140px;
  min-width: 140px;
  background: #f0f0ee;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  gap: 2px;
}
.sidebar button {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 0;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  text-align: left;
  border-left: 3px solid transparent;
}
.sidebar button:hover {
  background: #e8e8e6;
}
.sidebar button.active {
  color: #1a1a7a;
  background: white;
  border-left-color: #1a1a7a;
  font-weight: 500;
}
.main-content {
  flex: 1;
  overflow-x: auto;
}
.tab-content {
  display: none;
  padding: 2rem;
  max-width: 900px;
}
.tab-content.active {
  display: block;
}
