/* ==========================================================================
   Gig Worker Tax Estimator — v2 component styles
   Hand-written CSS, no build step. Only genuinely bespoke components live
   here; everything else reuses the compiled Tailwind utilities in styles.css.
   ========================================================================== */

/* ==========================================================================
   Self-hosted webfonts
   --------------------------------------------------------------------------
   Both typefaces used to be requested from fonts.googleapis.com, which cost a
   DNS lookup plus a TLS handshake to a THIRD origin on the critical path and
   put the text render behind two round trips. They are now served from this
   origin as two files totalling ~87 KB.

   These are the @fontsource VARIABLE builds, so one file per family covers the
   whole weight range that styles.css asks for (Inter 400-900, JetBrains Mono
   600-800) instead of the nine static weights the old Google Fonts request
   pulled in. Latin subset only — the app's copy is entirely US-English.

   font-display: swap keeps text visible in the fallback face while the file
   downloads, which is what keeps the CLS/LCP benefit rather than trading it
   for invisible text.

   Keeping the family names 'Inter' and 'JetBrains Mono' means the existing
   `.font-mono-num` rule and Tailwind's sans stack resolve unchanged.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Utility: a reliable visibility switch ------------------------------- */
.v2-hidden {
  display: none !important;
}

/*
  The calculator hides the caution badges (QBI, SEHI cap, business loss) by
  toggling the `.hidden` utility class, but `.caution-badge` below sets
  `display: flex` with the SAME specificity — and this file loads after
  styles.css, so it would win and the badge would stay visible even when
  hidden. This rule restores the intent.

  Written as `.caution-badge.hidden` (specificity 0,2,0) so it beats the
  display:flex rule without !important, and it is intentionally here rather
  than in styles.css because styles.css is a hand-compiled Tailwind artefact
  that must not be edited by hand.
*/
.caution-badge.hidden {
  display: none;
}

/* --- Gig-type profile selector ------------------------------------------ */
.profile-selector {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .profile-selector {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.profile-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid #1e293b;
  background: rgba(2, 6, 23, 0.6);
  color: #cbd5e1;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  font-family: inherit;
}

.profile-btn:hover {
  border-color: #4f46e5;
  background: rgba(30, 41, 59, 0.6);
}

.profile-btn.is-active {
  border-color: #6366f1;
  background: linear-gradient(160deg, rgba(79, 70, 229, 0.28), rgba(15, 23, 42, 0.9));
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.5), 0 8px 24px -12px rgba(79, 70, 229, 0.8);
  color: #ffffff;
}

.profile-btn .profile-emoji {
  font-size: 1.35rem;
  line-height: 1;
}

.profile-btn .profile-label {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
}

.profile-btn .profile-examples {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 500;
}

.profile-btn.is-active .profile-examples {
  color: #c7d2fe;
}

/* --- Segmented control (vehicle method toggle) -------------------------- */
.segmented {
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 0.9rem;
  background: rgba(2, 6, 23, 0.8);
  border: 1px solid #1e293b;
  gap: 0.25rem;
}

.segmented-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.7rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.segmented-btn:hover {
  color: #e2e8f0;
}

.segmented-btn.is-active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, 0.9);
}

/* --- Collapsible input cards ------------------------------------------- */
.card-collapsible {
  border: 1px solid rgba(30, 41, 59, 0.9);
  background: rgba(2, 6, 23, 0.45);
  border-radius: 1.25rem;
  overflow: hidden;
}

.card-collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #e2e8f0;
}

.card-collapsible > summary::-webkit-details-marker {
  display: none;
}

.card-collapsible > summary:hover {
  background: rgba(30, 41, 59, 0.5);
}

.card-collapsible .summary-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.5rem;
  background: rgba(79, 70, 229, 0.3);
  color: #a5b4fc;
  font-size: 0.7rem;
  font-weight: 900;
  flex-shrink: 0;
}

.card-collapsible .summary-chevron {
  width: 1rem;
  height: 1rem;
  color: #64748b;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.card-collapsible[open] .summary-chevron {
  transform: rotate(180deg);
}

.card-collapsible .card-body {
  padding: 0 1.1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: var(--v2-stack-gap);
}

