/* Supper component styles. Values come from tokens.css; nothing here re-declares a token. */
body { margin: 0; font-family: var(--font-sans); background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
.sp-stage { padding: var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.sp-stack { display: flex; flex-direction: column; gap: var(--space-3); }

/* Focus: paper gap, then a solid focus ring */
.sp-btn:focus-visible, .sp-chip:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--focus); }

/* Button */
.sp-btn { font-family: var(--font-sans); font-size: 16px; line-height: 20px; font-weight: 600; height: 52px; padding: 0 var(--space-5); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--paper-raised); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); }
.sp-btn-primary { background: var(--tomato); border-color: var(--tomato); color: var(--on-tomato); }
.sp-btn-ghost { background: transparent; border-color: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.sp-btn-block { width: 100%; }
.sp-btn[disabled] { opacity: .4; cursor: default; }

/* Chip */
.sp-chip { font-family: var(--font-sans); font-size: 16px; line-height: 20px; font-weight: 600; min-height: 44px; padding: 0 var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--paper-raised); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-2); }
.sp-chip .sp-check { width: 18px; height: 18px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); display: inline-grid; place-items: center; box-sizing: border-box; }
.sp-chip[aria-pressed="true"] { border: 2px solid var(--tomato); background: var(--tomato-soft); padding: 0 calc(var(--space-4) - 1px); }
.sp-chip[aria-pressed="true"] .sp-check { background: var(--tomato); border-color: var(--tomato); }
.sp-chip[aria-pressed="true"] .sp-check::after { content: ""; width: 8px; height: 4px; border-left: 2px solid var(--on-tomato); border-bottom: 2px solid var(--on-tomato); transform: translateY(-1px) rotate(-45deg); }
.sp-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Chapter progress */
.sp-progress { display: flex; flex-direction: column; gap: var(--space-2); }
.sp-progress-label { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.sp-progress-label b { color: var(--ink); font-weight: 600; }
.sp-progress-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-1); }
.sp-seg { height: 6px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.sp-seg i { display: block; height: 100%; background: var(--tomato); border-radius: var(--radius-pill); }

/* Receipt */
.sp-receipt { --tooth: 8px; width: 300px; background: var(--receipt); color: var(--ink); font-family: var(--font-mono); font-size: 14px; line-height: 20px; padding: var(--space-5) var(--space-4) calc(var(--space-5) + var(--tooth)); box-shadow: var(--shadow-receipt); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x; }
.sp-receipt-head { text-align: center; margin-bottom: var(--space-3); }
.sp-receipt-brand { display: block; font-family: var(--font-sans); font-size: 24px; line-height: 28px; font-weight: 700; letter-spacing: -.02em; margin-bottom: var(--space-1); }
.sp-receipt-head small { display: block; color: var(--ink-muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.sp-rule { border: 0; border-top: 1px dashed var(--line); margin: var(--space-2) 0; }
.sp-line { display: flex; justify-content: space-between; gap: var(--space-3); padding: 2px 0; text-transform: uppercase; }
.sp-line span:last-child { white-space: nowrap; }
.sp-line-save { color: var(--herb); }
.sp-line-hl { background: var(--butter); color: var(--on-butter); margin: 0 calc(var(--space-1) * -1); padding: 2px var(--space-1); }
.sp-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; line-height: 22px; font-weight: 500; padding: var(--space-2) var(--space-2); margin: var(--space-2) calc(var(--space-2) * -1) 0; border-radius: var(--radius-sm); }
.sp-total.is-under { background: var(--herb-soft); color: var(--ink); }
.sp-total.is-under span:last-child { color: var(--herb); }
.sp-receipt-foot { margin-top: var(--space-3); text-align: center; color: var(--ink-muted); font-size: 12px; }
.sp-print .sp-line, .sp-print .sp-rule, .sp-print .sp-total { opacity: 0; transform: translateY(-4px); animation: sp-print 180ms ease-out forwards; }
@keyframes sp-print { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sp-print .sp-line, .sp-print .sp-rule, .sp-print .sp-total { animation: none; opacity: 1; transform: none; } }
