:root {
  color-scheme: light;
  --bg: #f4efe4;
  --paper: #fbf8ef;
  --panel: rgba(255, 253, 247, 0.94);
  --ink: #1f2420;
  --ink-soft: #303a34;
  --muted: #6f756d;
  --subtle: #8f948b;
  --line: #ded7c9;
  --line-strong: #c9c0ae;
  --accent: #225c4d;
  --accent-ink: #12382f;
  --accent-soft: #e7eee8;
  --seal: #aa3b2e;
  --seal-soft: #f6e5dd;
  --gold-wash: #dac28e;
  --warning: #92522c;
  --warning-soft: #fff0e4;
  --row-hover: #fffaf0;
  --danger-soft: #f7e9e6;
  --radius: 6px;
  --shadow: 0 14px 34px rgba(45, 39, 28, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 760px 340px at 8% 2%, rgba(34, 92, 77, 0.26), transparent 66%),
    radial-gradient(ellipse 700px 360px at 88% 0%, rgba(170, 59, 46, 0.22), transparent 62%),
    radial-gradient(ellipse 900px 440px at 50% 105%, rgba(218, 194, 142, 0.34), transparent 68%),
    repeating-linear-gradient(0deg, rgba(31, 36, 32, 0.025) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(90deg, rgba(31, 36, 32, 0.018) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, #f8f4e9 0%, var(--bg) 100%);
  min-height: 100vh;
  background-attachment: fixed, fixed, fixed, scroll, scroll, fixed;
  color: var(--ink);
  font-size: 14px;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 24%, rgba(31, 36, 32, 0.08) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 18%, rgba(31, 36, 32, 0.06) 0 1px, transparent 2px),
    radial-gradient(circle at 45% 82%, rgba(31, 36, 32, 0.05) 0 1px, transparent 2px),
    linear-gradient(105deg, transparent 0 46%, rgba(31, 36, 32, 0.04) 48%, transparent 52% 100%);
  background-size: 42px 42px, 58px 58px, 36px 36px, 220px 100%;
  content: "";
  opacity: 0.9;
}

body::after {
  position: fixed;
  inset: auto 0 0;
  z-index: -1;
  height: 46vh;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 92%, rgba(34, 92, 77, 0.2), transparent 58%),
    radial-gradient(ellipse at 72% 100%, rgba(31, 36, 32, 0.12), transparent 54%),
    linear-gradient(180deg, transparent, rgba(244, 239, 228, 0.96));
  content: "";
}

button,
input,
select {
  font: inherit;
}

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 16px clamp(18px, 3vw, 40px);
  background: rgba(255, 253, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.app-header::after {
  position: absolute;
  right: clamp(18px, 3vw, 40px);
  bottom: -1px;
  left: clamp(18px, 3vw, 40px);
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(31, 36, 32, 0.34), rgba(170, 59, 46, 0.35), transparent);
  content: "";
  opacity: 0.7;
}

.app-header::before {
  position: absolute;
  right: clamp(18px, 3vw, 40px);
  bottom: -10px;
  left: clamp(18px, 3vw, 40px);
  height: 24px;
  background:
    radial-gradient(ellipse at 10% 45%, rgba(31, 36, 32, 0.34), transparent 46%),
    radial-gradient(ellipse at 42% 55%, rgba(31, 36, 32, 0.28), transparent 42%),
    radial-gradient(ellipse at 78% 50%, rgba(170, 59, 46, 0.26), transparent 40%);
  content: "";
  filter: blur(5px);
  opacity: 0.72;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.seal-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--seal);
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(170, 59, 46, 0.08), transparent),
    #fffaf1;
  color: var(--seal);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.product-label,
.kicker {
  margin: 0 0 4px;
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
  line-height: 1.25;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.language-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-switch select {
  min-height: 32px;
  width: auto;
  min-width: 112px;
  background: var(--paper);
}

.header-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.header-meta strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 11px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.ghost-link:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  max-width: 1620px;
  margin: 0 auto;
  padding: 18px clamp(18px, 3vw, 40px) 26px;
}

.chat-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  align-items: stretch;
  max-width: 1320px;
  min-height: calc(100vh - 118px);
  margin: 0 auto;
  padding: 18px clamp(18px, 3vw, 40px) 30px;
}

.chat-stage,
.chat-profile-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: paperLift 520ms ease both;
}