/* --- Tooltip helper ---------------------------------------------------- */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 9999px;
  background: rgba(71, 85, 105, 0.6);
  color: #cbd5e1;
  font-size: 0.6rem;
  font-weight: 900;
  cursor: help;
  flex-shrink: 0;
  position: relative;
}

.info-tip:hover,
.info-tip:focus {
  background: #4f46e5;
  color: #ffffff;
  outline: none;
}

/*
  POSITION: FIXED, not absolute.

  An absolutely-positioned tooltip is a descendant of whatever boxes its
  trigger sits inside, so every one of those boxes got to clip it:

    - the results card carried `overflow-hidden` (for its decorative glow);
    - the results wrapper is a scrolling container at desktop widths
      (`overflow-y: auto` / `overflow-x: hidden`);
    - the input cards carry `overflow-hidden` so their rounded corners clip.

  The result was that the pop-overs on the hero metrics and the breakdown rows
  were cut off at the panel edge and were unreadable. `position: fixed` takes
  the bubble out of every one of those clipping contexts, so it can never be
  truncacted. script.js supplies the coordinates on show (see positionTip());
  these rules are only the fallback if that never runs.

  `width: max-content` + `max-width` lets a long note use the room it needs
  without the bubble ever resolving narrower than its own padding on a phone.
*/
.info-tip .tip-text {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  top: 0;
  left: 0;
  width: max-content;
  max-width: min(19rem, calc(100vw - 1.5rem));
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  z-index: 80;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.9);
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.info-tip:hover .tip-text,
.info-tip:focus .tip-text {
  visibility: visible;
  opacity: 1;
}

/* --- Field label row --------------------------------------------------- */
.field-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
}

.field-help {
  font-size: 0.65rem;
  color: #64748b;
  line-height: 1.5;
  margin-top: 0.35rem;
}

/* --- Two/three-up input grids ------------------------------------------ */
.v2-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.v2-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 560px) {
  .v2-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 700px) {
  .v2-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- W-2 optional block ------------------------------------------------ */
.w2-block {
  border: 1px dashed rgba(99, 102, 241, 0.35);
  background: rgba(49, 46, 129, 0.12);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
}

.w2-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: #c7d2fe;
}

.w2-toggle input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #4f46e5;
  cursor: pointer;
  flex-shrink: 0;
}

/* --- Range slider ------------------------------------------------------ */
input[type="range"].v2-range {
  width: 100%;
  height: 1.4rem;
  accent-color: #4f46e5;
  cursor: pointer;
  background: transparent;
}

/* --- Dashboard: hero + stat tiles ------------------------------------- */
.quarterly-hero {
  background: linear-gradient(135deg, rgba(49, 46, 129, 0.75), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 1.25rem;
  padding: 1.15rem;
}

.stat-tile {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(30, 41, 59, 0.85);
  border-radius: 1rem;
  padding: 0.8rem 0.9rem;
}

.stat-tile .stat-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  margin-bottom: 0.3rem;
}

.stat-tile .stat-value {
  font-size: 1.1rem;
  font-weight: 900;
  color: #f1f5f9;
}

/* --- Optimization / shield badges ------------------------------------- */
.optimizer-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border-radius: 1rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.72rem;
  line-height: 1.5;
  font-weight: 600;
  background: rgba(6, 78, 59, 0.4);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

.shield-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border-radius: 1rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.72rem;
  line-height: 1.5;
  font-weight: 600;
  background: rgba(12, 74, 110, 0.4);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #bae6fd;
}

.caution-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border-radius: 1rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.72rem;
  line-height: 1.5;
  font-weight: 600;
  background: rgba(120, 53, 15, 0.35);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.badge-icon {
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1.3;
}

/* ==========================================================================
   Vertical rhythm
   --------------------------------------------------------------------------
   ONE gap value for a stacked group of labelled controls, used by both the
   input cards and the results panel. Previously the form used Tailwind's
   space-y utilities (0.75-1.75rem) while the breakdown rows carried only
   0.34rem of padding, so the two panels visibly disagreed. Everything that
   stacks a control now reads from this token, which is what makes the gap
   identical on every card and at every viewport.
   ========================================================================== */
