/* Learning-plan controls (plan-widgets.js), shared by /start and the dashboard schedule editor. Tokens from site.css;
   logical properties keep Arabic right-to-left layouts correct. */
.pw { min-width: 0; }
.pw > * + * { margin-top: 14px; }
.pw .option .opt-text { display: block; line-height: 1.45; }
.pw .option .opt-meta { display: block; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.opt-plans { display: block; font-size: .78rem; color: var(--emerald-deep); }
.opt-plans.limited { color: #7A5B1E; }
.option[disabled] .opt-plans.limited { color: #6B4E0F; }

/* Modes */
.options.modes { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.mode-card strong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--serif-head); font-size: 1.05rem; }
.mode-icon { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 50%; background: var(--sage-soft, #E8EFE9); color: var(--emerald-deep); flex: none; }
.mode-tag { display: block; font-weight: 600; color: var(--slate); margin-bottom: 2px; }
.mode-universal[aria-pressed='true'] .mode-icon { background: var(--emerald); color: #fff; }
.fmt-letter { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 6px; background: var(--navy); color: #fff; font: 600 .78rem/1 var(--sans); margin-inline-end: 8px; flex: none; }
.options.formats strong { display: flex; align-items: center; }
.pw-count { max-width: 520px; }
.pw-count input { width: 8rem; }

/* Panels, weights and mixes */
.pw-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 14px 16px; }
.pw-panel summary { cursor: pointer; }
.pw-panel[open] summary { margin-bottom: 10px; }
.pw-fields { max-height: 260px; overflow: auto; padding: 2px; }
.pw-weights { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.pw-weights li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pw-weights li > label, .pw-weights li > span:first-child { flex: 1 1 160px; }
.pw-other { border-top: 1px dashed var(--line); padding-top: 8px; color: var(--slate); }
.pw-pct { display: inline-flex; align-items: center; gap: 4px; }
.pw-pct input { width: 5.5rem; }
.pw-add { align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.pw-add .field { margin-bottom: 0; }
.pw-add select { min-width: 200px; max-width: 100%; }
.pw-add input { width: 6rem; }
.pw-problems { margin: 8px 0 0; padding-inline-start: 1.1em; color: var(--danger, #9B2C2C); }
.pw-mix { display: grid; gap: 10px; }
.pw-mix-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); }
.pw-mix-row label { flex: 1 1 200px; display: flex; flex-direction: column; }
.pw-total { margin: 0; font-weight: 600; color: var(--emerald-deep); }
.pw-total.off { color: #7A5B1E; }

/* Places and periods */
.pw-search label { display: flex; align-items: center; gap: 6px; }
.pw-tabs .chip { font-size: .85rem; }
.pw-places, .pw-periods { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-height: 380px; overflow: auto; padding: 2px; }
.pw-periods { max-height: none; }
.pw-place, .pw-period { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: start; gap: 2px; padding: 10px 12px; padding-inline-end: 34px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); font: inherit; color: inherit; cursor: pointer; }
.pw-place:hover, .pw-period:hover { border-color: var(--sage); }
.pw-place .tick, .pw-period .tick { position: absolute; top: 11px; inset-inline-end: 10px; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid #CDD2CC; }
.pw-place[aria-pressed='true'], .pw-period[aria-pressed='true'] { border-color: var(--emerald); background: #F3F8F5; }
.pw-place[aria-pressed='true'] .tick, .pw-period[aria-pressed='true'] .tick { background: var(--emerald); border-color: var(--emerald); box-shadow: inset 0 0 0 3px #fff; }
.pw-place[disabled] { opacity: .5; cursor: not-allowed; }
.pw-place:focus-visible, .pw-period:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pw-place-name { font-weight: 600; color: var(--navy); }
.chip-n { font-size: .75rem; opacity: .85; }
.pw-chosen .chips { margin-top: 6px; }
.pw-notes { margin: 0; padding-inline-start: 1.1em; }
.pw-range .row { align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.pw-range .field { margin-bottom: 0; }
.pw-range input { width: 8rem; }

/* Preview */
.pw-preview { margin-top: 28px; }
.pw-preview-title { font-size: 1.1rem; margin: 0 0 12px; }
.pw-items li { padding-block: 10px; }
.pw-note { margin-top: 10px; }
.pw-preview .sequence, .pw-items { list-style: none; counter-reset: seq; margin: 0; padding: 0; display: grid; gap: 8px; }
.pw-preview .sequence li { counter-increment: seq; position: relative; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; padding-inline-start: 48px; }
.pw-preview .sequence li::before { content: counter(seq); position: absolute; inset-inline-start: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font: 600 .78rem/24px var(--sans); text-align: center; }
.pw-preview .seq-title { font: 600 .98rem/1.4 var(--serif); color: var(--navy); }

@media (max-width: 640px) {
  .options.modes, .pw-places, .pw-periods { grid-template-columns: 1fr; }
  .pw-add select { min-width: 0; width: 100%; }
  .pw-add .field { flex: 1 1 100%; }
}
