/* Gym "All" tab: Longest / Heaviest workout cards */
#gymPage .wk-card{--wk-text:#eef2f7;--wk-muted:#9aa6b5;--wk-chip:rgba(255,255,255,.06);--wk-line:rgba(255,255,255,.09);padding:22px 24px!important;display:flex;flex-direction:column;gap:14px;color:var(--wk-text)}
#gymPage .wk-label{font-size:12px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--wk-muted)}
#gymPage .wk-metric{font-size:34px;font-weight:800;line-height:1.15;margin-top:4px;color:var(--wk-text);font-variant-numeric:tabular-nums}
#gymPage .wk-empty{color:var(--wk-muted);font-size:14px}
#gymPage .wk-meta{display:flex;flex-wrap:wrap;gap:8px}
#gymPage .wk-tag{font-size:13px;padding:5px 11px;border-radius:999px;background:var(--wk-chip);color:var(--wk-muted)}
#gymPage .wk-tag-name{background:color-mix(in srgb,var(--active-category,#9658f5) 22%,transparent);color:var(--wk-text);font-weight:600}
#gymPage .wk-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px}
#gymPage .wk-fact{background:var(--wk-chip);border-radius:12px;padding:10px 12px;min-width:0}
#gymPage .wk-fact-num{display:block;font-size:17px;font-weight:700;color:var(--wk-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
#gymPage .wk-fact-lbl{display:block;font-size:12px;color:var(--wk-muted);margin-top:2px}
#gymPage .wk-details summary{list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:600;color:var(--wk-text);padding:8px 14px;border-radius:10px;border:1px solid var(--wk-line);user-select:none}
#gymPage .wk-details summary::-webkit-details-marker{display:none}
#gymPage .wk-details summary::after{content:'';width:7px;height:7px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg) translateY(-2px);transition:transform .15s}
#gymPage .wk-details[open] summary::after{transform:rotate(-135deg) translateY(-2px)}
#gymPage .wk-details summary:hover{background:var(--wk-chip)}
#gymPage .wk-body{display:flex;flex-direction:column;gap:12px;margin-top:14px}
#gymPage .wk-group{border-left:3px solid var(--muscle);padding:2px 0 2px 14px;display:flex;flex-direction:column;gap:12px}
#gymPage .wk-muscle{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muscle)}
#gymPage .wk-ex{display:flex;flex-direction:column;gap:7px}
#gymPage .wk-ex-name{font-size:15px;font-weight:600;color:var(--wk-text)}
#gymPage .wk-sets{display:flex;flex-wrap:wrap;gap:6px}
#gymPage .wk-set{display:inline-flex;align-items:center;gap:7px;font-size:13px;padding:5px 10px 5px 5px;border-radius:8px;background:var(--wk-chip);color:#d5dce5;font-variant-numeric:tabular-nums;white-space:nowrap}
#gymPage .wk-set-n{display:inline-grid;place-items:center;width:19px;height:19px;border-radius:6px;background:rgba(255,255,255,.08);font-size:11px;color:var(--wk-muted)}
#gymPage .wk-set-top{background:color-mix(in srgb,var(--muscle) 20%,transparent);color:var(--wk-text)}
#gymPage .wk-set-none{padding:5px 10px;color:var(--wk-muted)}
html[data-theme="light"] #gymPage .wk-card{--wk-text:#1f2630;--wk-muted:#5e6976;--wk-chip:rgba(20,30,45,.06);--wk-line:rgba(20,30,45,.14)}
html[data-theme="light"] #gymPage .wk-set{color:#2b333d}
html[data-theme="light"] #gymPage .wk-set-n{background:rgba(20,30,45,.08)}
@media(max-width:640px){#gymPage .wk-card{padding:18px!important}#gymPage .wk-metric{font-size:28px}}

/* Gym history: date first, then a stats table and an exercise table */
#gymPage .history-entry summary.ly-session-summary{display:grid!important;gap:10px!important}
#gymPage .ly-hs-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
#gymPage .ly-hs-date{font-size:16px;font-weight:800;color:#eef2f7}
#gymPage .ly-hs-name{font-size:14px;font-weight:600;color:#9aa6b5}
#gymPage table.ly-hs-stats{border-collapse:separate;border-spacing:0;width:auto;min-width:min(100%,360px);border:1px solid rgba(255,255,255,.1);border-radius:12px;overflow:hidden;background:rgba(255,255,255,.03)}
#gymPage .ly-hs-stats th,#gymPage .ly-hs-stats td{padding:8px 16px;text-align:left;white-space:nowrap}
#gymPage .ly-hs-stats th{font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:#8f9aab;border-bottom:1px solid rgba(255,255,255,.08)}
#gymPage .ly-hs-stats td{font-size:15px;font-weight:800;color:#eef2f7;font-variant-numeric:tabular-nums}
#gymPage .ly-hs-stats th+th,#gymPage .ly-hs-stats td+td{border-left:1px solid rgba(255,255,255,.08)}
#gymPage .ly-hs-scroll{margin:14px 0 10px;overflow-x:auto;border:1px solid rgba(255,255,255,.1);border-radius:12px}
#gymPage table.ly-hs-table{width:100%;border-collapse:collapse;min-width:560px;font-size:13px}
#gymPage .ly-hs-table th{padding:10px 12px;text-align:left;font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:#8f9aab;background:rgba(255,255,255,.04);border-bottom:1px solid rgba(255,255,255,.1)}
#gymPage .ly-hs-table td{padding:10px 12px;border-bottom:1px solid rgba(255,255,255,.06);color:#d6dde6;vertical-align:middle}
#gymPage .ly-hs-table tbody tr{box-shadow:inset 3px 0 0 var(--muscle)}
#gymPage .ly-hs-table tbody tr:hover{background:rgba(255,255,255,.03)}
#gymPage .ly-hs-table td.ly-hs-ex{font-weight:700;color:#eef2f7}
#gymPage .ly-hs-muscle{display:inline-block;padding:2px 9px;border-radius:99px;font-size:11px;font-weight:700;color:var(--muscle);background:color-mix(in srgb,var(--muscle) 14%,transparent);border:1px solid color-mix(in srgb,var(--muscle) 35%,transparent);white-space:nowrap}
#gymPage .ly-hs-sets{display:flex;flex-wrap:wrap;gap:4px}
#gymPage .ly-hs-set{padding:2px 8px;border-radius:7px;background:rgba(255,255,255,.06);white-space:nowrap;font-variant-numeric:tabular-nums}
#gymPage .ly-hs-table .ly-hs-num,#gymPage .ly-hs-table th:last-child{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
#gymPage .ly-hs-table td.ly-hs-num{font-weight:700}
#gymPage .ly-hs-table tfoot td{font-weight:800;color:#eef2f7;border-bottom:0;background:rgba(255,255,255,.03)}
#gymPage .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
html[data-theme="light"] #gymPage :is(.ly-hs-date,.ly-hs-stats td,.ly-hs-table td.ly-hs-ex,.ly-hs-table tfoot td){color:#1f2630}
html[data-theme="light"] #gymPage :is(.ly-hs-stats,.ly-hs-scroll){border-color:rgba(20,30,45,.14)}
html[data-theme="light"] #gymPage .ly-hs-table td{color:#2b333d;border-color:rgba(20,30,45,.08)}

/* Clear open / close control on each logged session */
#gymPage .history-entry summary.ly-session-summary{position:relative;padding-right:54px!important;list-style:none!important}
#gymPage .history-entry summary.ly-session-summary::-webkit-details-marker{display:none}
#gymPage .history-entry summary.ly-session-summary::after{content:'';position:absolute;top:2px;right:0;width:38px;height:38px;border-radius:12px;background:rgba(255,255,255,.06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e6eaf0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/18px no-repeat;border:1px solid rgba(255,255,255,.14);transition:transform .2s,background-color .15s}
#gymPage .history-entry summary.ly-session-summary.ly-arrow-hot::after{background-color:rgba(255,255,255,.12)}
#gymPage .history-entry details[open]>summary.ly-session-summary::after{transform:rotate(180deg)}
#gymPage .history-entry summary.ly-session-summary:focus-visible{outline:2px solid rgba(167,139,250,.7);outline-offset:4px;border-radius:12px}
html[data-theme="light"] #gymPage .history-entry summary.ly-session-summary::after{background-color:rgba(20,30,45,.05);border-color:rgba(20,30,45,.14);filter:invert(1)}

/* Routine card actions: pin and eye as icon buttons (names show on hover) */
#gymPage .routine .actions button.ly-icon-only{display:inline-grid;place-items:center;width:40px;min-width:40px;padding:0!important}
#gymPage .routine .actions button.ly-icon-only svg{width:19px;height:19px}
#gymPage .routine .actions button.ly-icon-only.is-on{color:#fcd34d!important;border-color:rgba(252,211,77,.45)!important;background:rgba(252,211,77,.1)!important}
#gymPage .routine .actions button.ly-icon-only.is-on svg{fill:currentColor}

/* Workout cards: every set takes its muscle colour; the heaviest set gets a brighter outline */
#gymPage .wk-set{background:color-mix(in srgb,var(--muscle) 12%,transparent);color:var(--wk-text)}
#gymPage .wk-set-top{background:color-mix(in srgb,var(--muscle) 24%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--muscle) 70%,transparent)}
#gymPage .ly-hs-name{display:inline-flex;align-items:center;padding:2px 10px;border-radius:99px;font-size:12px!important;font-weight:800!important;letter-spacing:.02em;color:#c7d2fe!important;background:rgba(129,140,248,.14);border:1px solid rgba(129,140,248,.35)}
html[data-theme="light"] #gymPage .ly-hs-name{color:#3730a3!important;background:rgba(99,102,241,.1)}

/* Edit saved workout: floating glass panel in the Gym colours */
#editHistoryModal{background:rgba(4,6,12,.55)!important;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
#editHistoryModal .dialog{width:min(460px,calc(100vw - 32px))!important;padding:24px!important;border-radius:22px!important;background:radial-gradient(120% 90% at 0% 0%,rgba(157,174,255,.18),transparent 55%),linear-gradient(160deg,rgba(34,40,64,.88),rgba(16,19,30,.92))!important;border:1px solid rgba(255,255,255,.1)!important;box-shadow:0 30px 70px rgba(0,0,0,.55),inset 0 1px 0 rgba(255,255,255,.06)!important;backdrop-filter:blur(22px) saturate(1.2);-webkit-backdrop-filter:blur(22px) saturate(1.2)}
#editHistoryModal h2{margin:0!important;font-size:20px;color:#fff}
#editHistoryModal .ly-eh-nth{display:inline-flex;margin:8px 0 6px;padding:3px 11px;border-radius:99px;font-size:12px;font-weight:800;color:#c7d2fe;background:rgba(129,140,248,.14);border:1px solid rgba(129,140,248,.3)}
#editHistoryModal .ly-eh-nth:empty{display:none}
#editHistoryModal label{color:#a9b4d6!important;font-weight:700}
#editHistoryModal input{background:rgba(255,255,255,.05)!important;border:1px solid rgba(255,255,255,.12)!important;border-radius:12px!important;color:#fff!important;box-shadow:none!important}
#editHistoryModal input:focus{border-color:rgba(157,174,255,.7)!important;box-shadow:0 0 0 3px rgba(157,174,255,.18)!important;outline:none}
#editHistoryModal .tiny{color:#8f9ab8!important}
#editHistoryModal .dialog-actions{display:flex;gap:10px}
#editHistoryModal .dialog-actions button{flex:1;min-height:46px;border-radius:14px!important;font-weight:800!important;box-shadow:none!important}
#editHistoryModal .dialog-actions .ghost{background:rgba(255,255,255,.06)!important;border:1px solid rgba(255,255,255,.14)!important;color:#e7eaf5!important}
#editHistoryModal .dialog-actions button:not(.ghost){background:linear-gradient(115deg,#8b9cf8,#b4c3ff)!important;border:1px solid rgba(255,255,255,.25)!important;color:#141b3a!important}

/* Show / Hide exercises: one full-width bar, text and arrow centred, tap anywhere */
#gymPage .wk-details>summary{display:flex!important;width:100%;box-sizing:border-box;justify-content:center;align-items:center;gap:10px;min-height:46px;padding:0 16px!important;border-radius:14px!important;background:transparent!important;border:1px solid rgba(255,255,255,.12)!important;transition:background .15s,border-color .15s}
#gymPage .wk-details>summary:hover{background:transparent!important;border-color:rgba(255,255,255,.22)!important}
#gymPage .wk-details>summary:focus-visible{outline:2px solid rgba(157,174,255,.7);outline-offset:2px}

/* Session stats box fits inside the card on phones (no spill to the right) */
@media(max-width:640px){
 #gymPage table.ly-hs-stats{table-layout:fixed;width:calc(100% + 54px)!important;max-width:calc(100% + 54px);min-width:0!important;box-sizing:border-box}
 #gymPage .ly-hs-stats th,#gymPage .ly-hs-stats td{padding:8px 10px;overflow:hidden;text-overflow:ellipsis}
 #gymPage .ly-hs-stats th{font-size:10px;letter-spacing:.05em}
 #gymPage .ly-hs-stats td{font-size:14px}
}

/* Session edit / delete: translucent icon buttons at the top of each session */
#gymPage .ly-hs-actions{display:flex;gap:8px;margin:4px 0 2px}
#gymPage .ly-icon-act{display:inline-grid;place-items:center;width:38px;height:38px;min-height:38px!important;padding:0!important;margin:0!important;border-radius:12px!important;background:rgba(255,255,255,.04)!important;border:1px solid rgba(255,255,255,.12)!important;color:#d9def0!important;box-shadow:none!important;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);cursor:pointer;transition:background .18s,border-color .18s,color .18s,transform .12s,box-shadow .18s}
#gymPage .ly-icon-act svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
#gymPage .ly-icon-act:hover,#gymPage .ly-icon-act:focus-visible{background:rgba(165,180,252,.12)!important;border-color:rgba(165,180,252,.55)!important;color:#fff!important;box-shadow:0 0 0 3px rgba(165,180,252,.14),0 0 18px rgba(165,180,252,.25)!important;transform:translateY(-1px);outline:none}
#gymPage .ly-icon-del{color:#fca5a5!important;border-color:rgba(248,113,113,.22)!important;background:rgba(248,113,113,.05)!important}
#gymPage .ly-icon-del:hover,#gymPage .ly-icon-del:focus-visible{background:rgba(248,113,113,.14)!important;border-color:rgba(248,113,113,.6)!important;color:#fecaca!important;box-shadow:0 0 0 3px rgba(248,113,113,.14),0 0 18px rgba(248,113,113,.25)!important}
html[data-theme="light"] #gymPage .ly-icon-act{background:rgba(20,30,60,.04)!important;border-color:rgba(20,30,60,.14)!important;color:#2b3150!important}
html[data-theme="light"] #gymPage .ly-icon-del{color:#b91c1c!important}

/* Secondary buttons in the Gym (e.g. Show/Hide hidden routines): see-through, outlined in the section colour */
#gymPage button.ghost{background:linear-gradient(135deg,color-mix(in srgb,var(--active-category,#9658f5) 14%,transparent),rgba(255,255,255,.02))!important;border:1px solid color-mix(in srgb,var(--active-category,#9658f5) 45%,transparent)!important;color:#eef0fb!important;box-shadow:none!important;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);transition:background .18s,border-color .18s,box-shadow .18s,transform .12s}
#gymPage button.ghost:hover,#gymPage button.ghost:focus-visible{background:linear-gradient(135deg,color-mix(in srgb,var(--active-category,#9658f5) 26%,transparent),rgba(255,255,255,.04))!important;border-color:color-mix(in srgb,var(--active-category,#9658f5) 80%,transparent)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--active-category,#9658f5) 16%,transparent),0 0 18px color-mix(in srgb,var(--active-category,#9658f5) 24%,transparent)!important;transform:translateY(-1px);outline:none}
html[data-theme="light"] #gymPage button.ghost{color:#1b1f3a!important}
