* { margin: 0; padding: 0; box-sizing: border-box; }

  :root {
    --bg: #f7f7f8;
    --bg2: #ffffff;
    --bg3: #f0f1f3;
    --border: #e5e7eb;
    --border2: #d1d5db;
    --text: #1f2937;
    --text2: #4b5563;
    --text3: #9ca3af;
    --gold: #d97706;
    --up: #dc2626;
    --dn: #2563eb;
    --nc: #9ca3af;
    --shadow: 0 1px 3px rgba(0,0,0,.06);
    --mobile-ad-space: 0px;
    --mobile-ad-shell-height: 0px;
    --mobile-ad-side-gap: 16px;
    --content-pad-y: 16px;
  }

  body {
    font-family: 'Malgun Gothic', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #native-ad-shell {
    display: none !important;
  }

  .kakao-ad-rail {
    display: none;
  }

  .kakao-ad-square {
    display: flex;
    width: 250px;
    min-height: 250px;
    align-items: center;
    justify-content: center;
    margin: 18px auto 2px;
  }

  :root {
    --safe-top: 0px;
  }

  @supports (padding-top: env(safe-area-inset-top)) {
    :root {
      --safe-top: env(safe-area-inset-top);
    }
  }

  /* ── 상단 바 ── */
  #topbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: calc(4px + var(--safe-top)) 20px 4px;
    min-height: calc(48px + var(--safe-top));
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    -webkit-app-region: drag;
  }
  .logo {
    font-size: 17px;
    font-weight: 900;
    color: var(--gold);
    letter-spacing: 0;
    -webkit-app-region: no-drag;
    margin-right: 6px;
    text-decoration: none;
    cursor: pointer;
  }
  .logo:hover,
  .logo:focus-visible {
    color: #b45309;
  }
  .logo:focus-visible {
    outline: 2px solid rgba(217, 119, 6, .35);
    outline-offset: 3px;
    border-radius: 4px;
  }

  .index-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    -webkit-app-region: no-drag;
    transition: border-color .2s;
    flex: 0 0 auto;
  }
  .index-chip:hover { border-color: var(--border2); }
  .index-chip .lbl {
    color: var(--text3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
  }
  .index-chip .val {
    font-weight: 800;
    font-size: 13px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }
  .index-chip .chg {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .up { color: var(--up); }
  .dn { color: var(--dn); }
  .nc { color: var(--nc); }

  #status-wrap {
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    -webkit-app-region: no-drag;
    font-size: 11px;
    color: var(--text3);
  }
  .meta-links {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 10px;
    -webkit-app-region: no-drag;
  }
  .meta-links a {
    color: var(--text2);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
  }
  .meta-links a:hover {
    color: var(--gold);
  }
  #status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
  }
  #status-dot.disconnected { background: var(--up); box-shadow: 0 0 6px var(--up); }
  #status-dot.connecting { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; animation: pulse 1s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

  @media (max-width: 840px) {
    #topbar {
      padding: 0 12px;
      gap: 8px;
      flex-wrap: wrap;
      height: auto;
      min-height: calc(48px + var(--safe-top));
      padding-top: calc(8px + var(--safe-top));
      padding-bottom: 8px;
    }
    #status-wrap {
      margin-left: 0;
    }
    .meta-links {
      width: 100%;
      margin-left: 0;
      padding-top: 2px;
    }
    .index-chip {
      min-width: 0;
      flex: 0 0 auto;
    }
  }

  /* ── 탭 ── */
  #tabs-shell {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: relative;
    padding: 0 20px;
    flex-shrink: 0;
  }
  #tabs {
    display: flex;
    gap: 4px;
  }
  #tabs-prev,
  #tabs-more,
  .tabs-edge {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 42px;
    border: 0;
    color: var(--gold);
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
    align-items: center;
    cursor: pointer;
    -webkit-app-region: no-drag;
    z-index: 2;
  }
  #tabs-prev {
    left: 0;
    justify-content: flex-start;
    padding: 0 18px 1px 10px;
    background: linear-gradient(270deg, rgba(255,255,255,0), var(--bg2) 42%, var(--bg2));
  }
  #tabs-more {
    right: 0;
    justify-content: flex-end;
    padding: 0 10px 1px 18px;
    background: linear-gradient(90deg, rgba(255,255,255,0), var(--bg2) 42%, var(--bg2));
  }
  .tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text3);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    letter-spacing: .3px;
  }
  .tab:hover { color: var(--text2); }
  .tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 800; }

  /* ── 콘텐츠 ── */
  #content {
    flex: 1;
    overflow-y: auto;
    padding: var(--content-pad-y) 20px calc(var(--content-pad-y) + var(--mobile-ad-space));
    scrollbar-width: thin;
    scrollbar-color: var(--border2) transparent;
  }
  #content::-webkit-scrollbar { width: 5px; }
  #content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
  .pane { display: none; }
  .pane.active { display: block; }

  @media (min-width: 1280px) {
    #content {
      padding-right: 204px;
    }

    .kakao-ad-rail {
      position: fixed;
      right: 20px;
      top: calc(112px + var(--safe-top));
      z-index: 4;
      display: flex;
      width: 160px;
      min-height: 600px;
      align-items: flex-start;
      justify-content: center;
      pointer-events: auto;
    }
  }

  /* ── 섹터 ── */
  .sectors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
  }
  .sector-section {
    margin-bottom: 16px;
  }
  .sector-section-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 900;
    color: var(--text);
  }
  .sector-section-title small {
    font-size: 11px;
    font-weight: 600;
    color: var(--text3);
  }

  .sector-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: border-color .2s, box-shadow .2s;
  }
  .sector-card:hover {
    border-color: var(--border2);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
  }

  .sector-header {
    padding: 10px 14px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .sector-icon {
    width: 26px; height: 26px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
  }
  .sector-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0;
    color: var(--text);
    flex: 1;
    min-width: 120px;
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: normal;
    line-height: 1.35;
  }
  .sector-avg {
    font-size: 12px;
    font-weight: 700;
    border-radius: 5px;
    padding: 2px 7px;
    margin-left: auto;
    flex-shrink: 0;
  }

  .stock-col-header {
    display: grid;
    grid-template-columns: 1fr 80px 70px 62px;
    padding: 4px 14px;
    font-size: 10px;
    color: var(--text3);
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
    gap: 4px;
  }
  .stock-col-header span { text-align: right; }
  .stock-col-header span:first-child { text-align: left; }

  .stock-row {
    display: grid;
    grid-template-columns: 1fr 80px 70px 62px;
    align-items: center;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    gap: 4px;
    transition: background .1s;
    cursor: pointer;
  }
  .stock-row:last-child { border-bottom: none; }
  .stock-row:hover { background: rgba(0,0,0,.02); }
  .stock-row.row-hot, .amount-row.row-hot { background: rgba(220,38,38,.04); }
  .stock-row.row-limit-up, .amount-row.row-limit-up { background: rgba(220,38,38,.07); }
  .stock-row-extra { display: none; }
  .sector-card.sector-expanded .stock-row-extra { display: grid; }

  .sector-expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    color: var(--text3);
    font-size: 11px;
    cursor: pointer;
    transition: background .1s, color .1s;
  }
  .sector-expand-btn:hover { background: rgba(0,0,0,.03); color: var(--text); }
  .sector-expand-icon { font-size: 10px; line-height: 1; }

  .sname { color: var(--text); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sprice { font-weight: 700; font-size: 12px; text-align: right; }
  .srate-cell { text-align: right; }
  .srate { font-size: 11px; }
  .samt { color: var(--text3); font-size: 11px; text-align: right; }

  .badge-limit {
    display: inline-block;
    background: var(--up);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.4;
  }
  .badge-limit-time {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text3);
    text-align: right;
    margin-top: 1px;
  }

  .badge-lu-count {
    background: var(--up);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
    line-height: 1.4;
  }

  .sector-card.heat-high { border-color: rgba(220,38,38,.4); box-shadow: 0 0 14px rgba(220,38,38,.1); }
  .sector-card.heat-mid  { border-color: rgba(234,179,8,.4); }

  .sector-card.sector-leading {
    border-color: rgba(245,158,11,.75);
    box-shadow: 0 0 18px rgba(245,158,11,.22);
    background: linear-gradient(180deg, rgba(254,243,199,.35) 0%, var(--bg2) 60%);
  }
  .badge-leading {
    background: linear-gradient(90deg, #f59e0b, #dc2626);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    line-height: 1.4;
    letter-spacing: .3px;
    flex-shrink: 0;
  }
  .badge-theme {
    background: #e0f2fe;
    color: #075985;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.4;
    flex-shrink: 0;
  }
  .badge-continuity {
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.4;
    flex-shrink: 0;
    white-space: nowrap;
  }
  .badge-continuity.streak {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
  }
  .badge-continuity.new {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
  }
  .badge-continuity.rankUp {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
  }
  .badge-continuity.rankDown {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
  }

  .sector-issues {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    background: #fff7ed;
  }
  .sector-issue {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 11px;
    line-height: 1.35;
  }
  .sector-issue-tag {
    flex-shrink: 0;
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--up);
    font-weight: 800;
  }
  .sector-issue-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text2);
    font-weight: 600;
    text-decoration: none;
  }
  a.sector-issue-title:hover { color: var(--gold); text-decoration: underline; }

  /* ── 대금상위 ── */
  .amount-header {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    padding: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .amount-header span { color: var(--up); font-weight: 600; font-size: 13px; }

  .amount-col-header {
    display: grid;
    grid-template-columns: 1fr 90px 70px 80px;
    padding: 6px 16px;
    font-size: 11px;
    color: var(--text3);
    font-weight: 600;
    gap: 12px;
  }
  .amount-col-header span { text-align: right; }
  .amount-col-header span:first-child { text-align: left; }

  .amount-list { display: flex; flex-direction: column; gap: 6px; }

  .amount-row {
    display: grid;
    grid-template-columns: 1fr 90px 70px 80px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    gap: 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow .15s;
    position: relative;
    overflow: hidden;
    cursor: pointer;
  }
  .amount-row:hover { box-shadow: 0 2px 10px rgba(0,0,0,.08); }
  .amount-row.live-tick {
    animation: amount-live-tick .42s ease-out;
  }
  @keyframes amount-live-tick {
    0% { background: rgba(14, 165, 233, .16); }
    100% { background: var(--bg2); }
  }

  .amount-sector-bar {
    width: 4px;
    height: 100%;
    border-radius: 2px;
    position: absolute;
    left: 0;
    top: 0;
  }

  .amount-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    padding-left: 4px;
  }
  .amount-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .amount-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .amount-sector-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .supply-badges {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
  }
  .supply-star-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 4px;
    border-radius: 4px;
    background: #fff7cc;
    color: #7c4a03;
    border: 1px solid #f5d36b;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
  }
  .amount-price {
    font-size: 15px;
    font-weight: 800;
    text-align: right;
    color: var(--text);
  }
  .amount-rate {
    font-size: 13px;
    font-weight: 700;
    text-align: right;
  }
  .amount-amt {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
    color: var(--text2);
  }
  .amount-metric {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
  }
  .amount-metric-label {
    display: none;
    color: var(--text3);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
  }
  .amount-metric-value {
    min-width: 0;
  }

  /* ── 지수상세 ── */
  .idx-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .idx-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
  }
  .idx-card-top {
    padding: 16px 20px 12px;
  }
  .idx-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
  }
  .idx-name {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
  }
  .idx-time {
    font-size: 11px;
    color: var(--text3);
  }
  .idx-breadth {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg3);
    color: var(--text3);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
  }
  .idx-breadth-up {
    color: var(--up);
  }
  .idx-breadth-dn {
    color: var(--dn);
  }
  .idx-breadth-sep {
    color: var(--text3);
    font-weight: 600;
  }
  .idx-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
  }
  .idx-change-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
    font-size: 14px;
    font-weight: 700;
  }
  .idx-investor-row {
    display: flex;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--bg3);
    font-size: 12px;
  }
  .idx-inv-item {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .idx-inv-label {
    color: var(--text3);
    font-weight: 600;
  }
  .idx-inv-val {
    font-weight: 700;
  }
  .idx-us-meta {
    color: var(--text3);
    font-size: 11px;
    font-weight: 600;
  }
  .idx-chart-wrap {
    padding: 0 4px 4px;
    height: 320px;
    position: relative;
  }
  .idx-chart-wrap canvas {
    width: 100% !important;
  }


  /* ── 수급분석 ── */
  .flow-section {
    margin-bottom: 18px;
  }
  .flow-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    padding: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .flow-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }
  .flow-summary-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
  }
  .flow-summary-card .card-label {
    font-size: 11px; font-weight: 700; color: var(--text2); margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
  }

  .flow-summary-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 0; font-size: 12px;
  }
  .flow-summary-row .label { color: var(--text2); font-size: 11px; }
  .flow-summary-row .value { font-weight: 700; }
  .flow-table-wrap {
    padding: 6px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .flow-tbl {
    width: 100%; border-collapse: collapse; font-size: 11px;
  }
  .flow-tbl th {
    text-align: right; padding: 5px 6px; color: var(--text3);
    border-bottom: 1px solid var(--border); font-weight: 600; font-size: 10px;
    white-space: nowrap;
  }
  .flow-tbl th:first-child { text-align: left; }
  .flow-tbl td {
    text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--border);
    font-weight: 600; white-space: nowrap;
  }
  .flow-tbl td:first-child { text-align: left; font-weight: 700; color: var(--text); }
  .flow-tbl td.bar-cell { position: relative; }
  .flow-tbl td.bar-cell .bar-bg {
    position: absolute; left: 0; top: 0; bottom: 0; opacity: 0.12; border-radius: 3px;
  }
  .flow-tbl td.bar-cell span { position: relative; }
  .flow-tbl td.prog-col { color: #8b5cf6 !important; }
  .flow-tbl td.prog-col.up { color: #8b5cf6 !important; }
  .flow-tbl td.prog-col.dn { color: #a78bfa !important; }
  .flow-tbl tr[data-stock-code] {
    cursor: pointer;
  }
  .flow-tbl tr[data-stock-code]:hover {
    background: var(--bg3);
  }

  .frgn-rank-list { display: flex; flex-direction: column; gap: 3px; }
  .frgn-rank-list-mobile {
    display: none;
  }
  .frgn-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    font-size: 11px;
  }
  .frgn-row[data-stock-code] {
    cursor: pointer;
  }
  .frgn-row[data-stock-code]:hover {
    border-color: rgba(245, 158, 11, 0.35);
    background: var(--bg3);
  }
  .frgn-main {
    min-width: 0;
    flex: 1;
  }
  .frgn-name-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .frgn-name { font-weight: 700; color: var(--text); font-size: 12px; }
  .frgn-rate {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 800;
  }
  .frgn-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
  }
  .frgn-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
  }
  .frgn-total-label {
    color: var(--text3);
    font-size: 9px;
    font-weight: 700;
  }
  .frgn-val { font-weight: 700; min-width: 70px; text-align: right; font-size: 11px; }
  .frgn-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
  }
  .frgn-tag.up { color: var(--up); background: rgba(220,38,38,.08); }
  .frgn-tag.dn { color: var(--dn); background: rgba(37,99,235,.08); }
  .frgn-tag.nc { color: var(--text2); background: var(--bg3); }
  .frgn-tag.prog { border: 1px solid rgba(139,92,246,.25); }

  /* ── 급등감지 ── */
  .alert-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
  }
  .alert-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
  }
  .alert-panel-header {
    padding: 10px 14px;
    background: var(--bg3);
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .alert-list-container {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
  }
  .alert-list-container::-webkit-scrollbar { width: 4px; }
  .alert-list-container::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
  
  .alert-panel-header .count {
    background: var(--up);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
  }
  .alert-item {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    gap: 8px;
  }
  .alert-item[data-stock-code],
  .feed-item[data-stock-code] {
    cursor: pointer;
  }
  .alert-item[data-stock-code]:hover,
  .feed-item[data-stock-code]:hover {
    background: var(--bg2);
  }
  .alert-item:last-child { border-bottom: none; }
  .alert-item .icon { font-size: 14px; flex-shrink: 0; }
  .alert-item .info { flex: 1; min-width: 0; }
  .alert-item .aname { font-weight: 700; color: var(--text); }
  .alert-item .adetail { font-size: 11px; color: var(--text2); margin-top: 1px; }
  .alert-item .atime { font-size: 10px; color: var(--text3); flex-shrink: 0; }
  .alert-item .aprice { font-weight: 700; font-size: 12px; flex-shrink: 0; min-width: 70px; text-align: right; }

  .alert-feed-header {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    padding: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .alert-feed {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    transition: border-color .15s;
  }
  .feed-item:hover { border-color: var(--border2); }
  .feed-item.type-limitUp { border-left: 3px solid var(--up); }
  .feed-item.type-vi { border-left: 3px solid #f59e0b; }
  .feed-item.type-surge { border-left: 3px solid #3b82f6; }
  .feed-item.type-power { border-left: 3px solid #8b5cf6; }
  .feed-type {
    flex-shrink: 0;
    min-width: 62px;
    color: var(--text2);
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
  }
  .feed-item.type-limitUp .feed-type { color: var(--up); }
  .feed-item.type-vi .feed-type { color: #d97706; }
  .feed-item.type-surge .feed-type { color: #2563eb; }
  .feed-item.type-power .feed-type { color: #7c3aed; }
  .feed-msg { flex: 1; font-weight: 600; color: var(--text); }
  .feed-price { font-weight: 700; min-width: 80px; text-align: right; }
  .feed-time { font-size: 10px; color: var(--text3); flex-shrink: 0; min-width: 50px; text-align: right; }

  /* 알림 토스트 */
  #toast-container {
    position: fixed;
    top: 56px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
  }
  .toast {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    animation: toastIn .3s ease-out;
    max-width: 320px;
    pointer-events: auto;
  }
  .toast.fade-out { animation: toastOut .3s ease-in forwards; }
  .toast.type-limitUp { border-left: 3px solid #ef4444; }
  .toast.type-surge   { border-left: 3px solid #f97316; }
  .toast.type-power   { border-left: 3px solid #3b82f6; }
  .toast.type-vi      { border-left: 3px solid #a855f7; }
  @keyframes toastIn { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }
  @keyframes toastOut { from { opacity:1; } to { opacity:0; transform: translateY(-10px); } }

  /* 알림 필터 버튼 */
  #alert-filter-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: auto;
  }
  #alert-filter-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 6px;
    border-radius: 8px;
    line-height: 1;
    transition: background .15s;
    -webkit-app-region: no-drag;
  }
  #alert-filter-btn:hover { background: var(--bg3); }
  #alert-filter-btn.active { background: var(--bg3); }
  #alert-filter-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    min-width: 150px;
    z-index: 2000;
  }
  #alert-filter-panel[hidden] { display: none; }
  .af-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 8px;
  }
  .af-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    user-select: none;
  }
  .af-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--gold);
    cursor: pointer;
  }

  .stock-chart-modal[hidden] { display: none; }
  .stock-chart-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
  }
  .stock-chart-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.44);
    backdrop-filter: blur(3px);
  }
  .stock-chart-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(920px, calc(100vw - 24px));
    height: auto;
    max-height: min(640px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
    overflow: hidden;
  }
  .stock-chart-close {
    position: absolute;
    right: 12px;
    top: 10px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.14);
    color: var(--text2);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
  }
  .stock-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 56px 12px 20px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
    background:
      radial-gradient(circle at top left, rgba(220, 38, 38, 0.08), transparent 32%),
      linear-gradient(180deg, #fffaf8 0%, #ffffff 100%);
  }
  .stock-chart-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text3);
    text-transform: uppercase;
  }
  .stock-chart-title-wrap h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.2;
    color: var(--text);
  }
  .stock-chart-title-row {
    margin-top: 6px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
  }
  .stock-chart-code-inline {
    font-size: 13px;
    color: var(--text3);
    font-weight: 500;
    letter-spacing: 0.02em;
  }
  .stock-chart-fundamentals {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text2);
    line-height: 1.5;
  }
  .stock-chart-fundamentals strong {
    color: var(--text);
    font-weight: 700;
  }
  .stock-chart-fundamentals-extra {
    margin-top: 4px;
  }
  .stock-chart-stale-note {
    color: #b45309;
    font-weight: 600;
  }
  .stock-fair-value {
    margin-top: 8px;
    padding: 9px 11px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: rgba(248, 250, 252, 0.88);
    color: var(--text2);
    font-size: 12px;
    line-height: 1.45;
  }
  .fair-main {
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex-wrap: wrap;
  }
  .fair-label {
    color: var(--text3);
    font-size: 11px;
    font-weight: 800;
  }
  .fair-main strong {
    color: var(--text);
    font-size: 17px;
    font-weight: 900;
  }
  .fair-main .up {
    color: var(--up);
    font-weight: 800;
  }
  .fair-main .dn {
    color: var(--down);
    font-weight: 800;
  }
  .fair-range,
  .fair-metrics,
  .fair-note {
    margin-top: 3px;
  }
  .fair-metrics {
    color: var(--text2);
    font-weight: 700;
  }
  .fair-note {
    color: var(--text3);
  }
  .fair-sublabel {
    font-size: 11px;
    font-weight: 500;
    color: var(--text3);
    margin-left: 3px;
  }
  .fair-disclaimer {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--border, rgba(0,0,0,0.08));
    color: var(--text3);
    font-size: 10px;
    line-height: 1.45;
  }
  .fair-source {
    margin-top: 3px;
    color: var(--text3);
    font-size: 10px;
    opacity: 0.75;
  }
  .stock-chart-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 12px;
    color: var(--text3);
    white-space: nowrap;
  }
  .stock-chart-price-row {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
  }
  .stock-chart-price {
    font-size: 28px;
    font-weight: 900;
    line-height: 1;
  }
  .stock-chart-change {
    font-size: 15px;
    font-weight: 800;
  }
  .stock-chart-day-range {
    font-size: 12px;
    color: var(--text3);
  }
  .stock-chart-day-range strong {
    font-weight: 700;
  }
  .stock-chart-code {
    font-size: 12px;
    color: var(--text3);
    letter-spacing: 0.02em;
  }
  .stock-chart-body {
    padding: 16px 20px 20px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .stock-chart-status {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text3);
    font-size: 13px;
  }
  .stock-chart-status[hidden] { display: none; }
  .stock-chart-canvas {
    width: 100%;
    flex: 1 1 auto;
    min-height: 360px;
    position: relative;
  }
  .stock-chart-newhigh-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #dc2626, #f59e0b);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
    letter-spacing: 0.02em;
    line-height: 1.4;
  }
  .stock-chart-tools {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
  }
  .chart-tool-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text2);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.4;
  }
  .chart-tool-btn:hover {
    border-color: #d1d5db;
    color: var(--text);
  }
  .chart-tool-btn.is-active {
    background: #fef2f2;
    border-color: #dc2626;
    color: #dc2626;
  }

  /* 탭 알림 뱃지 */
  .tab-badge {
    display: inline-block;
    background: var(--up);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 0 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
    line-height: 16px;
    margin-left: 4px;
  }

  /* ── 브리핑 ── */
  .brief-holiday-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #fef3c7 0%, #fffbeb 100%);
    border: 1px solid #fbbf24;
    border-radius: 10px;
    font-size: 13px;
  }
  .brief-holiday-icon {
    font-size: 20px;
    line-height: 1;
  }
  .brief-holiday-text {
    font-weight: 800;
    font-size: 15px;
    color: #92400e;
    letter-spacing: 0.02em;
  }
  .brief-holiday-sub {
    color: #b45309;
    font-size: 12px;
    margin-left: 2px;
  }
  .brief-night-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 9px 14px;
    margin-bottom: 10px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: linear-gradient(90deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 8px;
    font-size: 12px;
    color: #475569;
  }
  .brief-night-label {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #0f172a;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
  }
  .brief-night-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
  }
  .brief-night-name {
    color: #475569;
    font-size: 11px;
    font-weight: 700;
  }
  .brief-night-item strong {
    font-weight: 900;
    font-size: 12px;
  }
  .brief-night-item strong.up { color: #dc2626; }
  .brief-night-item strong.dn { color: #2563eb; }
  .brief-night-item strong.nc { color: #64748b; }
  .brief-night-time {
    margin-left: auto;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
  }
  .brief-overview {
    background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 50%, #eef6ff 100%);
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: 0 10px 28px rgba(244, 114, 182, 0.10);
  }
  .brief-market-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    gap: 18px;
    align-items: stretch;
  }
  .brief-market-main-simple {
    display: block;
  }
  .brief-market-copy {
    min-width: 0;
  }
  .brief-kicker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  .brief-kicker {
    font-size: 11px;
    font-weight: 800;
    color: #be123c;
    letter-spacing: .04em;
  }
  .brief-phase-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.06);
  }
  .brief-phase-pill-pre {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border-color: rgba(99, 102, 241, 0.18);
  }
  .brief-phase-pill-live {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.20);
  }
  .brief-phase-pill-post {
    background: rgba(234, 88, 12, 0.12);
    color: #c2410c;
    border-color: rgba(234, 88, 12, 0.18);
  }
  .brief-phase-pill-holiday {
    background: rgba(251, 191, 36, 0.20);
    color: #78350f;
    border-color: rgba(251, 191, 36, 0.40);
  }
  .brief-phase-pre .brief-kicker { color: #4338ca; }
  .brief-phase-post .brief-kicker { color: #c2410c; }
  .brief-phase-holiday .brief-kicker { color: #92400e; }
  .brief-headline {
    font-size: 24px;
    line-height: 1.28;
    font-weight: 900;
    letter-spacing: 0;
    color: #0f172a;
    word-break: keep-all;
  }
  .brief-market-thesis {
    max-width: 780px;
    margin-top: 10px;
    color: #334155;
    font-size: 14px;
    line-height: 1.48;
    font-weight: 800;
    word-break: keep-all;
  }
  .brief-narrative-line {
    margin: 0 0 6px 0;
  }
  .brief-narrative-line:last-child {
    margin-bottom: 0;
  }
  .brief-narrative-line-labeled {
    display: block;
  }
  .brief-narrative-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: 1px;
    min-height: 21px;
    margin-right: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
  }
  .brief-narrative-text {
    min-width: 0;
  }
  .brief-news-row {
    display: flex;
    align-items: flex-start;
  }
  .brief-news-row .brief-narrative-label {
    flex-shrink: 0;
  }
  .brief-news-links {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
  }
  .brief-news-link {
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brief-news-link:hover {
    text-decoration: underline;
  }
  .brief-explain {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #0f172a;
    max-width: 100%;
  }
  .brief-explain-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
  }
  .brief-explain-label {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    color: #475569;
    background: rgba(15, 23, 42, 0.06);
  }
  .brief-explain-head strong {
    font-size: 13px;
    font-weight: 900;
  }
  .brief-explain-rows {
    display: grid;
    gap: 4px;
    margin-top: 5px;
  }
  .brief-explain-row {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 5px 0;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
  }
  .brief-explain-row-primary {
    border-top: none;
    padding-top: 0;
    padding-bottom: 6px;
  }
  .brief-explain-row-label {
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
  }
  .brief-explain-row-text {
    min-width: 0;
    font-size: 12px;
    line-height: 1.42;
    font-weight: 750;
    color: #334155;
  }
  .brief-explain-row-primary .brief-explain-row-text {
    color: #0f172a;
    font-size: 13px;
    font-weight: 900;
  }
  .brief-explain-up {
    border-color: rgba(220, 38, 38, 0.18);
    background: rgba(254, 242, 242, 0.70);
  }
  .brief-explain-up .brief-explain-head strong { color: #b91c1c; }
  .brief-explain-dn {
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(239, 246, 255, 0.74);
  }
  .brief-explain-dn .brief-explain-head strong { color: #1d4ed8; }
  .brief-explain-warn {
    border-color: rgba(217, 119, 6, 0.20);
    background: rgba(255, 251, 235, 0.76);
  }
  .brief-explain-warn .brief-explain-head strong { color: #b45309; }
  .brief-watch-row {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brief-watch-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.78);
    line-height: 1.2;
  }
  .brief-watch-chip-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: none;
  }
  .brief-watch-chip-value {
    color: #0f172a;
    font-weight: 700;
  }
  .brief-watch-chip.tone-up {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.18);
  }
  .brief-watch-chip.tone-up .brief-watch-chip-value { color: #b91c1c; }
  .brief-watch-chip.tone-dn {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.18);
  }
  .brief-watch-chip.tone-dn .brief-watch-chip-value { color: #1d4ed8; }
  .brief-watch-chip.tone-warn {
    background: rgba(234, 88, 12, 0.10);
    border-color: rgba(234, 88, 12, 0.24);
  }
  .brief-watch-chip.tone-warn .brief-watch-chip-value { color: #c2410c; }
  .brief-watch-chip.tone-info {
    background: rgba(99, 102, 241, 0.10);
    border-color: rgba(99, 102, 241, 0.22);
  }
  .brief-watch-chip.tone-info .brief-watch-chip-value { color: #4338ca; }
  .brief-watch-chip.is-clickable {
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  }
  .brief-watch-chip.is-clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.10);
    border-color: rgba(15, 23, 42, 0.18);
  }
  .brief-watch-chip.is-clickable:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
  }
  .brief-subline {
    margin-top: 8px;
    font-size: 12px;
    color: #475569;
    font-weight: 700;
  }
  .brief-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
  }
  .brief-metric {
    min-width: 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(2px);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  }
  .brief-metric.is-clickable {
    cursor: pointer;
  }
  .brief-metric.is-clickable:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 23, 42, 0.18);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  }
  .brief-metric.is-clickable:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
  }
  .brief-metric-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 800;
  }
  .brief-metric strong {
    color: #0f172a;
    font-size: 15px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brief-metric-sub {
    color: #475569;
    font-size: 11px;
    font-weight: 700;
  }
  .brief-metric.is-up strong,
  .brief-metric.is-up .brief-metric-sub { color: #dc2626; }
  .brief-metric.is-down strong,
  .brief-metric.is-down .brief-metric-sub { color: #2563eb; }
  .brief-focus-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 14px;
    margin-bottom: 14px;
  }
  .brief-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
  }
  .brief-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  }
  .brief-card-main,
  .brief-card-leaders {
    position: relative;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  }
  .brief-card-main::before,
  .brief-card-leaders::before {
    content: "";
    display: block;
    height: 3px;
  }
  .brief-card-main::before {
    background: linear-gradient(90deg, #0f766e 0%, #2563eb 58%, #f59e0b 100%);
  }
  .brief-card-leaders::before {
    background: linear-gradient(90deg, #b45309 0%, #0f766e 55%, #0f172a 100%);
  }
  .brief-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
  }
  .brief-card-main .brief-card-head {
    background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
  }
  .brief-card-leaders .brief-card-head {
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
  }
  .brief-card-head span {
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
  }
  .brief-card-main .brief-card-head span {
    color: #0f766e;
  }
  .brief-card-leaders .brief-card-head span {
    color: #92400e;
  }
  .brief-card-head small {
    color: var(--text3);
    font-size: 10px;
    font-weight: 800;
  }
  .brief-card-main .brief-card-head small,
  .brief-card-leaders .brief-card-head small {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.76);
  }
  .brief-sector-stack,
  .brief-stock-list,
  .brief-event-list {
    display: flex;
    flex-direction: column;
  }
  .brief-sector-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 66px;
    gap: 10px;
    align-items: center;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
  }
  .brief-sector-item:first-child {
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.10) 0%, rgba(37, 99, 235, 0.06) 58%, rgba(255, 255, 255, 0) 100%);
  }
  .brief-card-leaders .brief-stock-item:first-child {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(20, 184, 166, 0.06) 68%, rgba(255, 255, 255, 0) 100%);
  }
  .brief-sector-item:last-child,
  .brief-stock-item:last-child,
  .brief-event-row:last-child { border-bottom: none; }
  .brief-rank {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
  }
  .brief-sector-item:first-child .brief-rank {
    background: linear-gradient(135deg, #0f766e 0%, #2563eb 100%);
    box-shadow: 0 6px 14px rgba(15, 118, 110, 0.18);
  }
  .brief-sector-title,
  .brief-stock-name {
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brief-sector-meta,
  .brief-stock-meta {
    margin-top: 3px;
    color: var(--text3);
    font-size: 10px;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brief-sector-score {
    color: var(--text2);
    font-size: 11px;
    font-weight: 800;
    text-align: right;
  }
  .brief-sector-item:first-child .brief-sector-title,
  .brief-card-leaders .brief-stock-item:first-child .brief-stock-name {
    color: #0f172a;
  }
  .brief-sector-item:first-child .brief-sector-score {
    color: #0f766e;
  }
  .brief-stock-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 10px;
    align-items: center;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  .brief-stock-item:hover {
    background: #f8fafc;
  }
  .brief-stock-numbers {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text2);
  }
  .brief-card-leaders .brief-stock-item:first-child .brief-stock-numbers {
    color: #92400e;
  }
  .brief-events {
    margin-bottom: 14px;
  }
  .brief-event-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px;
  }
  .brief-event-strip .brief-metric {
    background: #f8fafc;
    border-color: var(--border);
  }
  .brief-event-strip .brief-metric-label,
  .brief-event-strip .brief-metric span:last-child {
    color: var(--text3);
  }
  .brief-event-strip .brief-metric strong {
    color: var(--text);
  }
  .brief-evt-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px;
  }
  .brief-evt-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 8px;
    min-height: 76px;
  }
  .brief-evt-tile.is-active {
    background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
    border-color: rgba(234, 88, 12, 0.20);
  }
  .brief-evt-tile-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 4px 8px;
    column-gap: 8px;
  }
  .brief-evt-tile-label {
    grid-column: 1;
    grid-row: 1;
    font-size: 10px;
    font-weight: 800;
    color: var(--text3);
  }
  .brief-evt-tile-count {
    grid-column: 1;
    grid-row: 2;
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
  }
  .brief-evt-tile.is-active .brief-evt-tile-count {
    color: #c2410c;
  }
  .brief-evt-tile-sub {
    grid-column: 2;
    grid-row: 2;
    font-size: 10px;
    font-weight: 800;
    color: var(--text3);
    align-self: end;
  }
  .brief-evt-tile-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .brief-evt-empty {
    font-size: 10px;
    font-weight: 700;
    color: var(--text3);
    padding: 2px 0;
  }
  .brief-evt-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 800;
    color: var(--text);
    cursor: pointer;
    max-width: 100%;
    transition: background .15s ease, border-color .15s ease;
  }
  .brief-evt-chip:hover {
    background: #f1f5f9;
    border-color: rgba(15, 23, 42, 0.18);
  }
  .brief-evt-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
  }
  .brief-evt-chip-rate {
    font-size: 10px;
    font-weight: 900;
  }
  .brief-evt-chip-rate.up { color: #dc2626; }
  .brief-evt-chip-rate.dn { color: #2563eb; }
  .brief-evt-chip-rate.nc { color: #64748b; }
  .brief-evt-chip-tag {
    font-size: 9px;
    font-weight: 800;
    color: #475569;
    background: #e2e8f0;
    padding: 1px 5px;
    border-radius: 4px;
  }
  .brief-evt-chip.more {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
    cursor: default;
  }
  .brief-evt-chip-static {
    cursor: default;
  }
  .brief-evt-chip-static:hover {
    background: #ffffff;
    border-color: var(--border);
  }
  @media (max-width: 720px) {
    .brief-evt-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  .brief-event-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 70px;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    font-size: 12px;
  }
  .brief-event-row span {
    color: var(--text3);
    font-size: 10px;
    font-weight: 800;
  }
  .brief-event-row strong {
    min-width: 0;
    color: var(--text);
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brief-event-row em {
    color: var(--text2);
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    text-align: right;
  }
  .brief-empty {
    padding: 24px 14px;
    color: var(--text3);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
  }
  .brief-more {
    margin-bottom: 16px;
  }
  .brief-more summary {
    cursor: pointer;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    color: var(--text2);
    font-size: 12px;
    font-weight: 900;
  }
  .brief-more summary::-webkit-details-marker {
    display: none;
  }
  .brief-more summary::after {
    content: "+";
    float: right;
    color: var(--text3);
    font-weight: 900;
  }
  .brief-more[open] summary {
    margin-bottom: 12px;
  }
  .brief-more[open] summary::after {
    content: "-";
  }
  .brief-more-body {
    display: block;
  }
  .brief-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 14px;
    margin-bottom: 16px;
  }
  .brief-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .brief-eod-main {
    border-color: rgba(234, 88, 12, 0.22);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  }
  .brief-eod-main > .brief-panel-header {
    background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  }
  .brief-panel-header {
    padding: 10px 14px;
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .brief-time {
    font-size: 10px;
    color: var(--text3);
    font-weight: 500;
  }
  .leader-list, .brief-list { display: flex; flex-direction: column; }
  .leader-row {
    display: grid;
    grid-template-columns: 34px 1fr 74px 86px;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
  }
  .leader-row:last-child, .brief-row:last-child { border-bottom: none; }
  .leader-rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--gold);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
  }
  .leader-title { font-weight: 900; color: var(--text); }
  .leader-sub {
    margin-top: 2px;
    color: var(--text3);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .leader-score {
    text-align: right;
    font-size: 11px;
    color: var(--text2);
    font-weight: 700;
  }
  .leader-amt {
    text-align: right;
    font-size: 11px;
    color: var(--text2);
    font-weight: 700;
  }
  .brief-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
  }
  .brief-name { font-weight: 800; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brief-meta { color: var(--text3); font-size: 10px; margin-top: 1px; }
  .alert-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px 14px;
  }
  .alert-summary-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    background: var(--bg2);
  }
  .alert-summary-item .lbl { font-size: 11px; color: var(--text2); font-weight: 700; }
  .alert-summary-item .val { margin-top: 4px; font-size: 20px; font-weight: 900; color: var(--text); }
  .sector-history-chart {
    height: 260px;
    padding: 6px 4px 4px;
  }
  .sector-history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text2);
  }
  .sector-history-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
  }
  .sector-history-legend i {
    width: 10px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
  }
  .sector-calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 14px 14px;
  }
  .sector-calendar-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg2);
    overflow: hidden;
    min-width: 0;
  }
  .sector-calendar-date {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 10px;
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
  }
  .sector-calendar-date strong {
    font-size: 13px;
    color: var(--text);
  }
  .sector-calendar-date span {
    font-size: 10px;
    color: var(--text3);
    font-weight: 700;
  }
  .sector-calendar-sectors {
    display: flex;
    flex-direction: column;
  }
  .sector-calendar-sector {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 6px;
    align-items: center;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    min-width: 0;
  }
  .sector-calendar-rank {
    color: var(--text3);
    font-weight: 900;
  }
  .sector-calendar-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
    color: var(--text);
  }
  .sector-calendar-sector strong {
    font-size: 11px;
  }
  .sector-calendar-stocks {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
  }
  .sector-calendar-stock {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    padding: 3px 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    font-weight: 800;
    color: var(--text2);
  }
  .sector-calendar-stock:hover {
    border-color: var(--gold);
    color: var(--text);
  }
  .sector-calendar-stock span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sector-calendar-stock strong {
    flex-shrink: 0;
  }
  .sector-calendar-news {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 10px 10px;
  }
  .sector-calendar-news a {
    color: var(--text2);
    font-size: 10px;
    line-height: 1.35;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .sector-calendar-news a:hover {
    color: var(--gold);
    text-decoration: underline;
  }
  /* "테마 캘린더" 탭 본문 */
  .calendar-pane-intro {
    padding: 4px 2px 12px;
  }
  .calendar-pane-title {
    font-size: 17px;
    font-weight: 900;
    color: var(--text);
    margin: 0 0 4px;
  }
  .calendar-pane-desc {
    font-size: 12px;
    color: var(--text3);
    line-height: 1.5;
    margin: 0;
  }
  .calendar-pane-note {
    font-size: 11px;
    color: var(--text3);
    line-height: 1.5;
    margin: 10px 2px 0;
  }
  /* 브리핑 상세 안의 캘린더 요약 */
  .calendar-brief-rows {
    display: flex;
    flex-direction: column;
  }
  .calendar-brief-row {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
  }
  .calendar-brief-date {
    color: var(--text3);
    font-weight: 800;
  }
  .calendar-brief-lead {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
    color: var(--text);
  }
  .calendar-brief-more {
    display: block;
    text-align: center;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 800;
    color: var(--gold);
    cursor: pointer;
    user-select: none;
  }
  .calendar-brief-more:hover {
    background: var(--bg3);
  }
  .report-summary {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .report-summary-line {
    font-size: 12px;
    color: var(--text);
    font-weight: 700;
    line-height: 1.5;
  }
  .report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
  }
  .report-table th {
    text-align: right;
    padding: 7px 8px;
    color: var(--text3);
    background: var(--bg3);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
  }
  .report-table th:first-child,
  .report-table td:first-child { text-align: left; }
  .report-table td {
    text-align: right;
    padding: 7px 8px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
  }
  .timeline-row {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
  }
  .timeline-hour { color: var(--text3); font-weight: 800; }
  .timeline-tags { display: flex; flex-wrap: wrap; gap: 5px; }
  .timeline-tag {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 6px;
    background: var(--bg2);
    font-weight: 700;
  }
  .candidate-row {
    display: grid;
    grid-template-columns: 44px 1fr 64px 78px;
    gap: 10px;
    align-items: start;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
  }
  .candidate-score {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--text);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 12px;
  }
  .candidate-title { font-weight: 900; color: var(--text); }
  .candidate-reasons {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .candidate-tag {
    font-size: 10px;
    border-radius: 5px;
    padding: 2px 6px;
    background: var(--bg3);
    color: var(--text2);
    font-weight: 700;
  }
  .candidate-tag.risk {
    color: var(--dn);
    border: 1px solid rgba(37,99,235,.25);
    background: rgba(37,99,235,.05);
  }
  .strategy-note {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    color: var(--text3);
    font-size: 11px;
    line-height: 1.5;
  }
  @media (max-width: 900px) {
    .idx-detail-grid { grid-template-columns: 1fr; }
    .sector-calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .brief-market-main {
      grid-template-columns: 1fr;
    }
    .brief-focus-grid,
    .brief-grid { grid-template-columns: 1fr; }
    .brief-metrics,
    .brief-event-strip {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .leader-row {
      grid-template-columns: 30px minmax(0, 1fr) 56px 64px;
      gap: 8px;
    }
    .leader-score,
    .leader-amt {
      font-size: 10px;
    }
    .candidate-row {
      grid-template-columns: 40px minmax(0, 1fr) 58px 42px;
      gap: 8px;
    }
    .candidate-amount {
      font-size: 10px;
    }
  }

  @media (max-width: 720px) {
    #tabs-shell {
      padding: 0 12px;
    }
    #tabs {
      gap: 0;
      overflow-x: auto;
      overflow-y: hidden;
      white-space: nowrap;
      scrollbar-width: none;
      scroll-behavior: smooth;
    }
    #tabs::-webkit-scrollbar {
      display: none;
    }
    #tabs-shell.can-scroll-left #tabs-prev,
    #tabs-shell.can-scroll-right #tabs-more {
      display: flex;
    }
    .tab {
      flex: 0 0 auto;
      padding: 10px 12px;
      font-size: 12px;
    }
    #content {
      --content-pad-y: 12px;
      padding-left: 12px;
      padding-right: 12px;
      padding-bottom: calc(var(--content-pad-y) + var(--mobile-ad-space));
    }
    .sectors-grid {
      grid-template-columns: 1fr;
      gap: 10px;
    }
    .sector-card,
    .idx-card,
    .alert-panel,
    .brief-card,
    .brief-panel {
      border-radius: 8px;
    }
    .brief-overview {
      padding: 16px;
    }
    .brief-headline {
      font-size: 20px;
    }
    .brief-market-thesis {
      font-size: 13px;
    }
    .brief-narrative-label {
      min-height: 19px;
      margin-right: 6px;
    }
    .brief-explain {
      padding: 11px 12px;
    }
    .brief-explain-row {
      grid-template-columns: 1fr;
      gap: 3px;
      padding: 7px 0;
    }
    .brief-explain-row-label {
      font-size: 9px;
    }
    .brief-explain-row-text {
      font-size: 12px;
      line-height: 1.45;
    }
    .brief-watch-chip {
      font-size: 11px;
      padding: 4px 9px;
    }
    .brief-watch-chip-label {
      font-size: 9px;
    }
    .brief-sector-item {
      grid-template-columns: 28px minmax(0, 1fr) 58px;
      padding: 11px 12px;
    }
    .brief-stock-item,
    .brief-card-head,
    .brief-event-row {
      padding-left: 12px;
      padding-right: 12px;
    }
    .stock-col-header,
    .stock-row {
      grid-template-columns: 1fr 72px 58px 56px;
      padding-left: 12px;
      padding-right: 12px;
    }
    .amount-col-header,
    .amount-row {
      grid-template-columns: minmax(0, 1fr) 72px 58px 68px;
      gap: 8px;
      padding-left: 12px;
      padding-right: 12px;
    }
    .amount-name {
      font-size: 13px;
    }
    .amount-price {
      font-size: 13px;
    }
    .amount-rate,
    .amount-amt {
      font-size: 11px;
    }
    .idx-card-top {
      padding: 14px 14px 10px;
    }
    .idx-breadth {
      width: 100%;
      justify-content: flex-start;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .idx-breadth::-webkit-scrollbar {
      display: none;
    }
    .idx-value {
      font-size: 24px;
    }
    .idx-investor-row {
      gap: 10px;
      padding: 10px 14px;
      flex-wrap: wrap;
    }
    .idx-chart-wrap {
      height: 260px;
    }
    .range-row {
      gap: 10px;
      padding: 12px 12px;
    }
    .range-header {
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 10px;
    }
    .range-info {
      min-width: 0;
    }
    .range-name-row {
      gap: 6px;
    }
    .range-bar-wrap {
      gap: 6px;
    }
    .range-pct-col {
      align-items: flex-end;
      text-align: right;
      min-width: 0;
    }
    .range-bar-track {
      height: 16px;
    }
    .range-labels {
      font-size: 9px;
      gap: 10px;
    }
    .stock-chart-panel {
      width: calc(100vw - 24px);
      height: auto;
      max-height: calc(100vh - 32px);
      border-radius: 16px;
    }
    .stock-chart-canvas {
      height: 280px;
      flex: 0 0 280px;
      min-height: 280px;
    }
    .stock-chart-tools {
      margin-bottom: 4px;
    }
    .chart-tool-btn {
      padding: 3px 8px;
      font-size: 10px;
    }
    .stock-chart-head {
      padding: 14px 50px 10px 12px;
      flex-direction: column;
      gap: 10px;
    }
    .stock-chart-meta {
      align-items: flex-start;
      width: 100%;
      white-space: normal;
    }
    .stock-chart-price-row {
      width: 100%;
      justify-content: flex-start;
      flex-wrap: wrap;
      gap: 6px 10px;
    }
    .stock-chart-title-wrap h3 {
      font-size: 20px;
    }
    .stock-chart-fundamentals {
      margin-top: 6px;
      font-size: 11px;
    }
    .stock-chart-price {
      font-size: 22px;
    }
    .stock-chart-change {
      font-size: 13px;
    }
    .stock-chart-code {
      font-size: 11px;
    }
    .stock-chart-body {
      padding: 8px 2px 8px 4px;
    }
    .stock-chart-close {
      right: 10px;
      top: 10px;
      width: 40px;
      height: 40px;
      font-size: 28px;
      border-radius: 12px;
    }
  }

  @media (max-width: 520px) {
    .sector-calendar-grid { grid-template-columns: 1fr; }
  }

  @media (max-width: 420px) {
    .brief-metrics {
      grid-template-columns: 1fr;
    }
    .brief-metric {
      padding: 10px 11px;
    }
    .stock-chart-panel {
      width: calc(100vw - 16px);
      height: auto;
      max-height: calc(100vh - 24px);
      border-radius: 14px;
    }
    .stock-chart-canvas {
      height: 240px;
      flex: 0 0 240px;
      min-height: 240px;
    }
    .stock-chart-head {
      padding: 12px 48px 8px 10px;
    }
    .stock-chart-title-wrap h3 {
      font-size: 18px;
    }
    .stock-chart-price {
      font-size: 20px;
    }
    .stock-chart-change {
      font-size: 12px;
    }
    .stock-chart-body {
      padding: 6px 1px 6px 2px;
    }
  }

  /* 폰 가로모드: 헤더를 가로로 배치하고 차트 높이를 확보 */
  @media (max-height: 500px) and (orientation: landscape) {
    .stock-chart-panel {
      width: min(900px, calc(100vw - 16px));
      max-height: calc(100vh - 16px);
      flex-direction: row;
      align-items: stretch;
      border-radius: 12px;
    }
    .stock-chart-head {
      flex: 0 0 220px;
      flex-direction: column;
      border-bottom: none;
      border-right: 1px solid var(--border);
      padding: 14px 14px 14px 14px;
      overflow-y: auto;
    }
    .stock-chart-meta {
      align-items: flex-start;
      white-space: normal;
    }
    .stock-chart-price-row {
      justify-content: flex-start;
      flex-wrap: wrap;
      gap: 4px 8px;
    }
    .stock-chart-body {
      flex: 1 1 auto;
      min-width: 0;
      padding: 8px 8px 8px 8px;
      display: flex;
      flex-direction: column;
    }
    .stock-chart-canvas {
      flex: 1 1 auto;
      min-height: 0;
      height: auto;
    }
    .stock-chart-close {
      top: 8px;
      right: 8px;
    }
  }

  @media (max-width: 640px) {
    #topbar {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto auto;
      grid-template-areas:
        "logo . alert status"
        "kospi kosdaq . ."
        "links links links links";
      align-items: center;
      gap: 8px 10px;
      padding: calc(10px + var(--safe-top)) 12px 8px;
    }
    #alert-filter-wrap {
      grid-area: alert;
      margin-left: 0;
    }
    .logo {
      grid-area: logo;
      margin-right: 0;
      font-size: 14px;
      letter-spacing: 0;
      min-width: 0;
    }
    .index-chip {
      width: 218px;
      max-width: 100%;
      padding: 5px 10px;
      gap: 6px;
      justify-content: center;
      justify-self: start;
    }
    .index-chip:nth-of-type(1) {
      grid-area: kospi;
    }
    .index-chip:nth-of-type(2) {
      grid-area: kosdaq;
    }
    .index-chip .lbl {
      font-size: 10px;
    }
    .index-chip .val {
      font-size: 12px;
    }
    .index-chip .chg {
      font-size: 10px;
    }
    .brief-night-strip {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px 10px;
      padding: 10px 12px;
    }
    .brief-night-item {
      min-width: 0;
      gap: 5px;
      white-space: nowrap;
    }
    .brief-night-name {
      flex: 0 0 auto;
    }
    .brief-night-time {
      margin-left: 0;
      margin-top: 0;
      line-height: 1.2;
      white-space: nowrap;
    }
    #status-wrap {
      grid-area: status;
      margin-left: 0;
      justify-self: end;
      gap: 4px;
      white-space: nowrap;
    }
    .meta-links {
      grid-area: links;
      width: 100%;
      margin-left: 0;
      padding-top: 0;
      gap: 8px;
      flex-wrap: wrap;
    }
    .meta-links a {
      font-size: 10px;
    }
  }

  @media (max-width: 560px) {
    #topbar {
      gap: 6px 8px;
    }
    .index-chip {
      width: min(218px, calc(50vw - 18px));
      max-width: calc(50vw - 18px);
      padding: 4px 7px;
      gap: 4px;
    }
    .index-chip .lbl {
      font-size: 10px;
    }
    .index-chip .val {
      font-size: 12px;
    }
    .index-chip .chg {
      font-size: 10px;
    }
    .brief-night-strip {
      column-gap: 10px;
      row-gap: 7px;
    }
    .brief-night-item strong {
      font-size: 11px;
    }
    .meta-links {
      gap: 8px;
      flex-wrap: wrap;
    }
    .meta-links a {
      font-size: 10px;
    }
    .stock-col-header {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 64px 56px 58px;
      padding-left: 12px;
      padding-right: 12px;
      gap: 6px;
      font-size: 9px;
    }
    .stock-row {
      grid-template-columns: minmax(0, 1fr) 64px 56px 58px;
      row-gap: 2px;
      column-gap: 6px;
    }
    .sprice,
    .srate,
    .samt {
      font-size: 10px;
    }
    .amount-col-header {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 62px 54px 56px;
      padding: 4px 8px;
      gap: 4px;
      font-size: 10px;
    }
    .amount-list {
      gap: 0;
    }
    .amount-row {
      grid-template-columns: minmax(0, 1fr) 62px 54px 56px;
      gap: 4px;
      padding: 6px 8px;
      border-radius: 0;
      border: none;
      border-bottom: 1px solid var(--border);
      box-shadow: none;
      background: transparent;
    }
    .amount-row:last-child {
      border-bottom: none;
    }
    .amount-info {
      padding-left: 6px;
      gap: 2px;
    }
    .amount-name-line {
      flex-wrap: wrap;
      row-gap: 2px;
      column-gap: 4px;
    }
    .amount-name {
      font-size: 13px;
      font-weight: 700;
      flex: 1 1 100%;
      min-width: 0;
    }
    .amount-sector-tag {
      font-size: 9px;
      padding: 1px 4px;
    }
    .supply-star-badge {
      height: 14px;
      font-size: 9px;
      padding: 0 3px;
    }
    .amount-price {
      font-size: 12px;
    }
    .amount-rate,
    .amount-amt {
      font-size: 11px;
    }
    .amount-metric {
      justify-content: flex-end;
    }
    .amount-metric-label {
      display: none;
    }
    .flow-section {
      margin-bottom: 12px;
    }
    .flow-title {
      align-items: flex-start;
      flex-direction: column;
      gap: 2px;
      line-height: 1.3;
      font-size: 13px;
      padding-bottom: 6px;
    }
    .flow-title span {
      font-size: 10px !important;
    }
    .flow-summary-grid {
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      margin-bottom: 8px;
    }
    .flow-summary-card {
      padding: 8px 10px;
      border-radius: 6px;
    }
    .flow-summary-card .card-label {
      font-size: 10px;
      margin-bottom: 4px;
    }
    .flow-summary-row {
      padding: 2px 0;
      font-size: 11px;
    }
    .flow-summary-row .label {
      font-size: 10px;
    }
    .flow-table-wrap {
      padding: 4px 0 0;
    }
    .flow-tbl {
      min-width: 520px;
      font-size: 10px;
    }
    .flow-tbl th,
    .flow-tbl td {
      padding: 5px 4px;
      font-size: 10px;
    }
    .flow-tbl th:first-child,
    .flow-tbl td:first-child {
      position: sticky;
      left: 0;
      background: #fff;
      z-index: 1;
    }
    .flow-table-wrap-wide {
      display: none;
    }
    .frgn-rank-list {
      gap: 4px;
    }
    .frgn-rank-list-mobile {
      display: flex;
      gap: 4px;
      margin-top: 4px;
    }
    .alert-grid,
    .alert-summary {
      grid-template-columns: 1fr;
      gap: 10px;
    }
    .alert-panel-header {
      padding: 8px 10px;
      font-size: 12px;
    }
    .frgn-row {
      padding: 6px 8px;
      gap: 8px;
      border-radius: 6px;
      box-shadow: none;
    }
    .frgn-name {
      font-size: 12px;
    }
    .frgn-name-line {
      gap: 6px;
    }
    .frgn-tags {
      gap: 3px;
      margin-top: 3px;
    }
    .frgn-tag {
      font-size: 9px;
      padding: 1px 4px;
    }
    .frgn-total-label {
      display: none;
    }
    .frgn-val {
      min-width: 52px;
      font-size: 10px;
    }
    .idx-chart-wrap {
      height: 220px;
    }
    .range-header {
      grid-template-columns: minmax(0, 1fr) auto;
    }
    .range-name-row {
      flex-wrap: wrap;
      align-items: baseline;
      gap: 4px 8px;
    }
    .range-name {
      font-size: 13px;
      white-space: nowrap;
    }
    .range-amt {
      font-size: 11px;
    }
    .range-labels {
      display: grid;
      grid-template-columns: 1fr 1fr;
      align-items: start;
      gap: 6px 10px;
      font-size: 9px;
      line-height: 1.35;
    }
    .range-labels span:last-child {
      text-align: right;
    }
    .range-pct-col {
      min-width: 52px;
    }
    .range-pct-val {
      font-size: 15px;
    }
    .range-cur-price {
      font-size: 13px;
    }
  }

  body.native-app .meta-links {
    display: flex;
  }

  @media (max-width: 560px) {
    body.native-app #status-wrap {
      gap: 4px;
    }
  }

  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    #content {
      padding-bottom: calc(var(--content-pad-y) + var(--mobile-ad-space) + env(safe-area-inset-bottom));
    }
  }

  /* ── 시장분석 (52주 신고가/신저가) ── */
  .market-section { margin-bottom: 20px; }
  .market-section-title {
    font-size: 14px; font-weight: 800; color: var(--text);
    padding: 0 0 10px; display: flex; align-items: center; gap: 8px;
  }
  /* ── 일일 변동폭 ── */
  .range-list { display: flex; flex-direction: column; gap: 8px; }
  .range-row {
    display: flex; flex-direction: column;
    gap: 8px; padding: 10px 14px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow);
  }
  .range-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }
  .range-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .range-name-row {
    display: flex; align-items: baseline; gap: 8px;
    min-width: 0;
  }
  .range-name { font-size: 14px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
  .range-amt { font-size: 10px; color: var(--text3); }
  .range-pct-label { font-size: 10px; color: var(--text3); letter-spacing: 0.5px; }
  .range-bar-wrap { display: flex; flex-direction: column; gap: 4px; }
  .range-bar-track {
    position: relative; height: 18px;
    background: var(--bg3, #f0f0f0); border-radius: 9px; overflow: visible;
  }
  .range-zero {
    position: absolute; top: -2px; bottom: -2px; width: 1px;
    background: var(--text3); opacity: .4;
  }
  .range-bar {
    position: absolute; top: 2px; bottom: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 7px; opacity: .7; min-width: 4px;
  }
  .range-cur {
    position: absolute; top: 50%; width: 10px; height: 10px;
    background: var(--text); border: 2px solid #fff;
    border-radius: 50%; transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgba(0,0,0,.25); z-index: 1;
  }
  .range-labels {
    display: flex; justify-content: space-between;
    font-size: 10px; color: var(--text3); padding: 0 2px;
  }
  .range-labels .dn { color: var(--dn); }
  .range-labels .up { color: var(--up); }
  .range-pct-col { display: flex; flex-direction: column; align-items: flex-end; gap: 0; line-height: 1.15; }
  .range-pct-val { font-size: 18px; font-weight: 800; color: #8b5cf6; }
  .range-cur-price { font-size: 15px; font-weight: 800; white-space: nowrap; }

  /* ── 로딩 ── */
  .loading {
    text-align: center;
    color: var(--text3);
    padding: 60px 20px;
    font-size: 14px;
  }
  .spinner {
    display: inline-block;
    width: 24px; height: 24px;
    border: 2px solid var(--border2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin-bottom: 10px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ── 뉴스 ── */
  .news-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 4px; }
  .news-row {
    background: #fff;
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .news-row:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
  .news-row.is-disclosure {
    border-color: #f3c66d;
  }
  .native-news-ad-slot {
    /* 네이티브 광고 카드 높이: MediaView 120dp + 상하 패딩 16dp (MainActivity dp(136) 과 동기화) */
    min-height: 136px;
    background: #fff;
    border: 1px solid var(--border2);
    border-radius: 8px;
    overflow: hidden;
  }
  .news-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--text2); }
  .news-time {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }
  .news-provider {
    background: #dbeafe;
    color: #1e3a8a;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.25;
  }
  .news-provider.is-disclosure {
    background: #fef3c7;
    color: #78350f;
    border-color: #f59e0b;
  }
  .news-title {
    font-size: 13px; line-height: 1.4;
    color: var(--text); font-weight: 500;
    text-decoration: none;
    display: block;
    cursor: pointer;
  }
  .news-title:hover { color: var(--gold); text-decoration: underline; }
  .news-chips { display: flex; flex-wrap: wrap; gap: 4px; }
  .news-chip {
    background: rgba(212,175,55,.10);
    color: #8b6914;
    border: 1px solid rgba(212,175,55,.25);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
  }
  .empty { text-align: center; color: var(--text3); padding: 40px 16px; font-size: 13px; }

  /* ── 공지 모달 ── */
  .notice-modal[hidden] { display: none; }
  .notice-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: notice-fade .18s ease-out;
  }
  .notice-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
  }
  .notice-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    animation: notice-pop .22s cubic-bezier(.2,.8,.2,1.05);
  }
  .notice-head {
    padding: 20px 22px 8px;
    background: linear-gradient(135deg, #fff7ed 0%, #ffe4e6 55%, #eff6ff 100%);
  }
  .notice-title {
    font-size: 17px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
    word-break: keep-all;
  }
  .notice-body {
    padding: 14px 22px 6px;
    font-size: 13px;
    line-height: 1.6;
    color: #334155;
    white-space: pre-line;
    word-break: keep-all;
    max-height: 50vh;
    overflow-y: auto;
  }
  .notice-actions {
    display: flex;
    gap: 8px;
    padding: 16px 18px 18px;
    justify-content: flex-end;
  }
  .notice-btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
  }
  .notice-btn:active { transform: scale(.97); }
  .notice-btn-ghost {
    background: transparent;
    color: #64748b;
  }
  .notice-btn-ghost:hover { color: #0f172a; }
  .notice-btn-primary {
    background: #0f172a;
    color: #fff;
  }
  .notice-btn-primary:hover { opacity: .9; }
  @keyframes notice-fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes notice-pop {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  @media (max-width: 480px) {
    .notice-card { max-width: 100%; }
    .notice-head { padding: 18px 18px 6px; }
    .notice-body { padding: 12px 18px 4px; }
    .notice-actions { padding: 14px 14px 16px; }
  }

  /* ── 온보딩 오버레이 ── */
  #onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    animation: ob-fade-in .25s ease-out;
  }
  @keyframes ob-fade-in { from { opacity: 0; } to { opacity: 1; } }

  .ob-card {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 360px;
    padding: 56px 28px 28px;
    box-shadow: 0 32px 64px rgba(15, 23, 42, 0.24);
    position: relative;
    animation: ob-pop .28s cubic-bezier(.2,.8,.2,1.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
  }
  @keyframes ob-pop {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
  }

  .ob-icon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 18px;
  }
  .ob-title {
    font-size: 18px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.35;
    word-break: keep-all;
    margin-bottom: 12px;
  }
  .ob-body {
    font-size: 13px;
    line-height: 1.7;
    color: #475569;
    word-break: keep-all;
    margin-bottom: 24px;
    white-space: pre-line;
  }
  .ob-body.warning {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 14px 16px;
    color: #78350f;
    font-size: 12px;
    text-align: left;
  }
  .ob-dots {
    display: flex;
    gap: 7px;
    margin-bottom: 24px;
  }
  .ob-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background .2s, transform .2s;
  }
  .ob-dot.active {
    background: #d97706;
    transform: scale(1.25);
  }
  .ob-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .ob-btn {
    border: 0;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    font-family: inherit;
  }
  .ob-btn:active { transform: scale(.97); }
  .ob-btn-ghost {
    background: #f1f5f9;
    color: #64748b;
    flex: 0 0 auto;
  }
  .ob-btn-ghost:hover { background: #e2e8f0; }
  .ob-btn-primary {
    background: #0f172a;
    color: #fff;
    flex: 1;
  }
  .ob-btn-primary:hover { opacity: .88; }
  .ob-btn-primary.agree {
    background: #d97706;
  }
  .ob-skip {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: 0;
    font-size: 12px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 6px;
    font-family: inherit;
    font-weight: 600;
  }
  .ob-skip:hover { color: #475569; }
  .ob-privacy-link {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    text-decoration: underline;
    margin-bottom: 12px;
    cursor: pointer;
  }
  .ob-privacy-link:hover { color: #475569; }
  @media (max-width: 480px) {
    .ob-card { padding: 52px 20px 22px; }
    .ob-title { font-size: 16px; }
  }
