/* ==========================================================================
   ELS Sales Kit — module "team" (Dashboard Tim)
   Every selector is scoped to .m-team (the #view while this module renders, and the sheets
   this module opens, which carry class "m-team"). Tokens only — no hard-coded colours.
   ========================================================================== */

/* ---------- Page rhythm ---------- */
.m-team .tm-body { margin-top: var(--space-4); min-width: 0; }
.m-team .tm-body > * + * { margin-top: var(--space-5); }
.m-team .tm-panel { margin-top: var(--space-4); min-width: 0; }
.m-team .tm-panel > * + * { margin-top: var(--space-5); }
.m-team .tm-note { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.m-team .tm-card .card-head { flex-wrap: wrap; row-gap: 8px; }
/* the head text keeps a readable width; a wide action (segmented control) wraps below instead */
.m-team .tm-card .card-head-text { min-width: min(100%, 170px); }
.m-team .tm-card .card-action { margin-left: auto; }

/* ---------- Hero: view tabs, person hero ---------- */
.m-team .tm-views { max-width: 520px; }
@media (max-width: 479.98px) {
  .m-team .tm-views .tab { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .m-team .tm-views .tab .ico { display: none; }
}
.m-team .page-hero-extra .tm-views { background: var(--surface-2); }
.m-team .tm-refresh.is-busy .ico { animation: tmSpin .9s linear infinite; }
@keyframes tmSpin { to { transform: rotate(360deg); } }
.m-team .tm-hero-avatar { width: 56px; height: 56px; font-size: 21px; }
@media (min-width: 720px) { .m-team .tm-hero-avatar { width: 64px; height: 64px; font-size: 24px; } }
.m-team .tm-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Pills (small status labels) ---------- */
.m-team .tm-pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 5px 11px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-glow);
  font-size: var(--fs-xs); font-weight: 750; line-height: 1.3;
}

