/* Free projection edits: the nav counter, its card and the inline mentions.
   Built like the Team ID control (assets/team-session.css): a pill in the bar
   that opens a card, moved into the menu on phones. Hidden for KFT Pro.
   Red = today's edits (they expire), gold = welcome edits (they never do). */
.kft-allowance-control{--allow-daily:var(--kft-accent,#E63946);--allow-welcome:#e0a83e;--allow-track:color-mix(in srgb,var(--text-ink,#f0f1ed) 14%,transparent);position:relative;flex-shrink:0;margin-left:8px;color:inherit;font:inherit;z-index:1100;order:1}
.kft-allowance-control[hidden],html.kft-is-pro .kft-allowance-control,html.kft-is-pro .kft-allowance-menu-item{display:none!important}

/* The button: the shared .kft-nav-chip body (assets/team-session.css), plus
   a count badge, two-tone meters and the refill time. */
.kft-allowance-count{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 5px;margin-left:-3px;border-radius:4px;background:var(--allow-daily);color:#fff;font-size:12px;font-weight:800;font-variant-numeric:tabular-nums}
.kft-allowance-count.is-gift{background:var(--allow-welcome);color:#1a1405}
.kft-allowance-label{font-weight:700}
.kft-allowance-meters{display:inline-flex;align-items:center;gap:5px;margin-left:1px}
.kft-allowance-meter{display:inline-flex;gap:2px}
.kft-allowance-meter i{display:block;width:6px;height:12px;border-radius:1.5px;background:var(--allow-track)}
.kft-allowance-meter.is-daily i.on{background:var(--allow-daily)}
.kft-allowance-meter.is-welcome i.on{background:var(--allow-welcome)}
.kft-allowance-clock{display:inline-flex;align-items:center;gap:5px;color:var(--text-muted,#adb3af);font-weight:600;font-variant-numeric:tabular-nums}
.kft-allowance-clock svg{width:13px;height:13px}
.kft-allowance-control[data-state=empty] .kft-nav-chip{border-color:color-mix(in srgb,var(--allow-daily) 70%,transparent)}
.kft-allowance-control[data-state=empty] .kft-allowance-count{background:transparent;color:var(--allow-daily);box-shadow:inset 0 0 0 1.5px var(--allow-daily)}
.kft-allowance-control[data-state=empty] .kft-allowance-clock{color:var(--text-ink,#f0f1ed)}
.kft-allowance-short{display:none}
/* With the full link row in the bar, space is tight: badge, label and caret only. */
@media(min-width:768px) and (max-width:1599px){
  body > nav:not(.kft-nav-compact) .kft-allowance-control .kft-allowance-long{display:none}
  body > nav:not(.kft-nav-compact) .kft-allowance-control .kft-allowance-short{display:inline}
  body > nav:not(.kft-nav-compact) .kft-allowance-control .kft-nav-chip-caret{display:none}
}

/* A compact editorial allowance: one balance, a ledger, one primary action. */
.kft-allowance-card{position:absolute;left:auto;right:0;top:calc(100% + 12px);width:min(388px,calc(100vw - 32px));padding:24px;background:#191c1c;color:#f0f1ed;border:1px solid #444c49;border-radius:12px;box-shadow:0 20px 64px #080a0a70;white-space:normal;box-sizing:border-box}
.kft-allowance-kicker{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:16px}
.kft-allowance-kicker span:first-child{display:flex;align-items:center;gap:7px}
.kft-allowance-kicker span:first-child::before{content:"";width:6px;height:6px;background:#e36169}
.kft-allowance-big{display:flex;align-items:center;gap:18px;margin:16px 0 16px}
.kft-allowance-big span{max-width:15ch;padding-left:18px;border-left:1px solid #444c49}
.kft-allowance-ledger{margin-top:16px;border-top:1px solid #444c49;border-bottom:1px solid #444c49}
.kft-allowance-row{display:flex;align-items:center;gap:12px;padding:12px 0}
.kft-allowance-row+.kft-allowance-row{border-top:1px solid #313736}
.kft-allowance-dot{width:5px;height:5px;flex-shrink:0;border-radius:50%;background:var(--allow-daily)}
.kft-allowance-row.is-welcome .kft-allowance-dot{background:var(--allow-welcome)}
.kft-allowance-row-copy{flex:1;min-width:0}
.kft-allowance-row-copy small{display:block;margin-top:4px}
.kft-allowance-row-count{display:flex;align-items:baseline;gap:4px;white-space:nowrap}
.kft-allowance-timer{display:flex;justify-content:space-between;align-items:center;gap:12px;padding-top:16px}
.kft-allowance-actions{display:flex;margin-top:18px}
.kft-allowance-actions svg,.kft-allowance-pro svg{width:20px;height:20px;flex-shrink:0}
.kft-allowance-pro{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:20px;padding-top:17px;border-top:1px solid #313736}
.kft-allowance-pro span{display:grid;gap:3px}
.kft-allowance-card :is(a,button):focus-visible{outline:2px solid #f0f1ed!important;outline-offset:4px}

/* Elsewhere: the homepage line and the editors' footer. */
.kft-allowance-inline{font-weight:800;color:var(--kft-accent,#E63946);font-variant-numeric:tabular-nums}
.kft-allowance-note{flex:1;font-size:12px;font-weight:700;text-align:center;padding:0 8px}
.kft-allowance-note b{color:var(--kft-accent,#E63946)}

/* Phones: the counter sits in the menu, like Team ID; the menu button shows the number. */
@media(max-width:767px){
  body > nav .hamburger[data-free-edits]{position:relative}
  body > nav .hamburger[data-free-edits]::after{content:attr(data-free-edits);position:absolute;top:-6px;right:-6px;min-width:18px;height:18px;padding:0 4px;border-radius:999px;background:var(--kft-accent,#E63946);color:#fff;font:800 11px/18px var(--kft-body,inherit);text-align:center;box-shadow:0 0 0 2px var(--bg-paper,#111)}
  body > nav .hamburger[data-free-edits="0"]::after{background:#555;color:#fff}
  .kft-allowance-control{margin:0}
  .kft-allowance-menu-item .kft-allowance-control{position:relative;width:100%}
  .kft-allowance-menu-item .kft-allowance-clock{margin-left:auto}
  .kft-allowance-menu-item .kft-allowance-clock + .kft-nav-chip-caret{margin-left:8px}
  .kft-allowance-card{position:static;width:100%;margin-top:8px;padding:22px;max-height:none;overflow:visible}
}
@media(prefers-reduced-motion:no-preference){.kft-allowance-control summary{transition:border-color .15s ease,background .2s ease}}
/* Keep the component's hierarchy inside the existing typography layer. */
@layer kft-studio{
  html body .kft-allowance-card h3{margin:0!important;padding:0!important;color:#f0f1ed!important;font:650 28px/1.2 var(--kft-display,Manrope,system-ui,sans-serif)!important;letter-spacing:-.045em!important;text-transform:none!important}
  html body .kft-allowance-card h3 em{font:inherit!important;letter-spacing:inherit!important;color:#e36169!important}
  html body .kft-allowance-kicker span{font:650 9px/1.3 var(--kft-body,system-ui,sans-serif)!important;letter-spacing:.11em!important;text-transform:uppercase!important;color:#adb3af!important}
  html body .kft-allowance-kicker span:last-child{color:#c4cbc6!important;letter-spacing:.04em!important}
  html body .kft-allowance-big strong{font:650 72px/.94 var(--kft-body,system-ui,sans-serif)!important;letter-spacing:-.065em!important;font-variant-numeric:tabular-nums!important;color:#f0f1ed!important}
  html body .kft-allowance-big span{font:500 14px/1.45 var(--kft-body,system-ui,sans-serif)!important;color:#c4cbc6!important}
  html body .kft-allowance-card p{margin:0!important;font:400 12px/1.75 var(--kft-body,system-ui,sans-serif)!important;letter-spacing:0!important;color:#adb3af!important;max-width:none!important}
  html body .kft-allowance-row-copy b{font:600 13px/1.3 var(--kft-body,system-ui,sans-serif)!important;color:#f0f1ed!important}
  html body .kft-allowance-row-copy small{font:400 11px/1.5 var(--kft-body,system-ui,sans-serif)!important;color:#adb3af!important}
  html body .kft-allowance-row-count b{font:600 28px/1 var(--kft-body,Manrope,system-ui,sans-serif)!important;letter-spacing:-.045em!important;font-variant-numeric:tabular-nums!important;color:#f0f1ed!important}
  html body .kft-allowance-row-count small{font:500 11px/1.3 var(--kft-body,Manrope,system-ui,sans-serif)!important;font-variant-numeric:tabular-nums!important;color:#adb3af!important}
  html body .kft-allowance-card .kft-allowance-policy{margin-top:14px!important;font-size:10px!important;color:#adb3af!important}
  html body .kft-allowance-timer span{font:500 10px/1.4 var(--kft-body,system-ui,sans-serif)!important;color:#adb3af!important}
  html body .kft-allowance-timer b{font:600 20px/1.2 var(--kft-body,Manrope,system-ui,sans-serif)!important;letter-spacing:-.025em!important;color:#f0f1ed!important;font-variant-numeric:tabular-nums!important}
  html body .kft-allowance-card[data-state=empty] .kft-allowance-big strong{color:#e36169!important}
  html body .kft-allowance-card[data-state=empty] .kft-allowance-timer{margin-bottom:16px}
  html body .kft-allowance-actions .primary{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:16px!important;width:100%!important;min-height:46px!important;padding:12px 16px!important;border:1px solid #b82e41!important;border-radius:6px!important;background:#b82e41!important;color:#fff!important;font:600 12px/1.4 var(--kft-body,system-ui,sans-serif)!important;text-transform:none!important;text-decoration:none!important;cursor:pointer!important;box-shadow:none!important}
  html body .kft-allowance-actions .primary:hover{background:#9f2435!important;border-color:#9f2435!important}
  html body .kft-allowance-card .kft-allowance-pro{display:flex!important;align-items:center!important;justify-content:space-between!important;margin:18px 0 0!important;padding:16px 0 0!important;width:100%!important;height:auto!important;border:0!important;border-top:1px solid #313736!important;text-transform:none!important;letter-spacing:normal!important;min-height:0!important;border-radius:0!important;background:transparent!important;color:#f0f1ed!important;text-decoration:none!important;box-shadow:none!important}
  html body .kft-allowance-pro b{font:600 12px/1.4 var(--kft-body,system-ui,sans-serif)!important;color:#f0f1ed!important}
  html body .kft-allowance-pro small{font:400 11px/1.5 var(--kft-body,system-ui,sans-serif)!important;color:#adb3af!important}
  html body .kft-allowance-card .kft-allowance-pro:hover b{color:#e36169!important}
  @media(max-width:380px){html body .kft-allowance-card h3{font-size:26px!important}}
}
@media(prefers-reduced-motion:no-preference){
  .kft-allowance-actions .primary{transition:background .18s ease}
  .kft-allowance-actions svg,.kft-allowance-pro svg{transition:transform .18s ease}
  .kft-allowance-actions .primary:hover svg,.kft-allowance-pro:hover svg{transform:translateX(3px)}
}
