/* Privacy, legal and trust UI: legal pages, Account & privacy, AI disclosure, notices.
   Uses only the design tokens from tokens.css so it matches the rest of the app. */

/* ---------- Shared ---------- */
.sample-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-faint);
  vertical-align: middle;
  white-space: nowrap;
}

.coach-sample { display: inline-flex; margin: 0 0 12px; }

.method-disclaimer {
  margin-top: 28px;
  font-size: 12px;
  color: var(--text-faint);
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.legal-links a,
.testimonial-person small a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color var(--transition-base);
}

.legal-links a { display: inline-flex; align-items: center; min-height: 24px; }

.legal-links a:hover,
.testimonial-person small a:hover { color: var(--text); }
.testimonial-person small a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(192, 112, 112, 0.5);
}

.btn-danger:hover:not(:disabled) { background: rgba(192, 112, 112, 0.12); }

.textarea {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  margin-right: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.status-on { color: var(--success); border-color: rgba(127, 174, 142, 0.5); background: rgba(127, 174, 142, 0.10); }
.status-open { color: var(--warning); border-color: rgba(216, 180, 95, 0.5); }

/* ---------- Sidebar ---------- */
.sidebar-account { margin-top: 4px; }

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logout { margin-left: auto; }

.sidebar-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px 10px 2px;
}

.sidebar-legal a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  font-size: 12px;
  color: var(--text-faint);
  text-decoration: none;
}

.sidebar-legal a:hover { color: var(--text-muted); }

/* ---------- AI coach chat ---------- */
.ai-disclosure {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-faint);
}

.ai-disclosure a { color: var(--text-muted); }

.ai-badge {
  flex-shrink: 0;
  margin-top: 1px;
  padding: 0 4px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.guest-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

.guest-notice strong { color: var(--text); font-weight: 600; }
.guest-notice a { color: var(--accent); }

.guest-notice-close {
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 16px;
  line-height: 1;
  color: var(--text-faint);
}

.guest-notice-close:hover { color: var(--text); }

.restriction-notice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border: 1px solid rgba(216, 180, 95, 0.4);
  border-radius: var(--radius-lg);
  background: rgba(216, 180, 95, 0.08);
  font-size: 13px;
  color: var(--text);
}

.restriction-notice-links { font-size: 11px; color: var(--text-muted); }
.restriction-notice a { color: var(--accent); }

.health-hint { margin: 4px 0 12px; }

/* Announced change to the terms or privacy notice (Legal:UpcomingChange) */
.legal-change-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 10px 14px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}

.legal-change-notice strong { color: var(--text); font-weight: 600; }
.legal-change-notice a { color: var(--accent); white-space: nowrap; }

.legal-change-badge {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 0 5px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.legal-change-notice-page { margin-bottom: 28px; }

/* Important notice to everyone, e.g. about a data breach (Legal:ServiceNotice) */
.service-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 20px;
  padding: 10px 14px;
  border: 1px solid rgba(216, 180, 95, 0.45);
  border-radius: var(--radius-lg);
  background: rgba(216, 180, 95, 0.08);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

.service-notice a { color: var(--accent); white-space: nowrap; }

.service-notice-badge {
  flex-shrink: 0;
  margin-top: 2px;
  padding: 0 5px;
  border: 1px solid rgba(216, 180, 95, 0.6);
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warning);
}

/* Full-width pages (landing, onboarding, legal): a strip across the top */
.service-notice-top {
  justify-content: center;
  margin: 0;
  border-width: 0 0 1px;
  border-radius: 0;
}

/* AI labels in the workout runner (set feedback toast, workout summary) */
.toast-ai-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-faint);
}

.summary-ai-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-faint);
}

/* Video placeholder: nothing loads from YouTube before the click */
.yt-embed .video-thumbnail {
  background:
    radial-gradient(circle at 28% 22%, rgba(113, 197, 251, 0.20), transparent 55%),
    linear-gradient(135deg, #161a21, #0b0c10);
}

.yt-embed:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Onboarding ---------- */
.onb-link { color: var(--accent); white-space: nowrap; }

.onb-legal {
  margin-top: 20px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-faint);
}

.onb-legal a { color: var(--text-muted); }

/* ---------- Legal pages ---------- */
.legal-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.legal-top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(8, 9, 10, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.legal-top-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.legal-brand { text-decoration: none; }

.legal-nav {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.legal-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-base), background var(--transition-base);
}

.legal-nav a:hover,
.legal-nav a.active {
  color: var(--text);
  background: var(--hover);
}

.legal-open-app { height: 32px; }

.legal-body {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.legal-title {
  margin-top: 14px;
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.022em;
  color: var(--text);
}

.legal-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-faint);
}

.legal-summary {
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: var(--accent-weak);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.legal-summary a,
.legal-doc a { color: var(--accent); text-underline-offset: 2px; }

.legal-doc {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-muted);
}

.legal-doc h2 {
  margin: 40px 0 12px;
  font-size: 18px;
  color: var(--text);
}

.legal-doc p + p { margin-top: 12px; }
.legal-doc ul { margin: 10px 0 0; padding-left: 20px; }
.legal-doc li + li { margin-top: 6px; }
.legal-doc strong { color: var(--text); font-weight: 600; }

.legal-doc code {
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--font-family-mono);
  font-size: 12px;
  color: var(--text);
}

.legal-table-wrap {
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.legal-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.55;
}

.legal-table-wrap th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.legal-table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

