/* ===== 基礎 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --buy:  #16a34a;
  --sell: #dc2626;
  --hold: #d97706;
  --bg:   #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --sub:  #64748b;
  --radius: 12px;
}

body { font-family: -apple-system, "Noto Sans TC", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

a { color: inherit; text-decoration: none; }

/* ===== Header ===== */
header { background: #1e293b; color: #fff; padding: 0 24px; }
.header-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 16px; height: 56px; }
.logo { font-size: 1.1rem; font-weight: 700; letter-spacing: .5px; }
.header-sub { font-size: .8rem; color: #94a3b8; }

/* ===== Footer ===== */
footer { text-align: center; padding: 24px; font-size: .75rem; color: var(--sub); border-top: 1px solid var(--border); margin-top: 48px; }

/* ===== Container ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* ===== Toolbar ===== */
.toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; padding: 16px; background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); }
.date-form select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; }
.tab-bar { display: flex; gap: 4px; }
.tab { padding: 6px 14px; border-radius: 20px; font-size: .85rem; color: var(--sub); border: 1px solid var(--border); transition: all .15s; }
.tab:hover, .tab.active { background: #1e293b; color: #fff; border-color: #1e293b; }
.btn-run { margin-left: auto; padding: 8px 18px; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: .85rem; cursor: pointer; font-weight: 600; transition: background .15s; }
.btn-run:hover { background: #1d4ed8; }

/* ===== Section Title ===== */
.section-title { font-size: 1rem; font-weight: 700; color: var(--sub); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }

/* ===== Card Grid ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }

.card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .15s; cursor: pointer; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.card-買進 { border-color: #bbf7d0; }
.card-賣出 { border-color: #fecaca; }
.card-觀望 { border-color: #fde68a; }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.stock-name { font-weight: 700; font-size: 1rem; }
.stock-id { font-size: .75rem; color: var(--sub); background: var(--bg); padding: 2px 6px; border-radius: 4px; }

.card-price { display: flex; align-items: baseline; gap: 8px; }
.price { font-size: 1.25rem; font-weight: 700; }
.change { font-size: .85rem; font-weight: 600; }
.up   { color: var(--sell); }  /* 台股紅漲 */
.down { color: var(--buy); }   /* 台股綠跌 */

.card-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-badge { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.action-買進 { background: #dcfce7; color: var(--buy); }
.action-賣出 { background: #fee2e2; color: var(--sell); }
.action-觀望 { background: #fef3c7; color: var(--hold); }
.confidence, .timing { font-size: .72rem; color: var(--sub); }

/* ===== Subsection Label ===== */
.subsection-label { font-size: .85rem; font-weight: 700; color: var(--sub); margin: 16px 0 10px; display: flex; align-items: center; gap: 6px; }
.watchlist-grid .card { border-width: 2px; }
.watchlist-grid .card-觀望 { border-color: #c7d2fe; }
.watchlist-grid .card-買進 { border-color: #86efac; }
.watchlist-grid .card-賣出 { border-color: #fca5a5; }
.report-section { margin-bottom: 36px; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 64px 24px; color: var(--sub); }
.empty-state p { font-size: 1.1rem; }
.empty-state .sub { font-size: .85rem; margin-top: 8px; }

/* ===== Report Detail ===== */
.back-link { display: inline-block; margin-bottom: 20px; color: var(--sub); font-size: .9rem; }
.back-link:hover { color: var(--text); }

.report-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.report-title-block h1 { font-size: 1.6rem; font-weight: 800; }
.stock-id-large { font-size: 1rem; font-weight: 400; color: var(--sub); }
.report-badge { font-size: .8rem; color: var(--sub); margin-top: 4px; display: block; }
.report-price-block { text-align: right; }
.big-price { font-size: 2rem; font-weight: 800; }
.big-price small { font-size: 1rem; font-weight: 400; }
.big-change { font-size: 1.1rem; font-weight: 700; }

/* ===== Metrics Bar ===== */
.metrics-bar { display: flex; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; }
.metric { display: flex; flex-direction: column; align-items: center; min-width: 72px; }
.metric .label { font-size: .72rem; color: var(--sub); }
.metric .val { font-size: 1rem; font-weight: 700; }

/* ===== Decision Block ===== */
.decision-block { border-radius: var(--radius); padding: 24px; margin-bottom: 28px; border: 2px solid; }
.decision-買進 { background: #f0fdf4; border-color: #86efac; }
.decision-賣出 { background: #fff1f2; border-color: #fca5a5; }
.decision-觀望 { background: #fffbeb; border-color: #fcd34d; }

.decision-label { font-size: .8rem; color: var(--sub); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.decision-action { font-size: 3rem; font-weight: 900; line-height: 1; margin-bottom: 12px; }
.decision-買進 .decision-action { color: var(--buy); }
.decision-賣出 .decision-action { color: var(--sell); }
.decision-觀望 .decision-action { color: var(--hold); }

.decision-meta { display: flex; gap: 12px; margin-bottom: 16px; }
.badge-timing, .badge-confidence { font-size: .82rem; padding: 4px 12px; border-radius: 20px; background: rgba(0,0,0,.06); font-weight: 600; }

.decision-summary { font-size: 1rem; line-height: 1.7; margin-bottom: 14px; }
.risk-warning { font-size: .85rem; color: #92400e; background: #fef3c7; padding: 10px 14px; border-radius: 8px; border-left: 3px solid #f59e0b; }

/* ===== Debate Section ===== */
.debate-section { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }

.debate-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.debate-block summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; font-weight: 700; user-select: none; }
.debate-block summary::-webkit-details-marker { display: none; }
.debate-block summary::after { content: "▼"; margin-left: auto; font-size: .7rem; color: var(--sub); transition: transform .2s; }
.debate-block[open] summary::after { transform: rotate(180deg); }
.bull-block summary { background: #f0fdf4; }
.bear-block summary { background: #fff1f2; }
.bull-response-block summary { background: #eff6ff; }

.role-icon { font-size: 1.2rem; }
.role-name { font-size: .95rem; }
.role-stance { font-size: .78rem; color: var(--sub); margin-left: 4px; }

.point-list { list-style: none; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.point-list li { padding: 10px 14px; border-radius: 8px; font-size: .92rem; line-height: 1.6; position: relative; padding-left: 28px; }
.point-list li::before { content: "•"; position: absolute; left: 10px; font-weight: 900; }
.bull-block .point-list li { background: #f0fdf4; }
.bull-block .point-list li::before { color: var(--buy); }
.bear-block .point-list li { background: #fff1f2; }
.bear-block .point-list li::before { color: var(--sell); }

.rebuttal, .response-text { padding: 14px 20px; font-size: .9rem; line-height: 1.7; border-top: 1px solid var(--border); color: var(--sub); }

/* ===== News ===== */
.news-section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.news-section h3 { font-size: .95rem; margin-bottom: 14px; color: var(--sub); }
.news-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.news-list li { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.news-list li:last-child { border-bottom: none; padding-bottom: 0; }
.news-date { font-size: .75rem; color: var(--sub); margin-right: 8px; }
.news-title { font-size: .9rem; font-weight: 600; }
.news-desc { font-size: .82rem; color: var(--sub); margin-top: 4px; }

/* ===== RWD ===== */
@media (max-width: 600px) {
  .report-header { flex-direction: column; }
  .report-price-block { text-align: left; }
  .metrics-bar { gap: 16px; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .btn-run { margin-left: 0; }
}
