/* Theme bridge: not every page names its theme tokens the same way
   (e.g. mis-cosas.html/planificacion.html use --surface2/--muted/--theme-accent
   instead of --surface-2/--text-sub/--primary). Chaining the fallbacks here
   means the guide always resolves to that page's real surface/text colors
   instead of silently dropping to a hardcoded light value in dark mode. */
:root{
  --tfg-surface:var(--surface,#fff);
  --tfg-surface-2:var(--surface-2,var(--surface2,var(--surface,#f8fafc)));
  --tfg-border:var(--border,#cbd5e1);
  --tfg-text:var(--text,#15213b);
  --tfg-text-sub:var(--text-sub,var(--muted,#64748b));
  --tfg-primary:var(--primary,var(--theme-accent,#2563eb));
  --tfg-danger:var(--danger,#b91c1c);
  --tfg-input-bg:var(--input-bg,var(--surface,#fff));
}
.tfg-launch{position:static;display:inline-flex;align-items:center;justify-content:center;flex:none;width:36px;height:36px;min-height:36px;padding:0;margin:0 3px;border:1px solid var(--tfg-border);border-radius:50%;background:var(--tfg-surface);color:var(--tfg-text);font-family:inherit;cursor:pointer}
.tfg-root{position:fixed;inset:0;width:100%;height:100dvh;max-width:none;max-height:none;margin:0;padding:0;border:0;background:transparent;color:var(--tfg-text);font-family:inherit;overflow:hidden}
.tfg-root[open]{display:flex;align-items:center;justify-content:center}.tfg-root::backdrop{background:transparent}
.tfg-shade{position:absolute;inset:0;background:#07142c99}.tfg-root[data-phase=tour] .tfg-shade{background:#07142c99}
.tfg-root[data-highlight=true] .tfg-shade{background:transparent}
.tfg-spot{position:fixed;border:2px solid #60a5fa;border-radius:12px;box-shadow:0 0 0 9999px #07142cb8;pointer-events:none;z-index:1;transition:left .18s ease,top .18s ease,width .18s ease,height .18s ease}
.tfg-card{position:relative;z-index:2;box-sizing:border-box;width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 32px);display:flex;flex-direction:column;overflow:hidden;background:var(--tfg-surface);border:1px solid var(--tfg-border);border-radius:22px;box-shadow:0 24px 80px #02061744;padding:26px;overscroll-behavior:contain;animation:tfg-in .18s ease-out}
.tfg-card h2{font-size:clamp(21px,4vw,27px);line-height:1.2;letter-spacing:-.5px;margin:12px 0}.tfg-card p{font-size:14px;line-height:1.65;color:var(--tfg-text-sub);margin:0 0 17px}.tfg-card button,.tfg-card input{font:inherit}
.tfg-top{display:flex;align-items:center;justify-content:space-between;gap:10px}.tfg-kicker{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:850;letter-spacing:.07em;text-transform:uppercase;color:var(--tfg-primary)}
.tfg-close{width:36px;height:36px;display:grid;place-items:center;background:transparent;border:0;border-radius:10px;color:inherit;cursor:pointer;flex:none}.tfg-close:hover{background:var(--tfg-surface-2)}
.tfg-actions{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:20px}.tfg-actions button{flex:1;min-height:44px;padding:11px 14px;border:1px solid var(--tfg-border);background:var(--tfg-surface);color:inherit;border-radius:12px;font-size:13px;font-weight:800;cursor:pointer}.tfg-actions .tfg-primary{background:var(--tfg-primary);border-color:var(--tfg-primary);color:white}.tfg-card button:disabled{opacity:.55;cursor:wait}
.tfg-card :focus-visible,.tfg-launch:focus-visible{outline:3px solid #60a5fa;outline-offset:3px}
.tfg-list{display:grid;gap:9px}.tfg-item{display:flex;align-items:center;gap:12px;text-align:start;border:1px solid var(--tfg-border);border-radius:13px;padding:13px;background:var(--tfg-surface-2);color:inherit;cursor:pointer;min-height:52px}.tfg-item:hover{border-color:var(--tfg-primary)}.tfg-item>span{flex:1;font-size:13px;font-weight:750}.tfg-item small{display:block;margin-top:3px;font-size:11px;font-weight:500;color:var(--tfg-text-sub)}
.tfg-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.tfg-field{display:grid;gap:7px;font-size:12px;font-weight:750;margin:13px 0}.tfg-field input{box-sizing:border-box;width:100%;min-height:44px;padding:11px;border:1px solid var(--tfg-border);border-radius:10px;background:var(--tfg-input-bg);color:inherit;font-size:14px}.tfg-error{font-size:13px;line-height:1.5;color:var(--tfg-danger);margin-top:12px}.tfg-error:empty{display:none}
.tfg-summary{display:grid;gap:9px;padding:16px;border:1px solid var(--tfg-border);border-radius:14px;background:var(--tfg-surface-2)}.tfg-summary strong{font-size:16px}.tfg-summary span{font-size:13px;color:var(--tfg-text-sub)}.tfg-progress{height:4px;border-radius:8px;overflow:hidden;background:var(--tfg-border);margin:15px 0}.tfg-progress>span{display:block;height:100%;background:var(--tfg-primary)}
.tfg-notice{font-size:12px!important;border-left:3px solid #60a5fa;padding-left:10px}.tfg-notice[data-kind="empty"],.tfg-notice[data-kind="denied"]{border-left-color:var(--tfg-text-sub)}.tfg-notice[data-kind="error"]{border-left-color:var(--tfg-danger);color:var(--tfg-danger)}.tfg-root[data-phase=tour] .tfg-card{width:min(380px,calc(100vw - 32px))}.tfg-home{margin:12px 0 18px;padding:16px;border:1px solid var(--tfg-border);border-radius:16px;background:var(--tfg-surface);color:var(--tfg-text)}.tfg-home .tfg-item{flex:1}.tfg-home strong{font-size:15px}.tfg-home p{font-size:12px;line-height:1.5;color:var(--tfg-text-sub);margin:6px 0 12px}.tfg-home-actions{display:flex;flex-wrap:wrap;gap:8px}
@keyframes tfg-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@media(max-width:640px){.tfg-card{padding:20px;border-radius:18px}.tfg-grid{gap:9px}.tfg-home-actions{flex-direction:column}}
@media(prefers-reduced-motion:reduce){.tfg-card{animation:none}.tfg-root *{scroll-behavior:auto!important}.tfg-spot{transition:none}}
.tfg-section-help{max-width:680px;margin:12px auto;padding:12px 16px}.tfg-section-help .tfg-home-actions{margin-top:8px;align-items:center;flex-direction:row}.tfg-dismiss{border:0;background:transparent;color:var(--tfg-text-sub);font-family:inherit;font-size:12px;font-weight:700;cursor:pointer;padding:12px}
@media(max-width:720px){.tfg-section-help{margin:12px 16px}}
.tfg-card #tfg-title:focus{outline:none}.tfg-item{font-family:inherit}.tfg-launch,.tfg-dismiss{font-family:inherit;font-size:13px;font-weight:700}.tfg-home-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.tfg-home-head .tfg-close{width:28px;height:28px}#tfg-settings-help{width:100%;margin:14px 0}
.tfg-item>svg:last-child{transform:rotate(-90deg)}

.tfg-step{font-size:11px;font-weight:750;color:var(--tfg-text-sub)}

.tfg-header-actions{display:flex;align-items:center;gap:8px;margin-left:auto}.tfg-launch:hover{border-color:var(--tfg-primary);color:var(--tfg-primary)}.tfg-group-title{font-size:12px;color:var(--tfg-text-sub);margin:14px 0 2px;text-transform:uppercase;letter-spacing:.06em}

/* The mascot decorates the guide without reducing the reading width. */
.tfg-head{display:flex;align-items:center;gap:14px;margin:6px 0 14px}
.tfg-head #tfg-title{flex:1;min-width:0;margin:0;overflow-wrap:anywhere}
.tfg-pet{flex:none;width:112px;pointer-events:none}
.tfg-pet:empty{display:none}.tfg-pet .tfm{display:block;width:100%;height:auto;overflow:visible}
.tfg-root[data-phase=tour] .tfg-pet{width:88px}
.tfg-item{width:100%;box-sizing:border-box}.tfg-item>svg{flex:none}
.tfg-item>span{min-width:0;overflow-wrap:anywhere}
@media(max-width:640px){.tfg-head{gap:10px}.tfg-pet{width:96px}.tfg-root[data-phase=tour] .tfg-pet{width:76px}}
@media(max-height:500px){.tfg-pet,.tfg-root[data-phase=tour] .tfg-pet{width:64px}.tfg-head{margin-bottom:8px}}

/* Floating "Guía de TaxUSA" launcher: mascot + label, bottom-right, clear of
   other floating controls (the AI chat bubble lives bottom-left; on pages with
   a bottom-right FAB — #btnAdd in mis-cosas.html — or a bottom nav bar —
   #day-bottom-nav in rutas.html — guide.js lifts the pill above them at runtime). */
.tfg-launch-pill{
  position:fixed;right:20px;z-index:140;display:inline-flex;align-items:center;gap:8px;
  padding:9px 16px 9px 9px;border:1px solid var(--tfg-border);border-radius:999px;
  background:var(--tfg-surface);color:var(--tfg-text);box-shadow:0 10px 28px -10px #0005;
  font:700 13px 'DM Sans',inherit;cursor:pointer;transition:transform .15s,box-shadow .15s,bottom .18s ease;
  bottom:calc(16px + env(safe-area-inset-bottom,0px));
}
.tfg-launch-pill:hover,.tfg-launch-pill:focus-visible{border-color:var(--tfg-primary);color:var(--tfg-primary);box-shadow:0 14px 34px -10px #0007}
.tfg-launch-pill:active{transform:scale(.96)}
.tfg-launch-pill .tfg-pill-pet{width:26px;height:26px;flex:none;display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--tfg-surface-2);overflow:hidden}
.tfg-launch-pill .tfg-pill-pet svg,.tfg-launch-pill .tfg-pill-pet .tfm{width:100%;height:100%}
.tfg-launch-pill .tfg-pill-pet:empty{display:none}
.tfg-launch-pill span.tfg-pill-label{white-space:nowrap}
@media(max-width:380px){.tfg-launch-pill span.tfg-pill-label{display:none}.tfg-launch-pill{padding:9px;gap:0}}
@media(prefers-reduced-motion:reduce){.tfg-launch-pill{transition:bottom .18s ease}}

.tfg-foot{display:flex;justify-content:center;margin-top:6px}.tfg-foot .tfg-dismiss{padding:8px 12px}
html.tfg-lock,html.tfg-lock body{overflow:hidden!important;scrollbar-gutter:stable}
.tfg-more{margin:0 0 12px;border:1px solid var(--tfg-border);border-radius:12px;background:var(--tfg-surface-2)}
.tfg-more>summary{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;font-size:12px;font-weight:750;color:var(--tfg-text-sub);cursor:pointer;list-style:none}
.tfg-more>summary::-webkit-details-marker{display:none}
.tfg-more>summary::after{content:"";flex:none;width:7px;height:7px;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg);margin-top:-3px}
.tfg-more[open]>summary::after{transform:rotate(-135deg);margin-top:3px}
.tfg-more-body{display:grid;gap:10px;padding:0 12px 12px}
.tfg-jump-label{display:grid;gap:4px;font-size:11px;font-weight:750;color:var(--tfg-text-sub)}
.tfg-jump-label select{box-sizing:border-box;width:100%;min-width:0;min-height:40px;padding:8px;border:1px solid var(--tfg-border);border-radius:10px;background:var(--tfg-input-bg);color:var(--tfg-text);font:inherit;font-size:13px}
.tfg-more-actions{display:flex;gap:8px}.tfg-more-actions .tfg-mini{flex:1;min-width:0;min-height:40px;padding:8px 10px;border:1px solid var(--tfg-border);border-radius:10px;background:var(--tfg-surface);color:var(--tfg-text);font:inherit;font-size:12px;font-weight:800;cursor:pointer}
.tfg-more-actions .tfg-mini:hover{border-color:var(--tfg-primary);color:var(--tfg-primary)}

/* Card layout: header, controls and buttons stay put; only the explanation scrolls. */
.tfg-top,.tfg-actions,.tfg-foot,.tfg-pinned,.tfg-meta,.tfg-more{flex:none}
.tfg-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;margin:0 -8px;padding:0 8px;scrollbar-width:none;-ms-overflow-style:none;
  background:
    linear-gradient(var(--tfg-surface) 30%,#0000) top/100% 16px no-repeat local,
    linear-gradient(#0000,var(--tfg-surface) 70%) bottom/100% 16px no-repeat local,
    radial-gradient(farthest-side at 50% 0,#0003,#0000) top/100% 8px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%,#0003,#0000) bottom/100% 8px no-repeat scroll}
.tfg-scroll::-webkit-scrollbar{display:none;width:0;height:0}
.tfg-scroll>:last-child{margin-bottom:0}
.tfg-meta{display:flex;align-items:center;gap:10px;margin:10px 0 8px}
.tfg-meta .tfg-step{white-space:nowrap}.tfg-meta .tfg-progress{flex:1;margin:0}

/* Tour cards are compact so they hide as little of the page as possible. */
.tfg-root[data-phase=tour] .tfg-card{padding:14px 16px 16px;border-radius:18px}
.tfg-root[data-phase=tour] .tfg-head{margin:2px 0 6px;gap:10px}
.tfg-root[data-phase=tour] .tfg-card h2{font-size:clamp(17px,3.6vw,20px);margin:0}
.tfg-root[data-phase=tour] .tfg-card p{font-size:13px;line-height:1.55;margin:0 0 10px}
.tfg-root[data-phase=tour] .tfg-pet{width:60px}
.tfg-root[data-phase=tour] .tfg-close{width:30px;height:30px}
.tfg-root[data-phase=tour] .tfg-actions{margin-top:10px;gap:8px}
.tfg-root[data-phase=tour] .tfg-actions button{min-height:40px;padding:8px 10px;font-size:12.5px}
.tfg-root[data-phase=tour] .tfg-foot{margin-top:2px}
.tfg-root[data-phase=tour] .tfg-more{margin:0 0 8px}
@media(max-width:640px){.tfg-root[data-phase=tour] .tfg-card{padding:12px 14px 14px}.tfg-root[data-phase=tour] .tfg-pet{width:52px}}
@media(max-height:560px){.tfg-root[data-phase=tour] .tfg-pet{width:44px}}

/* Tour card: no header row. The close button floats in the corner and the controls take less height. */
.tfg-root[data-phase=tour] .tfg-top{position:absolute;top:8px;right:8px;z-index:3}
.tfg-root[data-phase=tour] .tfg-kicker{display:none}
.tfg-root[data-phase=tour] .tfg-head{padding-right:34px}
.tfg-root[data-phase=tour] .tfg-meta{margin:8px 0 6px}
.tfg-root[data-phase=tour] .tfg-more>summary{padding:7px 12px}
.tfg-root[data-phase=tour] .tfg-actions button{min-height:38px}