.legal-table-wrap tr:last-child td { border-bottom: none; }

.legal-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.legal-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.legal-doc .legal-card h2 { margin: 0 0 8px; font-size: 15px; }
.legal-doc .legal-card-note { margin-top: 10px; font-size: 11px; color: var(--text-faint); }

.legal-dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 16px;
  margin: 12px 0 0;
  font-size: 14px;
}

.legal-dl dt { color: var(--text-faint); }
.legal-dl dd { margin: 0; color: var(--text); }

/* ---------- Report form ---------- */
.report-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  width: 100%;
}

.form-note { font-size: 12px; color: var(--text-faint); }
.form-actions { display: flex; gap: 10px; }

.form-errors {
  padding: 12px 16px;
  border: 1px solid rgba(192, 112, 112, 0.5);
  border-radius: var(--radius-lg);
  background: rgba(192, 112, 112, 0.08);
  font-size: 13px;
  color: var(--text);
}

.form-errors ul { margin: 6px 0 0; padding-left: 18px; }

.form-success {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: var(--accent-weak);
  color: var(--text);
}

.legal-doc .form-success h2 { margin: 0 0 8px; font-size: 17px; }
.form-success .btn { margin-top: 14px; }

/* ---------- Account & privacy ---------- */
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.account-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.account-card h2 { font-size: 15px; }
.account-card .field { width: 100%; }
.account-card-wide { grid-column: 1 / -1; }

.account-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.account-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 12px;
  width: 100%;
  margin: 0;
  font-size: 13px;
}

.account-dl dt { color: var(--text-faint); }
.account-dl dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.account-id { font-size: 11px; color: var(--text-faint); }
.account-id code { font-family: var(--font-family-mono); color: var(--text-muted); overflow-wrap: anywhere; }

.account-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  width: 100%;
}

.account-select { cursor: pointer; }

.account-toast {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: var(--accent-weak);
  font-size: 13px;
  color: var(--text);
}

.danger-zone { border-color: rgba(192, 112, 112, 0.35); }

.decision-text {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  white-space: pre-wrap;
  font-family: var(--font-family-primary);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
}

.account-deleted { max-width: 560px; }
.account-legal { margin-top: 28px; font-size: 12px; }

/* ---------- Admin ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-table tr.selected td { background: var(--surface-2); }

.admin-location {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.input-with-button { display: flex; gap: 8px; }

.admin-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* Wide tables scroll sideways inside their card. Without these, a grid item grows to its widest table and the
   page cuts the cards off on a phone. */
.admin-grid > * { min-width: 0; }
.admin-grid .legal-table-wrap { align-self: stretch; max-width: 100%; }

/* ---------- Admin analytics ---------- */
.admin-page {
  /* Views and people are two steps of the accent's hue (people are a subset of views); both clear 3:1 on the card */
  --chart-views: #3F7395;
  --chart-people: var(--accent);
}

.admin-page .page-header { flex-wrap: wrap; }
.admin-range { margin-bottom: 0; }
.admin-range .chip.selected { border-color: var(--accent-border); background: var(--accent-weak); color: var(--text); }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.admin-stat {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.admin-stat-value { font-size: var(--font-size-2xl); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.admin-stat-label { font-size: 13px; color: var(--text); margin-top: 2px; }
.admin-stat-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.admin-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); }
.admin-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.admin-swatch.views { background: var(--chart-views); }
.admin-swatch.people { background: var(--chart-people); }

.admin-chart,
.admin-chart-axis,
.admin-details { align-self: stretch; }

.admin-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 140px;
  border-bottom: 1px solid var(--border-strong);
}
/* The whole column is the hover target, so a short bar is still easy to point at */
.admin-chart-day { position: relative; flex: 1 1 0; height: 100%; border-radius: 4px 4px 0 0; }
.admin-chart-day:hover { background: var(--accent-weak); }
.admin-bar { position: absolute; bottom: 0; border-radius: 4px 4px 0 0; }
.admin-bar.views { left: 0; right: 0; background: var(--chart-views); }
.admin-bar.people { left: 25%; right: 25%; background: var(--chart-people); }
.admin-chart-day:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}
.admin-chart-day:nth-child(-n+5):hover::after { left: 0; transform: none; }
.admin-chart-day:nth-last-child(-n+5):hover::after { left: auto; right: 0; transform: none; }
.admin-chart-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-muted); }

.admin-details summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.admin-details[open] summary { margin-bottom: 10px; }

.admin-note { font-size: 12px; }
.admin-muted { color: var(--text-muted); }
.admin-section-title { grid-column: 1 / -1; margin: 12px 0 0; font-size: var(--font-size-lg); }

.admin-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--text); }
.admin-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.admin-status.training::before { background: var(--success); }
.admin-status.slipping::before { background: var(--warning); }
.admin-status.dipped::before { background: var(--danger); }

@media (max-width: 768px) {
  .account-grid,
  .admin-grid { grid-template-columns: 1fr; }

  .legal-top-inner { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .legal-nav { order: 3; flex-basis: 100%; } /* own row under the brand (flex: 1 above would squeeze it into a column) */
  .legal-open-app { margin-left: auto; }
  .legal-body { padding: 32px 16px 56px; }
  .legal-table-wrap table { min-width: 640px; } /* readable columns; the table scrolls sideways instead */
  .legal-dl { grid-template-columns: 1fr; gap: 2px; }
  .legal-dl dd { margin-bottom: 10px; }
}
