/* ============================================================
   Toasts, sheets (settings/script), scorecard report
   ============================================================ */

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; bottom: var(--s-4); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); z-index: 60; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: var(--r-pill); font-weight: 600; font-size: var(--text-sm); background: var(--card-solid); border: 1px solid var(--hairline); box-shadow: var(--sh-3); display: flex; align-items: center; gap: 8px; animation: toast-in var(--dur-2) var(--spring); }
.toast.xp { color: var(--accent); }
.toast.penalty { color: var(--danger); }
.toast.badge { color: var(--gold); border-color: oklch(80% 0.13 85 / 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.92); } }
.toast.out { animation: toast-out var(--dur-2) var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Overlays + sheets ---------- */
.overlay { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: var(--s-4); background: oklch(40% 0.01 264 / 0.32); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade-in var(--dur-2); }
@keyframes fade-in { from { opacity: 0; } }
.sheet { width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; background: var(--card-solid); border: 1px solid var(--hairline); border-radius: var(--r-2xl); padding: var(--s-4); box-shadow: var(--sh-3); animation: sheet-in var(--dur-3) var(--spring); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(28px) scale(0.98); } }
.sheet-grip { width: 38px; height: 5px; border-radius: var(--r-pill); background: var(--fill); margin: -6px auto 14px; }
.sheet h2 { font-size: var(--text-xl); margin-bottom: var(--s-2); }
.sheet-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-4); flex-wrap: wrap; }
.settings-modal { display: flex; flex-direction: column; gap: var(--s-3); }

/* ---------- Scorecard ---------- */
.scorecard { width: min(820px, 100%); }
.sc-hero { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; padding-bottom: var(--s-3); border-bottom: 1px solid var(--hairline); }
.sc-grade-ring { position: relative; width: 150px; aspect-ratio: 1; flex-shrink: 0; }
.sc-grade-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sc-grade-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sc-grade-num b { font-family: var(--font-display); font-size: 2.8rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.sc-grade-num span { font-size: var(--text-2xs); color: var(--text-3); margin-top: 2px; }
.sc-hero-meta { flex: 1; min-width: 220px; }
.sc-hero-meta h2 { font-size: var(--text-2xl); }
.sc-tier { display: inline-flex; align-items: center; gap: 7px; margin-top: 8px; padding: 5px 14px; border-radius: var(--r-pill); font-weight: 600; font-size: var(--text-xs); }
.sc-stars { font-size: 1.4rem; letter-spacing: 4px; margin-top: 10px; color: var(--gold); }
.sc-xp-gain { font-size: var(--text-sm); color: var(--accent); margin-top: 10px; font-weight: 600; }
.sc-xp-gain.levelup { color: var(--gold); }

.sc-section { margin-top: var(--s-4); }
.sc-section > h3 { font-size: var(--text-xs); margin-bottom: var(--s-2); color: var(--text-3); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.sc-dim { margin-bottom: var(--s-3); }
.sc-dim-head { display: flex; justify-content: space-between; align-items: baseline; }
.sc-dim-name { font-weight: 600; font-size: var(--text-sm); }
.sc-dim-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-dim-track { height: 8px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; margin: 7px 0; }
.sc-dim-fill { height: 100%; border-radius: var(--r-pill); animation: grow-x var(--dur-3) var(--ease); transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(0); } }
.sc-dim-tip { font-size: var(--text-xs); color: var(--text-2); line-height: 1.5; }

.sc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
@media (max-width: 640px) { .sc-cols { grid-template-columns: 1fr; } }
.sc-cols h3 { font-size: var(--text-sm); margin-bottom: var(--s-2); }
.sc-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.sc-list li { font-size: var(--text-sm); padding: 10px 13px; border-radius: var(--r-md); background: var(--card-2); border-left: 3px solid; line-height: 1.45; }
.sc-list.good li { border-color: var(--accent); }
.sc-list.bad li { border-color: var(--warn); }

.sc-badges { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.sc-badge { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: var(--r-lg); background: oklch(80% 0.13 85 / 0.1); border: 1px solid oklch(80% 0.13 85 / 0.35); animation: sheet-in var(--dur-2) var(--spring); }
.sc-badge .emoji { font-size: 1.5rem; }
.sc-badge b { font-size: var(--text-sm); }
.sc-badge span { font-size: var(--text-xs); color: var(--text-3); display: block; }

.sc-ai { margin-top: var(--s-3); padding: var(--s-3); border-radius: var(--r-lg); background: var(--card-2); border: 1px solid var(--hairline); white-space: pre-wrap; font-size: var(--text-sm); line-height: 1.65; }
.sc-actions { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-4); flex-wrap: wrap; }

.sc-board { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.sc-board th, .sc-board td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--hairline); }
.sc-board th { color: var(--text-3); font-size: var(--text-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.sc-board tr.me { background: oklch(68% 0.17 152 / 0.08); }
.sc-board td.rank { font-weight: 700; color: var(--accent); }
.sc-board td.mono { font-variant-numeric: tabular-nums; }

/* ---------- Progress dashboard ---------- */
.menu-progress { width: 100%; justify-content: center; margin-bottom: var(--s-2); }
.pg-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); margin-top: var(--s-2); }
.pg-stat { background: var(--card-2); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 12px 6px; text-align: center; }
.pg-stat b { display: block; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-stat span { font-size: var(--text-2xs); color: var(--text-3); }
.pg-chart { width: 100%; }
.pg-chart-svg { width: 100%; height: 100px; display: block; }
.pg-grid { stroke: var(--hairline); stroke-width: 1; stroke-dasharray: 3 4; }
.pg-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pg-area { fill: oklch(68% 0.17 152 / 0.12); stroke: none; }
.pg-mastery { font-size: 0.62rem; letter-spacing: 1px; color: var(--accent); margin-right: 8px; }
.pg-trend { font-size: var(--text-xs); font-weight: 700; }
.pg-trend.up { color: var(--accent); }
.pg-trend.down { color: var(--danger); }
.pg-trend.flat { color: var(--text-4); }
.pg-spotlight { display: flex; align-items: center; gap: var(--s-3); justify-content: space-between; margin-top: var(--s-3); padding: var(--s-3); border-radius: var(--r-lg); background: linear-gradient(135deg, oklch(58% 0.2 295 / 0.1), oklch(62% 0.19 256 / 0.08)); border: 1px solid var(--hairline); flex-wrap: wrap; }
.pg-spot-label { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--violet); font-weight: 700; }
.pg-spot-text { font-size: var(--text-sm); margin-top: 3px; line-height: 1.45; max-width: 46ch; }

