:root{
    --bg:#0f1115; --panel:#171a21; --line:#232838;
    --text:#eef1f7; --muted:#96a0b8;
    --accent:#5b8cff; --accent-2:#7aa5ff;
    --danger:#ff5b6e; --ok:#36c98f; --warn:#f7b955;
    --shadow:0 6px 20px rgba(0,0,0,.25);
    --shadow-lg:0 10px 28px rgba(0,0,0,.35);
  }
  
  /* ========== Base / Resets ========== */
  *{ box-sizing:border-box; }
  html,body{
    margin:0; padding:0;
    background:var(--bg); color:var(--text);
    font:16px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
    -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  }
  img{ max-width:100%; height:auto; display:block; }
  a{ color:inherit; }
  
  /* ========== Layout ========== */
  .container{ max-width:1000px; margin:0 auto; padding:16px; }
  .row{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
  
  /* Top bar */
  header.topbar{ background:var(--panel); border-bottom:1px solid var(--line); }
  .brand a{ color:var(--text); text-decoration:none; font-weight:700; font-size:20px; }
  .nav a{ color:var(--muted); text-decoration:none; margin-left:14px; }
  .nav a:hover{ color:var(--text); }

  /* ===== Center brand in header ===== */
.brand-center {
  flex: 1;
  text-align: center;
}

.brand-center .brand a {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
}
  
  /* Headings */
  h1,h2,h3{ margin:10px 0 6px; }
  h1{ font-size:28px; }
  h2{ font-size:22px; }
  h3{ font-size:18px; }
  
  /* Muted text helper */
  .muted{ color:var(--muted); }
  
  /* ========== Buttons & Links ========== */
  a.btn,button.btn{
    background:var(--accent); color:#fff;
    padding:10px 14px; border:0; border-radius:10px;
    text-decoration:none; display:inline-flex; align-items:center; gap:8px;
    cursor:pointer; font-weight:600; transition:filter .15s ease, transform .06s ease;
  }
  a.btn:hover,button.btn:hover{ filter:brightness(1.08); transform:translateY(-1px); }
  a.btn:active,button.btn:active{ transform:translateY(0); }
  
  button.btn-danger{
    background:var(--danger); color:#fff;
    border:0; border-radius:10px; padding:8px 12px; cursor:pointer; font-weight:600;
    transition:filter .15s ease, transform .06s ease;
  }
  button.btn-danger:hover{ filter:brightness(1.08); transform:translateY(-1px); }

  .btn-danger.btn-text {
    background: none;
    border: none;
    color: #c62828;   /* soft red */
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin: 0 4px;
    transition: color 0.2s ease;
  }
  
  .btn-danger.btn-text:hover {
    color: #ff3b30;   /* brighter red on hover */
    text-decoration: underline;
  }
  
  .link-btn{
    background:transparent !important; color:var(--muted) !important;
    border:1px solid var(--line); font-weight:600;
  }
  .link-btn:hover{ color:var(--text) !important; }
  
  .btn-sm{ padding:6px 10px; font-size:14px; border-radius:8px; }
  .btn-ghost{ background:transparent; border:1px solid var(--line); color:var(--text); }
  
  /* ========== Badges / Chips ========== */
  .badge{
    display:inline-block; padding:2px 8px; border-radius:999px;
    font-size:12px; font-weight:700; letter-spacing:.02em;
    border:1px solid var(--line); color:var(--muted);
  }
  .badge.ok{ color:#c9ffe7; border-color:#1f634d; background:rgba(54,201,143,.08); }
  .badge.warn{ color:#ffe9c2; border-color:#7a5b16; background:rgba(247,185,85,.12); }
  .badge.danger{ color:#ffd7dc; border-color:#7a1f29; background:rgba(255,91,110,.10); }
  .badge.accent {
    color: #dbe6ff;
    border-color: #2b3d73;
    background: rgba(91,140,255,.12);
  }

  /* ========== Tables ========== */
  table{
    width:100%; border-collapse:separate; border-spacing:0;
    background:var(--panel); border:1px solid var(--line);
    border-radius:12px; overflow:hidden;
  }
  thead th{
    background:#1b2030; color:var(--muted);
    text-align:left; font-weight:600; position:relative;
  }
  td,th{ padding:10px 12px; border-bottom:1px solid var(--line); }
  tbody tr:hover{ background:#141824; }
  td.actions{ display:flex; gap:8px; align-items:center; }
  td.actions form{ display:inline; margin:0; }
  tbody tr.subhead td{
    background:#1b2030; color:var(--muted); font-weight:600;
  }
  .table-compact td,.table-compact th{ padding:8px 10px; }
  
  /* Sticky table header (optional) */
  .table-sticky thead th{
    position:sticky; top:0; z-index:1;
  }
  
  /* ========== Cards ========== */
  .card{
    background:var(--panel); border:1px solid var(--line);
    border-radius:14px; padding:16px; box-shadow:var(--shadow);
    margin-top:12px;
  }
  .card h3{ margin:0 0 12px; font-size:20px; }
  
  /* Card grid (dashboard defaults to responsive; workout uses .vertical to force stack) */
  .card-grid{
    display:grid; gap:16px;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
    margin:16px 0;
  }
  .card-grid.vertical{
    grid-template-columns:1fr; gap:20px;
  }
  
  /* KPI card hover nicety */
  .kpi-card{
    position:relative; transition:transform .06s ease, box-shadow .2s ease, border-color .2s ease;
  }
  .kpi-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); border-color:var(--accent); }
  .card-overlay-link{
    position:absolute; inset:0; z-index:5; text-indent:-9999px; /* keep whole card clickable */
  }
  
  /* ========== Forms ========== */
  form{ display:grid; gap:16px; max-width:560px; }
  label{ display:grid; gap:6px; color:var(--muted); }
  
  input,select{
    background:#0d1017; color:var(--text);
    border:1px solid var(--line); border-radius:10px;
    padding:10px 12px; font-size:15px; outline:none;
    transition:border-color .15s ease, box-shadow .15s ease;
  }
  input::placeholder{ color:#6d7996; }
  input:focus,select:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px rgba(91,140,255,.15);
  }
  
  fieldset{
    border:1px dashed var(--line);
    border-radius:12px; padding:12px;
  }
  legend{ color:var(--muted); padding:0 6px; }
  
  /* Form grids */
  .grid-2{ display:grid; gap:12px; grid-template-columns:1fr 1fr; }
  .grid-3{ display:grid; gap:12px; grid-template-columns:1fr 1fr 1fr; }
  @media (max-width:720px){
    .grid-2,.grid-3{ grid-template-columns:1fr; }
  }
  
  /* ========== Utilities ========== */
  .sep{ height:1px; background:var(--line); margin:10px 0; }
  .right{ margin-left:auto; }
  .center{ text-align:center; }
  .nowrap{ white-space:nowrap; }
  .w-100{ width:100%; }
  .dim{ opacity:.8; }
  .hide{ display:none !important; }
  .right-aligned-div {
    float: right;
  }
  
  
  /* ========== Workout-specific niceties ========== */  
  /* Variant / lift chips (use in templates if you want) */
  .chip{ display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; border:1px solid var(--line); color:var(--muted); }
  .chip.rpe{ color:#cfe0ff; border-color:#2b3d73; background:rgba(91,140,255,.10); }
  .chip.pct{ color:#e5f0ff; border-color:#2b3d73; background:rgba(91,140,255,.08); }
  .chip.bk{ color:#ffe1e6; border-color:#7a2a36; background:rgba(255,91,110,.10); }

  /* ---- Accessories list styling ---- */
  .acc-list{
    display:grid; gap:10px;
  }
  .acc-item{
    border:1px solid var(--line);
    border-radius:12px;
    padding:12px;
    background:#141824;
  }
  .acc-item:hover{
    box-shadow:var(--shadow);
  }
  .acc-head{
    display:flex; align-items:center; gap:10px; justify-content:space-between; flex-wrap:wrap;
  }
  .acc-name{ font-size:16px; }
  .acc-meta{ margin-top:4px; display:flex; gap:8px; flex-wrap:wrap; }
  .acc-actions{ margin-top:8px; }

  /* Modal layout */
.modal{
    position: fixed;
    inset: 0;              /* top/right/bottom/left: 0 */
    display: none;         /* JS toggles to block */
    z-index: 1000;
  }
  .modal-backdrop{
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
  }
  .modal-card{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);  /* centers the card */
    width: min(560px, 92vw);
    max-height: 85vh;
    overflow: auto;
  
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    padding: 16px;
  }
  
  /* Optional: prevent background scroll when modal is open */
  body.modal-open{ overflow: hidden; }
  
  /* Header bits (optional polish) */
  .modal-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
  }
  .modal-close{
    background: transparent;
    border: 0;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }
  .modal-close:hover{ color: var(--text); }

  .dest-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
  }
  
  .dest-item {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    background: #0d1017;
    outline: none;
  }
  
  .dest-item:hover,
  .dest-item:focus {
    border-color: var(--text);
  }
  
  .dest-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, #0d1017);
  }

  .switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
  }
  
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0;
    right: 0; bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
  }
  
  .slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
  }
  
  input:checked + .slider {
    background-color: #4CAF50; /* green */
  }
  
  input:checked + .slider:before {
    transform: translateX(24px);
  }

