/* Market Limits: Cap Track — page styles.
   Supplements the shared site-nav stylesheet and the Tailwind CDN config. */

:root {
  color-scheme: dark;
  --ml-accent: #00e676;
  --ml-bg: #071a14;
  --ml-panel: #0b261e;
  --ml-border: rgba(0, 230, 118, 0.16);
  --ml-border-strong: rgba(0, 230, 118, 0.34);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  background-color: var(--ml-bg);
  color: #e2e8f0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 100;
  background: var(--ml-accent);
  color: #071a14;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
  transition: top 0.12s ease;
}
.skip-link:focus { top: 0.75rem; }

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 2px solid #34d399;
  outline-offset: 2px;
  border-radius: 6px;
}

.hero-grad {
  background: linear-gradient(to right, #34d399, #a7f3d0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card-gradient {
  background: linear-gradient(145deg, #0b261e 0%, #071a14 100%);
  border: 1px solid var(--ml-border);
  border-radius: 1rem;
  padding: 1.25rem;
}
@media (min-width: 640px) {
  .card-gradient { padding: 1.5rem; }
}
.card-gradient:hover { border-color: var(--ml-border-strong); }

.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #34d399;
}

/* ------------------------------------------------------------------ chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(6, 78, 59, 0.8);
  background: rgba(11, 38, 30, 0.7);
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  white-space: nowrap;
}
.chip i { color: #34d399; }
.chip-demo {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(120, 53, 15, 0.25);
  color: #fde68a;
}
.chip-demo i { color: #fbbf24; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 0.4rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-demo { background: rgba(120, 53, 15, 0.35); color: #fcd34d; border-color: rgba(251, 191, 36, 0.35); }
.badge-confirmed { background: rgba(6, 78, 59, 0.55); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); }
.badge-projected { background: rgba(120, 53, 15, 0.3); color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); }
.badge-partial { background: rgba(120, 53, 15, 0.3); color: #fcd34d; border-color: rgba(251, 191, 36, 0.3); }
.badge-complete { background: rgba(6, 78, 59, 0.5); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.3); }
.badge-source { background: rgba(15, 56, 43, 0.9); color: #a7f3d0; border-color: rgba(0, 230, 118, 0.2); }

.banner-demo {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background: linear-gradient(145deg, rgba(69, 36, 7, 0.75) 0%, rgba(7, 26, 20, 0.9) 100%);
  border-radius: 1rem;
  padding: 1rem 1.15rem;
  color: #fef3c7;
}
.banner-demo > i { color: #fbbf24; font-size: 1.1rem; margin-top: 0.15rem; }
.banner-demo code {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 0.3rem;
  padding: 0.05rem 0.3rem;
  font-size: 0.78em;
  word-break: break-all;
}

/* ------------------------------------------------------------------ tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
  border-bottom: 1px solid rgba(6, 78, 59, 0.6);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #94a3b8;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  background: transparent;
}
.tab:hover { color: #e2e8f0; }
.tab[aria-selected="true"] {
  color: #34d399;
  border-bottom-color: var(--ml-accent);
}
.tab i { font-size: 0.85em; }

/* --------------------------------------------------------------- controls */
.ctl {
  width: 100%;
  background: #0b261e;
  border: 1px solid rgba(0, 230, 118, 0.18);
  border-radius: 0.6rem;
  color: #e2e8f0;
  font-size: 0.875rem;
  padding: 0.5rem 0.7rem;
  min-height: 2.4rem;
}
.ctl::placeholder { color: #64748b; }
.ctl:hover { border-color: rgba(0, 230, 118, 0.3); }
select.ctl { appearance: none; padding-right: 1.9rem; background-image: linear-gradient(45deg, transparent 50%, #34d399 50%), linear-gradient(135deg, #34d399 50%, transparent 50%); background-position: calc(100% - 1rem) 1.05rem, calc(100% - 0.7rem) 1.05rem; background-size: 0.3rem 0.3rem, 0.3rem 0.3rem; background-repeat: no-repeat; }
.ctl-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border: 1px solid transparent;
  min-height: 2.4rem;
}
.btn-primary { background: var(--ml-accent); color: #071a14; }
.btn-primary:hover { background: #34d399; }
.btn-ghost {
  border-color: rgba(0, 230, 118, 0.22);
  color: #a7f3d0;
  background: rgba(11, 38, 30, 0.6);
}
.btn-ghost:hover { border-color: rgba(0, 230, 118, 0.5); color: #fff; }
.btn-link {
  color: #34d399;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0;
  background: none;
  border: none;
}
.btn-link:hover { color: #a7f3d0; text-decoration: underline; }

/* --------------------------------------------------------------- metrics */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.metric-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.metric-label i { color: #34d399; }
.metric-value {
  margin-top: 0.5rem;
  font-size: 1.65rem;
  line-height: 1.15;
  font-weight: 800;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.metric-value.is-negative { color: #fca5a5; }
.metric-sub { margin-top: 0.45rem; font-size: 0.78rem; color: #94a3b8; line-height: 1.45; }
.metric-sub strong { color: #cbd5e1; font-weight: 600; }

/* ---------------------------------------------------------------- tables */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(6, 78, 59, 0.55);
  border-radius: 0.75rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.data-table caption { text-align: left; }
.data-table thead th {
  background: rgba(6, 78, 59, 0.28);
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0;
  border-bottom: 1px solid rgba(6, 78, 59, 0.7);
  white-space: nowrap;
}
.data-table thead th:not(:has(.sort-btn)) { padding: 0.55rem 0.6rem; }
.data-table tbody td,
.data-table tbody th {
  padding: 0.5rem 0.6rem;
  border-top: 1px solid rgba(6, 78, 59, 0.45);
  vertical-align: middle;
  text-align: left;
  white-space: nowrap;
}
.data-table tbody tr:hover > td,
.data-table tbody tr:hover > th { background: rgba(6, 78, 59, 0.16); }
.data-table .num { text-align: right; }
.data-table tbody .num { font-variant-numeric: tabular-nums; }
.data-table .source-cell { color: #94a3b8; font-size: 0.75rem; }
.data-table .src-date { display: block; margin-top: 0.15rem; color: #64748b; font-size: 0.68rem; }

.sort-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}
.sort-btn:hover { color: #e2e8f0; }
.sort-btn.num { justify-content: flex-end; }
.sort-ind { opacity: 0.35; font-size: 0.7rem; }
th[aria-sort="ascending"] .sort-ind,
th[aria-sort="descending"] .sort-ind { opacity: 1; color: var(--ml-accent); }
th[aria-sort="ascending"] .sort-btn,
th[aria-sort="descending"] .sort-btn { color: #a7f3d0; }

.team-link {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.15rem 0.55rem;
  text-align: left;
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0;
}
.team-link:hover .team-name { color: #34d399; text-decoration: underline; }
.team-abbr {
  grid-row: span 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.2rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(6, 78, 59, 0.55);
  border: 1px solid rgba(0, 230, 118, 0.16);
  color: #a7f3d0;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.team-div { grid-column: 2; font-size: 0.68rem; font-weight: 400; color: #64748b; }

.row-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
}
.row-toggle:hover { color: #34d399; }
.row-caret { font-size: 0.6rem; color: #34d399; transition: transform 0.12s ease; }
.row-caret.is-open { transform: rotate(90deg); }

.detail-row > td {
  background: rgba(6, 78, 59, 0.16);
  white-space: normal !important;
  padding: 0.9rem 1rem !important;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.55rem 1rem;
}
@media (min-width: 640px) { .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.detail-item { font-size: 0.78rem; color: #94a3b8; }
.detail-item dt { font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.64rem; }
.detail-item dd { margin: 0.1rem 0 0; color: #e2e8f0; }
.detail-note { grid-column: 1 / -1; }

.na { color: #64748b; font-style: italic; }
.pos { color: #6ee7b7; }
.neg { color: #fca5a5; }

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.875rem;
}
.empty-state strong { color: #e2e8f0; }

/* ------------------------------------------------------------------ misc */
.note {
  font-size: 0.78rem;
  line-height: 1.6;
  color: #94a3b8;
}
.note a { color: #34d399; text-decoration: underline; text-underline-offset: 2px; }
.note code {
  background: rgba(6, 78, 59, 0.4);
  border: 1px solid rgba(0, 230, 118, 0.14);
  border-radius: 0.3rem;
  padding: 0.05rem 0.3rem;
  font-size: 0.9em;
}
.divider { border-top: 1px solid rgba(6, 78, 59, 0.55); }
.section-title { font-size: 1.05rem; font-weight: 700; color: #f1f5f9; display: flex; align-items: center; gap: 0.5rem; }
.section-title i { color: #34d399; font-size: 0.9em; }
.section-sub { font-size: 0.8rem; color: #94a3b8; margin-top: 0.2rem; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 640px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .filter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.summary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  font-size: 0.8rem;
  color: #94a3b8;
}
.summary-line strong { color: #e2e8f0; font-weight: 700; }

.detail-hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 768px) { .detail-hero-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mini-card {
  border: 1px solid rgba(6, 78, 59, 0.7);
  background: rgba(6, 78, 59, 0.18);
  border-radius: 0.7rem;
  padding: 0.7rem 0.8rem;
}
.mini-label { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #94a3b8; }
.mini-value { font-size: 1.1rem; font-weight: 800; color: #f1f5f9; margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
.mini-sub { font-size: 0.7rem; color: #64748b; margin-top: 0.2rem; }

.def-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.def-table th, .def-table td { text-align: left; padding: 0.55rem 0.65rem; border-top: 1px solid rgba(6, 78, 59, 0.45); vertical-align: top; }
.def-table th { color: #a7f3d0; font-weight: 600; white-space: nowrap; }
.def-table td { color: #cbd5e1; }

.list-check { display: grid; gap: 0.55rem; }
.list-check li { display: flex; gap: 0.55rem; font-size: 0.82rem; color: #cbd5e1; line-height: 1.5; }
.list-check i { color: #34d399; margin-top: 0.25rem; font-size: 0.7rem; }
.list-check.is-warning i { color: #fbbf24; }

.skeleton-grid { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 1rem; }
@media (min-width: 640px) { .skeleton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .skeleton-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.skeleton {
  height: 6.5rem;
  border-radius: 1rem;
  border: 1px solid rgba(6, 78, 59, 0.6);
  background: linear-gradient(145deg, rgba(11, 38, 30, 0.8), rgba(7, 26, 20, 0.5));
}

.error-card { border-color: rgba(248, 113, 113, 0.4); }
.error-card h2 { color: #fecaca; }
.error-list { list-style: disc; padding-left: 1.2rem; font-size: 0.82rem; color: #fecaca; display: grid; gap: 0.3rem; }

/* Tables fit the panel on desktop; only narrow screens scroll horizontally. */
#teams-table tbody th { max-width: 15rem; }
#contracts-table tbody th, #fa-table tbody th { max-width: 14rem; }
.data-table tbody th .row-toggle span { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1023px) {
  .table-scroll > .data-table { min-width: 42rem; }
  #contracts-table { min-width: 56rem; }
  #fa-table { min-width: 50rem; }
}