/* ---------- Roleplay setup ---------- */
.roleplay-modal { width: min(640px, 100%); }
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-2); margin: 6px 0 var(--s-3); }
.persona-card { text-align: left; background: var(--card-2); border: 1.5px solid var(--hairline); border-radius: var(--r-lg); padding: 12px; transition: transform var(--dur-1), border-color var(--dur-1), box-shadow var(--dur-1); }
.persona-card:hover { transform: translateY(-2px); box-shadow: var(--sh-1); }
.persona-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px oklch(68% 0.17 152 / 0.16); }
.persona-emoji { font-size: 1.6rem; }
.persona-name { font-weight: 600; font-size: var(--text-sm); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.persona-diff { font-size: var(--text-2xs); color: var(--text-3); }
.persona-blurb { font-size: var(--text-xs); color: var(--text-3); margin-top: 3px; line-height: 1.4; }
.rp-row { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.rp-context { margin-top: var(--s-3); padding: 10px 13px; border-radius: var(--r-md); background: var(--fill-subtle); }
.rp-context b { color: var(--text); font-weight: 600; }
.rp-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-3); }
@media (max-width: 520px) { .rp-toggles { grid-template-columns: 1fr; } }
.rp-toggle { display: flex; align-items: center; gap: 10px; text-align: left; padding: 11px 13px; border-radius: var(--r-lg); background: var(--card-2); border: 1.5px solid var(--hairline); transition: border-color var(--dur-1), background var(--dur-1); }
.rp-toggle[aria-pressed="true"] { border-color: var(--accent); background: oklch(68% 0.17 152 / 0.08); }
.rpt-check { width: 20px; height: 20px; border-radius: 7px; border: 2px solid var(--hairline-strong); flex-shrink: 0; display: grid; place-items: center; transition: all var(--dur-1); }
.rp-toggle[aria-pressed="true"] .rpt-check { background: var(--accent); border-color: var(--accent); }
.rp-toggle[aria-pressed="true"] .rpt-check::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 800; }
.rp-toggle b { display: block; font-size: var(--text-sm); }
.rp-toggle small { display: block; font-size: var(--text-2xs); color: var(--text-3); margin-top: 1px; }

