/* Weekly Tracking — spreadsheet-style KPI + conversion layout */

.wt-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.wt-week-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wt-week-display {
  display: flex;
  flex-direction: column;
  min-width: 8rem;
  padding: 0 0.5rem;
}

.wt-week-display strong {
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.wt-week-display .muted {
  font-size: 0.78rem;
}

.wt-week-picker {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font: inherit;
}

.wt-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wt-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
}

.wt-section-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.wt-section-hint {
  margin: 0 0 0.75rem;
}

.wt-body .wt-empty {
  padding: 2rem;
  text-align: center;
}

.wt-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.wt-link-count {
  font-size: 0.72rem;
  color: var(--muted);
}

.wt-body .wt-empty p {
  margin-bottom: 1rem;
}

/* Spreadsheet block (team total + expanded model) */
.wt-summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wt-summary-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.wt-summary-title {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.wt-model-sum-hint {
  margin: 0;
}

.wt-sheet {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}

.wt-sheet-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.wt-sheet-kpis--5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.wt-sheet-kpi {
  padding: 0.65rem 0.75rem;
  text-align: center;
  border-right: 1px solid var(--border);
  min-height: 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
}

.wt-sheet-kpi:last-child {
  border-right: 0;
}

.wt-sheet-kpi-label {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--muted);
}

.wt-sheet-kpi-val {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.wt-sheet-convs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wt-sheet-conv-col {
  padding: 0.55rem 0.65rem 0.7rem;
  text-align: center;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-height: 5.5rem;
}

.wt-sheet-conv-col:last-child {
  border-right: 0;
}

.wt-sheet-conv-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.wt-sheet-conv-nums {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.wt-sheet-conv-sep {
  margin: 0 0.2rem;
  opacity: 0.5;
}

.wt-sheet-conv-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.1rem;
}

.wt-sheet-conv-pct {
  font-size: 1.15rem;
  font-weight: 700;
  color: #4ade80;
  font-variant-numeric: tabular-nums;
}

.wt-sheet-conv-pct--inline {
  font-size: 0.85rem;
}

.wt-sheet-conv-prev {
  font-size: 0.68rem;
  color: var(--muted);
}

/* Compact model table */
.wt-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.wt-table--compact tbody td {
  padding: 0.45rem 0.65rem;
  vertical-align: middle;
}

.wt-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.wt-table th.wt-num,
.wt-table td.wt-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wt-table th.wt-actions-h,
.wt-table td.wt-actions-cell {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}

.wt-table tbody td {
  border-bottom: 1px solid var(--border);
}

.wt-compact-val .wt-cell-main {
  font-weight: 600;
  font-size: 0.95rem;
}

.wt-row td {
  background: var(--surface);
  transition: background 0.15s ease;
}

.wt-row:hover td {
  background: var(--surface-2);
}

.wt-row--expanded td {
  background: var(--surface-2);
}

.wt-cell-model {
  min-width: 12rem;
}

.wt-row-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}

.wt-row-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.wt-caret {
  color: var(--muted);
  font-size: 0.85rem;
  width: 0.9rem;
}

.wt-model-name {
  font-weight: 600;
}

.wt-model-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.wt-model-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.wt-extlink {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.wt-extlink:hover {
  text-decoration: underline;
}

.wt-paywall {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.08rem 0.4rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
}

.wt-paywall--of {
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.wt-paywall--fansly {
  color: #0369a1;
  background: rgba(31, 162, 241, 0.12);
  border-color: rgba(31, 162, 241, 0.35);
}

.wt-paywall:hover {
  text-decoration: underline;
}

.wt-paywall-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.wt-paywall-add .field {
  margin: 0;
  min-width: 10rem;
}

.wt-tag {
  display: inline-block;
  font-size: 0.62rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wt-tag--gms {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
}

.wt-tag--mixed {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.35);
}

.wt-tag--warn {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

.wt-delta {
  display: block;
  font-size: 0.68rem;
  margin-top: 0.15rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-weight: 500;
}

.wt-delta--up {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
}

.wt-delta--down {
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
}

.wt-delta--flat {
  color: var(--muted);
  background: var(--bg);
}

.wt-actions-cell .btn {
  margin-left: 0.2rem;
}

.wt-edit-kpis {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Breakdown / expand row */
.wt-breakdown-row td {
  background: var(--bg);
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.wt-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wt-breakdown-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.wt-breakdown-heading {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
}

.wt-breakdown-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.78rem;
}

.wt-breakdown-meta .wt-note {
  color: var(--text);
  background: var(--surface);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.wt-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.wt-breakdown-table th,
.wt-breakdown-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.wt-breakdown-table th.wt-num,
.wt-breakdown-table td.wt-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wt-breakdown-table tfoot td {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.wt-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.wt-table--manage {
  font-size: 0.85rem;
}

.wt-table--manage tbody tr:last-child td {
  border-bottom: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.wt-gms-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.wt-gms-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .wt-sheet-kpis,
  .wt-sheet-convs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wt-sheet-kpi:nth-child(2n),
  .wt-sheet-conv-col:nth-child(2n) {
    border-right: 0;
  }

  .wt-sheet-kpi:nth-child(-n + 2),
  .wt-sheet-conv-col:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  .row-2 {
    grid-template-columns: 1fr;
  }

  .wt-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .wt-week-nav {
    justify-content: space-between;
  }

  .wt-actions {
    justify-content: flex-end;
  }

  .wt-table--compact .wt-actions-cell .btn {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    font-size: 0.72rem;
  }
}
