/* ROBERIN my-salary-calculator (실수령액 계산기) - The New workspace (20260714a)
 * Scope: .tn-salary-* only. Finance-family DNA shared with loan/house-calculator.
 * Gates baked in: input-left (#3), no Calculate button (#17), container gap (#22/#37),
 * uniform 1px borders / no decorative left rail (#11/#30), field label separation (#34),
 * empty inputs use muted example placeholders (#40), flipped dark tokens with text-fill
 * (#8/#14), element reset limited to li/ul/ol/dd so p/dl padding survives (#37). */

.tn-salary-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  color: #1a1208;
  -webkit-text-fill-color: currentColor;
}

.tn-salary-page,
.tn-salary-page * {
  box-sizing: border-box;
}

.tn-salary-tool {
  --sal-ink: #1a1208;
  --sal-muted: #5a4a30;
  --sal-line: #b8a888;
  --sal-soft: #cbb692;
  --sal-paper: #fffdf8;
  --sal-wash: #f6eddc;
  --sal-surface: #fffdf8;
  --sal-card: #fbf4e6;
  --sal-band-bg: #f9f1e2;
  --sal-accent: #b5540f;
  --sal-accent-soft: #e6c9a6;
  --sal-track: #e7dcc4;
  --sal-btn-sec-bg: #f2e7d3;
  --sal-btn-sec-hover: #e7d8bd;
  --sal-btn-sec-text: #3a2c18;
  --sal-btn-pri-bg: #b5540f;
  --sal-btn-pri-hover: #9c470b;
  --sal-btn-pri-text: #fff6ec;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  font-family: inherit;
}

/* element reset limited to list/dd so p/dl/dt spacing survives (#37) */
.tn-salary-tool ul,
.tn-salary-tool ol,
.tn-salary-tool li,
.tn-salary-tool dd {
  margin: 0;
  padding: 0;
  list-style: none;
}
.tn-salary-tool dl,
.tn-salary-tool dt {
  margin: 0;
}

.tn-salary-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--sal-line);
  background: var(--sal-surface);
}

.tn-salary-input,
.tn-salary-result {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 16px;
  min-width: 0;
}
.tn-salary-input {
  border-right: 1px solid var(--sal-line);
  background: var(--sal-wash);
}

.tn-salary-pane-label {
  margin: 0;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}

/* segmented radios (연봉/월급, 퇴직금) — no titles, compact (#2) */
.tn-salary-seg {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.tn-salary-choice {
  position: relative;
  display: block;
  cursor: pointer;
}
.tn-salary-choice input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.tn-salary-choice > span {
  display: block;
  padding: 9px 8px;
  border: 1px solid var(--sal-soft);
  background: var(--sal-card);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
}
.tn-salary-choice input:checked + span {
  border-color: var(--sal-accent);
  background: var(--sal-accent-soft);
}
.tn-salary-choice input:focus-visible + span {
  outline: 2px solid var(--sal-accent);
  outline-offset: 2px;
}

.tn-salary-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* field label separation (#34): label outside control, 5px gap, control owns border */
.tn-salary-field {
  display: grid;
  gap: 5px;
  align-content: start;
  min-width: 0;
}
.tn-salary-field--full {
  grid-column: 1 / -1;
}
.tn-salary-label,
.tn-salary-field > span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}
.tn-salary-control {
  display: flex;
  align-items: stretch;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--sal-line);
  background: var(--sal-paper);
}
.tn-salary-control input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  font: 600 14px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.tn-salary-control input:focus-visible {
  outline: 2px solid var(--sal-accent);
  outline-offset: -2px;
}
/* empty inputs -> muted example placeholder (#40) */
.tn-salary-control input::placeholder {
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
  opacity: 0.5;
}
/* suffix chip (원) owns its own divider border (#7) */
.tn-salary-control--suffix b {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-left: 1px solid var(--sal-soft);
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
}
.tn-salary-hint {
  min-height: 16px;
  font-size: 12px;
  line-height: 16px;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}

/* stepper (부양가족/자녀) sized to the 36px control row (#11 same-row height) */
.tn-salary-stepper {
  display: flex;
  align-items: stretch;
  height: 36px;
  border: 1px solid var(--sal-line);
  background: var(--sal-paper);
}
.tn-salary-stepper input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  padding: 0 8px;
  border: 0;
  border-left: 1px solid var(--sal-soft);
  border-right: 1px solid var(--sal-soft);
  background: transparent;
  text-align: center;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  font: 700 14px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  -moz-appearance: textfield;
  appearance: textfield;
}
.tn-salary-stepper input::-webkit-outer-spin-button,
.tn-salary-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tn-salary-stepper input::placeholder {
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
  opacity: 0.5;
}
.tn-salary-stepper-btn {
  flex: 0 0 38px;
  border: 0;
  background: var(--sal-card);
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
}
.tn-salary-stepper-btn:hover {
  background: var(--sal-accent-soft);
}
.tn-salary-stepper-btn:focus-visible {
  outline: 2px solid var(--sal-accent);
  outline-offset: -2px;
}