/* ---------- Deal bar ---------- */
.deal-bar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin: 0 clamp(1rem, 3vw, 2.25rem) var(--s-3); padding: 10px 14px; border-radius: var(--r-lg); background: linear-gradient(135deg, oklch(58% 0.2 295 / 0.1), oklch(62% 0.19 256 / 0.08)); border: 1px solid var(--hairline); animation: card-rise var(--dur-2) var(--ease); }
.deal-bar-title { font-weight: 700; font-size: var(--text-sm); margin-right: 4px; }
.deal-stage { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--text-3); padding: 5px 11px; border-radius: var(--r-pill); background: var(--card-solid); border: 1px solid var(--hairline); }
.deal-stage.done { color: var(--accent); border-color: oklch(68% 0.17 152 / 0.4); }
.deal-stage.current { color: var(--violet); border-color: var(--violet); box-shadow: 0 0 0 3px oklch(58% 0.2 295 / 0.14); }
.deal-arrow { color: var(--text-4); }
.deal-bar.won { background: oklch(68% 0.17 152 / 0.14); }

/* ---------- Scorecard deal banner ---------- */
.sc-deal { margin: 0 0 var(--s-3); padding: var(--s-3); border-radius: var(--r-lg); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; border: 1px solid var(--hairline); }
.sc-deal.advance { background: oklch(68% 0.17 152 / 0.1); }
.sc-deal.stalled { background: oklch(78% 0.15 75 / 0.12); }
.sc-deal.won { background: linear-gradient(135deg, oklch(80% 0.13 85 / 0.18), oklch(68% 0.17 152 / 0.12)); }
.sc-deal-title { font-size: var(--text-lg); font-weight: 700; }
.sc-deal-sub { font-size: var(--text-sm); color: var(--text-2); margin-top: 2px; }

/* ---------- Custom coaching admin panel ---------- */
.playbook-modal { max-width: 600px; }
.playbook-body { display: flex; flex-direction: column; gap: 14px; max-height: 62vh; overflow-y: auto; padding: 4px 2px 2px; }
.playbook-body h4 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-2); margin: 0 0 6px; }
.pb-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pb-switch { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.pb-switch input { accent-color: var(--gold); width: 15px; height: 15px; }
.pb-hint { font-size: var(--text-2xs); color: var(--text-3); }
.pb-field { display: flex; flex-direction: column; gap: 5px; }
.pb-field.sm { gap: 3px; }
.pb-lab { font-size: var(--text-2xs); color: var(--text-3); font-weight: 700; }
.pb-ta { resize: vertical; min-height: 38px; font-family: inherit; }
.pb-add { display: flex; flex-direction: column; gap: 7px; padding: 12px; border: 1px dashed color-mix(in oklab, var(--gold) 40%, var(--hairline)); border-radius: var(--r-lg); background: color-mix(in oklab, var(--gold) 5%, transparent); }
.pb-rules { display: flex; flex-direction: column; gap: 9px; }
.pb-rule { padding: 10px 11px; border-radius: var(--r-md); border: 1px solid var(--hairline); background: var(--card-solid); display: flex; flex-direction: column; gap: 7px; }
.pb-rule.off { opacity: 0.55; }
.pb-rule-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pb-rule-ord { display: flex; gap: 4px; }
.pb-icon { width: 26px; height: 26px; border-radius: var(--r-sm); border: 1px solid var(--hairline); background: var(--card-solid); color: var(--text-2); cursor: pointer; font-size: var(--text-sm); line-height: 1; }
.pb-icon:hover:not(:disabled) { border-color: var(--gold); color: var(--text-1); }
.pb-icon:disabled { opacity: 0.3; cursor: default; }
.pb-empty { font-size: var(--text-sm); color: var(--text-3); padding: 8px 0; }
.pb-io { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--hairline); }
