/* /tax/ — Thai income tax calculator. Everything scoped under .tx */
.wrap.tx { max-width: 40rem; }
.tx .page-head > * { max-width: none; }
.tx .tx-privacy { font-size: .95rem; margin: 0; }
.tx h2 { font-size: clamp(1.4rem, 4.5vw, 1.8rem); margin-bottom: .9rem; }
.tx h3 { font-size: 1.1rem; margin: 1.4rem 0 .6rem; }
.tx-small { font-size: .9rem; }

.tx-card { background: #fff; border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 4px 4px 0 var(--ink); padding: clamp(1rem, 4vw, 1.5rem); margin-bottom: 1.5rem; }
.tx-step { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--coin); border: 2px solid var(--ink); font-size: .8em; margin-right: .3rem; vertical-align: .1em; }

/* Fields */
.tx-f { display: block; margin-bottom: 1rem; }
.tx-f > span { display: block; font-weight: 600; line-height: 1.35; margin-bottom: .2rem; }
.tx-f > small { display: block; color: var(--ink-2); font-size: .85rem; line-height: 1.4; margin-bottom: .35rem; }
.tx input:not([type="checkbox"]), .tx select { width: 100%; box-sizing: border-box; font: 600 1.15rem/1.3 var(--body); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; padding: .7rem .85rem; min-height: 3rem; }
.tx select { font-size: 1rem; }
.tx input:focus, .tx select:focus { outline: 3px solid var(--coin); outline-offset: 1px; background: #fff; }
.tx-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; align-items: end; }
@media (max-width: 30rem) { .tx-row2 { grid-template-columns: 1fr; } }
.tx-check { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: 1rem; font-weight: 600; cursor: pointer; }
.tx-check input { width: 1.4rem; height: 1.4rem; margin: .15rem 0 0; accent-color: var(--leaf-ink); flex: none; }
.tx-check small { display: block; font-weight: 400; color: var(--ink-2); }
.tx-note { margin: .35rem 0 0; font-size: .88rem; background: var(--leaf); color: var(--ink); border-radius: 10px; padding: .35rem .6rem; }
.tx-link { font: inherit; color: var(--ink); background: none; border: 0; padding: 0; text-decoration: underline; text-decoration-color: var(--coin); text-decoration-thickness: 2px; cursor: pointer; }
.tx-fixed { background: var(--paper-2); border-radius: 12px; padding: .5rem .75rem; font-size: .95rem; }

