/* Tactivela · modules/sessions — scope: .ss (screens + sheets) and .ssp (printed plan).
   App bars, tabs, cards, stats, RPE scale, segments and swatches are design-system components. */
.ss .ss-team-lbl { margin: 0; }
.ss .ss-team { min-height: 40px; flex: 1; }
.ss .ss-pad { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px calc(96px + var(--tk-safe-bottom)); }
.ss .ss-btns { display: flex; justify-content: center; }   /* No Football Team Yet: Add Team */
/* Contents of the control bar and the tabs (a .tk-column, so they centre on larger screens while the bars run edge to edge). */
.ss .ss-bar { display: flex; align-items: center; gap: var(--tk-space-2); }

/* session cards */
.ss .ss-card { display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: border-color var(--tk-dur) var(--tk-ease); }
.ss .ss-card:hover { border-color: var(--tk-violet); }
.ss .ss-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ss .ss-date { font-size: var(--tk-fs-meta); color: var(--tk-text-muted); }
.ss .ss-focus { overflow: hidden; text-overflow: ellipsis; }
.ss .ss-meta { font-size: var(--tk-fs-meta); color: var(--tk-text-subtle); }
.ss .ss-card-act { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* session sheet */
.ss .ss-keep, .ss .ss-keep-all { margin: 0; }
.ss .ss-type-f { width: 132px; flex: none; }
.ss .ss-mins { width: 96px; flex: none; }
/* The club platform's editor (planEditor, club mode): the privacy hint, a refused save's sentence; Copy to Club makes a
   fourth button, so the sheet's buttons wrap when they do not fit */
.ss .ss-hint, .ss .ss-err { margin: 0; }
.ss .ss-err { color: var(--tk-bad-text); font-size: var(--tk-fs-body-s); line-height: 1.45; }
.ss .tk-sheet__actions { flex-wrap: wrap; }
.ss .tk-sheet__actions.ss-acts4 > .tk-btn { flex: 1 1 40%; }
.ss.ss-club .ss-kinds .tk-chip { min-height: var(--tk-touch); }   /* the club's screens keep every target at 44px */
.ss .ss-acts-head { display: flex; align-items: baseline; justify-content: space-between; }
.ss .ss-acts-head .tk-section-label { margin: 0; }
.ss .ss-sum { font-size: var(--tk-fs-meta); color: var(--tk-text-muted); }
.ss .ss-sum.over { color: var(--tk-bad-text); }
.ss .ss-sum.exact { color: var(--tk-ok); }
.ss .ss-actrow { gap: 8px; padding-right: 4px; }
.ss .ss-act-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 0; border: 0; background: none; color: inherit; cursor: pointer; text-align: left; }
.ss .ss-act-main .tk-row__name { max-width: 100%; font-size: 16px; }
.ss .ss-act-mt { font-size: var(--tk-fs-meta); color: var(--tk-text-subtle); }
.ss .ss-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.ss .ss-kinds .tk-chip { font-size: 14px; min-height: 36px; }

/* activity editor (full screen) */
.ss .ss-editor { display: flex; flex-direction: column; gap: 12px; padding: 12px 12px calc(28px + var(--tk-safe-bottom)); }
/* The editor body: the diagram group (.ss-ed-dia, with the drawing in .ss-ed-draw) then the notes group (.ss-ed-txt: the
   notes in .ss-notes, then Save). Stacked here; held sideways and on a PC the drawing fills the height beside a tools
   column (below). */
.ss .ss-ed, .ss .ss-ed-dia, .ss .ss-ed-draw, .ss .ss-ed-txt, .ss .ss-notes { display: flex; flex-direction: column; gap: var(--tk-space-3); }
.ss .ss-notes-h { display: none; }                      /* the "Notes" heading shows only where the notes sit beside the drawing */
.ss .ss-dia { width: 100%; aspect-ratio: 100 / 70; border: var(--tk-border) solid var(--tk-line); border-radius: var(--tk-radius); overflow: hidden; touch-action: none; flex-shrink: 0; }
.ss .ss-dia .di { cursor: pointer; }
.ss .ss-statusbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ss .ss-status { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px; font-family: var(--tk-font-display); font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tk-text-muted); }
.ss .ss-status b { color: var(--tk-now); font-weight: 800; }
.ss .ss-swatches { gap: 6px; }
/* The tools (design system 0.6, 7.2): no tiles, a 30px icon with its name underneath, the chosen tool in --tk-now
   with a touchline bar under its name. */
.ss .ss-kit-tools { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); row-gap: 4px; column-gap: 2px; }
.ss .ss-kit-tools button { min-height: var(--tk-touch); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; padding: 4px 0 7px; cursor: pointer;
  background: none; border: 0; border-radius: var(--tk-radius); color: var(--tk-text-muted); overflow-wrap: anywhere;
  font-family: var(--tk-font-display); font-size: var(--tk-fs-micro); font-weight: 600; line-height: 1.1; letter-spacing: 0.02em; text-align: center; }
