/* v9.1 daily 報表 — 借用 widget 風格、純手寫、響應式 */
*,*:before,*:after { box-sizing: border-box; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  margin: 0;
  background: #f7f7f5;
  color: #2c2c2a;
  line-height: 1.6;
}

.container { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ---------- header ---------- */
header h1 { font-size: 1.5rem; font-weight: 500; margin: 0 0 0.5rem; }
header .meta { font-size: 0.85rem; color: #5f5e5a; display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
header .meta strong { color: #2c2c2a; }
.nav-links { font-size: 0.85rem; display: flex; gap: 1rem; align-items: center; }
.nav-links a { color: #185FA5; text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }
.nav-links .dim { color: #888780; margin-left: auto; }

/* ---------- KPI 卡 ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.kpi {
  background: #fff;
  border: 0.5px solid rgba(136,135,128,0.15);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  border-left: 3px solid transparent;
}
.kpi-label { font-size: 0.8rem; color: #5f5e5a; }
.kpi-value { font-size: 1.5rem; font-weight: 500; margin: 0.25rem 0; }
.kpi-sub { font-size: 0.75rem; color: #888780; }
.kpi.accent-warning { border-left-color: #BA7517; }
.kpi.accent-warning .kpi-value { color: #854F0B; }
.kpi.accent-success { border-left-color: #639922; }
.kpi.accent-success .kpi-value { color: #3B6D11; }

/* ---------- 候選表格 ---------- */
section h2 { font-size: 1.1rem; font-weight: 500; margin: 1.5rem 0 0.75rem; }
.cand-table {
  width: 100%;
  background: #fff;
  border: 0.5px solid rgba(136,135,128,0.15);
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 0.875rem;
}
.cand-table thead th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: #f1efe8;
  color: #5f5e5a;
  font-weight: 500;
  border-bottom: 0.5px solid rgba(136,135,128,0.2);
  white-space: nowrap;
}
.cand-table th.right, .cand-table td.right { text-align: right; }
.cand-table th.center, .cand-table td.center { text-align: center; }
.cand-table tbody td {
  padding: 0.55rem 0.75rem;
  border-bottom: 0.5px solid rgba(136,135,128,0.1);
  white-space: nowrap;
}
.cand-table tbody tr:last-child td { border-bottom: 0; }
.cand-table tbody tr:hover { background: #f1efe8; }
.market-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}
.market-T { background: #E6F1FB; color: #0C447C; }
.market-P { background: #FAEEDA; color: #854F0B; }
.score { font-weight: 500; color: #3B6D11; }
.dim-cell { color: #888780; }
.empty-state {
  background: #fff;
  border: 0.5px dashed rgba(136,135,128,0.3);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: #888780;
}

/* ---------- 規則總覽 ---------- */
.rules-table {
  width: 100%;
  background: #fff;
  border: 0.5px solid rgba(136,135,128,0.15);
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 0.85rem;
}
.rules-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 0.5px solid rgba(136,135,128,0.1);
}
.rules-table tr:last-child td { border-bottom: 0; }
.rules-table td:first-child {
  width: 30%;
  color: #5f5e5a;
  font-weight: 500;
}

/* ---------- footer ---------- */
footer { margin-top: 2rem; padding-top: 1rem; border-top: 0.5px solid rgba(136,135,128,0.2); font-size: 0.8rem; color: #5f5e5a; }
footer .warning { color: #5f5e5a; }
footer .warning strong { color: #993556; }
footer .dim { color: #888780; font-size: 0.75rem; margin-top: 0.5rem; }

/* ---------- index 頁專用 ---------- */
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.history-card {
  background: #fff;
  border: 0.5px solid rgba(136,135,128,0.15);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: inherit;
  display: block;
}
.history-card:hover { background: #f1efe8; border-color: rgba(136,135,128,0.3); }
.history-card .date { font-size: 0.95rem; font-weight: 500; }
.history-card .count { font-size: 0.8rem; color: #888780; margin-top: 0.25rem; }
.history-card .stocks { font-size: 0.75rem; color: #5f5e5a; margin-top: 0.5rem; line-height: 1.3; }

/* ---------- 響應式（手機）---------- */
@media (max-width: 640px) {
  .container { padding: 1rem 0.75rem; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  header .meta { flex-direction: column; gap: 0.25rem; }
  .cand-table { font-size: 0.8rem; }
  .cand-table thead th, .cand-table tbody td { padding: 0.4rem 0.5rem; }
  /* 手機隱藏次要欄位 */
  .cand-table .col-mobile-hide { display: none; }
}