/* Optional: stronger destructive panel for delete account content */
.danger-panel{
  background: #1a0f12;             /* deep crimson-black */
  border: 1px solid var(--danger);
  color: #ffd7dc;
  padding: 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

/* ========= Header / Menu (moved from base.html) ========= */

/* Keep header consistent with your theme */
.topbar { position: relative; z-index: 5; }

/* Layout helpers already exist: .container, .row, .brand, .spacer */

/* Welcome text tone */
.welcome-banner { display:flex; align-items:center; gap:.75rem; color: var(--muted); }

/* vertical layout helper for stacked cards */
.stack { display: grid; gap: 20px; }

/* ===== Global mobile polish (app-wide) ===== */

/* Prevent mysterious horizontal scrollbars */
html, body { overflow-x: hidden; }
#wv, #wv .card { overflow-x: hidden; }
#wv table { overflow-x: hidden; }      /* scope overflow hiding to workout viewer only */

/* Make text scale nicely on iOS */
html { -webkit-text-size-adjust: 100%; }

/* Containers & rows */
.container { padding-left: 16px; padding-right: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 768px){
  .container { padding-left: 14px; padding-right: 14px; }
  .row { gap: 10px; }
}
@media (max-width: 480px){
  .container { padding-left: 12px; padding-right: 12px; }
  .row { gap: 8px; }
}

/* Headings scale a bit on small screens */
@media (max-width: 640px){
  h1 { font-size: 24px; line-height: 1.25; }
  h2 { font-size: 20px; line-height: 1.3; word-break: break-word; }
  h3 { font-size: 18px; }
}

/* Cards */
.card { margin-top: 12px; }
@media (max-width: 640px){
  .card { padding: 14px; border-radius: 12px; }
}

/* Buttons: big tap targets, easy stacking */
a.btn, button.btn { min-height: 44px; }
.btn.block { width: 100%; justify-content: center; }
@media (max-width: 640px){
  .btn-sm { padding: 10px 12px; min-height: 40px; }
}

/* Form layout */
form { width: 100%; }
label { display: grid; gap: 6px; }
input, select, textarea { width: 100%; max-width: 100%; }
.grid-2, .grid-3 { gap: 12px; }
@media (max-width: 760px){
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
input::placeholder { opacity: .9; }

/* If you truly need fixed layout somewhere, opt-in with .table-fixed */
.table-fixed { table-layout: fixed; }

/* Opt-in responsive table: add class="rtable" in templates */
.rtable { border-collapse: separate; border-spacing: 0; }
@media (max-width: 640px){
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { border-top: 1px solid var(--line); padding: 12px 10px; }
  .rtable td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 6px 0;
  }
  .rtable td::before {
    content: attr(data-label);
    color: var(--muted); font-weight: 600; margin-right: 12px; flex: 0 0 auto;
  }
  /* Keep action buttons from squishing labels */
  .rtable td.actions { justify-content: flex-end; }
  .rtable td.actions .btn { white-space: nowrap; }
}

/* Set logging rows */
.set-row { display: flex; flex-wrap: wrap; gap: 10px; }
.table-input { flex: 1 1 140px; max-width: 100%; min-height: 44px; }

/* Sticky bottom action bar for Complete/Cancel */
.workout-action-bar { margin-top: 12px; display: flex; gap: 10px; }
@media (max-width: 640px){
  .workout-action-bar {
    position: sticky; bottom: 0; z-index: 5;
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 12px; box-shadow: 0 -8px 24px rgba(0,0,0,.25);
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  }
  .workout-action-bar.single { grid-template-columns: 1fr; }
}

/* Header/nav small tweaks */
header.topbar { position: sticky; top: 0; z-index: 50; }
.welcome-banner { gap: .5rem; }
@media (max-width: 640px){
  .brand a { font-size: 18px; }
  .nav a { margin-left: 10px; }
}

/* Utilities */
.stack-sm > * + * { margin-top: 8px; }
.hide-on-mobile { display: initial; }
@media (max-width: 640px){ .hide-on-mobile { display: none !important; } }

/* Images */
img { max-width: 100%; height: auto; }

/* ===== Workout Viewer: Core blocks, mobile-first polish ===== */

/* Scope to workout viewer to avoid collateral damage */
#wv { overflow-x: hidden; }
#wv .card { overflow-x: hidden; }

/* --- Core header meta (the little table at the top of each core) --- */
/* Works whether you used a table or simple rows */
#wv .core-meta,
#wv .core .rtable { width: 100%; }

/* On mobile, present as tidy label/value rows */
@media (max-width: 640px){
  /* Hide thead if it's a table */
  #wv .core .rtable thead { display: none; }

  /* Turn every table row into a block row with label/value */
  #wv .core .rtable tbody,
  #wv .core .rtable tr { display: block; width: 100%; }

  #wv .core .rtable tr {
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }

  #wv .core .rtable td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 2px;
    white-space: normal;
    word-break: break-word;
  }
  /* If you already add data-label on TDs, this keeps it styled */
  #wv .core .rtable td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
    margin-right: 12px;
  }
}

