/* Jomoq Finance: chat widgets (```pnl, ```chart, ```slides) on every chat
   page, plus the /finance hub, tools dialog and calculators.
   Chart colors: fixed categorical slots, the same palette validated for the
   admin dashboard (light on #FFFFFF; dark on #2C2C2C, slot 6 lifted to
   #1a9a1a for 3:1 contrast, re-validated 2026-10-17). Slides are always
   white, like a real deck, so they always use the light slots. */

:root {
  --jfin-viz-1: #3987e5;
  --jfin-viz-2: #d95926;
  --jfin-viz-3: #199e70;
  --jfin-viz-4: #c98500;
  --jfin-viz-5: #d55181;
  --jfin-viz-6: #1a9a1a;
  --jfin-viz-7: #9085e9;
  --jfin-viz-8: #e66767;
}
[data-theme="light"],
.jfin-slide {
  --jfin-viz-1: #2a78d6;
  --jfin-viz-2: #eb6834;
  --jfin-viz-3: #1baf7a;
  --jfin-viz-4: #eda100;
  --jfin-viz-5: #e87ba4;
  --jfin-viz-6: #008300;
  --jfin-viz-7: #4a3aa7;
  --jfin-viz-8: #e34948;
}
.jfin-f1 { fill: var(--jfin-viz-1); }
.jfin-f2 { fill: var(--jfin-viz-2); }
.jfin-f3 { fill: var(--jfin-viz-3); }
.jfin-f4 { fill: var(--jfin-viz-4); }
.jfin-f5 { fill: var(--jfin-viz-5); }
.jfin-f6 { fill: var(--jfin-viz-6); }
.jfin-f7 { fill: var(--jfin-viz-7); }
.jfin-f8 { fill: var(--jfin-viz-8); }
.jfin-s1 { stroke: var(--jfin-viz-1); }
.jfin-s2 { stroke: var(--jfin-viz-2); }
.jfin-s3 { stroke: var(--jfin-viz-3); }
.jfin-s4 { stroke: var(--jfin-viz-4); }
.jfin-s5 { stroke: var(--jfin-viz-5); }
.jfin-s6 { stroke: var(--jfin-viz-6); }
.jfin-s7 { stroke: var(--jfin-viz-7); }
.jfin-s8 { stroke: var(--jfin-viz-8); }
.jfin-b1 { background: var(--jfin-viz-1); }
.jfin-b2 { background: var(--jfin-viz-2); }
.jfin-b3 { background: var(--jfin-viz-3); }
.jfin-b4 { background: var(--jfin-viz-4); }
.jfin-b5 { background: var(--jfin-viz-5); }
.jfin-b6 { background: var(--jfin-viz-6); }
.jfin-b7 { background: var(--jfin-viz-7); }
.jfin-b8 { background: var(--jfin-viz-8); }

/* ── Card shell ───────────────────────────────────────────────────────── */
.jfin-card {
  margin: 14px 0;
  padding: 14px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}
figure.jfin-card {
  margin-inline: 0;
}
.jfin-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin: 0 0 12px;
}
.jfin-card-kicker {
  flex-basis: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.jfin-card-kicker .material-symbols-rounded {
  font-size: 16px;
}
.jfin-card-title {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
}
.jfin-card-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.jfin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.jfin-note {
  font-size: 12px;
  color: var(--text-faint);
}
.jfin-error {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--danger);
}
.jfin-error[hidden] {
  display: none;
}

.jfin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 600 13px/1 var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
}
.jfin-btn:hover {
  background: rgba(var(--on-rgb), 0.06);
}
.jfin-btn:focus-visible,
.jfin-tcard:focus-visible,
.jfin-calc:focus-visible,
.jfin-tab:focus-visible,
.jfin-focus-btn:focus-visible,
.jfin-row-del:focus-visible,
.jfin-dialog-close:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.jfin-btn .material-symbols-rounded {
  font-size: 18px;
}
.jfin-btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}
.jfin-btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.jfin-btn-primary:hover {
  background: var(--accent-deep);
}
.jfin-btn-ghost {
  border-color: transparent;
}
.jfin-icon-btn {
  width: 34px;
  padding: 0;
  justify-content: center;
}