/* ---------- Filters (period chips + branch) ---------- */
.m-team .tm-filters {
  margin-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); min-width: 0;
}
.m-team .tm-period {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, var(--bg) 12px, var(--bg) calc(100% - 16px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, var(--bg) 12px, var(--bg) calc(100% - 16px), transparent);
}
.m-team .tm-period::-webkit-scrollbar { display: none; }
.m-team .tm-period .chip { flex: none; }
.m-team .tm-branch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-team .tm-branch-ico { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--cyan-soft); color: var(--cyan-ink); }
.m-team .tm-branch .select-wrap { flex: 1; min-width: 0; }
.m-team .tm-branch .select { min-height: 44px; padding-top: 8px; padding-bottom: 8px; font-size: var(--fs-base); }
.m-team .tm-branch-chip { min-height: 36px; font-size: var(--fs-sm); }
.m-team .tm-filters-row { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
@media (min-width: 720px) {
  .m-team .tm-filters { flex-direction: row; align-items: center; justify-content: space-between; }
  .m-team .tm-period { margin: 0; padding: 2px; flex-wrap: wrap; overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .m-team .tm-branch { flex: none; width: 260px; }
  .m-team .tm-filters-cust { flex-direction: column; align-items: stretch; }
  .m-team .tm-filters-row { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------- Freshness stamp ---------- */
.m-team .tm-stamp { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: var(--fs-xs); font-weight: 650; padding: 0 2px; }
.m-team .tm-stamp .ico { flex: none; }
.m-team .tm-stamp-inline { color: var(--dim); font-size: var(--fs-xs); font-weight: 650; white-space: nowrap; }

/* ---------- Top row: omzet hero + chart ---------- */
.m-team .tm-top { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: stretch; }
@media (min-width: 1024px) { .m-team .tm-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); } }
.m-team .tm-omzet { display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-4); }
.m-team .tm-omzet .card-body { display: flex; flex-direction: column; gap: var(--space-4); height: 100%; }
.m-team .tm-omzet-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.m-team .tm-omzet-main { display: flex; align-items: center; gap: var(--space-4); }
.m-team .tm-omzet-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.m-team .tm-eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.m-team .tm-hero-amount {
  font-size: clamp(1.45rem, 1.1rem + 1.6vw, var(--fs-2xl)); font-weight: 800; letter-spacing: -.025em; line-height: 1.12;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.m-team .tm-omzet-sub { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.m-team .tm-omzet-status { margin-top: 6px; }
.m-team .tm-hero-ring { flex: none; }
.m-team .tm-hero-ring .ring-sublabel { text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.m-team .tm-ring-empty {
  flex: none; width: 108px; height: 108px; border-radius: 50%; padding: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 2px dashed var(--stroke-strong); color: var(--dim); font-size: var(--fs-xs); font-weight: 650; line-height: 1.2;
}
.m-team .tm-ring-empty .ico { color: var(--accent-ink); }
.m-team .tm-omzet-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.m-team .tm-mini {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--stroke);
}
.m-team .tm-mini-label { font-size: var(--fs-xs); font-weight: 750; color: var(--muted); }
.m-team .tm-mini-value { font-size: var(--fs-md); font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.m-team .tm-mini-sub { font-size: 11px; color: var(--dim); font-weight: 600; line-height: 1.3; }

.m-team .tm-chart-card { min-width: 0; }
.m-team .tm-chart-foot { display: flex; flex-direction: column; gap: 6px; margin-top: var(--space-3); }
.m-team .tm-mode .seg { min-height: 34px; padding: 0 12px; font-size: var(--fs-xs); }

/* ---------- KPI grid ---------- */
.m-team .tm-kpis { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .m-team .tm-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .m-team .tm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 720px) { .m-team .tm-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* labels such as "Pertanyaan terjawab" wrap to two lines instead of truncating at 360px */
.m-team .tm-kpis .kpi-label {
  white-space: normal; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.m-team .tm-kpis .kpi-value { font-size: clamp(1.15rem, 1rem + .8vw, var(--fs-xl)); }
.m-team .tm-kpis .kpi-sub { line-height: 1.35; }

/* ---------- Coaching signals ---------- */
.m-team .tm-sig-list { display: flex; flex-direction: column; gap: var(--space-2); }
.m-team .tm-sig {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: var(--space-2); width: 100%; text-align: left;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--stroke); color: var(--text); overflow: hidden;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.m-team .tm-sig:hover { border-color: var(--accent-glow); background: var(--accent-soft); }
.m-team .tm-sig:active { transform: scale(.995); }
.m-team .tm-sig-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.m-team .tm-sig-top { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.m-team .tm-sig-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
/* desktop: chips and action line up under the name */
@media (min-width: 720px) { .m-team .tm-sig-main { padding-left: calc(34px + var(--space-3)); } }
.m-team .tm-sig-head { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.m-team .tm-sig-branch { font-size: var(--fs-xs); color: var(--dim); font-weight: 650; }
.m-team .tm-sig-name { font-weight: 750; font-size: var(--fs-base); }
.m-team .tm-sig-sev {
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-ink);
}
.m-team .tm-sig-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.m-team .tm-sig-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; background: var(--accent-soft); color: var(--accent-ink);
}
.m-team .tm-sig-action { display: flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; }
.m-team .tm-sig-action .ico { flex: none; margin-top: 2px; color: var(--amber-ink); }
.m-team .tm-sig-chev { flex: none; color: var(--dim); }
.m-team .tm-sig-more { align-self: center; margin-top: 4px; }
.m-team .tm-sig-ok { display: flex; align-items: center; gap: var(--space-3); }
.m-team .tm-sig-ok-title { font-weight: 750; margin-bottom: 2px; }

/* ---------- Leaderboard ---------- */
.m-team .tm-lb .card-body { min-width: 0; }
.m-team .tm-sortbar {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--space-5) * -1) var(--space-3); padding: 2px var(--space-5);
}
.m-team .tm-sortbar::-webkit-scrollbar { display: none; }
.m-team .tm-sortbar .chip { flex: none; }

/* scroll shadows (background-attachment local/scroll) hint that the table scrolls sideways */
.m-team .tm-table-wrap {
  /* tall enough for a typical team (about 10–12 rows) without a nested vertical scroll on a laptop screen */
  position: relative; overflow: auto; max-height: max(420px, calc(100vh - 150px)); min-width: 0;
  border-radius: var(--radius); border: 1px solid var(--stroke);
  background:
    linear-gradient(270deg, var(--surface-solid) 40%, transparent) right center / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 100% 50%, var(--stroke-strong), transparent) right center / 16px 100% no-repeat scroll,
    var(--surface-solid);
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.m-team .tm-table td, .m-team .tm-table tbody th { background-clip: padding-box; }
.m-team .tm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.m-team .tm-table th, .m-team .tm-table td { padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--stroke); }
.m-team .tm-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-raised);
  font-size: var(--fs-xs); font-weight: 800; color: var(--muted); letter-spacing: .02em;
}
.m-team .tm-table tbody tr:last-child > * { border-bottom: 0; }
.m-team .tm-lb-table .tm-th-rank, .m-team .tm-lb-table .tm-td-rank {
  position: sticky; left: 0; z-index: 1; width: 52px; text-align: center; background: var(--surface-solid);
}
.m-team .tm-lb-table .tm-th-name, .m-team .tm-lb-table .tm-td-name {
  position: sticky; left: 52px; z-index: 1; background: var(--surface-solid); min-width: 190px;
  box-shadow: 1px 0 0 var(--stroke);
}
.m-team .tm-lb-table thead .tm-th-rank, .m-team .tm-lb-table thead .tm-th-name { z-index: 3; background: var(--surface-raised); }
.m-team .tm-lb-table .tm-td-name { font-weight: 400; }
.m-team .tm-th-num, .m-team .tm-td-num { text-align: right; }
.m-team .tm-sort {
  position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; margin: -4px -6px; border-radius: 8px;
  color: inherit; font: inherit; font-weight: 800; letter-spacing: inherit; white-space: nowrap;
}
.m-team .tm-sort:hover { color: var(--text); background: var(--surface-3); }
/* 44px tap height on touch tablets (the table shows from 720px) */
.m-team .tm-sort::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.m-team .tm-sort-ico { opacity: 0; transition: opacity var(--dur) var(--ease); }
.m-team .tm-sort:hover .tm-sort-ico { opacity: .6; }
.m-team .tm-th-num.is-sorted { color: var(--accent-ink); }
.m-team .tm-th-num.is-sorted .tm-sort-ico { opacity: 1; }
.m-team .tm-td-num.is-sorted { font-weight: 800; color: var(--text); background: var(--surface-2); }
.m-team .tm-td-num { color: var(--muted); font-weight: 650; }
.m-team .is-good { color: var(--green-ink) !important; }
.m-team .is-bad { color: var(--red-ink) !important; }
.m-team .tm-lb-row { cursor: pointer; transition: background-color var(--dur) var(--ease); }
.m-team .tm-lb-row:hover > * { background-color: var(--surface-3); }
.m-team .tm-lb-row:hover .tm-td-rank, .m-team .tm-lb-row:hover .tm-td-name { background: linear-gradient(var(--surface-3), var(--surface-3)), var(--surface-solid); }
.m-team .tm-lb-row.is-inactive { opacity: .6; }
.m-team .tm-name-btn {
  display: flex; align-items: center; min-width: 0; max-width: 100%; text-align: left; border-radius: 12px;
  padding: 2px 6px 2px 2px; margin: -2px -6px -2px -2px; color: inherit;
}
.m-team .tm-name-btn:hover .tm-person-name { color: var(--accent-ink); }

.m-team .tm-person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.m-team .tm-person-text { display: flex; flex-direction: column; min-width: 0; }
.m-team .tm-person-name { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.m-team .tm-person-sub { font-size: var(--fs-xs); color: var(--dim); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

.m-team .tm-rank {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 10px;
  background: var(--surface-3); color: var(--muted); font-size: var(--fs-xs); font-weight: 800; font-variant-numeric: tabular-nums;
}
.m-team .tm-medal {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 14px -6px var(--accent-glow), inset 0 1px 0 var(--inset-hi);
}
.m-team .tm-medal.c-amber { --accent-2: var(--amber); }
.m-team .tm-medal.c-slate { --accent-2: var(--slate); }
.m-team .tm-medal.c-pink { --accent-2: var(--pink); }
.m-team .tm-sync { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: var(--fs-xs); font-weight: 650; white-space: nowrap; }
.m-team .tm-sync.is-warn { color: var(--amber-ink); }

/* mobile cards */
.m-team .tm-lb-cards { display: flex; flex-direction: column; gap: var(--space-2); }
.m-team .tm-lb-card {
  display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; text-align: left; color: var(--text);
  padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--stroke);
  transition: border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.m-team .tm-lb-card:active { transform: scale(.99); }
.m-team .tm-lb-card.is-top { border-color: var(--amber-glow); background: linear-gradient(135deg, var(--amber-soft), transparent 60%), var(--surface-2); }
.m-team .tm-lb-card-rank { flex: none; width: 30px; min-height: 36px; display: grid; place-items: center; }
.m-team .tm-lb-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.m-team .tm-lb-card-main .tm-person { display: flex; }
.m-team .tm-lb-card-main .tm-person-name, .m-team .tm-lb-card-main .tm-person-sub { max-width: 100%; }
.m-team .tm-lb-card-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); padding-left: 46px; }
.m-team .tm-lb-card-extra { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding-bottom: 2px; }
.m-team .tm-lb-card.is-inactive { opacity: .6; }
.m-team .tm-lb-kv { display: inline-flex; gap: 4px; font-size: var(--fs-xs); color: var(--dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.m-team .tm-lb-kv strong { color: var(--muted); font-weight: 750; }
.m-team .tm-lb-card-val { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; max-width: 55%; text-align: right; }
.m-team .tm-lb-card-num { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.015em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.m-team .tm-lb-card-label { font-size: 10.5px; font-weight: 750; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Charts grid ---------- */
.m-team .tm-charts { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) {
  .m-team .tm-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-team .tm-charts > .tm-wide { grid-column: 1 / -1; }
}
.m-team .tm-charts > * { margin-top: 0 !important; }

/* category donut + legend */
.m-team .tm-cat { display: flex; flex-direction: column; gap: var(--space-4); align-items: stretch; }
@media (min-width: 560px) { .m-team .tm-cat { flex-direction: row; align-items: center; } .m-team .tm-cat .chart-donut { flex: none; width: 168px; } }
.m-team .tm-cat-list { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.m-team .tm-cat-row {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px;
  padding: 6px 0; font-size: var(--fs-sm); border-bottom: 1px dashed var(--stroke);
}
.m-team .tm-cat-row:last-child { border-bottom: 0; }
.m-team .tm-cat-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: 650; }
.m-team .tm-cat-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-team .tm-cat-name .ico { flex: none; color: var(--dim); }
.m-team .tm-cat-meta { color: var(--dim); font-size: var(--fs-xs); font-weight: 650; font-variant-numeric: tabular-nums; }
.m-team .tm-cat-amt { font-weight: 750; font-variant-numeric: tabular-nums; }
.m-team .tm-cat-pct { min-width: 38px; text-align: right; color: var(--muted); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; }

/* funnel */
.m-team .tm-funnel { display: flex; flex-direction: column; gap: var(--space-3); }
.m-team .tm-fun-row { display: flex; flex-direction: column; gap: 6px; }
.m-team .tm-fun-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); }
.m-team .tm-fun-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; min-width: 0; }
.m-team .tm-fun-label .ico { color: var(--accent-ink); flex: none; }
.m-team .tm-fun-val { display: inline-flex; align-items: baseline; gap: 8px; font-weight: 800; font-variant-numeric: tabular-nums; }
.m-team .tm-fun-pct { font-size: var(--fs-xs); font-weight: 700; color: var(--dim); }
.m-team .tm-fun-track { height: 12px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.m-team .tm-fun-bar {
  height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 12px -6px var(--accent-glow); transition: width var(--dur-slow) var(--ease);
}
.m-team .tm-fun-row.is-muted .tm-fun-bar { background: var(--slate); opacity: .55; box-shadow: none; }
.m-team .tm-fun-row.is-muted { padding-top: var(--space-2); border-top: 1px dashed var(--stroke); }

/* radar */
.m-team .tm-radar { display: flex; flex-direction: column; gap: var(--space-3); }
.m-team .tm-radar .legend { justify-content: center; }
.m-team .tm-radar-notes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* branch comparison */
.m-team .tm-branches { display: flex; flex-direction: column; gap: var(--space-4); }
.m-team .tm-branch-list { display: flex; flex-direction: column; gap: var(--space-2); }
.m-team .tm-branch-row {
  display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; color: var(--text);
  padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--stroke);
  transition: border-color var(--dur) var(--ease);
}
.m-team .tm-branch-row:hover { border-color: var(--accent-glow); }
.m-team .tm-branch-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.m-team .tm-branch-row-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; }
.m-team .tm-branch-row-name .ico { color: var(--cyan-ink); }
.m-team .tm-branch-row-meta { font-size: var(--fs-xs); color: var(--dim); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- States & skeleton ---------- */
.m-team .tm-state .empty { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.m-team .tm-state .btn-row { margin-top: var(--space-3); }
.m-team .tm-skeleton { display: flex; flex-direction: column; gap: var(--space-4); }
.m-team .tm-skel-row { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .m-team .tm-skel-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); } }
.m-team .tm-skel-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .m-team .tm-skel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.m-team .tm-skel-list { display: flex; flex-direction: column; gap: var(--space-2); }
.m-team .tm-skel {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--stroke);
}
.m-team .tm-skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--highlight), transparent);
  animation: tmShimmer 1.4s ease-in-out infinite;
}
@keyframes tmShimmer { 100% { transform: translateX(100%); } }
.m-team .tm-skel-hero { height: 230px; }
.m-team .tm-skel-chart { height: 230px; }
.m-team .tm-skel-kpi { height: 104px; }
.m-team .tm-skel-block { height: 280px; }
.m-team .tm-skel-tall { height: 420px; }
.m-team .tm-skel-line { height: 64px; border-radius: var(--radius); }
html.reduce-motion .m-team .tm-skel::after { animation: none; display: none; }
@media (prefers-reduced-motion: reduce) {
  .m-team .tm-skel::after { animation: none; display: none; }
  .m-team .tm-refresh.is-busy .ico { animation: none; }
}
html.reduce-motion .m-team .tm-refresh.is-busy .ico { animation: none; }
html.reduce-motion .m-team .tm-refresh.is-busy { opacity: .6; }

