/* =========================================================
 * SALON PAYDAY — 토스 스타일 (클린 화이트 & 토스블루)
 * ========================================================= */

:root {
  --bg: #ffffff;
  --surface: #f9fafb;      /* 카드 */
  --surface-2: #f2f4f6;    /* 세그먼트·칩 */
  --line: #e5e8eb;
  --track: #f2f4f6;

  --ink: #191f28;
  --ink-dim: #4e5968;
  --ink-faint: #6b7684;
  --ink-ghost: #8b95a1;

  --blue: #3182f6;         /* 큰 숫자·포인트 */
  --blue-deep: #1b64da;    /* 작은 파란 텍스트 */
  --blue-btn: #2272eb;     /* 버튼 */
  --blue-bg: #e8f3ff;      /* 콜아웃 배경 */
  --red: #e5344a;          /* 공제 금액 */

  --font-body: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', -apple-system, sans-serif;

  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --radius: 24px;
  --pad-card: clamp(1.2rem, 4.5vw, 1.7rem);

  --dur-fast: 150ms;
  --dur: 300ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  letter-spacing: -0.015em;
  padding: 0 clamp(1rem, 4vw, 2rem) 3rem;
  max-width: 560px;
  margin-inline: auto;
  position: relative;
}

.glow { display: none; }

/* ---------- 헤더 / 히어로 ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 0 0;
}
.brand-mark {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--blue-deep);
}
.settings-jump {
  background: var(--surface-2);
  border: 0;
  border-radius: 99px;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.settings-jump:hover,
.settings-jump:focus-visible { background: #e8ebee; color: var(--ink); }
.settings-jump:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.hero { padding: clamp(1.9rem, 6.5vw, 3rem) 0 1.5rem; }
.hero-eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: -0.01em;
}
.hero h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.85rem, 7.8vw, 2.6rem);
  line-height: 1.32;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.hero h1 em {
  font-style: normal;
  color: var(--blue);
  position: relative;
}
.hero h1 em::after {
  content: '';
  position: absolute;
  left: -0.06em;
  right: -0.06em;
  bottom: 0.02em;
  height: 0.5em;
  background: var(--blue-bg);
  border-radius: 0.2em;
  z-index: -1;
}
.hero-sub {
  margin: 0.9rem 0 0;
  color: var(--ink-faint);
  font-size: 0.95rem;
  font-weight: 500;
}

/* ---------- 탭 (토스 세그먼트) ---------- */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border: 0;
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 1rem;
}
.tab {
  position: relative;
  z-index: 1;
  background: none;
  border: 0;
  padding: 0.72rem 0.5rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-ghost);
  cursor: pointer;
  transition: color var(--dur) var(--ease-out);
}
.tab.is-active { color: var(--ink); }
.tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgb(2 32 71 / 0.1), 0 4px 10px rgb(2 32 71 / 0.06);
  transition: transform var(--dur) var(--ease-out);
}
.tabs.reverse-active .tab-indicator { transform: translateX(100%); }

/* ---------- 카드 공통 ---------- */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  padding: var(--pad-card);
  margin-bottom: 0.9rem;
}

.panel { animation: panel-in var(--dur) var(--ease-out); }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 금액 입력 ---------- */
.field-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}
.money-field {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.35rem;
  transition: border-color var(--dur-fast);
}
.money-field:focus-within { border-color: var(--blue); }
.money-field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1.85rem, 7.8vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 0;
  caret-color: var(--blue);
}
.money-field input::placeholder { color: var(--ink-ghost); }
.money-field .unit {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-ghost);
}
.field-hint {
  margin: 0.45rem 0 0.9rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--blue-deep);
  min-height: 1.2em;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip {
  background: var(--surface-2);
  border: 0;
  border-radius: 10px;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-size: 0.83rem;
  font-weight: 600;
  padding: 0.48rem 0.85rem;
  cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.chip:hover, .chip:focus-visible { background: #e8ebee; }
.chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.chip:active { transform: scale(0.97); }
.chip-clear { color: var(--red); }

.workdays-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-dim);
}
.workdays-row input {
  width: 4.2rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  padding: 0.42rem 0.2rem;
}
.workdays-row input:focus-visible { outline: 2px solid var(--blue); border-color: transparent; }