/* --- Set logger layout --- */
#wv .set-row { display: grid; gap: 10px; }

/* Desktop/tablet: inputs side-by-side, Save on the right */
@media (min-width: 641px){
  /* two inputs + button (adjust if you have 3 inputs) */
  #wv .set-row { grid-template-columns: 1fr 1fr auto; align-items: end; }
}

/* Mobile: stack everything full-width */
@media (max-width: 640px){
  #wv .set-row { grid-template-columns: 1fr; }
}

/* Inputs should stretch, be tappable, and never overflow */
#wv .set-row input,
#wv .set-row select,
#wv .set-row textarea,
#wv .table-input {
  width: 100%;
  max-width: 100%;
  min-height: 44px;  /* good tap target */
  font-size: 16px;   /* avoid iOS zoom */
}

/* Save button: no wrapping, consistent size */
#wv .set-row .btn,
#wv .set-row button[type="submit"] {
  white-space: nowrap;
  min-height: 44px;
}

/* On mobile, make Save full-width and anchor it visually */
@media (max-width: 640px){
  #wv .set-row .btn,
  #wv .set-row button[type="submit"] {
    width: 100%;
    justify-content: center;
  }
}

/* “Locked until previous set…” pills — ensure they fill width nicely */
#wv .locked-pill {
  width: 100%;
  display: block;
  min-height: 44px;
  line-height: 44px;
  border-radius: 10px;
  padding: 0 12px;
}