/* command row: copy/reset only, no Calculate (#17) */
.tn-salary-command {
  display: grid;
  gap: 8px;
}
.tn-salary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.tn-salary-secondary,
.tn-salary-primary {
  height: 38px;
  border: 1px solid var(--sal-line);
  background: var(--sal-btn-sec-bg);
  color: var(--sal-btn-sec-text);
  -webkit-text-fill-color: var(--sal-btn-sec-text);
  font: 700 13px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tn-salary-secondary:hover {
  background: var(--sal-btn-sec-hover);
}
.tn-salary-primary {
  border-color: var(--sal-btn-pri-bg);
  background: var(--sal-btn-pri-bg);
  color: var(--sal-btn-pri-text);
  -webkit-text-fill-color: var(--sal-btn-pri-text);
}
.tn-salary-primary:hover {
  background: var(--sal-btn-pri-hover);
}
.tn-salary-secondary:focus-visible,
.tn-salary-primary:focus-visible {
  outline: 2px solid var(--sal-accent);
  outline-offset: 2px;
}
.tn-salary-status {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--sal-soft);
  background: var(--sal-card);
  font-size: 12px;
  line-height: 1.5;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
  text-align: center;
}

/* result pane */
.tn-salary-main {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--sal-line);
  background: var(--sal-card);
}
.tn-salary-main > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}
.tn-salary-main strong {
  font: 800 clamp(26px, 5vw, 34px)/1.1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  word-break: keep-all;
}
.tn-salary-main-sub {
  font-size: 12px;
  font-style: normal;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}
.tn-salary-main-sub b {
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  font-weight: 700;
}

.tn-salary-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tn-salary-summary > div {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--sal-soft);
  background: var(--sal-card);
}
.tn-salary-summary dt {
  font-size: 11px;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}
.tn-salary-summary dd {
  font: 700 15px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  word-break: keep-all;
}

/* deduction detail: gap-separated rows, not a spreadsheet (#35) */
.tn-salary-ded {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--sal-soft);
  background: var(--sal-band-bg);
}
.tn-salary-ded-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}
.tn-salary-ded-head small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.tn-salary-ded-list {
  display: grid;
  gap: 6px;
}
.tn-salary-ded-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--sal-soft);
  background: var(--sal-card);
}
.tn-salary-ded-list dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
}
.tn-salary-ded-list dd {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
}
.tn-salary-ded-list em {
  font-size: 11px;
  font-style: normal;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}
.tn-salary-ded-list strong {
  font: 700 14px/1.2 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
  white-space: nowrap;
}

.tn-salary-disclaimer {
  margin: 2px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--sal-track);
  font-size: 11px;
  line-height: 1.5;
  color: var(--sal-muted);
  -webkit-text-fill-color: var(--sal-muted);
}

/* Mobile: single column, input above result, no horizontal scroll (#36) */
@media (max-width: 720px) {
  .tn-salary-workspace { grid-template-columns: minmax(0, 1fr); }
  .tn-salary-input { border-right: 0; border-bottom: 1px solid var(--sal-line); }
}
@media (max-width: 400px) {
  .tn-salary-summary { grid-template-columns: minmax(0, 1fr); }
}

/* Dark / inverse / auto-dark (#8/#14) */
body:is([data-scheme="dark"], [data-scheme="inverse"], [data-scheme="auto"][data-d="dark"], [data-scheme="auto"][data-l="dark"]):not([data-scheme="light"]) .tn-salary-tool,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-salary-tool,
html[data-scheme="inverse"] body:not([data-scheme="light"]) .tn-salary-tool {
  --sal-ink: #efe6d2;
  --sal-muted: #c3b492;
  --sal-line: #6f6047;
  --sal-soft: #574a37;
  --sal-paper: #241d12;
  --sal-wash: #221b11;
  --sal-surface: #1f1810;
  --sal-card: rgba(58, 48, 32, 0.5);
  --sal-band-bg: rgba(58, 48, 32, 0.36);
  --sal-accent: #e8823f;
  --sal-accent-soft: rgba(232, 130, 63, 0.28);
  --sal-track: rgba(120, 104, 74, 0.3);
  --sal-btn-sec-bg: #33291a;
  --sal-btn-sec-hover: #453720;
  --sal-btn-sec-text: #efe6d2;
  --sal-btn-pri-bg: #e8823f;
  --sal-btn-pri-hover: #f2a061;
  --sal-btn-pri-text: #241206;
  color: var(--sal-ink);
  -webkit-text-fill-color: var(--sal-ink);
}

@media (prefers-color-scheme: dark) {
  body[data-scheme="auto"]:not([data-scheme="light"]) .tn-salary-tool {
    --sal-ink: #efe6d2;
    --sal-muted: #c3b492;
    --sal-line: #6f6047;
    --sal-soft: #574a37;
    --sal-paper: #241d12;
    --sal-wash: #221b11;
    --sal-surface: #1f1810;
    --sal-card: rgba(58, 48, 32, 0.5);
    --sal-band-bg: rgba(58, 48, 32, 0.36);
    --sal-accent: #e8823f;
    --sal-accent-soft: rgba(232, 130, 63, 0.28);
    --sal-track: rgba(120, 104, 74, 0.3);
    --sal-btn-sec-bg: #33291a;
    --sal-btn-sec-hover: #453720;
    --sal-btn-sec-text: #efe6d2;
    --sal-btn-pri-bg: #e8823f;
    --sal-btn-pri-hover: #f2a061;
    --sal-btn-pri-text: #241206;
    color: var(--sal-ink);
    -webkit-text-fill-color: var(--sal-ink);
  }
}
