:root {
  color-scheme: light;
  --bg: #e9f1ef;
  --panel: rgba(255, 255, 255, 0.96);
  --ink: #213536;
  --muted: #607271;
  --line: #d7e3e0;
  --brand-dark: #263f40;
  --brand-darker: #1c3031;
  --brand-green: #61bf8e;
  --brand-green-deep: #21976b;
  --warn: #9b1c12;
  --soft: #edf8f3;
  --shadow: 0 22px 70px rgba(28, 48, 49, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(97, 191, 142, 0.32), transparent 28%),
    linear-gradient(135deg, #f6fbf8 0%, #e7f0ee 42%, #d8e6e2 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body.modal-open {
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.control-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  text-align: center;
}

.control-panel {
  align-self: start;
  border-radius: 8px;
  padding: 22px;
  position: sticky;
  top: 20px;
}

.result-panel {
  border-radius: 8px;
  padding: 24px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: -22px -22px 22px;
  padding: 22px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(145deg, var(--brand-dark), var(--brand-darker));
  color: #fff;
}

.logo {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 8px;
  flex: 0 0 auto;
}

.kicker {
  color: var(--brand-green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 6px 0 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

.field {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

label span {
  font-weight: 500;
}

input,
select,
button {
  width: 100%;
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
}

input,
select {
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  text-align: center;
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(97, 191, 142, 0.24);
  border-color: var(--brand-green-deep);
}

.segmented {
  display: grid;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8f7;
}

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

.segment {
  background: transparent;
  color: var(--ink);
  border-color: transparent;
  cursor: pointer;
  font-weight: 800;
}

.segment.active {
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-deep));
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(33, 151, 107, 0.22);
  color: #fff;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.payment-panel {
  border: 1px solid rgba(97, 191, 142, 0.28);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--brand-dark), var(--brand-darker));
  box-shadow: 0 12px 28px rgba(28, 48, 49, 0.16);
  margin-bottom: 16px;
  padding: 14px;
  text-align: center;
}

.payment-panel .grid-2 + .grid-2 {
  margin-top: 12px;
}

.payment-panel .field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 0;
  min-height: 92px;
  padding: 4px;
  text-align: center;
}

.payment-panel label {
  color: #dff2ea;
  line-height: 1.25;
}

.payment-panel label span {
  color: var(--brand-green);
  font-weight: 800;
}

.payment-panel input {
  border-color: rgba(97, 191, 142, 0.42);
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  font-weight: 900;
}

.payment-panel input:focus {
  background: rgba(255, 255, 255, 0.16);
}

.readonly output {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(97, 191, 142, 0.42);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  padding: 10px 12px;
  text-align: center;
  font-weight: 800;
}

.message {
  display: none;
  margin: 4px 0 16px;
  border-radius: 6px;
  background: #fff1f0;
  border: 1px solid #f0a29a;
  color: var(--warn);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
}

.message.show {
  display: block;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
  align-items: center;
}

.actions button {
  min-height: 48px;
  padding: 10px 8px;
  font-size: 13px;
  line-height: 1.1;
}

.tour-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin-top: 18px;
  min-height: 86px;
  border: 1px solid rgba(97, 191, 142, 0.52);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(28, 48, 49, 0.90), rgba(33, 151, 107, 0.44)),
    url("tour-cenac-render.png") center 44% / cover no-repeat;
  box-shadow: 0 14px 30px rgba(28, 48, 49, 0.22);
  color: #fff;
  padding: 14px;
  overflow: hidden;
  text-align: center;
  text-decoration: none;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.tour-button::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(28, 48, 49, 0.08), rgba(28, 48, 49, 0.48));
  content: "";
}

.tour-button:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.tour-button strong,
.tour-button span {
  position: relative;
  display: block;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.42);
}

.tour-button strong {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
}

