/* ============================================================
   DIA v3 — components
   buttons · cards · pills · forms · tabs · accordion · dialog
   conversation · steps · sliders · toast
   ============================================================ */

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 46px;
  padding: 0.7rem 1.35rem;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-base), transform var(--t-fast), opacity var(--t-fast);
  border: 1px solid transparent;
  text-align: center;
}
.btn:hover { background: var(--primary-hover); color: #fff; text-decoration: none; }
.btn:active { transform: scale(0.985); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--lg { min-height: 52px; padding: 0.85rem 1.7rem; font-size: var(--fs-body); }
.btn--sm { min-height: 44px; padding: 0.45rem 1.05rem; font-size: var(--fs-xs); }
.btn--block { width: 100%; }

.btn--secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.btn--secondary:hover { background: var(--surface); color: var(--text-primary); border-color: rgba(0,0,0,0.22); }

.btn--quiet { background: transparent; color: var(--primary); }
.btn--quiet:hover { background: var(--primary-soft); color: var(--primary-hover); }

.btn--dark { background: var(--text-primary); color: #fff; }
.btn--dark:hover { background: #000; color: #fff; }

.on-dark .btn--secondary { color: #fff; border-color: rgba(255,255,255,0.24); }
.on-dark .btn--secondary:hover { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.4); }

/* text link with chevron */
.link-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--primary);
  min-height: 44px;
}
.link-more::after {
  content: "";
  width: 6px; height: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--t-fast);
}
.link-more:hover { text-decoration: none; }
.link-more:hover::after { transform: rotate(-45deg) translate(2px, 2px); }
.link-more[aria-expanded="true"]::after { transform: rotate(45deg); }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s6);
  box-shadow: var(--sh-sm);
}
.card--pad-lg { padding: clamp(1.5rem, 1rem + 1.6vw, 2.5rem); }
.card--outline { box-shadow: none; border: 1px solid var(--border-soft); }
.card--soft { background: var(--surface-soft); box-shadow: none; border: 1px solid var(--border-soft); }
.card--lift { transition: box-shadow var(--t-base), transform var(--t-base); }
.card--lift:hover { box-shadow: var(--sh-lg); transform: translateY(-2px); }
.on-dark .card { background: var(--dark-surface); border: 1px solid var(--dark-border); box-shadow: none; color: var(--text-on-dark-soft); }

.panel {
  background: var(--surface);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-xl);
  overflow: hidden;
}
.on-dark .panel { background: var(--dark-surface); border: 1px solid var(--dark-border); box-shadow: none; }

/* ---------------- Pills / labels ---------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.pill--primary { background: var(--primary-soft); color: var(--primary); }
.pill--positive { background: var(--positive-soft); color: var(--positive); }
.pill--outline { background: transparent; border: 1px solid var(--border-medium); }
.on-dark .pill { background: rgba(255,255,255,0.08); color: var(--text-on-dark-soft); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------------- Feature list ---------------- */
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: var(--s3);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.ticks li::before {
  content: "";
  position: absolute;
  left: 1px; top: 0.42em;
  width: 13px; height: 7px;
  border-left: 1.8px solid var(--primary);
  border-bottom: 1.8px solid var(--primary);
  transform: rotate(-45deg);
}
.on-dark .ticks li { color: var(--text-on-dark-soft); }
.on-dark .ticks li::before { border-color: #38D6EA; }

/* ---------------- Forms ---------------- */
.field { margin-bottom: var(--s4); min-width: 0; }
.field > label, .legend {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  font-weight: 500;
}
.hint { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--text-muted); }

.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-md);
  font-size: 17px;          /* keeps iOS from zooming */
  letter-spacing: -0.01em;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select {
  padding-right: 2.3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236E6E73' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M5.5 8L10 12.5 14.5 8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 18px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--sh-focus);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

.err { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--danger); }
.err:empty { display: none; }

fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }

/* choice chips (checkbox / radio styled as cards) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); }
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.choice input { accent-color: var(--primary); width: 18px; height: 18px; flex: none; }
.choice:hover { border-color: rgba(0,0,0,0.22); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice:has(input:focus-visible) { box-shadow: var(--sh-focus); }

/* big selection tile used by the configurator */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--s4);
  min-height: 92px;
  border: 1px solid var(--border-medium);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-base), transform var(--t-fast);
}
.tile:hover { border-color: rgba(0,0,0,0.22); box-shadow: var(--sh-sm); }
.tile[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.tile__icon { width: 22px; height: 22px; color: var(--primary); }
.tile__name { font-weight: 500; font-size: var(--fs-sm); }
.tile__note { font-size: var(--fs-xs); color: var(--text-muted); }

/* slider + number pair */
.rangepair { display: grid; grid-template-columns: 1fr 92px; gap: var(--s3); align-items: center; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary) var(--fill, 0%), var(--surface-sunken) var(--fill, 0%));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-sunken); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--primary); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border-medium);
  box-shadow: var(--sh-md);
  transition: transform var(--t-fast);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border-medium);
  box-shadow: var(--sh-md);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.08); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--sh-focus); }
.rangepair .input { min-height: 44px; text-align: center; padding-inline: 0.4rem; }

