/* ==============================
   Ardenvale — Watchlist Page
   ============================== */

/* ── Header ─────────────────────────────────────────────────────────── */
.wl-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 2rem 3rem 1.5rem;
}
.wl-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.wl-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.1;
  margin-top: 0.25rem;
}
.wl-subtitle {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 0.4rem;
}
.btn-add {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 4px;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.825rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-add:hover { background: #0f2419; }

/* ── KPI strip ───────────────────────────────────────────────────────── */
.wl-kpi-strip {
  background: var(--accent);
  padding: 0.9rem 3rem;
}
.wl-kpi-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 2.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.wl-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.wl-kpi-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245,241,235,0.55);
}
.wl-kpi-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--bg);
  line-height: 1;
}
.wl-kpi-value--invest   { color: #7ec8a4; }
.wl-kpi-value--meet     { color: var(--accent-warm); }
.wl-kpi-value--diligence { color: #a8c4e0; }
.wl-kpi-value--watch    { color: rgba(245,241,235,0.5); }

/* ── Top-3 recommendation panel ─────────────────────────────────────── */
.wl-top3-panel {
  background: #f9f6f0;
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 3rem;
}
.wl-top3-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.wl-top3-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.wl-top3-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  display: flex;
  gap: 0.85rem;
}
.wl-top3-rank {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--border);
  line-height: 1;
  min-width: 2.5rem;
  padding-top: 0.1rem;
}
.wl-top3-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.2rem;
}
.wl-top3-score {
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}
.wl-top3-para {
  font-size: 0.83rem;
  color: var(--fg-muted);
  line-height: 1.65;
}

/* ── Filters ─────────────────────────────────────────────────────────── */
.wl-filters {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 3rem;
}
.wl-filters-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.filter-select {
  font-family: var(--font-body);
  font-size: 0.825rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--accent); }
.filter-reset {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  transition: color 0.15s;
}
.filter-reset:hover { color: var(--accent); }
.filter-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