.ss .ss-kit-tools .tk-icon { width: var(--tk-icon-tool); height: var(--tk-icon-tool); stroke-width: var(--tk-icon-stroke); flex-shrink: 0; }
.ss .ss-kit-tools button:hover { color: var(--tk-text); }
.ss .ss-kit-tools button[aria-pressed="true"] { color: var(--tk-now); font-weight: 800;
  background: linear-gradient(var(--tk-touchline), var(--tk-touchline)) center bottom / 18px 3px no-repeat; }
.ss .ss-kit-tools button:disabled { opacity: 0.35; cursor: not-allowed; }
.ss .ss-clear { align-self: flex-start; }
/* Equipment for this activity (design system 0.6, 7.2): each token at 34px above its count and name, no green tile. */
.ss .ss-equips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 10px 4px 8px; background: var(--tk-card); border-radius: var(--tk-radius); }
.ss .ss-equips:empty { display: none; }
.ss .ss-equip { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; color: var(--tk-text-muted);
  font-family: var(--tk-font-body); font-size: var(--tk-fs-label); font-weight: 600; line-height: 1.15; }
.ss .ss-equip .tk-token, .ss .ss-equip > .tk-icon { width: var(--tk-token-list); height: var(--tk-token-list); flex-shrink: 0; }

/* ── Larger screens (design system 6.6): tablets from 700px, PCs from 1100px. The phone rules above are untouched.
   The list, the load table, the editor body, the control bar and the tabs carry .tk-column in the markup, so they
   already sit in a centred 720px column; these rules add what the column alone cannot. ── */
@media (min-width: 700px) {
  .ss .tk-fab { right: max(calc(var(--tk-space-4) + var(--tk-safe-right)), calc(50% - var(--tk-column) / 2 + var(--tk-space-4))); }   /* by the column, clear of the notch */
  .ss .ss-kit-tools { grid-template-columns: repeat(12, minmax(0, 1fr)); }                                 /* 25 tools: two rows of 12, then one */
  .ss .ss-card-act .tk-btn, .ss .ss-clear { min-height: var(--tk-touch); }   /* small buttons outside a control bar still get a 44px target */
  .ss .ss-kinds .tk-chip, .ss .ss-team { min-height: var(--tk-touch); }   /* the phone rules above set 36px and 40px */
  .ss .ss-swatches .tk-swatch { width: var(--tk-touch); height: var(--tk-touch); }   /* as tactics.css and settings.css do */
}
@media (min-width: 1100px) {
  /* The list uses the wide column on a PC, so what sits in the control bar widens with it. */
  .ss .ss-bar { max-width: var(--tk-column-wide); }
  /* Session cards: a two-column grid inside the wide column. Empty state spans both; card buttons sit on the same line. */
  .ss .ss-cards { max-width: var(--tk-column-wide); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tk-space-3); }
  .ss .ss-cards > .tk-empty, .ss .ss-cards > .ss-keep-all { grid-column: 1 / -1; }
  .ss .ss-cards .ss-card-act { margin-top: auto; padding-top: var(--tk-space-1); }
  .ss .tk-fab { right: max(calc(var(--tk-space-4) + var(--tk-safe-right)), calc(50% - var(--tk-column-wide) / 2 + var(--tk-space-4))); }   /* by the wide column */
  /* The activity editor on a PC: the block below (the pitch screens' shared rule includes 1100px and up). */
}

/* ── Activity editor held sideways, and on a PC (design system 6.6 and 9.4) ────────────────────────────
   The pitch screens' shared rule (Formation builder, Tactics board): 1100px and up, or 700px and up held
   sideways. Tablet and phone held upright keep the stacked editor above. The editor body is one grid (its
   groups .ss-ed-dia, .ss-ed-draw and .ss-ed-txt step aside with display: contents): the diagram as large as
   fits on the left, and a column beside it (--tk-side-w, like the Tactics tools and the Formation bench)
   with the Area / Half pitch / Full pitch switch, the colours, all 25 tools, the current tool's hint, Clear
   and then the four writing boxes under "Notes", so the diagram, every tool and the notes sit side by side.
   The diagram takes the full height wherever the width beside the tools column allows (a phone held
   sideways, a 16:9 PC window); a tablet held sideways runs out of width first. A column taller than the
   diagram simply scrolls. Name, minutes, the equipment and Save follow below the drawing, in the markup's
   order, in a centred reading column (they are auto-placed, so a hidden equipment list leaves no gap).
   The editor's scroll box is a size container, so 100cqh is the height the drawing may use (the screen
   below the app bar, less the padding) and the diagram's column is capped at that height's 10:7 width.
   Every area type (Area, Half pitch, Full pitch) is the same 100 x 70 grid, so all of them fit. A turn
   of the screen re-fits the diagram through CSS alone: the SVG scales with its box, and diaPt() in
   sessions.js reads the diagram's position afresh on every pointer event. DOM order stays as written:
   the grid only places things (focus: name, minutes, switch, colours, tools, Clear, the notes, Save), so
   here the name and minutes come first to the keyboard but show below the drawing. An accepted
   trade-off, recorded in design system 9.4: the phone's order (name first) is the one the markup keeps. */