.status-note {
  display: flex;
  gap: var(--s3);
  align-items: flex-start;
  margin-top: var(--s4);
  padding: var(--s4);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
}
.status-note[data-tone="success"] { background: rgba(22,163,74,0.07); border-color: rgba(22,163,74,0.22); color: #14663A; }
.status-note[data-tone="error"] { background: rgba(208,52,44,0.06); border-color: rgba(208,52,44,0.22); color: #8E2A24; }
.status-note[data-tone="info"] { background: var(--primary-soft); border-color: rgba(21, 94, 239,0.2); color: #08508F; }
.status-note[data-tone="wait"] { background: var(--surface-sunken); border-color: var(--border-soft); color: var(--text-secondary); }
.status-note[data-tone="warning"] { background: rgba(180,83,9,0.07); border-color: rgba(180,83,9,0.24); color: #7C3D06; }
.status-note a { color: inherit; text-decoration: underline; }
.status-note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

.honeypot { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------------- Tabs ---------------- */
.tabs {
  display: flex;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
  background: var(--surface-sunken);
  border-radius: var(--r-pill);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs--plain { background: transparent; padding: 0; gap: var(--s2); }
.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0.45rem 1rem;
  border-radius: var(--r-pill);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--sh-xs);
}
.tab svg { width: 16px; height: 16px; }
.on-dark .tabs { background: rgba(255,255,255,0.07); }
.on-dark .tab { color: var(--text-on-dark-soft); }
.on-dark .tab[aria-selected="true"] { background: rgba(255,255,255,0.14); color: #fff; box-shadow: none; }

.tabpanel[hidden] { display: none !important; }
.tabpanel { animation: panel-in var(--t-slow) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Accordion ---------------- */
.acc { border-top: 1px solid var(--border-soft); }
.acc__item { border-bottom: 1px solid var(--border-soft); }
.acc__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: 60px;
  padding: var(--s4) 0;
  text-align: left;
  font-size: var(--fs-body);
  font-weight: 500;
  letter-spacing: -0.012em;
  cursor: pointer;
  color: var(--text-primary);
}
.acc__btn:hover { color: var(--primary); }
.acc__sign {
  position: relative;
  flex: none;
  width: 16px; height: 16px;
}
.acc__sign::before, .acc__sign::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  background: var(--text-muted);
  border-radius: 1px;
  transition: opacity var(--t-base), background var(--t-fast);
}
.acc__sign::before { width: 13px; height: 1.6px; }
.acc__sign::after { width: 1.6px; height: 13px; }
.acc__btn[aria-expanded="true"] .acc__sign::after { opacity: 0; }
.acc__btn[aria-expanded="true"] .acc__sign::before { background: var(--primary); }
.acc__panel { padding: 0 0 var(--s5); color: var(--text-secondary); font-size: var(--fs-sm); max-width: 44rem; }
.acc__panel > *:first-child { margin-top: 0; }

/* ---------------- Dialog ---------------- */
dialog.modal {
  width: min(1060px, calc(100vw - 2rem));
  max-height: min(86vh, 900px);
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-xl);
  overflow: hidden;
}
dialog.modal::backdrop { background: rgba(16, 17, 20, 0.34); backdrop-filter: blur(4px); }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.modal__head h2 { margin: 0; font-size: var(--fs-h3); }
.modal__body { padding: var(--s5) var(--s6) var(--s7); overflow-y: auto; max-height: calc(86vh - 78px); }
.modal__close {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal__close:hover { background: var(--border-soft); color: var(--text-primary); }
.modal__close svg { width: 16px; height: 16px; }

/* ---------------- Conversation ---------------- */
.convo {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s5);
  min-height: 320px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.msg {
  max-width: 82%;
  padding: 0.6rem 0.9rem;
  border-radius: 18px;
  font-size: var(--fs-sm);
  line-height: 1.45;
  letter-spacing: -0.008em;
  animation: msg-in 320ms var(--ease-out) both;
  overflow-wrap: anywhere;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.msg--customer {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.msg--dia {
  align-self: flex-start;
  background: var(--surface-sunken);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}
.on-dark .msg--dia { background: rgba(255,255,255,0.09); color: #ECECEF; }
.msg--voice { font-style: normal; }
.msg__who {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
}

.typing { display: inline-flex; gap: 4px; align-items: center; height: 12px; }
.typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: bounce 1.15s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: 0.14s; }
.typing i:nth-child(3) { animation-delay: 0.28s; }
@keyframes bounce { 0%, 62%, 100% { transform: translateY(0); opacity: 0.35; } 30% { transform: translateY(-3px); opacity: 0.9; } }

/* result checklist */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.results li {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0.6rem 0.2rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  opacity: 0.45;
  transition: opacity var(--t-slow), color var(--t-slow);
  margin: 0;
}
.results li.is-done { opacity: 1; color: var(--text-primary); }
.on-dark .results li { color: var(--text-on-dark-soft); }
.on-dark .results li.is-done { color: #fff; }
.results__mark {
  flex: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: grid;
  place-items: center;
  position: relative;
}
.results li.is-done .results__mark { background: var(--positive); border-color: var(--positive); }
.results__mark::after {
  content: "";
  width: 8px; height: 4.5px;
  border-left: 1.8px solid #fff;
  border-bottom: 1.8px solid #fff;
  transform: rotate(-45deg) scale(0.4);
  opacity: 0;
  transition: opacity var(--t-base), transform var(--t-base);
  margin-top: -2px;
}
.results li.is-done .results__mark::after { opacity: 1; transform: rotate(-45deg) scale(1); }

/* ---------------- Steps ---------------- */
.stepline { display: grid; gap: var(--s6); grid-template-columns: repeat(3, minmax(0, 1fr)); position: relative; }
.step__num {
  font-size: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--primary);
  margin-bottom: var(--s4);
  font-variant-numeric: tabular-nums;
}
.step h3 { margin-bottom: var(--s2); }
.step p { color: var(--text-secondary); font-size: var(--fs-sm); max-width: 26rem; }

/* progress dots for the configurator */
.stepdots { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s6); flex-wrap: wrap; }
.stepdot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 500;
  transition: background var(--t-base), color var(--t-base);
}
.stepdot b {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
}
.stepdot[data-state="active"] { background: var(--primary-soft); color: var(--primary); }
.stepdot[data-state="active"] b { background: var(--primary); color: #fff; }
.stepdot[data-state="done"] { color: var(--text-primary); }
.stepdot[data-state="done"] b { background: var(--positive); color: #fff; }

/* ---------------- Toast ---------------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  translate: -50% 0;
  z-index: 200;
  display: grid;
  gap: var(--s2);
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  background: rgba(16,17,20,0.92);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  box-shadow: var(--sh-lg);
  animation: msg-in 240ms var(--ease-out) both;
}
