/* Thai Income Tax calculator: the site's tokens applied to a working form. Clarity first: white fields,
   one blue for focus and selection, a result panel that reads like a statement. */
.page-head--tool { padding-bottom: 8px; }
.tax-noscript { margin-bottom: 20px; }
.tax-layout { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: clamp(20px, 3.4vw, 48px); align-items: start; }

/* ---------- Form ---------- */
.tax-form { display: grid; gap: 18px; min-width: 0; }
.tax-form > .field--year, .tax-form > .step, .more-head { padding: clamp(18px, 2.4vw, 28px); border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--sh-1); }
.tax-form fieldset { border: 0; margin: 0; min-width: 0; }
.tax-form legend { float: left; width: 100%; padding: 0; margin-bottom: 4px; font-family: var(--display); font-weight: 650; font-size: 1.5rem; letter-spacing: -.015em; line-height: 1.15; }
.tax-form legend + * { clear: both; }
.tax-form legend em, .more-head h2 em { font-style: normal; color: var(--accent); }
:lang(th) .tax-form legend, :lang(th) .more-head h2 { letter-spacing: 0; font-weight: 600; line-height: 1.35; }
.section-note { font-size: var(--fs-small); color: var(--ink-2); max-width: 62ch; margin-bottom: 6px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 230px); gap: 6px 20px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.step > .field:last-child, .step > div:last-child > .field, .more-body > .field:last-child { border-bottom: 0; }
.field label, .label { font-size: var(--fs-body); font-weight: 500; line-height: 1.4; }
.field .hint { grid-column: 1 / -1; font-size: var(--fs-small); color: var(--ink-2); line-height: 1.55; }
.field .hint:empty { display: none; }
.field .error, .month .error { grid-column: 1 / -1; font-size: var(--fs-small); line-height: 1.45; color: #A3271A; font-weight: 500; }
.field .error:empty, .month .error:empty { display: none; }
.field--year { grid-template-columns: minmax(0, 1fr) minmax(170px, 280px); border-bottom: 0; }
.field--year > label { font-family: var(--display); font-weight: 650; font-size: 1.25rem; }
:lang(th) .field--year > label { font-weight: 600; }
.field--select { grid-template-columns: minmax(0, 1fr) minmax(190px, 320px); }
.money, .count { position: relative; display: block; }
.money input, .count input, .field select {
  width: 100%; min-height: 48px; padding: 10px 14px; font: 500 1.0625rem/1.3 var(--text); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-field); text-align: right;
  font-variant-numeric: tabular-nums; appearance: none; transition: border-color var(--d-fast), box-shadow var(--d-fast);
}
.money input { padding-right: 34px; }
.money::after { content: '฿'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: .95rem; color: var(--ink-2); pointer-events: none; }
.field select { text-align: left; cursor: pointer; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: right 19px top 52%, right 14px top 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.money input:hover, .count input:hover, .field select:hover { border-color: var(--ink-2); }
.money input:focus, .count input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.tax-form input::placeholder { color: var(--ink-2); opacity: 1; }
[data-invalid] input { border-color: #A3271A; box-shadow: 0 0 0 3px #F6E1DE; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 12px 0; font-size: var(--fs-body); line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.check small { display: block; font-size: var(--fs-small); color: var(--ink-2); }
.derived { grid-column: 1 / -1; font-size: var(--fs-small); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.derived:empty { display: none; }

/* Salary over 12 months */
.salary12 { padding: 6px 0 10px; border-bottom: 1px solid var(--line); }
.salary-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 8px 0 4px; }
.salary-head .label { font-weight: 600; }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--tint); }
.seg-opt { position: relative; display: inline-flex; cursor: pointer; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-opt span { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; color: var(--ink-2); transition: background-color var(--d-mid) var(--ease-out), color var(--d-mid) var(--ease-out), box-shadow var(--d-mid); }
.seg-opt input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(32 36 42 / .08), 0 4px 10px -6px rgb(32 36 42 / .3); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field--lead { grid-template-columns: minmax(0, 1fr) minmax(200px, 300px); border-bottom: 0; }
.field--lead .money input { min-height: 64px; font: 650 clamp(1.7rem, 1.3rem + 1.2vw, 2.3rem)/1 var(--display); letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; padding-right: 40px; }
.field--lead .money::after { font-size: 1.15rem; right: 16px; }
.month-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; margin-top: 10px; }
.month { display: grid; gap: 4px; }
.month label { font-size: var(--fs-micro); font-weight: 600; color: var(--ink-2); }
.month .money input { font-size: 1rem; min-height: 44px; }
.salary12 > [data-salary-panel] > .hint { margin-top: 12px; font-size: var(--fs-small); color: var(--ink-2); }
.text-button { margin-top: 10px; min-height: 44px; padding: 0; font-size: var(--fs-small); font-weight: 600; color: var(--accent); }
.text-button:hover { text-decoration: underline; }
.derived--salary { margin-top: 10px; padding: 12px 14px; border-radius: var(--r-field); background: var(--accent-tint); color: var(--ink); font-size: var(--fs-small); }
.derived--salary strong { font-weight: 700; color: var(--accent); }