.chat-stage {
  display: grid;
  grid-template-rows: 7px auto minmax(360px, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.chat-stage::before,
.chat-profile-panel::before {
  display: block;
  height: 7px;
  background:
    radial-gradient(ellipse at 8% 50%, rgba(34, 92, 77, 1), transparent 42%),
    radial-gradient(ellipse at 52% 50%, rgba(31, 36, 32, 0.5), transparent 45%),
    radial-gradient(ellipse at 88% 50%, rgba(170, 59, 46, 0.55), transparent 44%),
    linear-gradient(90deg, rgba(34, 92, 77, 0.86), rgba(170, 59, 46, 0.46), transparent);
  content: "";
}

.chat-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.model-pill {
  max-width: 280px;
  overflow: hidden;
  border: 1px solid rgba(34, 92, 77, 0.16);
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.74rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.large-chat-log {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  padding: 18px;
  background:
    radial-gradient(ellipse at 12% 0%, rgba(34, 92, 77, 0.08), transparent 42%),
    rgba(255, 253, 247, 0.42);
}

.large-chat-log .chat-message {
  max-width: min(760px, 92%);
}

.large-chat-log .chat-message.user {
  justify-self: end;
}

.large-chat-log .chat-message p {
  padding: 11px 12px;
  font-size: 0.96rem;
}

.large-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.88);
}

.large-chat-form textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  color: var(--ink);
  padding: 10px;
  font: inherit;
  line-height: 1.45;
}

.large-chat-form textarea:focus {
  outline: 3px solid rgba(13, 95, 82, 0.16);
  border-color: var(--accent);
}

.large-chat-form .chat-send-button {
  min-height: 74px;
}

.chat-profile-panel {
  display: grid;
  align-self: start;
  gap: 14px;
  padding: 16px;
}

.chat-spend-bars {
  display: grid;
  gap: 9px;
}

.chat-preview-bar {
  grid-template-columns: minmax(96px, 0.78fr) minmax(70px, 1fr) 58px;
}

.chat-note {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.profile-apply-link {
  text-decoration: none;
}

.input-panel,
.comparison-panel,
.results-table,
.toolbar,
.summary-band article,
dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.input-panel,
.comparison-panel {
  animation: paperLift 520ms ease both;
}

.input-panel {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 18px;
  padding: 16px;
  overflow: hidden;
}

.input-panel::before,
.comparison-panel::before {
  display: block;
  height: 7px;
  margin: -16px -16px 13px;
  background:
    radial-gradient(ellipse at 8% 50%, rgba(34, 92, 77, 1), transparent 42%),
    radial-gradient(ellipse at 42% 50%, rgba(31, 36, 32, 0.5), transparent 45%),
    radial-gradient(ellipse at 88% 50%, rgba(170, 59, 46, 0.55), transparent 44%),
    linear-gradient(90deg, rgba(34, 92, 77, 0.86), rgba(170, 59, 46, 0.46), transparent);
  content: "";
  filter: blur(0.15px);
}

.panel-head,
.comparison-top,
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ghost-button,
.icon-button,
.details-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.ghost-button,
.details-button {
  padding: 0 11px;
  font-weight: 750;
}

.ghost-button:hover,
.details-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span,
.summary-band span,
.metric span,
.meta-label {
  color: var(--muted);
  font-size: 0.78rem;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.88);
  color: var(--ink);
  padding: 0 10px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(13, 95, 82, 0.16);
  border-color: var(--accent);
}

.spend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-builder {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(170, 59, 46, 0.18);
  border-radius: var(--radius);
  padding: 12px;
  background:
    radial-gradient(ellipse at 0 0, rgba(170, 59, 46, 0.09), transparent 56%),
    rgba(255, 253, 247, 0.68);
}

.chat-bubble {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.chat-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--seal);
  border-radius: 4px;
  color: var(--seal);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 850;
}

.chat-bubble p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.profile-chat-log {
  display: grid;
  gap: 8px;
  max-height: 174px;
  overflow-y: auto;
  padding: 3px 2px 2px;
  scroll-behavior: smooth;
}

.chat-message {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  animation: inkGrow 260ms ease both;
}

.chat-message > span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(34, 92, 77, 0.1);
  color: var(--accent-ink);
  font-size: 0.68rem;
  font-weight: 850;
}

.chat-message.user > span {
  background: var(--seal-soft);
  color: var(--seal);
}

.chat-message p {
  margin: 0;
  border: 1px solid rgba(31, 36, 32, 0.08);
  border-radius: 10px 10px 10px 3px;
  padding: 8px 9px;
  background: rgba(255, 253, 247, 0.82);
  color: var(--ink-soft);
  line-height: 1.45;
}

.chat-message.user p {
  border-color: rgba(170, 59, 46, 0.18);
  border-radius: 10px 10px 3px 10px;
  background:
    linear-gradient(135deg, rgba(170, 59, 46, 0.08), transparent 62%),
    rgba(255, 250, 240, 0.9);
}

.profile-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.profile-chat-entry {
  display: grid;
  gap: 8px;
}