/* ---------- User page ---------- */
.m-team .tm-user-tabs { margin-top: var(--space-4); }
.m-team .tm-user-tabs .tabs { max-width: 100%; }
.m-team .tm-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-team .tm-fu-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .m-team .tm-fu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.m-team .tm-fu-grid > * { margin-top: 0 !important; }
.m-team .tm-fu.is-late .li-meta { color: var(--red-ink); }
.m-team .tm-toolbar { display: flex; flex-direction: column; gap: var(--space-3); }
.m-team .tm-status-chips .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.m-team .tm-status-chips .chips::-webkit-scrollbar { display: none; }
.m-team .tm-status-chips .chip { flex: none; }
.m-team .tm-count {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--surface-3); font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.m-team .chip.active .tm-count { background: var(--accent-soft); }

/* customer rows */
.m-team .tm-cust-list {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--highlight);
}
.m-team .tm-cust { display: flex; align-items: center; gap: var(--space-2); padding-right: var(--space-3); }
.m-team .tm-cust + .tm-cust { border-top: 1px solid var(--stroke); }
.m-team .tm-cust-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-3); text-align: left; color: var(--text);
  padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); min-height: 64px;
  transition: background-color var(--dur) var(--ease);
}
.m-team .tm-cust-open:hover { background: var(--surface-2); }
.m-team .tm-cust-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.m-team .tm-cust-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; overflow-wrap: anywhere; }
.m-team .tm-hot { color: var(--red-ink); display: inline-flex; }
.m-team .tm-cust-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.m-team .tm-cust-need { color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; }
.m-team .tm-cust-owner { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: var(--fs-xs); font-weight: 650; }
.m-team .tm-status {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; flex: none;
  font-size: 11px; font-weight: 800; background: var(--accent-soft); color: var(--accent-ink);
}
.m-team .tm-cust-acts { flex: none; display: flex; gap: 6px; }
.m-team .tm-result-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; padding: 0 2px; }

