:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --primary: #166534;
  --primary-hover: #14532d;
  --primary-text: #ffffff;
  --focus: #166534;
  --error: #991b1b;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(17, 24, 39, 0.06);
  --container: min(100% - 32px, 1080px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: var(--muted);
}

a.btn,
a.btn:hover {
  text-decoration: none;
}

code {
  font-size: 0.9em;
  background: #eef1f6;
  padding: 2px 6px;
  border-radius: 6px;
}

.container {
  width: var(--container);
  margin-inline: auto;
  padding-inline: 16px;
}

.container--main {
  padding-block: 20px 48px;
}

/* Top bar — mobile first */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--text);
}

.brand__beta {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: 0.72rem;
  color: #2563eb;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  vertical-align: 0.15em;
  margin-left: 0.3em;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.nav {
  display: none;
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.nav.is-open {
  display: flex;
}

.nav a {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

@media (min-width: 640px) {
  .nav-toggle {
    display: none;
  }

  .topbar__inner {
    position: relative;
  }

  .nav {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .nav a {
    padding: 8px 10px;
    font-size: 0.95rem;
  }
}

.nav .lang-picker {
  margin-left: 2px;
  width: max-content;
}

.nav .lang-picker__trigger {
  min-width: 52px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 600;
  font-size: 0.95rem;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.12s ease;
}

.btn:hover:not(:disabled):not(.is-busy) {
  background: var(--primary-hover);
  text-decoration: none;
  color: var(--primary-text);
}

.btn:active:not(:disabled):not(.is-busy) {
  transform: scale(0.98);
}

.btn:disabled,
.btn.is-busy {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

.btn__spinner {
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.45em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.65s linear infinite;
  flex-shrink: 0;
}

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

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover:not(:disabled):not(.is-busy) {
  background: var(--bg);
  color: var(--text);
}

.btn--sm {
  padding: 8px 12px;
  font-size: 0.875rem;
}

.btn--danger {
  background: var(--error);
  color: #ffffff;
}

.btn--danger:hover:not(:disabled):not(.is-busy) {
  background: #7f1d1d;
  color: #ffffff;
}

.nav a.btn {
  color: var(--primary-text);
}

.nav a.btn:hover:not(.is-busy) {
  color: var(--primary-text);
  background: var(--primary-hover);
}

.nav a.btn:active:not(.is-busy) {
  transform: scale(0.98);
  background: var(--primary-hover);
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card--narrow {
  max-width: 420px;
  margin: 24px auto;
}

.premium-price {
  margin: 0 0 12px;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.hero {
  padding: 24px 0 8px;
}

.hero__card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.hero__card h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.2;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.account-danger {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.account-danger__title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--error);
}

.account-danger__text {
  margin: 0 0 12px;
  font-size: 0.875rem;
}

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden] {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  margin: 0;
}

.modal__panel h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.modal__text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.modal__actions {
  margin-top: 0;
}

.plan-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.plan-badge--free {
  background: #eef1f6;
  color: var(--text);
}

.plan-badge--premium {
  background: #ecfdf5;
  color: var(--primary);
  border: 1px solid #bbf7d0;
}

.plan-badge--dev {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.muted {
  color: var(--muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.field--inline {
  flex: 1 1 140px;
  min-width: 0;
}

input,
select,
.ma-control__select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.message {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.95rem;
}

.message--success {
  border-color: var(--success-border);
  background: var(--success-bg);
}

.message--error {
  border-color: var(--error-border);
  background: var(--error-bg);
  color: var(--error);
}

.message--info {
  border-color: var(--info-border);
  background: var(--info-bg);
}

.footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 16px 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  text-align: right;
}

.footer__contact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.footer__link {
  flex-shrink: 0;
  white-space: nowrap;
}

.cookie-notice {
  position: fixed;
  bottom: 16px;
  left: 50%;
  z-index: 30;
  width: min(100% - 32px, 640px);
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cookie-notice.is-hiding {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

.cookie-notice[hidden] {
  display: none !important;
}

.cookie-notice__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.cookie-notice__text {
  margin: 0;
  flex: 1;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

.cookie-notice__btn {
  flex-shrink: 0;
}

.cookie-notice a {
  color: var(--primary);
  text-decoration-color: rgba(22, 101, 52, 0.4);
}

.cookie-notice a:hover {
  color: var(--primary-hover);
  text-decoration-color: var(--primary-hover);
}

.legal-consent {
  margin: 20px 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.premium-features {
  margin: 0 0 16px;
  padding-left: 1.25rem;
}

.premium-features li + li {
  margin-top: 6px;
}

@media (max-width: 640px) {
  .footer__meta {
    align-items: flex-start;
    text-align: left;
  }
}

/* Dashboard */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dashboard__header {
  margin: 0;
}

.dashboard__eyebrow {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard__title {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.15;
}

.sync-form {
  margin: 0;
}

.sync-panel__note {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.sync-panel--running {
  border-color: var(--info-border, #bfdbfe);
}

.sync-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.95rem;
  line-height: 1.45;
}

.sync-status[hidden] {
  display: none !important;
}

.sync-status--running {
  border-color: var(--info-border, #bfdbfe);
  background: var(--info-bg, #eff6ff);
}

.sync-status--success {
  border-color: var(--success-border, #86efac);
  background: var(--success-bg, #ecfdf5);
}

.sync-status--error {
  border-color: var(--error-border, #fecaca);
  background: var(--error-bg, #fef2f2);
  color: var(--error, #b91c1c);
}

.sync-status__text {
  flex: 1;
}

.sync-status__spinner[hidden] {
  display: none;
}

.sync-panel__messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Onboarding */
.onboarding {
  display: grid;
  gap: 12px;
}

.onboarding__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.onboarding__card h2 {
  margin: 8px 0 6px;
  font-size: 1.05rem;
}

.onboarding__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.onboarding__done {
  margin: 8px 0 0;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .onboarding {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel__head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.panel__head--toolbar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel__head--toolbar > .panel__title {
  margin: 0;
}

.panel__title {
  margin: 0;
  font-size: 1.15rem;
}

.panel__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.panel__subtitle {
  margin: 4px 0 0;
  font-size: 0.875rem;
}

@media (min-width: 480px) {
  .panel {
    padding: 20px;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.period-picker {
  position: relative;
}

.period-picker__trigger {
  gap: 6px;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.period-picker__trigger[aria-expanded="true"] {
  background-color: var(--primary-hover);
}

.period-picker__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 148px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.period-picker__menu[hidden] {
  display: none;
}

.period-picker__menu [role="option"] {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease;
}

.period-picker__menu [role="option"]:hover {
  background: var(--bg);
}

.period-picker__menu [role="option"][aria-selected="true"] {
  background: #eff6ff;
  color: #1d4ed8;
}

.period-picker.lang-picker {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
}

.lang-picker .period-picker__menu {
  min-width: 0;
  width: 100%;
  padding: 0;
  background: var(--primary);
  border: 0;
  border-radius: 10px;
  top: calc(100% + 4px);
  overflow: hidden;
}

.lang-picker .period-picker__menu [role="option"] {
  padding: 8px 28px 8px 12px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-text);
  border-radius: 0;
}

.lang-picker .period-picker__menu [role="option"]:hover {
  background: var(--primary-hover);
  color: var(--primary-text);
}

.kpi-panel__footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  min-height: 72px;
}

.kpi-card__label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.kpi-card__value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-card__unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

.kpi-card__meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.kpi-card__hint {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.3;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    #e8ebf0 0%,
    #f3f5f8 50%,
    #e8ebf0 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton--text {
  height: 12px;
}

.skeleton--sm {
  width: 50%;
}

.skeleton--lg {
  width: 70%;
  height: 22px;
  margin-top: 6px;
}

.skeleton--xs {
  width: 40%;
  margin-top: 8px;
}

.skeleton--block {
  height: 120px;
  width: 100%;
  margin-bottom: 10px;
}

.skeleton--short {
  height: 48px;
}

.kpi-card--skeleton {
  pointer-events: none;
}

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

/* Progressive disclosure */
.disclosure {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.disclosure summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  list-style: none;
}

.disclosure summary:hover {
  color: var(--text);
}

.disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure summary::after {
  content: " +";
  font-weight: 400;
}

.disclosure[open] summary::after {
  content: " −";
}

.disclosure__body {
  padding-top: 12px;
}

.profile-dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.profile-dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.profile-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.profile-dl dd {
  margin: 0;
  font-weight: 600;
}

/* Nivo charts */
.chart-mount,
.details-grid-wrap {
  width: 100%;
}

.chart-shell {
  position: relative;
  width: 100%;
  min-height: 300px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 12px 12px;
  box-sizing: border-box;
}

.chart-shell--ci {
  padding: 8px 4px 12px;
  border: none;
  background: transparent;
}

.chart-shell--loading {
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Calorie Intelligence chart */
.ci-chart {
  width: 100%;
}

.ci-chart__plot {
  width: 100%;
}

.ci-chart__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 4px;
  padding: 0 8px;
}

.ci-chart__legend-actions {
  display: flex;
  gap: 6px;
}

.ci-chart__legend-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.ci-chart__legend-btn:hover {
  border-color: var(--muted);
  color: var(--text);
}

.ci-chart__legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.ci-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
}

.ci-chart__legend-item.is-off {
  opacity: 0.4;
  text-decoration: line-through;
}

.ci-chart__legend-line {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.ci-chart__legend-line--dashed {
  height: 0;
  border-top: 2px dashed;
  background: none !important;
  border-color: inherit;
}

.ci-tooltip {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.1);
  font-size: 0.8125rem;
  min-width: 240px;
}

.ci-tooltip__date {
  font-weight: 600;
  margin-bottom: 8px;
  color: #111827;
}

.ci-tooltip__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.ci-tooltip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ci-tooltip__label {
  flex: 1;
  color: #6b7280;
  line-height: 1.3;
}

.ci-tooltip__value {
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.analytics-details-page__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.analytics-details-page__lead {
  margin: 8px 0 0;
  max-width: 42rem;
}

.details-grid-hint {
  margin: 0 0 12px;
  font-size: 0.875rem;
}

.details-grid-wrap .grid-stack {
  min-height: 400px;
}

.chart-widget {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.chart-widget__title {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
}

.chart-widget__title:active {
  cursor: grabbing;
}

.chart-widget__body {
  flex: 1;
  min-height: 180px;
  padding: 8px;
}

.chart-widget__body > div {
  height: 100%;
}

.big-number {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
}

.big-number__value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
}

.big-number__label {
  margin-top: 8px;
  font-size: 0.875rem;
}

.diversity-table-wrap {
  overflow: auto;
  max-height: 100%;
}

.diversity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.diversity-table th,
.diversity-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.diversity-table th {
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--surface);
  padding: 0;
}

.diversity-table__sort {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.diversity-table__sort:hover {
  color: var(--accent, #ea580c);
}

.diversity-table__sort--active {
  color: var(--accent, #ea580c);
}

.box-plot-wrap {
  width: 100%;
  height: 100%;
  min-height: 220px;
}

.box-plot {
  display: block;
  width: 100%;
  height: 100%;
}

.box-plot-tooltip-portal {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  min-width: 180px;
}

/* Export */
.export-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.export-panel__title {
  margin: 0;
  font-size: 1rem;
}

.export-panel .panel__title-row {
  margin-bottom: 6px;
}

.export-panel--locked .btn {
  margin-top: 12px;
}

.export-form__fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 640px) {
  .export-form__fields {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
  }
}

.field--inline > span {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

/* Chat */
.chat-locked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.chat-locked__text {
  margin: 0;
}

.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-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  margin-bottom: 12px;
}

.chat-message {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.chat-message p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message--user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--primary-text);
}

.chat-message--assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
}

.chat-thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin: 0;
}

.chat-thinking__spinner {
  margin-right: 0;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 640px) {
  .chat-form {
    flex-direction: row;
    align-items: flex-end;
  }
}

.chat-input {
  flex: 1;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  resize: vertical;
}

.chat-input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.chat-form .btn {
  align-self: flex-end;
  min-width: 96px;
}
