.m-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(17, 17, 17, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: mFade .2s var(--ease);
}

.m-card {
  position: relative;
  width: 100%;
  max-width: 28rem;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: var(--r-xl);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  animation: mUp .28s var(--ease);
}

@keyframes mFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mUp { from { opacity: 0; transform: translateY(1.25rem); } to { opacity: 1; transform: none; } }

.m-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  background: var(--bg);
}

.m-head h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.m-head p { margin-top: .25rem; font-size: .875rem; color: var(--muted); }

.m-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
  transition: background-color .2s var(--ease);
}

.m-x:hover { background: var(--bg-warm); }
.m-x svg { width: 1.125rem; height: 1.125rem; }

.m-body { padding: .5rem 1.5rem 1.5rem; }

.f-field { display: block; margin-bottom: 1rem; }
.f-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.f-label { display: block; margin-bottom: .375rem; font-size: .8125rem; font-weight: 600; color: var(--text); }
.f-count { font-size: .75rem; color: var(--muted); }

.f-input {
  width: 100%;
  min-height: 3.25rem;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.f-input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--bg-warm); }
.f-input::placeholder { color: var(--muted); }
.f-textarea { min-height: 5.5rem; resize: vertical; line-height: 1.45; }

.f-err { margin-bottom: .75rem; font-size: .875rem; font-weight: 500; color: #b3261e; }
.f-note { margin-top: .875rem; font-size: .75rem; line-height: 1.5; text-align: center; color: var(--muted); }

.m-success { padding: 1.5rem 0 .5rem; text-align: center; color: var(--champagne-ink); }
.m-success svg { width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem; }
.m-success h3 { font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.m-success p { margin-top: .375rem; font-size: .875rem; color: var(--muted); }

.m-card--wide { max-width: 50rem; }

.calc-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  padding: .25rem;
  border-radius: var(--pill);
  background: var(--bg-soft);
}

.calc-tab {
  flex: 1;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}

.calc-tab:hover { color: var(--ink); }
.calc-tab.is-on { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sm); }

.calc-chart {
  margin: 0 -1.5rem;
  padding: 0 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.calc-chart::-webkit-scrollbar { display: none; }

.calc-inner { min-width: 38rem; }

.calc-label {
  margin-bottom: .625rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--champagne-ink);
}

.calc-label--lower { margin: .625rem 0 0; }
.calc-label--opts { margin-top: 1.5rem; }

.calc-jaw { display: flex; gap: .3125rem; }

.calc-tooth {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  height: 4.5rem;
  padding: .3125rem 0 .25rem;
  border: 1.5px solid var(--line);
  border-radius: .5rem .5rem .75rem .75rem;
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease), box-shadow .15s var(--ease);
}

.calc-tooth.is-lower { border-radius: .75rem .75rem .5rem .5rem; }

.calc-tooth img {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 0 .1875rem;
  object-fit: contain;
  pointer-events: none;
}

.calc-tooth.is-lower img { transform: scaleY(-1); }
.calc-tooth.is-lower .calc-tooth__num { order: -1; margin: 0 0 .125rem; }

.calc-tooth__num {
  flex: none;
  margin-top: .125rem;
  font-size: .625rem;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.calc-tooth:hover { border-color: var(--champagne); }

.calc-tooth.is-on {
  border-color: var(--champagne-ink);
  background: var(--bg-warm);
  box-shadow: 0 0 0 3px rgba(184, 155, 114, .22);
}

.calc-tooth.is-on .calc-tooth__num { color: var(--ink); }

.calc-sep {
  display: block;
  height: 1px;
  margin: .625rem 0;
  background: repeating-linear-gradient(90deg, var(--line) 0 .375rem, transparent .375rem .75rem);
}

.calc-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: .5rem;
}

.calc-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .125rem;
  min-height: 4.5rem;
  padding: .875rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}

.calc-opt:hover { border-color: var(--champagne); }
.calc-opt.is-on { border-color: var(--ink); background: var(--bg-soft); }
.calc-opt__name { font-size: .9375rem; font-weight: 600; color: var(--ink); }
.calc-opt__price { font-size: .875rem; font-weight: 600; color: var(--champagne-ink); }
.calc-opt__note { font-size: .75rem; line-height: 1.35; color: var(--muted); }

.calc-result {
  margin-top: 1.25rem;
  padding: 1.25rem 1.375rem;
  border-radius: var(--r-lg);
  background: radial-gradient(90% 140% at 85% 50%, #22201e 0%, var(--dark) 60%);
  color: rgba(255, 255, 255, .72);
}

.m-body > .calc-result:first-child { margin-top: 0; }
.calc-result__count { font-size: .8125rem; color: rgba(255, 255, 255, .6); }
.calc-result__label { margin-top: .625rem; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--champagne); }
.calc-result__sum { margin-top: .125rem; white-space: nowrap; font-size: 1.75rem; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; color: #fff; }
.calc-result__month { margin-top: .375rem; font-size: .875rem; }
.calc-result__month b { font-weight: 600; color: var(--champagne); }
.calc-result__free { display: flex; align-items: center; gap: .375rem; margin-top: .625rem; padding-top: .625rem; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .8125rem; color: rgba(255, 255, 255, .85); }
.calc-result__free svg { flex: none; width: 1rem; height: 1rem; color: var(--champagne); }
.calc-result__empty { margin-top: .5rem; font-size: .9375rem; color: rgba(255, 255, 255, .85); }

.calc-note { margin-top: .75rem; font-size: .8125rem; line-height: 1.45; color: var(--muted); }

.calc-ctas { display: flex; gap: .5rem; margin-top: 1rem; }
.calc-send { flex: 1; }
.calc-send:disabled { opacity: .45; cursor: not-allowed; }

.calc-form-title { margin: 1.25rem 0 .875rem; font-size: 1.0625rem; font-weight: 600; color: var(--ink); }

@media (max-width: 480px) {
  .m-overlay { align-items: flex-end; padding: 0; }
  .m-card { max-width: 100%; max-height: 94dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .m-head, .m-body { padding-left: 1rem; padding-right: 1rem; }
  .calc-chart { margin: 0; padding: 0; overflow: visible; }
  .calc-inner { min-width: 0; }
  .calc-jaw { flex-wrap: wrap; row-gap: .375rem; }
  .calc-tooth { flex: 0 0 calc((100% - 7 * .3125rem) / 8); height: 4.25rem; }
  .calc-tab { padding: 0 .5rem; font-size: .875rem; }
  .calc-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc-opt { min-height: 0; padding: .75rem .875rem; }
  .calc-opt__name { font-size: .875rem; }
  .calc-opt__price { font-size: .8125rem; }
  .calc-result__sum { font-size: 1.5rem; }
  .calc-ctas { flex-direction: column; }
}