/* consultations & questions */
.m-team .tm-consult > * + * { margin-top: var(--space-3); }
.m-team .tm-questions > * + * { margin-top: var(--space-3); }
.m-team .tm-q-seg { max-width: 100%; }
.m-team .tm-q-list { display: flex; flex-direction: column; gap: var(--space-3); }
.m-team .tm-q {
  padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--highlight);
}
.m-team .tm-q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m-team .tm-q-tag { font-size: var(--fs-xs); color: var(--dim); font-weight: 700; }
.m-team .tm-q-date { margin-left: auto; font-size: var(--fs-xs); color: var(--dim); font-weight: 650; }
.m-team .tm-q-text { margin-top: var(--space-2); font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.m-team .tm-q-answer {
  display: flex; gap: 8px; margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius);
  background: var(--green-soft); color: var(--text); font-size: var(--fs-sm); line-height: 1.5;
}
.m-team .tm-q-answer > .ico { flex: none; color: var(--green-ink); margin-top: 2px; }
.m-team .tm-q-answer p { overflow-wrap: anywhere; }
.m-team .tm-q-answer-label { font-size: var(--fs-xs); font-weight: 800; color: var(--green-ink); margin-bottom: 2px; }

/* training (per user) */
.m-team .tm-user-training > * + * { margin-top: var(--space-5); }
.m-team .tm-mods { display: flex; flex-direction: column; gap: var(--space-2); }
.m-team .tm-mod {
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--stroke); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.m-team .tm-mod.is-ready { border-color: var(--green-glow); }
.m-team .tm-mod-sum {
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); cursor: pointer;
  list-style: none; min-height: 60px;
}
.m-team .tm-mod-sum::-webkit-details-marker { display: none; }
.m-team .tm-mod-sum:hover { background: var(--surface-2); }
.m-team .tm-mod-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.m-team .tm-mod-title { font-weight: 700; line-height: 1.35; }
.m-team .tm-mod-meta { font-size: var(--fs-xs); color: var(--dim); font-weight: 650; }
.m-team .tm-mod-chev { flex: none; color: var(--dim); transition: transform var(--dur) var(--ease); }
.m-team .tm-mod[open] .tm-mod-chev { transform: rotate(180deg); }
.m-team .tm-mod-body { padding: 0 var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.m-team .tm-items { list-style: none; display: flex; flex-direction: column; }
.m-team .tm-item { display: flex; align-items: flex-start; gap: var(--space-3); padding: 10px 0; border-top: 1px dashed var(--stroke); }
.m-team .tm-item:first-child { border-top: 0; }
.m-team .tm-item-ico { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); }
.m-team .tm-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); line-height: 1.45; }
.m-team .tm-item.is-done .tm-item-text > span:first-child { color: var(--muted); }
.m-team .tm-item-sub { font-size: var(--fs-xs); color: var(--dim); font-weight: 650; }
.m-team .tm-item.is-verify.is-pending .tm-item-sub { color: var(--amber-ink); }
.m-team .tm-item.is-verify.is-done .tm-item-sub { color: var(--green-ink); }
.m-team .tm-item .btn { flex: none; align-self: center; }

