:root {
  color-scheme: light;
  --bg: #f8f6ef;
  --ink: #182724;
  --muted: #64716d;
  --panel: #fffefa;
  --line: #ded8cb;
  --soft-line: #eee8dc;
  --green: #12664f;
  --green-deep: #0b5b46;
  --green-soft: #eef7f2;
  --danger: #b64d3c;
  --shadow: 0 18px 42px rgba(31, 42, 38, 0.07);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(130deg, rgba(18, 102, 79, 0.06), transparent 34%),
    linear-gradient(310deg, rgba(216, 111, 74, 0.06), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family:
    "Pretendard",
    "Noto Sans KR",
    "Apple SD Gothic Neo",
    system-ui,
    sans-serif;
}

button,
input {
  font: inherit;
}

button,
input,
select,
label {
  max-width: 100%;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.app-header {
  margin-bottom: 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--green);
  color: #fffdf8;
  font-weight: 900;
}

h1 {
  margin: 0;
  color: var(--green-deep);
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

.brand-row p,
.lead,
.notice,
.basis-note,
.result-note {
  color: var(--muted);
}

.brand-row p {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

.lead {
  margin: 14px 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
}

.calculator-card {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.98);
  box-shadow: var(--shadow);
  padding: 16px;
}

.tab-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 10px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 16px;
  font-weight: 800;
}

.tab-button.is-active,
.tab-button:hover {
  border-color: var(--green);
  background: var(--green);
  color: #fffdf8;
}

.reset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.reset-button:hover {
  border-color: var(--green);
  color: var(--green-deep);
  background: #fffdf8;
}

.tab-panel {
  display: none;
  min-width: 0;
}

.tab-panel.is-active {
  display: block;
}

.work-area {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 12px;
  align-items: start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.field,
.option-group,
.segmented,
.deduction-list,
.rates-panel,
.rules-summary,
.basis-note {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.field,
.option-group,
.segmented {
  min-width: 0;
  padding: 10px;
}

.field:focus-within {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 0 0 3px rgba(18, 102, 79, 0.13);
}

.field-wide {
  grid-column: 1 / -1;
}

.field span,
.option-group legend,
.segmented legend {
  display: block;
  margin-bottom: 6px;
  color: #43514d;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.25;
}

.field-helper,
.field-hint {
  margin-top: 6px;
  font-size: 0.72rem;
  line-height: 1.35;
}

.field-helper {
  display: block;
  color: #8a948f;
  font-weight: 500;
  opacity: 0.75;
  text-align: right;
}

.field-hint {
  display: none;
  color: var(--danger);
  font-weight: 650;
  text-align: right;
}

.field-hint.is-visible {
  display: block;
}

.money-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  border-radius: 6px;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.field > input[type="number"],
.field > select.count-input,
.field > .count-input {
  text-align: right;
  color: #0f1f1f;
  font-weight: 850;
}

.field > select.count-input {
  min-height: 34px;
  cursor: pointer;
  appearance: auto;
  padding-right: 22px;
  padding-left: 22px;
  text-align: center;
  text-align-last: center;
}

.field > select.count-input:focus-visible {
  border-radius: 6px;
  background: #fff;
  color: var(--green-deep);
  outline: 2px solid rgba(18, 102, 79, 0.38);
  outline-offset: 3px;
}

.money-input input {
  min-width: 0;
  text-align: right;
  padding-right: 0;
  color: #0f1f1f;
  font-weight: 850;
}

.money-input input::placeholder {
  text-align: right;
  color: #8a948f;
  font-weight: 500;
  opacity: 0.72;
}

.money-input em,
.rate-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.money-input em {
  flex: 0 0 auto;
  color: #8a948f;
  font-weight: 500;
  opacity: 0.72;
  white-space: nowrap;
  line-height: 1;
}

.money-input.has-value em {
  color: #0f1f1f;
  font-weight: 850;
  opacity: 1;
}

.option-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.option-group legend,
.segmented legend {
  grid-column: 1 / -1;
}

.option-group label,
.segmented label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
  padding: 6px 8px;
  font-size: 0.82rem;
  font-weight: 750;
  min-width: 0;
}

.option-group input,
.segmented input {
  width: 15px;
  min-height: 15px;
  accent-color: var(--green);
}

.option-group label span {
  white-space: nowrap;
  word-break: keep-all;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin: 0;
}

#salaryTaxRateGroup,
#reverseTaxRateGroup {
  grid-template-columns: repeat(3, 1fr);
}

.is-hidden {
  display: none;
}

.result-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.result-card {
  min-width: 0;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 12px;
}

.result-card-primary {
  grid-column: 1 / -1;
  min-height: 82px;
  background: var(--green);
  color: #fffdf8;
}

.result-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  word-break: keep-all;
}