/* Optional groups */
.more-head h2 { font-family: var(--display); font-weight: 650; font-size: 1.5rem; letter-spacing: -.015em; }
.more-head p { margin-top: 6px; font-size: var(--fs-small); color: var(--ink-2); max-width: 62ch; }
.more { border-radius: var(--r-card); background: var(--surface); box-shadow: var(--sh-1); }
.more summary { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 20px; cursor: pointer; list-style: none; border-radius: var(--r-card); }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ''; width: 12px; height: 12px; margin-left: auto; flex: none; background: linear-gradient(var(--ink), var(--ink)) center / 12px 1.6px no-repeat, linear-gradient(var(--ink), var(--ink)) center / 1.6px 12px no-repeat; transition: transform var(--d-mid) var(--ease-out); }
.more[open] summary::after { transform: rotate(45deg); }
.more summary:hover .more-name { color: var(--accent); }
.more-name { font-weight: 600; font-size: 1.075rem; transition: color var(--d-fast); }
.more-count { padding: 1px 10px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); font-size: var(--fs-micro); font-weight: 600; }
.more-count:empty { display: none; }
.more-body { padding: 0 20px 18px; }
.more--scope { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.more-sub { margin-top: 16px; font-size: var(--fs-small); font-weight: 600; }
.plain-list { margin: 8px 0 0; padding: 0; list-style: none; font-size: var(--fs-small); line-height: 1.55; color: var(--ink-2); }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---------- Result ---------- */
.tax-result { position: sticky; top: 92px; padding: clamp(20px, 2.4vw, 30px); border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--sh-2); }
.result-title { font-family: var(--display); font-weight: 650; font-size: 1.5rem; letter-spacing: -.015em; margin-bottom: 12px; outline: none; }
:lang(th) .result-title { letter-spacing: 0; font-weight: 600; }
.result-empty { font-size: var(--fs-lead); line-height: 1.45; margin-bottom: 14px; color: var(--ink); }
.result-assume { font-size: var(--fs-micro); line-height: 1.55; color: var(--ink-2); padding: 12px 14px; border-radius: var(--r-field); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.result-assume strong { font-weight: 600; color: var(--ink); }
.result-flag { padding: 12px 14px; margin: 12px 0 0; border-radius: var(--r-field); background: #FBEDEB; color: #6E1D13; font-size: var(--fs-small); line-height: 1.55; }
.result-hero { margin-top: 14px; padding: 20px; border-radius: var(--r-card); background: var(--accent-tint); }
.result-hero.is-held { background: var(--tint); }
.result-big { font-size: var(--fs-small); font-weight: 600; color: var(--accent); }
.result-hero.is-held .result-big { color: var(--ink); }
.result-amount { margin-top: 4px; font-family: var(--display); font-weight: 700; font-size: clamp(2.5rem, 2rem + 2vw, 3.6rem); line-height: 1; letter-spacing: -.03em; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.result-sub { margin-top: 10px; font-size: var(--fs-small); line-height: 1.55; color: var(--ink-2); }
.result-lines { width: 100%; border-collapse: collapse; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.result-lines th { text-align: left; font-weight: 400; padding: 8px 12px 8px 0; vertical-align: top; }
.result-lines td { text-align: right; padding: 8px 0; white-space: nowrap; vertical-align: top; }
.result-lines tr { border-bottom: 1px solid var(--line); }
.result-lines tr:last-child { border-bottom: 0; }
.result-lines tr.is-sub th { padding-left: 14px; color: var(--ink-2); }
.result-lines tr.is-sub td { color: var(--ink-2); }
.result-lines tr.is-total th, .result-lines tr.is-total td { font-weight: 700; }
.result-balance { margin-top: 12px; }
.result-balance tr.is-total td { font-size: 1.1rem; color: var(--accent); }
.result-brackets .rate { margin-left: 6px; color: var(--ink-2); }
.result-section { margin-top: 22px; }
.result-section h3 { font-size: var(--fs-small); font-weight: 700; margin-bottom: 4px; }
.result-notes { list-style: none; padding: 0; margin: 0; font-size: var(--fs-small); line-height: 1.5; }
.result-notes li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.note-head { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.note-head strong { font-weight: 600; }
.result-notes small { display: block; margin-top: 2px; font-size: var(--fs-micro); color: var(--ink-2); }
.result-filing { margin-top: 18px; padding: 12px 14px; border-radius: var(--r-field); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-small); line-height: 1.55; }
.result-source { font-size: var(--fs-micro); color: var(--ink-2); margin-top: 16px; line-height: 1.6; }
.result-source a { color: var(--accent); }

/* ---------- Quick table ---------- */
.quick { margin-top: clamp(48px, 7vw, 96px); }
.quick-note { margin-top: 12px; max-width: 72ch; color: var(--ink-2); }
.quick-scroll { margin-top: 22px; overflow-x: auto; border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--sh-1); }
.quick-table { width: 100%; min-width: 640px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.quick-table th, .quick-table td { padding: 12px 20px; text-align: right; border-bottom: 1px solid var(--line); }
.quick-table thead th { font-size: var(--fs-micro); font-weight: 600; color: var(--ink-2); background: var(--surface-2); }
.quick-table th:first-child, .quick-table td:first-child { text-align: left; }
.quick-table tbody tr:last-child th, .quick-table tbody tr:last-child td { border-bottom: 0; }
.quick-table td { font-size: var(--fs-small); }
.quick-table td.is-tax { font-family: var(--display); font-weight: 650; font-size: 1.15rem; font-variant-numeric: lining-nums tabular-nums; }
.use-salary { min-height: 40px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; text-decoration: underline; text-decoration-color: rgb(44 107 165 / .35); text-underline-offset: 5px; }
.use-salary:hover { text-decoration-color: var(--accent); }
.quick-table tbody tr { transition: background-color var(--d-fast); }
.quick-table tbody tr:hover { background: var(--surface-2); }
.tax-privacy { margin-top: 28px; max-width: 72ch; font-size: var(--fs-small); color: var(--ink-2); }

/* Phone summary bar */
.tax-peek { display: none; }
@media (max-width: 960px) {
  .tax-layout { grid-template-columns: 1fr; }
  .tax-result { position: static; }
  .tax-peek:not([hidden]) {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 25; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px 10px 18px; border-radius: 999px; background: var(--ink); color: var(--on-dark); box-shadow: 0 20px 40px -18px rgb(32 36 42 / .6);
  }
  .peek-label { font-size: var(--fs-micro); color: var(--on-dark-2); }
  .peek-amount { font-family: var(--display); font-weight: 650; font-size: 1.3rem; font-variant-numeric: lining-nums tabular-nums; }
  .peek-go { margin-left: auto; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--accent-soft); color: #0E1B28; font-weight: 600; font-size: var(--fs-small); }
  .page-tax { padding-bottom: 76px; }
  .month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .field, .field--lead, .field--select, .field--year { grid-template-columns: 1fr; }
  .money input, .count input { text-align: left; }
  .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .salary-head { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; }
  .seg-opt { flex: 1; }
  .seg-opt span { width: 100%; padding: 0 10px; white-space: nowrap; font-size: .875rem; }
}

/* Other pay month by month, copy shortcuts, and the monthly withholding table. */
.other12 { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.other12 > .label, .shortcut > .label { font-weight: 600; margin: 0 0 4px; }
.items-grid { display: grid; gap: 6px; margin-top: 10px; }
.item-month { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.item-m { font-weight: 600; font-size: var(--fs-small); padding-top: 10px; }
.item-list { display: grid; gap: 6px; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.item-row select, .shortcut select { min-height: 44px; padding: 6px 10px; font: 500 0.95rem/1.2 var(--text); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-field); min-width: 0; }
.item-row input[aria-invalid] { border-color: #A3271A; }
.shortcuts { margin-top: 14px; }
.shortcuts summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.shortcut { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.month-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: var(--fs-small); cursor: pointer; }
.chip-check input:checked + span { background: var(--ink); color: var(--surface); box-shadow: none; }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.wh { margin-top: clamp(32px, 5vw, 56px); }
.wh-table { min-width: 620px; }
.wh-table td small { display: block; color: var(--ink-2); font-size: var(--fs-micro); }
.wh-table .is-wh { background: var(--accent-tint); }
.wh-table td.is-wh strong { font-family: var(--display); font-size: 1.15rem; font-weight: 650; font-variant-numeric: lining-nums tabular-nums; }
.wh-table .wh-toggle { display: block; margin-left: auto; min-height: 32px; font-size: var(--fs-micro); }
.wh-table tr.is-off td { color: var(--ink-2); text-align: left; font-size: var(--fs-small); }
.wh-table tr.wh-detail td { text-align: left; background: var(--surface-2); }
.wh-table tr.wh-detail ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: var(--fs-small); }
.wh-table tfoot th, .wh-table tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.wh-balance { margin-top: 12px; font-weight: 600; }
@media (max-width: 760px) { .item-row { grid-template-columns: 1fr 1fr; } .item-row .text-button { grid-column: 1 / -1; justify-self: start; } }
.wh-summary .wh-same strong { font-family: var(--display); font-size: 1.3rem; font-weight: 650; margin-left: 6px; font-variant-numeric: lining-nums tabular-nums; }
.wh-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; margin: 8px 0 0; padding: 0; list-style: none; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.wh-mini li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
/* Contain absolutely positioned descendants (visually hidden button text) so they cannot widen the page on phones. */
.quick-scroll { position: relative; }
.result-brackets .slice { display: block; font-size: var(--fs-micro); color: var(--ink-2); }
/* Grid items default to min-content width; wide tables inside must scroll, not widen the column. */
.tax-layout > * { min-width: 0; }

/* ---------- Monthly entry and estimated withholding (2026-11-04 refactor) ---------- */
.bonus-when { margin: 8px 0 4px; padding-left: 14px; border-left: 2px solid var(--accent-tint); }
.bonus-when .field { padding: 0; border: 0; }
.alloc-row, .x-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 8px; }
.alloc-row select, .x-row select { min-height: 44px; padding: 6px 10px; font: 500 0.95rem/1.2 var(--text); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-field); min-width: 0; }
.alloc-row input[aria-invalid], .x-row input[aria-invalid] { border-color: #A3271A; }
.alloc-status { margin-top: 6px; font-size: var(--fs-small); color: var(--ink-2); }
.extras { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line-strong); transition: background-color var(--d-fast); }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(32 36 42 / .25); transition: transform var(--d-fast) var(--ease-out); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.excluded-note { margin-top: 8px; padding: 8px 12px; border-radius: var(--r-field); background: #FBF3E4; color: #6B4A12; font-size: var(--fs-small); }
.extras-body:not([hidden]) { animation: mt-open 220ms var(--ease-out) both; }
@keyframes mt-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.x-month { padding: 10px 0; border-bottom: 1px solid var(--line); }
.x-name { margin: 0; font-weight: 600; font-size: var(--fs-small); }
.x-add { min-height: 36px; font-size: var(--fs-small); }

.mt-wrap { margin-top: 20px; }
.mt-flag { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--r-field); background: #FBF3E4; color: #6B4A12; font-size: var(--fs-small); }
.mt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mt caption { text-align: left; font-size: var(--fs-micro); font-weight: 600; color: var(--ink-2); padding-bottom: 6px; }
.mt th, .mt td { height: 56px; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mt thead th { height: auto; font-size: var(--fs-micro); font-weight: 600; color: var(--ink-2); text-align: left; }
.mt .num { text-align: right; white-space: nowrap; }
.mt tbody th { font-weight: 600; text-align: left; width: 64px; }
.mt td small { display: block; font-size: var(--fs-micro); color: var(--ink-2); white-space: normal; }
.mt .mt-in input { width: 100%; max-width: 132px; min-height: 44px; text-align: right; }
.mt .mt-wh { font-weight: 700; }
.wh-btn { min-height: 40px; padding: 0 2px; border: 0; background: none; color: var(--ink); font: 700 1rem/1.2 var(--text); font-variant-numeric: tabular-nums; cursor: pointer; text-decoration: underline dotted var(--line-strong); text-underline-offset: 4px; }
.wh-btn:hover { color: var(--accent); }
.wh-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wh-btn[aria-expanded='true'] { color: var(--accent); text-decoration-color: var(--accent); }
.mt tr.mt-detail td { height: auto; background: var(--surface-2); text-align: left; }
.mt tr.mt-detail ol { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: var(--fs-small); }
.mt tr[data-missing] th { color: #8A5A12; }
.mt tfoot th, .mt tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; }
.mt .unknown { color: #8A5A12; font-weight: 500; }
.mt-sum { display: grid; gap: 0; margin: 14px 0 0; font-variant-numeric: tabular-nums; }
.mt-sum > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-small); }
.mt-sum dd { margin: 0; white-space: nowrap; font-weight: 600; }
.mt-sum .is-total { border-bottom: 0; font-weight: 700; font-size: 1rem; }
@media (prefers-reduced-motion: reduce) { .extras-body:not([hidden]) { animation: none; } .switch-track, .switch-track::after { transition: none; } }

/* Phone: each month keeps its pay and its withholding together, no sideways scrolling. */
@media (max-width: 640px) {
  .mt thead { display: none; }
  .mt, .mt tbody, .mt tfoot { display: block; }
  .mt tr { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .mt th, .mt td { height: auto; padding: 0; border: 0; }
  .mt tbody th, .mt tfoot th { grid-row: span 2; }
  .mt td[data-c='salary'], .mt td[data-f='salary'] { text-align: left; }
  .mt td[data-label]::before { content: attr(data-label); display: block; font-size: var(--fs-micro); font-weight: 500; color: var(--ink-2); text-align: inherit; }
  .mt td[data-c='other'], .mt td[data-f='other'] { display: none; }
  .mt tr.mt-detail { display: block; padding: 8px; }
  .mt tr.mt-detail[hidden] { display: none; }
  .mt tr.mt-detail td { display: block; }
  .mt .mt-in input { max-width: none; }
  .alloc-row, .x-row { grid-template-columns: 1fr 1fr; }
  .alloc-row .text-button, .x-row .text-button { grid-column: 1 / -1; justify-self: start; }
}
/* Phone, refined: month | pay | withholding on one line; the month's total below only when other income exists. */
@media (max-width: 640px) {
  .mt caption { display: block; width: auto; }
  .mt tr { grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .mt td[data-c='salary'], .mt td[data-f='salary'] { grid-column: 2; grid-row: 1; }
  .mt td[data-c='wh'], .mt td[data-f='wh'] { grid-column: 3; grid-row: 1; text-align: right; }
  .mt td[data-c='total'], .mt td[data-f='total'] { grid-column: 2 / -1; grid-row: 2; text-align: left; font-size: var(--fs-small); color: var(--ink-2); }
  .mt td[data-c='total']::before { display: inline; margin-right: 6px; }
  .mt:not(.mt--other) td[data-c='total'], .mt:not(.mt--other) td[data-f='total'] { display: none; }
  .mt tbody th, .mt tfoot th { grid-row: 1 / span 2; padding-top: 18px; }
}
