/* ═══════════════════════════════════════════════════════════════
   ANAN SYSTEM — Dashboard Theme v1.0
   Warm Sandstone palette for all dashboard/tool pages
   Reference: shared/design-system.css tokens
   ═══════════════════════════════════════════════════════════════ */

/* ── Variable Bridge: Dark → Warm Sandstone ── */
:root {
  --bg: #FDFCFA;
  --bg2: #FAF7F2;
  --bg3: #F5F0EB;
  --bg4: #EDE7E0;
  --card: #FAF7F2;
  --card2: #F5F0EB;
  --border: #E3DDD5;
  --text: #2C2825;
  --text2: #6B6560;
  --muted: #8C8279;
  --accent: #FF8C42;
  --accent2: #FF7A2E;
  --green: #4CAF50;
  --red: #E53935;
  --yellow: #F9A825;
  --blue: #2196F3;
  --orange: #FF8C42;
  --purple: #9C64D6;
  --cyan: #0097A7;
  --short: #4CAF50;
  --mid: #2196F3;
  --long: #F9A825;
}

/* ── Base Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

/* ── Header ── */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.header-left { display: flex; align-items: center; gap: 14px; }
.header-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), #FF6B1A);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(255,140,66,0.25);
}
.header-title { font-size: 18px; font-weight: 700; color: var(--text); }
.header-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 12px; }

/* ── Channel Select ── */
.channel-select {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s;
}
.channel-select:focus { outline: none; border-color: var(--accent); }

