/* Coach console overhaul — the calm layer.
 *
 * Loaded last, scoped to the coach shell, screen only (reports keep their own
 * print sheet). It does not add features or remove controls; it settles the
 * hierarchy that a dozen refinement passes left competing:
 *
 *   1. One surface level. A section is one card; anything inside it is
 *      separated by hairlines, never by another bordered box.
 *   2. One gold action per screen, in the page header. Row and secondary
 *      actions are quiet until hovered or focused.
 *   3. One status language: a tinted pill with a dot, sentence case.
 *   4. Chrome recedes: quieter rail labels, no repeated titles.
 *
 * Tokens come from shared/overhaul.css and stay tenant-driven.
 */
@media screen {
  #shell.coach-athletic-shell {
    --cx-radius: 14px;
    --cx-radius-s: 8px;
    --cx-line: var(--rule-2);
    --cx-pad: 22px;
    --cx-gap: 16px;
    --cx-muted: var(--ink-2);
    --cx-hover: color-mix(in srgb, var(--ink) 6%, transparent);
  }

  /* ---------- Rail ---------- */
  #shell.coach-athletic-shell .rail {
    padding: 18px 12px 12px;
  }
  #shell.coach-athletic-shell .rail .coach-rail-caption {
    display: none;
  }
  #shell.coach-athletic-shell .rail .grp {
    padding: 18px 12px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: 0.01em;
  }
  #shell.coach-athletic-shell .rail nav button {
    min-height: 40px;
    margin: 1px 0;
    padding: 0.5rem 0.75rem;
    border-radius: var(--cx-radius-s);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-2);
  }
  #shell.coach-athletic-shell .rail nav button:hover {
    background: var(--cx-hover);
    color: var(--ink);
  }
  #shell.coach-athletic-shell .rail nav button[aria-current="page"] {
    background: var(--gold-wash);
    color: var(--gold-dp);
    box-shadow: inset 2px 0 0 var(--gold);
  }
  #shell.coach-athletic-shell .rail .nav-extras {
    margin-top: 10px;
    padding: 0 0.75rem;
    font-size: 0.85rem;
  }

  /* ---------- Context bar ---------- */
  #shell.coach-athletic-shell .coach-contextbar {
    min-height: 52px;
    border-bottom-color: transparent;
    background: transparent;
  }
  #shell.coach-athletic-shell .coach-context-path {
    font-size: 0.8125rem;
    color: var(--cx-muted);
  }
  #shell.coach-athletic-shell .coach-context-path strong {
    color: var(--ink-2);
    font-weight: 500;
  }
  #shell.coach-athletic-shell .coach-appearance {
    min-height: 36px;
    padding: 0.35rem 0.75rem;
    border-color: transparent;
    color: var(--cx-muted);
    font-weight: 500;
  }
  #shell.coach-athletic-shell .coach-contextbar .btn.coach-appearance:not(.gold):not(.primary) {
    border-color: transparent;
  }
  #shell.coach-athletic-shell .rail .nav-extras > summary::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-left: auto;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: translateY(-2px) rotate(45deg);
  }
  #shell.coach-athletic-shell .rail .nav-extras[open] > summary::after {
    transform: translateY(2px) rotate(-135deg);
  }
  #shell.coach-athletic-shell .coach-appearance:hover {
    background: var(--cx-hover);
    color: var(--ink);
  }

  /* ---------- Page header ---------- */
  #shell.coach-athletic-shell .workspace-heading {
    padding-bottom: 0;
    margin-bottom: 24px;
    border-bottom: 0;
    align-items: flex-start;
  }
  #shell.coach-athletic-shell .workspace-heading h1,
  #shell.coach-athletic-shell .main h1 {
    font-size: 1.75rem;
    letter-spacing: -0.025em;
  }
  #shell.coach-athletic-shell .workspace-heading .sub {
    margin-top: 4px;
    color: var(--cx-muted);
    font-size: 0.9rem;
  }
  #shell.coach-athletic-shell .main > div > div > fieldset > hr,
  #shell.coach-athletic-shell .workspace-heading + hr {
    display: none;
  }

  /* ---------- Surfaces ---------- */
  #shell.coach-athletic-shell .card {
    border-color: var(--cx-line);
    border-radius: var(--cx-radius);
    padding: var(--cx-pad);
  }
  #shell.coach-athletic-shell .card .card {
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
  }
  #shell.coach-athletic-shell .main :is(h1, h2, h3) {
    overflow-wrap: anywhere;
  }
  #shell.coach-athletic-shell .main h2 {
    font-size: 1.0625rem;
    font-weight: 650;
    letter-spacing: -0.01em;
  }
  #shell.coach-athletic-shell .main h3 {
    font-size: 0.975rem;
    font-weight: 600;
  }
  #shell.coach-athletic-shell .main .hint {
    color: var(--cx-muted);
  }

  /* ---------- Buttons ---------- */
  #shell.coach-athletic-shell .btn {
    border-radius: var(--cx-radius-s);
    font-weight: 600;
  }
  #shell.coach-athletic-shell .btn:not(.gold):not(.primary):not([aria-pressed="true"]) {
    border-color: var(--rule);
    background: transparent;
  }
  #shell.coach-athletic-shell .btn:not(.gold):not(.primary):not(:disabled):hover {
    background: var(--cx-hover);
  }
  /* Row actions stay available but stop shouting across every row. */
  #shell.coach-athletic-shell :is(td, .library-row-actions, .package-row-actions, .session-row-actions, .row-actions) .btn:not(.gold):not(.primary) {
    border-color: transparent;
    color: var(--ink-2);
  }
  #shell.coach-athletic-shell :is(td, .library-row-actions, .package-row-actions, .session-row-actions, .row-actions) .btn:not(.gold):not(.primary):hover,
  #shell.coach-athletic-shell :is(td, .library-row-actions, .package-row-actions, .session-row-actions, .row-actions) .btn:not(.gold):not(.primary):focus-visible {
    color: var(--ink);
    border-color: var(--rule);
  }

  /* ---------- Segmented controls & filter chips ---------- */
  #shell.coach-athletic-shell :is(.seg, .roster-stages) {
    gap: 2px;
    padding: 3px;
    border: 0;
    border-radius: 10px;
    background: var(--band);
  }
  #shell.coach-athletic-shell :is(.seg, .roster-stages) > .btn {
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-2);
    font-weight: 500;
    box-shadow: none;
  }
  #shell.coach-athletic-shell :is(.seg, .roster-stages) > .btn[aria-pressed="true"],
  #shell.coach-athletic-shell :is(.seg, .roster-stages) > .btn[aria-current="page"] {
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 1px 2px #0003;
  }
  #shell.coach-athletic-shell .roster-stages > .btn > b {
    margin-left: 6px;
    color: var(--cx-muted);
    font-weight: 500;
  }

  /* ---------- Status pills ---------- */
  #shell.coach-athletic-shell .main .tag {
    display: inline-block;
    padding: 0.15rem 0.6rem 0.15rem 1.15rem;
    border: 0;
    border-radius: 999px;
    background:
      radial-gradient(circle at 0.6rem 50%, currentColor 0 3px, transparent 3.5px),
      color-mix(in srgb, currentColor 13%, transparent);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.5;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  #shell.coach-athletic-shell .main .tag::first-letter {
    text-transform: uppercase;
  }
  #shell.coach-athletic-shell .main .tag:not(.ok):not(.bad):not(.warn):not(.gold):not(.info) {
    color: var(--ink-2);
  }

  /* ---------- Tables ---------- */
  #shell.coach-athletic-shell .main table {
    border-collapse: collapse;
  }
  #shell.coach-athletic-shell .main thead th {
    padding-block: 10px;
    background: transparent;
    border-bottom: 1px solid var(--rule);
    color: var(--cx-muted);
    font-size: 0.78rem;
    font-weight: 500;
  }
  #shell.coach-athletic-shell .main tbody td {
    border-bottom: 1px solid var(--cx-line);
  }
  #shell.coach-athletic-shell .main tbody tr:last-child > td {
    border-bottom: 0;
  }
  #shell.coach-athletic-shell .main tbody tr:hover > td {
    background: color-mix(in srgb, var(--ink) 3%, transparent);
  }

  /* ---------- Disclosures ---------- */
  #shell.coach-athletic-shell .main details:not(.row-menu):not(.more-tabs):not(.progress-metric) > summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-left: auto;
    border: solid var(--cx-muted);
    border-width: 0 1.5px 1.5px 0;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.15s;
    flex: none;
  }
  #shell.coach-athletic-shell .main details:not(.row-menu):not(.more-tabs):not(.progress-metric)[open] > summary::after {
    content: "";
    transform: translateY(2px) rotate(-135deg);
  }
  @media (prefers-reduced-motion: reduce) {
    #shell.coach-athletic-shell .main details > summary::after {
      transition: none;
    }
  }

  /* ---------- Today ---------- */
  #shell.coach-athletic-shell .athletic-day .welcome-top {
    align-items: flex-start;
    margin-bottom: 24px;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-intro h1 {
    font-size: 1.75rem;
    letter-spacing: -0.025em;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-intro h2 {
    margin: 6px 0 2px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-date {
    display: flex;
    flex-wrap: wrap;
    gap: 0 10px;
    margin: 0;
    text-align: left;
    font-size: 0.8125rem;
    color: var(--cx-muted);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-local-time::before {
    content: "·";
    margin-right: 10px;
  }
  @media (max-width: 700px) {
    #shell.coach-athletic-shell .athletic-day .welcome-date {
      flex-direction: column;
    }
    #shell.coach-athletic-shell .athletic-day .welcome-local-time::before {
      content: none;
    }
  }
  #shell.coach-athletic-shell .athletic-day .welcome-stats {
    gap: 12px;
    border: 0;
    background: transparent;
    margin-bottom: 28px;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-stat {
    padding: 12px 16px;
    border: 1px solid var(--cx-line);
    border-radius: 12px;
    background: var(--card);
    transition: border-color 0.15s;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-stat:hover {
    border-color: var(--gold-line);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-stat-icon {
    color: var(--gold-dp);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-stat strong {
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-stat > span:nth-child(2) > span {
    font-size: 0.8125rem;
    color: var(--cx-muted);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-workbench {
    gap: 20px;
    align-items: start;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-panel {
    padding: var(--cx-pad);
    border: 1px solid var(--cx-line);
    border-radius: var(--cx-radius);
    background: var(--card);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-panel .welcome-panel {
    padding: 0;
    border: 0;
    background: transparent;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-panel-heading {
    flex-wrap: wrap;
    margin-bottom: 16px;
  }
  #shell.coach-athletic-shell .session-month-toggle {
    white-space: normal;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-panel-heading h2 {
    font-size: 1.0625rem;
    margin: 0 0 2px;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-arrow {
    font-size: 0.8125rem;
    color: var(--cx-muted);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-onboarding {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    padding: 0 0 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--cx-line);
  }
  #shell.coach-athletic-shell .athletic-day .welcome-onboarding button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    min-height: 36px;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--cx-muted);
    font-size: 0.8125rem;
    font-weight: 500;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-onboarding button:hover {
    color: var(--ink);
    text-decoration: underline;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-onboarding button > strong {
    display: inline;
    width: auto;
    height: auto;
    border: 0;
    color: var(--ink);
    font-weight: 650;
  }
  #shell.coach-athletic-shell .athletic-day .welcome-priority-copy p {
    color: var(--cx-muted);
    font-size: 0.8125rem;
  }
  #shell.coach-athletic-shell .athletic-day :is(.priority-row, .welcome-request) .btn {
    border-color: var(--rule);
    color: var(--ink);
    min-height: 36px;
    padding-inline: 0.85rem;
  }

  /* ---------- Sessions ---------- */
  #shell.coach-athletic-shell .session-workspace {
    gap: 20px;
  }
  #shell.coach-athletic-shell :is(.session-month, .session-overview, .session-day > .card, .calendar-availability, .session-request-queue) {
    border-color: var(--cx-line);
    border-radius: var(--cx-radius);
  }
  #shell.coach-athletic-shell .session-overview > header p {
    color: var(--cx-muted);
    font-size: 0.75rem;
  }
  #shell.coach-athletic-shell .session-overview-totals dd {
    font-size: 1.25rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }
  #shell.coach-athletic-shell .calendar-availability > h3 {
    margin-bottom: 12px;
  }
  #shell.coach-athletic-shell .calendar-availability .slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 6px;
  }
  #shell.coach-athletic-shell .calendar-availability .slot {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    padding: 6px 8px;
    border: 1px solid var(--cx-line);
    border-radius: var(--cx-radius-s);
    background: transparent;
    font-variant-numeric: tabular-nums;
  }
  #shell.coach-athletic-shell .calendar-availability .slot:not(:disabled):hover {
    border-color: var(--gold-line);
    background: var(--gold-wash);
  }
  #shell.coach-athletic-shell .calendar-availability .slot[aria-pressed="true"] {
    border-color: var(--gold);
    background: var(--gold-wash);
    color: var(--gold-dp);
  }
  #shell.coach-athletic-shell .calendar-availability .slot b {
    font-size: 0.875rem;
    font-weight: 600;
  }
  #shell.coach-athletic-shell .calendar-availability .slot.taken {
    background: var(--band);
    border-color: transparent;
    color: var(--cx-muted);
    opacity: 1;
  }
  #shell.coach-athletic-shell .calendar-availability .slot.taken small {
    font-size: 0.6875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #shell.coach-athletic-shell .calendar-availability > .sub {
    margin-top: 10px;
    font-size: 0.8125rem;
  }

  /* ---------- Notices ---------- */
  /* An alert asks for action; a note explains. Neither is a slab of colour. */
  #shell.coach-athletic-shell .main .alert {
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
    border-left: 3px solid var(--gold);
    border-radius: 10px;
    background: var(--gold-wash);
    font-size: 0.875rem;
    line-height: 1.55;
  }
  #shell.coach-athletic-shell .main .note {
    padding: 8px 0 8px 14px;
    border: 0;
    border-left: 2px solid var(--rule);
    border-radius: 0;
    background: transparent;
    color: var(--cx-muted);
    font-size: 0.8125rem;
    line-height: 1.55;
  }
  #shell.coach-athletic-shell .main .alert + .note {
    margin-top: 10px;
  }

  /* ---------- Client record ---------- */
  #shell.coach-athletic-shell .dossier-header {
    padding-bottom: 8px;
  }
  #shell.coach-athletic-shell .dossier-identity h1 {
    font-size: 1.5rem;
  }
  #shell.coach-athletic-shell .dossier-context > summary {
    display: inline-flex;
    gap: 8px;
    min-height: 28px;
    color: var(--cx-muted);
    font-size: 0.875rem;
  }
  #shell.coach-athletic-shell .dossier-back {
    border-color: transparent;
    color: var(--cx-muted);
  }
  #shell.coach-athletic-shell .dossier-index button {
    font-weight: 500;
    color: var(--cx-muted);
  }
  #shell.coach-athletic-shell .dossier-index button[aria-current="page"] {
    color: var(--ink);
  }
  #shell.coach-athletic-shell .dossier-pane > * + * {
    margin-top: 16px;
  }
  /* Signed and reference documents keep every word; long text scrolls in place. */
  #shell.coach-athletic-shell .signing-document-list > details[open] > p[style*="pre-wrap"] {
    max-height: 22rem;
    overflow: auto;
    padding-right: 8px;
    overscroll-behavior: contain;
  }
  #shell.coach-athletic-shell .signing-document-list > details {
    border-color: var(--cx-line);
    border-radius: 10px;
  }

  /* ---------- Ledgers ---------- */
  #shell.coach-athletic-shell .main td.receipt-number,
  #shell.coach-athletic-shell .main .receipt-number {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  #shell.coach-athletic-shell .main td :is(small, .sub) {
    color: var(--cx-muted);
  }

  /* Titles inside a client record sit under the client's name, not beside it. */
  #shell.coach-athletic-shell .dossier-pane h1 {
    font-size: 1.25rem;
  }
  #shell.coach-athletic-shell .meal-options-editor > .meal-plan-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
    gap: 16px;
  }

  /* Phones keep 44px touch targets even where the desktop control is lighter. */
  @media (max-width: 760px) {
    /* Stacked table rows are already cards; cell dividers would cut them up. */
    #shell.coach-athletic-shell .main table.cardify tbody td {
      border-bottom: 0;
    }
    #shell.coach-athletic-shell .athletic-day .welcome-onboarding button,
    #shell.coach-athletic-shell .athletic-day :is(.priority-row, .welcome-request) .btn,
    #shell.coach-athletic-shell .coach-appearance,
    #shell.coach-athletic-shell .calendar-availability .slot {
      min-height: 44px;
    }
  }
}