/* ---------- Training matrix ---------- */
.m-team .tm-ready-list { display: flex; flex-direction: column; gap: var(--space-3); }
.m-team .tm-ready { padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--stroke); }
.m-team .tm-ready-head { margin-bottom: var(--space-2); }
.m-team .tm-ready-mod + .tm-ready-mod { margin-top: var(--space-3); }
.m-team .tm-ready-mod-title { display: flex; align-items: center; gap: 6px; font-weight: 750; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 4px; }
.m-team .tm-ready-item { display: flex; align-items: center; gap: var(--space-3); padding: 8px 0; border-top: 1px dashed var(--stroke); }
.m-team .tm-ready-item:first-of-type { border-top: 0; }
.m-team .tm-ready-text { flex: 1; min-width: 0; font-size: var(--fs-sm); line-height: 1.45; }
.m-team .tm-ready-item .btn { flex: none; }

.m-team .tm-mx-keys { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: var(--space-3); font-size: var(--fs-xs); color: var(--muted); font-weight: 650; }
.m-team .tm-mx-key { display: inline-flex; align-items: center; gap: 6px; }
.m-team .tm-matrix th, .m-team .tm-matrix td { padding: 6px; border-bottom: 1px solid var(--stroke); }
.m-team .tm-matrix thead th { text-align: center; }
.m-team .tm-mx-corner, .m-team .tm-mx-name {
  position: sticky; left: 0; z-index: 1; background: var(--surface-solid); min-width: 170px; text-align: left !important;
  box-shadow: 1px 0 0 var(--stroke); padding-left: 12px !important; padding-right: 12px !important;
}
.m-team .tm-matrix thead .tm-mx-corner { z-index: 4; background: var(--surface-raised); vertical-align: bottom; }
.m-team .tm-mx-groups th { position: sticky; top: 0; }
.m-team .tm-mx-mods th { position: sticky; top: 33px; }
.m-team .tm-mx-group { color: var(--accent-ink) !important; border-left: 2px solid var(--surface-solid); text-align: center; }
.m-team .tm-mx-mod { min-width: 34px; color: var(--accent-ink) !important; font-variant-numeric: tabular-nums; cursor: help; }
.m-team .tm-mx-total-h, .m-team .tm-mx-total { text-align: right; padding-right: 12px !important; }
.m-team .tm-mx-total { font-variant-numeric: tabular-nums; color: var(--muted); }
.m-team .tm-mx-total strong { color: var(--text); font-weight: 800; }
.m-team .tm-mx-cell { text-align: center; cursor: pointer; }
.m-team .tm-cell {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; vertical-align: middle;
}
.m-team .tm-cell.is-done { background: var(--green); color: var(--on-green); box-shadow: 0 4px 10px -5px var(--green-glow); }
/* progress ring: a solid centre layered over a conic fill */
.m-team .tm-cell.is-progress {
  background:
    radial-gradient(circle, var(--surface-solid) 0 42%, transparent 44%),
    conic-gradient(var(--amber) calc(var(--p, 0) * 1%), var(--surface-3) 0);
}
.m-team .tm-cell.is-ready { background: var(--violet-soft); color: var(--violet-ink); box-shadow: inset 0 0 0 1.5px var(--violet); }
.m-team .tm-cell.is-fresh { width: 10px; height: 10px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--stroke-strong); }
.m-team .tm-matrix tbody tr:hover > * { background-color: var(--surface-3); }
.m-team .tm-matrix tbody tr:hover .tm-mx-name { background: linear-gradient(var(--surface-3), var(--surface-3)), var(--surface-solid); }
.m-team .tm-mx-legend { margin-top: var(--space-3); }
.m-team .tm-mx-legend summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: var(--fs-sm); font-weight: 700; color: var(--muted); padding: 6px 0; }
.m-team .tm-mx-legend-body { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); margin-top: var(--space-2); }
@media (min-width: 720px) { .m-team .tm-mx-legend-body { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.m-team .tm-mx-legend-title { font-weight: 750; font-size: var(--fs-sm); margin-bottom: 4px; }
.m-team .tm-mx-legend ol { padding-left: 1.4em; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; }

/* ---------- Sheets: customer detail ---------- */
.m-team .tm-cust-sheet { display: flex; flex-direction: column; gap: var(--space-4); }
.m-team .tm-cust-sheet-head { display: flex; align-items: center; gap: var(--space-3); }
.m-team .tm-cust-sheet-name { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere; margin-bottom: 4px; }
.m-team .tm-cust-phone { margin-top: 4px; color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.m-team .tm-contact { gap: 8px; }
.m-team .tm-owner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--stroke);
}
.m-team .tm-info-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m-team .tm-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-team .tm-info-label { font-size: var(--fs-xs); font-weight: 750; color: var(--dim); letter-spacing: .02em; }
.m-team .tm-info-value { font-weight: 650; overflow-wrap: anywhere; }
.m-team .tm-cust-notes p { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.m-team .tm-timeline-wrap { display: flex; flex-direction: column; gap: var(--space-2); }
.m-team .tm-timeline { list-style: none; position: relative; display: flex; flex-direction: column; gap: var(--space-3); padding-left: 2px; }
.m-team .tm-tl { position: relative; display: flex; gap: var(--space-3); }
.m-team .tm-tl:not(:last-child)::before {
  content: ""; position: absolute; left: 13px; top: 30px; bottom: calc(var(--space-3) * -1); width: 2px; background: var(--stroke);
}
.m-team .tm-tl-dot {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue-ink);
}
.m-team .tm-tl.is-done .tm-tl-dot { background: var(--green-soft); color: var(--green-ink); }
.m-team .tm-tl.is-late .tm-tl-dot { background: var(--red-soft); color: var(--red-ink); }
.m-team .tm-tl-body { flex: 1; min-width: 0; padding-top: 3px; }
.m-team .tm-tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: var(--fs-sm); }
.m-team .tm-tl-date { font-size: var(--fs-xs); color: var(--dim); font-weight: 650; }
.m-team .tm-tl-note { margin-top: 2px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; overflow-wrap: anywhere; }
.m-team .tm-tl-state { margin-top: 2px; font-size: var(--fs-xs); font-weight: 750; color: var(--blue-ink); }
.m-team .tm-tl.is-done .tm-tl-state { color: var(--green-ink); }
.m-team .tm-tl.is-late .tm-tl-state { color: var(--red-ink); }

