/* ---- overlay + modal shell ---- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(6,5,15,.92); backdrop-filter: blur(20px); display: flex; align-items: flex-end; justify-content: center; opacity: 0; animation: fadein .28s forwards; }
@media(min-width:600px) { .overlay { align-items: center; padding: 20px; } }
@keyframes fadein { to { opacity: 1; } }
.modal { width: 100%; max-width: 500px; max-height: 82vh; overflow-y: auto; background: rgba(10,8,24,0.98); border: 1px solid rgba(168,85,247,0.3); border-radius: 22px 22px 0 0; padding: 22px 18px 30px; box-shadow: 0 -20px 60px -10px rgba(0,0,0,.95), 0 0 50px -15px var(--glow-purple-soft); }
@media(min-width:600px) { .modal { border-radius: 22px; } }
.modal-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-family: 'DM Sans', system-ui, sans-serif; font-weight: 600; font-size: 19px; }
.modal-close { background: none; border: none; color: var(--ink-faint); font-size: 20px; cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: var(--ink); }
.modal-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 16px; }
.section-div { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--card-line); }
.section-div-lbl { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: 10px; }

/* ---- action sheet ---- */
.action-sheet { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.action-item { width: 100%; font-family: inherit; font-size: 14px; font-weight: 600; padding: 13px 16px; border-radius: 11px; border: 1px solid var(--card-line-strong); background: rgba(255,255,255,.04); color: var(--ink); cursor: pointer; text-align: left; transition: .18s; display: flex; align-items: center; gap: 10px; }
.action-item:hover { background: rgba(255,255,255,.09); }
.action-item .ai-ico { width: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.action-item.danger { color: var(--rose); border-color: rgba(233,150,124,.25); background: rgba(233,150,124,.06); }
.action-item.danger:hover { background: rgba(233,150,124,.14); }
.action-item:disabled { opacity: .35; cursor: default; }
.action-divider { height: 1px; background: var(--card-line); margin: 4px 0; }

/* ---- sticky editor (preset + week template) ---- */
.editor-modal { display: flex !important; flex-direction: column; overflow: hidden !important; padding: 0 !important; max-height: 82vh; }
.editor-head { padding: 20px 18px 14px; flex-shrink: 0; border-bottom: 1px solid var(--card-line); }
.editor-body { flex: 1; overflow-y: auto; min-height: 0; padding: 14px 18px; }
.editor-foot { padding: 12px 18px 20px; border-top: 1px solid var(--card-line); flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; background: transparent; }

/* ---- recursive exercise editor ---- */
.edit-ex-card { background: transparent; border: none; border-left: 2px solid rgba(168,85,247,0.25); border-radius: 0; padding: 10px 0 10px 14px; margin-bottom: 12px; }
.edit-ex-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.edit-ex-name { font-weight: 600; font-size: 13.5px; flex: 1; }
.add-set-btn { font-family: inherit; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--card-line-strong); background: rgba(255,255,255,.05); color: var(--ink-faint); cursor: pointer; transition: .15s; margin-left: 6px; vertical-align: middle; }
.add-set-btn:hover { color: var(--purple); border-color: rgba(168,85,247,.4); }
.rm-set-btn { background: none; border: none; color: rgba(255,255,255,.18); cursor: pointer; font-size: 11px; padding: 0 2px; line-height: 1; transition: color .15s; margin-left: 1px; }
.rm-set-btn:hover { color: var(--rose); }
.edit-back-btn { font-family: inherit; font-size: 12px; background: none; border: none; color: var(--ink-faint); cursor: pointer; padding: 0; transition: color .18s; display: flex; align-items: center; gap: 4px; }
.edit-back-btn:hover { color: var(--ink); }
.editor-add-ex { width: 100%; font-family: inherit; font-size: 13px; font-weight: 600; padding: 10px; border-radius: 10px; border: 1px dashed var(--card-line-strong); background: rgba(255,255,255,.03); color: var(--ink-faint); cursor: pointer; transition: .18s; margin-top: 4px; }
.editor-add-ex:hover { border-color: rgba(168,85,247,.4); color: var(--purple); }
.ex-name-input { background: rgba(0,0,0,.25); border: 1px solid var(--card-line-strong); border-radius: 7px; color: var(--ink); font-family: inherit; font-size: 13px; font-weight: 600; padding: 3px 8px; width: 100%; }
.ex-name-input:focus { outline: none; border-color: var(--purple); }

/* ---- picker ---- */
.pick-filters { display: flex; gap: 6px; margin-bottom: 11px; }
.pf { font-family: inherit; font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 7px; border: 1px solid var(--card-line); background: rgba(255,255,255,.04); color: var(--ink-faint); cursor: pointer; transition: .15s; }
.pf.on { background: rgba(255,255,255,.1); color: var(--ink); border-color: var(--card-line-strong); }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-item { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.04); border: 1px solid var(--card-line); border-radius: 11px; padding: 10px 13px; cursor: pointer; transition: .18s; }
.pick-item:hover { background: rgba(168,85,247,.12); border-color: rgba(168,85,247,.4); }
.pi-name { font-weight: 600; font-size: 13.5px; flex: 1; }
.pi-sub { font-size: 11.5px; color: var(--ink-faint); white-space: nowrap; }
.pick-empty { font-size: 13px; color: var(--ink-faint); font-style: italic; text-align: center; padding: 20px; }