/* ── KPIs ─────────────────────────────────────────────────────────────── */
.jfin-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.jfin-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(var(--on-rgb), 0.045);
  min-width: 0;
}
.jfin-kpi-label {
  font-size: 12px;
  color: var(--text-muted);
}
.jfin-kpi-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.jfin-kpi-delta {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Tables inside cards (the markdown renderer wraps each in .table-wrap) */
.message .jfin-card .table-wrap,
.jfin-card .table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  overflow-x: auto;
}
@media (min-width: 901px) {
  .chat-app-shell .message-row.assistant .jfin-card .table-wrap {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
}
.message .jfin-pnl-table,
.message .jfin-data-table,
.jfin-pnl-table,
.jfin-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.4;
}
.message .jfin-pnl-table th,
.message .jfin-pnl-table td,
.message .jfin-data-table th,
.message .jfin-data-table td,
.jfin-pnl-table th,
.jfin-pnl-table td,
.jfin-data-table th,
.jfin-data-table td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  vertical-align: baseline;
  word-break: normal;
  overflow-wrap: normal;
}
.message .jfin-card tbody tr:nth-child(even) td {
  background: transparent;
}
.message .jfin-pnl-table td,
.message .jfin-data-table td,
.jfin-pnl-table td,
.jfin-data-table td {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.message .jfin-pnl-table thead th,
.message .jfin-data-table thead th,
.jfin-pnl-table thead th,
.jfin-data-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  background: rgba(var(--on-rgb), 0.03);
}
.message .jfin-card thead th:first-child,
.message .jfin-card tbody th,
.jfin-card thead th:first-child,
.jfin-card tbody th {
  text-align: left;
}
.message .jfin-pnl-table tbody th,
.jfin-pnl-table tbody th {
  font-weight: 400;
  min-width: 170px;
}
.message .jfin-pnl-table .jfin-row-section th,
.jfin-pnl-table .jfin-row-section th {
  padding-top: 12px;
  border-bottom: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.message .jfin-pnl-table .jfin-row-line th,
.jfin-pnl-table .jfin-row-line th {
  padding-left: 22px;
}
.message .jfin-pnl-table .jfin-row-subtotal > *,
.jfin-pnl-table .jfin-row-subtotal > * {
  font-weight: 600;
}
.message .jfin-pnl-table .jfin-row-total > *,
.jfin-pnl-table .jfin-row-total > * {
  font-weight: 700;
  border-top: 1px solid var(--line-strong);
}
.message .jfin-pnl-table .jfin-row-grand > *,
.jfin-pnl-table .jfin-row-grand > * {
  font-weight: 700;
  border-top: 2px solid var(--text);
}
.message .jfin-pnl-table .jfin-row-ratio > *,
.jfin-pnl-table .jfin-row-ratio > * {
  color: var(--text-muted);
  font-style: italic;
}
.message .jfin-pnl-table .jfin-change,
.jfin-pnl-table .jfin-change {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Charts ───────────────────────────────────────────────────────────── */
.jfin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.jfin-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.jfin-sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}
.jfin-plot {
  overflow-x: auto;
}
.jfin-plot[hidden],
.jfin-chart-table[hidden] {
  display: none;
}
.jfin-plot .jfin-svg {
  min-width: 420px;
}
.jfin-chart-table {
  max-height: 340px;
  overflow: auto;
}
.jfin-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.jfin-svg .jfin-grid {
  stroke: var(--line);
  stroke-width: 1;
}
.jfin-svg .jfin-base {
  stroke: var(--line-strong);
  stroke-width: 1;
}
.jfin-svg .jfin-axis {
  fill: var(--text-faint);
  font: 500 11px var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.jfin-svg .jfin-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.jfin-svg .jfin-dot {
  stroke: var(--surface);
  stroke-width: 2;
}
.jfin-svg .jfin-hit {
  fill: transparent;
}
.jfin-svg .jfin-bar:hover {
  opacity: 0.82;
}
.jfin-mini-chart {
  margin-top: 4px;
}
.jfin-mini-chart .jfin-svg {
  max-width: 560px;
}

/* ── Slide decks ──────────────────────────────────────────────────────── */
.jfin-deck-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.jfin-deck-stage > .jfin-slide,
.jfin-present-stage > .jfin-slide {
  display: none;
}
.jfin-deck-stage > .jfin-slide.is-active,
.jfin-present-stage > .jfin-slide.is-active {
  display: block;
}
.jfin-deck-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.jfin-deck-count {
  min-width: 52px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.jfin-spacer {
  flex: 1;
}

.jfin-slide {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  overflow: hidden;
  background: #fff;
  color: #17181c;
  font-family: var(--font-ui);
  text-align: left;
  --surface: #fff;
  --line: #e3e4e9;
  --line-strong: #c9cad2;
  --text-faint: #6b6c78;
}
.jfin-slide .jfin-sl {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 5cqw 6cqw 5cqw;
  box-sizing: border-box;
}
.jfin-slide .jfin-sl h3 {
  margin: 0;
  font-size: 5.2cqw;
  line-height: 1.08;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #17181c;
}
.jfin-slide .jfin-sl h4 {
  margin: 0 0 2.6cqw;
  font-size: 3.2cqw;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #17181c;
}
.jfin-slide .jfin-sl h5 {
  margin: 0 0 1.4cqw;
  font-size: 2.3cqw;
  font-weight: 700;
  color: #17181c;
}
.jfin-slide .jfin-sl p {
  margin: 1.8cqw 0 0;
  font-size: 2.1cqw;
  line-height: 1.4;
  color: #5d5e6b;
}
.jfin-slide .jfin-sl .jfin-sl-lede {
  font-size: 2.6cqw;
  color: #17181c;
}
.jfin-slide .jfin-sl ul {
  margin: 0;
  padding: 0 0 0 2.6cqw;
  display: flex;
  flex-direction: column;
  gap: 1.3cqw;
  list-style: disc;
}
.jfin-slide .jfin-sl li {
  margin: 0;
  padding-left: 0.6cqw;
  font-size: 2.3cqw;
  line-height: 1.35;
  color: #17181c;
}
.jfin-slide .jfin-sl li::marker {
  color: #2a78d6;
}
.jfin-slide .jfin-sl-title,
.jfin-slide .jfin-sl-section {
  justify-content: center;
}
.jfin-slide .jfin-sl-title h3 {
  font-size: 6cqw;
}
.jfin-sl-bar {
  display: block;
  width: 7cqw;
  height: 0.7cqw;
  margin-bottom: 2.4cqw;
  background: #2a78d6;
}
.jfin-sl-kicker {
  margin-bottom: 1cqw;
  font-size: 2cqw;
  font-weight: 700;
  color: #2a78d6;
}
.jfin-sl-stats {
  display: grid;
  gap: 2cqw;
  margin-block: auto;
}
.jfin-slide .jfin-sl .jfin-sl-stats + .jfin-sl-foot {
  margin-top: 0;
  margin-bottom: auto;
}
.jfin-sl-stat.is-long strong {
  font-size: 2.9cqw;
}
.jfin-slide .jfin-sl.is-roomy ul {
  gap: 2cqw;
}
.jfin-slide .jfin-sl.is-roomy li {
  font-size: 2.7cqw;
}
.jfin-slide .jfin-sl-table.is-roomy {
  font-size: 2.1cqw;
}
.jfin-sl-stats.jfin-n1 { grid-template-columns: 1fr; max-width: 40cqw; }
.jfin-sl-stats.jfin-n2 { grid-template-columns: repeat(2, 1fr); }
.jfin-sl-stats.jfin-n3 { grid-template-columns: repeat(3, 1fr); }
.jfin-sl-stats.jfin-n4 { grid-template-columns: repeat(4, 1fr); }
.jfin-sl-stat {
  display: flex;
  flex-direction: column;
  gap: 0.7cqw;
  padding: 2.6cqw 2.2cqw;
  border-radius: 1.2cqw;
  background: #f2f2f5;
  min-width: 0;
}
.jfin-sl-stat strong {
  font-size: 4.4cqw;
  line-height: 1.05;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #17181c;
  overflow-wrap: anywhere;
}
.jfin-sl-stat span {
  font-size: 1.75cqw;
  color: #17181c;
}
.jfin-sl-stat em {
  font-style: normal;
  font-size: 1.45cqw;
  color: #5d5e6b;
}
.jfin-slide .jfin-sl .jfin-sl-foot {
  margin-top: 3cqw;
}
.jfin-slide .table-wrap,
.message .jfin-slide .table-wrap {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  width: 100%;
}
.jfin-slide .jfin-sl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.75cqw;
  line-height: 1.35;
}
.jfin-slide .jfin-sl-table th,
.jfin-slide .jfin-sl-table td,
.message .jfin-slide .jfin-sl-table tbody tr:nth-child(even) td {
  padding: 0.9cqw 1.3cqw;
  border-bottom: 1px solid #e3e4e9;
  background: transparent;
  color: #17181c;
  text-align: left;
  word-break: normal;
}
.jfin-slide .jfin-sl-table th {
  background: #f2f2f5;
  font-weight: 700;
}
.jfin-sl-chart .jfin-sl-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3cqw;
  min-height: 0;
}
.jfin-sl-plot {
  flex: 1;
  min-width: 0;
}
.jfin-sl-chart.has-side .jfin-sl-plot {
  flex: 0 0 62%;
}
.jfin-slide .jfin-sl .jfin-sl-side {
  flex: 1;
}
.jfin-slide .jfin-legend {
  margin: 0 0 1cqw;
  gap: 0.8cqw 2cqw;
  font-size: 1.5cqw;
  color: #5d5e6b;
}
.jfin-slide .jfin-sw {
  width: 1.2cqw;
  height: 1.2cqw;
  border-radius: 0.3cqw;
}
.jfin-slide .jfin-svg .jfin-axis {
  fill: #5d5e6b;
}
.jfin-sl-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4cqw;
}
.jfin-slide-num {
  position: absolute;
  right: 3cqw;
  bottom: 2.2cqw;
  font-size: 1.3cqw;
  color: #8a8a97;
  font-variant-numeric: tabular-nums;
}