/* ---------- Sheets: period & export ---------- */
.m-team .tm-range { display: flex; flex-direction: column; gap: var(--space-4); }
.m-team .tm-range-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.m-team .tm-export { display: flex; flex-direction: column; gap: var(--space-4); }
.m-team .tm-export-list { display: flex; flex-direction: column; gap: var(--space-2); }
.m-team .tm-export-opt {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left; color: var(--text);
  padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--stroke);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.m-team .tm-export-opt:hover { border-color: var(--stroke-strong); }
.m-team .tm-export-opt.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.m-team .tm-export-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.m-team .tm-export-label { font-weight: 750; }
.m-team .tm-export-desc { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; }
.m-team .tm-export-radio {
  flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--stroke-strong);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.m-team .tm-export-opt.is-on .tm-export-radio { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface-solid), inset 0 0 0 10px var(--accent); }

@media (max-width: 719.98px) {
  /* filter chip rows scroll sideways instead of wrapping into several lines */
  .m-team .tm-filters-row > .chips {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter);
  }
  .m-team .tm-filters-row > .chips::-webkit-scrollbar { display: none; }
  .m-team .tm-filters-row > .chips .chip { flex: none; }
  /* narrow sticky name column in the matrix so module columns stay visible */
  .m-team .tm-mx-corner, .m-team .tm-mx-name { min-width: 118px; max-width: 132px; }
  .m-team .tm-mx-name .tm-person-sub { display: none; }
  .m-team .tm-mx-name .tm-person-name { max-width: 78px; }
  .m-team .tm-mx-name .tm-person { gap: 8px; }
}