/* Unit toggle at header right should not shove content off-screen */
#wv .core .unit-toggle { flex: 0 0 auto; }
@media (max-width: 640px){
  /* if it’s in the title row, let it wrap under the title gracefully */
  #wv .core .title-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  #wv .core .title-row > * { min-width: 0; }
}

/* Spacing tweaks so the card looks less “stacked boxes” on mobile */
@media (max-width: 640px){
  #wv .core-card { padding: 12px; }
  #wv .core-card .inner { padding: 10px; border-radius: 12px; }
}

/* Make sure long numbers/labels don’t cause horizontal scroll */
#wv th, #wv td { white-space: normal; word-break: break-word; }

/* Action bar at bottom (if you use it) stays clean */
@media (max-width: 640px){
  .workout-action-bar { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; z-index: 5; }
  .workout-action-bar.single { grid-template-columns: 1fr; }
}

/* Invite table actions: keep buttons tidy on mobile */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px){
  .right { text-align: left; }          /* don't push buttons off-screen */
  .rtable td { align-items: center; }   /* nicer label/value alignment */
}

/* ===== Flash (single source of truth) ===== */
.flash{ background:#141824; border:1px solid var(--line); color:var(--text); padding:10px 12px; border-radius:10px; }
.flash.success{ background: rgba(54,201,143,.12); border-color:#1f634d; color:#c9ffe7; }
.flash.warning{ background: rgba(247,185,85,.14); border-color:#7a5b16; color:#ffe9c2; }
.flash.error{   background: rgba(255,91,110,.14); border-color:#7a1f29; color:#ffd7dc; }
.flash.info{    background: rgba(91,140,255,.14); border-color:#2b3d73; color:#dbe6ff; }

/* ===== Menu & Backdrop (single, fixed-position version) ===== */
:root { --z-veil: 99998; --z-menu: 99999; }

/* Keep your existing #userMenuBtn styles if you like them; otherwise use this: */
#userMenuBtn {
  -webkit-appearance: none; appearance: none;
  border: 1px solid var(--line);
  background: #1b1e27;
  color: var(--text);
  font-size: .95rem; font-weight: 700; line-height: 1;
  border-radius: 10px; cursor: pointer; padding: .65rem .9rem;
  display: inline-flex; align-items: center; gap: .5rem;
  box-shadow: var(--shadow);
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease, border-color .15s ease;
}
#userMenuBtn:hover { background:#181b23; border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
#userMenuBtn:active { transform: translateY(1px); }
#userMenuBtn:focus { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

/* One menu */
.menu{
  position: fixed; top: calc(100% + 8px); /* JS should place it under the button */
  z-index: var(--z-menu);
  min-width: 240px;
  background: #101421;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: .35rem 0;
}
.menu[hidden]{ display: none !important; }
.menu a, .menu button{
  display:block; width:100%; text-align:left; padding:.6rem .9rem;
  border:0; background:none; color:var(--text); cursor:pointer;
}
.menu a:hover, .menu button:hover{ background:#141a2a; }
.menu hr{ border:0; border-top:1px solid var(--line); margin:.35rem 0; }

/* Backdrop just beneath the menu */
.menu-backdrop{
  position: fixed; inset: 0; z-index: var(--z-veil);
  background: transparent;
}
.menu-backdrop[hidden]{ display: none !important; }

/* ===== Tables – sane defaults ===== */
table { width: 100%; /* no global fixed layout */ }
th, td { white-space: normal; word-break: normal; }
/* Only use fixed layout where you explicitly need it */
.table-fixed { table-layout: fixed; }

/* ===== rtable (mobile stack) ===== */
@media (max-width: 640px){
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { border-top: 1px solid var(--line); padding: 12px 10px; }
  .rtable td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 6px 0;
  }
  .rtable td::before {
    content: attr(data-label);
    color: var(--muted); font-weight: 600; margin-right: 12px; flex: 0 0 auto;
  }
  /* Key fix: make colspan logger cells full-width without a label gutter */
  .rtable td[colspan] { display: block; padding-left: 0; padding-right: 0; }
  .rtable td[colspan]::before { content: none !important; }
  .rtable td[colspan] > .card { width: 100%; margin-left: 0; margin-right: 0; }
}

/* ===== Workout viewer specific ===== */
#wv, #wv .card, table { overflow-x: hidden; }

/* Use AUTO layout inside workout viewer so the logger isn’t squished */
#wv table { table-layout: auto; width: 100%; }
#wv th, #wv td { white-space: normal; word-break: break-word; }

/* Set logger grid: 2 inputs + Save on wide screens, stacked on mobile */
#wv .set-row { display: grid; gap: 10px; }
@media (min-width: 641px){ #wv .set-row { grid-template-columns: 1fr 1fr auto; align-items: end; } }
@media (max-width: 640px){ #wv .set-row { grid-template-columns: 1fr; } }

#wv .set-row input, #wv .set-row select, #wv .set-row textarea, #wv .table-input{
  width: 100%; max-width: 100%; min-height: 44px; font-size: 16px;
}
#wv .set-row .btn, #wv .set-row button[type="submit"]{
  white-space: nowrap; min-height: 44px;
}
@media (max-width: 640px){
  #wv .set-row .btn, #wv .set-row button[type="submit"]{ width: 100%; justify-content: center; }
}
#wv .locked-pill{
  width: 100%; display: block; min-height: 44px; line-height: 44px;
  border-radius: 10px; padding: 0 12px;
}

.workout-list{ display:flex; flex-direction:column; gap:8px; }
.workout-row{
  display:flex; align-items:center; gap:10px; justify-content:space-between;
  background:#141824; border:1px solid var(--line); border-radius:10px;
  padding:12px 14px; text-decoration:none; color:var(--text);
  transition:background .15s ease, transform .06s ease;
}
.workout-row:hover{ background:#1a1e29; transform:translateY(-1px); }
.w-title{ font-weight:600; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.w-date{ color:var(--muted); font-size:14px; min-width:92px; text-align:right; }
.w-status .badge{ margin-left:8px; }

/* ===== Mobile: lean core card ===== */
@media (max-width: 640px){
  /* tighten core header + meta rows */
  #wv .core-card { padding: 12px; }
  #wv .core .rtable thead { display: none; }
  #wv .core .rtable, #wv .core .rtable tbody, #wv .core .rtable tr, #wv .core .rtable td {
    display: block; width: 100%;
  }
  #wv .core .rtable tr { border-top: 1px solid var(--line); padding: 8px 0; }
  #wv .core .rtable td {
    display:flex; align-items:center; justify-content:space-between;
    gap: 10px; padding: 6px 0;
  }
  #wv .core .rtable td::before{
    content: attr(data-label);
    color: var(--muted); font-weight: 600; margin-right: 12px; flex: 0 0 auto;
  }

  /* ===== Set rows → “chip + action” look ===== */
  #wv .set-row{
    display:flex; align-items:center; gap:10px; margin:8px 0;
    padding: 8px 10px; border:1px solid var(--line); border-radius:12px;
    background:#141824;
  }
  /* the round number chip */
  #wv .set-row .set-num{
    display:inline-flex; align-items:center; justify-content:center;
    width:28px; height:28px; border-radius:50%;
    border:1px solid var(--line); background:#0d1017; font-weight:700;
  }
  /* when a set is already logged */
  #wv .set-row.logged{ opacity:.9; }
  #wv .set-row.logged .set-num{ background: rgba(54,201,143,.12); border-color:#1f634d; }

  /* inputs/buttons compact */
  #wv .set-row .table-input{ flex:1 1 120px; min-height:40px; }
  #wv .set-row .btn{ min-height:40px; padding:8px 10px; }

  /* locked pill style */
  #wv .locked-pill{
    width:100%; min-height:40px; line-height:40px;
    border-radius:10px; padding:0 12px; opacity:.75;
    background:#0d1017; border:1px dashed var(--line);
  }
}