/* Full-screen presenter */
.jfin-present {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  outline: none;
}
.jfin-present-stage {
  width: min(100vw, calc(100vh * 16 / 9));
  cursor: pointer;
}
.jfin-present-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.78);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.jfin-present:hover .jfin-present-bar,
.jfin-present-bar:focus-within {
  opacity: 1;
}
@media (hover: none) {
  .jfin-present-bar {
    opacity: 1;
  }
}
.jfin-present-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.jfin-present-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}
.jfin-present-btn:focus-visible {
  outline: 2px solid #fff;
}
.jfin-present-count {
  min-width: 56px;
  text-align: center;
  font: 600 13px var(--font-ui);
  font-variant-numeric: tabular-nums;
}

/* PDF export: only the slides print, one per 16:9 page. */
.jfin-print-root {
  display: none;
}
@media print {
  body.jfin-printing > *:not(.jfin-print-root) {
    display: none !important;
  }
  html:has(body.jfin-printing),
  body.jfin-printing {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: static !important;
    background: #fff !important;
  }
  body.jfin-printing .jfin-print-root {
    display: block !important;
  }
  .jfin-print-root > .jfin-slide {
    display: block !important;
    width: 13.333in;
    height: 7.5in;
    aspect-ratio: auto;
    break-after: page;
    page-break-after: always;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .jfin-print-root > .jfin-slide:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}

/* Placeholder while a widget block streams in */
.jfin-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
}
.jfin-spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: jfin-spin 0.8s linear infinite;
}
@keyframes jfin-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .jfin-spinner {
    animation-duration: 2.4s;
  }
}

