:root {
  --bg: #fcfbf8;
  --bg-soft: #fff7ef;
  --panel: #ffffff;
  --text: #2b2a28;
  --muted: #7d776f;
  --line: #ece4da;
  --line-strong: #e6d6c5;
  --primary: #ff7412;
  --primary-dark: #e56408;
  --primary-soft: #fff1e5;
  --green: #2aa76f;
  --green-soft: #ecfbf3;
  --red: #e23d35;
  --red-soft: #fff1ef;
  --yellow: #d59a10;
  --yellow-soft: #fff8e6;
  --blue: #2954bc;
  --blue-soft: #f2f7ff;
  --purple: #7a3fde;
  --purple-soft: #f7f1ff;
  --orange-soft: #fff5e9;
  --shadow: 0 18px 40px rgba(99, 77, 52, 0.08);
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --container: 1530px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: #fdfcfa;
}

body {
  position: relative;
}

.site-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(255, 141, 71, 0.09), transparent 22%),
    linear-gradient(180deg, #ffffff 0%, #fcfbf8 28%, #fcfbf8 100%);
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(236, 228, 218, 0.9);
  box-shadow: 0 2px 18px rgba(73, 50, 28, 0.04);
}

.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #ff9c57);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.logo-text strong {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.logo-text span {
  color: var(--primary);
}

.header-nav {
  display: flex;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(252, 251, 248, 0.9);
}

.header-link {
  padding: 12px 18px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 600;
}

.header-link.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
}

.header-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

.plans-link {
  color: var(--muted);
  font-weight: 600;
}

.avatar-badge {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffecd9, #fff7ee);
  color: #d56b1f;
  font-weight: 800;
}

.app-shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.banner-card,
.hero-card,
.section-card,
.step-card,
.result-card,
.summary-box,
.kpi-card,
.cost-section {
  background: #fff;
  border: 1px solid rgba(230, 214, 197, 0.9);
  box-shadow: var(--shadow);
}

.top-banner {
  border-radius: 22px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  background: linear-gradient(180deg, #fff8ed, #fffdfa);
}

.banner-copy {
  display: flex;
  align-items: center;
  gap: 14px;
}

.banner-copy h2,
.banner-copy p,
.hero-copy h2,
.hero-copy p,
.step-card h3,
.step-card p,
.section-heading h2,
.section-heading p,
.mini-section-head h3,
.page-section-title h2,
.warning-box,
.result-top h2,
.result-top p,
.cost-section h3 {
  margin: 0;
}

.banner-icon,
.hero-icon,
.section-icon,
.step-number,
.confirm-icon,
.result-status-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.banner-icon,
.hero-icon,
.section-icon {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
}

.tab-switch {
  display: inline-flex;
  gap: 10px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(252, 251, 248, 0.95);
  border: 1px solid var(--line);
  margin-bottom: 22px;
}

.tab-pill {
  padding: 14px 18px;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 700;
}

.tab-pill.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
}

.large-hero {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fff8f1 0%, #fffdfb 100%);
  margin-bottom: 22px;
}

.hero-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.hero-steps {
  margin: 0;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.step-card {
  border-radius: 18px;
  padding: 18px;
  display: flex;
  gap: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #ffe8d8;
  color: var(--primary);
  font-weight: 800;
}

.step-card p,
.section-heading p,
.field span,
.helper-text,
.page-section-title {
  color: var(--muted);
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.62fr);
  gap: 22px;
  align-items: start;
}

.inline-alert {
  border: 1px solid #f3c5c5;
  background: #fff4f3;
  color: #b43a34;
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 600;
}

.stack-lg {
  display: grid;
  gap: 18px;
}

.page-section-title,
.mini-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-section-title {
  margin-top: 2px;
  margin-bottom: -2px;
}

.mini-mark {
  color: var(--primary);
  font-size: 18px;
}

.mini-mark.green {
  color: #0ea86e;
}

.mini-mark.gold {
  color: #d89a00;
}

.mini-mark.orange {
  color: var(--primary);
}

.section-card {
  padding: 20px;
  border-radius: 22px;
}

.fixed-card {
  position: sticky;
  top: 100px;
}

