/* Studio Coach visual layer. Screen styling stays separate from the printable sheet. */
@media screen and (min-width: 980px) {
  #program-week-toolbar { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 6px 14px; padding: 10px 14px; }
  #program-week-toolbar .studio-week-heading { display: contents; }
  #program-week-toolbar .studio-week-heading > div { grid-column: 1; grid-row: 1; }
  #program-week-toolbar .studio-week-heading .studio-kicker { display: none; }
  #program-week-toolbar .studio-week-heading h2 { margin: 0; font-size: .94rem; white-space: nowrap; }
  #program-week-toolbar .studio-week-heading > button { grid-column: 3; grid-row: 1; justify-self: end; }
  #program-week-toolbar .studio-week-tabs { grid-column: 2; grid-row: 1; margin: 0; min-width: 0; }
  #program-week-toolbar .studio-structure-tools { grid-column: 1 / -1; grid-row: 2; margin: 0; }
  #program-week-toolbar .studio-structure-tools > summary { font-size: .73rem; }
  .studio-session-timing:not([open]) { display: block; padding: 0; margin: 0 0 8px; background: transparent; border: 0; }
  .studio-session-timing:not([open]) > summary { font-size: .72rem; }
  .studio-session-header { margin-bottom: 8px; }
}
@media screen {
  :root {
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    --ink: #24343d;
    --muted: #586973;
    --navy: #1d2d34;
    --green: var(--coach-accent, #125943);
    --green-dark: #0b4534;
    --wash: #f3f5f6;
    --line: #dce2e5;
    --paper: #fff;
    --radius: 11px;
    --studio-purple: var(--coach-accent, #125943);
    --studio-purple-deep: var(--coach-accent, #125943);
    --studio-purple-soft: #eaf1ee;
    --studio-teal-soft: #eaf1ee;
    --studio-shadow: 0 1px 2px #172f3906;
    --studio-side-width: 220px;
    --studio-header-height: 64px;
    --studio-gutter: clamp(16px, 2.6vw, 36px);
  }

  body.studio-page {
    min-height: 100dvh;
    background: var(--wash);
  }

  h1 {
    font-size: clamp(1.3rem, 1.8vw, 1.6rem);
    font-weight: 700;
    letter-spacing: -.025em;
    text-wrap: balance;
  }
  h2 { font-size: 1.08rem; font-weight: 650; letter-spacing: -.012em; }
  h3 { font-size: .98rem; font-weight: 650; }
  :focus-visible { outline: 2px solid var(--coach-accent, #125943); outline-offset: 3px; }

  .coach-header {
    background: #fff;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
  }
  .coach-header .studio-header-inner {
    min-width: 0;
    min-height: var(--studio-header-height);
    max-width: 1520px;
    padding: 10px var(--studio-gutter);
  }
  .studio-brand { min-width: 0; gap: 11px; }
  .studio-brand-copy { min-width: 0; }
  .studio-brand strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.04rem;
    font-weight: 770;
    letter-spacing: -.025em;
  }
  .coach-header .studio-kicker { color: var(--muted); font-size: .63rem; letter-spacing: .1em; }
  .studio-mark, .coach-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 9px;
  }
  .studio-mark {
    background: #e5eeea;
    color: #244d40;
    box-shadow: none;
    font-size: .95rem;
    letter-spacing: -.05em;
  }
  .coach-header-context {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: .86rem;
    font-weight: 650;
  }
  .coach-header-context::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--coach-accent, #125943);
  }
  .coach-account { justify-content: flex-end; min-width: 0; }
  #studio-account {
    min-width: 0;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
  }
  .coach-account .studio-button {
    color: var(--muted);
    border-color: var(--line);
    min-height: 34px;
    padding: 6px 10px;
    font-size: .78rem;
  }
  .coach-account .studio-button:hover:not(:disabled) { background: #f0f3f4; border-color: #b9c5ca; }

  .coach-nav {
    padding: 5px var(--studio-gutter) 10px;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
    max-width: 100%;
  }
  #studio-nav .studio-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 3px;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #4f626b;
    text-align: center;
    font-size: .8rem;
    font-weight: 680;
    line-height: 1.16;
  }
  #studio-nav .studio-button:hover:not(:disabled) { background: #eaf0ed; color: #254d41; }
  #studio-nav .studio-button[aria-current="page"] {
    color: var(--studio-purple-deep);
    background: var(--studio-purple-soft);
    border-color: #d3e1da;
    font-weight: 680;
  }
  .coach-nav-icon { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
  .coach-nav-label { min-width: 0; overflow-wrap: anywhere; }

  .studio-shell, .studio-shell.studio-client-area, .coach-global { max-width: 1520px; padding-inline: var(--studio-gutter); }
  .studio-shell { padding-block: clamp(17px, 3vw, 33px) 45px; }
  .coach-signin { max-width: 700px; }
  .coach-page, .studio-workspace { gap: 12px; }
  .studio-shell.studio-client-area { gap: 12px; }
  .studio-sidebar, .studio-panel, .studio-stat { box-shadow: var(--studio-shadow); }
  .studio-panel { padding: clamp(13px, 1.3vw, 18px); }
  .studio-panel > :is(h2, h3) { margin-bottom: 12px; }
  .studio-sidebar { padding: 17px; }
  .studio-sidebar-note { color: var(--muted); }

  .coach-banner, .studio-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-width: 0;
    padding: clamp(14px, 1.5vw, 20px);
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
    box-shadow: var(--studio-shadow);
  }
  .coach-banner::after, .studio-hero::after {
    content: none;
  }
  .coach-banner > p:last-child, .studio-hero p:not(.studio-kicker) {
    max-width: 69ch;
    color: var(--muted);
  }
  .coach-grid { gap: clamp(9px, 1.4vw, 17px); }
  .coach-stat {
    position: relative;
    align-content: start;
    min-height: 88px;
    padding: 12px 14px;
    border-radius: 7px;
    box-shadow: var(--studio-shadow);
    transition: border-color .16s ease, box-shadow .16s ease;
  }
  .coach-stat strong {
    display: block;
    justify-self: start;
    padding: 0;
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }
  .coach-stat:hover { border-color: #a3bbb0; background: #fafcfb; }
  .studio-stat { padding: clamp(11px, 1.65vw, 18px); }
  .studio-stat span { color: var(--muted); font-weight: 600; }

  .studio-button {
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 5px;
    border-color: #cad5d0;
    background: #edf3ef;
    color: #254f40;
    font-size: .82rem;
    font-weight: 600;
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
  }
  .studio-button:hover:not(:disabled) { background: #e2ece6; border-color: #a9bfb1; }
  .studio-button.quiet { background: #fff; border-color: var(--line); color: #475e68; }
  .studio-button.quiet:hover:not(:disabled) { background: #f1f4f5; border-color: #becbd0; }
  .studio-button.primary {
    background: var(--coach-accent);
    border-color: var(--coach-accent);
    color: var(--coach-on-accent);
    box-shadow: none;
  }
  .studio-button.primary:hover:not(:disabled) {
    background: var(--coach-accent);
    border-color: var(--coach-accent);
    color: var(--coach-on-accent);
  }
  .studio-button.danger { border-color: #e6cecc; color: #8d3933; }
  .studio-button.danger:hover:not(:disabled) { background: #fcf1ef; border-color: #dcb6b1; }
  input:not([type="checkbox"],[type="radio"]), select, textarea {
    min-height: 40px;
    padding: 8px 10px;
    border-color: #cbd5da;
    border-radius: 7px;
    background: #fff;
  }
  input::placeholder, textarea::placeholder { color: #6d7e87; }
  input:read-only:not([type]), textarea:read-only { background: #f3f5f6; }
  .studio-exercise, #studio-client-log fieldset { border-radius: 9px; background: #fafbfc; }
  .studio-plan-list button[aria-current="true"], .studio-volume-bar[aria-pressed="true"] {
    background: #eaf1ed;
    border-color: #b7cec0;
    color: #254f40;
  }
  .studio-volume li, .coach-list li, .coach-answers > div { background: #f3f6f7; }
  .coach-list a, .coach-answers a, .coach-text-link { color: var(--coach-accent, #125943); }
  .coach-chat { background: #f0f4f5; }
  .coach-chat li[data-from="trainer"] { background: #e9f1ec; }
  .studio-status { background: #eaf0f3; color: #314c5b; }
  .studio-status[data-kind="success"] { background: #def6eb; color: #15553d; }
  .studio-status[data-kind="error"] { background: #fbeeed; color: #85392f; }

  .coach-client-nav-group { border-radius: 9px; background: #f3f6f7; }
  .coach-client-nav-group.is-current { border-color: #b7cfc2; background: #eaf1ee; }
  .coach-client-shortcuts .studio-button { border-radius: 9px; }
  .coach-chart, .coach-history-card, .coach-client-expand, .coach-client-assignment {
    border-radius: 9px;
    background: #fafbfc;
  }
  .coach-history-comparison { background: #eaf1ed; color: #365a49; }
  .coach-nutrition-draft { border-radius: 9px; background: #f4f7f8; }
  .coach-dialog, .catalog-detail { border-radius: 12px; box-shadow: 0 18px 60px #142b3433; }
  .coach-dialog::backdrop, .catalog-detail::backdrop { background: #1528307a; }

  @media (min-width: 980px) {
    body.studio-page:has(.coach-nav:not([hidden])) { padding-inline-start: var(--studio-side-width); }
    .studio-page:has(.coach-nav:not([hidden])) .coach-header {
      position: sticky;
      z-index: 10;
      top: 0;
      background: #fffffff7;
    }
    .studio-page:has(.coach-nav:not([hidden])) .studio-brand {
      position: fixed;
      z-index: 2;
      top: 0;
      left: 0;
      width: var(--studio-side-width);
      min-height: 82px;
      padding: 12px 16px;
      color: #fff;
      border-bottom: 1px solid #ffffff18;
    }
    .studio-page:has(.coach-nav:not([hidden])) .studio-brand .studio-kicker { color: #abbdbd; }
    .studio-page:has(.coach-nav:not([hidden])) .coach-header-context { display: inline-flex; }
    .coach-nav {
      position: fixed;
      z-index: 1;
      inset: 0 auto 0 0;
      width: var(--studio-side-width);
      overflow: auto;
      overscroll-behavior: contain;
      align-content: start;
      grid-template-columns: minmax(0, 1fr);
      gap: 6px;
      padding: 103px 12px 18px;
      background: #1d2d34;
      border-right: 1px solid #31454c;
    }
    #studio-nav .studio-button {
      justify-content: flex-start;
      gap: 11px;
      min-height: 46px;
      padding: 8px 11px;
      color: #cbd7dc;
      text-align: left;
      font-size: .86rem;
    }
    #studio-nav .studio-button:hover:not(:disabled) { background: #ffffff11; color: #fff; }
    #studio-nav .studio-button[aria-current="page"] {
      background: var(--coach-accent, #125943);
      border-color: #ffffff18;
      color: var(--coach-on-accent, #fff);
    }
    #studio-nav .studio-button:focus-visible { outline-color: #bddccc; outline-offset: 1px; }
    .studio-page:has(.coach-nav:not([hidden])) .studio-sidebar {
      position: sticky;
      top: calc(var(--studio-header-height) + 18px);
      max-height: calc(100dvh - var(--studio-header-height) - 38px);
      overflow: auto;
    }
    #plan-area { grid-template-columns: minmax(205px, 250px) minmax(0, 1fr); }
  }

  @media (min-width: 980px) and (max-width: 1179px) {
    :root { --studio-side-width: 70px; }
    .studio-page:has(.coach-nav:not([hidden])) .studio-brand { justify-content: center; padding-inline: 8px; }
    .studio-page:has(.coach-nav:not([hidden])) .studio-brand-copy,
    .coach-nav-label {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip-path: inset(50%);
      white-space: nowrap;
    }
    .coach-nav { padding-inline: 8px; }
    #studio-nav .studio-button { justify-content: center; padding-inline: 3px; }
  }

  @media (min-width: 1370px) {
    .studio-hero { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
    .studio-hero > .studio-actions { justify-content: flex-end; }
  }

  @media (max-width: 979px) {
    #plan-area { grid-template-columns: minmax(0, 1fr); }
    #plan-area .studio-sidebar { order: 1; }
  }

  @media (max-width: 760px) {
    .coach-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    #studio-nav .studio-button { flex-direction: column; gap: 4px; min-height: 47px; }
    .coach-nav-icon { width: 17px; height: 17px; flex-basis: 17px; }
    .coach-stat { min-height: 112px; padding: 12px; }
  }

  @media (max-width: 540px) {
    .coach-header .studio-header-inner { flex-direction: row; align-items: center; gap: 7px; min-height: 58px; }
    .studio-mark, .coach-logo { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
    .studio-brand { gap: 7px; }
    .studio-brand strong { font-size: .93rem; }
    .coach-header .studio-kicker { display: none; }
    .coach-account { gap: 4px; }
    .coach-account .studio-button { padding-inline: 7px; min-height: 32px; }
    #studio-account { max-width: 92px; font-size: .75rem; }
    .studio-hero, .coach-banner, .studio-panel, .studio-sidebar { border-radius: 10px; }
    .studio-button, input:not([type="checkbox"],[type="radio"]), select { min-height: 44px; }
  }

  @media (prefers-reduced-motion: reduce) {
    .studio-button, .coach-stat { transition: none; }
  }
  #plan-area { grid-template-columns: minmax(0, 1fr); }
  .studio-page:has(.coach-nav:not([hidden])) #plan-area .studio-sidebar {
    position: static;
    max-height: none;
  }
  #plan-area .studio-sidebar-actions, .coach-manage-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .75rem;
  }
  #plan-area .studio-plan-list .studio-button {
    justify-content: space-between;
    text-align: left;
  }
  #plan-area [data-catalog-resources]:empty { display: none; }
  .coach-manage-filters label:first-child { flex: 1 1 14rem; }
  #coach-manage-roster .coach-list li { justify-content: space-between; }
  #coach-manage-roster small, #help-area .coach-list small { display: block; margin: .25rem 0 0; }
}

@media screen {
  .studio-comparison > summary {
    width: fit-content;
    color: var(--studio-purple-deep);
    font-size: 1.05rem;
    font-weight: 750;
    cursor: pointer;
  }
  .studio-comparison[open] > summary { margin-bottom: 13px; }
  #program-comparison-content { display: grid; gap: 12px; }
  .studio-comparison-tools, .studio-comparison-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: end;
  }
  .studio-comparison-tools { justify-content: space-between; }
  .studio-comparison-tools > label { flex: 1 1 190px; max-width: 360px; }
  .studio-comparison-pages { align-items: center; color: var(--muted); font-size: .82rem; }
  .studio-comparison-scroll {
    max-width: 100%;
    max-height: min(60dvh, 710px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
  }
  .studio-comparison-scroll table {
    min-width: 100%;
    width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
  }
  .studio-comparison-scroll :is(th, td) {
    min-width: 108px;
    max-width: 195px;
    padding: 8px 9px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    overflow-wrap: anywhere;
  }
  .studio-comparison-scroll tr > :last-child { border-right: 0; }
  .studio-comparison-scroll tbody tr:last-child > * { border-bottom: 0; }
  .studio-comparison-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #edf2f4;
  }
  .studio-comparison-scroll tr > :first-child {
    position: sticky;
    left: 0;
    min-width: 145px;
    max-width: 220px;
    background: #fafbfc;
  }
  .studio-comparison-scroll thead tr > :first-child { z-index: 3; background: #edf2f4; }
  .studio-comparison-scroll tbody th { z-index: 1; font-size: .9rem; }
  .studio-comparison-scroll strong, .studio-comparison-scroll small { display: block; }
  .studio-comparison-scroll small { margin-top: 3px; color: var(--muted); }
  .studio-comparison-scroll .studio-button {
    min-height: 34px;
    width: 100%;
    padding: 4px 9px;
  }
  .studio-comparison-scroll .studio-button[aria-pressed="true"] { background: #e4eee7; border-color: #a9c5b6; }
  .studio-comparison-different { background: #eef4f0; }
  .studio-comparison-scroll .studio-comparison-change {
    width: fit-content;
    padding: 2px 5px;
    border-radius: 5px;
    background: #dfebe3;
    color: #285541;
    font-weight: 680;
  }
  @media (max-width: 540px) {
    .studio-comparison-scroll tr > :first-child { min-width: 112px; max-width: 145px; }
  }

  #progressions-area .coach-progression-library { margin-top: 24px; }
  #progressions-area .coach-progression-library h2 { margin-bottom: 12px; }
  #progressions-area .coach-progression-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
    gap: 12px;
  }
  #progressions-area .coach-progression-examples article {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfc;
  }
  #progressions-area .coach-progression-examples h3 {
    margin: 5px 0 0;
    font-size: 1.02rem;
  }
  #progressions-area .coach-progression-examples p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .9rem;
  }
  #progressions-area .coach-progression-week, #progressions-area .coach-progression-phase {
    min-width: 0;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
  }
  #progressions-area .coach-progression-week > summary,
  #progressions-area .coach-progression-phase > summary {
    cursor: pointer;
    font-weight: 650;
  }
  #progressions-area .coach-progression-week > summary small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-weight: 400;
  }
  #progressions-area .coach-progression-fields, #progressions-area .coach-progression-phase {
    margin: 12px 0;
  }
  #progressions-area .coach-progression-fields h4 { margin: 0 0 8px; }
  #progressions-area .coach-progression-phase[open] > summary { margin-bottom: 10px; }
  #progressions-area .coach-progression-fields .studio-form-grid,
  #progressions-area .coach-progression-phase .studio-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  }
}

