/* ═══════════════════════════════════════════════════════
   EDUMGT 주식상식 웹앱 — Global Styles
   Font: Pretendard (Korean), -apple-system fallback
═══════════════════════════════════════════════════════ */

:root {
  --bg:             #ffffff;
  --surface:        #ffffff;
  --surface-soft:   #f8f9fa;
  --surface-hover:  #f0f7ff;
  --text:           #1a1a1a;
  --text-muted:     #555555;
  --text-subtle:    #8a8a8a;
  --border:         #e0e0e0;
  --border-strong:  #bdbdbd;
  --primary:        #0078d4;
  --primary-dark:   #004578;
  --primary-light:  #eff6ff;
  --accent:         #2b88d8;
  --green:          #059669;
  --green-bg:       #ecfdf5;
  --red:            #dc2626;
  --red-bg:         #fef2f2;
  --yellow:         #eab308;
  --yellow-bg:      #fefce8;
  --sidebar-w:      268px;
  --topbar-h:       56px;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow-sm:      0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:         0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:      0 12px 40px rgba(0,0,0,.14);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}

/* 한글 기본 폰트 크기 17px 이상 */
html { font-size: 17px; }

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-weight: 500;
  word-break: keep-all;
  word-wrap: break-word;
  font-feature-settings: "kern" 1, "liga" 1;
}
button, input, select, textarea { font: inherit; font-weight: 500; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ApexCharts 전역 폰트 오버라이드 */
.apexcharts-text, .apexcharts-legend-text,
.apexcharts-tooltip, .apexcharts-xaxis-label,
.apexcharts-yaxis-label {
  font-family: "Pretendard", -apple-system, "Malgun Gothic", sans-serif !important;
}
.apexcharts-canvas { background: #fff !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ═══════════════════════════════════════════════════════
   OVERLAY (mobile)
═══════════════════════════════════════════════════════ */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.overlay.show { display: block; }

/* ═══════════════════════════════════════════════════════
   TOPBAR
═══════════════════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.topbar-toggle {
  display: inline-flex;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background .15s, color .15s, border-color .15s;
}
.topbar-toggle:hover {
  background: var(--surface-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 0; background: none; border: none;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #004578 0%, #0078d4 55%, #2b88d8 100%);
  box-shadow: 0 2px 8px rgba(0,120,212,.30);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name {
  font-size: .9rem; font-weight: 800; letter-spacing: .07em;
  color: #1a1a1a; line-height: 1;
}
.brand-sub { font-size: .68rem; color: var(--text-muted); font-weight: 500; }

.topbar-ticker {
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0; overflow: hidden;
  font-size: .75rem; color: var(--text-muted);
  white-space: nowrap;
}
.ticker-item { display: flex; align-items: center; gap: 4px; margin-right: 10px; }
.ticker-label { color: var(--text-subtle); }
.ticker-item b { color: var(--text); font-weight: 650; }
.ticker-item em { font-style: normal; font-weight: 650; }
.ticker-stamp {
  color: var(--text-subtle);
  font-size: .68rem;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.up { color: var(--green); }
.dn { color: var(--red); }

.visitor-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 99px;
  font-size: .72rem; font-weight: 650; color: #1d4ed8;
  white-space: nowrap;
  flex-shrink: 0;
}
.visitor-badge i { color: var(--primary); }

.health-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: .72rem; color: var(--text-muted);
  flex-shrink: 0;
}
.health-docs-link { text-decoration: none; }
.health-docs-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}
.health-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong);
  transition: background .3s;
}

.auth-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 99px;
  font-size: .74rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.auth-badge:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ── Enterprise 안내 모달 ── */
.enterprise-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .45);
  padding: 16px;
}
.enterprise-modal-overlay[hidden] { display: none; }
.enterprise-modal {
  position: relative; width: 100%; max-width: 380px;
  background: #fff; border-radius: 14px; padding: 28px 24px 22px;
  text-align: center; box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.enterprise-modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: var(--surface-soft); border: none;
}
.enterprise-modal-close:hover { background: var(--border); color: var(--text); }
.enterprise-modal-icon {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #004578 0%, #0078d4 55%, #2b88d8 100%);
  color: #fff; font-size: 1.3rem;
  box-shadow: 0 4px 14px rgba(0, 120, 212, .35);
}
.enterprise-modal h3 { margin: 0 0 8px; font-size: 1.02rem; font-weight: 800; color: #1a1a1a; }
.enterprise-modal p { margin: 0 0 18px; font-size: .82rem; color: var(--text-muted); line-height: 1.55; }
.enterprise-modal-cta {
  padding: 8px 22px; border-radius: 8px; border: none;
  background: var(--primary); color: #fff; font-size: .82rem; font-weight: 700;
}
.enterprise-modal-cta:hover { background: var(--primary-dark); }

/* ═══════════════════════════════════════════════════════
   LAYOUT SHELL
═══════════════════════════════════════════════════════ */
.layout {
  display: flex;
  padding-top: var(--topbar-h);
  height: 100vh;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: var(--topbar-h); left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--topbar-h));
  /* 메뉴만 스크롤하고, 하단 챗봇은 항상 사이드바 안에 고정한다. */
  overflow: hidden;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 45;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 0 8px;
  display: flex; flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