.profile-chat-entry p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.chat-page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--accent-ink);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(18, 56, 47, 0.98), rgba(34, 92, 77, 0.92)),
    var(--accent-ink);
  color: #fffdf7;
  font-weight: 850;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.chat-page-link:hover {
  box-shadow: 0 10px 22px rgba(18, 56, 47, 0.16);
  transform: translateY(-1px);
}

.profile-chat-form input {
  min-height: 40px;
}

.chat-send-button {
  min-width: 66px;
  min-height: 40px;
  border: 1px solid var(--accent-ink);
  border-radius: var(--radius);
  background: var(--accent-ink);
  color: #fffdf7;
  cursor: pointer;
  font-weight: 850;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.chat-send-button:hover {
  background: #18483d;
  box-shadow: 0 8px 18px rgba(18, 56, 47, 0.16);
  transform: translateY(-1px);
}

.profile-preview {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.profile-preview > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.profile-preview span {
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-preview strong {
  color: var(--accent-ink);
}

#profilePreviewBars {
  display: grid;
  gap: 7px;
}

.preview-bar {
  display: grid;
  grid-template-columns: minmax(70px, 0.65fr) minmax(70px, 1fr) 52px;
  gap: 7px;
  align-items: center;
  font-size: 0.76rem;
}

.preview-bar i {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 36, 32, 0.08);
}

.preview-bar b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-ink), rgba(170, 59, 46, 0.48));
  animation: barDraw 420ms ease both;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--accent-ink);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 20% 20%, rgba(255, 255, 255, 0.2), transparent 45%),
    var(--accent-ink);
  color: #fffdf7;
  cursor: pointer;
  font-weight: 850;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.primary-button:hover {
  box-shadow: 0 8px 18px rgba(18, 56, 47, 0.16);
  transform: translateY(-1px);
}

.settings-block {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.settings-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  list-style: none;
}

.settings-block summary::-webkit-details-marker {
  display: none;
}

.settings-block summary::after {
  content: "+";
  color: var(--seal);
  font-weight: 800;
}

.settings-block[open] summary::after {
  content: "-";
}

.settings-content {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 32px;
  color: var(--ink);
  line-height: 1.35;
}

.check-row input {
  width: 16px;
  min-height: 16px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.point-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.comparison-panel {
  position: relative;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
}

.data-note {
  max-width: 460px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
  text-align: right;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(120px, 0.7fr);
  gap: 10px;
  margin: 14px 0 10px;
}

.value-chart {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(170, 59, 46, 0.18);
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(34, 92, 77, 0.1), transparent 52%),
    rgba(255, 253, 247, 0.78);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-head span {
  color: var(--ink);
  font-weight: 850;
}

.chart-row {
  display: grid;
  grid-template-columns: 24px minmax(150px, 0.8fr) minmax(180px, 1fr) 72px;
  gap: 9px;
  align-items: center;
  min-height: 28px;
  animation: inkGrow 360ms ease both;
  animation-delay: var(--delay);
}

.chart-rank {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(170, 59, 46, 0.32);
  border-radius: 50%;
  color: var(--seal);
  font-size: 0.72rem;
  font-weight: 850;
}

.chart-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-bars {
  position: relative;
  height: 18px;
}

.chart-bars i {
  position: absolute;
  left: 0;
  display: block;
  height: 7px;
  border-radius: 999px;
  transform-origin: left center;
}

.chart-bars .first {
  top: 2px;
  background: linear-gradient(90deg, var(--accent-ink), rgba(34, 92, 77, 0.55));
}

.chart-bars .ongoing {
  bottom: 2px;
  background: linear-gradient(90deg, rgba(170, 59, 46, 0.58), rgba(218, 194, 142, 0.45));
}

.summary-band article {
  min-width: 0;
  padding: 13px;
  box-shadow: none;
  background: rgba(255, 253, 247, 0.75);
  border-color: rgba(170, 59, 46, 0.18);
}

.summary-band strong {
  display: block;
  overflow: hidden;
  margin: 4px 0;
  font-size: 1.05rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-band small,
.data-note,
.note,
footer {
  color: var(--muted);
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(130px, 0.75fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  box-shadow: none;
  background: rgba(255, 253, 247, 0.88);
}

.results-table {
  overflow: hidden;
  box-shadow: none;
}

.table-header,
.result-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) minmax(230px, 1fr) minmax(72px, 0.35fr) minmax(210px, 0.9fr) 82px;
  gap: 12px;
  align-items: center;
}

.table-header {
  min-height: 40px;
  padding: 0 12px;
  background:
    linear-gradient(90deg, rgba(34, 92, 77, 0.08), transparent 40%),
    #f5f0e5;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.results {
  display: grid;
}

.result-row {
  min-height: 88px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  animation: rowIn 260ms ease both;
}

.result-row:last-child {
  border-bottom: 0;
}

.result-row:hover {
  background:
    linear-gradient(90deg, rgba(34, 92, 77, 0.07), transparent 48%),
    var(--row-hover);
}

.card-identity {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  min-width: 0;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(170, 59, 46, 0.34);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.issuer {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.card-name {
  margin: 2px 0 6px;
  font-size: 0.98rem;
  line-height: 1.3;
}

.card-tags,
.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 800;
}

.badge.neutral {
  background: #f0f2ef;
  color: var(--muted);
}

.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge:first-child {
  border-color: rgba(34, 92, 77, 0.18);
}

.badge.quiet {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.value-cell {
  display: grid;
  gap: 8px;
}

.value-line {
  display: grid;
  grid-template-columns: 18px minmax(90px, 1fr) 74px;
  gap: 8px;
  align-items: center;
}

.value-line strong {
  color: var(--accent-ink);
  font-size: 0.92rem;
}

.muted-line strong {
  color: var(--ink);
}

.mini-icon,
.fee-icon,
.signal svg,
.details-button svg {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: currentColor;
}

.mini-icon svg,
.fee-icon svg,
.details-button svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.signal svg {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.value-bar {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 36, 32, 0.08);
}

.value-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-ink), rgba(34, 92, 77, 0.56));
  animation: barDraw 680ms ease both;
}

