/* Module: sections 07-10 of automation 07 (Meeting Notes to Action Tracker).
   #features (site features.css tiles), #dashboard (shared dashboard.css frame), #stack and
   #industries (shared features.css rows). Every rule is scoped under its section id; every
   class invented here starts with mt-. Tokens come from site.css. */

/* ---------- 07 / Features: every title reserves two lines, so each body starts on one line ---------- */

#features .features-tile .cell-t {
  max-width: 14ch;
  text-wrap: pretty;
}

/* Two-line title reserve only where tiles sit side by side (640px and up) */
@media (min-width: 640px) {
  #features .features-tile .cell-t {
    min-height: 2.3em;
  }
}

#features .features-tile .cell-p {
  text-wrap: pretty;
}

@media (min-width: 1280px) {
  #features .features-tile .cell-t {
    max-width: 20ch;
  }
}

/* ---------- 08 / Dashboard: avatars, window body, columns ---------- */

/* Person avatar: circle in the person's colour, initials at 0.46 x the size (set inline by the script) */
#dashboard .mt-av {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--av, var(--bone));
  color: #14120f;
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

#dashboard .mt-dash-body {
  display: block;
}

@media (min-width: 1280px) {
  #dashboard .mt-dash-body {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
  }
}

#dashboard .mt-dash-main {
  min-width: 0;
}

/* Labels and sub-lines wrap rather than truncate: the cards are narrow at 1280 and 390 */
#dashboard .mt-dash .dashboard-stat-l,
#dashboard .mt-dash .dashboard-stat-s {
  white-space: normal;
  text-overflow: clip;
}

#dashboard .mt-dash .dashboard-stat-l {
  text-wrap: balance;
}

#dashboard .mt-dash .dashboard-bar-title {
  white-space: normal;
  line-height: 1.4;
}

@media (max-width: 639px) {
  #dashboard .mt-dash .dashboard-bar {
    height: auto;
    min-height: 40px;
    padding-block: 10px;
  }

  #dashboard .mt-dash .dashboard-foot-sync {
    display: inline;
  }
}

#dashboard .mt-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

#dashboard .mt-block {
  min-width: 0;
}

#dashboard .mt-block + .mt-block,
#dashboard .mt-columns + .mt-block {
  border-top: 1px solid var(--line);
}

#dashboard .mt-block .dashboard-meta {
  white-space: normal;
  text-overflow: clip;
  text-align: right;
}

/* Phone: the caption goes under the heading, left-aligned */
@media (max-width: 639px) {
  #dashboard .mt-block .dashboard-toolbar {
    align-items: flex-start;
  }

  #dashboard .mt-block .dashboard-meta {
    text-align: left;
  }
}

@media (min-width: 1024px) {
  #dashboard .mt-columns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  #dashboard .mt-owners-block {
    border-right: 1px solid var(--line);
  }

  #dashboard .mt-columns + .mt-block {
    border-top: 1px solid var(--line);
  }
}

/* ---------- Open items by owner: stacked track per person ---------- */

#dashboard .mt-owners {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0 20px 8px;
  list-style: none;
}

#dashboard .mt-own {
  min-width: 0;
}

#dashboard .mt-own-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

#dashboard .mt-own-who {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#dashboard .mt-own-name {
  font-size: 15px;
  line-height: 1.3;
  color: var(--bone);
}

#dashboard .mt-own-n {
  flex: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#dashboard .mt-own-late--on {
  color: var(--danger);
}

#dashboard .mt-own-track {
  display: flex;
  height: 6px;
  margin-top: 10px;
  background: var(--line);
}

#dashboard .mt-own-seg {
  display: block;
  height: 100%;
  min-width: 0;
  transform-origin: left center;
}

#dashboard .mt-own-seg--on {
  background: hsl(42 30% 94% / 0.32);
}

#dashboard .mt-own-seg--late {
  background: var(--danger);
  opacity: 0.85;
}

#dashboard .mt-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  padding: 14px 20px 20px;
}

#dashboard .mt-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
}

#dashboard .mt-legend-item i {
  display: block;
  width: 12px;
  height: 6px;
}

#dashboard .mt-legend-item--on i {
  background: hsl(42 30% 94% / 0.32);
}

#dashboard .mt-legend-item--late i {
  background: var(--danger);
  opacity: 0.85;
}

/* ---------- Overdue now: task, owner and meeting, days pill, nudge ---------- */

#dashboard .mt-overdue {
  margin: 0;
  padding: 0 20px 12px;
  list-style: none;
}

#dashboard .mt-late {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

#dashboard .mt-late:first-child {
  border-top: 0;
}

#dashboard .mt-late-text {
  display: grid;
  gap: 6px;
  min-width: 0;
}

#dashboard .mt-late-task {
  font-size: 15px;
  line-height: 1.4;
  color: var(--bone);
  text-wrap: pretty;
}

#dashboard .mt-late-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
}

#dashboard .mt-late-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

#dashboard .mt-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px 2px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#dashboard .mt-pill--late {
  background: hsl(0 70% 56% / 0.14);
  border-color: hsl(0 70% 56% / 0.5);
  color: hsl(0 70% 72%);
}

