/* Tax pack (PV-015, js/tax-ui.js; the PL-005 rules moved here from pocket.css). Steady mood: monochrome plus the one
   accent; nothing celebrates. Readiness card, four folders, the question card (tap or swipe) beside the opened folder.
   Linked before pocket.css (a test keeps pocket.css last). Design: docs/design/planning-v2/proto.html?screen=tax */

.tx { display: flex; flex-direction: column; gap: 14px; container-type: inline-size; }
.tx:focus, .tx *:focus:not(:focus-visible) { outline: none; }
.tx .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tx-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tx-tt { margin-right: auto; }
.tx-tt .pl-tool-title { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.tx-note { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; font: 400 13px var(--font-sans); color: var(--text-dim); }
.tx-note svg { width: 14px; height: 14px; flex: none; }
.tx select, .tx-q, .tx-newrule input { min-height: 48px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-input); background: var(--surface-2); color: var(--text); font: 500 14px var(--font-sans); }
.tx-status { font: 400 13px var(--font-sans); color: var(--text-dim); }
.tx-status:empty { display: none; }
.tx-save, .tx-add { min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--accent-fill); color: var(--on-accent); font: 600 14px var(--font-sans); cursor: pointer; }
.tx-save:hover, .tx-add:hover { background: var(--accent-fill-hi); }
.tx-save[hidden] { display: none; }
.tx-ev-slot { display: contents; }
.tx-evidence { min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--accent-fill); color: var(--on-accent); font: 600 14px var(--font-sans); cursor: pointer; white-space: nowrap; }
.tx-evidence:hover { background: var(--accent-fill-hi); }
.tx-evidence:disabled { opacity: .6; cursor: progress; }
.tx-skeleton { min-height: 110px; animation: pl-pulse 1.4s ease-in-out infinite; }
.tx-error { margin: 0; color: var(--text-mid); font: 400 14px var(--font-sans); grid-column: 1 / -1; }
.tx-link { min-height: 48px; padding: 0 4px; border: 0; background: none; color: var(--accent); font: 600 13px var(--font-sans); cursor: pointer; }

.tp-card { padding: 18px 20px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-sm); min-width: 0; }

/* readiness: the sentence (the year is the word to change), what's left, the bar */
.tp-ready { display: grid; gap: 12px; }
.tp-rh { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tp-rh > div { flex: 1 1 280px; min-width: 0; }
.tp-rs { margin: 0; font: 600 20px/1.3 var(--font-sans); letter-spacing: -.02em; color: var(--text); }
.tp-rs .sp-ans { color: var(--text); }
.tp-sub { margin: 4px 0 0; font: 400 13.5px var(--font-sans); color: var(--text-dim); }
.tp-ract { display: flex; gap: 8px; }
.tp-meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.tp-meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent-fill); transition: width 420ms cubic-bezier(.2, .8, .2, 1); }