@media (max-width: 380px) {
  .m-team .tm-omzet-main { gap: var(--space-3); }
  .m-team .tm-hero-ring { transform: scale(.92); transform-origin: right center; }
  .m-team .tm-omzet-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-team .tm-omzet-stats .tm-mini:last-child { grid-column: 1 / -1; }
}

/* ---------- UX review (2026-10-12): phone-first refinements ---------- */
/* the daily overview: numbers first, the explanatory subtitle only where there is room */
@media (max-width: 479.98px) { .m-team .tm-hero-overview .page-hero-sub { display: none; } }
/* user tabs: the overdue follow-up count is an alert, not a customer count */
.m-team .tm-tabs .tab[data-alert] .tab-count { background: var(--red-soft); color: var(--red-ink); }
/* an odd last KPI tile spans the row on phones instead of leaving a hole */
@media (max-width: 719.98px) { .m-team .tm-kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; } }
/* module rows: badge + meta under the title */
.m-team .tm-mod-metarow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; }
/* follow-up lists: long notes stay two lines; "Tampilkan semua" under the list */
.m-team .tm-fu .li-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-team .tm-fu-list { display: flex; flex-direction: column; }
.m-team .tm-fu-more { align-self: center; margin-top: var(--space-2); }
/* training matrix: compact "Andi S." label on phones, full name + branch on wider screens */
.m-team .tm-mx-short { display: none; font-weight: 700; color: var(--text); white-space: nowrap; }
@media (max-width: 719.98px) {
  .m-team .tm-mx-name .tm-person-text { display: none; }
  .m-team .tm-mx-short { display: inline; margin-left: 8px; }
  .m-team .tm-mx-corner, .m-team .tm-mx-name { min-width: 104px; max-width: 120px; }
}
/* verify rows: on narrow screens the item text gets the full width and the button sits below it */
@media (max-width: 559.98px) {
  .m-team .tm-ready-item { flex-direction: column; align-items: stretch; gap: var(--space-2); }
  .m-team .tm-ready-item .btn { align-self: flex-end; }
  .m-team .tm-item.is-verify { flex-wrap: wrap; }
  .m-team .tm-item.is-verify .tm-item-text { flex-basis: calc(100% - 28px - var(--space-3)); }
  .m-team .tm-item.is-verify .btn { margin-left: calc(28px + var(--space-3)); align-self: flex-start; }
}
/* leaderboard cards: a stale-sync warning wraps instead of running under the value */
.m-team .tm-lb-card-extra .tm-sync { white-space: normal; }
.m-team .tm-user-summary > * + *, .m-team .tm-user-cust > * + * { margin-top: var(--space-5); }
/* 44px tap targets for the compact matrix name buttons and the "Daftar modul" toggle */
.m-team .tm-mx-name .tm-name-btn { position: relative; }
.m-team .tm-mx-name .tm-name-btn::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.m-team .tm-mx-legend summary { min-height: 44px; }