.muted-line .value-bar i {
  background: linear-gradient(90deg, rgba(170, 59, 46, 0.65), rgba(218, 194, 142, 0.55));
}

.offer-cell small {
  color: var(--muted);
}

.fee-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 750;
}

.signal-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.signal {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  border: 1px solid rgba(34, 92, 77, 0.16);
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(255, 253, 247, 0.74);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 750;
}

.info-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 1px;
  color: var(--muted);
  cursor: help;
}

.info-hint svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.info-hint::after {
  position: absolute;
  right: -8px;
  bottom: calc(100% + 9px);
  z-index: 8;
  width: min(260px, 72vw);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgba(31, 36, 32, 0.16);
  color: var(--ink-soft);
  content: attr(data-tip);
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.info-hint:hover::after,
.info-hint:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.offer-cell {
  min-width: 0;
  color: var(--ink);
  line-height: 1.45;
}

.offer-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.details-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 32px;
  background: #fffdf7;
  line-height: 1;
  text-align: center;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.details-button:hover {
  transform: translateY(-1px);
  background: var(--seal-soft);
}

@keyframes paperLift {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rowIn {
  from {
    opacity: 0.72;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes barDraw {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes inkGrow {
  from {
    opacity: 0.72;
    filter: blur(1.5px);
    transform: translateX(-3px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateX(0);
  }
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(840px, calc(100vw - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

dialog::backdrop {
  background: rgba(30, 34, 31, 0.42);
}

.dialog-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 1.25rem;
}

#dialogBody {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.detail-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.detail-box h3 {
  margin: 4px 0 0;
  font-size: 1.08rem;
}

.rate-list,
.welcome-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rate-list li,
.welcome-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.source-list a {
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.source-list a:hover {
  text-decoration: underline;
}

footer {
  max-width: 1620px;
  margin: 0 auto;
  padding: 0 clamp(18px, 3vw, 40px) 30px;
  line-height: 1.6;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .chat-workspace {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }

  .spend-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .point-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .results-table {
    overflow-x: auto;
  }

  .table-header,
  .result-row {
    min-width: 980px;
  }
}

@media (max-width: 760px) {
  .app-header,
  .comparison-top,
  .chat-stage-head {
    display: grid;
  }

  .header-actions {
    display: grid;
    gap: 10px;
  }

  .header-meta,
  .data-note {
    text-align: left;
  }

  .spend-grid,
  .profile-chat-form,
  .large-chat-form,
  .point-grid,
  .summary-band,
  .toolbar,
  .detail-grid,
  .chart-row {
    grid-template-columns: 1fr;
  }

  .chart-row {
    gap: 5px;
  }

  .chart-bars {
    width: 100%;
  }

  .comparison-panel,
  .input-panel,
  .chat-profile-panel {
    padding: 14px;
  }

  .chat-workspace {
    min-height: 0;
    padding: 14px 12px 24px;
  }

  .chat-stage {
    grid-template-rows: 7px auto minmax(300px, 58vh) auto;
  }

  .large-chat-log {
    padding: 14px;
  }

  .large-chat-log .chat-message {
    max-width: 100%;
  }

  .large-chat-form .chat-send-button {
    min-height: 42px;
  }

  .results-table {
    overflow: visible;
  }

  .table-header {
    display: none;
  }

  .result-row {
    min-width: 0;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 10px;
  }

  .card-identity,
  .value-cell,
  .signal-cell,
  .details-button {
    grid-column: 1 / -1;
  }

  .fee-cell::before {
    content: attr(data-fee-label) " ";
    color: var(--muted);
    font-weight: 500;
  }
}
