/* ═══════════════════════════════════════════════════════════
   Emmy 投資台 — Apple 風格 UI（簡潔、色塊、幾何互動）
   ═══════════════════════════════════════════════════════════ */

/* ── 主視圖切換（膠囊分段）── */
.view-tabs{
  display:flex;gap:2px;flex-wrap:wrap;
  background:rgba(0,0,0,.04);border-radius:12px;padding:3px;
}
.view-tabs a{
  padding:8px 18px;border-radius:10px;font-size:.88rem;font-weight:600;color:var(--text2);
  cursor:pointer;transition:background .2s,color .2s,box-shadow .2s;
}
.view-tabs a:hover{color:var(--text)}
.view-tabs a.active{
  background:var(--surface);color:var(--text);
  box-shadow:0 1px 4px rgba(0,0,0,.08);
}

.view[hidden]{display:none}
body[data-view="macro"] #navLinks{display:flex}
body:not([data-view="macro"]) #navLinks{display:none}

/* ── 頁面 ── */
.page{margin:28px 32px 0;animation:fadeInUp .35s ease both}
.page-head{margin-bottom:22px}
.page-title{font-size:1.5rem;font-weight:800;letter-spacing:0}
.page-sub{font-size:.9rem;color:var(--text2);margin-top:8px;line-height:1.65;max-width:720px}
.eyebrow{font-size:.72rem;color:var(--text2);font-weight:800;letter-spacing:.09em;text-transform:uppercase;margin-bottom:8px}
.disclaimer{
  font-size:.78rem;color:var(--text2);
  background:rgba(255,149,0,.08);border:1px solid rgba(255,149,0,.18);
  border-radius:var(--radius);padding:12px 16px;margin-top:16px;line-height:1.6;
}