/* ── /finance hub (empty state) ───────────────────────────────────────── */
.jfin-brand-tag {
  margin-left: 10px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: 700 11px/1.2 var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
@media (max-width: 600px) {
  #jfin-tools-btn {
    display: none;
  }
}
.chat-empty-state.jfin-empty {
  padding-top: 40px;
}
.jfin-hub {
  width: 100%;
  max-width: 780px;
  margin: 2px auto 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}
.jfin-focus {
  align-self: center;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(var(--on-rgb), 0.06);
  max-width: 100%;
}
.jfin-focus-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: 600 14px var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
}
.jfin-focus-btn .material-symbols-rounded {
  font-size: 18px;
}
.jfin-focus-btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line);
}
.jfin-tabs,
.jfin-dialog-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.jfin-tabs {
  margin-bottom: 12px;
}
.jfin-tabs::-webkit-scrollbar,
.jfin-dialog-tabs::-webkit-scrollbar {
  display: none;
}
.jfin-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: 600 14px var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
}
.jfin-tab .material-symbols-rounded {
  font-size: 18px;
}
.jfin-tab:hover {
  color: var(--text);
}
.jfin-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
}
.jfin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 8px;
}
.jfin-tcard,
.jfin-calc {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.jfin-tcard:hover,
.jfin-calc:hover {
  border-color: var(--line-strong);
  background: rgba(var(--on-rgb), 0.035);
}
.jfin-tcard-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(var(--on-rgb), 0.07);
}
.jfin-tcard-icon .material-symbols-rounded,
.jfin-calc > .material-symbols-rounded {
  font-size: 19px;
}
.jfin-tcard-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.chat-app-shell .jfin-tcard-text strong,
.jfin-tcard-text strong {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}
.chat-app-shell .jfin-tcard-text span,
.jfin-tcard-text span {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-muted);
}
.jfin-calcs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 8px;
}
.jfin-calcs-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.jfin-calcs-head span {
  font-size: 13px;
  color: var(--text-muted);
}
.jfin-calcs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: 8px;
}
.jfin-calc {
  align-items: center;
  border-style: dashed;
  background: transparent;
}
.jfin-calc:hover {
  border-style: solid;
}

