/* Light theme (default) */
:root {
  --accent: #f8b500;
  --accent-light: #ffc62c;
  --primary: var(--accent);
  --bg: #ffffff;
  --card-bg: #ffffff;
  --muted-bg: #f8fafc;
  --text-main: #505762;
  --text-dark: #22252a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --on-accent: #1a1a1a;
  --success: #10b981;
  --error: #ef4444;
  --info: #3b82f6;
}

/* Dark theme */
:root[data-theme='dark'] {
  --accent: #f8b500;
  --accent-light: #ffd36a;
  --primary: var(--accent);
  --bg: #0f1115;
  --card-bg: #151922;
  --muted-bg: #12161d;
  --text-main: #e5e7eb;
  --text-dark: #f3f4f6;
  --text-muted: #9aa4b2;
  --border: #273041;
  --on-accent: #111418;
  --success: #10b981;
  --error: #ef4444;
  --info: #3b82f6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --accent: #f8b500;
    --accent-light: #ffd36a;
    --primary: var(--accent);
    --bg: #0f1115;
    --card-bg: #151922;
    --muted-bg: #12161d;
    --text-main: #e5e7eb;
    --text-dark: #f3f4f6;
    --text-muted: #9aa4b2;
    --border: #273041;
    --on-accent: #111418;
    --success: #10b981;
    --error: #ef4444;
    --info: #3b82f6;
  }
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background-color: var(--bg);
  color: var(--text-main);
  color-scheme: light dark;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.page-hero {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

.main-hero {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* Hero main section layout + background pattern */
.section-hero {
  position: relative;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

/* New: inner hero layout to align title and columns */
.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* New: pull the title a bit higher while keeping it left-aligned */
.hero-title {
  margin-bottom: 0;
  margin-top: -0.5rem;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    radial-gradient(circle at top left, transparent 0, transparent 40%, color-mix(in oklab, var(--accent) 8%, transparent) 41%, transparent 60%),
    url("data:image/svg+xml,%3Csvg width='48' height='48' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'%3E%3Cg opacity='0.1'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M-0.64647 24.3536L24.3535 -0.646439L23.6464 -1.35355L-1.35358 23.6465L-0.64647 24.3536ZM-0.64647 48.3536L48.3535 -0.646439L47.6464 -1.35355L-1.35358 47.6465L-0.64647 48.3536ZM49.3535 22.3535L22.3535 49.3535L21.6464 48.6464L48.6464 21.6464L49.3535 22.3535ZM46.3535 49.3536L49.3535 46.3536L48.6464 45.6465L45.6464 48.6465L46.3535 49.3536Z' fill='%239ca3af'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
  background-size: 480px 480px, 48px 48px;
  mix-blend-mode: normal;
  z-index: -1;
}

.container-max {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

a {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

/* Existing mappings kept (still useful if legacy classes remain) */
.border {
  border-color: var(--border) !important;
}

.text-\[var\(--text-dark\)\] {
  color: var(--text-dark) !important;
}

.text-\[var\(--text-main\)\] {
  color: var(--text-main) !important;
}

.text-\[var\(--text-muted\)\] {
  color: var(--text-muted) !important;
}

.bg-white {
  background-color: var(--card-bg) !important;
}

.bg-slate-50 {
  background-color: var(--muted-bg) !important;
}

.bg-\[\#f8b500\],
.bg-\[var\(--accent\)\] {
  background-color: var(--accent) !important;
}

.hover\:bg-\[\#ffc62c\]\:hover,
.hover\:bg-\[var\(--accent-light\)\]:hover {
  background-color: var(--accent-light) !important;
}

.bg-violet-600 {
  background: var(--accent) !important;
}

.bg-violet-600:hover {
  background: var(--accent-light) !important;
}

.bg-violet-600.text-white,
.text-\[var\(--on-accent\)\] {
  color: var(--on-accent) !important;
}

.hover\:text-\[\#f8b500\]:hover,
.hover\:text-\[var\(--accent\)\]:hover {
  color: var(--accent) !important;
}

svg [stroke="#f8b500"] {
  stroke: var(--accent) !important;
}

svg [stroke="#7c3aed"] {
  stroke: var(--accent) !important;
}

svg text[fill="#444"] {
  fill: var(--text-main) !important;
}

/* Theme Toggle switch */
.theme-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
}

.theme-input {
  display: none;
}

.theme-icon {
  grid-column: 1 / 1;
  grid-row: 1 / 1;
  transition: transform 500ms;
  line-height: 0.1;
}

.icon--moon {
  transition-delay: 200ms;
  color: #b4b4b4;
}

.icon--sun {
  transform: scale(0);
  color: #ffa500;
}

#switch:checked+.icon--moon {
  transform: rotate(360deg) scale(0);
}

#switch:checked~.icon--sun {
  transition-delay: 200ms;
  transform: scale(1) rotate(360deg);
}
/* End Theme Toggle switch */

/* Tables */
.r-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.r-table thead th {
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--muted-bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}
.r-table tbody td {
  color: var(--text-main);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.r-table tbody tr {
  transition: background-color 0.15s ease;
}
.r-table tbody tr:hover {
  background-color: var(--muted-bg);
}

/* Neutral badge for types */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  line-height: 1.2;
  font-weight: 600;
  background: var(--muted-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
}

/* Pagination wrapper */
.r-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

/* Forms and buttons */
.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: var(--card-bg);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input::placeholder {
  color: var(--text-muted);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}

.label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid transparent;
  border-radius: 0.375rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover {
  background: var(--accent-light);
}

.btn.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border-color: var(--text-main);
}
.btn.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Modal */
.r-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 50;
}
.r-modal-card {
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Icon button (close) */
.icon-btn {
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
}
.icon-btn:hover {
  color: var(--text-dark);
}

/* Dropdown (search results) */
.dropdown {
  position: absolute; /* ensure positioned for z-index to apply */
  z-index: 60;        /* render above following inputs/labels inside modal */
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  max-height: 15rem;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}
.dropdown-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}
.dropdown-item:hover {
  background: var(--muted-bg);
}

/* Checkbox accent */
input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Toasts */
.toast-container {
  position: fixed;
  inset: auto 16px 16px auto; /* bottom-right by default */
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 420px);
  z-index: 80;
  pointer-events: none; /* prevent blocking page; toasts re-enable */
}
.toast-container[data-position^="top"] { top: 16px; bottom: auto; }
.toast-container[data-position^="bottom"] { bottom: 16px; top: auto; }
.toast-container[data-position$="left"] { left: 16px; right: auto; align-items: flex-start; }
.toast-container[data-position$="right"] { right: 16px; left: auto; align-items: flex-end; }

.toast {
  --tone: var(--info);
  pointer-events: auto;
  background: color-mix(in oklab, var(--card-bg) 90%, var(--tone));
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--tone);
  color: var(--text-main);
  border-radius: 0.5rem;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  will-change: transform, opacity;
}
.toast--success { --tone: var(--success); }
.toast--error { --tone: var(--error); }
.toast--info { --tone: var(--info); }

.toast__title {
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}
.toast__message {
  color: var(--text-main);
}
.toast__close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 2px;
  line-height: 1;
  border-radius: 0.375rem;
  cursor: pointer;
}
.toast__close:hover { color: var(--text-dark); background: var(--muted-bg); }

/* Progress bar (optional; shown if present) */
.toast__progress {
  grid-column: 1 / -1;
  height: 2px;
  background: color-mix(in oklab, var(--tone) 70%, transparent);
  transform-origin: left center;
  transform: scaleX(1);
}

/* Animations */
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateY(8px); opacity: 0; }
}
.toast-enter { animation: toast-in 200ms ease-out both; }
.toast-exit { animation: toast-out 180ms ease-in forwards; }

@media (prefers-reduced-motion: reduce) {
  .toast-enter, .toast-exit { animation: none; }
}

.chart-container {
  height: 300px;
  position: relative;
}

.delisted-asset {
  opacity: 0.5;
  color: var(--text-muted);
}