@media (min-width: 1100px), (min-width: 700px) and (orientation: landscape) {
  .ss .ss-editor { container-type: size; padding: var(--tk-space-3) var(--tk-space-4) calc(var(--tk-space-3) + var(--tk-safe-bottom)); }
  /* The diagram's column (capped by the height; the first value is for a browser without cq units) and the tools column. */
  .ss .ss-ed { max-width: none; display: grid; justify-content: center; column-gap: var(--tk-space-4); row-gap: var(--tk-space-3);
    padding-bottom: var(--tk-space-4);                                                                     /* room after Save when scrolled to the end */
    grid-template-columns: minmax(0, 1fr) var(--tk-side-w);
    grid-template-columns: minmax(0, calc(100cqh * 10 / 7)) var(--tk-side-w);
    grid-template-rows: repeat(6, auto) minmax(0, 1fr);
    grid-template-areas: "dia seg" "dia sw" "dia tools" "dia status" "dia clear" "dia notes" "dia ."; }
  .ss .ss-ed-dia, .ss .ss-ed-draw, .ss .ss-ed-txt, .ss .ss-statusbar { display: contents; }   /* their parts become the grid's */
  .ss .ss-ed-draw > .ss-dia { grid-area: dia; width: 100%; align-self: start; }
  .ss .ss-ed-draw > .tk-seg { grid-area: seg; }
  .ss .ss-ed-draw .ss-status { grid-area: status; min-width: 0; }
  .ss .ss-ed-draw .ss-swatches { grid-area: sw; justify-content: space-between; }
  .ss .ss-ed-draw > .ss-kit-tools { grid-area: tools; grid-template-columns: repeat(6, minmax(0, 1fr)); }   /* 25 tools, six to a row */
  .ss .ss-ed-draw > .ss-clear { grid-area: clear; justify-self: start; }
  .ss .ss-notes { grid-area: notes; }
  .ss .ss-notes-h { display: block; }
  .ss .ss-ed-dia > :not(.ss-ed-draw), .ss .ss-ed-txt > .tk-btn { grid-column: 1 / -1; justify-self: center; width: 100%; max-width: var(--tk-column); }
}
/* A phone held sideways (the short-landscape rule): about 340px under the one-line app bar. The switch and a short
   "Clear" share the top row and the gaps tighten, so the diagram (the full height) and the switch, colours, every
   tool and the hint fit without scrolling. The shorter the screen, the narrower the full-height diagram, so the
   tools column takes the width it leaves (at least --tk-side-w) and the 44px tools flow into it, more to a row
   (six at 844 x 390, eight at 844 x 340): at 844px wide every tool stays on screen down to about 300px tall (a
   mobile browser's own bar takes some of a phone's 390px). The hint, the last row, drops below the fold first
   at some of those heights. A narrower short screen (740 x 330) can still lose the last row of tools, which
   then scrolls. Clear keeps its full name for screen readers and as its tooltip. The column is full of tools
   here, so the notes stay below the drawing, after the equipment, with no heading, as on a phone held upright. */
