:root {
    --bg: #0e1014;
    --panel: #161920;
    --panel-2: #1d2129;
    --panel-3: #252a34;
    --line: #2a2f3a;
    --line-soft: #22262f;
    --text: #e8eaee;
    --text-2: var(--text-2);
    --muted: #8a92a2;
    --accent: #d0ab5f;
    --accent-soft: rgba(208, 171, 95, 0.14);
    --info: #5b8def;
    --notice: #e0a63a;
    --urgent: #e5534b;
    --ok: #3fb950;
    --text-3: #7c8494;
    /* 빨강 글자: 어두운 패널 위 대비 4.5:1 이상(배경·테두리는 --urgent) */
    --urgent-text: #ec615a;
    --ok-soft: rgba(63, 185, 80, 0.12);
    --warn-soft: rgba(224, 166, 58, 0.12);
    --danger-soft: rgba(229, 83, 75, 0.12);
    --info-soft: rgba(91, 141, 239, 0.14);
    --up-1: #7a977f;
    --up-2: #5fa56e;
    --up-3: #45bf62;
    --up-4: #3dff7a;
    --down-1: #a08a87;
    --down-2: #cc7a73;
    --down-3: #f05a52;
    --down-4: #ff3b33;
    /* 글자 크기 7단계 */
    --fs-xs: 11px;
    --fs-sm: 12px;
    --fs-md: 13px;
    --fs-base: 14px;
    --fs-lg: 15px;
    --fs-xl: 17px;
    --fs-2xl: 20px;
    /* 폰 입력칸은 16px 미만이면 확대된다 */
    --fs-input: 16px;
    /* 간격(4px 그리드) */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;
    /* 모서리 */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 8px;
    --r-lg: 10px;
    --r-xl: 14px;
    --r-pill: 999px;
    --radius: var(--r-lg);
    --radius-sm: var(--r-sm);
    --control-h: 36px;
    --control-h-sm: 28px;
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    --ring: 0 0 0 3px rgba(208, 171, 95, 0.28);
    --dur: 160ms;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.55 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    color: inherit;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    cursor: pointer;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
button:hover { border-color: var(--accent); }
button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--ring); }
button.ghost { background: transparent; }

input[type="search"] {
    font: inherit;
    color: var(--text);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    min-width: 220px;
}

.top {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs button { border-color: transparent; background: transparent; }
.tabs button.active { background: var(--panel-2); border-color: var(--line); }
.right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.conn { color: var(--urgent); font-size: var(--fs-sm); }
.conn.on { color: var(--ok); }

.badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 4px;
    border-radius: var(--r-md);
    background: var(--urgent);
    color: #fff;
    font-size: var(--fs-xs);
    text-align: center;
}
.badge:empty { display: none; }

main { max-width: 1100px; margin: 0 auto; padding: 16px 20px 60px; }
.tab { display: none; }
.tab.active { display: block; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button.active { border-color: var(--accent); color: var(--accent); }
.check { color: var(--muted); display: flex; align-items: center; gap: 4px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line);
    border-radius: var(--r-md);
    padding: 10px 16px;
}
.item.sev-info { border-left-color: var(--info); }
.item.sev-notice { border-left-color: var(--notice); }
.item.sev-urgent { border-left-color: var(--urgent); }
.item.unread { background: var(--panel-2); }
.item.fresh { animation: flash 2s ease-out; }
.item .meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: var(--fs-sm); }
.item .title { font-weight: 600; margin: 2px 0; }
.item .body { color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.item .links { display: flex; gap: 10px; margin-top: 4px; }
.item a { color: var(--accent); text-decoration: none; }
.item a:hover { text-decoration: underline; }
.cat { color: var(--accent); }
.dot-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--urgent); display: inline-block; }

.more { display: block; margin: 12px auto; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

.status { width: 100%; border-collapse: collapse; }
.status th, .status td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.status th { color: var(--muted); font-weight: 500; }
.bad { color: var(--urgent-text); }
.good { color: var(--ok); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast {
    width: 340px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-md);
    padding: 10px 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}
.toast .title { font-weight: 600; }

@keyframes flash { from { box-shadow: 0 0 0 2px var(--accent); } to { box-shadow: none; } }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 16px; }
.card .label { color: var(--muted); font-size: var(--fs-sm); }
.card .value { font-size: var(--fs-2xl); font-weight: 700; }
.card .sub { color: var(--muted); font-size: var(--fs-sm); }

.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.grid th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--bg); }
.grid .num { text-align: right; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: var(--panel-2); }
.grid .variant { color: var(--muted); font-size: var(--fs-sm); margin-left: 4px; }
.up { color: var(--ok); }
.down { color: var(--urgent-text); }
.tag { font-size: var(--fs-xs); color: var(--notice); margin-left: 4px; }
.hint { color: var(--muted); font-size: var(--fs-sm); }

.legend { color: var(--muted); font-size: var(--fs-sm); display: flex; gap: 10px; align-items: center; }
.sw { display: inline-block; width: 14px; height: 3px; margin-right: 4px; vertical-align: middle; }

.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 20px 16px; }
.doc h1 { font-size: var(--fs-2xl); margin: 16px 0 6px; }
.doc h2 { font-size: var(--fs-input); margin: 16px 0 6px; color: var(--accent); }
.doc h3 { font-size: var(--fs-base); margin: 16px 0 4px; }
.doc ul, .doc ol { margin: 4px 0; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc p { margin: 6px 0; color: var(--text-2); }
.doc code { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-xs); padding: 0 4px; font-size: var(--fs-sm); }
.doc .callout { border: 1px solid var(--notice); border-radius: var(--r-md); padding: 2px 16px 8px; margin: 12px 0; background: rgba(224, 166, 58, 0.06); }
.doc .callout h2 { color: var(--notice); }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { display: flex; flex-direction: column; gap: 10px; width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }
.login-box input { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; }
.login-box button { padding: 8px; }
.login-error { color: var(--urgent); margin: 0; font-size: var(--fs-md); }



.digest { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 16px; margin-bottom: 12px; }
.digest summary { cursor: pointer; color: var(--text-2); }
.digest .label { color: var(--accent); font-weight: 600; margin-right: 6px; }
.digest-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.digest-list li { border-top: 1px solid var(--line); padding-top: 8px; }
.digest-list .meta { color: var(--muted); font-size: var(--fs-sm); }

.brief-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 16px; margin-bottom: 12px; }
.brief-grid .panel { margin-bottom: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.panel-head h3 { margin: 0; font-size: var(--fs-base); color: var(--accent); }
.panel .body { color: var(--text-2); white-space: pre-wrap; }
.mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mini li { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.mini .meta { color: var(--muted); font-size: var(--fs-sm); }
.link { color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }
.leagues { color: var(--muted); font-size: var(--fs-sm); }
.toolbar label { color: var(--muted); display: flex; align-items: center; gap: 4px; }
.toolbar input[type="number"] { width: 70px; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 6px; }
.toolbar select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 6px; }


.item-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.item-icon { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
.item-icon.blank { display: inline-block; }
.item-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.item-text .variant { margin-left: 0; }

.item-head { display: inline-flex; align-items: center; gap: 6px; }
.item-name { color: var(--text); }
.icon-btn { padding: 0 4px; font-size: var(--fs-sm); line-height: 18px; background: transparent; border-color: transparent; }
.icon-btn:hover { border-color: var(--line); }
.sort-select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 6px; }

.login-box a { text-align: center; color: var(--muted); }
.form-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0; }
.form-grid label { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.form-grid input, .form-grid select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px 8px; min-width: 180px; }
.form-actions { display: flex; gap: 6px; }

/* ---------- 모바일 ---------- */
.tab, .panel, .brief-grid > * { min-width: 0; }
.tabs button { white-space: nowrap; }

