/* ROOVI area styles: tm (teammanager entrance: #/tm, #/tm/athlete/:id, #/tm/invite).
   Owned by the tm area owner. Uses the tokens and components from css/app.css; every selector is
   scoped under a class prefixed "tm-" so areas never collide. Mobile first (390px), no horizontal
   scroll, 44px tap targets. Colour is never the only signal: chips and rows carry icon and text. */

/* ----- shared bits ----- */
.tm-header { margin-bottom: var(--space-4); }
.tm-count { margin-bottom: var(--space-3); font-size: 14px; }
.tm-no-match { margin-bottom: var(--space-3); font-size: 14px; }
.tm-search { margin-bottom: var(--space-3); }

/* chips may wrap on a phone: the text carries the meaning (task title and when) */
.tm-chips { list-style: none; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 0; padding: 0; }
.tm-chips li { max-width: 100%; }
.tm-attn-chip { max-width: 100%; white-space: normal; text-align: left; line-height: 1.35; }
.tm-attn-chip svg { flex: none; }
.tm-role-chip { white-space: nowrap; }

/* ----- athlete cards (#/tm) ----- */
.tm-athlete-list { list-style: none; display: grid; gap: var(--space-3); margin: 0; padding: 0; }
.tm-athlete { margin: 0; min-width: 0; }
.tm-card { position: relative; display: flex; flex-direction: column; gap: var(--space-3); }
.tm-athlete .tm-card + .tm-card { margin-top: 0; }
.tm-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.tm-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.tm-card-id { min-width: 0; flex: 1 1 0; display: flex; flex-direction: column; gap: 2px; }
.tm-card-name { font-size: 18px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
/* the whole card is one tap target: the name link is stretched over it */
.tm-card-link { color: var(--text); }
.tm-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.tm-card-link:focus-visible { outline: none; }
.tm-card-link:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.tm-card-club { font-size: 15px; font-weight: 600; }
.tm-card-arrival { font-variant-numeric: tabular-nums; }
.tm-card-score { flex: none; }
.tm-card-score .ring-number { font-size: 17px; }
.tm-card-milestone, .tm-hero-milestone { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.4; }
.tm-card-milestone svg, .tm-hero-milestone svg { flex: none; margin-top: 2px; color: var(--accent); }
.tm-card-milestone.muted svg, .tm-hero-milestone.muted svg { color: var(--text-tertiary); }
.tm-card-attention { min-width: 0; }
.tm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 28px; }
.tm-card-chevron { display: inline-flex; color: var(--text-tertiary); }

/* ----- empty state ----- */
.tm-empty .empty { padding: var(--space-5) var(--space-2); }

/* ----- athlete detail (#/tm/athlete/:id) ----- */
.tm-hero { display: flex; align-items: center; gap: var(--space-4); }
.tm-hero-score { flex: none; }
.tm-hero-body { min-width: 0; flex: 1 1 0; display: flex; flex-direction: column; gap: 6px; }
.tm-hero-title { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.tm-hero-role { margin-top: 2px; }
.tm-sent:empty { display: none; }

.tm-calm-text { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--accent-strong); }
.tm-calm-text svg { flex: none; }
/* an athlete without a plan is neither calm nor in trouble: a neutral card with one chip */
.tm-not-started .chip { align-self: flex-start; }
.tm-attention-list { margin: 0; }
.tm-attention-item .list-item-body { gap: 4px; }
.tm-attention-item .chip { align-self: flex-start; margin-top: 2px; white-space: normal; }
.tm-attn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
}
.tm-attn-danger { background: var(--danger-bg); color: var(--danger); }
.tm-attn-warning { background: var(--warning-bg); color: var(--warning-text); }
.tm-attn-amber { background: var(--amber-tint); color: var(--amber-ink); }
.tm-attn-neutral { background: var(--surface-2); color: var(--text-secondary); }

/* progress per module, read only */
.tm-modules { display: flex; flex-direction: column; gap: var(--space-5); }
.tm-module { display: flex; flex-direction: column; gap: 6px; }
.tm-module-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.tm-module-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.tm-module-count { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-bar { display: block; height: 6px; overflow: hidden; border-radius: var(--radius-pill); background: var(--border); }
.tm-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.tm-module-card { padding: 0 var(--space-4); margin-top: var(--space-1); }
.tm-tasks { list-style: none; margin: 0; padding: 0; }
.tm-task {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.tm-task:last-child { border-bottom: 0; }
.tm-task-main { min-width: 0; flex: 1 1 180px; display: flex; flex-direction: column; gap: 2px; }
.tm-task-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.tm-task[data-status="completed"] .tm-task-title { color: var(--text-secondary); }
.tm-task-due { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; color: var(--text-secondary); }
.tm-task-due .countdown { font-weight: 600; }
.tm-task-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }


/* ----- send a reminder (sheet) ----- */
.tm-reminder-preview {
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tm-reminder-preview-label { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); }
.tm-reminder-preview-text { margin-top: 4px; font-size: 15px; overflow-wrap: anywhere; }
.tm-reminder-error { margin-top: 0; margin-bottom: var(--space-2); }
.tm-reminder-sheet .radio-group { margin-bottom: var(--space-4); }

/* ----- invite (#/tm/invite) ----- */
.tm-invite-form .btn-block { margin-top: var(--space-2); }
.tm-invite-error { margin: 0 0 var(--space-3); }
.tm-invites-section { margin-top: var(--space-6); }
.tm-invites-heading { margin-bottom: 10px; }
.tm-invites { list-style: none; display: grid; gap: var(--space-3); margin: 0; padding: 0; }
.tm-invite { margin: 0; min-width: 0; }
.tm-invite-card .field { margin-bottom: var(--space-3); }
.tm-invite-title { margin-bottom: 6px; }
.tm-invite-who { margin-bottom: var(--space-3); color: var(--text-secondary); }
.tm-invite-url .input { font-family: var(--mono); font-size: 13px; text-overflow: ellipsis; }

.tm-invite-expiry { display: flex; align-items: center; gap: 4px; margin-top: var(--space-3); font-weight: 600; }
.tm-invite-expiry svg { flex: none; }
/* the timeline's kind (milestone, planned, appointment) as one chip under the label */
.tm-timeline-kind { align-self: flex-start; margin-top: 4px; }

.tm-invite-privacy { display: flex; align-items: flex-start; gap: 6px; margin-top: var(--space-6); }
.tm-invite-privacy svg { flex: none; margin-top: 2px; }

@media (min-width: 640px) {
  .tm-card-name { font-size: 19px; }
  .tm-chips { flex-direction: row; flex-wrap: wrap; }
  .tm-module-card { padding: 0 var(--space-5); }
}