.result-card-primary span {
  color: rgba(255, 253, 248, 0.78);
}

.result-card strong {
  display: block;
  color: var(--green-deep);
  font-size: clamp(1.2rem, 2.6vw, 1.72rem);
  line-height: 1.1;
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  white-space: nowrap;
}

.result-card-primary strong {
  color: #fffdf8;
  font-size: clamp(2rem, 4.2vw, 2.72rem);
}

.result-card-adjustment.is-visible {
  border-color: #d48a1f;
  background: #fff8e8;
}

.result-card-adjustment.is-visible span,
.result-card-adjustment.is-visible strong {
  color: #8a4b00;
}

.deduction-list {
  padding: 12px;
}

h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.download-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--green-deep);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.download-button:hover:not(:disabled) {
  border-color: var(--green);
  background: #f7fbf8;
}

.download-button:disabled {
  cursor: not-allowed;
  color: #9aa39f;
  background: #f6f4ef;
}

.download-area {
  display: grid;
  justify-items: end;
  gap: 5px;
  margin-top: 10px;
}

.download-area.is-hidden {
  display: none;
}

.download-area p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
  text-align: right;
}

.bulk-panel {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.bulk-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 14px;
}

.bulk-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  gap: 14px;
  align-items: center;
}

.bulk-actions p,
.bulk-guide,
.bulk-notice,
.bulk-status,
.bulk-preview-header span {
  color: var(--muted);
}

.bulk-actions p,
.bulk-notice,
.bulk-status {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.bulk-button-row {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  justify-content: flex-end;
  gap: 8px;
}

.bulk-button-row > * {
  flex: 0 1 auto;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--green-deep);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

.file-button:hover {
  border-color: var(--green);
  background: #f7fbf8;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.bulk-guide {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 0.84rem;
  line-height: 1.5;
}

.bulk-notice {
  margin-bottom: 8px;
}

.bulk-status {
  border-radius: 6px;
  background: var(--green-soft);
  padding: 8px 10px;
  font-weight: 700;
}

.bulk-status.is-error {
  background: #fff0ec;
  color: var(--danger);
}

.bulk-status.is-success {
  color: var(--green-deep);
}

.bulk-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.bulk-preview-header h2 {
  margin: 0;
}

.bulk-preview-header span {
  font-size: 0.8rem;
  font-weight: 750;
}

.bulk-errors {
  display: none;
  margin-bottom: 10px;
  border: 1px solid #f1c7bd;
  border-radius: 7px;
  background: #fff7f4;
  color: var(--danger);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
}

.bulk-errors.is-visible {
  display: block;
}

.bulk-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
}

.bulk-table {
  width: 100%;
  min-width: 1420px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.78rem;
}

.bulk-table th,
.bulk-table td {
  border-bottom: 1px solid var(--soft-line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.bulk-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fffefa;
  color: #43514d;
  font-weight: 900;
}

.bulk-table td.is-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bulk-table tr.is-error td {
  background: #fff8f5;
}

.bulk-table tr.is-warning td {
  background: #fffaf0;
}

dl {
  margin: 0;
}

dl .deduction-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.7fr) minmax(130px, 1.35fr) minmax(96px, auto) auto;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  border-top: 1px solid var(--soft-line);
  padding: 6px 0;
}

dl .deduction-row:first-child {
  border-top: 0;
}

dt {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 900;
}

.deduction-formula {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  text-align: left;
  min-width: 0;
}

.deduction-amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.deduction-action {
  text-align: right;
}

.deduction-toggle {
  min-height: 24px;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 0.74rem;
  font-weight: 800;
}

.deduction-toggle:hover {
  border-color: var(--green);
  color: var(--green-deep);
}

.deduction-detail {
  grid-column: 1 / -1;
  margin-top: 2px;
  border-radius: 6px;
  background: var(--green-soft);
  color: #43514d;
  padding: 9px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.55;
  text-align: left;
}

.basis-note,
.result-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
}

.basis-note {
  padding: 10px;
}

.basis-note:empty {
  display: none;
}

.rates-panel {
  padding: 12px;
}

