@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.css");

:root {
  /* shadcn/ui의 neutral 토큰 체계를 현재 대시보드 의미 변수에 연결한다. */
  --background: #fafafa; --foreground: #18181b;
  --card: #ffffff; --card-foreground: #18181b;
  --primary: #18181b; --primary-foreground: #fafafa;
  --secondary: #f4f4f5; --secondary-foreground: #18181b;
  --muted-bg: #f4f4f5; --muted-foreground: #71717a;
  --border: #e4e4e7; --input: #e4e4e7; --ring: #a1a1aa;
  --radius: 0.625rem;
  --bg: var(--background); --line: var(--border);
  --text: var(--foreground); --muted: var(--muted-foreground);
  --accent: var(--primary);
  --up: #dc2626; --down: #2563eb; --ok: #15803d;
  --warn: #b45309; --bad: #dc2626;
}
* { box-sizing: border-box; }
/* ⚠️ hidden 속성이 클래스 display 에 지지 않게(2026-08-10): `.badge{display:inline-block}`
   가 UA 의 `[hidden]{display:none}` 을 이겨서, 통화 메모 0건일 때도 숨김 처리한
   '💬 0' 배지가 그대로 보였다. 같은 함정이 다른 클래스에도 있어 전역으로 못박는다. */
[hidden] { display: none !important; }
body { margin: 0; font-family: "Pretendard Variable", Pretendard, -apple-system,
       BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
       background: var(--bg); color: var(--text); font-size: 14px; overflow-x: hidden;
       line-height: 1.5; letter-spacing: -0.012em; text-rendering: optimizeLegibility;
       -webkit-font-smoothing: antialiased; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- 헤더 ---------- */
header { display: flex; align-items: center; gap: 20px; padding: 10px 20px;
         background: #fff; border-bottom: 1px solid var(--line);
         position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 16px; }
nav { display: flex; gap: 4px; }
nav button { border: 0; background: none; padding: 8px 14px; cursor: pointer;
             font-size: 14px; color: var(--muted); border-radius: 8px; }
nav button.on { background: var(--accent); color: #fff; font-weight: 600; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
button.ghost { border: 1px solid var(--line); background: #fff; border-radius: 8px;
               padding: 6px 12px; cursor: pointer; color: var(--muted); }

main { max-width: 1200px; margin: 0 auto; padding: 16px 20px 60px; }

/* ---------- 탭/카드 ---------- */
.tabs { display: flex; gap: 6px; margin: 4px 0 14px; }
.tabs button { border: 1px solid var(--line); background: #fff; padding: 8px 18px;
               border-radius: 20px; cursor: pointer; font-size: 14px; font-weight: 600; }
.tabs button.on { background: var(--text); color: #fff; border-color: var(--text); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
        padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 14px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
            gap: 10px; margin-bottom: 14px; }
/* 넓은 박스 3열(→ 6개면 3+3). 좁은 화면에선 2열·1열로 자동 축소. */
.stat-row.wide { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
        padding: 12px 14px; }
.stat-row.wide .stat { padding: 14px 16px; min-height: 92px;
                       display: flex; flex-direction: column; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 2px; }
.stat-row.wide .stat .v { font-size: 24px; line-height: 1.25; }
.stat .v.sm { font-size: 18px; }
.stat-row.wide .stat .v.sm { font-size: 20px; }
.stat .s { font-size: 11px; color: var(--muted); }
/* 캡션(증권사 명단 등)은 2줄까지만 — 넘치면 말줄임, 전체는 title 툴팁 */
.stat-row.wide .stat .s { font-size: 12px; margin-top: auto; padding-top: 6px;
                          display: -webkit-box; -webkit-line-clamp: 2;
                          -webkit-box-orient: vertical; overflow: hidden; }
/* 값이 긴 카드(최고/최저·투자의견)는 2칸 차지 + 한 줄 유지 */
.stat.span2 { grid-column: span 2; }
.stat.span2 .v { white-space: nowrap; }
.stat .v .opseg { white-space: nowrap; margin-right: 12px; }
.stat .v .opseg:last-child { margin-right: 0; }
.stat .v .opseg i { font-style: normal; font-size: 12px; font-weight: 600;
                    color: var(--muted); margin-right: 3px; }
.stat .v small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat .v .arw { color: var(--muted); font-weight: 400; margin: 0 6px; }
.stat .v .pct { font-size: 14px; margin-left: 6px; }

/* ---------- 테이블 ---------- */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line);
         text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.tbl-wrap table > tbody > tr:first-child th,
.tbl-wrap table > tr:first-child th { position: sticky; top: 0; background: var(--card);
                                      z-index: 2; }
tr.stale td { color: #aab2c0; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sortable.on { color: var(--accent); }
th .sort-ind { font-size: 10px; margin-left: 3px; opacity: .45; }
th.sortable.on .sort-ind { opacity: 1; }
td.num, th.num { text-align: right; }
.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }

/* 목표주가 종합: 이번 분기 미발간 블록(구 발간 X) — 회색 글자로 흡수 */
td.dim { color: #aab2c0; }
td.dim .up, td.dim .down, td.dim .muted { color: inherit; font-weight: 400; }
/* 투자의견 등급 색(배지 대신 글자색 — 폭 절감 + 한눈에 스캔). 배지 팔레트와 동일 */
.op-tp { color: var(--warn); font-weight: 600; }
.op-buy { color: var(--up); font-weight: 600; }
.op-sell { color: var(--down); font-weight: 600; }
.op-hold { color: #5b6575; }
td.dim .op-tp, td.dim .op-buy, td.dim .op-sell, td.dim .op-hold {
  color: inherit; font-weight: 400; }

/* ---------- 애널리스트 프로필 ----------
   개인정보(연락처·인물평)를 담는 화면. 카드 그리드 + 좌측 사진. */
.an-grid { display: grid; gap: 12px;
           grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.an-card { margin-bottom: 0; position: relative; }
.an-card.an-past { opacity: .72; }
.an-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.an-profile-edit { position: absolute; top: 10px; right: 10px; padding: 3px 7px;
                   font-size: 11px; cursor: pointer; }
.an-photo { width: 108px; height: 140px; object-fit: cover; border-radius: 8px;
            border: 1px solid var(--line); flex: none; }
.an-photo-btn { display: block; flex: none; padding: 0; border: 0; background: none;
                border-radius: 8px; cursor: zoom-in; line-height: 0; }
.an-photo-btn:hover .an-photo, .an-photo-btn:focus-visible .an-photo {
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37, 99, 235, .18); }
.an-nophoto { display: flex; align-items: center; justify-content: center;
              background: #f1f4f8; color: var(--muted); font-size: 38px; }
.an-id { min-width: 0; flex: 1; }
.an-firm { font-size: 12px; color: var(--muted); display: flex; gap: 5px;
           align-items: center; flex-wrap: wrap; padding-right: 76px; }
.an-name { font-size: 17px; font-weight: 700; margin: 3px 0 5px; }
.an-name-en { margin-left: 6px; color: var(--muted); font-size: 12px;
              font-weight: 500; white-space: nowrap; }
/* 목표주가는 종목당 한 줄 — 종목·의견·금액이 세로로 정렬돼야 비교가 된다 */
.an-covs { margin: 5px 0 0; font-size: 12.5px; }
.an-cov { display: grid; grid-template-columns: 42px max-content minmax(0, 1fr); gap: 6px;
          align-items: center; padding: 2px 0; }
.an-cov .badge { white-space: nowrap; }
.an-cov .c { color: var(--muted); font-weight: 600; }
.an-cov .t { text-align: right; font-weight: 700; }
.an-photo-overlay { position: fixed; inset: 0; z-index: 1000; padding: 28px;
                    display: flex; align-items: center; justify-content: center;
                    background: rgba(15, 23, 42, .78); cursor: zoom-out; }
.an-photo-modal { position: relative; max-width: min(680px, 92vw); color: #fff;
                  text-align: center; font-weight: 600; cursor: default; }
.an-photo-modal img { display: block; max-width: 100%; max-height: 82vh; margin-bottom: 8px;
                      object-fit: contain; border-radius: 10px; background: #fff; }
.an-photo-close { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px;
                  border: 0; border-radius: 50%; background: rgba(15, 23, 42, .72);
                  color: #fff; font-size: 25px; line-height: 30px; cursor: pointer; }
.an-edit-overlay { position: fixed; inset: 0; z-index: 1000; padding: 24px;
                   display: flex; align-items: center; justify-content: center;
                   background: rgba(15, 23, 42, .72); }
.an-edit-modal { width: min(680px, 94vw); max-height: 90vh; overflow: auto;
                 padding: 18px; border-radius: 12px; background: var(--card);
                 box-shadow: 0 20px 55px rgba(0, 0, 0, .28); }
.an-edit-title { display: flex; align-items: center; justify-content: space-between;
                 margin-bottom: 12px; font-size: 16px; }
.an-edit-close { border: 0; background: none; font-size: 25px; cursor: pointer;
                 color: var(--muted); }
.an-edit-photo-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.an-edit-photo-row button { cursor: pointer; }
.an-edit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.an-edit-form label { display: flex; flex-direction: column; gap: 4px;
                      font-size: 12px; font-weight: 600; }
.an-edit-form input, .an-edit-form textarea { width: 100%; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px;
  font: 13px/1.4 inherit; background: #fff; }
.an-edit-form textarea { resize: vertical; }
.an-form-sep { grid-column: 1 / -1; margin-top: 4px; padding-top: 9px;
               border-top: 1px solid var(--line); color: var(--muted);
               font-size: 12px; font-weight: 700; }
.an-edit-actions { display: flex; align-items: center; justify-content: flex-end;
                   gap: 8px; margin-top: 14px; }
.an-edit-actions .admin-msg { margin-right: auto; }
@media (max-width: 600px) {
  .an-edit-form { grid-template-columns: 1fr; }
  .an-head { padding-top: 25px; }
  .an-firm { padding-right: 0; }
}
.rv-photo-preview { display: block; width: 96px; height: 124px; object-fit: cover;
                    margin-top: 7px; border: 1px solid var(--line); border-radius: 7px; }
/* 애널리스트 본인 정보와 RA 정보 사이 구분선 */
.an-sep { margin: 10px 0 4px; padding-top: 8px; font-size: 11.5px;
          font-weight: 700; color: var(--muted);
          border-top: 1px solid var(--line); }
table.an-tbl { font-size: 12.5px; }
table.an-tbl th { width: 66px; vertical-align: top; padding: 4px 8px 4px 0;
                  border: 0; font-weight: 600; }
table.an-tbl td { padding: 4px 0; border: 0; white-space: normal;
                  word-break: break-word; }

/* 커버리지: 담당 공석 — 붉은 '경과 N일' 칸이 독촉 대상처럼 읽히지 않게 구분 */
.vacant { color: var(--warn); font-weight: 600; font-size: 12px;
          border-bottom: 1px dotted var(--warn); cursor: help; }
tr.row-vacant td { background: #fffbf0; }
/* 분기보고: 담당 교체가 낀 행(이닛) — 상향/하향 집계에서 빠진 이유를 표에서 보이게 */
.init-mark { color: var(--warn); font-size: 11px; font-weight: 600;
             margin-left: 4px; cursor: help; }

/* 목표주가 종합: 미커버 기준(일) 조정 컨트롤 */
.mtx-ctl { font-size: 12px; color: var(--muted); margin: 0 0 8px;
           display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mtx-ctl input { width: 58px; border: 1px solid var(--line); border-radius: 6px;
                 padding: 3px 6px; font-size: 12px; font-family: inherit; }

/* ---------- 배지 ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px;
         font-size: 11px; font-weight: 600; }
.b-buy { background: #fee4e2; color: var(--up); }
.b-hold { background: #eef1f5; color: #5b6575; }
.b-sell { background: #dbe9fe; color: var(--down); }
.b-tp { background: #fef0c7; color: var(--warn); }
.b-kr { background: #e8f5ef; color: var(--ok); }
.b-os { background: #ede9fe; color: #6d28d9; }
.b-cmt { background: #e0f2fe; color: #0369a1; }

/* ---------- 피드 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
           margin-bottom: 14px; }
.filters select, .filters input[type=text], .filters input:not([type]) {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
  background: #fff; font-size: 13px; }
#ff-q { flex: 1; min-width: 160px; }
#sf-q { flex: 1; min-width: 180px; }
.chk { display: flex; align-items: center; gap: 4px; font-size: 13px;
       color: var(--muted); }
/* ---------- 리포트 피드 (2줄 그리드 행) ----------
   건별 카드(테두리+그림자)를 쌓으면 300건에서 눈이 피로해 → 목록 전체를 카드 1개로 감싸고
   행 사이는 얇은 구분선 + hover 배경으로만 구분한다. 목표주가는 우측 고정폭·우측정렬이라
   행마다 같은 x 좌표에 온다(세로 비교 가능). */
.rep-list { background: var(--card); border: 1px solid var(--line);
            border-radius: 12px; overflow: hidden; }
.rep + .rep { border-top: 1px solid var(--line); }
.rep-row { display: grid; align-items: center; gap: 12px;
           grid-template-columns: 96px minmax(0, 1fr) 150px 62px;
           padding: 9px 14px; }
/* 섹터 행: 목표주가 열이 없어 3열(날짜·본문·PDF/펼치기) */
.rep-row.sec { grid-template-columns: 96px minmax(0, 1fr) 62px; }
.rep-row:hover { background: #fafbfd; }
/* 박스 아무 데나 클릭해 펼치는 행 → 포인터 커서로 클릭 가능함을 알림 */
.rep-row.clickable { cursor: pointer; }
.rc-date { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.rc-date .d { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rc-main { min-width: 0; }
.rc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
           font-size: 12.5px; }
.rc-meta .f { font-weight: 700; font-size: 13px; }
.rc-meta b { font-size: 12.5px; }
/* 헤드라인은 1줄 말줄임(행 높이 고정) — 전체 문구는 title 툴팁 */
.rc-title { font-size: 13.5px; font-weight: 600; margin-top: 2px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-nums { text-align: right; line-height: 1.25; }
.rc-nums .tp { font-size: 15px; font-weight: 700;
               font-variant-numeric: tabular-nums; }
.rc-nums .tp i { color: var(--muted); font-weight: 400; font-style: normal; }
.rc-nums .sub { font-size: 12px; color: var(--muted); }
.rc-act { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.rc-toggle { border: 0; background: none; cursor: pointer; color: var(--accent);
             font-size: 13px; padding: 2px 4px; line-height: 1; }
.rep-more { padding: 2px 14px 12px 110px; }
.rm-sec h4 { margin: 6px 0 0; font-size: 11.5px; color: var(--muted);
             font-weight: 600; }
.rep pre { white-space: pre-wrap; font-family: inherit; font-size: 13px;
           background: #f8fafc; border-radius: 8px; padding: 10px; margin: 4px 0 0; }
.more-row { display: flex; justify-content: center; padding: 14px; }
.more-row button { min-width: 150px; }
.loading { color: var(--muted); text-align: center; padding: 32px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px;
         margin: 14px 0; color: var(--muted); font-size: 12px; }
.pager button:disabled { opacity: .45; cursor: default; }

/* ---------- 통화 메모(애널리스트 코멘트·추가 질문) ---------- */
.cmt-sec { margin-top: 10px; }
.cmt { border-left: 3px solid #bae6fd; padding-left: 10px; margin: 8px 0; }
.cmt-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
            font-size: 12.5px; }
.cmt-act { margin-left: auto; display: flex; gap: 2px; }
button.lnk { border: 0; background: none; color: var(--accent); cursor: pointer;
             font-size: 12px; padding: 2px 4px; font-family: inherit; }
button.lnk:hover { text-decoration: underline; }
.cmt-empty { margin: 6px 0 2px; }
.cmt-form, .cmt-edit { margin: 6px 0 2px; }
.cmt-fields { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.cmt-fields label { display: flex; align-items: center; gap: 6px;
                    font-size: 12px; color: var(--muted); }
.cmt-fields input { border: 1px solid var(--line); border-radius: 8px;
                    padding: 5px 8px; font-size: 13px; font-family: inherit; }
.cmt-form textarea, .cmt-edit textarea { width: 100%; border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; font-family: inherit; font-size: 13px;
  resize: vertical; }
.cmt-form .btn-row, .cmt-edit .btn-row { margin-top: 6px; }
.cf-msg { margin-left: 4px; }

/* ---------- Top pick 구두 정정 ---------- */
.b-call { box-shadow: inset 0 0 0 1px #b54708; }   /* 리포트 명시분과 구분 */
/* 수기 이력(마스터 시드) 기준 값 — 리포트 원문과 다름(툴팁에 원문 의견) */
.seed-mark { margin-left: 3px; color: var(--muted); font-size: 11px; cursor: help; }
.b-pend { background: #fef0c7; color: var(--warn); margin-left: 4px; }
.tp-sec { margin-top: 12px; }
.tp-sec h4 { margin: 6px 0 2px; font-size: 11.5px; color: var(--muted);
             font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.tp-state { border-left: 3px solid var(--line); padding: 2px 0 2px 10px;
            display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
            font-size: 12.5px; }
.tp-state.ok { border-color: #f59e0b; }
.tp-state.pend { border-color: #94a3b8; }
.tp-state.rej { border-color: #d92d20; }
.tp-state pre { flex-basis: 100%; }
.tp-state .cmt-act { margin-left: auto; }
.tp-form { margin: 6px 0 2px; }
.tp-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px;
                    padding: 9px 10px; font-family: inherit; font-size: 13px;
                    resize: vertical; }
.tp-form select { border: 1px solid var(--line); border-radius: 8px;
                  padding: 5px 8px; font-size: 13px; font-family: inherit; }
.rv-tbl td { vertical-align: top; }
.rv-tbl .rv-chg { white-space: nowrap; }
.rv-tbl pre { white-space: pre-wrap; font-family: inherit; font-size: 12.5px;
              background: #f8fafc; border-radius: 8px; padding: 8px; margin: 0; }
.rv-act { white-space: nowrap; }
.rv-act button { background: var(--accent); color: #fff; border: 0;
                 border-radius: 8px; padding: 5px 12px; cursor: pointer;
                 font-size: 12px; }
.rv-act button.ghost { background: #fff; color: var(--text);
                       border: 1px solid var(--line); }
.qc-block { margin-top: 10px; }
.qc-block h4 { margin: 0 0 2px; font-size: 13px; }
.qc-block pre { white-space: pre-wrap; font-family: inherit; font-size: 13px;
                background: #f8fafc; border-radius: 8px; padding: 10px;
                margin: 4px 0 0; }

/* 좁은 화면: 4열이 깨지므로 세로 스택으로 폴백 */
@media (max-width: 900px) {
  header { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  header .head-right { gap: 6px; }
  header .head-right #meta { display: none; }
  header nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px;
               scrollbar-width: thin; }
  header nav button { flex: 0 0 auto; white-space: nowrap; padding: 7px 11px; }
  main { padding: 12px 12px 50px; }
  .rep-row, .rep-row.sec { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .rc-date { flex-direction: row; align-items: baseline; }
  .rc-main { grid-column: 1 / -1; order: 2; }
  .rc-nums { order: 1; }
  .rc-act { grid-column: 1 / -1; order: 3; justify-content: flex-start; }
  .rc-title { white-space: normal; }
  .rep-more { padding-left: 14px; }
  .stat.span2 { grid-column: auto; }
}
@media (max-width: 520px) {
  main { overflow-x: hidden; }
  .brand { font-size: 14px; }
  .head-right button { padding: 5px 8px; font-size: 12px; }
  .head-right #pw-open { display: none; }
  .stat-row, .stat-row.wide { grid-template-columns: 1fr 1fr; }
  .stat-row.wide .stat { min-width: 0; }
  .stat .v, .stat-row.wide .stat .v { font-size: 18px; }
  .stat.span2 .v { white-space: normal; overflow-wrap: anywhere; }
  .stat .v .pct { display: block; margin-left: 0; }
  .tabs { overflow-x: auto; }
  .tabs button { flex: 0 0 auto; }
}
a.pdf { font-size: 12px; color: var(--accent); text-decoration: none; }
a.pdf:hover { text-decoration: underline; }

/* ---------- 커버리지 ---------- */
.cov-cell { border-radius: 8px; padding: 4px 8px; font-size: 12px;
            display: inline-block; min-width: 96px; }
.cov-g { background: #e8f5ef; color: var(--ok); }
.cov-y { background: #fef0c7; color: var(--warn); }
.cov-r { background: #fee4e2; color: var(--bad); }
.cov-n { background: #f1f4f8; color: #aab2c0; }

/* 값이 원문과 다를 때(예: 마스터 커버 애널리스트) — 툴팁으로 원문 확인 */
.hint { border-bottom: 1px dotted var(--line); cursor: help; }

/* ---------- 차트 ---------- */
.chart-box { position: relative; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-tip { position: absolute; top: 10px; pointer-events: none; display: none;
             background: #fff; border: 1px solid #e3e8ef; border-radius: 6px;
             padding: 6px 9px; font-size: 12px; line-height: 1.5;
             box-shadow: 0 2px 8px rgba(16, 24, 40, .1); white-space: nowrap;
             z-index: 5; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; }
.legend span { font-size: 12px; cursor: pointer; display: flex;
               align-items: center; gap: 4px; }
.legend span.off { opacity: .3; }
.lg-all { font-size: 11.5px; cursor: pointer; padding: 1px 8px; color: #475467;
          background: #f5f7fa; border: 1px solid #e3e8ef; border-radius: 10px; }
.lg-all:hover { background: #eceff4; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- 관리자 ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
           align-items: center; }
.btn-row input, #admin-body input { border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; font-family: inherit; }
.btn-row button { background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.btn-row button.ghost { background: #fff; color: var(--text);
                        border: 1px solid var(--line); }
#admin-body table input { width: 100%; min-width: 120px; }
#admin-body td button.ghost { padding: 3px 10px; font-size: 12px;
                              cursor: pointer; }
/* 수기 메타 표 — 신규 행은 배경으로 기존 행과 구분(잘못 덮어쓰는 실수 방지) */
#admin-body tr.mt-addrow { background: #f8fafc; }
#admin-body td button.mt-add { background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
/* 표 안의 조용한 액션(담당 변경 요청 ✎) — 값 옆에 붙어도 시선을 뺏지 않게 */
button.linkbtn { border: 0; background: none; cursor: pointer; padding: 0 2px;
  color: var(--muted); font-size: 12px; line-height: 1; }
button.linkbtn:hover { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f1f4f8; border-radius: 999px; padding: 3px 6px 3px 12px;
        font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted);
               font-size: 14px; line-height: 1; padding: 0 4px; }
.chip button:hover { color: var(--bad); }
.admin-msg { display: inline-block; min-height: 18px; font-size: 12.5px;
             color: var(--ok); margin-bottom: 6px; }
.admin-msg.bad { color: var(--bad); }
.copybox { width: 100%; border: 1px solid var(--line); border-radius: 8px;
           padding: 8px; font-size: 12px; font-family: inherit; margin-top: 6px; }
#admin-body details summary { cursor: pointer; font-size: 12px; margin-top: 8px; }
/* 카드 통째로 접기 — 자주 안 고치는 표(커버 애널리스트 등)는 기본 접힘.
   summary 를 카드 제목(.card h3)과 같은 크기로 보이게 해 접혀 있어도 카드처럼 읽힌다. */
#admin-body details.fold > summary { font-size: 14px; font-weight: 700; margin: 0; }
#admin-body details.fold[open] > summary { margin-bottom: 10px; }
.aa-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
           gap: 8px; align-items: end; margin: 12px 0 16px; }
.aa-form label { color: var(--muted); font-size: 12px; }
.aa-form label input { display: block; width: 100%; margin-top: 3px; }
.aa-form select { border: 1px solid var(--line); border-radius: 8px;
                  padding: 6px 10px; font: inherit; background: #fff; }
.aa-form button { background: var(--accent); color: #fff; border: 0;
                  border-radius: 8px; padding: 7px 14px; cursor: pointer; }
.aa-form .admin-msg { align-self: center; margin: 0; }
.fi-tbl select, .fi-tbl input, .fi-new { min-width: 110px; }
.fi-tbl select, #admin-body .fi-new[data-f="구분"] { border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font: inherit; background: #fff; }
.fi-tbl button.fi-add { background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: 4px 12px; cursor: pointer; }

/* ---------- 로그인 ---------- */
.login-body { display: flex; align-items: center; justify-content: center;
              min-height: 100vh; }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 16px;
             padding: 36px 32px; width: 320px; text-align: center; }
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login-box input { border: 1px solid var(--line); border-radius: 8px;
                   padding: 10px 12px; font-size: 14px; }
.login-box button { background: var(--accent); color: #fff; border: 0;
                    border-radius: 8px; padding: 10px; font-size: 14px;
                    font-weight: 600; cursor: pointer; }
.login-err { color: var(--bad); font-size: 12px; min-height: 16px; }

/* ---- 밸류에이션 탭 ---- */
.b-none { background: #f1f4f8; color: #98a2b3; }
.vchip { display: inline-flex; align-items: center; gap: 6px;
         background: #fff; border: 1px solid var(--line); border-radius: 999px;
         padding: 4px 12px; font-size: 13px; cursor: pointer;
         font-family: inherit; color: var(--text); }
.vchip:hover { border-color: #b6c2d4; background: #f8fafc; }
.vchip.on { border-color: var(--accent); background: #eff4ff;
            box-shadow: 0 0 0 1px var(--accent); }
.vwarn { color: #b54708; cursor: help; }
.vchg { font-size: 11.5px; color: #6d28d9; background: #ede9fe;
        border-radius: 8px; padding: 1px 6px; white-space: nowrap; }
/* ⚠️ 전역 `th, td { white-space: nowrap }`(테이블 절) 때문에 상세 행 안의 긴 문장이
   한 줄로 뻗어 표 폭을 밀어냈다(실측 2026-08-07: 상세 펼치면 1,126px 래퍼 안에서
   표가 1,321→1,909px 로 확장 = 열이 화면 밖으로 밀려 '깨져' 보임). 상세·긴 텍스트
   셀은 줄바꿈을 되살리고, 상세 내용은 max-width 로 고정해 **표 폭을 좌우하지
   않게** 한다(래퍼가 overflow-x:auto 라 셀 내용이 곧 표 폭이 되는 구조). */
.vdetail td { padding: 0 10px 8px 24px; border-bottom: 1px solid var(--line);
              white-space: normal; }
.vdetail summary { cursor: pointer; color: #667085; font-size: 12.5px; }
.vdetail > td > details { max-width: 860px; }
.vdetail pre, .vcard-more pre { white-space: pre-wrap; overflow-wrap: anywhere;
               font: 13px/1.6 inherit; margin: 6px 0; max-width: 860px;
               background: #f8fafc; border-radius: 8px; padding: 8px 12px; }
.vq { font-size: 12.5px; color: #667085; margin: 4px 0; font-style: italic;
      white-space: normal; overflow-wrap: anywhere; max-width: 860px; }
/* 배수·적용지표는 'EV/EBITDA 5.0배(통신), EV/EBIT(FY30) 2.7배(AI인프라)'처럼
   길어질 수 있어 1줄 말줄임(…)한다 — 전체는 title 툴팁 + 행 클릭 상세에서 확인.
   행 높이를 증권사마다 균일한 1줄로 맞추기 위함(2줄 clamp 였던 것을 교체). */
.vtable td.vwrap { max-width: 150px; overflow: hidden; text-overflow: ellipsis;
                   white-space: nowrap; }
/* 산정 근거(배수+적용지표 병합) — 본문 폭을 넉넉히 주되 1줄 말줄임(전체는 title·상세) */
.vtable td.vbasis { max-width: 300px; overflow: hidden; text-overflow: ellipsis;
                    white-space: nowrap; }
/* 상세는 행 클릭으로 펼침 — 기본 접힘(별도 토글 행이 상시 뜨지 않게) → 1줄 유지. */
.vmain.has-detail { cursor: pointer; }
.vmain.has-detail:hover { background: #fafbfd; }
.vexp { display: inline-block; color: var(--muted); font-size: 10px;
        transition: transform .12s; }
.vmain.exp .vexp, .vcard.exp .vexp { transform: rotate(90deg); }
tr.vdetail.hidden { display: none; }

/* ---- 밸류에이션 카드(2줄, 1열, 색 없이 깔끔) ---- */
.vcard-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
.vcard { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
         background: var(--card); }
.vcard.has-detail { cursor: pointer; }
.vcard.has-detail:hover { background: #fafbfd; }
.vcard.stale { color: #aab2c0; background: #fbfcfd; }
.vcard.stale .badge { opacity: .65; }
.vc-top { display: flex; align-items: center; gap: 7px; }
.vc-firm { font-weight: 700; }
.vc-method { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.vc-tp { margin-left: auto; font-weight: 700; font-size: 15px;
         font-variant-numeric: tabular-nums; white-space: nowrap; }
.vc-bot { display: flex; align-items: center; gap: 10px; margin-top: 5px;
          font-size: 12.5px; }
.vc-basis { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
            white-space: nowrap; color: #475467; }
.vcard.stale .vc-basis { color: inherit; }
.vc-meta { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; }
.vcard-more { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
              white-space: normal; cursor: default; }
.vcard-more.hidden { display: none; }
.vcard-more .vtl, .vcard-more .vq, .vcard-more pre { max-width: 100%; }
/* 긴 값은 2줄까지만 — 넘치면 말줄임, 전체는 title 툴팁(캡션과 같은 관례) */
.vclamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
          overflow: hidden; cursor: help; }
.vcur { margin-bottom: 8px; }
/* 변경 타임라인(세로형) — 산정 로직이 언제 어떻게 바뀌었나. 미기재·중복은 접혀
   실제 변경 지점만 노드로 남는다(이력이 길어져도 노드 수는 변경 횟수만큼). */
.vtl-label { font-size: 12px; font-weight: 600; color: var(--muted);
             margin: 10px 0 8px; }
.vtl { max-width: 860px; }
.vtl-node { position: relative; padding: 0 0 12px 20px;
            border-left: 2px solid var(--line); }
.vtl-node:last-child { border-left-color: transparent; padding-bottom: 0; }
.vtl-dot { position: absolute; left: -5px; top: 4px; width: 9px; height: 9px;
           border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 2px #fff; }
.vtl-node.cur .vtl-dot { background: var(--accent);
                         box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent); }
.vtl-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vtl-date { font-size: 12px; font-weight: 600; }
.vtl-chg { font-size: 11px; color: #6d28d9; background: #ede9fe;
           border-radius: 8px; padding: 1px 7px; }
.vtl-chg.first { color: #667085; background: #eef1f5; }  /* 최초 기록 = 중립색 */
.vtl-chg.none { color: #98a2b3; background: #f1f4f8; }   /* 미기재 노드 = 회색 */
.vtl-node.none .vtl-dot { background: #e3e8ef; }         /* 미기재 = 옅은 점 */
.vtl-sub { font-size: 12.5px; color: #475467; margin-top: 2px;
           overflow-wrap: anywhere; }
.vtl-node.none .vtl-sub { color: #98a2b3; }
tr.vdetail.stale td, tr.vdetail.stale summary { color: #aab2c0; }

/* ---------- 비밀번호 변경 모달 ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
            display: flex; align-items: center; justify-content: center;
            z-index: 100; }
.modal-bg[hidden] { display: none; }
.modal { background: #fff; border-radius: 12px; padding: 22px 24px;
         width: min(360px, 92vw); box-shadow: 0 12px 40px rgba(0, 0, 0, .18); }
.modal h3 { margin: 0 0 14px; font-size: 16px; }
.modal label { display: block; font-size: 12.5px; color: var(--muted);
               margin-bottom: 10px; }
.modal input { display: block; width: 100%; box-sizing: border-box;
               margin-top: 4px; border: 1px solid var(--line);
               border-radius: 8px; padding: 8px 10px; font-size: 14px;
               font-family: inherit; }
#pw-note { font-size: 12px; min-height: 16px; margin: 2px 0 4px; }
#pw-note.err { color: var(--bad); }

/* ---------- 관리자 미등록 증권사 경고 ---------- */
.warn-card { border-color: #f5c518; background: #fffbeb; }
.warn-card h3 { color: #b54708; }

/* ---------- 앱 스위처(브랜드 드롭다운) ---------- */
.brand-menu { position: relative; }
button.brand { display: flex; align-items: center; gap: 7px; border: 0;
               background: none; cursor: pointer; font: inherit; font-weight: 700;
               font-size: 16px; color: inherit; white-space: nowrap;
               padding: 6px 10px; border-radius: 10px; }
button.brand:hover { background: #f1f4f8; }
button.brand.open { background: #eceff4; }
.brand .caret { font-size: 11px; color: var(--muted); transition: transform .15s; }
.brand.open .caret { transform: rotate(180deg); }

.app-drop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
            min-width: 272px; background: #fff; border: 1px solid var(--line);
            border-radius: 12px; padding: 6px;
            box-shadow: 0 10px 28px rgba(16, 24, 40, .13); }
.app-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px;
            border-radius: 9px; text-decoration: none; color: var(--text); }
.app-item:hover { background: #f4f6f9; }
.app-item.on { background: #eef4ff; }
.app-item .ic { font-size: 18px; }
.app-item .tx { display: flex; flex-direction: column; line-height: 1.35; }
.app-item .tx b { font-size: 13.5px; }
.app-item .tx small { font-size: 11.5px; color: var(--muted); }
.app-item .ck { margin-left: auto; color: var(--accent); font-weight: 700; }

/* ---------- ADR 괴리율 페이지 ---------- */
.tabs.sm { display: inline-flex; margin: 0; gap: 4px; }
.tabs.sm button { padding: 4px 12px; font-size: 12.5px; }
.dl-row { margin-left: auto; display: flex; gap: 8px; }
a.ghost.dl { border: 1px solid var(--line); background: #fff; border-radius: 8px;
             padding: 6px 12px; color: var(--muted); text-decoration: none;
             font-size: 12.5px; }
a.ghost.dl:hover { color: var(--text); }

.adr-cards { display: grid; gap: 14px;
             grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.adr-card { margin-bottom: 0; }
.ac-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.ac-name { font-weight: 700; font-size: 15px; padding-left: 8px;
           border-left: 4px solid var(--accent); }
.ac-val { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.v-ok { background: #e8f5ef; color: var(--ok); }
.v-warn { background: #fef0c7; color: var(--warn); }
.v-none { background: #f1f4f8; color: #98a2b3; }
.b-flag { background: #fff4e6; color: var(--warn); }
.ac-miss { background: #fff4e6; border-radius: 8px; padding: 8px 10px;
           font-size: 12.5px; color: var(--warn); margin-top: 8px; }
.gauge { margin: 10px 0 2px; }
.gauge svg { width: 100%; height: auto; display: block; }
.ac-tbl { margin-top: 8px; }
.ac-tbl th { text-align: left; color: var(--muted); font-weight: 500;
             white-space: nowrap; }
.ac-tbl td { white-space: nowrap; }
.ac-tbl td.fx-drift { white-space: normal; text-align: right; color: var(--muted);
                      font-size: 11.5px; line-height: 1.5; padding-top: 0; }
.ac-flags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px;
            align-items: center; font-size: 12.5px; color: var(--muted); }
.footnote { color: var(--muted); font-size: 12px; line-height: 1.65;
            margin: 14px 2px 0; }
.spec-dl { margin: 8px 2px 0; }

.two-col { display: grid; gap: 16px; margin-top: 14px;
           grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.sub-h { font-size: 12.5px; font-weight: 600; color: #475467; margin-bottom: 6px; }
.mtbl th, .mtbl td { padding: 4px 8px; }
.mbar { display: block; position: relative; width: 100px; height: 8px;
        background: #f1f4f8; border-radius: 4px; }
.mbar i { position: absolute; top: 0; height: 8px; border-radius: 4px; }
.mbar i.p { background: #f2b8b5; }
.mbar i.n { background: #b8cdf5; }

/* ---------- shadcn-inspired shared component layer ---------- */
button, input, select, textarea { font-family: inherit; }
button, a, input, select, textarea { transition: color .15s ease, background-color .15s ease,
  border-color .15s ease, box-shadow .15s ease, opacity .15s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ring);
}
button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed; opacity: .5;
}

header { background: rgba(255, 255, 255, .92); border-color: var(--border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
nav button { border-radius: calc(var(--radius) - 2px); font-weight: 500; }
nav button:hover { background: var(--secondary); color: var(--secondary-foreground); }
nav button.on { background: var(--primary); color: var(--primary-foreground); }

.card, .stat, .rep-list, .vcard { border-color: var(--border);
  border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0, 0, 0, .035); }
.card h3 { font-weight: 600; letter-spacing: -0.015em; }
.stat .v, .big, .rc-nums .tp, .vc-tp { font-variant-numeric: tabular-nums; }

.tabs { gap: 4px; padding: 3px; width: fit-content; max-width: 100%;
  border-radius: calc(var(--radius) - 1px); background: var(--muted-bg); }
.tabs button { border: 0; border-radius: calc(var(--radius) - 3px); padding: 6px 14px;
  color: var(--muted); background: transparent; font-weight: 500; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.filters select, .filters input[type=text], .filters input:not([type]),
.modal input, .login-box input, .an-edit-form input, .an-edit-form textarea,
.cmt-fields input, .cmt-fields textarea, .tp-form textarea, .tp-form select,
.btn-row input, #admin-body input, .copybox, .aa-form select, .fi-tbl select {
  border-color: var(--input); border-radius: calc(var(--radius) - 2px);
  background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .025);
}
input::placeholder, textarea::placeholder { color: #a1a1aa; }

button.ghost, a.ghost.dl, .btn-row button.ghost, .rv-act button.ghost {
  color: var(--text); background: var(--card); border-color: var(--border);
  border-radius: calc(var(--radius) - 2px); box-shadow: 0 1px 2px rgba(0, 0, 0, .035);
}
button.ghost:hover, a.ghost.dl:hover, .btn-row button.ghost:hover,
.rv-act button.ghost:hover { background: var(--secondary); color: var(--secondary-foreground); }
.btn-row button, .rv-act button, .aa-form button, .fi-tbl button.fi-add,
#admin-body td button.mt-add, .login-box button {
  background: var(--primary); color: var(--primary-foreground);
  border-radius: calc(var(--radius) - 2px); font-weight: 500;
}
.btn-row button:hover, .rv-act button:hover, .aa-form button:hover,
.fi-tbl button.fi-add:hover, #admin-body td button.mt-add:hover,
.login-box button:hover { opacity: .9; }

th { color: var(--muted-foreground); font-weight: 500; }
tbody tr:hover td { background-color: rgba(244, 244, 245, .55); }
.rep-row:hover, .vmain.has-detail:hover, .vcard.has-detail:hover { background: var(--secondary); }
.badge, .chip, .vchg, .vtl-chg { border-radius: 999px; font-weight: 500; }
.rep pre, .rv-tbl pre, .qc-block pre, .vdetail pre, .vcard-more pre {
  background: var(--muted-bg); border: 1px solid var(--border); }

.modal-bg, .an-edit-overlay { background: rgba(9, 9, 11, .55); backdrop-filter: blur(2px); }
.modal, .an-edit-modal, .app-drop { border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0, 0, 0, .16); }
.login-body { background: radial-gradient(circle at 50% 20%, #ffffff 0, var(--background) 45%); }
.login-box { border-radius: calc(var(--radius) + 2px); box-shadow: 0 8px 30px rgba(0, 0, 0, .06); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