@media (max-width: 720px) {
    body { font-size: var(--fs-md); }
    .top { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
    .brand { font-size: var(--fs-base); }
    .right { gap: 6px; }
    #me-name { display: none; }
    #btn-notify { padding: 2px 6px; font-size: var(--fs-sm); }
    /* 탭은 한 줄로 두고 가로로 밀어서 본다 */
    .tabs { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tabs button { flex-shrink: 0; padding: 4px 8px; }
    main { padding: 10px 10px 60px; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .card { padding: 8px 10px; }
    .card .value { font-size: var(--fs-input); }
    .brief-grid, .two { grid-template-columns: minmax(0, 1fr); }
    .panel { padding: 8px 10px; }
    .panel-head { gap: 6px; }
    .hide-sm { display: none; }
    .grid th, .grid td { padding: 4px 4px; white-space: normal; }
    .grid .num { white-space: nowrap; }
    .item-icon { width: 22px; height: 22px; }
    .item-cell { gap: 6px; }
    .item-head { flex-wrap: wrap; gap: 4px; }
    .toolbar { gap: 6px; }
    .toolbar input[type="search"] { min-width: 0; width: 100%; }
    .form-grid label { width: 100%; }
    .form-grid input, .form-grid select { min-width: 0; flex: 1; }
    .status th, .status td { padding: 6px 4px; font-size: var(--fs-sm); }
    .toasts { left: 10px; right: 10px; }
    .toast { width: auto; }
}

.ret-cell { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.ret-main { font-weight: 600; }
.ret-range { font-size: var(--fs-xs); color: var(--muted); }
.item-text .variant { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 720px) {
    .item-text { min-width: 0; }
    .item-text .variant { white-space: nowrap; max-width: 150px; }
    .grid td:first-child { min-width: 150px; }
}

@media (max-width: 720px) {
    /* 차트는 viewBox(900폭)를 줄여 그리므로 글자를 키워야 폰에서 읽힌다 */
}
.grid td.strong { font-weight: 700; }

.show-sm { display: none; }
@media (max-width: 720px) {
    .show-sm { display: inline; }
}

/* ---------- 시즌별 팝오버 ---------- */
.has-popover { cursor: pointer; }
.popover {
    position: absolute;
    z-index: 30;
    background: var(--panel-2);
    border: 1px solid var(--accent);
    border-radius: var(--r-md);
    padding: 10px 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    font-size: var(--fs-sm);
}
.pop-title { margin-bottom: 6px; }
.pop-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pop-table th, .pop-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.pop-table th { color: var(--muted); font-weight: 500; }
.pop-table .num { text-align: right; }
.pop-summary { margin-top: 6px; color: var(--muted); }

.pop-table tr.missing td { color: var(--muted); }
#price-empty p { margin: 8px 0; }
.ret-range.good { color: var(--ok); }
.ret-range.bad { color: var(--notice); }

.buy-btn { color: var(--ok); border-color: var(--ok); }
td.bad, .grid td.bad { color: var(--notice); }

@media (max-width: 720px) {
    .grid td:first-child { min-width: 130px; }
    .item-head { gap: 4px; }
    .ret-cell { align-items: flex-end; text-align: right; }
    .grid td.num:has(.ret-cell) { white-space: normal; }
    .ret-cell { max-width: 130px; }
    .ret-range { white-space: normal; }
}

/* 실시간 시세: 추천 */
.test-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(229, 83, 75, 0.12); border: 1px solid var(--notice); color: var(--notice); border-radius: var(--r-md); padding: 8px 12px; margin-bottom: 12px; font-weight: 600; }
.rec-group { margin-top: 10px; }
.rec-group-title { margin-bottom: 4px; }
.tier-badge { display: inline-block; font-size: var(--fs-sm); font-weight: 700; padding: 1px 8px; border-radius: var(--r-lg); border: 1px solid var(--line); }
.tier-badge.tier-strong { color: #0d1117; background: var(--ok); border-color: var(--ok); }
.tier-badge.tier-pattern { color: var(--accent); border-color: var(--accent); }
.tier-badge.tier-watch { color: var(--muted); }
.rec-list { list-style: none; margin: 0; padding: 0; }
.rec-item { border-top: 1px solid var(--line); padding: 8px 0; }
.rec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-numbers { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.rec-price { font-weight: 600; }
.rec-expected { font-weight: 700; font-size: var(--fs-lg); }
.rec-why { margin: 4px 0 0 34px; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--muted); }
.rec-why li::before { content: '· '; }
.rec-why li.warn { color: var(--notice); }
details.panel > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
@media (max-width: 720px) {
    .rec-why { margin-left: 0; }
    .rec-numbers { width: 100%; justify-content: flex-start; }
}

/* 추천 카드: 매매 한 줄 · 사실 · 그래프 */
.rec-item .tier-badge { margin-right: 6px; }
.rec-trade { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; margin: 6px 0 2px; font-size: var(--fs-lg); cursor: help; }
.rec-step { font-weight: 600; }
.rec-arrow { color: var(--muted); }
.rec-expected.up { color: var(--ok); }
.rec-expected.down { color: var(--urgent); }
.rec-facts { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--fs-sm); color: var(--muted); }
.rec-facts .good { color: var(--ok); }
.rec-facts .bad { color: var(--notice); }
.rec-body { display: flex; gap: 12px; align-items: flex-start; margin-top: 4px; }
.rec-body .rec-why { margin: 0; flex: 1; }
.trade-chart { width: 360px; max-width: 46%; height: auto; flex: none; background: var(--panel-2); border-radius: var(--r-sm); }
.trade-chart .tc-past { fill: none; stroke: var(--muted); stroke-width: 1; opacity: 0.55; }
.trade-chart .tc-now { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.trade-chart .tc-now-dot { fill: var(--accent); }
.trade-chart .tc-target { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 4 3; }
.trade-chart .tc-target-dot { fill: var(--ok); }
.trade-chart .tc-today, .trade-chart .tc-sell { stroke: var(--line); stroke-width: 1; }
.trade-chart .tc-sell { stroke-dasharray: 2 2; }
.trade-chart .tc-label, .trade-chart .tc-axis { fill: var(--muted); font-size: 9px; }
.trade-chart .tc-axis-target { fill: var(--ok); }
.ret-main.bad { color: var(--urgent); }
@media (max-width: 720px) {
    .rec-body { flex-direction: column; }
    .trade-chart { width: 100%; max-width: 100%; }
    .rec-trade { font-size: var(--fs-base); }
}
.rec-actual { font-size: var(--fs-md); font-weight: 600; margin: 2px 0; }
.rec-actual.good { color: var(--ok); }
.rec-actual.bad { color: var(--urgent); }
.link-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline dotted; cursor: pointer; }
.link-btn.up { color: var(--ok); }
.basis-notes { margin: 6px 0 0; padding-left: 16px; color: var(--muted); }
.basis-notes .warn { color: var(--notice); }

/* ---------- 품목 AI 리포트 ---------- */
.pop-title { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pop-title .report-btn { margin-left: auto; }
body.modal-open { overflow: hidden; }
.report-modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.report-modal[hidden] { display: none; }
.report-box { background: var(--panel); border: 1px solid var(--accent); border-radius: var(--r-lg); padding: 16px 16px; width: 100%; max-width: 760px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.report-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.report-bar .hint { flex: 1 1 200px; }
.report-verdict { display: flex; align-items: center; gap: 8px; }
.verdict-badge { font-weight: 600; font-size: var(--fs-md); padding: 2px 10px; border-radius: var(--r-pill); border: 1px solid currentColor; }
.verdict-buy { color: var(--ok); }
.verdict-hold { color: var(--info); }
.verdict-wait { color: var(--notice); }
.verdict-sell, .verdict-avoid { color: var(--urgent); }
.report-headline { margin: 8px 0 12px; font-size: var(--fs-xl); line-height: 1.45; }
.report-facts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.report-fact { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.report-fact small { color: var(--muted); font-size: var(--fs-xs); }
.report-fact.up strong { color: var(--ok); }
.report-fact.down strong { color: var(--urgent); }
.report-section { margin: 12px 0; }
.report-section h4 { margin: 0 0 4px; color: var(--accent); font-size: var(--fs-base); }
.report-section p { margin: 0; white-space: pre-wrap; line-height: 1.6; }
.report-section ul { margin: 0; padding-left: 16px; line-height: 1.6; }
.report-risks li { color: var(--notice); }
.report-meta { margin-top: 16px; font-size: var(--fs-xs); }
.report-empty { padding: 16px 0; }
.spinner { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid var(--muted); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 720px) {
    .report-modal { padding: 8px; }
    .report-box { padding: 12px; }
    .report-facts { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 확인·입력 창 ---------- */
.dialog-layer { z-index: 60; align-items: center; }
.dialog-box { max-width: 420px; display: flex; flex-direction: column; gap: 10px; }
.dialog-box .report-head { margin-bottom: 0; }
.dialog-title { margin: 0; font-size: var(--fs-input); }
.dialog-line { margin: 0; }
.dialog-field { display: flex; flex-direction: column; gap: 4px; }
.dialog-label { font-size: var(--fs-sm); color: var(--muted); }
.dialog-input { display: flex; align-items: center; gap: 6px; }
.dialog-input input { flex: 1; min-width: 0; font-size: var(--fs-input); padding: 8px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); font-variant-numeric: tabular-nums; }
.dialog-input input:focus { outline: none; border-color: var(--accent); }
.dialog-summary { background: var(--panel-2); border-radius: var(--r-sm); padding: 8px 10px; font-size: var(--fs-md); line-height: 1.6; }
.dialog-summary:empty { display: none; }
.dialog-error { margin: 0; color: var(--urgent); font-size: var(--fs-sm); min-height: 0; }
.dialog-error:empty { display: none; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* 목록: AI 리포트 있음 */
.icon-btn.report-chip { color: var(--accent); border-color: rgba(208, 171, 95, 0.6); padding: 0 6px 0 4px; }
.icon-btn.report-chip:hover { background: var(--accent-soft); }
.icon-btn.report-chip svg { display: block; flex: none; }

/* 품목 옆 아이콘 버튼: 복사 · poedb · 매수 (같은 크기·테두리) */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 20px; min-width: 22px; padding: 0 4px; border: 1px solid var(--line); border-radius: var(--r-xs); background: transparent; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; vertical-align: middle; }
.icon-btn svg { display: block; flex: none; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn.done { color: var(--ok); border-color: var(--ok); }
.icon-btn.buy-btn { color: var(--ok); border-color: var(--ok); padding: 0 6px 0 4px; }
.icon-btn.buy-btn:hover { background: rgba(63, 185, 80, 0.12); }
@media (max-width: 720px) {
    .icon-btn { height: 24px; min-width: 26px; }
}

/* ---------- 품목 그래프 팝업 ---------- */
.chart-box { max-width: 980px; }
.chart-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chart-tools { display: flex; align-items: center; gap: 6px; }
.chart-tools .icon-btn { font-size: var(--fs-lg); height: 26px; min-width: 28px; }
.chart-host { position: relative; }
.ic-wrap { position: relative; width: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.ic-svg { display: block; width: 100%; height: auto; cursor: crosshair; }
.ic-grid { stroke: var(--line); stroke-width: 1; }
.ic-grid-x { stroke-dasharray: 2 4; }
.ic-axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ic-frame { fill: none; stroke: var(--line); }
.ic-today { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 4 3; }
.ic-today-label { fill: var(--accent); font-size: 11px; }
.ic-base { stroke: var(--info); stroke-width: 1; stroke-dasharray: 2 3; }
.ic-cross { stroke: var(--text); stroke-width: 1; opacity: 0.5; }
.ic-dot { stroke: var(--bg); stroke-width: 1.5; }
.ic-tip { position: absolute; z-index: 2; pointer-events: none; background: rgba(15, 17, 21, 0.94); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; font-size: var(--fs-sm); min-width: 150px; max-width: 260px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
.ic-tip-head { font-weight: 700; margin-bottom: 4px; }
.ic-tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.5; white-space: nowrap; }
.ic-tip-label { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ic-tip-change { font-size: var(--fs-xs); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r-pill); background: transparent; color: var(--text); cursor: pointer; }
.legend-item.off { opacity: 0.35; text-decoration: line-through; }
.chart-stats td:first-child { white-space: nowrap; }
.chart-stats .sw, .ic-tip .sw, .legend-item .sw { display: inline-block; width: 10px; height: 10px; border-radius: var(--r-xs); margin-right: 4px; vertical-align: -1px; }
.chart-help { margin-top: 8px; }
@media (max-width: 720px) {
    .chart-controls { flex-direction: column; align-items: stretch; }
    .chart-ranges { overflow-x: auto; flex-wrap: nowrap; }
    .chart-tools { justify-content: flex-end; }
}

/* 이번 패치로 달라진 품목 */
.patch-chip { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--r-xs); font-size: var(--fs-xs); font-weight: 700; border: 1px solid currentColor; background: transparent; cursor: pointer; white-space: nowrap; }
.patch-chip.patch-up { color: var(--ok); }
.patch-chip.patch-down { color: var(--urgent); }
.patch-chip.patch-mixed { color: var(--notice); }
.chart-patch { margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid currentColor; background: var(--panel-2); border-radius: var(--r-xs); font-size: var(--fs-md); }
.chart-patch.patch-up { color: var(--ok); }
.chart-patch.patch-down { color: var(--urgent); }
.chart-patch.patch-mixed { color: var(--notice); }

/* 물가(인플레이션) */
.inflation-badge { display: inline-block; font-weight: 700; padding: 2px 10px; border-radius: var(--r-pill); border: 1px solid currentColor; margin-bottom: 8px; }
.inflation-badge.ok { color: var(--ok); }
.inflation-badge.info { color: var(--info); }
.inflation-badge.notice { color: var(--notice); }
.inflation-badge.urgent { color: var(--urgent); }
#inflation-chart { margin: 6px 0 10px; }

/* 품목 칸: 이름 누르면 복사(한글·영문 각각) · 그래프 · db · 매수 · 패치 · AI */
.item-head { flex-wrap: wrap; row-gap: 4px; }
.item-actions, .item-tags { display: inline-flex; align-items: center; gap: 4px; }
.item-tags:empty { display: none; }
.copy-name { display: inline-flex; align-items: center; gap: 4px; cursor: copy; border-radius: var(--r-xs); }
.copy-name .copy-mark { display: inline-flex; color: var(--muted); opacity: 0.55; transition: opacity var(--dur) var(--ease); }
.copy-name:hover .copy-mark, .copy-name:focus-visible .copy-mark { opacity: 1; color: var(--accent); }
.copy-name:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px; }
.copy-name.copied, .copy-name.copied .copy-mark { color: var(--ok); opacity: 1; }
.item-name.copy-name { color: var(--accent); font-weight: 600; }
.item-en .copy-name-text { color: var(--muted); }
.item-variant { color: var(--muted); }
.holding-row { cursor: pointer; }
.holding-row:hover td { background: rgba(255, 255, 255, 0.025); }
/* 이름(1행) · 영문(2행) | 버튼(오른쪽, 두 행에 걸침). 폰: 버튼은 3행 */
.item-text { display: grid; grid-template-columns: auto auto; grid-template-areas: "head tools" "sub tools"; column-gap: 8px; align-items: center; justify-content: start; }
.item-text > .item-head { grid-area: head; }
.item-text > .variant { grid-area: sub; }
.item-text > .item-tools { grid-area: tools; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
@media (max-width: 720px) {
    .item-text { grid-template-columns: auto; grid-template-areas: "head" "sub" "tools"; row-gap: 4px; }
}
.item-tools .patch-chip { height: 20px; }
@media (max-width: 720px) {
    .item-tools .patch-chip { height: 24px; }
}


/* =========================================================
   디자인 정리: 입력 요소·필터 바·세그먼트·검색 상자
   ========================================================= */
.panel { border-radius: var(--radius); padding: 16px 16px; border-color: var(--line-soft); }
.panel-head { margin-bottom: 10px; }
.panel-head h3 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em; }
.card { border-radius: var(--radius); border-color: var(--line-soft); }
.card .value { letter-spacing: -0.02em; }
.sub-title { font-size: var(--fs-md); font-weight: 600; color: var(--text-2); margin: 12px 0 4px; }
.top { backdrop-filter: blur(8px); background: rgba(22, 25, 32, 0.92); }
.tabs button { border-radius: var(--r-md); padding: 4px 12px; color: var(--muted); font-weight: 600; }
.tabs button:hover { color: var(--text); border-color: transparent; background: var(--panel-2); }
.tabs button.active { color: var(--text); background: var(--panel-3); border-color: transparent; }
mark { background: none; color: var(--accent); font-weight: 700; }

/* 공통 입력 요소 */
select, input[type="number"], input[type="text"], input[type="password"] {
    font: inherit;
    color: var(--text);
    background-color: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    height: var(--control-h);
    padding: 0 10px;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%238a92a2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}
select:hover, input[type="number"]:hover { border-color: #3a4150; }
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type="number"] { font-variant-numeric: tabular-nums; }
.toolbar select, .toolbar input[type="number"], .sort-select { height: 32px; padding-top: 0; padding-bottom: 0; }
.toolbar select, .sort-select { padding-right: 28px; }

/* 이름 붙은 한 줄 선택(브리핑 정렬 등) */
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.inline-field select { height: 30px; font-size: var(--fs-md); }

/* 필터 바: 라벨이 위, 입력이 아래인 칸들 */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-items: end; margin: 4px 0 8px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field[hidden] { display: none; }
.field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.field-control { position: relative; display: flex; align-items: center; }
.field-control select, .field-control input { width: 100%; min-width: 0; background-color: var(--bg); }
.field-control input[type="number"] { padding-right: 52px; }
.field-unit { position: absolute; right: 10px; font-size: var(--fs-sm); color: var(--muted); pointer-events: none; }
.field-wide { grid-column: span 2; }

/* 세그먼트(둘 중 하나 고르기) */
.segmented { display: inline-flex; gap: 2px; padding: 4px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--r-lg); margin: 6px 0 10px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 6px 16px; border-radius: var(--r-sm); white-space: nowrap; }
.segmented button small { font-weight: 500; font-size: var(--fs-xs); opacity: 0.8; margin-left: 4px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.segmented.small { margin: 0; }
.segmented.small button { padding: 4px 10px; font-size: var(--fs-sm); }

/* 표 */
.grid th { font-size: var(--fs-sm); line-height: 1.3; vertical-align: bottom; padding-top: 8px; padding-bottom: 8px; }
.grid th small { font-weight: 400; font-size: var(--fs-xs); opacity: 0.8; }
.grid td { border-bottom-color: var(--line-soft); padding-top: 8px; padding-bottom: 8px; }
.grid tbody tr { transition: background-color var(--dur) var(--ease); }

/* ---------- 품목 검색 상자(자동완성) ---------- */
.combo { position: relative; max-width: 640px; }
.combo-field { position: relative; display: flex; align-items: center; }
.combo-icon { position: absolute; left: 12px; display: inline-flex; color: var(--muted); pointer-events: none; }
input.combo-input { width: 100%; min-width: 0; height: 44px; padding: 0 40px 0 38px; font-size: var(--fs-lg); border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
input.combo-input::-webkit-search-cancel-button { display: none; }
input.combo-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.combo-clear { position: absolute; right: 8px; width: 26px; height: 26px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--panel-3); color: var(--muted); }
.combo-clear:hover { color: var(--text); }
.combo-clear[hidden] { display: none; }
.combo-list { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; max-height: min(440px, 62vh); overflow-y: auto; overscroll-behavior: contain; padding: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.combo-list[hidden] { display: none; }
.combo-heading { padding: 6px 10px 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.combo-note { position: sticky; bottom: -6px; margin: 6px -6px -6px; padding: 8px 16px; font-size: var(--fs-xs); color: var(--muted); background: var(--panel-2); border-top: 1px solid var(--line-soft); }
.combo-status { padding: 16px 12px; text-align: center; color: var(--muted); font-size: var(--fs-md); }
.combo-item + .combo-item { border-top: 1px solid var(--line-soft); }
.combo-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; }
.combo-row.active, .combo-row.is-group:hover { background: var(--panel-3); }
.combo-thumb { width: 32px; height: 32px; object-fit: contain; flex: none; }
.combo-thumb.blank { display: inline-block; border-radius: var(--r-sm); background: var(--panel-3); }
.combo-names { flex: 1; min-width: 0; line-height: 1.3; }
.combo-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-sub { font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-sub mark { color: var(--text-2); }
.combo-variant { margin-left: 6px; padding: 0 6px; border-radius: var(--r-xs); background: var(--panel-3); color: var(--text-2); font-size: var(--fs-xs); }
.combo-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; text-align: right; line-height: 1.3; }
.combo-type { font-size: var(--fs-xs); color: var(--muted); }
.combo-meta { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.combo-variants { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 10px 52px; }
.combo-chip { display: inline-flex; align-items: baseline; gap: 6px; height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-pill); background: var(--bg); border: 1px solid var(--line); color: var(--text-2); }
.combo-chip small { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.combo-chip:hover, .combo-chip.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

@media (max-width: 720px) {
    :root { --control-h: 40px; }
    .panel { padding: 12px; }
    .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
    .field-wide, .filter-submit { grid-column: 1 / -1; }
    select, input[type="number"] { font-size: var(--fs-input); }
    .combo { max-width: none; }
    input.combo-input { font-size: var(--fs-input); }
    .combo-list { max-height: 58vh; }
    .combo-variants { padding-left: 10px; }
    .combo-row { padding: 8px 8px; }
    .segmented { display: flex; }
    .segmented button { flex: 1; }
    .inline-field select { font-size: var(--fs-base); }
}
@media (max-width: 720px) {
    .grid th small { display: none; }
    .grid th br { display: none; }
}
/* 필터 바: PC는 한 줄로 흐르게(칸 너비는 내용 기준), 폰은 2열 */
@media (min-width: 721px) {
    .filter-bar { display: flex; flex-wrap: wrap; }
    .filter-bar .field { flex: 1 1 130px; }
    .filter-bar .field-wide { flex: 2 1 200px; }
}

/* 팝오버가 화면 폭을 넘어 페이지에 좌우 스크롤이 생기지 않게 */
body { overflow-x: clip; }
.popover { max-width: calc(100vw - 16px); overflow-x: auto; overscroll-behavior-x: contain; }
@media (max-width: 720px) {
    .pop-table { font-size: var(--fs-xs); }
    .pop-table th, .pop-table td { padding: 4px 4px; }
    .pop-table th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
}

/* display를 지정한 요소도 hidden이면 숨긴다(빈 배너·빈 칸이 보이던 문제) */
[hidden] { display: none !important; }

/* ---------- 셀렉트(검색·다중 선택) ---------- */
select.sel-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); }
.sel-trigger { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; height: var(--control-h); min-width: 120px; padding: 0 10px 0 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); text-align: left; font-weight: 500; }
.sel-trigger:hover { border-color: #3a4150; }
.sel-trigger.open, .sel-trigger:focus-visible { border-color: var(--accent); box-shadow: var(--ring); }
.sel-trigger:disabled { opacity: 0.45; cursor: not-allowed; }
.sel-trigger .sel-value { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-trigger .sel-chevron { display: inline-flex; color: var(--muted); transition: transform var(--dur) var(--ease); }
.sel-trigger.open .sel-chevron { transform: rotate(180deg); color: var(--accent); }
.sel-placeholder { color: var(--muted); }
.sel-count { flex: none; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 700; line-height: 18px; }
.field-control .sel-trigger { width: 100%; background: var(--bg); }
.inline-field .sel-trigger, .toolbar .sel-trigger, .sel-trigger.sort-select { height: 32px; font-size: var(--fs-md); }
.chart-tools .sel-trigger { height: 28px; font-size: var(--fs-sm); min-width: 0; }

.sel-panel { position: fixed; z-index: 70; display: flex; flex-direction: column; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; animation: sel-in 0.12s ease-out; outline: none; }
@keyframes sel-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sel-search { position: relative; display: flex; align-items: center; padding: 8px; border-bottom: 1px solid var(--line-soft); }
.sel-search .combo-icon { left: 18px; }
.sel-search input { width: 100%; height: 34px; padding: 0 10px 0 32px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); font: inherit; }
.sel-search input:focus { outline: none; border-color: var(--accent); box-shadow: none; }
.sel-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.sel-option { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.sel-option.active { background: var(--panel-3); }
.sel-option.disabled { opacity: 0.4; cursor: not-allowed; }
.sel-mark { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-top: 2px; color: var(--accent); visibility: hidden; }
.sel-option.selected .sel-mark { visibility: visible; }
.sel-panel.is-multi .sel-mark { visibility: visible; color: transparent; border: 1.5px solid var(--line); border-radius: var(--r-xs); }
.sel-panel.is-multi .sel-option.selected .sel-mark { color: #1a1407; background: var(--accent); border-color: var(--accent); }
.sel-panel.is-multi .sel-mark svg { width: 11px; height: 11px; }
.sel-option-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.sel-option.selected .sel-option-label { color: var(--accent); font-weight: 600; }
.sel-panel.is-multi .sel-option.selected .sel-option-label { color: var(--text); }
.sel-option-hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; white-space: normal; }
.sel-empty { padding: 16px; text-align: center; color: var(--muted); font-size: var(--fs-md); }
.sel-foot { display: flex; justify-content: space-between; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line-soft); }
.sel-foot button { font-size: var(--fs-sm); padding: 4px 8px; border-color: transparent; color: var(--muted); }
.sel-foot button:hover { color: var(--accent); }
.sel-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; font-weight: 700; }
.sel-sheet-head button { color: var(--accent); border-color: transparent; font-weight: 700; }
.sel-backdrop { position: fixed; inset: 0; z-index: 69; background: rgba(0, 0, 0, 0.5); animation: fade-in var(--dur) var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
.sel-panel.is-sheet { left: 0; right: 0; bottom: 0; top: auto; max-height: 72vh; border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet-up 0.2s ease-out; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sel-panel.is-sheet::before { content: ''; display: block; width: 36px; height: 4px; margin: 8px auto 0; border-radius: var(--r-xs); background: var(--line); }
.sel-panel.is-sheet .sel-option { padding: 12px 12px; font-size: var(--fs-lg); }
.sel-panel.is-sheet .sel-search input { height: 40px; font-size: var(--fs-input); }

/* ---------- 설명 버튼 (i) ---------- */
.info-btn { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; padding: 0; margin: 0 2px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--muted); font: italic 700 10px/1 Georgia, "Times New Roman", serif; vertical-align: 1px; flex: none; cursor: help; }
.info-btn::before { content: 'i'; }
.info-btn:hover, .info-btn:focus-visible { color: var(--accent); border-color: var(--accent); }
.panel-head .info-btn { align-self: center; }
.card .label { display: flex; align-items: center; gap: 2px; }
.popover.narrow { border-color: var(--line); }
.info-pop { font-size: var(--fs-md); line-height: 1.6; color: var(--text-2); white-space: pre-line; }
@media (max-width: 720px) {
    /* 손가락으로 누르기 쉽게 터치 영역만 넓힌다 */
    .info-btn { width: 20px; height: 20px; position: relative; }
    .info-btn::after { content: ''; position: absolute; inset: -8px; }
}

/* ---------- 우상단 알림(종) ---------- */
.bell-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 0; border-radius: var(--r-md); background: transparent; border-color: transparent; color: var(--muted); }
.bell-btn:hover, .bell-btn.open { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.bell-btn.has-unread { color: var(--accent); }
.bell-btn.has-unread svg { filter: drop-shadow(0 0 4px rgba(208, 171, 95, 0.55)); }
.bell-btn .badge { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; line-height: 16px; font-size: var(--fs-xs); font-weight: 700; border: 2px solid var(--panel); box-sizing: content-box; }
.alert-center { position: fixed; z-index: 45; top: 58px; right: 16px; width: 420px; max-height: min(640px, calc(100vh - 80px)); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); animation: sel-in 0.14s ease-out; overflow: hidden; }
.ac-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 8px; }
.ac-head strong { font-size: var(--fs-lg); margin-right: auto; }
.ac-head .check { font-size: var(--fs-sm); }
.ac-close { display: none; }
.ac-filters { flex-wrap: nowrap; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none; border-bottom: 1px solid var(--line-soft); }
.ac-filters::-webkit-scrollbar { display: none; }
.ac-filters button { flex: none; font-size: var(--fs-sm); padding: 4px 10px; border-radius: var(--r-pill); }
.ac-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px; }
.ac-body .list { gap: 6px; }
.ac-body .item { padding: 8px 12px; border-radius: var(--r-md); }
.ac-body .item .body { font-size: var(--fs-md); max-height: 4.8em; overflow: hidden; }
.ac-body .empty { padding: 30px 0; }
.ac-body .digest { margin-bottom: 8px; }
.ac-foot { display: flex; justify-content: flex-end; padding: 6px 10px; border-top: 1px solid var(--line-soft); }
.ac-foot:has(#btn-notify[hidden]) { display: none; }
@media (max-width: 720px) {
    .alert-center { top: 8px; left: 8px; right: 8px; width: auto; max-height: calc(100dvh - 16px); z-index: 55; }
    .ac-close { display: inline-block; }
}
.ac-head, .ac-filters, .ac-foot { flex: none; }
.ac-filters { padding-top: 2px; }
.ac-body .digest summary { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-body .digest[open] summary { white-space: normal; }

/* 상단 바: 시즌·오늘 n일차 */
.season-chip { display: inline-flex; align-items: center; height: 30px; padding: 0 4px 0 10px; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--panel-2); font-size: var(--fs-sm); white-space: nowrap; cursor: default; }
.sc-version { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.sc-name { color: var(--text-2); font-weight: 500; }
.sc-day { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: var(--r-pill); background: var(--accent); color: #1a1407; font-weight: 800; font-size: var(--fs-sm); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sc-day.before { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 1100px) {
    .sc-name { display: none; }
}
@media (max-width: 720px) {
    .season-chip { height: 26px; padding-left: 8px; gap: 6px; margin-left: auto; }
    .sc-day { height: 20px; padding: 0 8px; font-size: var(--fs-sm); }
    .top .right { margin-left: 0; }
}
.season-chip { position: relative; overflow: hidden; }
.sc-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255, 255, 255, 0.05); pointer-events: none; }
.sc-progress::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p); background: linear-gradient(90deg, rgba(208, 171, 95, 0.35), var(--accent)); border-radius: 0 2px 2px 0; transition: width 0.6s ease; }

/* 시즌별 팝오버 아래 요약: 숫자 칸 + 표시 칩 */
.pop-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; margin-top: 10px; }
.pop-stat { display: flex; flex-direction: column; gap: 1px; padding: 8px 8px; background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-md); min-width: 0; }
.pop-stat-label { font-size: var(--fs-xs); color: var(--muted); }
.pop-stat-value { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pop-stat-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-stat.up .pop-stat-value, .pop-stat.good .pop-stat-value { color: var(--ok); }
.pop-stat.down .pop-stat-value, .pop-stat.bad .pop-stat-value { color: var(--urgent); }
.pop-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pop-flags:empty { display: none; }
.pop-flag { font-size: var(--fs-xs); padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--text-2); }
.pop-flag.good { color: var(--ok); border-color: rgba(63, 185, 80, 0.45); background: rgba(63, 185, 80, 0.08); }
.pop-flag.bad { color: var(--notice); border-color: rgba(224, 166, 58, 0.45); background: rgba(224, 166, 58, 0.08); }
@media (max-width: 720px) {
    .pop-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pop-stat-value { font-size: var(--fs-base); }
}
.pop-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pop-stat.wide .pop-stat-value { font-size: var(--fs-base); }
@media (max-width: 720px) {
    .pop-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 품목 태그: 바로 팔기 */
.sell-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-xs); font-size: var(--fs-xs); font-weight: 700; color: var(--urgent); background: rgba(229, 83, 75, 0.1); border: 1px solid rgba(229, 83, 75, 0.45); white-space: nowrap; cursor: help; }
@media (max-width: 720px) { .sell-chip { height: 24px; } }