@keyframes fadeInUp{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes spin{to{transform:rotate(360deg)}}

@media(max-width:900px){ .page{margin:20px 16px 0} }

/* ── 色塊 / 分段控制（取代下拉）── */
.chip-row,.chip-group{display:flex;flex-wrap:wrap;gap:8px}
.chip,.chip-item{
  display:inline-flex;align-items:center;gap:6px;
  padding:10px 18px;border-radius:12px;font-size:.86rem;font-weight:600;
  border:1.5px solid var(--border);background:var(--surface);color:var(--text2);
  cursor:pointer;transition:all .18s;font-family:inherit;user-select:none;
}
.chip:hover,.chip-item:hover{border-color:rgba(0,113,227,.35);color:var(--text)}
.chip.on,.chip-item.on{
  background:var(--blue);border-color:var(--blue);color:#fff;
  box-shadow:0 4px 14px rgba(0,113,227,.28);
}
.chip.sm,.chip-item.sm{padding:6px 14px;font-size:.8rem;border-radius:10px}
.chip.tint-green.on{background:var(--green);border-color:var(--green);box-shadow:0 4px 14px rgba(52,199,89,.25)}
.chip.tint-red.on{background:var(--red);border-color:var(--red);box-shadow:0 4px 14px rgba(255,59,48,.25)}
.chip.tint-purple.on{background:var(--purple);border-color:var(--purple);box-shadow:0 4px 14px rgba(175,82,222,.25)}

.seg-pill{
  display:inline-flex;background:rgba(0,0,0,.05);border-radius:12px;padding:3px;gap:2px;
}
.seg-pill button{
  padding:8px 16px;border:none;border-radius:10px;font-size:.84rem;font-weight:600;
  background:transparent;color:var(--text2);cursor:pointer;transition:.18s;font-family:inherit;
}
.seg-pill button.on{background:var(--surface);color:var(--text);box-shadow:0 1px 4px rgba(0,0,0,.08)}

/* 大色塊選項（交易方向等） */
.tile-row{display:flex;gap:10px;flex-wrap:wrap}
.tile{
  flex:1;min-width:120px;padding:16px 18px;border-radius:var(--radius);
  border:2px solid var(--border);background:var(--surface);cursor:pointer;
  text-align:center;transition:all .18s;
}
.tile .tile-label{font-size:.95rem;font-weight:700}
.tile .tile-sub{font-size:.72rem;color:var(--text2);margin-top:4px}
.tile.on{border-color:var(--blue);background:rgba(0,113,227,.06);box-shadow:0 4px 16px rgba(0,113,227,.12)}
.tile.on.tint-green{border-color:var(--green);background:rgba(52,199,89,.08)}
.tile.on.tint-red{border-color:var(--red);background:rgba(255,59,48,.06)}

/* ═══════════ 學習教材 ═══════════ */
.learn-hero{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:24px;align-items:end;
  background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:24px;
  box-shadow:var(--shadow);
}
.learn-stats{display:flex;gap:12px;flex-wrap:wrap;justify-content:flex-end}
.learn-stats div{
  min-width:96px;background:#f9faf7;border:1px solid var(--border);border-radius:12px;
  padding:12px 14px;text-align:left;
}
.learn-stats b{display:block;font-size:1.35rem;line-height:1;color:var(--text)}
.learn-stats span{display:block;font-size:.72rem;color:var(--text2);margin-top:6px}
.learn-layout{display:grid;grid-template-columns:240px 1fr;gap:24px;align-items:start}
.learn-side{
  position:sticky;top:88px;display:flex;flex-direction:column;gap:6px;
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:12px;
  box-shadow:0 1px 2px rgba(32,40,33,.04);
}
.learn-side .side-group{
  font-size:.68rem;color:var(--text2);letter-spacing:.08em;margin:14px 4px 6px;
  text-transform:uppercase;font-weight:600;
}
.learn-side a,.side-tile{
  padding:10px 14px;border-radius:12px;font-size:.86rem;color:var(--text);
  cursor:pointer;transition:.15s;display:flex;justify-content:space-between;align-items:center;gap:8px;
  border:1px solid transparent;background:transparent;text-decoration:none;
}
.learn-side a:hover,.side-tile:hover{background:#f9faf7}
.learn-side a.active,.side-tile.active{
  background:#202421;color:#fff;border-color:#202421;
  box-shadow:0 8px 18px rgba(32,40,33,.14);font-weight:700;
}
.learn-side a.active .count{color:#202421;background:#fff}
.learn-side a .count{font-size:.68rem;color:var(--text2);background:rgba(0,0,0,.05);
  padding:2px 8px;border-radius:20px}
.learn-content{min-width:0}

@media(max-width:780px){
  .learn-hero{grid-template-columns:1fr}
  .learn-stats{justify-content:flex-start}
  .learn-layout{grid-template-columns:1fr}
  .learn-side{position:static;flex-direction:row;flex-wrap:wrap}
  .learn-side .side-group{width:100%}
}

.learning-board{
  display:grid;grid-template-columns:minmax(220px,.82fr) minmax(0,1.4fr);gap:18px;
  background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:22px;
  box-shadow:var(--shadow);margin-bottom:16px;
}
.learning-method{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:center;
  background:#202421;color:#fff;border-radius:16px;padding:22px 24px;margin-bottom:16px;
  box-shadow:var(--shadow);
}
.learning-method .eyebrow{color:rgba(255,255,255,.62)}
.learning-method h2{font-size:1.28rem;line-height:1.3;margin-bottom:8px}
.learning-method p{font-size:.86rem;line-height:1.65;color:rgba(255,255,255,.74);max-width:720px}
.method-rail{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.method-rail span{
  font-size:.76rem;font-weight:760;color:#202421;background:#fff;border-radius:999px;
  padding:7px 12px;box-shadow:0 10px 24px rgba(0,0,0,.14);
}
.method-rail span:nth-child(2){background:#dff1ff}
.method-rail span:nth-child(3){background:#efe8ff}
.method-rail span:nth-child(4){background:#e4f7ea}
.board-copy h2{font-size:1.35rem;line-height:1.25;margin-bottom:10px}
.board-copy p{font-size:.88rem;color:var(--text2);line-height:1.75}
.learning-cards{display:grid;gap:10px}
.learning-card{
  display:grid;grid-template-columns:auto 1fr;gap:5px 14px;text-align:left;
  border:1px solid var(--border);background:#f9faf7;border-radius:12px;padding:15px 16px;
  color:var(--text);font-family:inherit;cursor:pointer;transition:.18s;
}
.learning-card:hover{background:#fff;border-color:rgba(35,103,199,.28);box-shadow:var(--soft-shadow);transform:translateY(-1px)}
.learning-card .lc-step{
  grid-row:1/4;width:34px;height:34px;border-radius:10px;background:#202421;color:#fff;
  display:flex;align-items:center;justify-content:center;font-size:.74rem;font-weight:800;
}
.learning-card strong{font-size:.96rem;line-height:1.35}
.learning-card span:not(.lc-step){font-size:.8rem;color:var(--text2);line-height:1.55}
.learning-card em{font-style:normal;color:var(--blue);font-size:.78rem;font-weight:760}
.practice-strip{
  display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:16px;
}
.practice-strip div{
  background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:14px 16px;
}
.practice-strip b{display:block;font-size:.86rem;margin-bottom:5px}
.practice-strip span{font-size:.76rem;color:var(--text2);line-height:1.5}
.learn-shortcuts .module-card{min-height:110px}

/* ── 學習 HTML 文章 ── */
.learn-path-host{margin-bottom:18px}
.learn-path-head{margin-bottom:12px}
.learn-path-steps{display:grid;gap:8px}
.path-step{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px 14px}
.path-step summary{cursor:pointer;font-size:.88rem;list-style:none;display:flex;align-items:center;gap:10px}
.path-step summary::-webkit-details-marker{display:none}
.path-n{width:22px;height:22px;border-radius:50%;background:rgba(35,103,199,.12);color:var(--blue);display:inline-flex;align-items:center;justify-content:center;font-size:.72rem;font-weight:700;flex-shrink:0}
.path-step p{font-size:.82rem;color:var(--text2);margin:10px 0 8px;line-height:1.55}
.path-actions{display:flex;flex-wrap:wrap;gap:8px}
.la-link,.la-practice{
  border:1px solid var(--border);background:#f9faf7;border-radius:999px;padding:6px 12px;
  font-size:.76rem;cursor:pointer;color:var(--text);
}
.la-link:hover{border-color:rgba(175,82,222,.35);color:var(--purple)}
.la-practice{background:rgba(35,103,199,.08);border-color:rgba(35,103,199,.2);color:var(--blue);font-weight:650}
.learn-article .la-head{margin-bottom:16px}
.learn-article .la-kind{font-size:.72rem;color:var(--blue);font-weight:700;margin-bottom:6px}
.learn-article .la-title{font-size:1.45rem;line-height:1.25;margin:0 0 8px}
.learn-article .la-lead{font-size:.92rem;color:var(--text2);line-height:1.6;margin:0}
.learn-tabs{
  display:inline-flex;gap:3px;background:rgba(0,0,0,.05);border-radius:12px;padding:4px;margin:4px 0 16px;
  max-width:100%;overflow:auto;
}
.learn-tab{
  border:none;background:transparent;color:var(--text2);border-radius:9px;padding:8px 14px;
  font-size:.82rem;font-weight:760;cursor:pointer;font-family:inherit;white-space:nowrap;
}
.learn-tab.on{background:var(--surface);color:var(--text);box-shadow:0 1px 4px rgba(0,0,0,.08)}
.learn-tab-panel{display:grid;gap:14px}
.learn-tab-panel[hidden]{display:none}
.learning-panel{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px;
  box-shadow:0 1px 2px rgba(32,40,33,.04);
}
.panel-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.panel-head span{
  width:28px;height:28px;border-radius:8px;background:#202421;color:#fff;
  display:inline-flex;align-items:center;justify-content:center;font-size:.7rem;font-weight:820;flex-shrink:0;
}
.panel-head h2{font-size:.98rem;margin:0}
.insight-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px}
.insight-card{
  background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:13px 14px;min-height:104px;
}
.insight-card b{display:block;font-size:.7rem;color:var(--blue);margin-bottom:7px}
.insight-card p{font-size:.82rem;line-height:1.55;color:var(--text);margin:0}
.recall-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}
.recall-card{
  border:1px solid rgba(35,103,199,.16);background:rgba(35,103,199,.05);
  border-radius:12px;padding:13px 14px;display:flex;flex-direction:column;gap:10px;
}
.recall-q{font-size:.84rem;font-weight:720;line-height:1.5}
.recall-toggle{
  align-self:flex-start;border:1px solid rgba(35,103,199,.24);background:var(--surface);color:var(--blue);
  border-radius:999px;padding:6px 11px;font-size:.74rem;font-weight:720;cursor:pointer;font-family:inherit;
}
.recall-a{
  color:var(--text2);font-size:.8rem;line-height:1.55;background:var(--surface);
  border:1px solid var(--border);border-radius:10px;padding:10px 12px;
}
.section-ladder{display:grid;gap:8px}
.section-chip{
  background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:10px 12px;
}
.section-chip summary{cursor:pointer;list-style:none;font-size:.84rem;font-weight:760}
.section-chip summary::-webkit-details-marker{display:none}
.section-chip p{font-size:.8rem;color:var(--text2);line-height:1.6;margin:9px 0 0}
.review-track{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;position:relative;
}
.review-step{
  border:1px solid var(--border);background:#f9faf7;color:var(--text2);border-radius:10px;
  min-height:42px;font-size:.8rem;font-weight:760;cursor:pointer;font-family:inherit;
}
.review-step.on{background:#202421;color:#fff;border-color:#202421;box-shadow:0 8px 18px rgba(32,40,33,.14)}
.personal-note-input{
  width:100%;min-height:112px;resize:vertical;border:1px solid var(--border);border-radius:12px;
  padding:12px 14px;background:#f9faf7;color:var(--text);font:inherit;font-size:.86rem;line-height:1.55;outline:none;
}
.personal-note-input:focus{border-color:var(--blue);box-shadow:0 0 0 4px rgba(35,103,199,.12);background:#fff}
.personal-note-actions{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:10px}
.personal-note-status{font-size:.74rem;color:var(--text2)}
.learn-lab{display:grid;gap:16px}
.lab-hero{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:center;
  background:#202421;color:#fff;border-radius:16px;padding:22px 24px;box-shadow:var(--shadow);
}
.lab-hero .eyebrow{color:rgba(255,255,255,.62)}
.lab-hero h2{font-size:1.35rem;line-height:1.25;margin-bottom:8px}
.lab-hero p{font-size:.86rem;color:rgba(255,255,255,.74);line-height:1.65;max-width:760px}
.lab-score{background:#fff;color:#202421;border-radius:14px;padding:14px 18px;min-width:110px;text-align:center}
.lab-score b{display:block;font-size:1.45rem}.lab-score span{font-size:.72rem;color:var(--text2)}
.lab-game,.lab-notes{
  background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:16px;box-shadow:var(--shadow);
}
.match-board{display:grid;grid-template-columns:1fr 1.2fr;gap:14px}
.match-board>div{display:grid;gap:10px}
.match-card{
  min-height:58px;text-align:left;border:1px solid var(--border);background:#f9faf7;border-radius:12px;
  padding:12px 14px;color:var(--text);font:inherit;font-size:.86rem;font-weight:760;cursor:pointer;transition:.16s;
}
.match-card small{display:block;font-weight:500;color:var(--text2);margin-top:4px}
.match-card.picked{border-color:var(--blue);box-shadow:0 0 0 4px rgba(35,103,199,.12);background:#fff}
.match-card.matched{border-color:rgba(31,157,102,.28);background:rgba(31,157,102,.08);color:var(--green)}
.match-card.wrong{border-color:rgba(216,79,69,.35);background:rgba(216,79,69,.08);color:var(--red)}
.lab-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;margin-top:14px}
.note-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}
.note-card{
  text-align:left;border:1px solid var(--border);background:#f9faf7;border-radius:12px;padding:13px 14px;
  color:var(--text);font:inherit;cursor:pointer;
}
.note-card:hover{border-color:rgba(35,103,199,.3);box-shadow:var(--soft-shadow)}
.note-card b{display:block;font-size:.88rem;line-height:1.35}.note-card span{font-size:.68rem;color:var(--text2)}
.note-card p{font-size:.76rem;color:var(--text2);line-height:1.45;margin-top:8px}
.la-principles{background:#f7f9f5;border:1px solid var(--border);border-radius:14px;padding:14px 16px;margin:16px 0}
.la-principles-head h2{font-size:.95rem;margin:0 0 4px}
.la-principles-head p{font-size:.78rem;color:var(--text2);margin:0 0 10px;line-height:1.5}
.la-principle-chips,.learn-article .principle-chips{display:flex;flex-wrap:wrap;gap:8px}
.principle-chip,.learn-article .principle-chip{
  border:1px solid rgba(175,82,222,.25);background:rgba(175,82,222,.08);color:#5b3f99;
  border-radius:999px;padding:6px 12px;font-size:.76rem;cursor:pointer;
}
.principle-chip:hover{background:rgba(175,82,222,.14)}
.la-toc{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px 14px;margin:0 0 16px}
.la-toc-title{font-size:.72rem;color:var(--text2);margin-bottom:8px;font-weight:700}
.la-toc-links{display:flex;flex-wrap:wrap;gap:6px 10px}
.la-toc-links a{font-size:.78rem;color:var(--blue);text-decoration:none}
.la-toc-links a.lv3{padding-left:8px;color:var(--text2)}
.learn-body{margin-top:4px}
.la-footer{margin-top:22px;padding-top:16px;border-top:1px solid var(--border)}
.la-footer-title{font-size:.82rem;font-weight:700;margin-bottom:10px}
.la-tool-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.la-tool-card{
  text-align:left;border:1px solid var(--border);background:var(--surface);border-radius:12px;padding:12px 14px;cursor:pointer;
}
.la-tool-card strong{display:block;font-size:.86rem;margin-bottom:4px}
.la-tool-card span{font-size:.74rem;color:var(--text2)}
.la-tool-card:hover{border-color:rgba(35,103,199,.28);box-shadow:var(--soft-shadow)}
.case-badge{font-size:.62rem;color:var(--purple);background:rgba(175,82,222,.1);padding:2px 7px;border-radius:999px;margin-left:6px;vertical-align:middle}
.principle-groups{display:grid;gap:10px}
.principle-group{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px 12px}
.principle-group summary{cursor:pointer;font-weight:700;font-size:.88rem}
.pg-count{font-size:.68rem;color:var(--text2);font-weight:500;margin-left:6px}
.pg-grid{margin-top:10px}
.pg-card .mod-name{font-size:.82rem;line-height:1.35}
@media(max-width:760px){
  .la-tool-grid{grid-template-columns:1fr}
  .learning-method{grid-template-columns:1fr}
  .method-rail{justify-content:flex-start}
  .review-track{grid-template-columns:repeat(2,minmax(0,1fr))}
  .lab-hero{grid-template-columns:1fr}
  .match-board{grid-template-columns:1fr}
}
@media(max-width:860px){
  .learning-board{grid-template-columns:1fr}
  .practice-strip{grid-template-columns:1fr}
}

.stage{margin-bottom:28px}
.stage-title{font-size:1.1rem;font-weight:700;margin-bottom:6px}
.stage-badge{font-size:.66rem;font-weight:700;padding:3px 10px;border-radius:20px}
.stage-desc{font-size:.84rem;color:var(--text2);margin-bottom:14px;line-height:1.6}
.module-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:12px}
.module-card{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:18px 20px;cursor:pointer;transition:transform .15s,box-shadow .2s;
  display:flex;flex-direction:column;gap:8px;box-shadow:var(--shadow);
}
.module-card:hover{transform:translateY(-2px);box-shadow:var(--soft-shadow)}
.module-card .mod-name{font-size:.98rem;font-weight:700}
.module-card .mod-meta{font-size:.76rem;color:var(--text2);line-height:1.55}
.module-card .mod-tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.chip-tag{
  font-size:.68rem;color:var(--text2);background:rgba(0,0,0,.04);
  border-radius:20px;padding:3px 10px;
}

.search-box{display:flex;gap:10px;margin-bottom:16px}
.search-box input{
  flex:1;background:var(--surface);border:1px solid var(--border);border-radius:12px;
  color:var(--text);padding:12px 16px;font-size:.92rem;outline:none;
  box-shadow:var(--shadow);font-family:inherit;
}
.search-box input:focus{border-color:var(--blue);box-shadow:0 0 0 4px rgba(0,113,227,.15)}
.glossary-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.gloss-item{
  background:var(--card);border:1px solid var(--border);border-radius:12px;
  padding:12px 14px;cursor:pointer;transition:.15s;box-shadow:var(--shadow);
}
.gloss-item:hover{border-color:rgba(0,113,227,.3);transform:translateY(-1px)}
.gloss-item .gi-title{font-size:.86rem;font-weight:600}
.gloss-item .gi-sub{font-size:.72rem;color:var(--text2);margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.list-meta{font-size:.78rem;color:var(--text2);margin-bottom:12px}

/* Markdown */
.md{font-size:.94rem;line-height:1.75;color:var(--text)}
.md h1{font-size:1.55rem;font-weight:700;margin:.2em 0 .5em;letter-spacing:-.02em}
.md h2{font-size:1.22rem;font-weight:700;margin:1.4em 0 .5em;padding-bottom:.35em;border-bottom:1px solid var(--border)}
.md h3{font-size:1.05rem;font-weight:700;margin:1.2em 0 .4em}
.md h4{font-size:.94rem;font-weight:600;margin:1em 0 .3em;color:var(--text2)}
.md p{margin:.65em 0}
.md ul,.md ol{margin:.5em 0 .5em 1.3em}
.md li{margin:.3em 0}
.md blockquote{
  border-left:4px solid var(--blue);background:rgba(0,113,227,.05);
  margin:.9em 0;padding:.7em 1.1em;color:var(--text2);border-radius:0 12px 12px 0;
}
.md code{background:rgba(0,0,0,.05);padding:2px 8px;border-radius:6px;color:var(--purple);font-size:.88em}
.md pre{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:14px;overflow:auto;margin:.9em 0;box-shadow:var(--shadow)}
.md pre code{background:none;padding:0;color:var(--text2)}
.md table{border-collapse:collapse;width:100%;margin:1em 0;font-size:.86rem;display:block;overflow-x:auto;border-radius:12px}
.md th,.md td{border:1px solid var(--border);padding:10px 14px;text-align:left}
.md th{background:rgba(0,0,0,.03);font-weight:600}
.md hr{border:none;border-top:1px solid var(--border);margin:1.4em 0}
.md a{color:var(--blue)}
.md .wlink{color:var(--purple);border-bottom:1px dashed rgba(175,82,222,.4);cursor:pointer;font-weight:500}
.md .wlink:hover{border-bottom-style:solid}
.md .wlink.dead{color:var(--text2);border-bottom:none;cursor:default}

/* Mermaid 圖表 */
.mermaid-wrap{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  padding:20px;margin:1.2em 0;overflow-x:auto;box-shadow:var(--shadow);
}
.mermaid-wrap .mermaid{display:flex;justify-content:center}
.mermaid-wrap svg{max-width:100%;height:auto}

.note-toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.back-link{
  display:inline-flex;align-items:center;gap:6px;font-size:.84rem;color:var(--text2);
  cursor:pointer;margin-bottom:16px;padding:6px 12px;border-radius:10px;
  background:rgba(0,0,0,.04);transition:.15s;
}
.back-link:hover{color:var(--blue);background:rgba(0,113,227,.08)}
.note-frontmatter{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px}
.fm-tag{
  font-size:.72rem;color:var(--text2);background:var(--surface);
  border:1px solid var(--border);border-radius:20px;padding:4px 12px;box-shadow:var(--shadow);
}

/* 知識圖譜 */
.graph-panel{
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  box-shadow:var(--shadow);overflow:hidden;
}
.graph-toolbar{
  display:flex;flex-wrap:wrap;gap:10px;align-items:center;padding:14px 16px;
  border-bottom:1px solid var(--border);
}
.graph-canvas{min-height:420px;background:linear-gradient(180deg,#fafafa 0%,#f5f5f7 100%);padding:14px}
.graph-foot{font-size:.74rem;color:var(--text2);padding:10px 16px;border-top:1px solid var(--border)}
.graph-legend{display:flex;flex-wrap:wrap;gap:12px;font-size:.72rem}
.graph-legend span{display:inline-flex;align-items:center;gap:5px}
.graph-legend i{width:10px;height:10px;border-radius:50%;display:inline-block}
.knowledge-map{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,.36fr);gap:14px;align-items:start}
.kg-map{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
.kg-column{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:12px;
  box-shadow:0 1px 2px rgba(32,40,33,.04);min-width:0;
}
.kg-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.kg-head b{font-size:.86rem}.kg-head span{font-size:.7rem;color:var(--text2);background:#f0f2ee;border-radius:999px;padding:2px 8px}
.kg-nodes{display:grid;gap:7px;max-height:420px;overflow:auto;padding-right:2px}
.kg-node,.kg-relation,.kg-edge{
  width:100%;text-align:left;border:1px solid var(--border);background:#f9faf7;color:var(--text);
  border-radius:10px;padding:9px 10px;font:inherit;cursor:pointer;transition:.15s;
}
.kg-node:hover,.kg-relation:hover,.kg-edge:hover{border-color:rgba(35,103,199,.28);background:#fff}
.kg-node.active{border-color:var(--blue);box-shadow:0 0 0 3px rgba(35,103,199,.12);background:#fff}
.kg-node span{display:block;font-size:.78rem;font-weight:760;line-height:1.3}
.kg-node small{display:block;font-size:.66rem;color:var(--text2);margin-top:3px}
.kg-focus{
  position:sticky;top:96px;background:var(--surface);border:1px solid var(--border);border-radius:14px;
  box-shadow:var(--shadow);padding:14px;min-height:260px;
}
.kg-focus-head b{display:block;font-size:.95rem;line-height:1.35}.kg-focus-head span{display:block;font-size:.72rem;color:var(--text2);margin-top:4px}
.kg-focus-actions{margin:12px 0}.kg-relations{display:grid;gap:8px}
.kg-relation span{display:block;font-size:.66rem;color:var(--blue);font-weight:800;margin-bottom:4px}
.kg-relation b{font-size:.78rem;line-height:1.35}
.kg-list{grid-column:1/-1;display:grid;gap:8px}
.kg-edge{display:grid;grid-template-columns:minmax(0,1fr) 24px minmax(0,1fr);align-items:center;gap:8px}
.kg-edge span{font-size:.8rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.kg-edge i{height:2px;background:var(--border);position:relative}.kg-edge i:after{content:'';position:absolute;right:0;top:-3px;border-left:6px solid var(--border);border-top:4px solid transparent;border-bottom:4px solid transparent}
@media(max-width:880px){.knowledge-map{grid-template-columns:1fr}.kg-focus{position:static}.kg-edge{grid-template-columns:1fr}.kg-edge i{display:none}}

.quiz-q{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:16px 18px;margin-bottom:12px;box-shadow:var(--shadow);
}
.quiz-q .q-text{font-size:.92rem;line-height:1.65}
.quiz-q .q-src{font-size:.74rem;color:var(--text2);margin-top:10px;cursor:pointer}

/* ═══════════ 個股工具 ═══════════ */
.finbox-search{display:flex;gap:10px;margin-bottom:8px;max-width:480px}
.finbox-search input{
  flex:1;background:var(--surface);border:1px solid var(--border);border-radius:12px;
  color:var(--text);padding:14px 18px;font-size:1.05rem;outline:none;
  box-shadow:var(--shadow);font-family:inherit;letter-spacing:.03em;text-transform:uppercase;
}
.finbox-search input:focus{border-color:var(--blue);box-shadow:0 0 0 4px rgba(0,113,227,.12)}
.finbox-search button{
  background:var(--blue);color:#fff;border:none;padding:0 24px;border-radius:12px;
  font-weight:600;font-size:.92rem;cursor:pointer;box-shadow:0 4px 14px rgba(0,113,227,.25);
}
.finbox-search button:disabled{opacity:.5;cursor:wait}
.finbox-examples{font-size:.78rem;color:var(--text2);margin-bottom:20px}
.finbox-examples b{cursor:pointer;color:var(--blue);font-weight:600;margin:0 6px}
.stock-learn-bridge{
  background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:14px 16px;
  box-shadow:var(--soft-shadow);margin:0 0 18px;
}
.slb-head{display:flex;justify-content:space-between;gap:12px;align-items:baseline;flex-wrap:wrap;margin-bottom:12px}
.slb-head b{font-size:.9rem}.slb-head span{font-size:.74rem;color:var(--text2)}
.slb-steps{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
.slb-steps button{
  text-align:left;border:1px solid var(--border);background:#f9faf7;border-radius:12px;padding:11px 12px;
  color:var(--text);font:inherit;cursor:pointer;min-height:86px;transition:.15s;
}
.slb-steps button:hover{border-color:rgba(35,103,199,.32);background:#fff;transform:translateY(-1px);box-shadow:var(--soft-shadow)}
.slb-steps span{
  width:22px;height:22px;border-radius:7px;background:#202421;color:#fff;display:inline-flex;
  align-items:center;justify-content:center;font-size:.68rem;font-weight:900;margin-bottom:8px;
}
.slb-steps b{display:block;font-size:.82rem;line-height:1.25}.slb-steps small{display:block;font-size:.68rem;color:var(--text2);line-height:1.35;margin-top:4px}

.sub-tabs{
  display:flex;gap:4px;background:rgba(0,0,0,.04);border-radius:12px;
  padding:4px;margin:8px 0 20px;flex-wrap:wrap;width:fit-content;
}
.sub-tabs a{
  padding:10px 20px;border-radius:10px;font-size:.86rem;font-weight:600;
  color:var(--text2);cursor:pointer;transition:.15s;
}
.sub-tabs a:hover{color:var(--text)}
.sub-tabs a.active{background:var(--surface);color:var(--blue);box-shadow:0 1px 4px rgba(0,0,0,.08)}
.stk-pane[hidden]{display:none}

.metric-head{
  display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px 18px;
  box-shadow:var(--shadow);margin-bottom:12px;
}
.metric-head b{display:block;font-size:1rem}
.metric-head span{display:block;font-size:.78rem;color:var(--text2);margin-top:4px}
.metric-source-note{
  font-size:.78rem;line-height:1.65;color:var(--text2);background:#f9faf7;
  border:1px solid var(--border);border-radius:12px;padding:12px 14px;margin-bottom:16px;
}
.metric-board{display:grid;gap:18px}
.decision-panel{
  border:1px solid var(--border);border-radius:16px;padding:20px 22px;background:var(--surface);
  box-shadow:var(--shadow);border-left:6px solid var(--text2);
}
.decision-panel.good{border-left-color:var(--green)}
.decision-panel.warn{border-left-color:var(--orange)}
.decision-panel.bad{border-left-color:var(--red)}
.decision-kicker{font-size:.7rem;color:var(--text2);font-weight:800;letter-spacing:.08em;text-transform:uppercase;margin-bottom:8px}
.decision-title{font-size:1.55rem;font-weight:850;line-height:1.2}
.decision-panel.good .decision-title{color:var(--green)}
.decision-panel.warn .decision-title{color:var(--orange)}
.decision-panel.bad .decision-title{color:var(--red)}
.decision-score{font-size:.82rem;color:var(--text2);margin-top:6px}
.decision-cols{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:16px}
.decision-cols div{background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:12px 14px}
.decision-cols b{display:block;font-size:.78rem;margin-bottom:8px}
.decision-cols p{font-size:.76rem;color:var(--text2);line-height:1.55;margin:6px 0}
.metric-section{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px;
  box-shadow:var(--shadow);
}
.metric-section-head{display:flex;align-items:baseline;gap:10px;margin-bottom:12px;flex-wrap:wrap}
.metric-section-head h3{font-size:.98rem;line-height:1.2}
.metric-section-head span{font-size:.74rem;color:var(--text2)}
.metric-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.metric-card{
  min-height:106px;border:1px solid var(--border);border-radius:12px;padding:12px;
  background:#f9faf7;display:flex;flex-direction:column;gap:7px;
}
.metric-card.good{border-color:rgba(31,157,102,.22);background:rgba(31,157,102,.06)}
.metric-card.warn{border-color:rgba(200,138,29,.26);background:rgba(200,138,29,.07)}
.metric-card.bad{border-color:rgba(216,79,69,.24);background:rgba(216,79,69,.06)}
.metric-card.missing{border-style:dashed;opacity:.78}
.info-btn{
  width:18px;height:18px;border-radius:50%;border:1px solid var(--border);background:var(--surface);
  color:var(--text2);font-size:.7rem;line-height:1;cursor:help;flex-shrink:0;padding:0;
  display:inline-flex;align-items:center;justify-content:center;transition:.15s;font-weight:700;
  vertical-align:middle;margin-left:3px;
}
.info-btn:hover,.info-btn:focus{border-color:var(--blue);color:var(--blue);outline:none}
.metric-name{
  font-size:.72rem;color:var(--text2);line-height:1.35;
  display:flex;align-items:flex-start;justify-content:space-between;gap:4px;
}
.metric-name .info-btn{margin-top:0;flex-shrink:0}
.metric-section-head h3{display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap}
.page-sub .info-btn,.event-title .info-btn{margin-left:2px;vertical-align:middle}
.metric-value{font-size:1.12rem;font-weight:800;line-height:1.2;color:var(--text);word-break:break-word}
.metric-card.good .metric-value{color:var(--green)}
.metric-card.warn .metric-value{color:var(--orange)}
.metric-card.bad .metric-value{color:var(--red)}
.metric-card.missing .metric-value{font-size:.92rem;color:var(--text2)}
.metric-note{font-size:.7rem;color:var(--text2);line-height:1.45;margin-top:auto}
.strategy-panel{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px;
  box-shadow:var(--shadow);
}
.strategy-table{display:grid;gap:8px;margin-bottom:14px}
.strategy-row{
  display:grid;grid-template-columns:minmax(180px,1fr) 120px 100px;gap:12px;align-items:center;
  background:#f9faf7;border:1px solid var(--border);border-radius:10px;padding:10px 12px;
  font-size:.78rem;
}
.strategy-row b{display:block;font-size:.82rem}
.strategy-row span{display:block;color:var(--text2);font-size:.7rem;margin-top:3px}
.formula-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}
.formula-card{border:1px solid var(--border);border-radius:12px;background:#fbfcfa;padding:12px}
.formula-title{font-size:.78rem;font-weight:800;margin-bottom:8px;display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.formula-card pre{
  background:#202421;color:#e9efe7;border-radius:10px;padding:10px;overflow:auto;
  font-size:.76rem;line-height:1.45;margin:0 0 8px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.formula-note{font-size:.72rem;color:var(--text2);line-height:1.45}
.calendar-page .page-sub{max-width:880px}
.calendar-hero{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}
.calendar-watch-panel{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px 16px;
  margin-bottom:16px;box-shadow:var(--soft-shadow);position:relative;z-index:2;
}
.cal-intro{
  background:#f7f9f5;border:1px solid var(--border);border-radius:14px;padding:14px 16px;
  margin-bottom:16px;font-size:.78rem;line-height:1.55;color:var(--text2);
}
.cal-intro b{display:block;color:var(--text);font-size:.84rem;margin-bottom:6px}
.cal-intro p{margin:0 0 8px}
.cal-intro ul{margin:0;padding-left:18px}
.cal-intro li{margin:4px 0}
.cal-intro .info-btn.demo{
  display:inline-flex;width:18px;height:18px;font-size:.62rem;vertical-align:middle;
  pointer-events:none;margin:0 2px;
}
.cal-more-inline{font-size:.7rem;color:var(--text2);background:rgba(102,112,100,.12);padding:1px 6px;border-radius:999px}
.calendar-watch-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;margin-bottom:10px}
.calendar-watch-head b{display:block;font-size:.88rem}
.calendar-watch-head span{display:block;font-size:.72rem;color:var(--text2);margin-top:3px}
.calendar-watch-add{display:flex;gap:8px;align-items:center;flex:1;justify-content:flex-end;min-width:240px}
.calendar-watch-add input{
  flex:1;min-width:0;max-width:260px;border:1px solid var(--border);border-radius:9px;padding:8px 11px;
  background:#f9faf7;color:var(--text);font-size:.86rem;
}
.calendar-watch-add button{
  border:0;background:var(--blue);color:#fff;border-radius:9px;padding:8px 14px;font-weight:800;cursor:pointer;white-space:nowrap;
}
.watch-chip-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;min-height:36px}
.watch-empty{font-size:.76rem;color:var(--text2);line-height:1.5}
.watch-chip{
  display:inline-flex;align-items:center;gap:4px;padding:4px 6px 4px 10px;border-radius:999px;
  background:rgba(35,103,199,.08);border:1px solid rgba(35,103,199,.22);font-size:.78rem;font-weight:800;color:var(--blue);
}
.watch-chip-label{line-height:1.2}
.watch-chip-x{
  width:22px;height:22px;border:0;border-radius:50%;background:var(--surface);color:var(--text2);
  cursor:pointer;font-size:1rem;line-height:1;padding:0;flex-shrink:0;
}
.watch-chip-x:hover{background:var(--red);color:#fff}
.calendar-msg{font-size:.74rem;margin-top:8px;padding:8px 10px;border-radius:8px;line-height:1.45}
.calendar-msg.good{background:rgba(31,157,102,.08);color:#1a6b45;border:1px solid rgba(31,157,102,.18)}
.calendar-msg.warn{background:rgba(200,138,29,.08);color:#8a5a12;border:1px solid rgba(200,138,29,.18)}
.calendar-msg.bad{background:rgba(216,79,69,.08);color:#9a3a32;border:1px solid rgba(216,79,69,.16)}
.calendar-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:12px}
.calendar-stat{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px;box-shadow:var(--soft-shadow);min-width:0;
}
.calendar-stat b{display:block;font-size:1.05rem;line-height:1.2;word-break:break-word}
.calendar-stat span{display:block;font-size:.74rem;color:var(--text2);margin-top:5px;line-height:1.45}
.cal-loading{padding:28px 0;text-align:center;color:var(--text2);font-size:.82rem}
.cal-legend{
  display:flex;flex-wrap:wrap;gap:12px;align-items:center;font-size:.72rem;color:var(--text2);margin-bottom:12px;
}
.cal-legend .leg{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:4px;vertical-align:middle}
.cal-legend .leg.high{background:var(--red)}
.cal-legend .leg.medium{background:var(--orange)}
.cal-legend .leg.fed{background:var(--purple)}
.cal-legend .leg.deriv{background:#a8386c}
.cal-legend .leg.cb{background:#2367c7}
.cal-legend .leg.earn{background:var(--blue)}
.cal-legend-note{margin-left:auto}
.cal-board{display:flex;flex-direction:column;gap:16px;margin-bottom:14px;width:100%}
.cal-month{
  width:100%;min-width:0;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px;box-shadow:var(--shadow);
}
.cal-month-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:10px}
.cal-month-head h3{font-size:.95rem;line-height:1.2;margin:0}
.cal-month-head span{font-size:.72rem;color:var(--text2)}
.cal-weekdays{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;margin-bottom:6px}
.cal-weekdays span{text-align:center;font-size:.68rem;color:var(--text2);font-weight:700;padding:4px 0}
.cal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;width:100%}
.cal-cell{
  min-height:92px;min-width:0;border:1px solid var(--border);border-radius:10px;background:#f9faf7;padding:6px;
  display:flex;flex-direction:column;gap:4px;text-align:left;font:inherit;color:inherit;
}
.cal-cell.pad,.cal-cell.off{opacity:.35;background:#fbfcfa;pointer-events:none}
.cal-cell.off .cal-day{color:var(--text2)}
.cal-cell[data-date]{cursor:pointer;transition:border-color .15s,box-shadow .15s,background .15s}
.cal-cell[data-date]:hover{border-color:rgba(35,103,199,.35);background:#f5f8ff}
.cal-cell.today{border-color:var(--blue);box-shadow:inset 0 0 0 1px rgba(35,103,199,.25);background:rgba(35,103,199,.05)}
.cal-cell.selected{box-shadow:inset 0 0 0 2px var(--blue);background:rgba(35,103,199,.08)}
.cal-cell.has-hot{border-color:rgba(216,79,69,.35)}
.cal-day-top{display:flex;align-items:center;justify-content:space-between;gap:4px}
.cal-day{font-size:.78rem;font-weight:850;line-height:1}
.cal-count{font-size:.62rem;color:var(--text2);background:var(--surface);border:1px solid var(--border);border-radius:999px;padding:1px 5px;flex-shrink:0}
.cal-events{display:flex;flex-direction:column;gap:3px;min-width:0;overflow:hidden;pointer-events:none}
.cal-ev{
  display:block;width:100%;max-width:100%;font-size:.62rem;line-height:1.25;padding:3px 5px;border-radius:6px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:700;border:0;text-align:left;
  font-family:inherit;cursor:default;
}
.cal-ev.high{background:rgba(216,79,69,.14);color:#9a3a32}
.cal-ev.medium{background:rgba(200,138,29,.16);color:#8a5a12}
.cal-ev.low{background:rgba(102,112,100,.12);color:var(--text2)}
.cal-ev.cat-fed{background:rgba(123,87,201,.14);color:#5b3f99}
.cal-ev.cat-earnings{background:rgba(35,103,199,.12);color:var(--blue)}
.cal-ev.cat-derivatives{background:rgba(168,56,108,.14);color:#8a3058}
.cal-ev.cat-market{background:rgba(102,112,100,.14);color:var(--text2)}
.cal-ev.cat-central_bank{background:rgba(35,103,199,.1);color:#1e4f8f}
.cal-more,.cal-quiet{font-size:.6rem;color:var(--text2)}
body.cal-modal-open{overflow:hidden}
.cal-modal{
  position:fixed;inset:0;z-index:450;display:flex;align-items:center;justify-content:center;padding:20px;
}
.cal-modal[hidden]{display:none}
.cal-modal-backdrop{
  position:absolute;inset:0;background:rgba(0,0,0,.35);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
}
.cal-modal-panel{
  position:relative;z-index:1;width:min(540px,100%);max-height:min(82vh,680px);overflow:auto;
  background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:16px 18px;
  box-shadow:0 24px 80px rgba(0,0,0,.18);animation:fadeInUp .2s ease both;
}
.cal-day-detail-head{display:flex;align-items:center;gap:10px;margin-bottom:12px;flex-wrap:wrap}
.cal-day-detail-head b{font-size:.98rem}
.cal-day-detail-head span{font-size:.74rem;color:var(--text2);margin-right:auto}
.cal-day-close{
  margin-left:auto;border:1px solid var(--border);background:#f9faf7;color:var(--text2);
  width:30px;height:30px;border-radius:8px;cursor:pointer;font-size:.9rem;flex-shrink:0;
}
.cal-day-close:hover{border-color:var(--red);color:var(--red)}
.cal-detail-list{display:grid;gap:8px}
.cal-detail-row{
  display:grid;grid-template-columns:minmax(0,1fr) 88px;gap:10px;align-items:start;
  background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:11px 12px;
}
.cal-detail-row.high{border-left:5px solid var(--red)}
.cal-detail-row.medium{border-left:5px solid var(--orange)}
.cal-detail-row.low{border-left:5px solid var(--text2)}
.cal-detail-title{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:.86rem}
.cal-detail-title b{font-size:.88rem}
.cal-detail-note{font-size:.72rem;color:var(--text2);line-height:1.45;margin-top:4px}
.cal-detail-meta{text-align:right;font-size:.74rem;font-weight:800}
.cal-detail-meta small{display:block;font-size:.68rem;color:var(--text2);margin-top:3px;font-weight:500}
.event-impact{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;font-size:.68rem;font-weight:900;color:#fff;flex-shrink:0}
.event-impact.high{background:var(--red)}
.event-impact.medium{background:var(--orange)}
.event-impact.low{background:var(--text2)}
.event-symbol{font-size:.68rem;color:var(--blue);font-weight:850;background:rgba(35,103,199,.08);border-radius:999px;padding:3px 7px}
.stock-detail-layout{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(280px,.8fr);gap:14px;align-items:start}
.company-profile{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px;box-shadow:var(--shadow);
}
.profile-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;border-bottom:1px solid var(--border);padding-bottom:12px;margin-bottom:12px}
.profile-head b{display:block;font-size:.95rem;line-height:1.3}
.profile-head span{display:block;font-size:.72rem;color:var(--text2);margin-top:4px}
.profile-price{font-size:1.2rem;font-weight:900;color:var(--blue);white-space:nowrap}
.profile-stats{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-bottom:12px}
.profile-stats div{background:#f9faf7;border:1px solid var(--border);border-radius:10px;padding:9px}
.profile-stats span{display:block;font-size:.68rem;color:var(--text2);margin-bottom:4px}
.profile-stats b{font-size:.76rem;line-height:1.3}
.profile-desc{font-size:.76rem;line-height:1.62;color:var(--text2);margin:10px 0}
.profile-meta{display:grid;gap:6px;font-size:.72rem;color:var(--text2);line-height:1.45}
.profile-meta a{font-weight:800}
.profile-events{display:grid;gap:6px;margin-top:12px;background:#f9faf7;border:1px solid var(--border);border-radius:10px;padding:10px}
.profile-events b{font-size:.74rem}
.profile-events span{font-size:.72rem;color:var(--text2);line-height:1.4}
.company-intel{display:grid;gap:14px;margin-top:14px}
.intel-section{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:16px;box-shadow:var(--shadow);
}
.chain-map{display:grid;grid-template-columns:1fr .8fr 1fr;gap:10px;align-items:stretch}
.chain-map div{background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:12px;display:grid;gap:7px}
.chain-map b{font-size:.82rem}
.chain-map span{font-size:.72rem;color:var(--text2);line-height:1.35}
.chain-links{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.chain-links a,.peer-chips button{
  border:1px solid var(--border);background:#fbfcfa;color:var(--blue);border-radius:999px;
  padding:6px 10px;font-size:.72rem;font-weight:800;cursor:pointer;
}
.peer-chips{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.officer-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}
.officer-card{background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:12px}
.officer-card b{display:block;font-size:.82rem}
.officer-card span{display:block;font-size:.72rem;color:var(--text2);line-height:1.4;margin-top:5px}
.officer-card small{display:block;font-size:.68rem;color:var(--text2);margin-top:8px}
.insider-list{display:grid;gap:8px}
.insider-summary{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-bottom:10px}
.insider-summary div{background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:12px}
.insider-summary b{display:block;font-size:1.25rem}
.insider-summary span{font-size:.72rem;color:var(--text2)}
.insider-summary .good b{color:var(--green)}
.insider-summary .bad b{color:var(--red)}
.insider-row{
  display:grid;grid-template-columns:1fr 110px 130px;gap:10px;align-items:center;
  background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:11px 12px;color:var(--text);
}
.insider-row.good{border-left:5px solid var(--green)}
.insider-row.bad{border-left:5px solid var(--red)}
.insider-row.warn{border-left:5px solid var(--orange)}
.insider-row b{display:block;font-size:.8rem}
.insider-row span{display:block;font-size:.68rem;color:var(--text2);margin-top:3px;line-height:1.35}
.news-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px}
.news-card{background:#f9faf7;border:1px solid var(--border);border-radius:12px;padding:12px;color:var(--text)}
.news-card:hover{border-color:rgba(35,103,199,.28)}
.news-card b{display:block;font-size:.82rem;line-height:1.35}
.news-card span{display:block;font-size:.68rem;color:var(--text2);margin-top:7px}
.news-card p{font-size:.72rem;color:var(--text2);line-height:1.5;margin-top:8px}
@media(max-width:520px){
  .metric-grid{grid-template-columns:1fr 1fr}
  .metric-card{min-height:116px}
  .decision-cols{grid-template-columns:1fr}
  .strategy-row{grid-template-columns:1fr}
  .calendar-hero{display:block}
  .calendar-watch-head{align-items:stretch;flex-direction:column}
  .calendar-watch-add{width:100%;min-width:0;justify-content:stretch}
  .calendar-watch-add input{max-width:none}
  .calendar-summary{grid-template-columns:1fr}
  .cal-legend-note{margin-left:0;width:100%}
  .cal-cell{min-height:78px}
  .cal-detail-row{grid-template-columns:1fr}
  .cal-detail-meta{text-align:left;margin-top:6px}
  .stock-detail-layout{grid-template-columns:1fr}
  .chain-map{grid-template-columns:1fr}
  .insider-row{grid-template-columns:1fr}
  .slb-steps{grid-template-columns:1fr 1fr}
}

.chart-wrap{
  position:relative;width:100%;background:var(--surface);
  border:1px solid var(--border);border-radius:var(--radius);padding:12px;box-shadow:var(--shadow);
}
.chart-wrap svg{display:block;width:100%;height:auto}
.chart-empty{padding:48px 0;text-align:center;color:var(--text2)}
.chart-legend{display:flex;gap:16px;font-size:.78rem;color:var(--text2);margin-bottom:8px}
.chart-legend i{display:inline-block;width:12px;height:12px;border-radius:4px;margin-right:6px}
.chart-hover{font-size:.8rem;color:var(--text2);margin-top:8px;min-height:1.2em}
.range-btns{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px}
.range-btns button{
  background:var(--surface);border:1px solid var(--border);color:var(--text2);
  border-radius:10px;padding:8px 16px;font-size:.82rem;font-weight:600;
  cursor:pointer;font-family:inherit;box-shadow:var(--shadow);transition:.15s;
}
.range-btns button:hover{border-color:var(--blue)}
.range-btns button.active{background:var(--blue);border-color:var(--blue);color:#fff}

.fin-summary{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:22px 26px;margin-bottom:20px;display:grid;grid-template-columns:auto 1fr;
  gap:24px;align-items:center;box-shadow:var(--shadow);
}
.fin-verdict .v-big{font-size:2.5rem;font-weight:800;line-height:1}
.fin-verdict .v-sub{font-size:.78rem;color:var(--text2);margin-top:4px}
.fin-lights{display:flex;gap:20px}
.fin-light{text-align:center}
.fin-light .fl-num{font-size:1.55rem;font-weight:700}
.fin-light .fl-lab{font-size:.72rem;color:var(--text2);margin-top:4px}
.fin-co{font-size:.84rem;color:var(--text2);margin-bottom:10px}
.fin-co b{color:var(--text);font-size:1.08rem}
.fin-fresh{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;font-size:.76rem;color:var(--text2);margin-bottom:18px}

.fin-step{margin-bottom:20px}
.fin-step-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.fin-step-num{
  width:28px;height:28px;border-radius:10px;background:rgba(0,113,227,.1);
  color:var(--blue);font-size:.8rem;font-weight:700;
  display:flex;align-items:center;justify-content:center;
}
.fin-step-title{font-size:1.02rem;font-weight:700}
.check-row{
  background:var(--card);border:1px solid var(--border);border-radius:12px;
  padding:14px 16px;margin-bottom:8px;display:grid;grid-template-columns:10px 1fr auto;
  gap:14px;align-items:center;border-left:4px solid var(--border);box-shadow:var(--shadow);
}
.check-row.good{border-left-color:var(--green)}
.check-row.warn{border-left-color:var(--yellow)}
.check-row.bad{border-left-color:var(--red)}
.check-row.na{border-left-color:var(--text2);opacity:.75}
.check-dot{width:10px;height:10px;border-radius:50%}
.check-row.good .check-dot{background:var(--green)}
.check-row.warn .check-dot{background:var(--yellow)}
.check-row.bad .check-dot{background:var(--red)}
.check-main .ck-label{font-size:.9rem;font-weight:600}
.check-main .ck-note{font-size:.8rem;color:var(--text2);line-height:1.55;margin-top:4px}
.check-main .ck-links{margin-top:6px;display:flex;flex-wrap:wrap;gap:6px}
.check-main .ck-links .wlink{font-size:.74rem;color:var(--purple);cursor:pointer}
.check-val{font-size:1.05rem;font-weight:700;text-align:right}
.check-val.good{color:var(--green)}.check-val.warn{color:var(--yellow)}.check-val.bad{color:var(--red)}

/* 投資地圖 */
.map-core{
  background:linear-gradient(135deg,rgba(175,82,222,.08),rgba(0,113,227,.06));
  border:1px solid rgba(175,82,222,.2);border-radius:var(--radius);
  padding:16px 20px;font-weight:700;margin-bottom:16px;box-shadow:var(--shadow);
}
.map-core span{display:block;font-weight:400;color:var(--text2);font-size:.84rem;margin-top:6px;line-height:1.6}
.map-funnel{
  display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;margin-bottom:16px;
}
.funnel-step{
  border:1px solid var(--border);background:var(--surface);border-radius:12px;padding:12px 10px;min-height:94px;
  text-align:left;font:inherit;color:var(--text);cursor:pointer;box-shadow:var(--shadow);transition:.15s;
}
.funnel-step:hover{transform:translateY(-1px);box-shadow:var(--soft-shadow)}
.funnel-step span{
  width:24px;height:24px;border-radius:8px;background:#202421;color:#fff;display:flex;align-items:center;
  justify-content:center;font-size:.7rem;font-weight:900;margin-bottom:8px;
}
.funnel-step b{display:block;font-size:.78rem;line-height:1.25}.funnel-step small{display:block;font-size:.68rem;color:var(--text2);margin-top:5px}
.funnel-step.pass{border-color:rgba(31,157,102,.28);background:rgba(31,157,102,.07)}
.funnel-step.watch{border-color:rgba(200,138,29,.28);background:rgba(200,138,29,.07)}
.funnel-step.out{border-color:rgba(216,79,69,.28);background:rgba(216,79,69,.07)}
.funnel-step.pending{opacity:.82}
.map-verdict{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:18px 22px;margin-bottom:18px;border-left:5px solid var(--text2);box-shadow:var(--shadow);
}
.map-verdict.good{border-left-color:var(--green)}
.map-verdict.warn{border-left-color:var(--yellow)}
.map-verdict.bad{border-left-color:var(--red)}
.map-verdict .mv-lab{font-size:.76rem;color:var(--text2)}
.map-verdict .mv-text{font-size:1rem;font-weight:700;line-height:1.5;margin-top:4px}
.map-verdict .mv-actions{display:flex;gap:10px;margin-top:14px;flex-wrap:wrap}
.map-layer{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:18px 22px;margin-bottom:14px;border-left:4px solid var(--border);box-shadow:var(--shadow);
}
.map-layer.pass{border-left-color:var(--green)}
.map-layer.watch{border-left-color:var(--yellow)}
.map-layer.out{border-left-color:var(--red)}
.ml-head{display:flex;align-items:center;gap:12px;margin-bottom:8px}
.ml-num{
  width:32px;height:32px;border-radius:10px;background:rgba(0,113,227,.1);
  color:var(--blue);font-weight:700;display:flex;align-items:center;justify-content:center;
}
.ml-title{font-size:1.05rem;font-weight:700;flex:1}
.ml-badge{font-size:.68rem;font-weight:700;padding:4px 12px;border-radius:20px}
.ml-badge.good{background:rgba(52,199,89,.12);color:var(--green)}
.ml-badge.warn{background:rgba(255,149,0,.12);color:var(--orange)}
.ml-badge.bad{background:rgba(255,59,48,.12);color:var(--red)}
.ml-badge.na{background:rgba(0,0,0,.05);color:var(--text2)}
.ml-ask,.ml-pillar{font-size:.82rem;line-height:1.6}
.ml-pillar{color:var(--text2);margin:4px 0 12px}
.map-q{border-top:1px solid var(--border);padding:12px 0}
.mq-text{font-size:.88rem;line-height:1.55;margin-bottom:8px}
.mq-text .gate{
  font-size:.64rem;font-weight:700;background:rgba(255,149,0,.15);color:var(--orange);
  border-radius:6px;padding:2px 8px;margin-right:8px;
}
.mq-ans{display:flex;gap:8px;flex-wrap:wrap}
.ans{
  font-size:.8rem;padding:8px 16px;border-radius:10px;border:1.5px solid var(--border);
  background:var(--surface);color:var(--text2);cursor:pointer;transition:.15s;
}
.ans input{display:none}
.ans.yes.on{background:rgba(52,199,89,.12);border-color:var(--green);color:var(--green);font-weight:600}
.ans.unsure.on{background:rgba(255,149,0,.1);border-color:var(--orange);color:var(--orange);font-weight:600}
.ans.no.on{background:rgba(255,59,48,.1);border-color:var(--red);color:var(--red);font-weight:600}
.ml-out{font-size:.74rem;color:var(--text2);margin-top:10px;font-style:italic}
@media(max-width:900px){.slb-steps{grid-template-columns:repeat(2,minmax(0,1fr))}.map-funnel{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* 回測 */
.bt-controls{
  display:flex;gap:14px;align-items:flex-end;flex-wrap:wrap;
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:18px 20px;margin-bottom:18px;box-shadow:var(--shadow);
}
.bt-field label{font-size:.72rem;color:var(--text2);font-weight:600;margin-bottom:6px;display:block}
.bt-params{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}
.bt-stats{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:16px}
.bt-stat{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:16px 18px;box-shadow:var(--shadow);
}
.bt-stat .bts-title{font-size:.86rem;font-weight:700;margin-bottom:12px}
.bts-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 16px}
.bts-grid span{font-size:.7rem;color:var(--text2)}
.bts-grid b{font-size:1.02rem}
.bt-note{font-size:.78rem;color:var(--text2);margin-top:14px;line-height:1.6}
@media(max-width:680px){ .bt-stats{grid-template-columns:1fr} }

/* ═══════════ 交易復盤 ═══════════ */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:14px;margin-bottom:24px}
.stat-card{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:18px 20px;box-shadow:var(--shadow);
}
.stat-card .st-lab{font-size:.76rem;color:var(--text2);margin-bottom:8px}
.stat-card .st-val{font-size:1.75rem;font-weight:700;line-height:1}
.stat-card .st-sub{font-size:.74rem;color:var(--text2);margin-top:6px}

.btn{
  background:var(--blue);color:#fff;border:none;padding:10px 20px;border-radius:12px;
  font-weight:600;font-size:.88rem;cursor:pointer;transition:.15s;
  box-shadow:0 4px 14px rgba(0,113,227,.2);font-family:inherit;
}
.btn:hover{filter:brightness(1.05);transform:translateY(-1px)}
.btn.ghost{background:var(--surface);border:1px solid var(--border);color:var(--text2);box-shadow:var(--shadow)}
.btn.ghost:hover{border-color:var(--blue);color:var(--blue)}
.btn.danger{background:var(--surface);border:1px solid var(--border);color:var(--red);box-shadow:var(--shadow)}
.btn.danger:hover{border-color:var(--red)}
.btn.sm{padding:6px 14px;font-size:.8rem;border-radius:10px}

.journal-bar{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:18px;flex-wrap:wrap}
.seg{display:flex;gap:3px;background:rgba(0,0,0,.04);border-radius:12px;padding:4px}
.seg a{
  padding:8px 16px;border-radius:10px;font-size:.84rem;font-weight:600;
  color:var(--text2);cursor:pointer;transition:.15s;
}
.seg a.active{background:var(--surface);color:var(--text);box-shadow:0 1px 4px rgba(0,0,0,.08)}

.trade-table{width:100%;border-collapse:separate;border-spacing:0;font-size:.84rem}
.trade-table th{
  text-align:left;padding:12px 14px;color:var(--text2);font-weight:600;font-size:.74rem;
  border-bottom:1px solid var(--border);
}
.trade-table td{padding:12px 14px;border-bottom:1px solid var(--border);vertical-align:middle}
.trade-table tr:hover td{background:rgba(0,113,227,.03)}
.t-sym{font-weight:700}
.t-sym .t-name{font-weight:400;color:var(--text2);font-size:.76rem;margin-left:6px}
.pill{font-size:.68rem;font-weight:600;padding:3px 10px;border-radius:20px}
.pill.long{background:rgba(52,199,89,.12);color:var(--green)}
.pill.short{background:rgba(255,59,48,.12);color:var(--red)}
.pill.invest{background:rgba(0,113,227,.1);color:var(--blue)}
.pill.trade{background:rgba(175,82,222,.1);color:var(--purple)}
.pill.open{background:rgba(255,149,0,.12);color:var(--orange)}
.pill.mistake{background:rgba(255,59,48,.12);color:var(--red)}
.pnl-pos{color:var(--green);font-weight:700}
.pnl-neg{color:var(--red);font-weight:700}
.t-actions{display:flex;gap:8px;justify-content:flex-end}
.empty-state{text-align:center;color:var(--text2);padding:56px 24px;font-size:.92rem}

.group-stat{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);
  padding:16px 18px;margin-bottom:12px;box-shadow:var(--shadow);
}
.group-stat h4{font-size:.88rem;margin-bottom:12px}
.gs-row{display:grid;grid-template-columns:1fr auto auto auto;gap:12px;font-size:.82rem;padding:6px 0;border-top:1px solid var(--border)}
.gs-row:first-of-type{border-top:none}
.gs-row .gs-cell{text-align:right;min-width:64px;color:var(--text2)}

/* Modal */
#tradeModal .modal-panel{background:var(--surface);border-radius:18px;box-shadow:0 24px 80px rgba(0,0,0,.18)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px 16px;margin-top:8px}
.form-grid .full{grid-column:1/-1}
.field label{display:block;font-size:.74rem;color:var(--text2);font-weight:600;margin-bottom:6px}
.field input,.field textarea{
  width:100%;background:var(--bg);border:1px solid var(--border);border-radius:12px;
  color:var(--text);padding:10px 14px;font-size:.88rem;outline:none;font-family:inherit;
}
.field input:focus,.field textarea:focus{border-color:var(--blue);box-shadow:0 0 0 4px rgba(0,113,227,.12)}
.field textarea{resize:vertical;min-height:72px}
.field select{display:none}
.principle-chips{
  display:flex;flex-wrap:wrap;gap:8px;max-height:160px;overflow-y:auto;
  padding:12px;background:var(--bg);border-radius:12px;border:1px solid var(--border);
}
.form-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:20px}
.check-inline{display:flex;align-items:center;gap:10px;font-size:.88rem;cursor:pointer}
.check-inline input{width:18px;height:18px;accent-color:var(--blue)}
@media(max-width:600px){ .form-grid{grid-template-columns:1fr} }

/* AI Provider / Page Assistant */
.ai-settings-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:14px}
.ai-provider-card{
  background:var(--surface);border:1px solid var(--border);border-radius:16px;padding:18px;
  box-shadow:var(--shadow);
}
.ai-provider-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:14px}
.ai-provider-head b{display:block;font-size:1rem}.ai-provider-head span{display:block;font-size:.76rem;color:var(--text2);line-height:1.55;margin-top:5px}
.ai-default{font-size:.78rem;color:var(--text2);display:flex;gap:6px;align-items:center;white-space:nowrap}
.ai-default input{accent-color:var(--blue)}
.ai-model-row{display:flex;gap:8px;align-items:center}
.ai-model-row input{min-width:0;flex:1}
.ai-model-row button{flex-shrink:0}
.ai-provider-foot{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px;font-size:.74rem;color:var(--text2)}
.ai-settings-msg{font-size:.82rem;color:var(--text2);margin-top:12px;line-height:1.55}
.ai-dock{position:fixed;right:22px;bottom:22px;z-index:380}
.ai-fab{
  width:54px;height:54px;border-radius:50%;border:none;background:#202421;color:#fff;
  font-weight:900;box-shadow:0 16px 44px rgba(32,40,33,.24);cursor:pointer;font-family:inherit;
}
.ai-panel{
  position:absolute;right:0;bottom:66px;width:min(430px,calc(100vw - 32px));height:min(76vh,680px);
  background:var(--surface);border:1px solid var(--border);border-radius:18px;box-shadow:0 24px 80px rgba(0,0,0,.18);
  padding:0;display:flex;flex-direction:column;overflow:hidden;
}
.ai-panel[hidden]{display:none}
.ai-panel-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;border-bottom:1px solid var(--border);padding:14px 14px 10px;background:rgba(249,250,247,.92)}
.ai-panel-head b{display:block;font-size:.95rem}.ai-panel-head span{display:block;font-size:.72rem;color:var(--text2);line-height:1.45;margin-top:3px}
.ai-panel-head button{border:1px solid var(--border);background:#f9faf7;color:var(--text2);border-radius:8px;width:30px;height:30px;cursor:pointer;font-size:1rem}
.ai-provider-row{display:flex;gap:8px;align-items:center;padding:10px 14px;border-bottom:1px solid var(--border);background:var(--surface)}
.ai-provider-row select{
  flex:1;border:1px solid var(--border);border-radius:10px;background:#f9faf7;color:var(--text);
  padding:9px 11px;font:inherit;font-size:.82rem;
}
.ai-chat{
  flex:1;overflow:auto;padding:14px;background:
    linear-gradient(180deg,rgba(35,103,199,.04),rgba(32,40,33,.02));
  display:flex;flex-direction:column;gap:10px;
}
.ai-msg{display:flex;flex-direction:column;max-width:86%}
.ai-msg-user{align-self:flex-end;align-items:flex-end}
.ai-msg-bot{align-self:flex-start;align-items:flex-start}
.ai-bubble{
  border:1px solid var(--border);background:#fff;color:var(--text);
  border-radius:16px;padding:10px 12px;font-size:.86rem;line-height:1.6;box-shadow:0 1px 2px rgba(32,40,33,.05);
  overflow-wrap:anywhere;
}
.ai-msg-user .ai-bubble{background:#2367c7;color:#fff;border-color:#2367c7;border-bottom-right-radius:5px}
.ai-msg-bot .ai-bubble{border-bottom-left-radius:5px}
.ai-msg-meta{font-size:.66rem;color:var(--text2);margin:4px 6px 0}
.ai-bubble .md{font-size:.86rem}.ai-bubble .md p{margin:.4em 0}.ai-bubble .md p:first-child{margin-top:0}.ai-bubble .md p:last-child{margin-bottom:0}
.ai-compose{display:flex;gap:8px;align-items:flex-end;padding:10px 12px;border-top:1px solid var(--border);background:var(--surface)}
#aiQuestion{
  flex:1;width:100%;min-height:40px;max-height:112px;resize:none;border:1px solid var(--border);border-radius:18px;
  background:#f9faf7;padding:9px 13px;font:inherit;font-size:.86rem;line-height:1.45;outline:none;
}
#aiQuestion:focus{border-color:var(--blue);box-shadow:0 0 0 4px rgba(35,103,199,.12);background:#fff}
.ai-send{
  width:40px;height:40px;border:none;border-radius:50%;background:#202421;color:#fff;
  font-size:1rem;font-weight:900;cursor:pointer;flex-shrink:0;font-family:inherit;
}
.ai-send:disabled{opacity:.45;cursor:wait}
.ai-typing{display:inline-flex;gap:4px;align-items:center;padding:4px 2px}
.ai-typing i{width:6px;height:6px;border-radius:50%;background:var(--text2);opacity:.45;animation:aiTyping 1s infinite ease-in-out}
.ai-typing i:nth-child(2){animation-delay:.15s}.ai-typing i:nth-child(3){animation-delay:.3s}
@keyframes aiTyping{0%,80%,100%{transform:translateY(0);opacity:.35}40%{transform:translateY(-3px);opacity:.8}}
.ai-error{color:var(--red);background:rgba(216,79,69,.08);border:1px solid rgba(216,79,69,.16);border-radius:10px;padding:10px 12px}
@media(max-width:520px){.ai-dock{right:16px;bottom:16px}.ai-panel{height:min(82vh,680px)}.ai-provider-row,.ai-model-row{align-items:stretch;flex-direction:column}}