.criteria-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.35fr) minmax(0, 0.65fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.rules-summary {
  padding: 14px 16px;
  background: #fff;
}

.rules-summary h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.rules-summary ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-summary li {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.rules-summary li strong {
  color: var(--ink);
  font-weight: 850;
}

.rules-summary li span {
  min-width: 0;
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.month-field {
  display: grid;
  grid-template-columns: auto minmax(150px, 190px);
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
  padding: 6px 8px;
}

.month-field span {
  color: #43514d;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.25;
}

.month-field input {
  min-height: 28px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  padding: 0 8px;
  font-size: 0.95rem;
}

.rate-row {
  display: grid;
  grid-template-columns: auto minmax(76px, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fff;
  padding: 6px 8px;
}

.rate-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.rate-row input {
  min-height: 28px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  padding: 0 8px;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}

.rate-row input::-webkit-outer-spin-button,
.rate-row input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.notice {
  margin: 12px 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
}

.print-only {
  display: none;
}

@media (max-width: 900px) {
  .work-area {
    grid-template-columns: 1fr;
  }

  .result-column {
    order: 2;
  }

  .rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .criteria-layout {
    grid-template-columns: 1fr;
  }

  .month-field {
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .bulk-actions {
    grid-template-columns: 1fr;
  }

  .bulk-button-row {
    justify-content: flex-start;
  }

  .bulk-button-row > * {
    flex: 1 1 180px;
  }
}

@media (max-width: 768px) {
  .app-shell {
    width: calc(100% - 32px);
    padding: 16px 0 28px;
  }

  .app-header {
    margin-bottom: 12px;
  }

  .brand-row {
    align-items: flex-start;
  }

  .brand-mark {
    flex: 0 0 auto;
  }

  h1 {
    font-size: clamp(1.5rem, 5.2vw, 1.9rem);
  }

  .brand-row p {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .lead {
    margin-top: 12px;
    font-size: 0.92rem;
  }

  .calculator-card {
    padding: 14px;
  }

  .tab-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .tabs {
    display: contents;
  }

  .tab-button,
  .reset-button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
  }

  .work-area {
    gap: 12px;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .field,
  .option-group,
  .segmented {
    padding: 10px;
  }

  .field span,
  .option-group legend,
  .segmented legend {
    font-size: 0.8rem;
  }

  input,
  select {
    min-height: 36px;
    font-size: clamp(0.95rem, 3.5vw, 1rem);
  }

  .field > select.count-input {
    min-height: 38px;
  }

  .money-input {
    gap: 6px;
  }

  .option-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .option-group label,
  .segmented label {
    min-height: 42px;
    justify-content: center;
    line-height: 1.25;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #salaryTaxRateGroup,
  #reverseTaxRateGroup {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }

  .result-card {
    min-height: 70px;
    padding: 12px;
  }

  .result-card-primary {
    min-height: 88px;
  }

  .result-card strong {
    font-size: clamp(1.14rem, 4.6vw, 1.55rem);
  }

  .result-card-primary strong {
    font-size: clamp(2rem, 7.6vw, 2.9rem);
  }

  .deduction-list,
  .rates-panel,
  .rules-summary,
  .basis-note {
    width: 100%;
  }

  .deduction-list {
    padding: 12px;
    overflow: visible;
  }

  dl .deduction-row {
    grid-template-columns: minmax(74px, 0.72fr) minmax(104px, 1.28fr) max-content auto;
    gap: 8px;
  }

  .deduction-formula {
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .deduction-amount {
    font-size: 0.98rem;
  }

  .criteria-layout {
    gap: 10px;
    margin-top: 12px;
  }

  .rules-summary {
    padding: 12px;
  }

  .rules-summary li {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 8px;
  }

  .download-area {
    justify-items: end;
    margin-top: 12px;
    padding-bottom: 4px;
  }

  .download-button {
    min-height: 38px;
  }
}

@media (max-width: 620px) and (min-width: 431px) {
  .tab-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reset-button {
    justify-self: stretch;
  }

  .tabs,
  .form-grid,
  .result-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1100px);
    padding: 12px 0 20px;
  }

  .calculator-card {
    padding: 10px;
  }

  .tab-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabs {
    display: contents;
  }

  .reset-button {
    justify-self: stretch;
    min-width: 86px;
  }

  .form-grid,
  .result-summary,
  .rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .option-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #salaryTaxRateGroup,
  #reverseTaxRateGroup {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  dl .deduction-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
  }

  .deduction-formula {
    grid-column: 1 / 2;
    order: 3;
  }

  .deduction-action {
    grid-column: 2 / 3;
    justify-self: end;
    order: 4;
  }

  .deduction-detail {
    order: 5;
  }

  .rules-summary li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .download-area {
    justify-items: stretch;
  }

  .download-button {
    width: 100%;
  }

  .download-area p {
    text-align: left;
  }

  .bulk-actions {
    grid-template-columns: 1fr;
  }

  .bulk-button-row {
    justify-content: stretch;
  }

  .bulk-button-row > *,
  .file-button {
    width: 100%;
  }

  .bulk-preview-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .app-shell {
    width: calc(100% - 24px);
    padding: 12px 0 22px;
  }

  .calculator-card {
    padding: 10px;
  }

  .brand-row {
    gap: 10px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  h1 {
    font-size: clamp(1.38rem, 6.2vw, 1.65rem);
  }

  .lead {
    font-size: 0.88rem;
  }

  .tab-button,
  .reset-button {
    font-size: 0.86rem;
  }

  .field,
  .option-group,
  .segmented,
  .deduction-list,
  .rates-panel {
    padding: 10px;
  }

  .field-wide,
  .option-group,
  #salaryManualTaxField,
  #reverseManualTaxField {
    grid-column: 1 / -1;
  }

  .option-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .option-group label {
    justify-content: flex-start;
  }

  .option-group label span {
    white-space: normal;
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-card {
    padding: 11px 10px;
  }

  .result-card span {
    font-size: 0.76rem;
  }

  .result-card strong {
    font-size: clamp(1.05rem, 4.7vw, 1.32rem);
  }

  .result-card-primary strong {
    font-size: clamp(1.9rem, 7.8vw, 2.45rem);
  }

  dl .deduction-row {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 4px 8px;
    min-height: 42px;
    padding: 7px 0;
  }

  dt {
    font-size: 0.86rem;
  }

  .deduction-formula {
    grid-column: 1 / 2;
    order: 3;
    font-size: 0.74rem;
  }

  .deduction-amount {
    grid-column: 2 / 3;
    justify-self: end;
    font-size: 0.96rem;
  }

  .deduction-action {
    grid-column: 2 / 3;
    justify-self: end;
    order: 4;
  }

  .deduction-toggle {
    min-height: 26px;
  }

  .deduction-detail {
    order: 5;
  }

  .rules-summary li {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .month-field {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    width: calc(100% - 20px);
  }

  .tab-bar,
  .form-grid,
  .result-summary,
  .option-group,
  .segmented,
  #salaryTaxRateGroup,
  #reverseTaxRateGroup,
  .rate-grid {
    grid-template-columns: 1fr;
  }

  .tab-button,
  .reset-button {
    min-height: 42px;
  }

  .result-card-primary strong {
    font-size: clamp(1.64rem, 8.4vw, 2rem);
  }

  .result-card strong,
  .deduction-amount {
    font-size: 0.98rem;
  }

  .field > select.count-input {
    padding-left: 12px;
    padding-right: 18px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 8mm;
  }

  body {
    background: #fff;
    color: #111;
  }

  .app-shell {
    display: none;
  }

  .print-only {
    display: block;
  }

  .print-report {
    font-family:
      "Pretendard",
      "Noto Sans KR",
      "Apple SD Gothic Neo",
      system-ui,
      sans-serif;
    width: 100%;
    font-size: 10.3px;
    line-height: 1.3;
  }

  .print-report h1 {
    margin: 0 0 4px;
    color: #0b5b46;
    font-size: 17px;
    line-height: 1.15;
  }

  .print-report h2 {
    margin: 9px 0 4px;
    color: #182724;
    font-size: 11px;
    line-height: 1.2;
  }

  .print-report p {
    margin: 2px 0;
  }

  .print-report .print-meta {
    margin-bottom: 6px;
    color: #555;
    font-size: 9.4px;
  }

  .print-report table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0 0 6px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-report th,
  .print-report td {
    border: 1px solid #d8d2c6;
    padding: 3.5px 5.5px;
    text-align: left;
    vertical-align: top;
  }

  .print-report th {
    width: 26%;
    background: #f8f6ef;
    font-weight: 800;
  }

  .print-report tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-report .amount-cell {
    text-align: right;
    white-space: nowrap;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }

  .print-report .notice-text {
    margin-top: 9px;
    color: #555;
    font-size: 9.2px;
    line-height: 1.42;
  }

  .print-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