.tour-button span {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

button {
  background: linear-gradient(135deg, var(--brand-green), var(--brand-green-deep));
  color: #fff;
  border-color: transparent;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  filter: brightness(0.96);
}

button.ghost {
  background: #fff;
  color: var(--brand-dark);
  border-color: var(--brand-green);
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: -24px -24px 0;
  padding: 24px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(135deg, var(--brand-dark), #315253);
  color: #fff;
}

.summary-head > div:first-child {
  text-align: left;
}

.summary-head .kicker {
  color: var(--brand-green);
}

.price {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 66px;
  border-radius: 8px;
  background: rgba(97, 191, 142, 0.16);
  border: 1px solid rgba(97, 191, 142, 0.45);
  color: #fff;
  padding: 12px 16px;
  font-size: 24px;
  font-weight: 900;
}

.cenac-badge {
  display: block;
  width: 49px;
  height: auto;
  object-fit: contain;
  align-self: center;
  flex: 0 0 auto;
}

.lot-preview {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.lot-preview-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  background: #eff7f4;
  color: var(--brand-dark);
  text-align: left;
}

.caption-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.lot-preview-caption span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.plan-open-btn {
  width: auto;
  min-height: 0;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.lot-preview-caption strong {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lot-map {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 260px;
  max-height: 520px;
  overflow: hidden;
  background: #f8fbfa;
}

.lot-map img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  user-select: none;
}

.metrics,
.finance-strip {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

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

.metrics article,
.finance-strip div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbfa);
  padding: 11px;
  min-width: 0;
  text-align: center;
}

.metrics article {
  min-height: 72px;
}

.finance-strip div {
  border-color: rgba(97, 191, 142, 0.36);
  background: linear-gradient(145deg, var(--brand-dark), var(--brand-darker));
  box-shadow: 0 10px 22px rgba(28, 48, 49, 0.12);
}

.metrics span,
.finance-strip span {
  display: block;
  font-size: 11px;
  font-weight: 800;
}

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

.finance-strip span {
  color: #dff2ea;
}

.metrics strong,
.finance-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  line-height: 1.2;
}

.finance-strip strong {
  color: #ffffff;
}

.table-wrap {
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 540px;
}

.col-date {
  width: 96px;
}

.col-concept {
  width: 88px;
}

.col-money,
.col-tax,
.col-total {
  width: calc((100% - 184px) / 3);
}

th,
td {
  padding: 9px 6px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(215, 227, 224, 0.9);
  text-align: center;
  white-space: nowrap;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  background: #eff7f4;
  color: var(--brand-dark);
  font-size: 12px;
  text-transform: uppercase;
}

thead th:nth-child(even),
tbody td:nth-child(even) {
  background: #f5fbf8;
}

thead th:nth-child(odd),
tbody td:nth-child(odd) {
  background: #ffffff;
}

tbody td {
  font-size: 13px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tfoot td {
  color: var(--brand-dark);
  font-weight: 900;
}

tfoot td:nth-child(odd) {
  background: #e8f6f0;
}

tfoot td:nth-child(even) {
  background: #f3fbf7;
}

.credits {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.plan-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(8, 18, 18, 0.92);
  color: #fff;
}

.plan-modal[hidden] {
  display: none;
}

.plan-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-darker));
  border-bottom: 1px solid rgba(97, 191, 142, 0.28);
}

.plan-modal-bar strong {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.plan-tools button {
  width: 42px;
  min-height: 38px;
  border-radius: 8px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.plan-close-btn {
  background: #ffffff;
  color: var(--brand-dark);
}

.plan-viewport {
  position: relative;
  overflow: hidden;
  touch-action: auto;
  background:
    radial-gradient(circle at center, rgba(97, 191, 142, 0.14), transparent 34%),
    #111b1c;
}

.plan-viewport img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  max-width: none;
  width: min(92vw, 1400px);
  height: auto;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%) translate(0, 0) scale(1);
  transform-origin: center center;
  user-select: none;
  will-change: transform;
}

.plan-viewport iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.is-hidden {
  display: none;
}

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

  .control-panel {
    position: static;
  }

  .metrics,
  .finance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 10px;
  }

  .control-panel,
  .result-panel {
    padding: 16px;
  }

  .brand {
    margin: -16px -16px 18px;
    padding: 18px;
    gap: 12px;
  }

  .logo {
    width: 58px;
    height: 58px;
  }

  .grid-2,
  .finance-strip,
  .summary-head {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .metrics article {
    padding: 8px 6px;
    min-height: 58px;
  }

  .metrics strong {
    font-size: 13px;
  }

  .metrics span {
    font-size: 10px;
  }

  .summary-head {
    margin: -16px -16px 0;
    padding: 18px;
  }

  .lot-preview-caption {
    display: block;
    text-align: center;
  }

  .caption-title {
    justify-content: center;
    flex-wrap: wrap;
  }

  .lot-preview-caption strong {
    display: block;
    margin-top: 4px;
    text-align: center;
  }

  .lot-map {
    aspect-ratio: 4 / 3;
    min-height: 230px;
  }

  .price {
    width: 100%;
  }

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

  .actions button {
    width: 100%;
    justify-self: center;
  }

  .cenac-badge {
    width: 44px;
    justify-self: center;
  }

  .plan-modal-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .plan-modal-bar strong {
    text-align: center;
  }

  .plan-tools {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .plan-tools button,
  .plan-viewport img {
    width: 96vw;
  }
}

@media print {
  body {
    background: #fff;
  }

  .shell {
    display: block;
    padding: 0;
    min-height: auto;
  }

  .control-panel {
    display: none;
  }

  .result-panel {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .summary-head {
    margin: 0 0 12px;
    border-radius: 0;
    padding: 16px;
  }

  .metrics,
  .finance-strip {
    page-break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
    font-size: 11px;
  }

  th,
  td {
    padding: 6px;
  }
}