/* Desktop unchanged */
@media (min-width: 641px){
  #wv .set-row .set-num{ display:none; } /* keep old look on desktop */
}

/* Hide "Variant" column on phones */
@media (max-width: 640px){
  .rtable th.variant,
  .rtable td[data-label="Variant"]{
    display: none !important;
  }
}

/* Scheme column tidy look */
.rtable td[data-label="Scheme"] {
  font-weight: 600;
  color: var(--text);
}
.rtable td[data-label="Scheme"] .muted {
  color: var(--muted);
  font-weight: 400;
}

/* Mobile: tighter spacing and clean stacking */
@media (max-width: 640px){
  .rtable td[data-label="Scheme"] {
    justify-content: flex-start;
  }
}

@media (max-width: 640px){
  .rtable th.scheme,
  .rtable td[data-label="Scheme"]::before {
    display: none !important;
  }
}

/* Show both on desktop; hide the table's Suggested Range column on mobile */
@media (max-width:640px){
  .rtable .suggest-col { display: none !important; }
}

/* keep the inline suggestion tidy */
.set-row .suggest { margin-left: .5rem; }
@media (max-width:640px){
  .set-row .suggest { margin-left: .35rem; }
}

/* inline forms that shouldn't stretch */
.form-inline{
  display:inline-flex;              /* behave like a button */
  align-items:center;
  gap:8px;
  width:auto !important;            /* beat form { width:100% } */
  max-width:none !important;
  margin:0;                         /* kill default form spacing */
}