/* ---------- 결과 카드 ---------- */
.result-card {
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgb(2 32 71 / 0.06);
}
.result-label {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-faint);
}
.takehome {
  margin: 0.25rem 0 0;
  font-weight: 800;
  font-size: clamp(2.4rem, 11.5vw, 3.4rem);
  line-height: 1.18;
  color: var(--blue);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.takehome .won {
  font-size: 0.44em;
  font-weight: 700;
  color: var(--ink-dim);
  margin-left: 0.12em;
}
.result-sub {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-faint);
}

.nudge {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: var(--blue-bg);
  border: 0;
  font-size: 0.87rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--blue-deep);
}
.nudge strong { color: var(--blue-deep); font-weight: 800; }

/* ---------- 정산 흐름 (워터폴) ---------- */
.flow {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--line);
}
.flow li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.36rem 0;
  font-size: 0.9rem;
  animation: row-in 0.45s var(--ease-out) backwards;
}
.flow li:nth-child(1) { animation-delay: 0.03s; }
.flow li:nth-child(2) { animation-delay: 0.07s; }
.flow li:nth-child(3) { animation-delay: 0.11s; }
.flow li:nth-child(4) { animation-delay: 0.15s; }
.flow li:nth-child(5) { animation-delay: 0.19s; }
.flow li:nth-child(6) { animation-delay: 0.23s; }
.flow li:nth-child(7) { animation-delay: 0.27s; }
.flow li:nth-child(8) { animation-delay: 0.31s; }
.flow li:nth-child(9) { animation-delay: 0.35s; }
.flow li:nth-child(10) { animation-delay: 0.39s; }
@keyframes row-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}

.flow .row-label { color: var(--ink-dim); font-weight: 500; white-space: nowrap; }
.flow .row-note { font-size: 0.78rem; font-weight: 500; color: var(--ink-ghost); margin-left: 0.3rem; }
.flow .row-bar {
  height: 4px;
  border-radius: 4px;
  align-self: center;
  background: var(--track);
  overflow: hidden;
  position: relative;
}
.flow .row-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  transform-origin: left;
  animation: bar-in 0.7s var(--ease-out) backwards;
}
@keyframes bar-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.flow .row-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.flow .is-minus .row-amount { color: var(--red); }
.flow .is-minus .row-bar i { background: #f04452; }
.flow .is-plus .row-amount { color: var(--blue-deep); }
.flow .is-plus .row-bar i { background: var(--blue); }
.flow .is-neutral .row-amount { color: var(--ink); }
.flow .is-neutral .row-bar i { background: var(--ink-ghost); }

.flow .is-subtotal {
  border-top: 1px dashed var(--line);
  margin-top: 0.3rem;
  padding-top: 0.62rem;
}
.flow .is-subtotal .row-label { color: var(--ink); font-weight: 700; }
.flow .is-total {
  border-top: 1px solid var(--line);
  margin-top: 0.4rem;
  padding-top: 0.72rem;
}
.flow .is-total .row-label { color: var(--ink); font-weight: 800; }
.flow .is-total .row-amount { color: var(--blue); font-size: 1.05rem; font-weight: 800; }

/* ---------- 공유 버튼 (토스 CTA) ---------- */
.share-btn {
  display: block;
  width: 100%;
  margin-top: 1.3rem;
  padding: 0.95rem;
  border: 0;
  border-radius: 14px;
  background: var(--blue-btn);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.share-btn:hover { background: var(--blue-deep); }
.share-btn:active { transform: scale(0.98); }
.share-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- 정산 조건 ---------- */
.settings {
  margin-top: 1.5rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.settings summary {
  list-style: none;
  cursor: pointer;
  padding: 1.1rem var(--pad-card);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  transition: background var(--dur-fast);
}
.settings summary::-webkit-details-marker { display: none; }
.settings summary::after {
  content: '↓';
  position: absolute;
  right: var(--pad-card);
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-ghost);
  font-size: 1rem;
  font-weight: 700;
  transition: rotate var(--dur) var(--ease-out);
}
.settings[open] summary::after { rotate: 180deg; }
.settings summary:hover { background: var(--surface-2); }
.settings-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.settings-desc { font-size: 0.82rem; font-weight: 500; color: var(--ink-faint); }

.settings-body {
  padding: 0 var(--pad-card) var(--pad-card);
  display: grid;
  gap: 1.3rem;
}
.setting-group {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 1.1rem 0 0;
}
.setting-group legend {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue-deep);
  padding-right: 0.7rem;
  letter-spacing: 0.02em;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem 0;
}
.setting-row label { font-size: 0.9rem; font-weight: 500; color: var(--ink-dim); }
.pct-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-faint);
  font-size: 0.86rem;
  font-weight: 500;
}
.pct-field input {
  width: 4.6rem;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
  padding: 0.48rem 0.6rem;
}
.won-field input { width: 7.4rem; }
.pct-field input:focus-visible { outline: 2px solid var(--blue); border-color: transparent; }

