/* TradingView と統一感のあるダークテーマ */
:root {
  --bg: #131722;
  --bg-elev: #1e222d;
  --bg-card: #2a2e39;
  --border: #363a45;
  --text: #d1d4dc;
  --text-dim: #868993;
  --accent: #2962ff;
  --accent-hover: #1e53e5;
  --bullish: #26a69a;
  --bearish: #ef5350;
  --score-high: #ffb300;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
               "Noto Sans JP", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body { display: flex; flex-direction: column; }

/* ───────── Top bar ───────── */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.batch-meta {
  font-size: 12px;
  color: var(--text-dim);
}

/* ───────── Layout ───────── */
.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 0;
}

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 12px;
}

.chart-pane {
  position: relative;
  background: var(--bg);
  min-height: 0;
}

.tradingview-widget {
  width: 100%;
  height: 100%;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
}
.chart-empty.hidden { display: none; }

/* ───────── Section ───────── */
.section {
  margin-bottom: 16px;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.section-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.section-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ───────── Signals list ───────── */
.signals-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.placeholder {
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px 4px;
  margin: 0;
}

.strategy-group {
  margin-bottom: 10px;
}
.strategy-group-header {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 6px;
  margin-bottom: 4px;
}

.signal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.signal-card:hover {
  border-color: var(--accent);
}
.signal-card.active {
  border-color: var(--accent);
  background: rgba(41, 98, 255, 0.1);
}

.signal-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.signal-ticker {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.signal-score {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.signal-score.high { color: var(--score-high); }

.signal-highlight {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
  text-align: right;
}
.signal-highlight.bullish { color: var(--bullish); }
.signal-highlight.bearish { color: var(--bearish); }

/* ───────── B: Watchlist ───────── */
.watchlist-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.watchlist-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.watchlist-form input#watchlist-ticker {
  flex: 0 0 110px;
  text-transform: uppercase;
}
.watchlist-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.watchlist-form button {
  flex: 0 0 auto;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s;
}
.watchlist-form button:hover {
  background: var(--accent-hover);
}

.watchlist-error {
  padding: 6px 10px;
  margin-bottom: 6px;
  background: rgba(239, 83, 80, 0.15);
  border: 1px solid var(--bearish);
  border-radius: 4px;
  color: var(--bearish);
  font-size: 12px;
}
.watchlist-error.hidden { display: none; }

.watchlist-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.watchlist-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: 4px;
  transition: border-color 0.1s;
}
.watchlist-card:hover {
  border-color: var(--accent);
}
.watchlist-main {
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}
.watchlist-main:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.watchlist-ticker {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.watchlist-note {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.watchlist-remove {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.watchlist-remove:hover {
  color: var(--bearish);
  background: rgba(239, 83, 80, 0.1);
}

/* ───────── C: Curated (Claude絞込み) ───────── */
.curated-meta {
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 6px 8px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.curated-meta.hidden { display: none; }

.curated-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.curated-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.curated-card:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
}
.curated-card.active {
  border-color: var(--accent);
  background: rgba(41, 98, 255, 0.1);
}
.curated-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.curated-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.curated-ticker {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.curated-score {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.curated-score.high { color: var(--score-high); }
.curated-strategy {
  font-size: 10px;
  color: var(--text-dim);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.curated-reason {
  margin: 0;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  opacity: 0.9;
}

/* ───────── Responsive (mobile) ───────── */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 45vh;
  }
  .chart-pane {
    min-height: 50vh;
  }
}