#dashboard .mt-nudge {
  min-height: 34px;
  padding: 0.375rem 1rem;
  font-size: 14px;
  pointer-events: none;
}

@media (max-width: 639px) {
  #dashboard .mt-late {
    flex-direction: column;
    align-items: flex-start;
  }

  #dashboard .mt-late-side {
    justify-self: start;
  }
}

/* ---------- Meetings: title and date | counts | completion bar ---------- */

#dashboard .mt-meetings {
  margin: 0;
  padding: 0;
  list-style: none;
}

#dashboard .mt-meet-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(180px, 260px);
  align-items: center;
  gap: 10px 28px;
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
}

#dashboard .mt-meet-row:first-child {
  border-top: 0;
}

#dashboard .mt-meet-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

#dashboard .mt-meet-title {
  font-size: 15px;
  line-height: 1.3;
  color: var(--bone);
  text-wrap: pretty;
}

#dashboard .mt-meet-date {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ash);
}

#dashboard .mt-meet-counts {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--ash);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#dashboard .mt-meet-done {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#dashboard .mt-meet-track {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  height: 6px;
  background: var(--line);
}

#dashboard .mt-meet-fill {
  display: block;
  height: 100%;
  background: hsl(42 30% 94% / 0.4);
  transform-origin: left center;
}

#dashboard .mt-meet-row--hl .mt-meet-fill {
  background: var(--accent);
}

#dashboard .mt-meet-pct {
  flex: none;
  min-width: 3.2ch;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ash);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 639px) {
  /* Phone: title and date, then counts, then the bar on its own line */
  #dashboard .mt-meet-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 16px 16px;
  }

  #dashboard .mt-meet-counts {
    justify-self: start;
  }

  #dashboard .mt-meet-track {
    flex: 1 1 auto;
  }
}

/* Bars grow once when the window scrolls into view. The finished widths are already set by the
   script, so ?static=1, reduced motion and no-JS all show the finished state. */
#dashboard .mt-dash--play .mt-own-seg,
#dashboard .mt-dash--play .mt-meet-fill {
  animation: mt-grow 0.9s var(--ease-out) both;
  animation-delay: var(--d, 0s);
}

@keyframes mt-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  #dashboard .mt-dash--play .mt-own-seg,
  #dashboard .mt-dash--play .mt-meet-fill {
    animation: none;
  }
}

/* ---------- 09 / Stack: ten tools on hairlines ----------
   5 across from 1024, 2 across from 640, one row each below that (as 03's stack). */

#stack .mt-stack > * {
  min-width: 0;
  padding: 28px 22px;
  border-left: 0;
  border-top: 0;
}

#stack .mt-tool {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

#stack .mt-stack .features-glyph {
  margin-bottom: 24px;
}

#stack .mt-tool-text {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#stack .mt-tool-r {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ash);
  text-wrap: pretty;
}

#stack .mt-tool:hover .mt-tool-r {
  color: var(--bone-70);
}

#stack .mt-caption {
  margin-top: 24px;
}

@media (min-width: 1024px) {
  #stack .mt-stack {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  #stack .mt-stack > *:nth-child(5n + 2),
  #stack .mt-stack > *:nth-child(5n + 3),
  #stack .mt-stack > *:nth-child(5n + 4),
  #stack .mt-stack > *:nth-child(5n + 5) {
    border-left: 1px solid var(--line);
  }

  #stack .mt-stack > *:nth-child(n + 6) {
    border-top: 1px solid var(--line);
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  #stack .mt-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #stack .mt-stack > *:nth-child(2n) {
    border-left: 1px solid var(--line);
  }

  #stack .mt-stack > *:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 639px) {
  #stack .mt-stack {
    grid-template-columns: minmax(0, 1fr);
  }

  #stack .mt-stack > *:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  /* One tool per row: glyph on the left, name with its line of copy beside it */
  #stack .mt-stack > * {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
  }

  #stack .mt-stack .features-glyph {
    flex: none;
    margin: 2px 0 0;
  }
}

/* ---------- 10 / Built for: name and one line per row ---------- */

#industries .mt-ind-row {
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  padding: 24px 0;
}

#industries .mt-ind-text {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#industries .mt-ind-row .features-hex {
  margin-top: 8px;
}

#industries .mt-ind-line {
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ash);
  text-wrap: pretty;
}

@media (max-width: 767px) {
  #industries .mt-ind-row {
    min-height: 0;
    padding: 20px 0;
  }
}

/* ---------- Phones: a compact dashboard. Overdue rows use two columns (task, then the pill and the
   nudge on the right); the chrome title shortens below 480px; the nudge is a 44px target ---------- */

@media (max-width: 479px) {
  #dashboard .mt-t-x {
    display: none;
  }
}

@media (max-width: 639px) {
  #dashboard .mt-late {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
  }

  #dashboard .mt-late-side {
    justify-self: end;
    gap: 8px;
  }

  #dashboard .mt-late-task {
    font-size: 14.5px;
  }

  #dashboard .mt-nudge {
    min-height: 44px;
  }
}