/* Collapsible groups */
.tx-group { border: 2px solid var(--ink); border-radius: 16px; margin-bottom: .75rem; background: var(--paper); }
.tx-group > summary { list-style: none; cursor: pointer; font: 600 1.08rem/1.3 var(--display); padding: .85rem 1rem; display: flex; justify-content: space-between; gap: .5rem; align-items: center; min-height: 2.6rem; }
.tx-group > summary::-webkit-details-marker { display: none; }
.tx-group > summary::after { content: "+"; font-size: 1.4rem; line-height: 1; margin-left: auto; }
.tx-group[open] > summary::after { content: "–"; }
.tx-group > summary b { font: 600 .9rem/1 var(--body); background: var(--leaf); border-radius: 999px; padding: .25rem .6rem; }
.tx-group > summary b:empty { display: none; }
.tx-group[open] { background: #fff; }
.tx-group > :not(summary) { margin-inline: 1rem; }
.tx-group > :last-child { margin-bottom: 1rem; }
.tx-more { margin-bottom: 1rem; }
.tx-more > summary { cursor: pointer; font-weight: 600; padding: .4rem 0; text-decoration: underline; text-decoration-color: var(--coin); text-decoration-thickness: 2px; }
.tx-more[open] > summary { margin-bottom: .6rem; }

/* Result */
.tx-result { background: var(--leaf); }
.tx-big { text-align: center; margin-bottom: 1rem; }
.tx-big > span:first-child { display: block; font-weight: 600; }
.tx-big b { display: block; font: 600 clamp(2rem, 9vw, 2.8rem)/1.15 var(--display); }
.tx-balance { display: inline-block; margin-top: .5rem; font-weight: 600; border: 2px solid var(--ink); border-radius: 999px; padding: .3rem .9rem; background: #fff; }
.tx-balance.refund { background: #fff; color: var(--leaf-ink); }
.tx-balance.pay { background: var(--blush); }
.tx-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 0; }
.tx-stats div { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: .5rem .7rem; }
.tx-stats dt { font-size: .82rem; color: var(--ink-2); }
.tx-stats dd { margin: 0; font-weight: 600; font-size: 1.1rem; }
.tx-warn { background: var(--blush); border-radius: 12px; padding: .6rem .8rem; margin: 1rem 0 0; font-size: .92rem; }
.tx-brackets, .tx-summary { width: 100%; border-collapse: collapse; font-size: .9rem; background: #fff; border-radius: 12px; overflow: hidden; }
.tx-brackets th, .tx-brackets td, .tx-summary th, .tx-summary td { padding: .45rem .5rem; border-bottom: 1px solid var(--rule); text-align: right; font-variant-numeric: tabular-nums; }
.tx-brackets th:first-child, .tx-brackets td:first-child, .tx-summary th { text-align: left; font-weight: 400; }
.tx-brackets thead th { font-weight: 600; font-size: .8rem; color: var(--ink-2); }
.tx-brackets tr.off td { color: var(--ink-2); opacity: .6; }
.tx-brackets td:nth-child(3) { position: relative; }
.tx-bar { display: block; height: .4rem; width: var(--w); background: var(--coin); border-radius: 4px; margin: 0 0 .2rem auto; border: 1px solid var(--ink); box-sizing: border-box; min-width: 0; }
.tx-bar[style="--w:0%"] { border: 0; }
.tx-summary tr.b th, .tx-summary tr.b td { font-weight: 600; }
.tx-used { margin: 1rem 0 0; }

/* Room left */
.tx-roomlist { list-style: none; margin: 0 0 .8rem; padding: 0; }
.tx-roomlist li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; padding: .6rem 0; border-bottom: 1.5px dashed var(--rule); }
.tx-roomlist li > span:first-child { font-weight: 600; }
.tx-notadvice { background: var(--paper-2); border-radius: 12px; padding: .5rem .75rem; margin: 0; }

.tx-actions { margin: .5rem 0 .6rem; }
.tx-actions .btn { min-height: 3rem; }
.tx-disclaimer { border-left: 4px solid var(--coin); padding-left: .8rem; font-size: .95rem; margin: 1.5rem 0 2rem; }

/* Sticky mini result on phones */
.tx-sticky { position: fixed; left: 50%; bottom: .8rem; transform: translate(-50%, 150%); transition: transform .2s; z-index: 5; display: flex; gap: .6rem; align-items: center; background: var(--ink); color: var(--paper); border-radius: 999px; padding: .55rem .6rem .55rem 1.1rem; box-shadow: 3px 3px 0 var(--coin); font-size: .95rem; white-space: nowrap; max-width: calc(100vw - 2rem); }
.tx-sticky.show { transform: translate(-50%, 0); }
.tx-sticky b { font-family: var(--display); font-size: 1.1rem; }
.tx-sticky a { background: var(--coin); color: var(--ink); text-decoration: none; font-weight: 600; border-radius: 999px; padding: .35rem .85rem; }
@media (prefers-reduced-motion: reduce) { .tx-sticky { transition: none; } }

/* Info sections */
.tx-info { margin: 2.5rem 0; }
.tx-info ol, .tx-refs ul { padding-left: 1.3rem; }
.tx-info li { margin-bottom: .4rem; }
.tx-faq details { border-top: 1.5px solid var(--rule); padding: .8rem 0; }
.tx-faq summary { font-weight: 600; cursor: pointer; }
.tx-faq details p { margin: .5rem 0 0; }
.tx-refs li { font-size: .92rem; overflow-wrap: anywhere; }
.tx-back { margin: 2rem 0 0; font-weight: 600; }

/* Print: just the summary */
@media print {
  .site-header, .site-footer, .skip, .tx-app, .tx-actions, .tx-saved, .tx-sticky, .tx-info, .tx-back, .tx .page-head .lede, .tx-privacy { display: none !important; }
  body { background: #fff; }
  .tx .page-head { background: none; box-shadow: none; clip-path: none; padding: 0 0 .5rem; margin: 0; }
  .tx .page-head h1 { font-size: 1.5rem; }
  .tx-card { box-shadow: none; border-width: 1.5px; break-inside: avoid; background: #fff; }
  .tx-used > summary { display: none; }
  .tx-sticky { display: none; }
}