.setting-row select,
.text-field {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.52rem 0.65rem;
  max-width: 60%;
}
.text-field { flex: 1; }
.setting-row select:focus-visible,
.text-field:focus-visible { outline: 2px solid var(--blue); border-color: transparent; }

.setting-note {
  margin: 0.15rem 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-faint);
  line-height: 1.55;
}

/* 구간 편집기 */
.tier-editor { margin-top: 0.6rem; }
.tier-head,
.tier-row {
  display: grid;
  grid-template-columns: 1fr 5.6rem 2rem;
  gap: 0.5rem;
  align-items: center;
}
.tier-head {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-faint);
  padding-bottom: 0.35rem;
}
.tier-row { padding: 0.28rem 0; }
.tier-row .tier-min-wrap,
.tier-row .tier-rate-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}
.tier-row input {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
  padding: 0.44rem 0.55rem;
  width: 100%;
  min-width: 0;
}
.tier-row input:focus-visible { outline: 2px solid var(--blue); border-color: transparent; }
.tier-remove {
  background: none;
  border: 0;
  color: var(--ink-ghost);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 8px;
  transition: color var(--dur-fast);
}
.tier-remove:hover, .tier-remove:focus-visible { color: var(--red); }
.tier-remove:focus-visible { outline: 2px solid var(--blue); }
.tier-add {
  margin-top: 0.5rem;
  background: none;
  border: 1.5px dashed #c5cad1;
  border-radius: 12px;
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  width: 100%;
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.tier-add:hover, .tier-add:focus-visible { color: var(--blue-deep); border-color: var(--blue); }

.reset-btn {
  background: var(--surface-2);
  border: 0;
  border-radius: 12px;
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.65rem;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.reset-btn:hover, .reset-btn:focus-visible { background: #e8ebee; color: var(--red); }

/* ---------- 푸터 / 토스트 ---------- */
.site-footer {
  margin-top: 2.2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.disclaimer { font-size: 0.78rem; font-weight: 500; color: var(--ink-ghost); margin: 0 0 0.5rem; }
.credit {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-faint);
  margin: 0;
  letter-spacing: -0.01em;
}
.company {
  margin: 0.4rem 0 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-ghost);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  translate: -50% 0;
  background: #333d4b;
  color: #ffffff;
  font-size: 0.87rem;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgb(25 31 40 / 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--dur), transform var(--dur) var(--ease-out);
  max-width: min(90vw, 420px);
  text-align: center;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- 스크린리더 전용 ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 모션 최소화 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 좁은 화면 보정 ---------- */
@media (max-width: 360px) {
  .setting-row { flex-wrap: wrap; }
  .setting-row select, .text-field { max-width: 100%; width: 100%; }
}

/* ---------- 브랜드 가위 아이콘 (Lucide) ---------- */
.brand-scissors {
  width: 1em;
  height: 1em;
  vertical-align: -0.12em;
  color: #4e55ec;
}

/* ---------- 사용 방법 3단계 ---------- */
.howto {
  list-style: none;
  margin: 1.5rem auto 0;
  padding: 0;
  max-width: 560px;
  display: grid;
  gap: 8px;
  text-align: left;
}
.howto li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e8eb;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.875rem;
  color: #4e5968;
  word-break: keep-all;
}
.howto li b {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #e9eafd;
  color: #3d43d6;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 900;
}

/* ---------- INPACT+ 홈 링크 ---------- */
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 800;
  color: #4e55ec;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e9eafd;
  transition: background 150ms ease;
}
.home-link:hover { background: #d9dbfb; }
