/* BI 대시보드 스타일 (Tableau 계열): 평평한 시트, 얇은 선, 작은 글자, 높은 정보 밀도.
 * 색은 모두 변수. 상태는 색 + 기호 + 글자를 함께 쓴다. */
:root {
  --bg: #ffffff; --panel: #f5f6f7; --text: #2b2f33; --muted: #6b7480; --line: #d9dde1; --line2: #eceef0;
  --bar: #26384b; --bar-text: #ffffff; --accent: #2f6fab;
  --c1: #4e79a7; --c1d: #2a4f7c; --c2: #f28e2b; --c3: #e15759; --c4: #76b7b2; --c5: #59a14f; --c6: #edc948; --c7: #b07aa1;
  --green: #3f8a3a; --yellow: #b58900; --red: #d13b3d; --row: #f7f9fb; --lossbg: #fdeeee;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1f24; --panel: #232930; --text: #e3e7eb; --muted: #98a3af; --line: #38414b; --line2: #2b323a;
    --bar: #10161c; --accent: #6fa8dc; --c1: #6c9bc8; --c1d: #9cc3e8; --c2: #f5a04f; --c3: #ec7a7c;
    --green: #78c26e; --yellow: #e3c04a; --red: #f08183; --row: #20262d; --lossbg: #3a2325;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 "Pretendard", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", system-ui, sans-serif; }
#app { max-width: 1360px; margin: 0 auto; }

/* 제목줄 + 필터줄 + 시트 탭 */
.titlebar { background: var(--bar); color: var(--bar-text); padding: 10px 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.titlebar strong { font-size: 16px; font-weight: 600; } .titlebar span { opacity: .75; font-size: 12px; }
.filterbar { display: flex; align-items: flex-end; gap: 18px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filter label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
select { font: inherit; padding: 3px 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 2px; min-width: 120px; }
.tabs { display: flex; gap: 0; overflow-x: auto; margin-left: auto; }
.tabs a { padding: 6px 14px; text-decoration: none; color: var(--muted); white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); } .tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: 10px 16px 24px; }
.pagehead { margin: 0 0 8px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; } .pagehead h2 { margin: 0; font-size: 16px; } .pagehead p { margin: 0; color: var(--muted); }

/* 12칸 격자 위의 시트 */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.sheet { border: 1px solid var(--line); background: var(--bg); min-width: 0; grid-column: span 12; }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; } .s7 { grid-column: span 7; } .s8 { grid-column: span 8; }
.sheet > header { padding: 6px 10px; font-weight: 600; border-bottom: 1px solid var(--line); background: var(--panel); display: flex; justify-content: space-between; gap: 8px; }
.sheet > header small { font-weight: 400; color: var(--muted); }
.sheet > .body { padding: 8px 10px 10px; } .sheet > .body.flush { padding: 0; overflow-x: auto; }
.note { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.muted { color: var(--muted); } .small { font-size: 12px; }

/* BAN (큰 숫자) 띠 */
.bans { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--line); margin-bottom: 10px; }
.ban { padding: 10px 14px; border-right: 1px solid var(--line); min-width: 0; } .ban:last-child { border-right: 0; }
.ban .bl { color: var(--muted); font-size: 12px; } .ban .bv { font-size: 26px; font-weight: 300; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; } .ban .bv small { font-size: 12px; color: var(--muted); margin-left: 3px; }
.ban .bs { font-size: 12px; color: var(--muted); }
.up-good, .dn-good { color: var(--green); } .up-bad, .dn-bad { color: var(--red); }
.txt-green { color: var(--green); } .txt-yellow { color: var(--yellow); } .txt-red { color: var(--red); }