.accent-card {
  background: linear-gradient(180deg, #fff6ef 0%, #ffffff 100%);
}

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-icon.bright {
  background: linear-gradient(135deg, var(--primary), #ff9348);
  color: #fff;
}

.subsection {
  padding-top: 16px;
  border-top: 1px solid rgba(236, 228, 218, 0.9);
}

.subsection.no-border {
  border-top: 0;
}

.subsection.no-padding {
  padding-top: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

.form-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field textarea,
.select-field {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 0 14px;
  color: var(--text);
  outline: none;
  transition: 0.2s ease;
}

.field textarea {
  padding-top: 12px;
  min-height: 110px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.select-field:focus {
  border-color: rgba(255, 116, 18, 0.7);
  box-shadow: 0 0 0 4px rgba(255, 116, 18, 0.12);
}

.toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.toggle-pill {
  position: relative;
}

.toggle-pill input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.toggle-pill span {
  min-height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-weight: 700;
  color: #4f4a45;
}

.toggle-pill input:checked + span {
  background: linear-gradient(180deg, var(--primary) 0%, #ff822d 100%);
  color: #fff;
  border-color: transparent;
}

[data-finance-fields].is-hidden {
  display: none;
}

.actions-row,
.result-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.actions-row {
  margin-top: 18px;
}

.btn {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 15px;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 14px 30px rgba(255, 116, 18, 0.18);
}

.btn-ghost {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: #3f3c38;
}

.btn-block {
  width: 100%;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 60;
}

.modal.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 43, 30, 0.34);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(860px, calc(100vw - 24px));
  margin: 24px auto;
  background: #fffdfa;
  border-radius: 24px;
  border: 1px solid rgba(230, 214, 197, 0.95);
  box-shadow: 0 34px 90px rgba(83, 58, 33, 0.2);
  padding: 22px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.modal-dialog-narrow {
  width: min(620px, calc(100vw - 24px));
}

.modal-dialog-wide {
  width: min(1080px, calc(100vw - 24px));
}

.loading-dialog {
  width: min(660px, calc(100vw - 24px));
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 116, 18, 0.12);
  color: var(--primary);
  font-size: 28px;
  cursor: pointer;
}

.confirm-title {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.confirm-title p {
  margin: 6px 0 0;
  color: #5f5b57;
}

.confirm-icon {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: #def8e7;
  color: var(--green);
  font-size: 26px;
  font-weight: 800;
}

.confirm-box {
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.confirm-box-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.confirm-box-head h3,
.modal-header h2 {
  margin: 0;
}

.preview-box {
  border-color: #f1c7a2;
  background: linear-gradient(180deg, #fff8f1, #fffdfb);
}

.success-box {
  border-color: #6fe3a4;
  background: linear-gradient(180deg, #f7fffa, #ffffff);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}

.tag.neutral {
  background: #ffeddc;
  color: var(--primary);
}

.tag.success {
  background: #dcf8e6;
  color: #248c59;
}

.tag.warning {
  background: #fff3cc;
  color: #cb8510;
}

.tag.danger {
  background: #ffe0de;
  color: #d13b34;
}

.helper-text {
  margin-top: 8px;
  font-size: 14px;
}

.loading-shell {
  display: grid;
  gap: 18px;
}

.loading-orb {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffd1a8, #ff7412 70%);
  box-shadow: 0 18px 42px rgba(255, 116, 18, 0.28);
  animation: pulseOrb 1.8s ease-in-out infinite;
}

.loading-kicker {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.loading-copy h2 {
  margin: 0 0 8px;
}

.loading-copy p {
  margin: 0;
  color: var(--muted);
}

.loading-progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 116, 18, 0.12);
  border: 1px solid rgba(255, 116, 18, 0.18);
}

.loading-progress-bar {
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7412, #ffab58);
  transition: width 0.8s ease;
}

.loading-percent {
  justify-self: end;
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.loading-log-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #fff8f1, #fffdfb);
}

.loading-log-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
}

.loading-log-head span {
  color: var(--muted);
}

.loading-log-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: #7a746f;
}

.loading-log-list li.is-active {
  color: var(--text-main);
  font-weight: 700;
}

.loading-log-list li.is-done {
  color: #248c59;
}

@keyframes pulseOrb {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 18px 42px rgba(255, 116, 18, 0.28);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 22px 52px rgba(255, 116, 18, 0.4);
  }
}

.warning-text {
  color: #c67a00;
  font-weight: 600;
}

.iptu-period-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.toggle-pill.compact span {
  min-height: 44px;
  font-size: 14px;
}

.result-top {
  border-radius: 22px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.result-top.is-not-viable {
  background: linear-gradient(180deg, #fff7f6, #fffdfb);
  border: 1px solid #f2c8c5;
}

.result-top.is-viable {
  background: linear-gradient(180deg, #f4fff8, #fffdfb);
  border: 1px solid #bde8cf;
}

.result-top-main {
  display: flex;
  gap: 14px;
  min-width: 0;
}

.result-status-icon {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  font-size: 30px;
  font-weight: 800;
}

.result-status-icon.bad {
  color: var(--red);
  background: #ffe6e3;
}

.result-status-icon.ok {
  color: var(--green);
  background: #def8e7;
}

.result-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.result-title-row h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.15;
}

.result-top-metrics {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.result-top-metrics span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.result-top-metrics strong {
  font-size: clamp(1.65rem, 2.3vw, 2.55rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.metric-bad {
  color: var(--red);
}

.metric-good {
  color: var(--green);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.result-card {
  border-radius: 22px;
  padding: 18px;
}

.blue-card {
  background: linear-gradient(180deg, #f7faff, #fdfefe);
  border-color: #cddcf9;
}

.green-card {
  background: linear-gradient(180deg, #f6fff9, #fcfffd);
  border-color: #caecd8;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.card-title-row h3 {
  margin: 0;
  color: #163f91;
}

.green-card .card-title-row h3 {
  color: #1c6a43;
}

.warning-box {
  border-radius: 16px;
  background: #fff7da;
  color: #cb7f00;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.45;
}

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

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

.summary-box {
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.85);
  min-width: 0;
}

.summary-box.small {
  padding: 14px 12px;
}

.summary-box span,
.kpi-card span,
.line-items span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-box strong,
.kpi-card strong {
  font-size: clamp(0.98rem, 1vw, 1.18rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.chips-row {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-strong);
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}

.cost-title {
  margin: 6px 0 12px;
  font-weight: 800;
  color: #57514a;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.kpi-card {
  border-radius: 18px;
  padding: 18px;
  min-width: 0;
}

.soft-red {
  background: #fff4f2;
  border: 1px solid #f6c8c5;
}

.soft-green {
  background: #effdf5;
  border: 1px solid #bce6cb;
}

.soft-yellow {
  background: #fff8e8;
  border: 1px solid #efd06a;
}

.address-chip {
  margin-top: 18px;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #dcefe3;
}

.address-chip.secondary {
  margin-top: 10px;
}

.installments-title {
  margin: 18px 0 10px;
  font-weight: 800;
  color: #4f5f4f;
}

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

.installment-chip {
  border-radius: 14px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #dcefe3;
  text-align: center;
  min-width: 0;
}

.installment-chip span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
  font-size: 13px;
}

.installment-chip strong {
  display: block;
  font-size: clamp(0.82rem, 0.9vw, 0.95rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.result-actions {
  margin-top: 18px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
}

.cost-section {
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
}

.neutral-panel {
  background: #fff;
}

.blue-panel {
  background: #f5f9ff;
  border-color: #c8dafb;
}

.purple-panel {
  background: #f9f4ff;
  border-color: #dcc7ff;
}

.orange-panel {
  background: #fff7ec;
  border-color: #f2d3aa;
}

.green-panel {
  background: #f4fff7;
  border-color: #c6ebd2;
}

.red-panel {
  background: #fff5f5;
  border-color: #f3c5c5;
}

.summary-panel {
  background: linear-gradient(180deg, #fff8f2, #fffdfb);
  border-color: #f1cfad;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-top: 12px;
}

.details-grid span {
  color: var(--muted);
}

.line-items {
  margin-top: 8px;
}

.line-items div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.line-items div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.line-items strong {
  font-size: clamp(0.92rem, 1vw, 1.08rem);
  text-align: right;
  max-width: 48%;
  overflow-wrap: anywhere;
}

.toolbar,
.cards-grid,
.empty-state {
  display: flex;
}

.toolbar {
  margin-bottom: 18px;
}

.cards-grid {
  gap: 12px;
  flex-wrap: wrap;
}

.empty-state {
  min-height: 310px;
  border-radius: 22px;
  border: 1px dashed var(--line-strong);
  background: linear-gradient(180deg, #fffefc, #fff);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 10px;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  background: #fff4ea;
  color: #b6aca4;
  font-size: 34px;
}

.mini-card {
  padding: 18px;
  border-radius: 16px;
}

.app-shell-auth {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
}

.flash-success {
  background: #effdf5;
  border-color: #bce6cb;
}

.flash-error {
  background: #fff4f2;
  border-color: #f1c3be;
}

.success-alert {
  background: #effdf5;
  border-color: #bce6cb;
}

.flash-whatsapp_link {
  background: #effaf1;
  border-color: #9fd8b3;
}

.flash a {
  color: inherit;
  font-weight: 700;
}

.user-meta {
  display: flex;
  flex-direction: column;
  text-align: right;
  gap: 2px;
}

.user-meta span {
  color: var(--muted);
  font-size: 13px;
}

.avatar-photo,
.table-avatar {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.table-avatar {
  width: 42px;
  height: 42px;
}

.table-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff1e4;
  color: var(--brand);
  font-weight: 800;
}

.btn-sm {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.auth-wrap {
  width: 100%;
}

.auth-card,
.page-head-card,
.admin-form-card,
.history-card {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

.auth-card {
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.logo-mark.large {
  width: 62px;
  height: 62px;
  font-size: 24px;
}

.auth-brand h1,
.page-head-card h1 {
  margin: 0 0 6px;
}

.auth-brand p,
.page-head-card p {
  margin: 0;
  color: var(--muted);
}

.auth-hint {
  margin-top: 18px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
}

.page-head-card {
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  font-size: 13px;
  color: var(--muted);
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-toggle-row {
  justify-content: flex-start;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.history-item {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #fffefb, #fff);
}

.history-item-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.history-item h3 {
  margin: 0;
  font-size: 1rem;
}

.history-item p {
  color: var(--muted);
  margin: 8px 0 14px;
}

.history-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.history-metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.history-metrics strong {
  display: block;
  overflow-wrap: anywhere;
}

.compact-empty {
  min-height: 220px;
}

.filters-card {
  margin-bottom: 18px;
}

.filters-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.field-grow {
  grid-column: span 1;
}

.filters-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.analysis-list-hero {
  margin-bottom: 18px;
}

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

.analysis-card {
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), #fbfffd);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.analysis-card-viable {
  border-top: 4px solid #2dc567;
}

.analysis-card-risk {
  border-top: 4px solid #f4a416;
}

.analysis-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.analysis-card-top h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

.analysis-card-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
}

.analysis-card-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.analysis-card-kpis > div {
  padding: 22px 20px;
  background: rgba(255, 255, 255, 0.92);
  min-width: 0;
}

.analysis-card-kpis > div + div {
  border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.analysis-card-kpis span {
  display: block;
  color: #7b766f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.analysis-card-kpis strong {
  display: block;
  font-size: clamp(1.2rem, 1.8vw, 1.7rem);
  overflow-wrap: anywhere;
}

.analysis-card-note {
  margin-bottom: 18px;
}

.analysis-card-note-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.analysis-card-note-head span,
.analysis-card-note p {
  color: var(--muted);
}

.analysis-card-actions {
  display: grid;
  gap: 12px;
}

.analysis-card-actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.analysis-card-grow {
  flex: 1 1 auto;
}

.btn-success {
  border: 1px solid #16a765;
  background: linear-gradient(180deg, #1fc671, #15995c);
  color: #fff;
}

.btn-icon-danger {
  min-height: 52px;
  min-width: 52px;
  border-radius: 16px;
  border: 1px solid #f1d2ce;
  background: #fff;
  color: #9d4d45;
  font-weight: 800;
}

.detailed-result-page,
.detailed-market-card {
  margin-top: 18px;
}

.detailed-market-insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.comparables-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.market-source-line {
  margin-top: 12px;
  color: var(--muted);
}

.market-source-line a,
.comparables-table a {
  color: var(--brand);
  font-weight: 700;
}

.comparable-source-name {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.portal-comparables-block {
  margin-top: 18px;
}

.portal-comparables-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}

.portal-comparables-head h3 {
  margin: 0 0 4px;
}

.portal-comparables-head p {
  margin: 0;
  color: var(--muted);
}

.comparables-empty {
  padding: 16px 18px;
  border: 1px dashed var(--stroke);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 1200px) {
  .analysis-layout,
  .result-grid,
  .summary-grid.four-tight,
  .form-grid.four,
  .form-grid.five {
    grid-template-columns: 1fr;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .history-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters-grid,
  .analysis-cards-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detailed-market-insights {
    grid-template-columns: 1fr;
  }

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

  .fixed-card {
    position: static;
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding-inline: 14px;
  }

  .page-head-card,
  .header-side {
    flex-direction: column;
    align-items: stretch;
  }

  .top-banner,
  .result-top,
  .result-top-main,
  .result-top-metrics,
  .actions-row,
  .result-actions,
  .confirm-title {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid.two,
  .form-grid.three,
  .toggle-row,
  .iptu-period-box,
  .summary-grid,
  .kpi-row,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid.four-tight,
  .installments-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-box,
  .kpi-card,
  .installment-chip {
    padding: 14px 12px;
  }

  .result-top-metrics strong {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .summary-box strong,
  .kpi-card strong,
  .line-items strong {
    font-size: 0.98rem;
  }

  .tab-switch {
    display: flex;
    width: 100%;
  }

  .tab-pill {
    flex: 1 1 auto;
    text-align: center;
  }

  .modal-dialog {
    margin: 12px auto;
    max-height: calc(100vh - 24px);
    padding: 18px 14px;
  }

  .line-items div {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .line-items strong {
    max-width: 100%;
    text-align: left;
  }

  .history-grid,
  .history-metrics,
  .filters-grid,
  .analysis-cards-grid,
  .analysis-card-kpis {
    grid-template-columns: 1fr;
  }

  .analysis-card-top,
  .analysis-card-actions-row,
  .filters-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3),
  .admin-table th:nth-child(6),
  .admin-table td:nth-child(6) {
    display: none;
  }
}