:root {
  --v2-stack-gap: 0.9rem;
}

/* A stack of form groups, or of rows inside the results card. */
.v2-stack {
  display: flex;
  flex-direction: column;
  gap: var(--v2-stack-gap);
}

/* ==========================================================================
   Results panel: card rhythm + clipping
   --------------------------------------------------------------------------
   The results panel deliberately does NOT use Tailwind margin utilities to
   separate the hero from the detail cards. `styles.css` is a PRE-COMPILED
   Tailwind build and only contains the utilities something already used at
   build time - `mb-4` is not in it, so `class="... mb-4"` on the hero and the
   four cards resolved to `margin-bottom: 0` and the whole stack ran together
   with no gap at all. Margins here are therefore explicit, from one token.

   `overflow` is also forced back to `visible`. The panel wrapper carries
   `overflow-hidden` (to clip its decorative glow) and the wrapper is a
   scrolling container at desktop widths (overflow-y:auto / overflow-x:hidden),
   so both of them were cutting the tooltip pop-overs off at the edge of the
   panel. A tooltip has to escape its container to be readable.
   ========================================================================== */
:root {
  --v2-card-gap: 1.15rem;
}

.v2-results-card {
  margin-bottom: var(--v2-card-gap);
  overflow: visible;
}

.v2-results-card:last-child {
  margin-bottom: 0;
}

/* The decorative corner glow, drawn as a soft radial gradient over the card
   rather than as an oversized blurred circle that had to be clipped. Because
   it is inset to the card's own box, `overflow: hidden` here clips it to the
   rounded corners and the card itself never needs `overflow-hidden` - which
   was what truncated every tooltip pop-over. */
.v2-results-card > .v2-card-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(
    16rem 16rem at 100% 0%,
    rgba(99, 102, 241, 0.16),
    rgba(99, 102, 241, 0) 70%
  );
}

/* ==========================================================================
   Results hero
   --------------------------------------------------------------------------
   The four headline figures sit OUTSIDE any card, on the panel itself, so they
   read as the answer rather than as one more panel among many. Stacked on
   mobile, two-up from 560px, four-across from 900px. No utility class that the
   pre-compiled styles.css might lack is relied on here (text-5xl does not
   exist in that build), so the sizing is explicit.
   ========================================================================== */
.v2-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--v2-stack-gap);
}

/* Two-up from 560px. NOT four-across: this panel is only 5 of 12 columns
   (~416px of content), so four tiles leave ~93px each and a figure like
   "$11,017.33" wraps mid-number. Two tiles always have room. */