/* 표 */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
td { padding: 4px 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
tbody tr:nth-child(even) td { background: var(--row); }
.num { text-align: right !important; } tr.group td { background: var(--panel) !important; font-weight: 600; color: var(--muted); font-size: 12px; }
tr.click { cursor: pointer; } tr.click:hover td { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
tr.total td { font-weight: 700; border-top: 1px solid var(--line); } tr.loss td { background: var(--lossbg) !important; }
td.wrap { white-space: normal; min-width: 220px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: baseline; background: var(--muted); }
.dot.green { background: var(--green); } .dot.yellow { background: var(--c6); } .dot.red { background: var(--red); border-radius: 0; } .dot.yellow { border-radius: 0; transform: rotate(45deg) scale(.9); }
.spark { fill: none; stroke: var(--muted); stroke-width: 1.4; vertical-align: middle; } .spark.red { stroke: var(--red); } .spark.yellow { stroke: var(--yellow); } .spark.green { stroke: var(--green); }
.bar-in { display: inline-block; height: 8px; background: var(--c1); vertical-align: middle; margin-right: 6px; } .bar-in.neg { background: var(--c3); }

/* 차트 */
.chart { display: block; height: auto; } .chartbox { width: 100%; }
.chart .grid { stroke: var(--line2); } .chart .axis { stroke: var(--line); } .chart .tick { fill: var(--muted); font-size: 10.5px; } .chart .thlabel { fill: var(--muted); font-size: 10px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; } .chart .dot2 { stroke: var(--bg); stroke-width: 1.2; } .chart .hit { fill: transparent; }
.chart .markband { fill: var(--accent); opacity: .08; } .chart .thline { stroke-dasharray: 4 3; stroke-width: 1; } .th-green { stroke: var(--green); } .th-yellow { stroke: var(--yellow); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin-top: 4px; } .legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.bars { display: flex; flex-direction: column; gap: 4px; } .barrow { display: grid; grid-template-columns: 104px 1fr 96px; gap: 8px; align-items: center; }
.bartrack { height: 14px; } .barfill { display: block; height: 100%; background: var(--c1); } .barfill.ok { background: var(--c5); } .barfill.warn { background: var(--c6); } .barfill.bad { background: var(--c3); }
.barval { text-align: right; font-variant-numeric: tabular-nums; } .barval small { color: var(--muted); }

dialog.detail { width: min(680px, calc(100vw - 24px)); border: 1px solid var(--line); border-radius: 2px; background: var(--bg); color: var(--text); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dhead { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: var(--bar); color: var(--bar-text); } .dhead h2 { margin: 0; font-size: 14px; }
.dbody { padding: 12px 14px 14px; } .close { all: unset; cursor: pointer; padding: 2px 8px; } .close:hover { background: rgba(255,255,255,.15); }
.dval { display: flex; align-items: baseline; gap: 12px; } .dval strong { font-size: 28px; font-weight: 300; }
.guide dt { font-weight: 600; margin-top: 10px; color: var(--muted); } .guide dd { margin: 2px 0 0; } .guide ul { margin: 0; padding-left: 18px; }
footer { padding: 8px 16px 20px; color: var(--muted); font-size: 11.5px; border-top: 1px solid var(--line2); }
a:focus-visible, button:focus-visible, select:focus-visible, tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 900px) {
  .sheet[class*="s"] { grid-column: span 12; } .bans { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ban { border-bottom: 1px solid var(--line); }
  .tabs { margin-left: 0; width: 100%; } .barrow { grid-template-columns: 84px 1fr 88px; }
}

/* ---------- EIS (경영진용 한 화면) ---------- */
.modes { display: flex; gap: 2px; margin-left: 8px; } .modes .mode { color: #fff; opacity: .7; text-decoration: none; padding: 3px 12px; border: 1px solid rgba(255,255,255,.35); font-size: 12.5px; }
.modes .mode.on { opacity: 1; background: rgba(255,255,255,.18); font-weight: 600; } .titlebar .asof { margin-left: auto; }
.is-eis .titlebar { align-items: center; } .is-eis .titlebar .filter { display: flex; align-items: center; gap: 6px; } .is-eis .titlebar .filter label { margin: 0; color: #fff; opacity: .75; }
.is-eis .titlebar select { min-width: 110px; }
.is-eis main { padding-top: 10px; } .is-eis footer { padding-top: 4px; }
.etiles { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border: 1px solid var(--line); margin-bottom: 10px; }
.etile { all: unset; box-sizing: border-box; display: block; padding: 8px 12px 8px; border-right: 1px solid var(--line); border-top: 4px solid var(--line); cursor: pointer; min-width: 0; }
div.etile { cursor: default; } .etile:last-child { border-right: 0; } .etile:hover { background: var(--panel); }
.etile.green { border-top-color: var(--green); } .etile.yellow { border-top-color: var(--c6); } .etile.red { border-top-color: var(--red); }
.etile .el { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etile .ev { font-size: 28px; font-weight: 300; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; } .etile .ev small { font-size: 12px; color: var(--muted); }
.etile .es { font-size: 12px; } .etile .es .amt { color: var(--muted); } .etile .et { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etile .ed { font-size: 11.5px; color: var(--muted); } .etile .ed.good { color: var(--green); } .etile .ed.bad { color: var(--red); }
.etile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.eisrow .sheet { grid-column: span 6; }
.ftable { margin-top: 6px; font-size: 12px; } .ftable th, .ftable td { padding: 3px 6px; }
.segs { display: flex; gap: 12px; margin-bottom: 4px; } .seg { display: inline-flex; border: 1px solid var(--line); } .seg button { all: unset; cursor: pointer; padding: 2px 12px; font-size: 12px; color: var(--muted); } .seg button.on { background: var(--accent); color: #fff; } .seg button:focus-visible { outline: 2px solid var(--accent); }
.vlabel { font-size: 10.5px; font-weight: 600; fill: var(--text) !important; }
.issues { list-style: none; margin: 0; padding: 0; } .issues li { padding: 5px 0; border-bottom: 1px solid var(--line2); } .issues li:last-child { border-bottom: 0; }
.issues .ih { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; } .issues .iv { font-weight: 700; margin-left: 4px; } .issues .iq { color: var(--muted); font-size: 12px; } .ilink { font-size: 11.5px; color: var(--accent); }
.comm .headline { font-size: 14.5px; font-weight: 600; margin: 0 0 6px; } .cblock h4 { margin: 6px 0 2px; font-size: 12px; color: var(--muted); } .cblock ul { margin: 0; padding-left: 18px; } .cblock li { margin: 1px 0; }
.cblock.decide { border-left: 3px solid var(--c2); padding-left: 8px; } .cblock.decide h4 { color: var(--c2); }
.empty { color: var(--muted); padding: 30px 0; text-align: center; } .empty small { display: block; }
@media (max-width: 1200px) { .etiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } .etile { border-bottom: 1px solid var(--line); } }
@media (max-width: 900px) { .etiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .eisrow .sheet { grid-column: span 12; } .is-eis .titlebar .asof { margin-left: 0; } }
.is-eis { max-width: 1880px !important; }