/* ── Tools dialog ─────────────────────────────────────────────────────── */
.jfin-dialog {
  width: min(940px, calc(100vw - 24px));
  max-width: none;
  max-height: min(90vh, 920px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  display: none;
}
.jfin-dialog[open] {
  display: flex;
  flex-direction: column;
}
.jfin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.jfin-dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 8px 18px;
  flex: none;
}
.jfin-dialog-head h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.jfin-currency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.jfin-dialog-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.jfin-dialog-close:hover {
  background: rgba(var(--on-rgb), 0.08);
}
.jfin-dialog-tabs {
  flex: none;
  padding: 0 12px;
}
.jfin-dialog-body {
  flex: 1;
  min-height: 0;
  padding: 16px 18px;
  overflow-y: auto;
}
.jfin-dialog > .jfin-error {
  margin: 0 18px 8px;
}
.jfin-dialog-foot {
  flex: none;
  margin: 0;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-faint);
}
.jfin-dialog .jfin-hub {
  max-width: none;
  margin: 0;
}

/* ── Calculators ──────────────────────────────────────────────────────── */
.jfin-tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.jfin-tool-results {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.jfin-tool-results > div:not(.jfin-res-grid) {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.jfin-tool-wide .jfin-tool-grid {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
}
.jfin-tool-wide .jfin-res-grid {
  grid-template-columns: 1fr;
}
.jfin-res-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.jfin-res {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(var(--on-rgb), 0.05);
}
.jfin-res-label {
  font-size: 12px;
  color: var(--text-muted);
}
.jfin-res-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.jfin-res-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.jfin-res.is-bad .jfin-res-value {
  color: var(--danger);
}
.jfin-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.jfin-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.jfin-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.jfin-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.jfin-field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-faint);
}
.jfin-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: 16px var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.jfin-input:focus {
  outline: none;
  border-color: var(--text);
}
.jfin-input[aria-invalid="true"] {
  border-color: var(--danger);
}
.jfin-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}
.jfin-input-wrap:focus-within {
  border-color: var(--text);
}
.jfin-input-wrap .jfin-input {
  border: 0;
}
.jfin-suffix {
  padding: 0 10px 0 2px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.jfin-input-num {
  text-align: right;
}
.jfin-type {
  height: 34px;
  max-width: 100%;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 13px var(--font-ui);
}
.jfin-pnl-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.jfin-title-input {
  flex: 1 1 220px;
  font-weight: 600;
}
.jfin-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.jfin-pnl-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.jfin-pnl-head,
.jfin-pnl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 104px 122px;
  gap: 6px;
  align-items: center;
}
.jfin-pnl-rows.is-single .jfin-pnl-head,
.jfin-pnl-rows.is-single .jfin-pnl-row {
  grid-template-columns: minmax(0, 1fr) 140px 122px;
}
.jfin-pnl-head > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.jfin-period {
  height: 32px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}