/* 사이드바 하단 Enterprise 챗봇 */
.sidebar-chatbot {
  flex: 0 0 auto;
  margin: 10px 12px 14px;
  padding: 10px;
  border: 1px solid #cbdcf4;
  border-radius: 10px;
  background: linear-gradient(145deg, #f8fbff, #eef6ff);
  box-shadow: 0 2px 8px rgba(0, 69, 120, .08);
  position: relative;
  z-index: 1;
}
.sidebar-chatbot-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #123b68; font-size: .76rem; font-weight: 800; }
.sidebar-chatbot-head span { display: inline-flex; align-items: center; gap: 6px; }
.sidebar-chatbot-head i { color: var(--primary); }
.sidebar-chatbot-head em { padding: 2px 6px; border-radius: 999px; background: #dbeafe; color: #1d4ed8; font-size: .58rem; font-style: normal; letter-spacing: .02em; }
.sidebar-chatbot-messages { min-height: 52px; margin: 8px 0; }
.sidebar-chatbot-welcome { margin: 0; color: #64748b; font-size: .68rem; line-height: 1.45; }
.sidebar-chatbot-message { margin: 0 0 5px; padding: 6px 8px; border-radius: 7px; font-size: .68rem; line-height: 1.4; word-break: break-word; }
.sidebar-chatbot-message.is-user { background: #fff; color: #475569; border: 1px solid #dbe4ee; }
.sidebar-chatbot-message.is-enterprise { margin-bottom: 0; background: #dbeafe; color: #1e40af; font-weight: 750; }
.sidebar-chatbot-form { display: flex; gap: 5px; }
.sidebar-chatbot-form input { min-width: 0; flex: 1; height: 30px; padding: 0 8px; border: 1px solid #bfdbfe; border-radius: 6px; background: #fff; color: var(--text); font-size: .68rem; outline: none; }
.sidebar-chatbot-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0, 120, 212, .12); }
.sidebar-chatbot-form button { width: 30px; height: 30px; border-radius: 6px; background: var(--primary); color: #fff; font-size: .7rem; }
.sidebar-chatbot-form button:hover { background: var(--primary-dark); }

/* single nav item */
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 20px;
  font-size: 1rem; font-weight: 500;
  color: var(--text-muted);
  border-radius: 0;
  cursor: pointer;
  transition: background .12s, color .12s;
  border-left: 3px solid transparent;
}
.nav-item i { width: 14px; text-align: center; font-size: .85rem; flex-shrink: 0; }
.nav-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
  font-weight: 700;
}
.nav-item.locked {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-item.locked::after {
  content: '\f023';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: .65rem;
  margin-left: auto;
  color: var(--text-muted);
}
.nav-home {
  font-size: 1rem; font-weight: 700; color: var(--text);
  padding: 8px 14px 8px 20px; margin-bottom: 4px;
}

/* section header (collapsible) */
.nav-section { }
.nav-section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 9px 14px 9px 16px;
  font-size: 1rem; font-weight: 700;
  color: var(--text); letter-spacing: .04em;
  text-transform: uppercase;
  background: none; border: none;
  cursor: pointer;
  transition: background .12s;
}
.nav-section-hdr:hover { background: var(--primary-light); }
.nav-section-hdr > span {
  display: flex; align-items: center; gap: 8px;
}
.nav-section-hdr > span i { color: var(--primary); font-size: .9rem; }
.nav-chev { font-size: .65rem; color: var(--text-subtle); transition: transform .2s; }

/* children list (collapsible) */
.nav-children {
  display: none; overflow: hidden;
  background: #fafbfd;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.nav-children.open { display: block; }
.nav-children .nav-item { padding-left: 28px; font-size: .85rem; }

.nav-group-label {
  padding: 7px 14px 3px 28px;
  font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-subtle);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   CONTENT AREA
═══════════════════════════════════════════════════════ */
.content-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-width: 0;
  display: flex; flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
  background: var(--bg);
}
.content-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 36px 48px;
  width: 100%;
}

/* breadcrumb */
.breadcrumb {
  font-size: 1rem; color: var(--text-muted);
  margin-bottom: 6px;
}
.breadcrumb .bc-sep { margin: 0 6px; color: var(--border-strong); }
.breadcrumb .bc-cur { color: var(--text); font-weight: 600; }

.page-head { margin-bottom: 20px; }

.app-surface { min-height: 200px; }

/* ═══════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════ */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 14px 28px;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
}
.footer-logo { font-size: .95rem; font-weight: 800; letter-spacing: .07em; color: #1a1a1a; }
.footer-line { font-size: .8rem; color: var(--text-subtle); }

/* ═══════════════════════════════════════════════════════
   CARDS / GRID UTILITIES
═══════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 1.05rem; font-weight: 700; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .82rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub   { font-size: .88rem; color: var(--text-muted); margin-top: 3px; }

/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: none;
}
.btn-primary   { background: var(--primary); color: #ffffff; border: 1.5px solid var(--primary-dark); }
.btn-primary:hover   { background: #006cbe; border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface-soft); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.btn-danger    { background: var(--red-bg); color: var(--red); border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.btn-success   { background: var(--green-bg); color: var(--green); border: 1px solid #6ee7b7; }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════
   BADGE / TAG
═══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px;
  font-size: .7rem; font-weight: 700; letter-spacing: .02em;
}
.badge-blue   { background: var(--primary-light); color: var(--primary-dark); border: 1px solid var(--primary); }
.badge-green  { background: var(--green-bg); color: #065f46; }
.badge-red    { background: var(--red-bg); color: #991b1b; }
.badge-yellow { background: var(--yellow-bg); color: #854d0e; border: 1px solid #eab308; }
.badge-gray   { background: var(--surface-soft); color: var(--text-muted); border: 1px solid #ccc; }

/* ═══════════════════════════════════════════════════════
   PROGRESS BAR
═══════════════════════════════════════════════════════ */
.progress-bar {
  height: 8px; border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #004578, #0078d4);
  transition: width .5s ease;
}

/* ═══════════════════════════════════════════════════════
   LEARNING VIEW — MD Renderer
═══════════════════════════════════════════════════════ */
.learn-container {
  position: relative;
}
.learn-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow-sm);
  min-height: 400px;
  min-width: 0;
}

