@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Hide content until fully loaded to prevent flash */
body {
  opacity: 0;
  transition: opacity 0.15s ease;
}

body.loaded {
  opacity: 1;
}

/* Fallback: show after brief delay even if JS fails */
@media (prefers-reduced-motion: no-preference) {
  body {
    animation: showBody 0s 0.1s forwards;
  }
}

@keyframes showBody {
  to {
    opacity: 1;
  }
}

:root {
  color-scheme: dark;

  /* Core Colors */
  --bg-color: #0f172a;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --primary-color: #8b5cf6;
  --secondary-color: #06b6d4;
  --accent-glow: rgba(139, 92, 246, 0.3);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --font-main: 'Outfit', sans-serif;

  /* Mapping to existing variable names for compatibility */
  --bg: var(--bg-color);
  --bg-alt: #1e293b;
  /* Slightly lighter than bg-color */
  --surface: var(--glass-bg);
  --surface-alt: rgba(255, 255, 255, 0.1);
  --border: var(--glass-border);
  --text: var(--text-color);
  --muted: var(--text-muted);
  --accent: var(--primary-color);
  --accent-strong: #7c3aed;
  --danger: #ef4444;
  --danger-strong: #dc2626;
  --success: #22c55e;
  --shadow: rgba(0, 0, 0, 0.3);
  --accent-highlight: rgba(139, 92, 246, 0.15);
  --accent-highlight-strong: rgba(139, 92, 246, 0.3);
  --danger-highlight: rgba(239, 68, 68, 0.12);
  --overlay: rgba(15, 23, 42, 0.85);
  --spinner-track: rgba(255, 255, 255, 0.1);
  --tooltip-bg: rgba(30, 30, 35, 0.98);
  --tooltip-border: rgba(255, 255, 255, 0.15);
}

/* Remove old theme selectors as we are enforcing this new theme */


* {
  box-sizing: border-box;
}

html {
  background-color: #0c1322;
}

body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Glow Effect */
.background-glow {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 50%);
  z-index: -1;
  animation: pulse-glow 10s infinite alternate;
  pointer-events: none;
}