.jfin-pnl-group {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.jfin-row-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.jfin-row-tools .jfin-type {
  width: 88px;
}
.jfin-row-del {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.jfin-row-del:hover {
  background: rgba(var(--on-rgb), 0.08);
  color: var(--text);
}
.jfin-row-del .material-symbols-rounded {
  font-size: 18px;
}
.jfin-row-fixed {
  padding-left: 10px;
  font-size: 14px;
}
.jfin-pnl-adds {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 8px;
}
.jfin-pnl-adds .jfin-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}
.jfin-paste {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}
.jfin-paste[hidden] {
  display: none;
}
.jfin-paste .jfin-field-hint {
  margin-bottom: 8px;
}
.jfin-paste .jfin-tool-actions {
  margin-top: 10px;
}
.jfin-paste-area {
  height: auto;
  min-height: 120px;
  padding: 8px 10px;
  resize: vertical;
  font: 13px/1.5 var(--font-mono);
}
.jfin-split-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.jfin-split-track {
  display: flex;
  gap: 2px;
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
  overflow: hidden;
}
.jfin-split-seg {
  min-width: 3px;
  flex-basis: 0;
}
.jfin-verdict {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}
.jfin-empty {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .jfin-tool-grid,
  .jfin-tool-wide .jfin-tool-grid {
    grid-template-columns: 1fr;
  }
  .jfin-tool-wide .jfin-res-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .jfin-tool-results {
    position: static;
  }
}
@media (max-width: 560px) {
  .jfin-fields {
    grid-template-columns: 1fr;
  }
  .jfin-pnl-head,
  .jfin-pnl-row,
  .jfin-pnl-rows.is-single .jfin-pnl-head,
  .jfin-pnl-rows.is-single .jfin-pnl-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }
  .jfin-pnl-head > span:first-child,
  .jfin-pnl-row > .jfin-input:first-child,
  .jfin-pnl-row > .jfin-row-fixed {
    grid-column: 1 / -1;
  }
  .jfin-pnl-rows.is-single .jfin-pnl-row > .jfin-input-num {
    grid-column: span 2;
  }
  .jfin-dialog {
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .jfin-dialog-body {
    padding: 14px 16px;
  }
  .jfin-currency > span {
    display: none;
  }
  .jfin-focus-btn {
    padding: 0 10px;
    font-size: 13px;
  }
  .jfin-deck-bar .jfin-btn:not(.jfin-icon-btn) {
    padding: 0 10px;
  }
}

/* ── /finance signed-out landing (replaces the gallery section) ──────── */
.jfin-land-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 960px) {
  .jfin-land-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .jfin-land-grid {
    grid-template-columns: 1fr;
  }
}
.jfin-land-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 280px;
  padding: 32px;
  border: 0;
  border-radius: 0;
  background: var(--rd-wash-grey, #F5F5F5);
  color: var(--rd-ink);
}
.jfin-land-card:nth-child(6n + 1) { background: var(--rd-wash-lime, #F3FFE3); }
.jfin-land-card:nth-child(6n + 2) { background: var(--rd-wash-cyan, #D9F8F7); }
.jfin-land-card:nth-child(6n + 3) { background: var(--rd-wash-violet, #EFE9FF); }
.jfin-land-card:nth-child(6n + 4) { background: var(--rd-wash-peach, #FFEEE4); }
.jfin-land-card:nth-child(6n + 5) { background: var(--rd-wash-grey, #F5F5F5); }
.jfin-land-card:nth-child(6n + 6) { background: var(--rd-wash-lime, #F3FFE3); }
.jfin-land-card > .material-symbols-rounded {
  margin-bottom: 40px;
  color: var(--rd-ink);
  font-size: 28px;
}
.jfin-land-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--rd-ink);
}
.jfin-land-card p {
  flex: 1;
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: #333333;
}
.jfin-land-card .rd-text-link {
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
}