/* 목차 — offcanvas (우측에서 슬라이드 인) */
.toc-toggle-btn {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  right: 20px;
  z-index: 55;
  display: flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: .82rem; font-weight: 600;
  cursor: pointer;
}
.toc-toggle-btn:hover { background: var(--surface-hover); }
.toc-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 58;
  backdrop-filter: blur(2px);
}
.toc-overlay.show { display: block; }
.learn-toc {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: 300px;
  max-width: 85vw;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 18px 16px;
  box-shadow: var(--shadow-lg);
  z-index: 59;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.learn-toc.open {
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}
.learn-toc-close {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
}
.learn-toc-close:hover { background: var(--surface-hover); color: var(--text); }
.learn-toc-hdr { display: flex; align-items: center; margin-bottom: 10px; }
.learn-toc-title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: 10px;
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-item {
  padding: 4px 0;
  font-size: .88rem; color: var(--text-muted);
  cursor: pointer; transition: color .12s;
  border-left: 2px solid transparent;
  padding-left: 8px;
}
.toc-item:hover { color: var(--primary-dark); }
.toc-item.active { color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.toc-item.h3 { padding-left: 18px; font-size: .82rem; }

/* MD body styling */
.md-body {
  line-height: 1.75;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.md-body h1 { font-size: 1.65rem; font-weight: 800; margin: 0 0 20px; border-bottom: 2px solid var(--border); padding-bottom: 12px; }
.md-body h2 { font-size: 1.2rem; font-weight: 700; margin: 32px 0 12px; color: #1a1a1a; border-left: 4px solid var(--primary); background: var(--primary-light); padding: 8px 10px 8px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.md-body h3 { font-size: 1.05rem; font-weight: 700; margin: 22px 0 8px; }
.md-body h4 { font-size: 1rem; font-weight: 700; margin: 16px 0 6px; color: var(--text-muted); }
.md-body p  { margin: 0 0 12px; }
.md-body ul, .md-body ol { margin: 0 0 12px; padding-left: 24px; }
.md-body li { margin-bottom: 4px; }
.md-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 1rem; }
.md-body th { background: var(--primary); color: #ffffff; font-weight: 700; padding: 8px 12px; border: 1px solid var(--primary-dark); text-align: left; }
.md-body td { padding: 7px 12px; border: 1px solid var(--border); }
.md-body tr:nth-child(even) td { background: var(--surface-soft); }
.md-body code { background: #f4f4f4; border: 1px solid #ddd; border-radius: 4px; padding: 1px 5px; font-size: .85em; font-family: "Fira Code", "Cascadia Code", monospace; }
.md-body pre  { background: #1e1e1e; border-radius: var(--radius-sm); padding: 16px; overflow-x: auto; margin: 16px 0; border: 1px solid #333; }
.md-body pre code { background: none; border: none; color: #e2e8f0; font-size: .85rem; }
.mermaid-view-badge {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 16px 0; padding: 7px 10px;
  color: #075985; background: #e0f2fe;
  border: 1px solid #7dd3fc; border-radius: 999px;
  font-size: .76rem; font-weight: 800; letter-spacing: .04em;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.mermaid-view-badge small { font-weight: 600; letter-spacing: 0; color: #0369a1; }
.mermaid-view-badge:hover { background: #bae6fd; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(2,132,199,.18); }
.mermaid-view-badge:focus-visible { outline: 3px solid rgba(14,165,233,.35); outline-offset: 2px; }
.mermaid-modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 200;
  align-items: center; justify-content: center; padding: 0;
  background: rgba(15,23,42,.62); backdrop-filter: blur(3px);
}
.mermaid-modal-backdrop.show { display: flex; }
.mermaid-modal {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 0; border-radius: 0;
  box-shadow: none;
}
.mermaid-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-size: .95rem; font-weight: 750;
}
.mermaid-modal-header i { color: var(--primary); margin-right: 7px; }
.mermaid-modal-close {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; color: var(--text-muted);
}
.mermaid-modal-close:hover { background: var(--surface-soft); color: var(--text); }
.mermaid-modal-chart {
  flex: 1; min-height: 0; overflow: auto; padding: 40px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
.mermaid-modal-chart svg {
  width: max(100%, 1200px); height: auto; max-width: none; min-width: 0;
}
.mermaid-modal-loading { padding: 60px 20px; color: var(--text-muted); }
.mermaid-modal-error { margin: 0; padding: 36px 12px; color: var(--red); text-align: center; }
.macro-news-simulator-button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: #075985; background: #ecfeff; border: 1px solid #a5f3fc; border-radius: 9px; font-size: .82rem; font-weight: 800; box-shadow: 0 2px 5px rgba(8,145,178,.08); }
.macro-news-simulator-button:hover { color: #fff; background: #0891b2; border-color: #0891b2; }
.macro-news-modal-backdrop { position: fixed; z-index: 1200; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.macro-news-modal-backdrop.show { display: flex; }
.macro-news-modal { width: min(720px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; background: #fff; border: 1px solid #cbd5e1; border-radius: 15px; box-shadow: 0 24px 70px rgba(15,23,42,.3); }
.macro-news-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 19px 20px 16px; border-bottom: 1px solid #e2e8f0; }
.macro-news-modal-header > div { display: flex; align-items: center; gap: 11px; }
.macro-news-modal-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: #fff; background: linear-gradient(135deg, #0284c7, #2563eb); border-radius: 10px; }
.macro-news-modal h2 { margin: 0; color: #0f172a; font-size: 1rem; }
.macro-news-modal-header p { margin: 3px 0 0; color: #64748b; font-size: .73rem; }
.macro-news-modal-close { width: 32px; height: 32px; flex: 0 0 auto; color: #64748b; border-radius: 8px; }
.macro-news-modal-close:hover { color: #0f172a; background: #f1f5f9; }
.macro-news-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; padding: 16px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.macro-news-controls label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; color: #334155; font-size: .78rem; font-weight: 750; }
.macro-news-controls input { grid-column: 1 / -1; width: 100%; accent-color: #0284c7; }
.macro-news-controls output { min-width: 22px; color: #0369a1; text-align: right; font-variant-numeric: tabular-nums; }
.macro-news-canvas-wrap { padding: 15px 20px 0; }
.macro-news-canvas { display: block; width: 100%; border: 1px solid #e2e8f0; border-radius: 10px; }
.macro-news-insight { margin: 12px 20px 0; padding: 10px 12px; color: #475569; background: #f0f9ff; border-left: 3px solid #0ea5e9; border-radius: 0 7px 7px 0; font-size: .77rem; line-height: 1.55; }
.macro-news-insight strong { color: #0f172a; }
.macro-news-disclaimer { margin: 10px 20px 19px; color: #94a3b8; font-size: .68rem; line-height: 1.45; }
.financial-statement-samples-button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 9px; font-size: .82rem; font-weight: 800; box-shadow: 0 2px 5px rgba(37,99,235,.08); }
.financial-statement-samples-button:hover { color: #fff; background: #2563eb; border-color: #2563eb; }
.financial-statement-modal-backdrop { position: fixed; z-index: 1200; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(15,23,42,.58); backdrop-filter: blur(2px); }
.financial-statement-modal-backdrop.show { display: flex; }
.financial-statement-modal { width: min(980px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border: 1px solid #cbd5e1; border-radius: 15px; box-shadow: 0 24px 70px rgba(15,23,42,.32); }
.financial-statement-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 19px 20px 16px; border-bottom: 1px solid #e2e8f0; }
.financial-statement-modal-header > div { display: flex; align-items: center; gap: 11px; }
.financial-statement-modal-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: #fff; background: linear-gradient(135deg, #1d4ed8, #0f766e); border-radius: 10px; }
.financial-statement-modal h2 { margin: 0; color: #0f172a; font-size: 1rem; }
.financial-statement-modal-header p { margin: 3px 0 0; color: #64748b; font-size: .73rem; }
.financial-statement-modal-close { width: 32px; height: 32px; flex: 0 0 auto; color: #64748b; border-radius: 8px; }
.financial-statement-modal-close:hover { color: #0f172a; background: #f1f5f9; }
.financial-statement-tabs { display: flex; gap: 8px; padding: 14px 20px 0; border-bottom: 1px solid #e2e8f0; overflow-x: auto; }
.financial-statement-tabs button { flex: 0 0 auto; padding: 9px 12px; color: #64748b; background: transparent; border: 0; border-bottom: 3px solid transparent; font-size: .8rem; font-weight: 800; }
.financial-statement-tabs button[aria-selected="true"] { color: #1d4ed8; border-bottom-color: #2563eb; }
.financial-statement-sample { margin: 0; padding: 18px 20px 10px; }
.financial-statement-image-wrap { display: flex; justify-content: center; max-height: min(59vh, 650px); overflow: auto; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
.financial-statement-image-wrap img { display: block; width: auto; min-width: min(100%, 620px); max-width: 100%; height: auto; object-fit: contain; }
.financial-statement-sample figcaption { margin-top: 10px; color: #475569; font-size: .79rem; line-height: 1.55; }
.financial-statement-modal-note { margin: 4px 20px 20px; padding: 10px 12px; color: #64748b; background: #f8fafc; border-radius: 8px; font-size: .73rem; line-height: 1.55; }
.financial-statement-modal-note i { margin-right: 5px; color: #2563eb; }
@media (max-width: 640px) {
  .mermaid-modal-chart { padding: 18px; align-items: flex-start; }
  .mermaid-modal-chart svg { width: 1200px; }
  .macro-news-modal-backdrop { padding: 10px; }
  .macro-news-controls { grid-template-columns: 1fr; }
  .macro-news-modal-header { padding: 15px; }
  .macro-news-canvas-wrap { padding-inline: 12px; }
  .macro-news-insight, .macro-news-disclaimer { margin-inline: 12px; }
  .financial-statement-modal-backdrop { padding: 10px; }
  .financial-statement-modal-header { padding: 15px; }
  .financial-statement-tabs { padding-inline: 12px; }
  .financial-statement-sample { padding-inline: 12px; }
  .financial-statement-modal-note { margin-inline: 12px; }
}
.md-body blockquote { border-left: 4px solid var(--primary); margin: 14px 0; padding: 10px 16px; background: var(--primary-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: #444444; }
.md-body strong { font-weight: 700; color: var(--text); }
.md-body a { color: var(--primary); text-decoration: underline; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Home market dashboard ── */
.home-dashboard { min-width: 0; }
.home-market-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.home-market-card { min-width: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 18px 12px; box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.home-market-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.home-market-name { font-size: .8rem; font-weight: 800; color: #334155; letter-spacing: .03em; }
.home-market-name span { color: #94a3b8; font-weight: 600; }
.home-market-price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.home-market-price-row strong { font-size: 1.35rem; line-height: 1; color: #0f172a; letter-spacing: -.03em; }
.home-market-price-row em { font-style: normal; font-size: .72rem; font-weight: 750; padding: 3px 7px; border-radius: 999px; background: #f1f5f9; color: #64748b; }
.home-market-price-row em.is-up { background: #fff1f2; color: #e11d48; }
.home-market-price-row em.is-down { background: #eff6ff; color: #2563eb; }
.home-market-periods { display: inline-flex; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 6px; }
.home-market-periods button { padding: 3px 7px; color: #64748b; font-size: .68rem; font-weight: 750; border-right: 1px solid #e2e8f0; }
.home-market-periods button:last-child { border-right: 0; }
.home-market-periods button.active { color: #fff; background: #0078d4; }
.home-market-chart-wrap { position: relative; min-height: 250px; }
.home-market-chart { width: 100%; }
.home-market-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 7px; color: #94a3b8; font-size: .78rem; background: rgba(255,255,255,.85); }
.home-market-error { color: var(--red); }
.home-market-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; color: #94a3b8; font-size: .67rem; }
.home-market-foot .is-simulated { color: #a16207; }
.home-quote-dashboard { margin-top: 18px; padding: 18px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.home-quote-dashboard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.home-quote-dashboard-head h1 { margin: 0; color: #0f172a; font-size: 1rem; font-weight: 800; }
.home-quote-dashboard-head p { margin: 4px 0 0; color: #64748b; font-size: .76rem; }
.home-quote-actions { display: flex; align-items: center; gap: 9px; color: #94a3b8; font-size: .7rem; white-space: nowrap; }
.home-quote-actions button { padding: 6px 9px; color: #0369a1; border: 1px solid #bae6fd; border-radius: 7px; background: #f0f9ff; font-size: .72rem; font-weight: 750; }
.home-quote-actions button:hover { background: #e0f2fe; }
.home-quote-actions button:disabled { opacity: .65; cursor: wait; }
.home-quote-actions button.is-loading i { animation: spin 1s linear infinite; }
.home-quote-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.home-quote-panel { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 10px; }
.home-quote-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 11px 13px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.home-quote-panel-head h2 { margin: 0; color: #1e293b; font-size: .85rem; font-weight: 800; }
.home-quote-panel-head p { margin: 3px 0 0; color: #94a3b8; font-size: .68rem; }
.home-quote-count { padding: 3px 6px; color: #475569; border-radius: 999px; background: #e2e8f0; font-size: .64rem; font-weight: 750; }
.home-quote-list { display: grid; }
.home-quote-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 47px; padding: 8px 13px; border-bottom: 1px solid #f1f5f9; }
.home-quote-row:last-child { border-bottom: 0; }
.home-quote-row.is-loading { opacity: .6; }
.home-quote-row.is-error { background: #fffbeb; }
.home-quote-name { display: flex; flex-direction: column; min-width: 0; }
.home-quote-name strong { color: #334155; font-size: .76rem; font-weight: 750; }
.home-quote-name span { margin-top: 2px; color: #94a3b8; font-size: .65rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.home-quote-value { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.home-quote-value b { color: #0f172a; font-size: .79rem; font-variant-numeric: tabular-nums; }
.home-quote-value em { margin-top: 2px; color: #64748b; font-size: .66rem; font-style: normal; font-weight: 750; font-variant-numeric: tabular-nums; }
.home-quote-value em.is-up { color: #e11d48; }
.home-quote-value em.is-down { color: #2563eb; }
.home-quote-note { margin: 11px 0 0; color: #94a3b8; font-size: .67rem; }
.server-resource-page { max-width: 1180px; }
.server-resource-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.server-resource-head h1 { margin: 0; color: #0f172a; font-size: 1.25rem; font-weight: 800; }
.server-resource-head h1 i { margin-right: 7px; color: #2563eb; }
.server-resource-head p { margin: 6px 0 0; color: #64748b; font-size: .84rem; }
.server-resource-actions { display: flex; align-items: center; gap: 10px; color: #94a3b8; font-size: .72rem; white-space: nowrap; }
.server-resource-actions button { padding: 7px 10px; color: #0369a1; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 7px; font-size: .75rem; font-weight: 750; }
.server-resource-actions button:hover { background: #e0f2fe; }
.server-resource-actions button:disabled { opacity: .65; cursor: wait; }
.server-resource-actions button.is-loading i { animation: spin 1s linear infinite; }
.server-resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.server-resource-card { min-width: 0; padding: 17px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 2px 10px rgba(15,23,42,.05); }
.server-resource-card > header { display: flex; align-items: center; gap: 10px; }
.server-resource-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: var(--resource-color); background: color-mix(in srgb, var(--resource-color) 12%, white); border-radius: 9px; }
.server-resource-card h2 { margin: 0; color: #1e293b; font-size: .88rem; font-weight: 800; }
.server-resource-card header p { margin: 3px 0 0; color: #94a3b8; font-size: .68rem; }
.server-resource-chart { min-height: 255px; }
.server-resource-detail { margin: 0; padding-top: 10px; color: #64748b; border-top: 1px solid #f1f5f9; text-align: center; font-size: .72rem; font-variant-numeric: tabular-nums; }
.server-resource-note { margin: 14px 0 0; padding: 10px 12px; color: #64748b; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; font-size: .72rem; line-height: 1.55; }
.volume-cloud-page { max-width: 1180px; }
.volume-cloud-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.volume-cloud-head h1 { margin: 0; color: #0f172a; font-size: 1.25rem; font-weight: 800; }
.volume-cloud-head h1 i { margin-right: 7px; color: #0ea5e9; }
.volume-cloud-head p { margin: 6px 0 0; color: #64748b; font-size: .84rem; }
.volume-cloud-actions { display: flex; align-items: center; gap: 10px; color: #94a3b8; font-size: .72rem; white-space: nowrap; }
.volume-cloud-actions button { padding: 7px 10px; color: #cbd5e1; background: #172033; border: 1px solid #334155; border-radius: 7px; font-size: .75rem; font-weight: 750; }
.volume-cloud-actions button:hover { color: #fff; background: #26344c; }
.volume-cloud-actions button:disabled { opacity: .65; cursor: wait; }
.volume-cloud-actions button.is-loading i { animation: spin 1s linear infinite; }
.volume-cloud-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 10px; background: #e2e8f0; border-radius: 8px; }
.volume-cloud-tabs button { padding: 7px 11px; color: #64748b; border-radius: 6px; font-size: .75rem; font-weight: 750; }
.volume-cloud-tabs button.active { color: #fff; background: #0f172a; box-shadow: 0 1px 2px rgba(15,23,42,.2); }
.volume-cloud-stage { padding: 0; overflow: hidden; background: #3f3f3f; border: 1px solid #262626; border-radius: 10px; box-shadow: 0 8px 24px rgba(15,23,42,.14); }
.volume-cloud-stage-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; padding: 0 14px; color: #f8fafc; background: #464646; border-bottom: 1px solid #252525; font-size: .78rem; }
.volume-cloud-stage-head > span { color: #d1d5db; font-size: .68rem; }
.volume-cloud-stage-head i { margin-left: 7px; font-size: .5rem; vertical-align: middle; }
.volume-cloud-stage-head i.is-up { color: #fb5165; }
.volume-cloud-stage-head i.is-down { color: #4487ee; }
.volume-cloud-stage .apexcharts-canvas { margin: 0 auto; }
.volume-cloud-stage .apexcharts-treemap-rect { cursor: pointer; }
.volume-cloud-stage .apexcharts-data-labels text { paint-order: stroke; stroke: rgba(0,0,0,.14); stroke-width: 1px; }
.volume-cloud-summary { margin-top: 10px; padding: 11px 13px; color: #64748b; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; font-size: .75rem; }
.volume-cloud-summary strong { color: #1e293b; }
.volume-cloud-summary b { color: #0f172a; }
.volume-cloud-summary span { color: #0369a1; font-weight: 750; }
.volume-cloud-note { margin: 10px 0 0; color: #94a3b8; font-size: .7rem; line-height: 1.55; }
.volume-cloud-tooltip { min-width: 175px; padding: 10px 11px; color: #cbd5e1; font-size: .72rem; }
.volume-cloud-tooltip strong { display: block; color: #fff; font-size: .8rem; }
.volume-cloud-tooltip strong span { color: #94a3b8; font-size: .65rem; font-weight: 500; }
.volume-cloud-tooltip b { display: block; margin-top: 7px; color: #fff; font-size: .9rem; }
.volume-cloud-tooltip em { display: block; margin-top: 3px; font-style: normal; font-weight: 750; }
.volume-cloud-tooltip em.is-up { color: #fb7185; }
.volume-cloud-tooltip em.is-down { color: #60a5fa; }
.volume-cloud-tooltip p { margin: 5px 0 0; color: #94a3b8; }
@media (max-width: 1000px) { .home-market-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .home-quote-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .server-resource-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .home-market-card-head, .home-quote-dashboard-head, .server-resource-head, .volume-cloud-head { flex-direction: column; } .home-quote-actions, .server-resource-actions, .volume-cloud-actions { width: 100%; justify-content: space-between; } .volume-cloud-stage { padding-inline: 8px; } }

/* ═══════════════════════════════════════════════════════
   QUIZ VIEW
═══════════════════════════════════════════════════════ */
.quiz-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.quiz-meta { display: flex; align-items: center; gap: 10px; }
.quiz-progress-wrap { display: flex; flex-direction: column; gap: 4px; flex: 1; max-width: 360px; }
.quiz-progress-label { font-size: .75rem; color: var(--text-muted); display: flex; justify-content: space-between; }

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.q-num {
  font-size: .85rem; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.q-text { font-size: 1.05rem; font-weight: 600; line-height: 1.6; margin-bottom: 18px; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn {
  display: flex; align-items: flex-start; gap: 10px;
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left; font-size: 1rem; font-weight: 500;
  color: var(--text); cursor: pointer;
  transition: all .15s;
}
.choice-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.choice-btn.correct   { border-color: var(--green); background: var(--green-bg); color: #065f46; }
.choice-btn.wrong     { border-color: var(--red);   background: var(--red-bg);   color: #991b1b; }
.choice-btn:disabled  { cursor: default; }
.choice-idx {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%; border: 1.5px solid var(--border-strong);
  font-size: .72rem; font-weight: 700;
}
.choice-btn.correct .choice-idx { border-color: var(--green); background: var(--green); color: #fff; }
.choice-btn.wrong   .choice-idx { border-color: var(--red);   background: var(--red);   color: #fff; }

.explanation {
  display: none;
  margin-top: 16px; padding: 14px 16px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  font-size: .85rem; line-height: 1.65; color: #14532d;
}
.explanation.show { display: block; }
.explanation.wrong-exp { background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
.exp-label { font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }

.quiz-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 20px; flex-wrap: wrap; gap: 10px;
}
.quiz-score-bar {
  display: flex; align-items: center; gap: 12px; font-size: .82rem; color: var(--text-muted);
}
.score-correct { color: var(--green); font-weight: 700; }
.score-wrong   { color: var(--red);   font-weight: 700; }

/* result screen */
.quiz-result {
  text-align: center; padding: 40px 24px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.result-score {
  font-size: 3.5rem; font-weight: 900;
  background: linear-gradient(135deg, #004578, #0078d4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  line-height: 1; margin-bottom: 8px;
}
.result-label { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 24px; }
.result-stats {
  display: flex; align-items: center; justify-content: center; gap: 32px;
  margin-bottom: 28px;
}
.result-stat { text-align: center; }
.result-stat .val { font-size: 1.6rem; font-weight: 800; }
.result-stat .lbl { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

/* edit modal */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 100;
  align-items: center; justify-content: center;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--border);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; color: var(--text-muted); font-size: .9rem; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--surface-soft); }
.modal-field { margin-bottom: 14px; }
.modal-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; display: block; }
.modal-input, .modal-textarea, .modal-select {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1rem; color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
}
.modal-input:focus, .modal-textarea:focus, .modal-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}
.modal-textarea { resize: vertical; min-height: 80px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ═══════════════════════════════════════════════════════
   QUIZ PLAN HOME
═══════════════════════════════════════════════════════ */
.plan-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px;
  margin-top: 20px;
}
.plan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  cursor: pointer; transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.plan-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.plan-card.done { border-color: var(--green); background: var(--green-bg); }
.plan-day { font-size: .75rem; font-weight: 700; color: var(--text-subtle); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.plan-topic { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.3; }
.plan-count { font-size: .88rem; color: var(--text-muted); }
.plan-prog { margin-top: 8px; }

/* ═══════════════════════════════════════════════════════
   HOME VIEW
═══════════════════════════════════════════════════════ */
.home-hero {
  background: linear-gradient(135deg, #004578 0%, #0078d4 55%, #2b88d8 100%);
  border-radius: var(--radius); padding: 36px 32px; color: #ffffff;
  margin-bottom: 28px; position: relative; overflow: hidden;
  border: none;
  box-shadow: 0 4px 20px rgba(0,120,212,.25);
}
.home-hero::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.08); border-radius: 50%;
}
.home-hero h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 8px; color: #ffffff; }
.home-hero p  { font-size: 1rem; opacity: .85; margin: 0 0 20px; }
.home-hero .btn { background: #ffffff; color: var(--primary); font-weight: 700; border: none; }
.home-hero .btn:hover { background: #f0f7ff; }

.home-sections { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 28px; }
.home-section-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  cursor: pointer; transition: all .15s; box-shadow: var(--shadow-sm);
}
.home-section-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.hsc-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: 12px;
}
.hsc-icon.learn   { background: var(--primary-light); color: var(--primary); border: 1.5px solid var(--primary); }
.hsc-icon.practice{ background: #f0fdf4; color: #065f46; border: 1.5px solid #6ee7b7; }
.hsc-icon.quiz    { background: var(--primary-light); color: var(--primary); border: 1.5px solid var(--primary); }
.hsc-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 5px; }
.hsc-desc  { font-size: .9rem; color: var(--text-muted); line-height: 1.5; }

/* ═══════════════════════════════════════════════════════
   LOADING SPINNER
═══════════════════════════════════════════════════════ */
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px 0; }
.loading-text { font-size: .85rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   FORMS / INPUTS (general)
═══════════════════════════════════════════════════════ */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .88rem; font-weight: 600; color: var(--text-muted); }
.form-input, .form-select {
  padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 1rem;
  background: var(--surface); color: var(--text);
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}

/* ═══════════════════════════════════════════════════════
   METRIC BOX (used in ML views)
═══════════════════════════════════════════════════════ */
.metric-box {
  background: var(--surface-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; min-width: 110px;
}

/* ═══════════════════════════════════════════════════════
   HOME VIEW — ANALYSIS GROUP GRID
═══════════════════════════════════════════════════════ */
.analysis-group-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.analysis-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.analysis-group-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.analysis-group-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  background: var(--primary);
  color: #ffffff;
  border: none;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,120,212,.25);
}

.analysis-group-head h2 {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text); margin: 0 0 4px;
}

.analysis-group-head p {
  font-size: 1rem; color: var(--text-muted);
  line-height: 1.5; margin: 0;
}

/* 실습 화면 — 분석/ML 기법 쉬운 설명 */
.practice-guide {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 14px 16px;
  color: var(--text);
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
}
.practice-guide-icon {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #92400e;
  background: #fef3c7;
  border-radius: 50%;
}
.practice-guide-title { font-size: .9rem; font-weight: 800; }
.practice-guide-title span { margin-left: 6px; color: var(--primary); }
.practice-guide p { margin: 4px 0 0; color: var(--text-muted); font-size: .88rem; line-height: 1.6; }

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.home-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: all .15s;
  display: flex; flex-direction: column; gap: 8px;
}

.home-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.home-card.is-disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

.home-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  color: var(--primary);
}

.home-card-title {
  font-size: 1rem; font-weight: 700;
  color: var(--text); line-height: 1.35;
}

.home-card-tag {
  font-size: .85rem; color: var(--text-muted);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════
   HOME MINI CARDS — Copilot-style
═══════════════════════════════════════════════════════ */
.home-mini-group {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: box-shadow .15s;
}

.home-mini-group:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,.09);
}

.home-mini-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #424242;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  letter-spacing: .01em;
}

.home-mini-group-head i {
  color: var(--primary);
  font-size: 0.82rem;
}

.home-mini-items {
  display: flex;
  flex-direction: column;
}

.home-mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background .1s;
}

.home-mini-card:last-child { border-bottom: none; }

.home-mini-card:hover {
  background: var(--primary-light);
}

.home-mini-card:hover .home-mini-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

.home-mini-card.is-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

.home-mini-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #c8e0f7;
  flex-shrink: 0;
}

.home-mini-text { flex: 1; min-width: 0; }

.home-mini-name {
  font-size: 0.81rem;
  font-weight: 600;
  color: #212121;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-mini-tag {
  font-size: 0.7rem;
  color: #9e9e9e;
  margin-top: 1px;
}

.home-mini-arrow {
  font-size: 0.6rem;
  color: #bdbdbd;
  flex-shrink: 0;
  transition: color .1s, transform .1s;
}

/* ═══════════════════════════════════════════════════════
   DART VIEWS — 공통 UI (검색 패널, 결과 카드, 테이블)
═══════════════════════════════════════════════════════ */
.dart-search-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.dart-search-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.param-label {
  display: block;
  font-size: .74rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.param-input {
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
}
.param-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,120,212,.12); }
.run-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 22px;
  background: var(--primary); color: #ffffff;
  border: 1.5px solid var(--primary-dark); border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: background .15s;
  white-space: nowrap;
}
.run-btn:hover  { background: #006cbe; }
.run-btn:disabled { opacity: .5; cursor: not-allowed; }
.dart-help {
  margin-top: 10px;
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.65;
}
.dart-result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  font-size: .9rem;
}
.dart-result-summary span {
  font-size: .85rem;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 10px;
}
.dart-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dart-result-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color .15s;
}
.dart-result-card:hover { border-color: var(--primary); }
.dart-result-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.dart-ticker {
  font-size: .88rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 10px;
}
.dart-result-card dl { margin: 0 0 12px; display: grid; gap: 4px; }
.dart-result-card dl > div {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .88rem;
}
.dart-result-card dt { color: var(--text-muted); }
.dart-result-card dd {
  margin: 0; font-weight: 600;
  font-family: "Fira Code", "Cascadia Code", monospace;
}
.dart-copy-row { display: flex; gap: 6px; flex-wrap: wrap; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.dart-notes {
  font-size: .76rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.dart-notes p { margin: 2px 0; }
.dart-error {
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--red);
}
.dart-error p { margin: 4px 0; font-size: .85rem; color: var(--text-muted); }
.dart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.dart-table th {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--primary-dark);
  white-space: nowrap;
  font-size: 1rem;
}
.dart-table td {
  padding: 7px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  font-size: 1rem;
}
.dart-table tr:nth-child(even) td { background: var(--surface-soft); }
.dart-table tr:hover td { background: var(--primary-light); }
.mono {
  font-family: "Fira Code", "Cascadia Code", monospace;
  font-size: .85em;
  letter-spacing: .02em;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (min-width: 1440px) {
  :root {
    --sidebar-w:  300px;
    --topbar-h:   62px;
  }
  .content-main { padding: 32px 48px 56px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .learn-body { padding: 36px 42px; }
  .grid-2 { gap: 20px; }
  .grid-3 { gap: 20px; }
  .grid-4 { gap: 18px; }
}

@media (min-width: 1920px) {
  :root {
    --sidebar-w:  320px;
    --topbar-h:   66px;
  }
  .content-main { padding: 36px 56px 64px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .analysis-group { padding: 28px 36px; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .content-wrap {
    margin-left: 0;
    width: 100%;
  }
  .learn-toc { width: 86vw; }
  .home-sections { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .result-stats { gap: 16px; }
}

@media (min-width: 1025px) {
  body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }

  body.sidebar-collapsed .content-wrap {
    margin-left: 0;
    width: 100%;
  }
}
@media (max-width: 640px) {
  .content-main { padding: 16px 14px 32px; }
  .topbar-ticker { display: none; }
  .brand-sub { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .question-card { padding: 18px 16px; }
  .quiz-header { flex-direction: column; align-items: flex-start; }
  .home-hero { padding: 24px 20px; }
  .home-hero h1 { font-size: 1.25rem; }
  .home-grid { grid-template-columns: 1fr 1fr; }
  .analysis-group { padding: 16px; }
  .analysis-group-head { gap: 10px; }
}