@media (min-width: 700px) and (max-height: 500px) {
  .ss .ss-editor { --ss-clear-w: calc(var(--tk-touch) + var(--tk-space-5));                              /* 64px: room for "Clear" */
    padding: var(--tk-space-2) var(--tk-space-3) max(var(--tk-space-2), var(--tk-safe-bottom)); }
  /* No spare row here: the diagram spans the four rows, so any height it has beyond them spreads evenly between them. */
  .ss .ss-ed { column-gap: var(--tk-space-3); row-gap: var(--tk-space-1);
    grid-template-columns: minmax(0, calc(100cqh * 10 / 7)) minmax(var(--tk-side-w), 1fr);
    grid-template-rows: repeat(4, auto); grid-template-areas: "dia seg" "dia sw" "dia tools" "dia status"; }
  .ss .ss-ed-draw > .ss-kit-tools { grid-template-columns: repeat(auto-fill, minmax(var(--tk-touch), 1fr)); }   /* as many to a row as fit */
  /* Here the names under the tools would push the last rows below the fold: icons only, in their 44px targets. The
     hint names the chosen tool, and each tool keeps its name for screen readers and as its tooltip. */
  .ss .ss-ed-draw > .ss-kit-tools button { justify-content: center; padding: 0; }
  .ss .ss-ed-draw .ss-tool-n { display: none; }
  .ss .ss-ed-draw > :not(.ss-dia), .ss .ss-ed-draw .ss-status, .ss .ss-ed-draw .ss-swatches { align-self: center; }
  .ss .ss-ed-draw > .tk-seg { grid-auto-columns: auto; margin-right: calc(var(--ss-clear-w) + var(--tk-space-2)); }   /* each label its own width */
  .ss .ss-ed-draw > .tk-seg > button { padding-inline: var(--tk-space-1); }
  .ss .ss-ed-draw > .ss-clear { grid-area: seg; justify-self: end; width: var(--ss-clear-w); padding-inline: 0; }
  .ss .ss-clear-more { display: none; }
  .ss .ss-notes { grid-area: auto; grid-column: 1 / -1; justify-self: center; width: 100%; max-width: var(--tk-column); }
  .ss .ss-notes-h { display: none; }
  /* Below the drawing the usual 12px gap returns. */
  .ss .ss-ed-dia > :not(.ss-ed-draw), .ss .ss-notes, .ss .ss-ed-txt > .tk-btn { margin-top: var(--tk-space-2); }
}

/* ── printed session plan (A4, day kit; #ps-page gets class "ssp") ── */
.ssp { width: 210mm; min-height: 297mm; box-sizing: border-box; padding: 12mm; position: relative;
  background: var(--tk-bg); color: var(--tk-text); font-family: var(--tk-font-body); font-size: 12pt; }
.ssp .sp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; padding-bottom: 3mm; margin-bottom: 5mm; border-bottom: 1.2mm solid var(--tk-touchline); }
.ssp .sp-club { font-family: var(--tk-font-display); font-size: 10pt; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tk-violet-soft); }
.ssp .sp-title { margin: 0; font-family: var(--tk-font-display); font-size: 26pt; font-weight: 900; line-height: 1; text-transform: uppercase; }
.ssp .sp-meta { text-align: right; font-size: 11pt; color: var(--tk-text-muted); line-height: 1.45; }
.ssp .sp-obj { border-left: 1.2mm solid var(--tk-touchline); background: var(--tk-card); border-radius: 0 var(--tk-radius) var(--tk-radius) 0; padding: 3mm 4mm; margin-bottom: 5mm; }
.ssp .sp-obj span { font-family: var(--tk-font-display); font-size: 10pt; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tk-violet-soft); }
.ssp .sp-obj p { margin: 1mm 0 0; line-height: 1.45; }
.ssp .sp-act { border: 0.4mm solid var(--tk-line); border-radius: var(--tk-radius); overflow: hidden; margin-bottom: 5mm; break-inside: avoid; page-break-inside: avoid; }
.ssp .sp-act-t { display: flex; justify-content: space-between; align-items: baseline; background: var(--tk-purple-deep); color: var(--tk-on-accent); padding: 2mm 4mm;
  font-family: var(--tk-font-display); font-size: 15pt; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.ssp .sp-min { color: var(--tk-touchline); font-size: 12pt; }
.ssp .sp-cols { display: flex; align-items: flex-start; gap: 5mm; padding: 4mm; }
.ssp .sp-dia { flex: 0 0 46%; }
.ssp .sp-dia svg { width: 100%; height: auto !important; aspect-ratio: 100 / 70; border-radius: var(--tk-radius-sm); }
.ssp .sp-eq { margin-top: 2mm; font-family: var(--tk-font-display); font-size: 10pt; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tk-text-muted); }
.ssp .sp-txt { flex: 1; min-width: 0; }
.ssp .sp-h { font-family: var(--tk-font-display); font-size: 10pt; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tk-violet-soft); margin-top: 3mm; }
.ssp .sp-h:first-child { margin-top: 0; }
.ssp .sp-b { font-size: 12pt; line-height: 1.4; }
/* Ruled lines to write on, for an activity with nothing written (as tall as the diagram beside them, about). */
.ssp .sp-lines > div { height: 7.5mm; border-bottom: 0.3mm solid var(--tk-line); }
.ssp .sp-foot { display: flex; justify-content: space-between; align-items: center; border-top: 0.5mm solid var(--tk-line); margin-top: 4mm; padding-top: 3mm;
  font-size: 10pt; color: var(--tk-text-muted); }
.ssp .sp-made { display: flex; align-items: center; gap: 2mm; font-family: var(--tk-font-display); font-weight: 700; letter-spacing: 0.06em; }
.ssp .sp-made b { color: var(--tk-text); }