/* ── Save indicator ──────────────────────────────────────────────────── */
.save-indicator {
  font-size: 0.75rem;
  color: #5a9a74;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.save-indicator--visible { opacity: 1; }

/* ── Watchlist table body ─────────────────────────────────────────────── */
.wl-body {
  padding: 1.5rem 3rem 4rem;
}
.wl-body-inner {
  max-width: 1200px;
  margin: 0 auto;
}
.wl-empty {
  padding: 3rem;
  text-align: center;
  color: var(--fg-muted);
}
.wl-empty-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ── Table ───────────────────────────────────────────────────────────── */
.wl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.wl-table thead th {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.wl-table tbody .wl-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.wl-table tbody .wl-row:hover { background: #f9f6f0; }
.wl-table td {
  padding: 0.75rem;
  vertical-align: middle;
  color: var(--fg);
}

/* Columns */
.col-name    { width: 240px; }
.col-segment { width: 160px; }
.col-score   { width: 140px; }
.col-threshold { width: 90px; }
.col-status  { width: 110px; }
.col-next    { width: auto; }
.col-reviewed { width: 110px; white-space: nowrap; }
.col-detail  { width: 70px; text-align: center; }

.candidate-name {
  font-weight: 500;
  color: var(--accent);
  font-size: 0.875rem;
}
.candidate-ticker {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.1rem;
  letter-spacing: 0.03em;
}

/* Segment pill */
.seg-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  background: var(--bg-alt);
  white-space: nowrap;
}

/* Score bar */
.score-cell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.score-num {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg);
}
.score-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.score-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.score-bar--high  { background: #5a9a74; }
.score-bar--mid   { background: var(--accent-warm); }
.score-bar--low   { background: #b87c6e; }

/* Threshold badge */
.threshold-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.threshold-pass      { background: #d4ead7; color: #2a6440; }
.threshold-diligence { background: #faefd4; color: #7a5a10; }
.threshold-watch     { background: #e8e4dd; color: var(--fg-muted); }
.threshold-below     { background: #f5dbd7; color: #8a3020; }

/* Status select in table */
.status-select {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  outline: none;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  padding-right: 1.4rem;
}
.status-select--status-invest   { background-color: #d4ead7; color: #2a6440; border-color: #b6d9bc; }
.status-select--status-meet     { background-color: #faefd4; color: #7a5a10; border-color: #e8d9b0; }
.status-select--status-diligence { background-color: #dce8f5; color: #2a4a70; border-color: #b8d0e8; }
.status-select--status-watch    { background-color: #e8e4dd; color: var(--fg-muted); border-color: var(--border); }
.status-select--status-passed   { background-color: #f0ece6; color: #999; border-color: var(--border); }

.next-action-text {
  font-size: 0.8rem;
  color: var(--fg-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Detail button */
.btn-detail {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--fg-muted);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  white-space: nowrap;
}
.btn-detail:hover { border-color: var(--accent); color: var(--accent); }
.col-memo { width: 70px; text-align: center; }
.btn-memo-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.btn-memo-link:hover { text-decoration: underline; }
.diligence-progress {
  font-size: 0.65rem;
  letter-spacing: 0.03em;
  color: inherit;
}

/* ── Detail Side Panel ───────────────────────────────────────────────── */
.wl-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,24,0.35);
  z-index: 100;
}
.wl-overlay--visible { display: block; }

.wl-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 540px;
  max-width: 96vw;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.wl-panel--open { transform: translateX(0); }

.wl-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.wl-panel-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
}
.wl-panel-segment {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
  letter-spacing: 0.03em;
}
.wl-panel-close {
  background: transparent;
  border: none;
  font-size: 1rem;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  transition: color 0.15s;
}
.wl-panel-close:hover { color: var(--accent); }

.wl-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 2rem;
}

.panel-loading { color: var(--fg-muted); font-size: 0.85rem; padding: 2rem 0; }

/* Panel meta row */
.panel-meta {
  background: var(--bg-alt);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.panel-meta-row { display: flex; align-items: center; gap: 0.75rem; }
.panel-meta-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  min-width: 90px;
}
.panel-meta-val { font-size: 0.85rem; color: var(--fg); }

.panel-section { margin-bottom: 1.5rem; }
.panel-section-title {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

/* Risks */
.panel-risks { display: flex; flex-direction: column; gap: 0.5rem; }
.panel-risk {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.82rem;
  color: var(--fg);
  line-height: 1.55;
}
.risk-num {
  background: #f5dbd7;
  color: #8a3020;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.65rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Scorecard table in panel */
.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.scorecard-table thead th {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.scorecard-table tbody td { padding: 0.35rem 0.5rem; border-bottom: 1px solid #eee; }
.sc-label { color: var(--fg); font-weight: 500; }
.sc-weight { color: var(--fg-muted); font-size: 0.72rem; }
.sc-dots { letter-spacing: 0.05em; color: var(--accent-warm); font-size: 0.8rem; }
.sc-raw { color: var(--fg-muted); text-align: right; }
.sc-weighted { color: var(--fg); font-weight: 600; text-align: right; }
.sc-total-row td { font-weight: 600; font-size: 0.85rem; padding-top: 0.5rem; border-bottom: none; color: var(--fg-muted); }
.sc-total { color: var(--accent); font-size: 1rem; text-align: right; }
.scorecard-footnote { font-size: 0.7rem; color: var(--fg-muted); margin-top: 0.5rem; font-style: italic; }

/* Diligence checklist */
.dq-progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.dq-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}
.dq-progress-label { font-size: 0.75rem; color: var(--fg-muted); }
.dq-list { display: flex; flex-direction: column; gap: 0.15rem; }
.dq-section { margin-bottom: 0.85rem; }
.dq-section-title {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.dq-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.2rem 0;
  cursor: pointer;
}
.dq-check {
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.dq-text {
  font-size: 0.8rem;
  color: var(--fg);
  line-height: 1.45;
}
.dq-item:has(.dq-check:checked) .dq-text { color: var(--fg-muted); text-decoration: line-through; }

/* Panel textareas */
.panel-textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--fg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
  resize: vertical;
  outline: none;
  line-height: 1.55;
  min-height: 60px;
  transition: border-color 0.15s;
}
.panel-textarea:focus { border-color: var(--accent); background: var(--bg); }

/* ── Add Candidate Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,24,0.45);
  z-index: 200;
}
.add-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 480px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 8px 32px rgba(26,26,24,0.18);
}
.add-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.add-modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
}
.add-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}
.add-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.add-input {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--fg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.15s;
}
.add-input:focus { border-color: var(--accent); background: var(--bg); }
.add-textarea { resize: vertical; min-height: 60px; }
.add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--fg-muted);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-cancel:hover { border-color: var(--accent); color: var(--accent); }
.btn-save {
  background: var(--accent);
  border: none;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--bg);
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-save:hover { background: #0f2419; }

/* Nav link active state */
.nav-link {
  font-size: 0.82rem;
  color: var(--fg-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--accent); }
.nav-link--active { color: var(--accent); font-weight: 500; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .wl-top3-grid { grid-template-columns: 1fr; }
  .wl-panel { width: 100%; }
  .col-next, .col-reviewed { display: none; }
}
@media (max-width: 768px) {
  .wl-header, .wl-kpi-strip, .wl-top3-panel, .wl-filters, .wl-body { padding-left: 1.25rem; padding-right: 1.25rem; }
  .wl-kpi-inner { gap: 1.25rem; }
}
