/* ─── Watchlist panel ─── */

.wl-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wl-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Card + corner brackets ─── */
.wl-card {
  position: relative;
  padding: 16px 18px;
  background: rgba(184, 196, 208, 0.025);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.wl-card:hover {
  background: var(--steel-faint);
  border-color: var(--border-bright);
}

.wl-card::before,
.wl-card::after {
  position: absolute;
  z-index: 1;
  width: 12px;
  height: 12px;
  content: '';
  border: 2px solid var(--steel);
  opacity: 0.6;
  pointer-events: none;
}

.wl-card::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.wl-card::after {
  right: -1px;
  bottom: -1px;
  border-top: none;
  border-left: none;
}

.wl-card.is-error {
  border-color: var(--red);
}

.wl-card.is-error::before,
.wl-card.is-error::after {
  border-color: var(--red);
}

/* ─── Header row ─── */
.wl-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.wl-name-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.wl-name {
  overflow: hidden;
  color: var(--steel);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wl-ticker {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.wl-ticker-price {
  flex-shrink: 0;
  color: var(--steel-bright);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: var(--glow-sm);
}

.wl-ticker-currency {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 10px;
}

.wl-header-right {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
}

.wl-price-block {
  display: flex;
  align-items: baseline;
  flex-shrink: 0;
  gap: 6px;
}

.wl-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.wl-icon-btn:hover {
  color: var(--steel);
  background: var(--steel-faint);
  border-color: var(--border-bright);
}

.wl-price {
  color: var(--steel-bright);
  font-size: 20px;
  font-weight: 700;
  text-shadow: var(--glow-sm);
}

.wl-currency {
  color: var(--text-dim);
  font-size: 11px;
}

/* ─── Details grid ─── */
.wl-grid {
  display: grid;
  gap: 10px 20px;
  margin: 14px 0;
  padding: 12px 0;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.wl-metric-label {
  color: var(--text-dim);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wl-metric-value {
  margin-top: 2px;
  color: var(--steel);
  font-size: 13px;
}

.wl-metric-value.is-muted {
  color: var(--muted);
}

/* ─── Status bar ─── */
.wl-statusbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wl-statusbar-track {
  position: relative;
  flex: 1;
  height: 18px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

.wl-statusbar-fill {
  height: 100%;
  transition: width 0.3s ease;
}

.wl-statusbar-fill.is-overvalued {
  width: 0%;
  background: var(--red);
  opacity: 0.35;
}

.wl-statusbar-fill.is-value-range {
  background: var(--steel);
  box-shadow: 0 0 8px rgba(184, 196, 208, 0.45);
}

.wl-statusbar-fill.is-deep-value {
  width: 100%;
  background: var(--cyan);
  box-shadow: var(--glow-cyan);
}

.wl-statusbar-fill.is-unknown {
  width: 0%;
  background: var(--muted);
}

.wl-statusbar-overflow {
  position: absolute;
  top: 50%;
  right: 6px;
  color: var(--bg);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: none;
  transform: translateY(-50%);
}

.wl-statusbar-label {
  flex-shrink: 0;
  min-width: 92px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: uppercase;
}

.wl-statusbar-label.is-overvalued {
  color: var(--red);
}

.wl-statusbar-label.is-value-range {
  color: var(--steel);
}

.wl-statusbar-label.is-deep-value {
  color: var(--cyan);
  text-shadow: var(--glow-cyan);
}

.wl-statusbar-label.is-unknown {
  color: var(--muted);
}

/* ─── Footer row ─── */
.wl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.wl-footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.wl-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.wl-error-msg {
  color: var(--red);
  font-size: 10px;
}

.wl-badge {
  padding: 1px 6px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.wl-badge-stale {
  color: var(--amber);
}

.wl-badge-error {
  color: var(--red);
}

/* ─── States: loading / empty / error ─── */
.wl-skeleton {
  height: 148px;
  background: linear-gradient(
    100deg,
    rgba(184, 196, 208, 0.025) 30%,
    rgba(184, 196, 208, 0.08) 50%,
    rgba(184, 196, 208, 0.025) 70%
  );
  background-size: 200% 100%;
  border: 1px solid var(--border);
  animation: wl-shimmer 1.6s ease-in-out infinite;
}

@keyframes wl-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.wl-empty {
  padding: 60px 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.wl-empty-icon {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--steel-dim);
  font-family: var(--display);
  font-size: 36px;
  line-height: 60px;
  background: transparent;
  border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.wl-empty-icon:hover {
  color: var(--steel);
  border-color: var(--border-bright);
  box-shadow: var(--glow-md);
}

.wl-load-error {
  padding: 24px;
  color: var(--red);
  font-size: 12px;
  text-align: center;
  border: 1px solid var(--red);
}

/* ─── Delete fade-out ─── */
.wl-card.is-deleting {
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ─── Edit mode ─── */
.wl-card.is-editing {
  border-color: var(--border-bright);
  box-shadow: var(--glow-sm);
}

.wl-edit-input {
  width: 100%;
  padding: 3px 6px;
  margin-top: 2px;
  color: var(--steel-bright);
  font-family: var(--mono);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-bright);
}

.wl-edit-notes {
  margin: 0 0 14px;
}

.wl-edit-notes textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 6px 8px;
  margin-top: 4px;
  color: var(--steel);
  font-family: var(--mono);
  font-size: 12px;
  resize: vertical;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

.wl-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.wl-edit-actions-right {
  display: flex;
  gap: 8px;
}

.wl-btn-delete {
  color: var(--red);
  border-color: rgba(255, 68, 68, 0.4);
}

.wl-btn-delete:hover {
  color: var(--red);
  background: rgba(255, 68, 68, 0.1);
  border-color: var(--red);
}

/* ─── Add Stock modal ─── */
.wl-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 5, 7, 0.75);
}

.wl-modal-overlay.is-open {
  display: flex;
}

.wl-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 24px 22px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-bright);
  box-shadow: var(--glow-lg), 0 20px 60px rgba(0, 0, 0, 0.6);
}

.wl-modal::before,
.wl-modal::after {
  position: absolute;
  z-index: 1;
  width: 14px;
  height: 14px;
  content: '';
  border: 2px solid var(--steel);
  pointer-events: none;
}

.wl-modal::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.wl-modal::after {
  right: -1px;
  bottom: -1px;
  border-top: none;
  border-left: none;
}

.wl-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  border: 1px solid transparent;
}

.wl-modal-close:hover {
  color: var(--steel);
  border-color: var(--border);
}

.wl-modal-title {
  margin: 0 0 16px;
  color: var(--steel-bright);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: var(--glow-md);
}

.wl-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wl-search-input,
.wl-modal-input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  color: var(--steel-bright);
  font-family: var(--mono);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-bright);
}

.wl-search-input::placeholder,
.wl-modal-input::placeholder {
  color: var(--muted);
}

.wl-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.wl-search-hint {
  padding: 14px 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.wl-search-hint-error {
  color: var(--red);
}

.wl-search-result {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 10px;
  text-align: left;
  background: transparent;
  border: 1px solid var(--border);
}

.wl-search-result:hover {
  background: var(--steel-faint);
  border-color: var(--border-bright);
}

.wl-search-result-symbol {
  flex-shrink: 0;
  color: var(--steel-bright);
  font-size: 12px;
  font-weight: 700;
}

.wl-search-result-name {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wl-search-result-exchange {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.wl-modal-selected {
  padding: 10px 12px;
  background: var(--steel-faint);
  border: 1px solid var(--border);
}

.wl-modal-selected-name {
  color: var(--steel-bright);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
}

.wl-modal-selected-ticker {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.wl-modal-label {
  color: var(--text-dim);
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wl-modal-error {
  min-height: 14px;
  color: var(--red);
  font-size: 11px;
}

.wl-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .wl-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