/* ── Badges ── */
.badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; margin-left: 8px; }
.badge-live { background: var(--accent); color: #fff; }
.badge-new { background: var(--accent); color: #fff; }
.badge-demo { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; margin-left: 8px; }

/* ── Container ── */
.container { max-width: 1400px; margin: 0 auto; padding: 24px 32px; }

/* ── Section Title ── */
.section-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  margin: 28px 0 16px;
}
.section-title:first-child { margin-top: 0; }
.section-title .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.section-title .hint { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 8px 0 24px; }

/* ── Time Tabs ── */
.time-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.time-tab {
  padding: 7px 18px; border-radius: 20px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card2); color: var(--muted);
  transition: all 0.2s; font-family: inherit;
}
.time-tab.active { color: #fff; font-weight: 700; border-color: transparent; }
.time-tab.short.active { background: var(--green); }
.time-tab.mid.active { background: var(--blue); }
.time-tab.long.active { background: var(--yellow); color: #000; }
.time-tab:hover { border-color: var(--accent); color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Signal Cards ── */
.signal-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.signal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}
.signal-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }
.signal-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.signal-card.short::before { background: var(--green); }
.signal-card.mid::before { background: var(--blue); }
.signal-card.long::before { background: var(--yellow); }
.signal-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.signal-card-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.signal-card-label .period-dot { width: 8px; height: 8px; border-radius: 50%; }
.signal-trend { font-size: 11px; padding: 3px 8px; border-radius: 10px; font-weight: 600; }
.trend-up { background: rgba(76,175,80,0.12); color: var(--green); }
.trend-down { background: rgba(229,57,53,0.12); color: var(--red); }
.trend-flat { background: rgba(249,168,37,0.12); color: var(--yellow); }
.signal-main { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.signal-sub { font-size: 12px; color: var(--muted); }
.signal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.signal-tag { font-size: 11px; padding: 3px 9px; border-radius: 10px; border: 1px solid; }
.signal-tag.hot { border-color: rgba(76,175,80,0.4); color: var(--green); background: rgba(76,175,80,0.08); }
.signal-tag.warm { border-color: rgba(33,150,243,0.4); color: var(--blue); background: rgba(33,150,243,0.08); }
.signal-tag.stable { border-color: rgba(249,168,37,0.4); color: var(--yellow); background: rgba(249,168,37,0.08); }
.signal-tag.danger { border-color: rgba(229,57,53,0.4); color: var(--red); background: rgba(229,57,53,0.08); }

/* ── Detail Grid ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.detail-card-title { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }

/* ── Formula List ── */
.formula-list { display: flex; flex-direction: column; gap: 10px; }
.formula-item { display: flex; align-items: center; gap: 10px; }
.formula-rank {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.rank-1 { background: var(--yellow); color: #000; }
.rank-2 { background: #B0BEC5; color: #000; }
.rank-3 { background: var(--orange); color: #fff; }
.rank-n { background: var(--card2); color: var(--muted); }
.formula-name { flex: 1; font-size: 13px; }
.formula-bar-wrap { width: 80px; height: 6px; background: var(--card2); border-radius: 3px; overflow: hidden; }
.formula-bar { height: 100%; border-radius: 3px; }
.formula-pct { font-size: 11px; color: var(--muted); width: 36px; text-align: right; }
.formula-views { font-size: 11px; color: var(--yellow); width: 50px; text-align: right; }

/* ── Health Gauge ── */
.health-section { margin-bottom: 24px; }
.health-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.health-gauge-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 24px; display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.gauge-label { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 16px; }
.gauge-score { font-size: 42px; font-weight: 800; text-align: center; }
.gauge-score.excellent { color: var(--green); }
.gauge-score.good { color: var(--blue); }
.gauge-score.warn { color: var(--yellow); }
.gauge-score.danger { color: var(--red); }
.gauge-desc { font-size: 12px; color: var(--muted); text-align: center; margin-top: 4px; }
.health-metrics-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.metric-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.metric-row:last-child { border-bottom: none; }
.metric-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.metric-info { flex: 1; }
.metric-name { font-size: 13px; font-weight: 600; }
.metric-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.metric-right { text-align: right; }
.metric-value { font-size: 16px; font-weight: 700; }
.metric-status { font-size: 11px; margin-top: 2px; }
.status-ok { color: var(--green); }
.status-warn { color: var(--yellow); }
.status-danger { color: var(--red); }

/* ── Three Lines ── */
.three-lines-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.three-lines-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.line-item { padding: 16px 20px; border-right: 1px solid var(--border); }
.line-item:last-child { border-right: none; }
.line-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.line-label .line-dot { width: 10px; height: 3px; border-radius: 2px; }
.line-value { font-size: 28px; font-weight: 800; }
.line-desc { font-size: 11px; color: var(--muted); margin-top: 4px; }
.line-boom { color: var(--green); }
.line-floor { color: var(--blue); }
.line-stop { color: var(--red); }

/* ── Chart ── */
.chart-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.chart-title-text { font-size: 13px; font-weight: 600; }
.chart-subtitle { font-size: 11px; color: var(--muted); margin-top: 2px; }
.chart-legend { display: flex; gap: 16px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-dot { width: 10px; height: 3px; border-radius: 2px; }
canvas { max-height: 220px; }

/* ── Emotion Heatmap ── */
.emotion-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.emotion-chip {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 5px; cursor: default;
}
.emotion-chip .e-bar { width: 4px; border-radius: 2px; }

/* ── KPI Row ── */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.kpi-label { font-size: 11px; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 800; }
.kpi-sub { font-size: 11px; color: var(--muted); }
.kpi-badge { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 600; margin-top: 4px; }
.kpi-badge.ok { background: rgba(76,175,80,0.12); color: var(--green); }
.kpi-badge.warn { background: rgba(249,168,37,0.12); color: var(--yellow); }
.kpi-badge.danger { background: rgba(229,57,53,0.12); color: var(--red); }

/* ── Direction Card ── */
.direction-card {
  background: var(--card);
  border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; margin-bottom: 24px;
  position: relative; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.direction-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--blue), var(--green));
}
.direction-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.direction-item-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.direction-item-value { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.5; }
.direction-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.dir-tag {
  font-size: 11px; padding: 3px 9px; border-radius: 10px; border: 1px solid;
  border-color: rgba(255,140,66,0.4); color: var(--accent); background: rgba(255,140,66,0.08);
}
.dir-tag.green { border-color: rgba(76,175,80,0.4); color: var(--green); background: rgba(76,175,80,0.08); }
.dir-tag.blue { border-color: rgba(33,150,243,0.4); color: var(--blue); background: rgba(33,150,243,0.08); }
.dir-tag.yellow { border-color: rgba(249,168,37,0.4); color: var(--yellow); background: rgba(249,168,37,0.08); }
.dir-tag.red { border-color: rgba(229,57,53,0.4); color: var(--red); background: rgba(229,57,53,0.08); }

/* ── Vocab Chips ── */
.vocab-section { margin-bottom: 16px; }
.vocab-section-title { font-size: 11px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.vocab-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vocab-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
  border: 1px solid; cursor: default; transition: opacity 0.2s;
}
.vocab-chip:hover { opacity: 0.8; }
.vocab-chip.s { border-color: rgba(76,175,80,0.5); color: var(--green); background: rgba(76,175,80,0.08); }
.vocab-chip.a { border-color: rgba(33,150,243,0.4); color: var(--blue); background: rgba(33,150,243,0.06); }
.vocab-chip.forbidden { border-color: rgba(229,57,53,0.4); color: var(--red); background: rgba(229,57,53,0.06); text-decoration: line-through; }

/* ── Insight Cards ── */
.insight-list { display: flex; flex-direction: column; gap: 10px; }
.insight-item {
  background: var(--card2); border-radius: 10px; padding: 12px 14px;
  border-left: 3px solid var(--accent); font-size: 13px; line-height: 1.6;
}
.insight-item.green { border-left-color: var(--green); }
.insight-item.yellow { border-left-color: var(--yellow); }
.insight-item.red { border-left-color: var(--red); }

/* ── Tooltip ── */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip-wrap .tip {
  position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 11px; padding: 5px 10px;
  border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 0.2s; z-index: 10;
}
.tooltip-wrap:hover .tip { opacity: 1; }
.info-icon { color: var(--muted); font-size: 13px; cursor: help; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 40px; color: var(--muted); font-size: 13px; }
.empty-state .empty-icon { font-size: 32px; margin-bottom: 10px; }

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(90deg, var(--card2) 25%, var(--border) 50%, var(--card2) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 6px; height: 16px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Buttons ── */
.btn {
  padding: 7px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--card2); color: var(--text); cursor: pointer;
  font-size: 12px; font-family: inherit; transition: all 0.2s;
}
.btn:hover { background: var(--card); border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; font-weight: 700; }
.btn-green:hover { opacity: 0.85; }
.btn-red { background: transparent; border-color: var(--red); color: var(--red); }
.btn-cyan { background: rgba(0,151,167,0.1); border-color: rgba(0,151,167,0.4); color: var(--cyan); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Loading Badge ── */
.loading-badge {
  font-size: 11px; color: var(--muted); padding: 4px 10px;
  background: var(--card2); border: 1px solid var(--border); border-radius: 20px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .signal-row, .direction-grid, .kpi-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: 1fr; }
  .three-lines-grid { grid-template-columns: 1fr; }
  .three-lines-grid .line-item { border-right: none; border-bottom: 1px solid var(--border); }
  .container { padding: 16px; }
  .header { padding: 14px 16px; }
}