/* ---- form fields ---- */
.mfield { margin-top: 14px; }
.mfield label { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 600; margin-bottom: 6px; }
.mfield input[type=text] { width: 100%; background: rgba(0,0,0,.3); border: 1px solid var(--card-line-strong); border-radius: 10px; color: var(--ink); font-family: inherit; font-size: 15px; padding: 10px 12px; }
.mfield input[type=text]:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 2px rgba(168,85,247,.18); }
.type-tog { display: flex; gap: 7px; margin-top: 5px; }
.topt { flex: 1; font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px; border-radius: 9px; border: 1px solid var(--card-line-strong); background: rgba(255,255,255,.04); color: var(--ink-faint); cursor: pointer; transition: .18s; text-align: center; }
.topt.sl { background: rgba(168,85,247,.15); border-color: rgba(168,85,247,.4); color: var(--purple); }
.topt.sc { background: rgba(255,181,71,.15); border-color: rgba(255,181,71,.4); color: var(--amber); }
.mfooter { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
/* modal buttons — use shared .btn system */
.btn-pri { display: flex; width: 100%; justify-content: center; }
/* btn-pri inherits .btn .btn-solid via JS classes — applied below as override */
.btn-pri { border: 1px solid var(--purple); color: var(--purple); background: transparent; box-shadow: 0 0 20px -8px var(--glow-purple); font-family: inherit; font-size: 13.5px; font-weight: 600; padding: 13px; border-radius: 10px; cursor: pointer; transition: background .22s, box-shadow .22s, color .22s, transform .1s; letter-spacing: .02em; }
.btn-pri:hover { background: rgba(168,85,247,0.1); box-shadow: 0 0 30px -6px var(--glow-purple); color: #fff; }
.btn-pri:active { transform: scale(.97); }
.btn-ghost { font-family: inherit; font-size: 13px; background: none; border: none; color: var(--ink-faint); cursor: pointer; transition: color .18s; text-align: center; }
.btn-ghost:hover { color: var(--ink); }

/* ---- exercise checklist (preset builder) ---- */
.ex-check-list { display: flex; flex-direction: column; gap: 5px; max-height: 240px; overflow-y: auto; margin-top: 4px; }
.ex-check { display: flex; align-items: center; gap: 9px; background: rgba(255,255,255,.03); border: 1px solid var(--card-line); border-radius: 9px; padding: 8px 11px; cursor: pointer; transition: .15s; }
.ex-check:hover { background: rgba(255,255,255,.07); }
.ex-check.checked { background: rgba(168,85,247,.1); border-color: rgba(168,85,247,.3); }
.ck-box { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--card-line-strong); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.ex-check.checked .ck-box { background: var(--purple); border-color: var(--purple); color: #04111e; }
.ck-name { font-size: 13px; font-weight: 600; flex: 1; }
