/* Lowest-rate finder — full-page chat */

.cx-page { background: #fff; overflow: hidden; }
.cx {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Top bar */
.cx-top {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 56px;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.cx-top .brand { font-size: 1.02rem; justify-self: start; }
.cx-top .brand-mark { width: 20px; height: 20px; }
.cx-title { font-size: .9rem; font-weight: 600; color: var(--ink); }
.cx-reset {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  height: 34px;
  padding: 0 .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
}
.cx-reset:hover { color: var(--ink); border-color: var(--line-2); }
.cx-reset svg { width: 15px; height: 15px; }

/* Thread */
.cx-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.cx-thread {
  width: min(760px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.cx-msg { display: flex; gap: .85rem; animation: cxIn .25s var(--ease) both; }
@keyframes cxIn { from { opacity: 0; transform: translateY(6px); } }

.cx-bot { align-items: flex-start; }
.cx-av {
  flex: 0 0 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 50%;
  background: url("/assets/img/rankomate-icon.png") center / cover no-repeat;
}
.cx-body { flex: 1; min-width: 0; padding-top: 3px; }
.cx-body > p { font-size: .98rem; line-height: 1.55; color: var(--ink); }
.cx-body > p strong { font-weight: 700; color: var(--ink); }
.cx-list {
  margin: .45rem 0 .2rem;
  padding-left: 1.15rem;
  display: grid;
  gap: .35rem;
}
.cx-list li { font-size: .98rem; line-height: 1.45; color: var(--ink); }
.cx-body a { color: var(--g-700); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cx-hint {
  display: block;
  margin-top: .4rem;
  font-size: .85rem;
  color: var(--ink-3);
}
.cx-error .cx-body > p { color: #9a3412; }

.cx-user { justify-content: flex-end; }
.cx-bubble {
  max-width: 75%;
  padding: .65rem 1rem;
  border-radius: 18px;
  background: #f1f3f5;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.cx-dots { display: inline-flex; gap: 4px; padding: .55rem 0; }
.cx-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: cxDot 1s infinite ease-in-out;
}
.cx-dots i:nth-child(2) { animation-delay: .15s; }
.cx-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes cxDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Results card */
.cx-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.cx-card-head {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: #fafbfb;
}
.cx-card-head > div { padding: .95rem 1.1rem; }
.cx-card-head > div + div { border-left: 1px solid var(--line); }
.cx-card-head span { display: block; font-size: .72rem; color: var(--ink-3); margin-bottom: .2rem; }
.cx-card-head b { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-card-head small { font-size: .75rem; color: var(--ink-3); font-weight: 500; margin-left: 1px; }
.cx-card-head em {
  display: inline-block;
  margin-left: .45rem;
  padding: .1rem .4rem;
  border-radius: 4px;
  background: var(--g-50);
  color: var(--g-800);
  font-size: .68rem;
  font-style: normal;
  font-weight: 600;
  vertical-align: 2px;
}
.cx-save {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: #f2f8f5;
  font-size: .88rem;
}
.cx-save span { color: var(--ink-2); }
.cx-save b { color: var(--g-700); font-weight: 600; }
.cx-table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.cx-table th {
  padding: .65rem 1.1rem;
  text-align: right;
  font-size: .72rem;
  font-weight: 500;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.cx-table th:first-child, .cx-table td:first-child { text-align: left; }
.cx-table td {
  padding: .85rem 1.1rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}
.cx-table td:first-child { color: var(--ink); font-weight: 500; }
.cx-table tr.is-best td { background: #f2f8f5; }
.cx-table tr.is-best td:nth-child(2) { color: var(--g-700); font-weight: 600; }
.cx-rank {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: .6rem;
  border-radius: 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: .7rem;
  font-weight: 600;
  color: var(--ink-2);
}
.is-best .cx-rank { background: var(--g-700); border-color: var(--g-700); color: #fff; }
.cx-blur { filter: blur(5px); user-select: none; }
.cx-fit {
  display: inline-block;
  padding: .12rem .45rem;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
}
.cx-fit-strong { background: var(--g-50); color: var(--g-800); }
.cx-fit-good { background: var(--g-50); color: var(--g-700); }
.cx-fit-fair { background: #fef6e7; color: #92400e; }
.cx-fit-moderate { background: #fef6e7; color: #92400e; }
.cx-fit-weak { background: #f1f3f5; color: var(--ink-2); }
.cx-lock {
  padding: .75rem 1.1rem;
  font-size: .82rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.cx-card h4 {
  padding: 1rem 1.1rem .35rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
}
.cx-tips, .cx-docs, .cx-reasons { padding: 0 1.1rem .5rem; }
.cx-tips li { padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.cx-tips li:last-child { border-bottom: 0; }
.cx-tips b { display: block; font-weight: 600; margin-bottom: .1rem; }
.cx-tips span { color: var(--ink-2); }
.cx-reasons { padding-top: .85rem; border-bottom: 1px solid var(--line); }
.cx-reasons li { font-size: .88rem; color: var(--ink-2); padding: .2rem 0 .35rem; }
.cx-reasons b { color: var(--ink); font-weight: 600; }
.cx-docs { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem 1rem; padding-bottom: .9rem; }
.cx-docs li { position: relative; padding-left: 1.1rem; font-size: .88rem; color: var(--ink-2); }
.cx-docs li::before { content: "✓"; position: absolute; left: 0; color: var(--g-700); font-weight: 600; }
.cx-fine-in {
  padding: .7rem 1.1rem;
  border-top: 1px solid var(--line);
  font-size: .72rem;
  color: var(--ink-3);
}

/* Dock */
.cx-dock {
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 1.25rem);
  padding: .5rem 0 max(.75rem, env(safe-area-inset-bottom));
}
.cx-dock-inner { width: min(760px, calc(100% - 2.5rem)); margin: 0 auto; }
.cx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .75rem;
}
.cx-chips[hidden] { display: none; }
.cx-chip {
  min-height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  animation: cxIn .2s var(--ease) both;
  transition: border-color .15s, background .15s, color .15s;
}
.cx-chip:hover { border-color: var(--g-700); color: var(--g-800); background: #f6faf8; }
.cx-chip:active { background: var(--g-50); }

.cx-composer {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .4rem .4rem 1.1rem;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(15,23,42,.06);
  transition: border-color .15s, box-shadow .15s;
}
.cx-composer:focus-within { border-color: var(--ink-3); box-shadow: 0 2px 16px rgba(15,23,42,.1); }
.cx-composer input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 1rem;
}
.cx-composer input::placeholder { color: var(--ink-3); }
.cx-composer input:disabled { background: transparent; }
.cx-composer button {
  flex: 0 0 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--g-700);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.cx-composer button:hover { background: var(--g-800); }
.cx-composer button:disabled { opacity: .35; cursor: default; }
.cx-composer button svg { width: 18px; height: 18px; }
.cx-fine {
  margin-top: .55rem;
  text-align: center;
  font-size: .72rem;
  color: var(--ink-3);
}

@media (max-width: 640px) {
  .cx-top { padding: 0 1rem; grid-template-columns: 1fr auto; }
  .cx-title { display: none; }
  .cx-reset span { display: none; }
  .cx-reset { width: 34px; padding: 0; justify-content: center; }
  .cx-thread, .cx-dock-inner { width: calc(100% - 2rem); }
  .cx-thread { padding-top: 1.25rem; gap: 1.1rem; }
  .cx-av { flex-basis: 24px; height: 24px; }
  .cx-msg { gap: .6rem; }
  .cx-body > p, .cx-bubble { font-size: .97rem; }
  .cx-bubble { max-width: 85%; }
  .cx-chips { gap: .4rem; margin-bottom: .6rem; }
  .cx-chip { min-height: 38px; padding: 0 .8rem; font-size: .88rem; }
  .cx-card-head { grid-template-columns: 1fr 1fr; }
  .cx-card-head > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .cx-card-head > div:nth-child(2) { border-left: 0; }
  .cx-table th, .cx-table td { padding-inline: .7rem; }
  .cx-table th:nth-child(4), .cx-table td:nth-child(4) { display: none; }
  .cx-docs { grid-template-columns: 1fr; }
}