/* 꼭 봐야 할 글 */
.must-read { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.must-empty { grid-column: 1 / -1; padding: 8px 0; }
.must-link { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel-2); color: inherit; text-decoration: none; transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.must-link:hover { border-color: var(--accent); background: var(--panel-3); }
.must-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.must-tag { font-size: var(--fs-xs); font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); color: var(--accent); background: var(--accent-soft); }
.must-tag.cat-official { color: var(--info); background: rgba(91, 141, 239, 0.14); }
.must-tag.cat-sell_warning { color: var(--urgent); background: rgba(229, 83, 75, 0.12); }
.must-hot { font-size: var(--fs-xs); font-weight: 700; color: var(--urgent); }
.must-past { font-size: var(--fs-xs); color: var(--notice); }
.must-meta { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.must-summary { font-weight: 600; line-height: 1.45; }
.must-action { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; }
.must-action::before { content: '→ '; color: var(--accent); }
.must-title { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .must-read { grid-template-columns: minmax(0, 1fr); } }

/* 브리핑 맨 위: 보유 중인 품목 */
.holdings-top { border-color: rgba(208, 171, 95, 0.35); }
.holdings-summary { margin-left: auto; display: inline-flex; align-items: baseline; gap: 8px; font-size: var(--fs-md); color: var(--muted); font-variant-numeric: tabular-nums; }
.holdings-summary strong { font-size: var(--fs-base); }
.holdings-due { color: var(--notice); font-weight: 700; }
.holdings-empty { padding: 16px 8px !important; color: var(--muted); white-space: normal !important; }
@media (max-width: 720px) { .holdings-summary { margin-left: 0; width: 100%; } }
#holdings-panel.is-empty thead { display: none; }
#holdings-panel.is-empty .holdings-empty { border-bottom: 0; }
.cards:empty { display: none; }

/* 시즌별 팝오버: 매매 일정 [매수 n일차] ── n일 보유 ──▶ [매도 m일차] */
.pop-route { display: flex; align-items: center; gap: 0; margin: 2px 0 10px; }
.pop-step { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: var(--r-md); border: 1px solid; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pop-step small { font-size: var(--fs-xs); font-weight: 600; opacity: 0.85; }
.pop-step b { font-size: var(--fs-base); }
.pop-step.buy { color: var(--ok); border-color: rgba(63, 185, 80, 0.45); background: rgba(63, 185, 80, 0.08); }
.pop-step.sell { color: var(--accent); border-color: rgba(208, 171, 95, 0.5); background: var(--accent-soft); }
.pop-route-line { position: relative; flex: 1; min-width: 70px; height: 2px; margin: 0 4px 0 6px; background: linear-gradient(90deg, rgba(63, 185, 80, 0.6), var(--accent)); }
.pop-route-line::after { content: ''; position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left: 7px solid var(--accent); border-right: 0; }
.pop-route-hold { position: absolute; left: 50%; top: -9px; transform: translate(-50%, -50%); padding: 0 6px; font-size: var(--fs-xs); color: var(--text-2); background: var(--panel-2); white-space: nowrap; }
.pop-route { padding-top: 8px; }

/* 표 칸: 성격 칩·시즌별 결과 칩 */
.ret-main.up { color: var(--ok); }
.ret-main { font-size: var(--fs-base); }
.cell-tags { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-top: 4px; }
.cell-tag { font-size: var(--fs-xs); font-weight: 600; line-height: 16px; padding: 0 6px; border-radius: var(--r-xs); color: var(--text-2); background: var(--panel-3); white-space: nowrap; }
.cell-tag.good { color: var(--ok); background: rgba(63, 185, 80, 0.12); }
.cell-tag.bad { color: var(--notice); background: rgba(224, 166, 58, 0.12); }
.season-pill { display: inline-flex; align-items: baseline; gap: 4px; font-size: var(--fs-xs); font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); background: var(--panel-2); border: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.season-pill small { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.season-pill.up { color: var(--ok); }
.season-pill.down { color: var(--urgent); }
.grid td:has(.season-pills) { white-space: normal; }
/* 급등락 목록 */
.mini .mover { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mover-stats { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.mover-stats strong { font-size: var(--fs-md); }
.mover-num.up { color: var(--ok); }
.mover-num.down { color: var(--urgent); }
.season-pill { padding: 1px 6px; font-size: var(--fs-xs); }
@media (max-width: 1300px) { .hide-md { display: none; } }
.season-pill { padding: 0 4px; }
.season-pills { display: inline-flex; flex-wrap: wrap; gap: var(--sp-1); max-width: 168px; }
.grid td:has(.season-pills) { white-space: normal; }



/* 상승·하락 색 단계: 작은 변화는 옅게(t1), +100% 이상은 짙게+굵게+배경(t4). 기준 10%·30%·100% */
.up.t1, .pop-stat.up.t1 .pop-stat-value { color: var(--up-1); }
.up.t2, .pop-stat.up.t2 .pop-stat-value { color: var(--up-2); }
.up.t3, .pop-stat.up.t3 .pop-stat-value { color: var(--up-3); font-weight: 600; }
.up.t4, .pop-stat.up.t4 .pop-stat-value { color: var(--up-4); font-weight: 800; text-shadow: 0 0 10px rgba(61, 255, 122, 0.35); }
.down.t1, .pop-stat.down.t1 .pop-stat-value { color: var(--down-1); }
.down.t2, .pop-stat.down.t2 .pop-stat-value { color: var(--down-2); }
.down.t3, .pop-stat.down.t3 .pop-stat-value { color: var(--down-3); font-weight: 600; }
.down.t4, .pop-stat.down.t4 .pop-stat-value { color: var(--down-4); font-weight: 800; }
td.up.t4, .ret-main.up.t4 { background: rgba(61, 255, 122, 0.1); }
td.down.t4 { background: rgba(255, 59, 51, 0.1); }
.ret-main.up.t4 { padding: 0 var(--sp-1); border-radius: var(--r-xs); }
.season-pill.up.t4 { background: rgba(61, 255, 122, 0.1); border-color: rgba(61, 255, 122, 0.35); }
.season-pill.down.t4 { background: rgba(255, 59, 51, 0.1); border-color: rgba(255, 59, 51, 0.35); }

/* 움직임을 줄이도록 설정한 기기 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* =========================================================
   버튼 체계: 크기 sm(28)·md(36)·lg(44) / 성격 기본·primary·ghost·danger
   ========================================================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-1); height: var(--control-h); padding: 0 var(--sp-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); color: var(--text); font-size: var(--fs-base); font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.btn:hover { border-color: #3a4150; background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn.sm { height: var(--control-h-sm); padding: 0 var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn.lg { height: 44px; padding: 0 var(--sp-5); font-size: var(--fs-lg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1407; }
.btn.primary:hover { background: #dbb86c; border-color: #dbb86c; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.danger { color: var(--down-3); }
.btn.danger:hover { background: var(--danger-soft); border-color: rgba(229, 83, 75, 0.5); color: var(--down-3); }
.btn.danger.solid { background: var(--urgent); border-color: var(--urgent); color: #fff; }
.btn.danger.solid:hover { background: #ef6159; }
.btn.report-btn { color: var(--accent); border-color: rgba(208, 171, 95, 0.55); background: transparent; }
.btn.report-btn:hover, .btn.report-btn.has-report { background: var(--accent-soft); }
.btn.more { display: flex; margin: var(--sp-3) auto; }
/* 비활성·처리 중 */
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: inherit; border-color: inherit; }
.btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ''; position: absolute; width: 14px; height: 14px; border: 2px solid currentColor; border-color: var(--text-2) var(--text-2) var(--text-2) transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.btn.primary.is-busy::after { border-color: #1a1407 #1a1407 #1a1407 transparent; }
/* 아이콘만 있는 버튼(로그아웃 등) */
.icon-only { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--muted); }
.icon-only:hover { color: var(--text); background: var(--panel-2); border-color: var(--line); }
/* 표 안 작은 버튼 묶음 */
.holding-actions { white-space: nowrap; }
.holding-actions .btn { margin-left: var(--sp-1); }
.holding-actions .btn:first-child { margin-left: 0; }
.dialog-buttons .btn { min-width: 88px; }
.login-box .btn { width: 100%; margin-top: var(--sp-1); }
@media (max-width: 720px) {
    .btn { height: 40px; }
    .btn.sm { height: 32px; }
    .holding-actions .btn { display: flex; width: 100%; margin: var(--sp-1) 0 0; }
}

/* 결과 알림(토스트): 성공·실패. 겹친 창보다 위 */
.toasts { z-index: 80; gap: var(--sp-2); }
.toast { border-radius: var(--r-lg); box-shadow: var(--shadow-sm); animation: toast-in var(--dur) var(--ease); }
.toast-ok, .toast-error { width: auto; min-width: 240px; max-width: 360px; padding: var(--sp-2) var(--sp-4); }
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--urgent); }
.toast-ok .title::before { content: '✓ '; color: var(--ok); }
.toast-error .title::before { content: '! '; color: var(--urgent); font-weight: 800; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.link-btn.is-busy { opacity: 0.5; pointer-events: none; }

/* ---------- 불러오는 중·빈 상태 ---------- */
.skeleton, .skeleton-card, .skeleton-block { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3) 50%, var(--panel-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton { height: 14px; width: 100%; }
.skeleton-row td { padding: var(--sp-3) var(--sp-2) !important; }
.skeleton-row:nth-child(2n) .skeleton { width: 82%; }
.skeleton-row:hover { background: transparent !important; }
.skeleton-card { height: 64px; border-radius: var(--r-md); list-style: none; }
.skeleton-block { height: 48px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.is-loading { position: relative; }
.is-loading > * { opacity: 0.55; transition: opacity var(--dur) var(--ease); }
.is-loading::before { content: ''; position: absolute; z-index: 2; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: loading-bar 1s linear infinite; }
@keyframes loading-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.empty-cell { padding: var(--sp-5) var(--sp-3) !important; text-align: center !important; color: var(--muted); white-space: normal !important; }
.empty-row:hover { background: transparent !important; }
.list > .empty { list-style: none; padding: var(--sp-6) 0; }

/* =========================================================
   레이아웃·표·패널 정리
   ========================================================= */
main { max-width: 1240px; padding: var(--sp-4) var(--sp-5) 64px; }
.top { padding: var(--sp-2) var(--sp-5); gap: var(--sp-4); }
.panel { padding: var(--sp-4); margin-bottom: var(--sp-3); }
.brief-grid { gap: var(--sp-3); margin-bottom: var(--sp-3); }
.cards { gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card { padding: var(--sp-3) var(--sp-4); }
.panel-head { gap: var(--sp-2); margin-bottom: var(--sp-3); }
.panel-head .hint { font-size: var(--fs-sm); }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: calc(-1 * var(--sp-1)) 0 var(--sp-3); }
/* 표: 데이터 표·관리 표·팝오버 표 같은 규칙 */
.grid th { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.01em; color: var(--muted); background: var(--panel-2); padding: var(--sp-2); }
.grid th:first-child { border-top-left-radius: var(--r-sm); }
.grid th:last-child { border-top-right-radius: var(--r-sm); }
.grid td { padding: var(--sp-2); vertical-align: middle; }
.grid th small { display: block; font-size: 10px; font-weight: 500; margin-top: 2px; }
.grid th br { display: none; }
.grid.static tbody tr { cursor: default; }
.grid.static tbody tr:hover { background: transparent; }
.pop-table th { font-size: var(--fs-xs); font-weight: 600; }
.pop-table th, .pop-table td { padding: var(--sp-1) var(--sp-2); }
/* 빈 상태 */
.empty { padding: var(--sp-6) var(--sp-4); }
.empty .empty-title { color: var(--text-2); font-size: var(--fs-lg); font-weight: 600; margin: 0 0 var(--sp-1); }
#price-empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r-lg); margin-bottom: var(--sp-3); }
/* 그래프 범례(정적) */
.static-legend { margin-top: var(--sp-2); }
.static-legend .legend-item { cursor: default; }
@media (max-width: 720px) {
    main { padding: var(--sp-3) var(--sp-3) 64px; }
    .top { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
    .panel { padding: var(--sp-3); }
    .grid th, .grid td { padding: var(--sp-2) var(--sp-1); }
    .panel-tools { justify-content: flex-start; }
    .panel-tools .segmented { width: 100%; }
}

/* 커뮤니티 글 목록: 제목 위, 발췌 2줄, 출처·시간 아래 */
#post-list { gap: var(--sp-2); }
.item.post { padding: var(--sp-3) var(--sp-4); border-left-width: 1px; border-color: var(--line-soft); transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.item.post:hover { border-color: var(--line); background: var(--panel-2); }
.item.post .title { font-size: var(--fs-base); margin: 0; line-height: 1.45; }
.item.post .title a { color: var(--text); }
.item.post .title a:hover { color: var(--accent); text-decoration: none; }
.item.post .body { font-size: var(--fs-md); color: var(--muted); margin-top: var(--sp-1); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item.post .meta { margin-top: var(--sp-2); gap: var(--sp-2); font-size: var(--fs-xs); align-items: center; }
.site-badge { font-weight: 700; padding: 1px var(--sp-2); border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); }
.site-badge.site-reddit { background: rgba(255, 112, 67, 0.14); color: #ff8a65; }
.site-badge.site-official, .site-badge.site-poe_forum { background: var(--info-soft); color: var(--info); }
.site-badge.site-youtube { background: var(--danger-soft); color: #ff6b63; }
/* 커뮤니티 도구줄 검색칸: 검색 상자와 같은 모양 */
#tab-posts .toolbar { gap: var(--sp-2); }
#post-search { height: var(--control-h); min-width: 240px; padding: 0 var(--sp-3) 0 34px; border-radius: var(--r-lg); background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 16 16'%3E%3Cg fill='none' stroke='%238a92a2' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5L14 14'/%3E%3C/g%3E%3C/svg%3E") no-repeat 12px center; border: 1px solid var(--line); }
#post-search:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.chips button { height: 30px; padding: 0 var(--sp-3); border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); background: var(--panel-2); border-color: var(--line-soft); }
.chips button:hover { color: var(--text); border-color: var(--line); }
.chips button.active { color: #1a1407; background: var(--accent); border-color: var(--accent); }
@media (max-width: 720px) {
    .grid th small { display: none; }
    #post-search { min-width: 0; width: 100%; font-size: var(--fs-input); }
    .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
    .chips::-webkit-scrollbar { display: none; }
    .chips button { flex: none; }
}

/* 키보드 초점: 행·목록 항목도 보이게 */
.grid tbody tr:focus-visible, .item:focus-visible, .holding-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.btn:focus-visible, .icon-btn:focus-visible, .icon-only:focus-visible, .segmented button:focus-visible, .chips button:focus-visible, .legend-item:focus-visible, .must-link:focus-visible { outline: none; box-shadow: var(--ring); }
a:focus-visible { border-radius: var(--r-xs); }


/* =========================================================
   터치 크기: 폰에서 작은 버튼·칩은 눌리는 영역만 44px 가까이 넓힌다(모양은 그대로)
   ========================================================= */
@media (max-width: 720px) {
    .icon-btn, .patch-chip, .copy-name, .combo-chip, .legend-item, .chart-ranges button, .ac-filters button, .report-chip, .link-btn { position: relative; }
    .icon-btn::after, .patch-chip::after, .combo-chip::after, .legend-item::after, .chart-ranges button::after, .ac-filters button::after, .report-chip::after, .link-btn::after { content: ''; position: absolute; inset: -8px -3px; }
    .copy-name::after { content: ''; position: absolute; inset: -6px -2px; }
    .chips button, .ac-filters button { height: 34px; }
    .combo-chip { height: 34px; }
    .legend-item { padding: var(--sp-1) var(--sp-3); }
    .segmented button { min-height: 36px; }
    .sel-option { min-height: 44px; align-items: center; }
    .item.post, .must-link { min-height: 44px; }
}
@media (max-width: 720px) {
    /* 탭이 더 있다는 단서: 오른쪽 끝을 흐리게 */
    .tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: var(--sp-5); }
}

/* =========================================================
   화면 마무리: 내 정보·로그인·상단 사용자·그래프 팝업
   ========================================================= */
/* 정보 목록(내 정보) */
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-5); margin: 0; }
.info-list dt { color: var(--muted); font-size: var(--fs-sm); }
.info-list dd { margin: 0; font-weight: 600; }
/* 세로로 쌓는 폼(내 정보): 라벨 위·입력 아래, 버튼은 아래 줄 */
.stack-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); max-width: 640px; margin-top: var(--sp-1); }
.stack-form .form-actions { grid-column: 1 / -1; display: flex; gap: var(--sp-2); }
.stack-form .field-control input { background: var(--bg); width: 100%; height: var(--control-h); padding: 0 var(--sp-3); }
#poe-status:empty { display: none; }
@media (max-width: 720px) {
    .stack-form { grid-template-columns: minmax(0, 1fr); }
    .stack-form .form-actions .btn { flex: 1; }
}
/* 로그인·회원가입 */
.login-box { width: 340px; max-width: calc(100vw - 32px); gap: var(--sp-3); padding: var(--sp-6) var(--sp-5); border-radius: var(--r-xl); border-color: var(--line-soft); box-shadow: var(--shadow); }
.login-head { margin-bottom: var(--sp-2); }
.login-head .brand { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
.login-head .hint { margin: var(--sp-1) 0 0; font-size: var(--fs-md); }
.login-box input { height: 44px; padding: 0 var(--sp-3); font-size: var(--fs-input); background: var(--bg); border-radius: var(--r-md); }
.login-box input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.login-error { padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--danger-soft); color: var(--urgent-text); font-size: var(--fs-md); }
.login-box a { font-size: var(--fs-md); }
/* 상단 바 사용자 표시 */
#me-name { font-size: var(--fs-sm); color: var(--text-2); padding: 0 var(--sp-1); }
.conn { font-size: 10px; }
/* 그래프 팝업 도구줄 */
.chart-controls { gap: var(--sp-2) var(--sp-3); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line-soft); }
.chart-tools .sel-trigger { min-width: 120px; }
.chart-help { text-align: center; }
.report-box { border-color: var(--line); border-radius: var(--r-xl); padding: var(--sp-4) var(--sp-5); }
.report-head { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--line-soft); margin-bottom: var(--sp-3); }
@media (max-width: 720px) {
    .report-box { padding: var(--sp-3); border-radius: var(--r-lg); }
}
.chart-stats th, .chart-stats td { white-space: nowrap !important; }

/* ---------- 빌드 품목 ---------- */
.build-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.build-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.build-notes li { position: relative; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-md); line-height: 1.55; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.build-grid td { vertical-align: middle; }
.build-grid .group-row td { padding: var(--sp-3) var(--sp-2) var(--sp-1); font-size: var(--fs-sm); font-weight: 700; color: var(--accent); background: transparent; border-bottom: 1px solid var(--line); letter-spacing: 0.02em; }
.build-grid tr.clickable { cursor: pointer; }
.build-grid td .sub { margin-top: 2px; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.build-grid td .muted { color: var(--muted); }
.build-grid td.near-buy { color: var(--ok); font-weight: 700; }
.build-note { margin: var(--sp-1) 0 0 36px; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.45; }
.role-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-xs); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; border: 1px solid var(--line); color: var(--text-3); }
.role-chip.role-core { color: var(--accent); border-color: rgba(208, 171, 95, 0.5); background: var(--accent-soft); }
.role-chip.role-upgrade { color: var(--info); border-color: rgba(91, 141, 239, 0.45); background: var(--info-soft); }
.spark { display: block; width: 132px; height: 34px; overflow: visible; }
.spark-line { fill: none; stroke: var(--text-3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-today { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 2; }
.spark-dot { fill: var(--text-3); stroke: var(--panel); stroke-width: 1.5; }
.spark-dot.advice-wait { fill: var(--ok); }
.spark-dot.advice-mixed { fill: var(--notice); }
.spark-dot.advice-now { fill: var(--accent); }
.advice-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 140px; }
.advice-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; border: 1px solid var(--line); color: var(--text-2); }
.advice-chip.advice-now { color: var(--accent); border-color: rgba(208, 171, 95, 0.55); background: var(--accent-soft); }
.advice-chip.advice-wait { color: var(--ok); border-color: rgba(63, 185, 80, 0.5); background: var(--ok-soft); }
.advice-chip.advice-mixed { color: var(--notice); border-color: rgba(224, 166, 58, 0.5); background: var(--warn-soft); }
.advice-when { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.advice-sub { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.build-videos { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1); }
.build-videos li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line-soft); font-size: var(--fs-md); }
.build-videos a { color: var(--text); text-decoration: none; }
.build-videos a:hover { color: var(--accent); text-decoration: underline; }
.video-new { flex: none; font-size: var(--fs-xs); font-weight: 700; color: var(--ok); }
@media (max-width: 720px) {
    .build-note { margin-left: 0; }
    .advice-cell { min-width: 0; }
    .build-grid td .sub { white-space: normal; }
}

/* ---------- 관심 품목 ---------- */
.watch-bar { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.watch-lists { display: flex; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.watch-lists::-webkit-scrollbar { display: none; }
.watch-list { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 var(--sp-3); border-radius: var(--r-pill); border: 1px solid var(--line-soft); background: var(--panel); color: var(--text-2); font-size: var(--fs-md); font-weight: 600; white-space: nowrap; cursor: pointer; }
.watch-list small { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.watch-list:hover { color: var(--text); border-color: var(--line); }
.watch-list.active { color: #1a1407; background: var(--accent); border-color: var(--accent); }
.watch-list.active small { color: rgba(26, 20, 7, 0.7); }
.watch-bar > .btn { flex: none; }
.watch-empty { text-align: center; padding: var(--sp-6) var(--sp-4); }
.watch-empty h3 { margin: 0 0 var(--sp-2); }
.watch-empty .hint { margin: 0 auto var(--sp-4); max-width: 460px; }
.panel-actions { display: inline-flex; gap: var(--sp-1); margin-left: auto; }
.watch-add { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); align-items: stretch; }
.watch-add .combo { flex: 1; min-width: 0; }
.watch-add .btn { flex: none; }
.build-links:empty, .build-notes:empty { display: none; }
.role-chip { cursor: pointer; background: transparent; }
.role-chip:hover { filter: brightness(1.2); }
.watch-remove { color: var(--muted); }
.watch-remove:hover { color: var(--urgent); }
.ai-box { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.ai-box .report-head { display: flex; align-items: center; justify-content: space-between; }
.ai-body { overflow-y: auto; min-height: 0; }
.ai-form textarea { width: 100%; min-height: 160px; resize: vertical; padding: var(--sp-3); font: inherit; font-size: var(--fs-input); line-height: 1.5; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); box-sizing: border-box; }
.ai-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.ai-form-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: var(--sp-2) 0; flex-wrap: wrap; }
.ai-help { margin: 0; padding-left: 18px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }
.ai-running { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-base); }
.ai-sources { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: 2px; font-size: var(--fs-sm); }
.ai-sources li { display: flex; gap: var(--sp-2); align-items: baseline; min-width: 0; }
.ai-sources .ok .ai-source-mark { color: var(--ok); }
.ai-sources .fail .ai-source-mark { color: var(--urgent); }
.ai-source-label { flex: none; color: var(--text-2); }
.ai-source-url { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ai-check { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); cursor: pointer; }
.ai-check:hover { background: var(--panel-2); }
.ai-check input[type=checkbox] { flex: none; width: 18px; height: 18px; margin-top: 4px; accent-color: var(--accent); }
.ai-notes { background: var(--panel-2); border: 1px solid var(--line-soft); margin-bottom: var(--sp-3); }
.ai-notes ul { margin: var(--sp-1) 0 0; padding-left: 18px; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.55; }
.ai-slot { margin: var(--sp-3) 0 var(--sp-1); padding: 0 var(--sp-3); font-size: var(--fs-sm); font-weight: 700; color: var(--accent); }
.ai-item-info { min-width: 0; flex: 1; }
.ai-item-meta { display: flex; align-items: center; gap: var(--sp-2); margin-top: 2px; padding-left: 36px; }
.ai-item-meta .build-note { margin: 0; }
.ai-item.unmatched .item-cell { opacity: 0.65; }
@media (max-width: 720px) {
    .watch-add { flex-direction: column; }
    .ai-item-meta { padding-left: 0; flex-wrap: wrap; }
    .panel-actions .btn { padding: 0 var(--sp-2); }
}
.ai-message { margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md); background: var(--info-soft); color: var(--text-2); font-size: var(--fs-md); line-height: 1.55; }
#watch-ai { display: inline-flex; align-items: center; justify-content: center; gap: 6px; position: relative; overflow: hidden; }
#watch-ai.btn-ai-running { color: var(--text); background: var(--panel-3); border-color: var(--accent); }
#watch-ai.btn-ai-running::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(208, 171, 95, 0.28) 50%, transparent 80%); transform: translateX(-100%); animation: ai-sweep 1.6s var(--ease) infinite; pointer-events: none; }
#watch-ai.btn-ai-running .spinner { margin-right: 0; border-top-color: var(--accent); }
#watch-ai.btn-ai-done { color: #0b1a0f; background: var(--ok); border-color: var(--ok); animation: ai-pop 1.8s ease-out 2; }
#watch-ai.btn-ai-failed { color: var(--urgent); background: var(--danger-soft); border-color: rgba(229, 83, 75, 0.5); }
@keyframes ai-sweep { to { transform: translateX(100%); } }
@keyframes ai-pop { 0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.55); } 100% { box-shadow: 0 0 0 10px rgba(63, 185, 80, 0); } }
@media (prefers-reduced-motion: reduce) { #watch-ai.btn-ai-running::after, #watch-ai.btn-ai-done { animation: none; } }

.note-item { display: flex; align-items: flex-start; gap: var(--sp-2); }
.note-text { flex: 1; min-width: 0; white-space: pre-wrap; }
.note-tools { display: inline-flex; align-items: center; gap: 2px; flex: none; margin-top: -2px; }
.note-tools .icon-btn { color: var(--muted); }
.note-tools .icon-btn:hover { color: var(--text); }
.note-link { font-size: var(--fs-xs); font-weight: 700; color: var(--info); text-decoration: none; margin-right: var(--sp-1); white-space: nowrap; }
.note-link:hover { text-decoration: underline; }
.note-src { color: var(--info); font-size: var(--fs-xs); }
.note-add { margin-top: var(--sp-2); }
.dialog-field textarea { width: 100%; box-sizing: border-box; padding: var(--sp-2) var(--sp-3); font: inherit; font-size: var(--fs-input); line-height: 1.5; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); resize: vertical; }
.dialog-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.cheap-box { margin-top: var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel-2); }
.cheap-box summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); cursor: pointer; font-weight: 700; list-style: none; }
.cheap-box summary::-webkit-details-marker { display: none; }
.cheap-box summary::before { content: '▸'; color: var(--muted); transition: transform var(--dur) var(--ease); }
.cheap-box[open] summary::before { transform: rotate(90deg); }
.cheap-box summary small { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.cheap-list { list-style: none; margin: 0; padding: 0 var(--sp-2) var(--sp-2); display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2px var(--sp-3); }
.cheap-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2); border-radius: var(--r-md); }
.cheap-row.clickable { cursor: pointer; }
.cheap-row:hover { background: var(--panel-3); }
.cheap-row .item-cell { min-width: 0; }
.cheap-price { display: flex; flex-direction: column; align-items: flex-end; flex: none; font-variant-numeric: tabular-nums; }
.cheap-price small { font-size: var(--fs-xs); color: var(--muted); }
.cheap-price .muted { color: var(--muted); }
@media (max-width: 720px) { .cheap-list { grid-template-columns: 1fr; } }
.link-chip { display: inline-flex; align-items: center; gap: 2px; height: 30px; padding: 0 4px 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--panel-2); max-width: 100%; }
.link-chip:not(:has(.icon-btn)) { padding-right: var(--sp-3); }
.link-chip-a { color: var(--text); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.link-chip-a:hover { color: var(--accent); }
.link-chip .icon-btn { color: var(--muted); }
.link-chip .icon-btn:hover { color: var(--urgent); }
.build-links { align-items: center; }
.tr-tag { display: inline-flex; align-items: center; height: 18px; margin-left: 6px; padding: 0 6px; border-radius: var(--r-xs); font-size: var(--fs-xs); font-weight: 700; color: var(--info); background: var(--info-soft); border: 1px solid rgba(91, 141, 239, 0.4); vertical-align: 2px; }
.build-summary { margin: var(--sp-3) 0; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-soft); border-radius: var(--r-lg); background: var(--panel-2); display: grid; gap: var(--sp-3); }
.bs-head { display: flex; align-items: center; gap: var(--sp-2); }
.bs-head h4 { margin: 0; font-size: var(--fs-lg); color: var(--accent); display: inline-flex; align-items: center; }
.bs-time { color: var(--muted); font-size: var(--fs-xs); margin-right: auto; }
.bs-class { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: baseline; font-size: var(--fs-md); }
.bs-class strong { color: var(--text); }
.bs-class span { color: var(--text-2); }
.bs-overview { margin: 0; color: var(--text-2); font-size: var(--fs-md); line-height: 1.6; }
.bs-row { display: grid; grid-template-columns: 88px 1fr; gap: var(--sp-3); align-items: start; }
.bs-label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); padding-top: 4px; }
.bs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bs-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-2); background: var(--panel-3); border: 1px solid var(--line-soft); line-height: 1.4; }
.bs-chip.key { color: var(--accent); border-color: rgba(208, 171, 95, 0.45); background: var(--accent-soft); font-weight: 600; }
.bs-asc { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: asc; }
.bs-asc li { counter-increment: asc; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; border-radius: var(--r-pill); background: var(--panel-3); border: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.bs-asc li::before { content: counter(asc); display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #1a1407; font-size: var(--fs-xs); font-weight: 700; }
.bs-gems { display: grid; gap: 6px; }
.bs-gem-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.bs-gem-label { font-size: var(--fs-xs); font-weight: 700; color: var(--text); min-width: 76px; }
.bs-gem-chain { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bs-gem { padding: 1px 7px; border-radius: var(--r-xs); background: var(--panel-3); font-size: var(--fs-sm); color: var(--text-2); }
.bs-link { color: var(--muted); font-size: var(--fs-xs); }
.bs-stages { display: grid; gap: 4px; }
.bs-stage { border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.bs-stage summary { padding: 6px var(--sp-3); cursor: pointer; font-size: var(--fs-sm); font-weight: 700; }
.bs-stage p { margin: 0; padding: 0 var(--sp-3) var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); line-height: 1.6; white-space: pre-wrap; }
.ai-build-overview { margin: 4px 0 0; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }
@media (max-width: 720px) {
    .bs-row { grid-template-columns: 1fr; gap: 4px; }
    .bs-label { padding-top: 0; }
    .bs-gem-label { width: 100%; }
}
.watch-tally { margin-left: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.note-more { list-style: none; padding: 0 var(--sp-1); }
.note-more .link-btn { font-size: var(--fs-sm); color: var(--info); }
.bs-more { display: grid; gap: var(--sp-3); }
.bs-more > summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--info); list-style: none; }
.bs-more > summary::-webkit-details-marker { display: none; }
.bs-more > summary::before { content: '▸ '; }
.bs-more[open] > summary::before { content: '▾ '; }
.bs-more[open] { gap: var(--sp-3); }
.bs-more[open] > summary { margin-bottom: var(--sp-1); }
.watch-videos { padding: 0; }
.watch-videos > summary { padding: var(--sp-3) var(--sp-4); cursor: pointer; font-weight: 700; list-style: none; }
.watch-videos > summary::-webkit-details-marker { display: none; }
.watch-videos > summary::before { content: '▸ '; color: var(--muted); }
.watch-videos[open] > summary::before { content: '▾ '; }
.watch-videos .build-videos { padding: 0 var(--sp-3) var(--sp-3); }
.watch-tools .segmented { margin: 0; padding: 2px; }
.watch-tools .segmented button { height: 28px; padding: 0 10px; font-size: var(--fs-sm); }
@media (max-width: 720px) {
    .watch-tally { display: block; width: 100%; margin: 2px 0 0; }
    .watch-tools { gap: 6px; }
    .panel-tools.watch-tools .segmented { width: auto; flex: none; }
    .watch-tools .segmented button { flex: none; height: 30px; padding: 0 9px; }
}
.ai-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.ai-model-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(208, 171, 95, 0.45); }
.ai-running { color: var(--text); }
.ai-running .spinner { width: 14px; height: 14px; }
/* 전직 순서: 글이 두 줄이 돼도 번호 동그라미가 줄지 않게(위쪽 정렬, 모서리는 둥근 사각) */
.bs-asc li { align-items: flex-start; border-radius: var(--r-lg); padding: 4px 12px 4px 5px; line-height: 1.5; }
.bs-asc li::before { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.order-row { display: flex; align-items: center; gap: var(--sp-2); padding: 6px var(--sp-2) 6px var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel-2); }
.order-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row small { color: var(--muted); font-size: var(--fs-xs); }
.order-move { width: 36px; padding: 0; font-size: var(--fs-lg); }
.order-move:disabled { opacity: 0.3; }
/* 기본 탭(모든 회원에게 보임) */
.pin-mark { display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: var(--r-xs); font-size: 10px; font-weight: 800; letter-spacing: 0.02em; color: var(--info); background: var(--info-soft); border: 1px solid rgba(91, 141, 239, 0.45); }
.watch-list.active .pin-mark { color: #1a1407; background: rgba(26, 20, 7, 0.12); border-color: rgba(26, 20, 7, 0.3); }
.readonly-note { font-size: var(--fs-xs); font-weight: 700; color: var(--info); }
.watch-readonly .note-tools, .watch-readonly .link-chip .icon-btn, .watch-readonly #build-links > .btn, .watch-readonly .watch-remove,
.watch-readonly .watch-add, .watch-readonly #watch-note-add, .watch-readonly #watch-rename, .watch-readonly #watch-delete, .watch-readonly .bs-head .btn { display: none !important; }
.watch-readonly .role-chip { cursor: default; pointer-events: none; }
.watch-readonly .link-chip { padding-right: var(--sp-3); }
/* 시즌별 결과 팝오버: 폰에서 팝오버 전체가 옆으로 밀리지 않게 */
.popover { overflow-x: hidden; }
.pop-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 0 -2px; }
.pop-league small { display: block; font-size: 10px; color: var(--muted); line-height: 1.2; }
.pop-table td.pop-league { white-space: nowrap; }
.pop-low { display: block; font-size: 10px; font-weight: 600; color: var(--notice); line-height: 1.2; }
@media (max-width: 720px) {
    .pop-table th, .pop-table td { padding: 4px 3px; }
    .pop-table th { word-break: keep-all; }
    .pop-stat-sub { white-space: normal; }
}
.link-more { height: 30px; padding: 0 var(--sp-3); border: 1px dashed var(--line); border-radius: var(--r-pill); background: transparent; color: var(--info); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.link-more:hover { border-color: var(--info); }
/* 커뮤니티: AI 판정 */
.post-views { margin: 0 0 4px; }
.post-view-hint { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); }
.post-hot, .post-worth { display: inline-flex; align-items: center; height: 18px; margin-right: 6px; padding: 0 6px; border-radius: var(--r-xs); font-size: var(--fs-xs); font-weight: 700; vertical-align: 2px; }
.post-hot { color: var(--urgent); background: var(--danger-soft); border: 1px solid rgba(229, 83, 75, 0.45); }
.post-worth { color: var(--ok); background: var(--ok-soft); border: 1px solid rgba(63, 185, 80, 0.4); }
.post .tr-tag { margin: 0 6px 0 0; }
.post-original { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-summary { color: var(--text-2); }
.post-action { font-size: var(--fs-sm); color: var(--accent); margin-top: 2px; }
.post.post-dim { opacity: 0.5; }
/* 긴 파일 경로·띄어쓰기 없는 문장이 폰 화면 밖으로 나가지 않게(어디서든 줄바꿈) */
.doc, .doc li, .doc p { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.doc code { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
.doc pre { max-width: 100%; overflow-x: auto; }
.doc table { display: block; max-width: 100%; overflow-x: auto; }
/* 모든 화면 공통 안전망: 본문 글이 길어도 칸을 밀지 않게 */
.panel, .item, .note-text, .bs-overview, .bs-stage p, .build-note, .advice-sub { overflow-wrap: anywhere; }

/* 관리: 회원 AI 한도·자동 정지 */
.admin-credits { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; height: auto; padding: 4px 8px; white-space: nowrap; }
.admin-credit { font-variant-numeric: tabular-nums; }
.admin-ban-reason { font-size: 11px; margin-top: 2px; white-space: normal; text-align: right; }
.admin-block-ips { font-size: 12px; overflow-wrap: anywhere; }
.admin-username { font-size: 11px; overflow-wrap: anywhere; }

/* 자료 없는 시즌(최신순 제자리에) */
.season-pill.missing { opacity: 0.45; }
.legend-missing { cursor: default; }
.legend-item .sw.sw-dash { height: 0; border-top: 2px dashed; border-radius: 0; vertical-align: 3px; }
.legend-missing .sw { background: var(--line, #444); }

/* 품목 AI 리포트: 버튼 + 오른쪽 모델·남은 횟수만 */
.report-quota { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); white-space: nowrap; }
.report-quota .report-model { color: var(--muted); }
.report-quota b { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; }
.report-quota.empty b { color: var(--down, #e5484d); border-color: currentColor; }
.report-status { margin: -4px 0 12px; display: flex; align-items: center; gap: 6px; }
.report-empty { margin: 8px 0 4px; }
@media (max-width: 720px) {
    /* 폰: 리포트 버튼은 아이콘만(버튼 줄이 넓어져 옆 칸이 줄바꿈되지 않게) */
    .icon-btn.report-chip span:not(.spinner) { display: none; }
    .icon-btn.report-chip { padding: 0 4px; }
}

/* 리포트 본문: 섹션마다 짧은 항목 목록(문단 대신) */
.report-section { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.report-section h4 { margin: 0 0 6px; font-size: var(--fs-sm); letter-spacing: 0.01em; }
.report-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.report-points li { position: relative; padding-left: 14px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere; }
.report-points li::before { content: ''; position: absolute; left: 2px; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.report-risks .report-points li::before { background: var(--down, #e5484d); }
.report-watch .report-points li::before { background: var(--accent); }
@media (max-width: 720px) {
    .report-headline { font-size: var(--fs-lg); line-height: 1.5; }
}
/* 가격·수익률 숫자는 중간에서 줄바꿈하지 않는다(폰에서 '1.8 / 1d'처럼 끊기던 것) */
.ret-main, .ret-cell .ret-main { white-space: nowrap; }

/* 리포트 버튼 줄: 날짜 선택은 남는 폭을 채우고, 버튼과 같은 높이·모서리 */
.report-bar { flex-wrap: nowrap; }
.report-bar .sel-trigger { flex: 1 1 auto; min-width: 0; height: var(--control-h); border-radius: var(--r-md); font-size: var(--fs-sm); }
.report-bar .sel-trigger .sel-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-bar > .btn { flex: none; }
/* 리포트 만드는 중: 목록 버튼에 돌림표 */
.icon-btn.report-chip.is-running { background: var(--accent-soft); }
.icon-btn.report-chip .spinner, .report-btn .spinner { width: 9px; height: 9px; margin-right: 2px; border-width: 1.5px; }

/* 관리: 가입 코드 */
.invite-form { align-items: flex-end; }
.invite-form .field:first-child { flex: 0 0 120px; }
.invite-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
.invite-actions { white-space: nowrap; }
.invite-actions .btn + .btn { margin-left: 4px; }
.invite-done td { color: var(--muted); }
.invite-done .invite-code { color: var(--muted); text-decoration: line-through; }
.invite-users { font-size: var(--fs-sm); }

/* 내 정보: 비밀번호 변경 */
.password-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.password-form input[type="password"] { height: var(--control-h); padding: 0 12px; background: var(--bg, #0e1014); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); font-size: var(--fs-base); }
.password-form input[type="password"]:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.password-form .btn { align-self: flex-start; }

/* 관리: 테스트 계정 */
.admin-test-badge { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--accent); border: 1px solid rgba(208, 171, 95, 0.6); vertical-align: 1px; }
td.num > .btn + .btn { margin-left: 4px; }
@media (max-width: 720px) {
    /* 관리 회원 줄: 상태 칸 버튼을 세로로(좁은 폭에서 밖으로 밀리지 않게) */
    .admin-state > .btn { display: flex; margin: 0 0 0 auto; }
    .admin-state > .btn + .btn { margin-top: 4px; }
}

/* 물가 패널: 인플레이션율 설명(용어 · 설명 두 줄 카드) */
.infl-explain { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 4px; }
.infl-explain > div { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 10px 12px; }
.infl-explain dt { font-weight: 700; font-size: var(--fs-sm, 13px); color: var(--accent); margin-bottom: 4px; }
.infl-explain dd { margin: 0; font-size: var(--fs-sm, 13px); color: var(--text-2, inherit); line-height: 1.55; }
.rec-infl { font-size: var(--fs-sm, 13px); color: var(--muted); }
@media (max-width: 720px) {
    .infl-explain { grid-template-columns: minmax(0, 1fr); }
}
.pop-sub { display: block; font-size: 10px; font-weight: 500; color: var(--muted); line-height: 1.2; }

/* 역병용 베이스 필터 */
.check-col { width: 36px; text-align: center; }
.check-col input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.filter-code { margin: var(--sp-2) 0 0; padding: var(--sp-2) var(--sp-3); max-height: 104px; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-sm); line-height: 1.5; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.filter-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.filter-actions .segmented { margin: 0; }
/* 필터 규칙은 목록을 내려도 상단 바 바로 아래에 붙어 있게(상단 바 높이는 JS가 --top-h로 넣음) */
.base-sticky { position: sticky; top: var(--top-h, 56px); z-index: 5; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
@media (max-width: 720px) {
    .base-sticky .filter-code { max-height: 56px; }
    .base-sticky .panel-head { margin-bottom: var(--sp-1); }
}

/* 시즌 가이드 탭: 목차 칩은 상단 바 아래에 붙어 있음 */
.guide-toc { position: sticky; top: var(--top-h, 56px); z-index: 5; display: flex; gap: var(--sp-1); flex-wrap: wrap; padding: var(--sp-2) 0; margin-bottom: var(--sp-2); background: var(--bg); }
.guide-toc:empty { display: none; }
.guide-chip { border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); border-radius: 999px; padding: 4px 12px; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.guide-chip:hover { color: var(--text); border-color: var(--accent); }
.guide-doc { max-width: 920px; }
.guide-doc h2 { scroll-margin-top: 120px; border-top: 1px solid var(--line-soft); padding-top: var(--sp-3); }
.guide-doc h2:first-of-type { border-top: 0; }
.guide-doc a { color: var(--accent); }
@media (max-width: 720px) {
    .guide-toc { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .guide-toc::-webkit-scrollbar { display: none; }
    .guide-chip { white-space: nowrap; }
}