/* Show little “only on mobile” summaries under the name */
.only-mobile { display: none; }

@media (max-width: 640px){
  /* Hide these columns entirely on mobile */
  th.col-sex, td.col-sex,
  th.col-bw,  td.col-bw,
  th.col-dots,td.col-dots,
  th.col-sq, td.col-sq,
  th.col-bp, td.col-bp,
  th.col-dl, td.col-dl { display:none; }

  .only-mobile { display:block; }
}

.suggest-inline{
  font-size:12px;
  color:var(--muted);
  margin-left:8px;
  white-space:nowrap;
}

.suggest-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.9em;
}

.suggest-inline {
  color: var(--text-bright);
  font-weight: 500;
}

.suggest-inline span[data-unit-text] {
  opacity: 0.7;
  margin-left: 2px;
}

/* common badge styling */
.badge.ss {
  color: #333;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 2px 6px;
  border: 1px solid transparent;
}

/* pastel codes per SS group */
.badge.ss-a { background:#ffebeb; border-color:#ff7f7f; }
.badge.ss-b { background:#fff2e0; border-color:#ffb347; }
.badge.ss-c { background:#fff9d6; border-color:#ffe066; }
.badge.ss-d { background:#ecffe0; border-color:#9be564; }
.badge.ss-e { background:#e6f5ff; border-color:#64c7ff; }
.badge.ss-f { background:#f0e6ff; border-color:#c28eff; }

/* Superset card (one card per label) */
.ss-card {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-card);
  margin-bottom: 14px;
}

.ss-card__header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 10px 12px 6px;
}

.ss-card__body {
  border-top: 1px dashed var(--ui-border);
  padding: 10px 12px 12px;
  display: grid;
  gap: 12px;
}

/* inner exercise rows (no outer card chrome) */
.ss-row {
  padding-bottom: 10px;
}
.ss-row:not(:last-child) {
  border-bottom: 1px dashed var(--ui-border);
}

/* colored accent per group */
.ss-badge { font-weight: 600; }
.ss-a .ss-badge, .ss-card.ss-a { --ss: #4a90e2; }
.ss-b .ss-badge, .ss-card.ss-b { --ss: #16a34a; }
.ss-c .ss-badge, .ss-card.ss-c { --ss: #facc15; }
.ss-d .ss-badge, .ss-card.ss-d { --ss: #8b5cf6; }
.ss-e .ss-badge, .ss-card.ss-e { --ss: #0ea5e9; }
.ss-f .ss-badge, .ss-card.ss-f { --ss: #f43f5e; }

.ss-card { box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.ss-card[class*="ss-"] { border-left: 4px solid var(--ss); }
.ss-badge[class*="ss-"] { background: var(--ss, #666); color: #fff; }

/* add breathing room below solo accessories */
.card.acc-card {
  margin-bottom: 16px;
}

/* tighten the spacing between supersets and solos slightly */
.accessories .ss-card + .acc-card {
  margin-top: 8px;
}

/* Collapse animation */
.acc-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  opacity: 1;
}
.collapsible .collapsible__content {
  max-height: 1200px;
  overflow: hidden;
  opacity: 1;
  transition: max-height .25s ease, opacity .2s ease;
}
.collapsible.collapsed .collapsible__content {
  max-height: 0;
  opacity: 0;
}
.btn-icon.collapse-btn{ background:none; border:0; font-size:1.25rem; line-height:1; color:var(--muted); cursor:pointer; }
.btn-icon.collapse-btn:hover{ color:var(--text); }

/* --- Inline accessory logging row --- */
.set-row-form{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;          /* never wrap */
  width:100%;
}

/* Inputs flex; keep reasonable minimums */
.set-row-form .table-input{
  flex:1 1 0;
  min-width:72px;            /* so they don't collapse to dots */
  width:auto;                /* override any 100% rules */
  display:inline-block;      /* kill block-level 100% from form styles */
  height:36px;
}

/* Keep the Save button compact and on the right */
.set-row-form .btn.btn-sm{
  flex:0 0 auto;             /* do NOT grow */
  width:auto;                /* override width:100% globals */
  min-width:96px;            /* fixed readable size */
  margin-left:auto;          /* push to the far right */
  white-space:nowrap;
  height:36px;
}

/* If you have a global ".form .btn { width:100%; }", neutralize it here */
.set-row-form .btn{ width:auto !important; }

/* Core builder radio layout */
.field-group { margin-top: 10px; }
.field-label { font-weight: 600; margin-bottom: 4px; }

/* Keep radios directly beside text, stacked neatly */
.field-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  /* stop weird grid/flex parents from shoving this around */
  max-width: 100%;
}

.opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Make the radio slightly easier to hit in dark UI */
.opt input[type="radio"] {
  accent-color: var(--accent, #3b82f6);
  transform: scale(1.05);
}

.acc-lastbest { font-size: 12px; }

details.subsection > summary {
  list-style: none; /* removes default triangle on some browsers */
}
details.subsection[open] > summary h4::after,
details.subsection > summary h4::after {
  content: '';
}
details.subsection > summary h4 {
  display: inline-block;
}

/* Add to your CSS bundle */
.drag-placeholder {
  border: 2px dashed var(--muted,#bbb);
  border-radius: 8px;
  margin: 6px 0;
}
fieldset.dragging {
  opacity: .6;
}

.drag-image {
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
/* Hide the original list item while dragging so only the floating ghost is visible */
.reorder-item.dragging { opacity: 0; }