@keyframes pulse-glow {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.info-list a,
.info-blurb a {
  color: #4da3ff;
}

.info-list a:hover,
.info-list a:focus-visible,
.info-blurb a:hover,
.info-blurb a:focus-visible {
  text-decoration: underline;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5vw;
  padding-top: calc(1.5rem + 200px);
  margin-top: -200px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: -200px;
  z-index: 100;
  border-bottom: 1px solid var(--glass-border);
}

.branding h1 {
  margin: 0;
  font-size: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.branding h1 .logo-icon {
  height: 1.8rem;
  width: auto;
}

.branding h1 a.brand-link {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s ease;
}

.branding h1 a.brand-link:hover,
.branding h1 a.brand-link:focus-visible {
  color: var(--accent);
}

.breadcrumb-separator {
  color: var(--muted);
  font-weight: 400;
  margin: 0 0.25rem;
}

.breadcrumb-current {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85em;
}

.branding .tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.header-credits {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-alt);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.header-credits svg {
  color: var(--accent);
}

.credits-button svg {
  color: var(--accent);
}

.chat-body .header-actions {
  align-items: flex-start;
  margin-left: auto;
  padding-top: 0.1rem;
}

.chat-body .header-actions .button {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.button[hidden] {
  display: none;
}

.button.icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
  font-size: 1.15rem;
  font-weight: 700;
}

.button.icon-only {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.button.icon-only img,
.button.icon-only svg {
  width: 1.25rem;
  height: 1.25rem;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border: none;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.success {
  background: #2ea043;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
}

.button.success.animate-in {
  animation: slideReveal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.button.success.animate-out {
  animation: slideHide 0.3s ease-in forwards;
  pointer-events: none;
}

.button.success:hover {
  background: #2c974b;
}

.button.danger {
  background: var(--danger);
}

.button.danger:hover {
  background: var(--danger-strong);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button.is-disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  background: var(--surface-alt);
  color: var(--muted);
  border-color: var(--border);
}

.button.is-disabled:hover,
.button.is-disabled:focus-visible,
.button[aria-disabled="true"]:hover,
.button[aria-disabled="true"]:focus-visible {
  background: var(--surface-alt);
  color: var(--muted);
}

.button.primary.is-disabled,
.button.primary[aria-disabled="true"] {
  background: var(--accent-highlight-strong);
  border-color: var(--accent);
  color: var(--text);
  opacity: 0.6;
}

.button.primary.is-disabled:hover,
.button.primary.is-disabled:focus-visible,
.button.primary[aria-disabled="true"]:hover,
.button.primary[aria-disabled="true"]:focus-visible {
  background: var(--accent-highlight-strong);
  border-color: var(--accent);
  color: var(--text);
}

.page-content {
  padding: 1.5rem 1.5vw 4rem;
  display: grid;
  gap: 2rem;
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  margin: 0;
}

.alert.fading {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.slide-up {
  transition: transform 0.3s ease-out;
}

.alert.success {
  background: var(--accent-highlight);
  border-color: var(--accent);
}

.alert.error {
  background: var(--danger-highlight);
  border-color: var(--danger);
}


.formula-panel,
.ideas-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.batch-panel .batch-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.batch-alert {
  min-height: 1.25rem;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
}

.batch-alert.is-error {
  color: var(--danger);
}

.batch-alert.is-success {
  color: var(--accent);
}

.panel-rounds {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0.3rem 0 0.4rem;
  border-bottom: 1px solid var(--border);
}

.panel-rounds[data-panel="batch"] {
  margin-top: 0.5rem;
}

.panel-rounds .rounds-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.rounds-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.rounds-progress {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.rounds-details {
  flex: 1 1 240px;
  min-width: 220px;
}

.formula-panel,
.ideas-panel {
  position: relative;
  z-index: 0;
}

.formula-panel:hover,
.formula-panel:focus-within,
.ideas-panel:hover,
.ideas-panel:focus-within {
  z-index: 50;
  /* lift hovered panel so its tooltip can float above siblings */
}

.rounds-warning {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--danger);
  background: var(--danger-highlight);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-weight: 500;
  margin: 0.75rem 0 1rem;
}

.rounds-warning .button {
  margin-left: auto;
}

.button.secondary {
  background: transparent;
  border-color: var(--border);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}


.info-panel {
  display: grid;
  gap: 0.9rem;
  padding: 0.35rem 1.5rem 1.5rem;
}

.info-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.info-list li strong {
  color: var(--text);
}

.info-blurb {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.info-blurb a {
  color: var(--text);
}

.formula-view {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 0.3rem 0 0.5rem;
  min-height: 3rem;
}

.formula-view .formula-display {
  flex: 1;
  margin: 0;
  min-height: 2.7rem;
}

.formula-view .button {
  flex-shrink: 0;
  align-self: center;
}

.formula-display {
  margin: 0;
  padding: 0.6rem 0.9rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1rem;
  line-height: 1.5;
  display: none;
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

.formula-display.mathjax-ready {
  display: block;
  cursor: pointer;
}

.formula-display.mathjax-ready:hover {
  background: var(--surface-alt);
}

.formula-skeleton {
  flex: 1;
  height: 2.7rem;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.formula-display.mathjax-ready+.formula-skeleton,
.formula-skeleton:has(+ .formula-display.mathjax-ready),
.formula-display.mathjax-ready~.formula-skeleton {
  display: none;
}

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

  100% {
    background-position: -200% 0;
  }
}

.formula-display mjx-container {
  justify-content: flex-start !important;
  text-align: left !important;
  margin: 0 !important;
}

.formula-view[hidden] {
  display: none;
}

.formula-form[hidden] {
  display: none;
}

.formula-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.formula-form textarea {
  resize: vertical;
  min-height: 4rem;
  font-family: inherit;
  margin-top: 0.25rem;
}

.formula-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.formula-footer .helper-text {
  margin: 0;
  flex: 1 1 240px;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.formula-footer .formula-actions {
  display: inline-flex;
  gap: 0.75rem;
  margin-left: auto;
}

.formula-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 1rem;
  backdrop-filter: blur(5px);
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(0, 0, 0, 0.3);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-value {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  justify-content: center;
  font-weight: 600;
  white-space: nowrap;
}

.metric-std {
  color: var(--muted);
  font-size: 0.75em;
  font-weight: 500;
  position: relative;
  cursor: help;
}

.metric-std.dynamic-std-gradient {
  color: hsl(var(--std-hue), 70%, 45%);
}

.metric-std[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--tooltip-border);
  font-size: 0.85rem;
  line-height: 1.4;
  width: 180px;
  white-space: normal;
  text-align: center;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  margin-bottom: 0.4rem;
  opacity: 0;
  animation: fadeIn 0.2s forwards;
}

.metric-missing {
  opacity: 0.6;
}

.eval-count-cell {
  text-align: center;
  font-weight: 600;
}


.ideas-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.ideas-heading {
  justify-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ideas-header .rounds-stepper-form {
  justify-self: center;
}

.ideas-header .header-actions,
.ideas-header .batch-actions {
  justify-self: end;
}

.ideas-heading h2 {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
}

.ideas-heading .idea-count {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.table-wrapper {
  position: relative;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.table-wrapper.has-overlay {
  min-height: 14rem;
}

.table-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.table-overlay.is-visible,
.table-overlay[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.table-overlay .overlay-content {
  text-align: center;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  max-width: 320px;
}

.overlay-spinner {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 3px solid var(--spinner-track);
  border-top-color: var(--accent);
  margin: 0 auto 0.75rem;
  animation: overlay-spin 1s linear infinite;
}

@keyframes overlay-spin {
  to {
    transform: rotate(360deg);
  }
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 0;
  table-layout: auto;
  background: transparent;
  border-radius: 16px;
}

table th,
table td {
  text-align: center;
  padding: 0.85rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}

tbody td {
  font-size: 0.88rem;
}


table th.sortable {
  padding: 0;
}

table th.sortable .sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.sort-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.9rem;
  height: 0.9rem;
  font-size: 0.75rem;
  opacity: 0.45;
}

.sort-button.is-sorted-asc .sort-indicator::before {
  content: "\2191";
}

.sort-button.is-sorted-desc .sort-indicator::before {
  content: "\2193";
}

.sort-button:not(.is-sorted-asc):not(.is-sorted-desc) .sort-indicator::before {
  content: "\2195";
}

.sort-button.is-sorted-asc .sort-indicator,
.sort-button.is-sorted-desc .sort-indicator {
  opacity: 1;
}

table th:not(:last-child),
table td:not(:last-child) {
  border-right: 1px solid var(--border);
}

table tr:last-child td {
  border-bottom: none;
}

thead th:first-child {
  border-top-left-radius: 16px;
}

thead th:last-child {
  border-top-right-radius: 16px;
}

.table-wrapper tbody tr:last-child td:first-child {
  border-bottom-left-radius: 16px;
}

.table-wrapper tbody tr:last-child td:last-child {
  border-bottom-right-radius: 16px;
}

.score-info-cell {
  text-align: center;
}

.score-info-header,
.score-info-cell {
  width: 1%;
  white-space: nowrap;
}

.actions-header,
td.actions {
  width: 1%;
  white-space: nowrap;
}

table th {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.6rem;
  color: var(--muted);
  background: var(--surface-alt);
  white-space: normal;
}

tbody tr:hover td {
  background: var(--accent-highlight);
}

.incomplete-row td {
  background: var(--danger-highlight);
}

.incomplete-row:hover td {
  background: rgba(239, 68, 68, 0.15);
}

.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent-highlight);
  color: var(--text);
  font-weight: 700;
  cursor: help;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 200;
  /* ensure tooltip trigger and popup stay above surrounding panels */
}

.tooltip:hover,
.tooltip:focus-visible {
  background: var(--accent-highlight-strong);
  transform: translateY(-1px);
  outline: none;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.8rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--tooltip-border);
  font-size: 0.85rem;
  line-height: 1.45;
  min-width: 16rem;
  max-width: min(32rem, calc(100vw - 4rem));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: pre-line;
  z-index: 210;
}

.tooltip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 0.25rem);
  left: 50%;
  transform: translateX(-50%);
  border-width: 0.5rem;
  border-style: solid;
  border-color: var(--tooltip-bg) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 205;
}

.tooltip.info-tooltip::after {
  bottom: auto;
  top: calc(100% + 0.8rem);
}

.tooltip.info-tooltip::before {
  bottom: auto;
  top: calc(100% + 0.25rem);
  border-color: transparent transparent var(--tooltip-bg) transparent;
}

.tooltip:hover::after,
.tooltip:focus-visible::after,
.tooltip:hover::before,
.tooltip:focus-visible::before {
  opacity: 1;
}

.tooltip.disabled {
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.tooltip.disabled::after,
.tooltip.disabled::before {
  display: none;
}

/* Idea name tooltip - hover to show popup, click to open modal */
.idea-name-tooltip {
  position: relative;
  cursor: pointer;
}

.idea-name-popup {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 0;
  background: var(--tooltip-bg);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 8px 20px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  z-index: 210;
}

.idea-name-popup::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 1rem;
  border-width: 0.4rem;
  border-style: solid;
  border-color: var(--tooltip-bg) transparent transparent transparent;
}

.idea-name-tooltip:hover .idea-name-popup,
.idea-name-tooltip:focus-visible .idea-name-popup {
  opacity: 1;
}

.idea-name-tooltip:hover .idea-name-text {
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Wide modal dialog for summaries */
.modal-dialog.modal-dialog-wide {
  max-width: 60vw;
  width: 60vw;
}

.summary-content {
  max-height: 60vh;
  overflow-y: auto;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1rem 0;
  white-space: pre-line;
  line-height: 1.6;
}

/* Button with tooltip - preserves button styling */
.button-tooltip {
  position: relative;
  overflow: visible !important;
}

.button-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.8rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--tooltip-border);
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
  width: auto;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
}

.button-tooltip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 0.25rem);
  left: 50%;
  transform: translateX(-50%);
  border-width: 0.5rem;
  border-style: solid;
  border-color: var(--tooltip-bg) transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1000;
}

.button-tooltip:hover::after,
.button-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

.tooltip-block {
  position: relative;
  display: flex;
}

.tooltip-block[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 24rem;
  max-width: min(48rem, calc(100vw - 3rem));
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--tooltip-bg);
  border: 1px solid var(--tooltip-border);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  text-align: left;
  z-index: 12;
}

.tooltip-block[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 0.25rem);
  left: 50%;
  transform: translateX(-50%);
  border-width: 0.45rem;
  border-style: solid;
  border-color: var(--tooltip-bg) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 11;
}

.tooltip-block[data-tooltip]:hover::after,
.tooltip-block[data-tooltip]:focus-within::after,
.tooltip-block[data-tooltip]:hover::before,
.tooltip-block[data-tooltip]:focus-within::before {
  opacity: 1;
}

.actions {
  text-align: right;
}

.empty-row {
  background: transparent;
}

.empty-row .empty-message {
  text-align: center;
  color: var(--muted);
  padding: 3.5rem 1rem;
  font-style: italic;
}

.empty-row .empty-message .button {
  font-size: 1.1rem;
  padding: 0.9rem 2rem;
}

.empty-row .actions {
  text-align: center;
  padding: 1rem;
}

.chat-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.chat-body .page-header {
  padding-left: 1.5vw;
  padding-right: 1.5vw;
}

.chat-container {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  padding: 1.5rem 1.5vw 2rem;
  box-sizing: border-box;
}

.chat-sidebar {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Chat History Section */
.chat-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.chat-history-header .button.small {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.chat-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.chat-history-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: var(--accent-highlight);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  position: relative;
}

.chat-history-item:hover {
  background: var(--border);
}

.chat-history-item.is-active {
  background: var(--accent);
  color: var(--accent-text);
}

.chat-history-item.is-completed {
  border-left: 3px solid var(--success, #22c55e);
}

.chat-history-item.is-draft {
  border-left: 3px solid var(--warning, #f59e0b);
}

.chat-history-status {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-history-item.is-completed .chat-history-status {
  background: var(--success, #22c55e);
}

.chat-history-item.is-draft .chat-history-status {
  background: var(--warning, #f59e0b);
}

.chat-history-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-history-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-history-preview {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-history-item.is-active .chat-history-preview {
  color: var(--accent-text);
  opacity: 0.8;
}

.chat-history-delete {
  opacity: 0;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--danger);
  line-height: 1;
  border-radius: 4px;
  transition: opacity 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-history-delete svg {
  width: 14px;
  height: 14px;
}

.chat-history-item:hover .chat-history-delete {
  opacity: 1;
}

.chat-history-delete:hover {
  color: var(--danger);
  opacity: 1;
}

.chat-history-empty {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  padding: 1rem 0.5rem;
}

.status {
  min-height: 1.6rem;
  font-size: 0.95rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status.error {
  color: var(--danger);
}

.spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 2px solid var(--spinner-track);
  border-top-color: var(--accent);
  animation: spin 0.6s linear infinite;
}


.chat-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 10rem);
  min-height: 0;
  position: relative;
}

/* Chat Idea Header */
.chat-idea-header {
  padding: 0 0 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.chat-idea-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

/* Chat Start Prompt */
.chat-start-prompt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.chat-start-prompt[hidden] {
  display: none;
}

.chat-start-card {
  text-align: center;
  max-width: 400px;
}

.chat-start-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
}

.chat-start-card p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.chat-start-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-start-form input {
  padding: 0.85rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
  color: var(--text);
  text-align: center;
}

.chat-start-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-highlight);
}

.chat-start-form .button {
  padding: 0.85rem 1.5rem;
}

.chat-panel.is-evaluating {
  cursor: progress;
}

.chat-panel.has-results .chat-session {
  display: none;
}

.chat-session {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-session[hidden] {
  display: none;
}

.chat-session.is-hidden {
  display: none;
}

.chat-log {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-log li {
  align-self: flex-start;
  max-width: min(75ch, 90%);
  padding: 0.7rem 0.9rem;
  border-radius: 16px;
  line-height: 1.35;
  animation: fadeIn 0.25s ease;
  word-break: break-word;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-log li.user {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  align-self: flex-end;
  box-shadow: 0 4px 15px var(--accent-glow);
  border: none;
}

.chat-log li.assistant {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--text-color);
}

.chat-log li.pending {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  color: var(--muted);
  padding: 0.6rem 0.85rem;
}

/* Removed redundant text-align: center for specific columns */

.bubble-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.bubble-dots span {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.4;
  animation: bounce 0.9s infinite;
}

.bubble-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.bubble-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-form {
  margin-top: 1.5rem;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input-row textarea {
  min-height: 2.75rem;
  max-height: 12rem;
  resize: none;
  overflow-y: auto;
  line-height: 1.5;
  font-family: inherit;
}

.chat-form .send-button {
  width: 3rem;
  height: 3rem;
  background: var(--accent);
  color: #fff;
  font-size: 1.25rem;
  border: none;
}

.chat-form .send-button:hover,
.chat-form .send-button:focus-visible {
  background: var(--accent-strong);
  color: #fff;
}

.chat-actions {
  margin-top: 1rem;
  display: none;
}

.chat-actions.is-active {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.chat-actions .button {
  width: 100%;
  min-height: 3rem;
  justify-content: center;
  font-size: 1rem;
}

.spinner.large {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 3px;
}

.chat-panel-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--overlay);
  border-radius: inherit;
  backdrop-filter: blur(6px);
  text-align: center;
  z-index: 5;
}

.chat-panel-overlay p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.chat-evaluation {
  flex: 1 1 auto;
  display: none;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  padding-top: 0.5rem;
}

.chat-evaluation:not([hidden]) {
  display: flex;
}

.evaluation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  display: grid;
  gap: 0.75rem;
}

.evaluation-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.evaluation-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  white-space: pre-line;
}

.evaluation-scoring {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 2.5rem;
}

#evaluation-scoring-status.is-loading {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.evaluation-card .spinner.large {
  width: 3rem;
  height: 3rem;
  border-width: 4px;
}

.evaluation-score {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
}

.rounds-stepper-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  padding: 0.35rem 0.5rem 0.35rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.rounds-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.stepper-btn:hover,
.stepper-btn:focus-visible {
  background: var(--surface-alt);
  color: var(--accent);
}

.stepper-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.stepper-value {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0.4);
    opacity: 0.3;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideReveal {
  from {
    max-width: 0;
    opacity: 0;
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
  }

  to {
    max-width: 240px;
    opacity: 1;
    padding-left: 1.3rem;
    padding-right: 1.3rem;
    margin-left: 0.4rem;
  }
}

@keyframes slideHide {
  from {
    max-width: 240px;
    opacity: 1;
    padding-left: 1.3rem;
    padding-right: 1.3rem;
    margin-left: 0.4rem;
  }

  to {
    max-width: 0;
    opacity: 0;
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .formula-footer .helper-text {
    white-space: normal;
  }
}

@media (max-width: 960px) {

  .page-header,
  .page-content,
  .chat-container {
    padding: 1.5rem;
  }

  .chat-container {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    order: -1;
  }

  table {
    min-width: 0;
  }

  table th,
  table td {
    font-size: 0.85rem;
  }
}

/* Profile Page Styles */
.profile-form {
  display: grid;
  gap: 2rem;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
}

.settings-section h2 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Form row for side-by-side fields */
.form-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.form-row .form-group {
  flex: 0 0 auto;
  min-width: 0;
  margin-bottom: 0;
}

/* Section divider */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.settings-section h3 {
  margin: 0 0 1.5rem;
  font-size: 1.2rem;
  color: var(--text);
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-group .helper-text {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.form-group select,
.form-group input[type="number"] {
  width: 100%;
  max-width: 200px;
  padding: 0.6rem 2.5rem 0.6rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

.form-group select:hover,
.form-group select:focus {
  border-color: var(--accent);
}

.form-group input[type="number"] {
  max-width: 120px;
  padding: 0.6rem 1rem;
  background-image: none;
}

.metrics-editor {
  margin-top: 1rem;
}

.metrics-table {
  width: 100%;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  border-collapse: separate;
  border-spacing: 0;
}

.metrics-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.metrics-table th:first-child {
  border-top-left-radius: 0.5rem;
}

.metrics-table th:last-child {
  border-top-right-radius: 0.5rem;
}

.metrics-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 0.5rem;
}

.metrics-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 0.5rem;
}

.metrics-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.metrics-table tbody tr:last-child td {
  border-bottom: none;
}

.metrics-table input {
  width: 100%;
  padding: 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text);
}

/* Drag handle column */
.metrics-table .col-drag {
  width: 2rem;
  text-align: center;
  cursor: grab;
  color: var(--muted);
  user-select: none;
}

.metrics-table .col-drag:active {
  cursor: grabbing;
}

.metrics-table .drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  cursor: grab;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity 0.15s;
}

.metrics-table .drag-handle:hover {
  opacity: 1;
}

.metrics-table tr.dragging {
  opacity: 0.5;
  background: var(--accent);
}

.metrics-table tr.drag-over {
  border-top: 2px solid var(--accent);
}

/* Metrics table column widths */
.metrics-table .col-name {
  width: 18%;
}

.metrics-table .col-symbol {
  width: 8%;
  min-width: 60px;
}

.metrics-table .col-description {
  width: auto;
}

.metrics-table .col-direction {
  width: 15%;
  min-width: 140px;
}

.metrics-table .col-direction select {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.5rem;
  font-size: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f8fafc' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.875rem;
}

.metrics-table .col-direction select:hover {
  border-color: var(--accent);
}

/* Direction select color coding */
.metrics-table .col-direction select.direction-higher {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.4);
}

.metrics-table .col-direction select.direction-lower {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.metrics-table .col-actions {
  width: 1%;
  white-space: nowrap;
}

.metrics-table th .tooltip {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.7rem;
}

/* Inline stepper for profile page */
.rounds-stepper-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.rounds-stepper-inline .stepper {
  background: var(--surface);
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.rounds-stepper-inline .helper-text {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.subscription-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.info-item {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 16px;
  text-align: center;
  border: 1px solid var(--border);
}

.info-item .label {
  display: block;
  color: var(--muted);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-item .value {
  font-size: 1.5rem;
  font-weight: 700;
}

.info-item .badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  font-size: 1rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Save status indicator */
.save-status {
  font-size: 0.85rem;
  font-weight: 500;
  margin-left: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.save-status.saving,
.save-status.saved,
.save-status.error {
  opacity: 1;
}

.save-status.saving {
  color: var(--muted);
}

.save-status.saved {
  color: #2ea043;
}

.save-status.error {
  color: var(--danger);
}

/* User Avatar Styles */
.profile-button {
  padding-left: 0.5rem !important;
  padding-right: 0.75rem !important;
}

.profile-button>span:last-child {
  margin-left: 0.25rem;
}

.button-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.button-avatar-placeholder {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Profile Page User Section */
.profile-header-section {
  margin-bottom: 1.5rem;
}

.profile-user-info {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 2rem;
  border: 3px solid var(--border);
}

.profile-user-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.profile-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.profile-email {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.profile-badges {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.profile-provider {
  font-size: 0.75rem;
  text-transform: uppercase;
}

.profile-tier {
  font-size: 0.75rem;
  text-transform: uppercase;
}

.profile-tier.tier-free {
  background: var(--surface-alt);
}

.profile-tier.tier-pro {
  background: var(--accent);
  color: white;
}

.profile-tier.tier-enterprise {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
}

.profile-credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--surface-alt);
  border-radius: 12px;
  margin-left: auto;
}

.credits-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.credits-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==================== Modal ==================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay:not([hidden]) .modal-dialog {
  transform: scale(1);
}

.modal-dialog h3 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.modal-dialog p {
  margin: 0 0 0.5rem;
  color: var(--text);
  line-height: 1.5;
}

.modal-dialog #delete-idea-name {
  font-weight: 600;
}

.modal-warning {
  font-size: 0.875rem;
  color: var(--danger);
  margin-bottom: 1.25rem !important;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Gradient Text Utilities */
.text-gradient-success {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.text-gradient-warning {
  background: linear-gradient(135deg, #eab308, #facc15);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.text-gradient-danger {
  background: linear-gradient(135deg, #ef4444, #f87171);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.text-gradient-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.text-gradient-blue {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.dynamic-score-gradient {
  background: linear-gradient(135deg, hsl(var(--score-hue), 90%, 45%), hsl(calc(var(--score-hue) + 15), 90%, 60%));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* Page footer with version */
.page-footer {
  text-align: center;
  padding: 2rem 0;
  margin-top: 2rem;
}

.page-footer .version,
.version {
  color: var(--muted);
  font-size: 0.75rem;
  opacity: 0.6;
}