@media (min-width: 560px) {
  .v2-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.v2-hero-item {
  padding: 0.75rem 0.85rem;
  border-left: 3px solid #4f46e5;
  border-radius: 0.25rem;
  background: rgba(2, 6, 23, 0.45);
  min-width: 0;
}

/* The lead metric is the one figure the visitor came for. */
.v2-hero-lead {
  border-left-color: #818cf8;
  background: rgba(49, 46, 129, 0.3);
}

.v2-hero-label {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a5b4fc;
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.v2-hero-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.02em;
  /* A currency figure must never break inside: "$11,017.33" wrapped as
     "$11,0 / 17.33" reads as two different numbers. */
  white-space: nowrap;
}

.v2-hero-lead .v2-hero-value {
  color: #c7d2fe;
}

/*
  The hero is a two-column grid from 560px, so a "wide" tile has to span both
  columns to run side to side. The lead figure and the quarterly figure are both
  wide: they are the two ends of the story - what is owed in total, and what to
  send each quarter - and reading them full width separates them from the two
  single-authority tiles between them.
*/
.v2-hero-wide {
  grid-column: 1 / -1;
}

.v2-hero-value-lg {
  font-size: 1.6rem;
}

/* The due-date line under the quarterly figure. */
.v2-hero-note {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #64748b;
}

/*
  A negative figure in the hero is a refund, and green is the only honest signal
  for it. The word "Refund" is appended with ::after rather than written into the
  element's text, so the PDF builder - which reads textContent - still gets a
  clean "$412.00" instead of "$412.00 Refund".
*/
.v2-hero-value.is-refund {
  color: #34d399;
}

.v2-hero-value.is-refund::after {
  content: " Refund";
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Pulse on update: the value flashes once when it changes, so a visitor editing
   an input sees WHICH number moved rather than hunting the whole panel. */
@keyframes v2-hero-flash {
  0%   { background: rgba(99, 102, 241, 0.42); }
  100% { background: transparent; }
}

.v2-hero-item.v2-flash {
  animation: v2-hero-flash 0.7s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .v2-hero-item.v2-flash { animation: none; }
}

@media print {
  .v2-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v2-hero-item { background: #ffffff !important; border-left-color: #334155 !important; }
  .v2-hero-label { color: #334155 !important; }
  .v2-hero-value, .v2-hero-lead .v2-hero-value { color: #000000 !important; }
}

/* ==========================================================================
   Responsive page rhythm + panel insets
   --------------------------------------------------------------------------
   Two complaints, one cause: the layout used the SAME padding and gaps at every
   width, so a 390px phone carried desktop-sized gutters.

   Measured before the change, inside a real 390px viewport:
     main side gutter        16px each side  -> panel was 358px of 390
     panel inner padding     20px            -> content only 316px wide
     card-body inner padding  1px + 1.1rem   -> ~18px of nesting, twice over
     panel-to-first-child    20px
     card-to-card gap        14.4px

   So roughly 72px of the 390px screen - 18% of the width - was gutter before a
   single label was drawn. Everything below is scoped to max-width 640px, so
   tablet and desktop geometry is untouched.

   The `var()` fallbacks matter: if v2.css were ever loaded without this block,
   `padding: var(--x, 0.75rem)` still resolves rather than dropping the
   declaration.
   ========================================================================== */
:root {
  --v2-panel-pad-y: 1.25rem;
  --v2-panel-pad-x: 1.25rem;
}

.v2-panel-pad {
  padding: var(--v2-panel-pad-y) var(--v2-panel-pad-x);
}

@media (max-width: 640px) {
  :root {
    --v2-panel-pad-y: 0.9rem;
    --v2-panel-pad-x: 0.8rem;
    /* One token drives the card gap, the hero gap AND the in-card row padding
       (`.bd-row` reads it divided in half), so tightening it here tightens the
       whole stack in step and the panels cannot drift apart. */
    --v2-stack-gap: 0.7rem;
  }

  /* Screen edge -> panel. Was 1rem each side (Tailwind's px-4). */
  #app-main {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    /* Was 1.5rem top and bottom (Tailwind's py-6), which put 24px of dead space
       between the sticky header and the first panel. */
    padding-top: 0.75rem;
    padding-bottom: 1.25rem;
  }

  /* Panel -> panel. The 12-column grid collapses to one column on mobile. */
  #calculator-grid {
    row-gap: 1.25rem;
  }

  /* Panel -> its own child cards. `.card-collapsible` sets its own
     `padding: 0.9rem 1.1rem`; that inner inset is what made the nested boxes
     look padded twice over. */
  .card-collapsible > summary {
    padding: 0.75rem 0.8rem;
  }

  .card-collapsible .card-body {
    padding: 0 0.8rem 0.8rem;
  }
}

/* ==========================================================================
   Profile panel header — mobile re-flow
   --------------------------------------------------------------------------
   The panel heading row is `flex ... justify-between` with a `shrink-0` right
   column. On a phone that column is the widest thing in the row and it wins the
   space fight, because flex will not shrink a `shrink-0` item: it forces the
   heading column down to whatever is left.

   Measured at 390px before the change:
     heading row width        316px
     right column demand      184px  (the "2026: 72.5c / 76.0c mi" badge)
     heading left with       115.6px -> "Your Gig Profile" broke onto 2 lines
     subtext left with       115.6px -> 5 lines
     "Reset inputs"           sat UNDER the badge, 21px in from the panel edge

   Fix, mobile only:
     1. stack the row so the heading gets the full width;
     2. move the reset control to the panel's top-RIGHT corner, aligned with the
        heading's first line, as an absolutely-positioned tab. Absolute is
        required rather than a flex order change: the reset button and the
        mileage badge live in the same non-shrinkable column, and only taking
        the button out of flow lets the heading run the full width;
     3. drop the year prefix from the badge (script.js) so it fits.
   ========================================================================== */
.profile-panel-head {
  position: relative;
}

@media (max-width: 640px) {
  .profile-panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    /* Room for the absolutely-positioned reset control on the first line. */
    padding-right: 4.75rem;
  }

  .profile-panel-lead {
    min-width: 0;
  }

  /* One line, and it must stay one line: `white-space: nowrap` plus a minimum
     size is what stops the flex heading from being squeezed back into a wrap by
     any future sibling. */
  .profile-panel-head h2 {
    white-space: nowrap;
    min-width: 0;
  }

  /* "alligned end to end in the same panel" — the subtext's own box now spans
     the full panel width, so its first and last characters sit flush against
     the same left and right edges the heading uses. */
  .profile-panel-sub {
    width: 100%;
    margin-top: 0.35rem;
  }

  .profile-panel-aside {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
  }

  .profile-panel-aside #resetBtn {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    white-space: nowrap;
  }
}

/* ==========================================================================
   Disabled PDF export button
   --------------------------------------------------------------------------
   `button:disabled` in styles.css only sets opacity + cursor, and the button was
   ALSO carrying Tailwind's `active:scale-95` (a press animation) and
   `cursor-pointer` (both at 0,1,0 in the compiled sheet). With v2.css loading
   afterwards those still applied, so a disabled button still depressed when
   tapped and still showed a pointer cursor — a disabled control that ignores a
   tap has to LOOK inert, or the visitor concludes the tool is broken instead of
   incomplete. These selectors are 0,2,0 so they win without `!important`.
   ========================================================================== */
/* The disabled fill needs `!important` on the COLOUR only.
   Tailwind's `.bg-indigo-600` is 0,1,0, and this block's selectors are 0,2,0, so
   the rest of the state (cursor, transform, shadow) is won on specificity. The
   background is not: `hover:bg-indigo-500` (0,2,0) and `active:scale-95` sit in
   the compiled sheet with the same weight, and in the browser the element was
   still reporting the indigo fill while disabled. `!important` here is scoped
   to a state that should be impossible to override anyway. */
.pdf-cta:disabled,
.pdf-cta:disabled:hover,
.pdf-cta:disabled:active {
  cursor: not-allowed !important;
  transform: none !important;
  background-color: #334155 !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}

.pdf-cta:disabled {
  opacity: 1;
}

/* ==========================================================================
   Header control pill — full width on a phone
   --------------------------------------------------------------------------
   "Extend the panel that hosts year and the state end to end."
   The pill is the second flex item in a wrapping header row, so on a phone it
   took only its content width (291px of 390). `flex-basis: 100%` forces it onto
   its own row at full width; the `@media` guard keeps the desktop header on one
   line exactly as it is today.
   ========================================================================== */
@media (max-width: 640px) {
  .header-controls {
    flex: 1 1 100%;
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  /* Both selects share the row evenly, so the year and the state line up and
     neither one crowds the other off. */
  .header-controls > div {
    flex: 1 1 0;
    min-width: 0;
  }

  .header-controls-divider {
    height: 1.5rem;
    flex: 0 0 1px;
  }
}

/* ==========================================================================
   Manual ad units (AdSense)
   --------------------------------------------------------------------------
   The four ad containers reserve space so the page does not jump when an ad
   loads. .v2-ad-slot is the two 250px slots beside the calculator columns:
   a single fixed height for both keeps the input and results panels
   symmetrical (they previously disagreed at 250px vs 300px).

   IMPORTANT: these heights are a RESERVATION, not a guarantee. If no ad is
   served the container is hidden outright by ads.js, which is what reclaims
   the space — otherwise a visitor with an ad blocker would see a large blank
   rectangle. So do not rely on the reserved height for layout balance in a way
   that would break when the container disappears.
   ========================================================================== */
.v2-ad-slot {
  width: 100%;
  height: 250px;
  min-height: 250px;
}

/* The <ins> element AdSense fills. It must be block-level and must be given the
   full size of its container: an unpushed or empty <ins> has no intrinsic
   height, so without this it would collapse and the unit could never be
   measured as filled. */
.v2-ad-unit {
  display: block;
  overflow: hidden;
}

.v2-ad-unit > .adsbygoogle {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

/* The wide unit below the results has no fixed height — it takes whatever the
   returned creative needs, up to the width available. */
.v2-ad-band {
  min-height: 100px;
}

.v2-ad-band > .adsbygoogle {
  display: block !important;
  width: 100% !important;
}

/* --- Itemized breakdown rows ------------------------------------------ */
.bd-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: calc(var(--v2-stack-gap) / 2) 0;
  font-size: 0.76rem;
  color: #94a3b8;
}

.bd-row .bd-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

/*
  A card body whose FIRST row is a `.bd-total` (the SE card, where "SE Tax Owed"
  is the parent of the three components beneath it) would otherwise draw that
  row's top border as a stray rule hanging just under the card's own summary
  divider. The border belongs to a row that closes a group above it, so there is
  nothing for it to do at the top of a card.
*/
.card-body > .bd-row:first-child {
  border-top: none;
  margin-top: 0;
}

.bd-row .bd-value {
  font-weight: 800;
  color: #e2e8f0;
  white-space: nowrap;
}

.bd-row.bd-sub {
  padding-left: 0.85rem;
  font-size: 0.7rem;
  color: #64748b;
}

.bd-row.bd-sub .bd-value {
  color: #94a3b8;
  font-weight: 600;
}

.bd-row.bd-total {
  border-top: 1px solid rgba(30, 41, 59, 0.9);
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  font-size: 0.82rem;
  color: #e2e8f0;
  font-weight: 700;
}

.bd-row.bd-total .bd-value {
  color: #ffffff;
  font-size: 0.92rem;
}

.bd-row.bd-negative .bd-value {
  color: #6ee7b7;
}

.bd-row.bd-highlight .bd-value {
  color: #818cf8;
}

/*
  A running BALANCE rather than a running total: the figure after credits and
  payments have been taken off. It gets the same weight as .bd-total because it
  is the row the eye should land on, but its own class because a balance can be
  negative (a refund) and must be able to say so in green.
*/
.bd-row.bd-balance {
  border-top: 1px solid rgba(30, 41, 59, 0.9);
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  font-size: 0.82rem;
  color: #e2e8f0;
  font-weight: 700;
}

.bd-row.bd-balance .bd-label {
  color: #ffffff;
}

.bd-row.bd-balance .bd-value {
  color: #818cf8;
  font-size: 0.92rem;
}

/* A negative .bd-balance is a refund, and green is the only honest signal for
   it. The word "Refund" is appended by ::after rather than written into the
   element's text, so the PDF builder - which reads textContent - still gets a
   clean "-$412.00" instead of "-$412.00 (Refund)". */
.bd-row.bd-balance.is-refund .bd-value {
  color: #34d399;
}

.bd-row.bd-balance.is-refund .bd-value::after {
  content: " \00a0Refund";
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.bd-sep {
  height: 1px;
  background: rgba(30, 41, 59, 0.9);
  margin: 0.5rem 0;
}

/* --- Print ------------------------------------------------------------- */
@media print {
  .profile-selector,
  .segmented,
  .v2-range,
  .info-tip .tip-text {
    display: none !important;
  }

  .profile-btn,
  .card-collapsible,
  .quarterly-hero,
  .stat-tile,
  .optimizer-badge,
  .shield-badge,
  .caution-badge,
  .w2-block {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #000000 !important;
    box-shadow: none !important;
  }

  .bd-row,
  .bd-row .bd-value,
  .bd-row.bd-sub .bd-value,
  .bd-row.bd-total .bd-value,
  .stat-tile .stat-value,
  .profile-btn .profile-label {
    color: #000000 !important;
  }

  .bd-row.bd-negative .bd-value,
  .bd-row.bd-highlight .bd-value {
    color: #000000 !important;
  }

  .bd-row.bd-balance .bd-value,
  .bd-row.bd-balance.is-refund .bd-value,
  .v2-hero-value.is-refund {
    color: #000000 !important;
  }

  .card-collapsible .summary-chevron {
    display: none !important;
  }
}