/* the four folders, a tab on each */
.tp-folders { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-top: 6px; }
.tp-folder { position: relative; display: grid; gap: 8px; min-width: 0; min-height: 48px; padding: 14px 16px; border: 0; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tp-folder::before { content: ""; position: absolute; left: 16px; top: -6px; width: 42px; height: 8px; border-radius: 6px 6px 0 0; background: inherit; }
.tp-folder.is-open { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow-sm); }
.tp-folder:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tp-fh { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 34px; }
.tp-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); color: var(--text-mid); }
.tp-folder.is-open .tp-ico { color: var(--accent); }
.tp-fl { font: 600 13.5px/1.2 var(--font-sans); text-wrap: balance; overflow-wrap: anywhere; }
.tp-ft { font: 600 22px var(--font-sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tp-fn { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; font: 400 12.5px var(--font-sans); color: var(--text-dim); }
.tp-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-mid); font: 500 11.5px var(--font-sans); white-space: nowrap; }
.tp-badge.is-sort { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.tp-badge.is-none { background: none; color: var(--text-dim); padding: 2px 0; }

/* the question card beside the opened folder */
.tp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; align-items: start; }
.tp-left { display: grid; gap: 10px; min-width: 0; }
.tp-sort { position: relative; display: grid; gap: 14px; padding: 18px; border-radius: var(--r-card); background: var(--surface-2); box-shadow: var(--shadow-md, var(--shadow-sm)); touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform 300ms cubic-bezier(.2, .9, .3, 1.15); }
.tp-sort.is-drag { transition: none; cursor: grabbing; }
.tp-sort.is-done { box-shadow: var(--shadow-sm); background: var(--surface); }
.tp-kick { font: 600 11.5px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.tp-q2 { margin: 0; font: 600 19px/1.3 var(--font-sans); letter-spacing: -.02em; color: var(--text); }
.tp-ex { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-chip { padding: 4px 10px; border-radius: 999px; background: var(--surface); color: var(--text-mid); font-size: 12px; }
.tp-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); font: 600 14px var(--font-sans); cursor: pointer; }
.tp-btn:hover { color: var(--accent); }
.tp-btn:focus-visible, .tp-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tp-btn[data-tx="business"] { background: var(--accent-fill); color: var(--on-accent); }
.tp-btn[data-tx="business"]:hover { background: var(--accent-fill-hi); color: var(--on-accent); }
.tp-sort[data-lean="r"] .tp-btn[data-tx="business"], .tp-sort[data-lean="l"] .tp-btn[data-tx="personal"] { box-shadow: 0 0 0 2px var(--accent); }
.tp-text { justify-self: center; min-height: 48px; padding: 0 12px; border: 0; background: none; color: var(--accent); font: 600 13px var(--font-sans); cursor: pointer; }
.tp-sort.is-go-r { animation: tp-go-r 320ms cubic-bezier(.2, .8, .2, 1) forwards; }
.tp-sort.is-go-l { animation: tp-go-l 320ms cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes tp-go-r { from { transform: translateX(var(--tp-from, 0)); } to { transform: translateX(60px) rotate(4deg); opacity: 0; } }
@keyframes tp-go-l { from { transform: translateX(var(--tp-from, 0)); } to { transform: translateX(-60px) rotate(-4deg); opacity: 0; } }
.tp-hint { display: none; margin: 0; font: 400 12px var(--font-sans); color: var(--text-dim); text-align: center; }
.tp-also { margin: 0; font: 400 13px/1.45 var(--font-sans); color: var(--text-mid); }
.tp-said { margin: 0; font: 400 13px var(--font-sans); color: var(--text-mid); text-align: center; }
.tp-said:empty { display: none; }
.tp-note { margin: 10px 0 0; font: 400 12px var(--font-sans); color: var(--text-dim); }

/* the opened folder's charges (PL-005) */
.tx-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tx-h > div { flex: 1 1 0; min-width: 0; }
.tx-h h3 { margin: 0; font: 600 17px var(--font-sans); }
.tx-h small { font: 400 12.5px var(--font-sans); color: var(--text-dim); }
.tx-count { font-size: 13px; color: var(--text-dim); }
.tx-q { min-width: 220px; }
.tx-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.tx-chip { min-height: 48px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text-mid); font: 500 13px var(--font-sans); cursor: pointer; }
.tx-chip.is-on { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.tx-scroll { max-height: 520px; overflow: auto; }
.tx-table { width: 100%; border-collapse: collapse; font: 400 14px var(--font-sans); }
.tx-table th { position: sticky; top: 0; background: var(--surface); text-align: left; padding: 8px 10px; font: 600 12px var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.tx-table td { padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: middle; }
.tx-r { text-align: right; }
.tx-amt { text-align: right; white-space: nowrap; }
.tx-date { color: var(--text-dim); font-size: 12.5px; white-space: nowrap; }
.tx-who b { display: block; font-weight: 500; }
.tx-who small { display: block; color: var(--text-dim); font-size: 12.5px; }
.tx-rc { min-height: 48px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--text-mid); font: 500 12.5px var(--font-sans); cursor: pointer; white-space: nowrap; }
.tx-rc.is-on { border-color: transparent; background: var(--surface-2); color: var(--text); }
.tx-mv select { max-width: 170px; }
.tx-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; font: 400 13px var(--font-sans); color: var(--text-dim); }
.tx-empty { margin: 14px 0 0; color: var(--text-dim); font: 400 14px/1.5 var(--font-sans); }
.tx-sd { display: none; }

/* the rules the answers made, and a rule by hand under a fold */
.tx-rules { margin: 12px 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tx-rules li:not(.tx-empty) { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 4px 0 12px; border-radius: var(--r-input); background: var(--surface-2); font: 400 14px var(--font-sans); }
.tx-rules li span { margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.tx-rules em { font: 500 12px var(--font-sans); font-style: normal; color: var(--accent); white-space: nowrap; }
.tx-x { display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: none; color: var(--text-dim); font-size: 20px; cursor: pointer; }
.tp-asked { margin: 0 0 8px; font: 400 13px var(--font-sans); color: var(--text-mid); }
.tp-more summary { display: flex; align-items: center; min-height: 48px; color: var(--accent); font: 600 13px var(--font-sans); cursor: pointer; }
.tx-newrule { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.tx-newrule input, .tx-newrule select[name=value] { grid-column: 1 / -1; }

@container (max-width: 900px) {
  .tp-grid { grid-template-columns: 1fr; }
  .tp-left { display: contents; }   /* phone order: the question, the folder's charges, then the rules */
  #tx-rules { order: 3; }
  .tp-folders { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; }
}
@container (max-width: 640px) {
  .tp-hint { display: block; }
  .tp-rs { font-size: 18px; }
  .tp-ract, .tp-ract > *, .tx-evidence, .tx-save { width: 100%; }
  .tp-ft { font-size: 18px; }
  .tp-folder { padding: 12px 14px; }
  .tx-table thead, .tx-table td.tx-date { display: none; }
  .tx-sd { display: inline; }
  .tx-amt { align-self: start; }
  .tx-table, .tx-table tbody, .tx-table tr, .tx-table td { display: block; }
  .tx-table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--border); }
  .tx-table td { border: 0; padding: 0; }
  .tx-mv { grid-column: 1 / -1; } .tx-mv select { max-width: none; width: 100%; }
  .tx-q { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .tx-skeleton { animation: none; }
  .tp-sort, .tp-meter i { transition: none; }
  .tp-sort.is-go-r, .tp-sort.is-go-l { animation: none; opacity: 0; }
}
