/* 세후로 장부 화면. 회색 바탕 + 흰 카드, 파랑 하나, 손익은 증권 관례(이익 빨강·손실 파랑).
   자간은 body 한 곳에서만 정한다. 요소별로 따로 주지 않는다. */
:root {
  --bg: #f2f4f6; --card: #fff; --ink: #191f28; --ink2: #333d4b; --sub: #8b95a1; --sub2: #4e5968;
  --line: #f2f4f6; --line2: #e5e8eb; --blue: #3182f6; --blue-soft: #e8f3ff;
  --up: #f04452; --down: #3182f6; --div: #ffb331;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif; font-size: 15px; line-height: 1.5; word-break: keep-all; -webkit-font-smoothing: antialiased; }
*, button, input, select, textarea { letter-spacing: -0.02em; }
.wrap { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--sub); font-size: 13px; }
.up { color: var(--up); } .down { color: var(--down); }

.top { background: var(--card); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 54px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { width: 24px; height: 24px; }
.brand b { font-size: 16px; font-weight: 700; }
.tag { font-size: 13px; color: var(--sub); }

.card { background: var(--card); border-radius: 20px; padding: 22px; margin-top: 12px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card h2 { margin: 0; font-size: 18px; font-weight: 700; }
.side { font-size: 13px; color: var(--sub); }

.hero { padding: 26px 22px 22px; }
.hero .co { margin: 0; font-size: 14px; color: var(--sub2); }
.hero .h-label { margin: 14px 0 2px; font-size: 15px; color: var(--sub2); }
.hero h1 { margin: 0; font-size: 32px; font-weight: 700; }
.hero .meta { margin: 10px 0 0; font-size: 13px; color: var(--sub); }
.link { border: 0; background: none; color: var(--blue); font: inherit; cursor: pointer; padding: 0 0 0 4px; }

.kpi { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.kpi > div { background: var(--card); border-radius: 20px; padding: 18px 20px; }
.kpi span { display: block; font-size: 14px; color: var(--sub2); }
.kpi b { display: block; font-size: 22px; font-weight: 700; margin-top: 4px; white-space: nowrap; }
.kpi small { display: block; font-size: 12.5px; color: var(--sub); margin-top: 2px; }

.list .li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 11px 0; }
.list .l { color: var(--sub2); }
.list .l small { display: block; font-size: 12.5px; color: var(--sub); margin-top: 1px; }
.list .v { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
.list .v.up { color: var(--up); } .list .v.down { color: var(--down); }
.list .li.sum { border-top: 1px solid var(--line2); margin-top: 6px; padding-top: 15px; }
.list .li.sum .l { color: var(--ink); font-weight: 700; }
.list .li.sum .v { font-size: 18px; font-weight: 700; }

.bracket { margin: 4px 0 10px; }
.bk { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.bk i { display: block; height: 100%; border-radius: 5px; background: var(--blue); }
.bk-l { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--sub); margin-top: 6px; }

.hb { margin: 2px 0 8px; }
.hb-row { display: grid; grid-template-columns: 30% 1fr 96px; gap: 10px; align-items: center; padding: 7px 0; }
.hb-l { font-size: 14px; color: var(--sub2); }
.hb-l small { display: block; font-size: 11.5px; color: var(--sub); }
.hb-t { display: flex; height: 16px; }
.hb-t .half { flex: 1; display: flex; }
.hb-t .half.neg { justify-content: flex-end; border-right: 1px solid var(--line2); }
.hb-t i { display: block; height: 100%; border-radius: 4px; min-width: 2px; }
.up-bg { background: var(--up); } .down-bg { background: var(--down); } .mid-bg { background: var(--blue); }
.hb-v { text-align: right; font-weight: 600; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wbar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; margin: 4px 0 12px; background: var(--line); }
.wbar i { display: block; height: 100%; }
.wbar i + i { border-left: 2px solid #fff; }
.wt { font-size: 14px; }
.wt th { font-size: 12.5px; font-weight: 500; color: var(--sub); text-align: right; padding: 4px 4px 8px; }
.wt th:first-child, .wt td:first-child { text-align: left; }
.wt td { text-align: right; padding: 9px 4px; border-top: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wt td:first-child { color: var(--ink); font-weight: 600; white-space: normal; }
.wt td b { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; vertical-align: 0; }
.chart .val { font-size: 11.5px; text-anchor: middle; font-weight: 600; font-family: inherit; }
.chart .v-up { fill: var(--up); } .chart .v-down { fill: var(--down); }
.notes { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--sub); }
.notes li { margin: 3px 0; }
.more { font-size: 13px; color: var(--sub); margin: 10px 0 0; }

.unit-r { margin: 0 0 2px; text-align: right; font-size: 12px; color: var(--sub); }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line2); stroke-width: 1; }
.chart .tick { font-size: 12px; fill: var(--sub); text-anchor: middle; font-family: inherit; }
.bar-up { fill: var(--up); } .bar-down { fill: var(--down); } .bar-div { fill: var(--div); }
.legend { font-size: 12.5px; color: var(--sub); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 4px; margin: 0 4px 0 10px; }
.l-up { background: var(--up); } .l-down { background: var(--down); } .l-div { background: var(--div); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.grid-t { font-size: 14px; }
.grid-t th { font-size: 12.5px; font-weight: 500; color: var(--sub); text-align: right; padding: 6px 6px 8px; white-space: nowrap; }
.grid-t th:first-child { text-align: left; }
.grid-t td { padding: 11px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.grid-t td.name { font-weight: 600; color: var(--ink); }
.grid-t td.name span { display: block; font-size: 12px; color: var(--sub); font-weight: 400; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.actions { text-align: center; padding: 22px 0 4px; }
.actions p { margin: 8px 0 0; }
.btn { display: inline-block; background: var(--blue); color: #fff; border: 0; border-radius: 12px; padding: 13px 20px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .6; }
.sign { text-align: center; margin: 28px 0 6px; font-size: 13px; color: var(--sub); line-height: 1.7; }
.sign p { margin: 0; }
.sign .firm { font-size: 16px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.foot { padding: 16px 0 36px; font-size: 13px; color: var(--sub2); text-align: center; }
.foot p { margin: 2px 0; }
.err { color: var(--up); padding: 40px 0; }
.loading { padding: 40px 0; text-align: center; }

.intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.intro p { margin: 0; font-size: 14px; color: var(--sub2); }
label.btn, label.btn-sub { display: inline-block; cursor: pointer; white-space: nowrap; }
.databar .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.co-in, .databar select { font: inherit; font-size: 14px; padding: 9px 12px; border: 0; border-radius: 10px; background: var(--bg); color: var(--ink); }
.co-in { flex: 1 1 180px; }
.btn-sub { font: inherit; font-size: 14px; font-weight: 600; padding: 9px 14px; border: 0; border-radius: 10px; background: var(--blue-soft); color: var(--blue); cursor: pointer; }
.btn-sub.ghost { background: var(--bg); color: var(--sub2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 13px; background: var(--bg); border-radius: 8px; padding: 5px 10px; color: var(--sub2); }
.chip.bad { color: var(--up); }
.privacy { margin: 10px 0 0; font-size: 12.5px; color: var(--sub); }

@media (max-width: 720px) {
  .hero h1 { font-size: 28px; }
  .kpi b { font-size: 19px; }
  .card { padding: 20px 18px; }
  .hide-sm { display: none; }
  .hb-row { grid-template-columns: 34% 1fr 84px; gap: 8px; }
  .hb-l, .hb-v, .wt { font-size: 13px; }
  .grid-t { font-size: 13px; }
  .grid-t th, .grid-t td { padding-left: 3px; padding-right: 3px; }
  .card { padding-left: 16px; padding-right: 16px; }
  .intro { flex-direction: column; align-items: stretch; }
  .intro .btn { text-align: center; }
  .tag { display: none; }
}
