/* 내 포트폴리오·배당 계산기 공통 (백테스트·세금 계산기와 같은 모양) */
.form { display: grid; gap: 12px; }
.lbl, .form label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.form select, .form input[type=number], .form input[type=text] {
  font: inherit; font-size: 16px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; min-width: 0;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.unit { position: relative; }
.unit input { padding-right: 40px !important; text-align: right; }
.unit span { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12.5px; pointer-events: none; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 104px 32px; gap: 6px; align-items: center; margin-top: 6px; }
.prow.info { grid-template-columns: minmax(0, 1fr) 96px 32px 32px; }
.iconbtn { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 16px; padding: 0; }
.iconbtn:hover { color: var(--text); }
.addbtn { font: inherit; font-size: 13px; color: var(--accent); background: none; border: 1px dashed var(--line); border-radius: 8px; padding: 7px; cursor: pointer; margin-top: 6px; width: 100%; }
.addbtn:disabled { color: var(--muted); cursor: default; }
.sum { font-size: 12px; color: var(--muted); margin-top: 6px; }
.sum.bad { color: var(--yellow); }
.sum.ok { color: var(--green); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 14px 0; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tile .k { font-size: 11.5px; color: var(--muted); }
.tile .v { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 11px; color: var(--muted); }
.tile.hl { border-color: rgba(255, 214, 10, .55); }
h2.sec2 { font-size: 15px; margin: 18px 0 6px; }
.tip { font-size: 12.5px; background: rgba(110,168,254,.08); border: 1px solid rgba(110,168,254,.35); border-radius: 10px; padding: 9px 12px; margin: 10px 0; }
.sbtn { font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; border-radius: 10px; padding: 8px 14px;
        border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.sbtn:hover { border-color: var(--muted); }
.sbtn.primary { background: var(--accent); border-color: var(--accent); color: #0d1320; }
.sbtn.danger { color: var(--red); }
.sbtn:disabled { opacity: .5; cursor: default; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

/* 도넛 */
.pf-chart { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 560px) { .pf-chart { grid-template-columns: 1fr; justify-items: center; } }
.pf-chart svg { max-width: 100%; height: auto; }
.pf-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13px; width: 100%; }
.pf-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pf-legend i { width: 12px; height: 12px; border-radius: 3px; }
.pf-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-legend b { font-variant-numeric: tabular-nums; }
.pf-legend li.empty { color: var(--muted); }

/* 아래에서 올라오는 정보 창 (휴대폰) / 가운데 창 (PC) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; display: flex; align-items: center; justify-content: center; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(560px, 94vw); max-height: 86vh; overflow: auto; padding: 14px 16px 18px; position: relative; }
@media (max-width: 560px) {
  .sheet-bg { align-items: flex-end; }
  .sheet { width: 100%; border-radius: 16px 16px 0 0; max-height: 88vh; padding-bottom: calc(18px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
}
@keyframes up { from { transform: translateY(40px); } to { transform: none; } }
.sheet .x { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.sheet h2 { font-size: 17px; margin: 0 30px 2px 0; }
.sheet h3 { font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin: 0; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.kv dd small { color: var(--muted); font-size: 11px; margin-left: 4px; }
.na { color: var(--muted); }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 90px 46px; gap: 8px; align-items: center; font-size: 12.5px; margin: 3px 0; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .tr { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; display: flex; }
.hbar .tr i { display: block; height: 100%; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
