:root {
  --bg: #ececea;
  --panel: rgba(250, 249, 247, 0.82);
  --panel-strong: #ffffff;
  --text: #171717;
  --muted: #686868;
  --line: rgba(88, 88, 88, 0.14);
  --primary: #3a3a3a;
  --primary-dark: #202020;
  --accent: #b8a37a;
  --shadow: 0 24px 80px rgba(16, 16, 16, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(95, 95, 95, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(184, 163, 122, 0.12), transparent 24%),
    linear-gradient(180deg, #f4f3f1 0%, #e9e7e3 100%);
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.4;
  pointer-events: none;
}

.ambient-left {
  left: -120px;
  top: 8vh;
  background: rgba(109, 109, 109, 0.18);
}

.ambient-right {
  right: -160px;
  top: 40vh;
  background: rgba(184, 163, 122, 0.16);
}

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

.page-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 86px;
  transition: width 0.22s ease, padding 0.22s ease;
  padding: 18px 12px;
  background:
    linear-gradient(180deg, rgba(22, 22, 22, 0.98), rgba(41, 41, 41, 0.96));
  color: #ece9e1;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  overflow: visible auto;
  z-index: 30;
  backdrop-filter: blur(18px);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 10px 8px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  border: 1px solid rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.sidebar:not(:hover):not(:focus-within) .topbar {
  justify-items: center;
}

.sidebar:not(:hover):not(:focus-within) .nav-section-label {
  opacity: 0;
  max-height: 0;
  padding: 0;
  overflow: hidden;
}

.sidebar:hover,
.sidebar:focus-within {
  width: 248px;
  padding: 18px 14px;
}

.topbar {
  display: grid;
  align-content: start;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 0;
  flex: 0 0 auto;
  min-height: 58px;
  padding: 6px;
  border-radius: 18px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.brand:hover {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand-mark {
  min-width: 46px;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #d5c08d, #a78f63);
  color: #1f1f1f;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-lockup {
  display: grid;
  gap: 2px;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transform: translateX(-6px);
  transition: max-width 0.22s ease, opacity 0.18s ease, transform 0.22s ease;
}

.brand-lockup strong {
  display: block;
  font-family: "Cinzel", serif;
  font-size: 0.96rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.brand small {
  display: block;
  color: rgba(236, 233, 225, 0.64);
  margin-top: 3px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.62rem;
}

.nav-links {
  display: grid;
  align-items: stretch;
  align-content: start;
  gap: 6px;
  min-width: 0;
  overflow: visible;
  padding-bottom: 0;
  padding-top: 6px;
  scrollbar-width: thin;
}

.sidebar:not(:hover):not(:focus-within) .nav-links {
  justify-items: center;
  width: 100%;
  gap: 8px;
}

.nav-links a,
.button {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.nav-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  color: rgba(236, 233, 225, 0.78);
  border: 1px solid transparent;
  white-space: nowrap;
  width: 100%;
  font-size: 0.76rem;
  text-align: center;
  overflow: hidden;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    justify-content 0.2s ease,
    border-color 0.2s ease;
}

.sidebar:not(:hover):not(:focus-within) .nav-links a,
.sidebar:not(:hover):not(:focus-within) .nav-dropdown,
.sidebar:not(:hover):not(:focus-within) .nav-dropdown summary {
  width: 46px;
}

.sidebar:not(:hover):not(:focus-within) .nav-links a,
.sidebar:not(:hover):not(:focus-within) .nav-dropdown summary {
  height: 46px;
  padding: 0;
  justify-content: center;
  border-radius: 14px;
}

.sidebar:not(:hover):not(:focus-within) .nav-dropdown-menu {
  left: 56px;
  right: auto;
  top: 0;
  width: 196px;
}

.nav-dropdown {
  position: relative;
  width: 100%;
  z-index: 40;
}

.nav-dropdown summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  color: rgba(236, 233, 225, 0.78);
  border: 1px solid transparent;
  white-space: nowrap;
  font-size: 0.76rem;
  cursor: pointer;
  user-select: none;
  width: 100%;
  overflow: hidden;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    justify-content 0.2s ease,
    box-shadow 0.2s ease;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown-caret {
  font-size: 0.78rem;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

.nav-dropdown[open] .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown.active summary,
.nav-dropdown summary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(184, 163, 122, 0.18);
  color: white;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 0;
  max-width: none;
  display: grid;
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(34, 34, 34, 0.98), rgba(22, 22, 22, 0.96));
  border: 1px solid rgba(184, 163, 122, 0.2);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.nav-dropdown-menu a {
  justify-content: flex-start;
  padding: 8px 10px;
  border-radius: 10px;
  color: rgba(236, 233, 225, 0.82);
  border: 1px solid transparent;
  white-space: normal;
}

.nav-dropdown-menu a.active,
.nav-dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(184, 163, 122, 0.18);
  color: white;
}

.nav-link-full {
  display: inline;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transform: translateX(-6px);
  transition: max-width 0.22s ease, opacity 0.18s ease, transform 0.22s ease;
}

.nav-link-mini {
  width: 24px;
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  font-size: 0.92rem;
  color: rgba(236, 233, 225, 0.92);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.nav-links a.active,
.nav-links a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(184, 163, 122, 0.18);
  color: white;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

.nav-links a.active {
  background: linear-gradient(180deg, rgba(184, 163, 122, 0.18), rgba(255, 255, 255, 0.08));
  border-color: rgba(184, 163, 122, 0.34);
}

.nav-links a.active .nav-link-mini,
.nav-links a:hover .nav-link-mini,
.nav-dropdown.active .nav-link-mini,
.nav-dropdown summary:hover .nav-link-mini {
  background: rgba(184, 163, 122, 0.2);
  color: #f7f1e5;
}

.sidebar:not(:hover):not(:focus-within) .nav-links a.active,
.sidebar:not(:hover):not(:focus-within) .nav-dropdown.active summary {
  background: linear-gradient(180deg, rgba(184, 163, 122, 0.22), rgba(255, 255, 255, 0.08));
  border-color: rgba(184, 163, 122, 0.34);
}

.sidebar:not(:hover):not(:focus-within) .nav-links a.active .nav-link-mini,
.sidebar:not(:hover):not(:focus-within) .nav-dropdown.active .nav-link-mini {
  transform: scale(1.08);
}

.sidebar:hover .brand,
.sidebar:focus-within .brand {
  justify-content: flex-start;
  gap: 12px;
}

.sidebar:hover .brand-mark,
.sidebar:focus-within .brand-mark {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 24px rgba(0, 0, 0, 0.16);
}

.sidebar:hover .brand-lockup,
.sidebar:focus-within .brand-lockup {
  max-width: 160px;
  opacity: 1;
  transform: translateX(0);
}

.sidebar:hover .nav-links a,
.sidebar:focus-within .nav-links a,
.sidebar:hover .nav-dropdown summary,
.sidebar:focus-within .nav-dropdown summary {
  justify-content: flex-start;
}

.sidebar:hover .nav-dropdown[open],
.sidebar:focus-within .nav-dropdown[open] {
  margin-bottom: 152px;
}

.sidebar:hover .nav-link-full,
.sidebar:focus-within .nav-link-full {
  max-width: 160px;
  opacity: 1;
  transform: translateX(0);
}

.sidebar:hover .nav-link-mini,
.sidebar:focus-within .nav-link-mini {
  opacity: 0;
  transform: scale(0.92);
  width: 0;
}

.content {
  padding: 28px 36px 36px;
  min-width: 0;
  max-width: 100%;
}

.hero,
.panel,
.form-shell {
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}

.hero {
  padding: 34px;
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -120px auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 163, 122, 0.22), transparent 70%);
  pointer-events: none;
}

.hero h1,
.page-heading h1 {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.hero p,
.page-heading p,
.empty-state p,
.notes {
  color: var(--muted);
  line-height: 1.6;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.05);
  color: #232323;
  font-weight: 700;
}

.hero-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
}

.hero-ribbon span {
  padding: 10px 12px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: #555555;
  font-size: 0.92rem;
  font-weight: 700;
}

.eyebrow {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #5f5f5f;
  font-weight: 800;
}

.hero-actions,
.detail-actions,
.form-actions,
.panel-header,
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-copy {
  max-width: 760px;
}

.hero-copy h1 {
  font-size: 1.7rem;
  line-height: 1.1;
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  gap: 16px;
}

.hero-stats,
.dashboard-status-grid {
  margin-top: 26px;
  grid-template-columns: repeat(5, 148px);
  justify-content: start;
  gap: 12px;
}

.hero-stats .stat-card,
.dashboard-status-grid .stat-card {
  border-radius: 18px;
  padding: 12px 14px;
  width: 148px;
  min-width: 148px;
}

.hero-stats .stat-card span,
.dashboard-status-grid .stat-card span {
  font-size: 0.78rem;
  white-space: nowrap;
}

.hero-stats .stat-card strong,
.dashboard-status-grid .stat-card strong {
  margin-top: 4px;
  font-size: 1.25rem;
}

.hero-stats .stat-card small,
.dashboard-status-grid .stat-card small {
  display: none;
}

.stat-card {
  border-radius: 24px;
  padding: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.stat-card.highlight {
  background: linear-gradient(135deg, #5b5b5b, #222222);
  color: white;
}

.stat-card span,
.badge,
dt,
figcaption {
  color: var(--muted);
}

.stat-card.highlight span {
  color: rgba(255, 255, 255, 0.75);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

.stat-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.stat-card.highlight small {
  color: rgba(255, 255, 255, 0.75);
}

.panel,
.form-shell {
  margin-top: 26px;
  border-radius: var(--radius-xl);
  padding: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.button.primary {
  background: linear-gradient(135deg, #4f4f4f, #1d1d1d);
  color: white;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.86);
  color: #232323;
  border: 1px solid var(--line);
}

.button.danger {
  background: rgba(140, 45, 45, 0.08);
  color: #8c3535;
  border: 1px solid rgba(140, 45, 45, 0.16);
}

.button.danger:hover,
.button.danger:focus {
  background: rgba(140, 45, 45, 0.14);
}

.button.full {
  width: 100%;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.52);
  color: #2d2d2d;
  border: 1px solid rgba(88, 88, 88, 0.14);
  backdrop-filter: blur(10px);
}

.hero-actions {
  margin-top: 22px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.hero-actions-main {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-inline-form {
  margin: 0;
}

.table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
}

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

th,
td {
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: rgba(63, 63, 63, 0.05);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(184, 163, 122, 0.14);
  color: #5e5138;
  font-size: 0.9rem;
  font-weight: 700;
}

.search-bar {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
}

.search-bar input,
.report-form input,
.report-form select,
.report-form-bound input,
.report-form-bound select,
.report-form-bound textarea,
.report-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
}

.search-bar input:focus,
.report-form input:focus,
.report-form select:focus,
.report-form textarea:focus,
.report-form-bound input:focus,
.report-form-bound select:focus,
.report-form-bound textarea:focus {
  outline: none;
  border-color: rgba(184, 163, 122, 0.52);
  box-shadow: 0 0 0 3px rgba(184, 163, 122, 0.14);
}

.report-form input,
.report-form select,
.report-form textarea,
.report-form-bound input,
.report-form-bound select,
.report-form-bound textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.report-form input[list] {
  background-image: linear-gradient(45deg, transparent 50%, #686868 50%),
    linear-gradient(135deg, #686868 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.report-grid,
.gallery,
.detail-grid {
  display: grid;
  gap: 18px;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.integration-help {
  margin-top: 24px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 88, 88, 0.12);
}

.integration-help pre {
  margin: 12px 0 0;
  padding: 16px;
  overflow-x: auto;
  border-radius: 16px;
  background: #181818;
  color: #f3efe6;
}

.report-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.report-card,
.gallery-card {
  padding: 20px;
  border-radius: 22px;
  background: white;
  border: 1px solid var(--line);
}

.report-card.is-validated {
  background: linear-gradient(180deg, rgba(241, 250, 243, 0.96), rgba(255, 255, 255, 0.98));
  border-color: rgba(84, 140, 95, 0.18);
}

.report-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.report-card h3 {
  margin-bottom: 8px;
}

.report-card p {
  min-height: 48px;
  color: var(--muted);
}

.report-card dl,
.detail-list {
  display: grid;
  gap: 12px;
}

.report-card dl div,
.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.report-card dt,
.detail-list dt {
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

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

.form-grid-terreno-wrap {
  grid-template-columns: 1fr;
  gap: 0;
}

.form-grid-comparativo {
  grid-template-columns: 1fr;
  gap: 14px;
}

.form-grid-construccion {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.form-grid-construccion label {
  min-width: 0;
}

.form-grid-construccion label:has(input[name="Tipo_Construccion"]),
.form-grid-construccion label:has(input[name="Uso_Actual"]) {
  grid-column: span 2;
}

.comparables-shell {
  display: grid;
  gap: 14px;
}

.comparison-lab-shell {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

.comparison-lab {
  display: grid;
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

.comparison-subject-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 242, 233, 0.74));
  border: 1px solid rgba(184, 163, 122, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.comparison-warning-box {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(184, 163, 122, 0.12);
  border: 1px solid rgba(184, 163, 122, 0.2);
}

.comparison-warning-box strong {
  display: block;
  margin-bottom: 6px;
}

.comparison-warning-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.comparable-card {
  padding: 18px 18px 16px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(249, 246, 239, 0.84));
  border: 1px solid rgba(184, 163, 122, 0.14);
  box-shadow: 0 16px 36px rgba(36, 31, 22, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.comparable-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(184, 163, 122, 0.14);
}

.comparable-card-head strong {
  font-size: 1.06rem;
}

.comparable-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.comparable-photo-field {
  grid-column: span 2;
}

.comparable-photo-shell {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.comparable-photo-preview {
  display: block;
  width: 140px;
  height: 112px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(184, 163, 122, 0.2);
  background: rgba(255, 255, 255, 0.96);
}

.comparable-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.comparable-photo-preview.is-empty {
  display: grid;
  place-items: center;
  color: rgba(108, 102, 90, 0.7);
  font-size: 0.82rem;
}

.comparable-photo-controls {
  display: grid;
  gap: 8px;
}

.comparable-photo-controls small {
  color: rgba(108, 102, 90, 0.82);
}

.link-danger {
  margin-left: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #b04343;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.link-danger:hover {
  color: #8e2f2f;
  text-decoration: underline;
}

.comparable-factors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(184, 163, 122, 0.14);
}

.comparable-factors-grid > * {
  min-width: 0;
}

.cost-services-grid {
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 10px;
}

.market-toggle-grid {
  margin-bottom: 16px;
}

.cost-extra-controls-grid {
  margin-top: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cost-type-area-grid {
  margin-top: 12px;
  grid-template-columns: minmax(260px, 420px);
  justify-content: start;
}

.service-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(184, 163, 122, 0.18);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  white-space: normal;
}

.service-check span {
  overflow-wrap: anywhere;
}

.market-toggle-check {
  grid-column: 1 / -1;
  justify-content: flex-start;
  font-weight: 800;
}

.service-check input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.cost-final-table-shell {
  margin-bottom: 16px;
  padding: 8px 0 4px;
  overflow: visible;
}

.cost-final-table {
  overflow: visible;
}

.cost-final-table th,
.cost-final-table td {
  white-space: nowrap;
  font-size: 0.92rem;
}

.cost-final-table th {
  color: #4b4438;
  font-weight: 800;
  position: relative;
  overflow: visible;
}

.cost-final-table td {
  color: #2e2a23;
}

.construction-table-shell {
  padding-bottom: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.embedded-cost-lab {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.embedded-cost-lab .comparison-lab {
  padding: 0;
  background: transparent;
  border: 0;
}

.cost-lab-intro {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(184, 163, 122, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 242, 233, 0.74));
}

.cost-lab-intro h3 {
  margin: 0;
  font-size: 1.05rem;
}

.cost-lab-intro p {
  margin: 0;
  color: var(--muted);
}

.construction-table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.construction-floating-bubble {
  position: fixed;
  z-index: 60;
  display: grid;
  gap: 4px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 241, 232, 0.96));
  border: 1px solid rgba(184, 163, 122, 0.24);
  box-shadow: 0 14px 28px rgba(32, 28, 22, 0.06);
  pointer-events: none;
}

.construction-floating-bubble[hidden] {
  display: none;
}

.construction-floating-bubble span {
  color: rgba(75, 68, 56, 0.8);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.construction-floating-bubble strong {
  color: #1f1a13;
  font-size: 1.5rem;
  line-height: 1.1;
  font-weight: 800;
  word-break: break-word;
}

.construction-table-actions small {
  color: var(--muted);
  font-weight: 700;
}

.construction-input-table {
  min-width: 0;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.construction-input-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 7px;
  background: rgba(244, 240, 232, 0.96);
  color: #4b4438;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(184, 163, 122, 0.22);
}

.construction-input-table tbody td {
  padding: 7px 5px;
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid rgba(184, 163, 122, 0.12);
}

.construction-input-table tbody tr:nth-child(even) td {
  background: rgba(249, 246, 239, 0.88);
}

.construction-input-table input {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(140, 129, 103, 0.18);
  background: rgba(255, 255, 255, 0.96);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.construction-cell--surface,
.construction-cell--age,
.construction-cell--life {
  max-width: 86px;
}

.construction-cell--vrn,
.construction-input-table tbody td:nth-child(7) {
  max-width: 120px;
}

.construction-input-table td {
  overflow: visible;
}

.table-input-with-trigger {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 118px;
}

.table-input-with-trigger--wide {
  min-width: 110px;
}

.table-input-with-trigger--type {
  min-width: 190px;
}

.table-input-with-trigger input {
  padding-right: 32px;
  transition: width 0.18s ease, min-width 0.18s ease, box-shadow 0.18s ease;
}

.table-input-with-trigger input:focus {
  position: relative;
  z-index: 5;
  min-width: 200px;
}

.table-input-with-trigger--wide input:focus {
  min-width: 180px;
}

.table-input-with-trigger--type input:focus {
  min-width: 320px;
}

.table-input-trigger {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(184, 163, 122, 0.14);
  color: #66583f;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.table-input-trigger:hover {
  background: rgba(184, 163, 122, 0.22);
}

.construction-cell--type {
  min-width: 205px;
}

.construction-cell--use {
  min-width: 135px;
}

.construction-cell--surface {
  min-width: 92px;
}

.construction-cell--vrn {
  min-width: 118px;
}

.construction-cell--age {
  min-width: 58px;
}

.construction-cell--life {
  min-width: 92px;
}

.construction-cell--factor {
  min-width: 58px;
}

.construction-cell--compact input {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.construction-cell--compact .table-input-with-trigger input {
  text-align: left;
}

.construction-input-table th:nth-child(5),
.construction-input-table th:nth-child(7) {
  min-width: 58px;
}

.construction-input-table th:nth-child(3),
.construction-input-table th:nth-child(6) {
  min-width: 92px;
}

.construction-input-table th:nth-child(4),
.construction-input-table th:nth-child(14) {
  min-width: 118px;
}

.construction-input-table th:nth-child(1) {
  min-width: 205px;
}

.construction-input-table th:nth-child(2) {
  min-width: 135px;
}

.construction-input-table input:focus {
  border-color: rgba(184, 163, 122, 0.58);
  box-shadow: 0 0 0 3px rgba(184, 163, 122, 0.12);
  outline: none;
}

.construction-input-table input[data-result-band="Minimo tecnico"] {
  border-color: rgba(170, 94, 44, 0.28);
  background: rgba(255, 245, 238, 0.96);
}

.construction-input-table input[data-result-band="Bajo minimo recomendable"] {
  border-color: rgba(191, 152, 58, 0.28);
  background: rgba(255, 250, 235, 0.96);
}

.construction-input-table input[data-result-band="Maximo"] {
  border-color: rgba(74, 142, 92, 0.24);
  background: rgba(245, 252, 246, 0.96);
}

.construction-input-table tr[hidden] {
  display: none;
}

.construction-factor-row td {
  padding-top: 0;
  background: rgba(249, 246, 239, 0.74) !important;
}

.construction-factor-grid {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) repeat(5, minmax(48px, 0.56fr)) minmax(76px, 0.78fr) minmax(86px, 0.85fr) minmax(72px, 0.74fr);
  gap: 6px;
  align-items: end;
  padding: 6px 8px 8px;
  border-radius: 0 0 14px 14px;
  background: rgba(244, 240, 232, 0.52);
  border: 1px solid rgba(184, 163, 122, 0.12);
  border-top: 0;
}

.construction-factor-row td {
  overflow: hidden;
}

.construction-factor-grid label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.construction-factor-grid label span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.construction-factor-grid input,
.construction-factor-grid select {
  min-width: 0;
  width: 100%;
  min-height: 32px;
  padding: 6px 7px;
  border-radius: 9px;
  font-size: 0.74rem;
}

.construction-factor-grid input[data-derived-field="true"] {
  text-align: center;
}

.installation-factor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 6px;
  max-width: 520px;
}

.installation-factor-grid label {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.installation-factor-grid span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.construction-actions-cell {
  width: 76px;
  text-align: center;
}

.table-row-remove {
  width: 100%;
  min-height: 30px;
  border: 1px solid rgba(150, 55, 49, 0.18);
  border-radius: 999px;
  background: rgba(150, 55, 49, 0.08);
  color: #8b2f2f;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 800;
}

.table-row-remove:hover:not(:disabled) {
  background: rgba(150, 55, 49, 0.14);
  border-color: rgba(150, 55, 49, 0.32);
}

.table-row-remove:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-row-lock {
  color: var(--muted);
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.installation-db-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.installation-db-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.installation-db-form-grid {
  grid-template-columns: repeat(7, minmax(140px, 1fr));
}

.catalog-update-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(244, 240, 232, 0.96);
  border: 1px solid rgba(184, 163, 122, 0.18);
  color: #5b5242;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.table-row-actions {
  display: grid;
  gap: 0.4rem;
}

.table-row-actions .button {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.85rem;
}

.construction-input-table tr.is-dirty {
  background: rgba(184, 163, 122, 0.08);
}

.error-text {
  color: #a24444;
}

@media (max-width: 980px) {
  .installation-db-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

.construction-subtotal-row td {
  padding-top: 2px;
  border-bottom: none;
  background: transparent !important;
}

.construction-subtotal-value {
  display: grid;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  justify-items: end;
  text-align: right;
}

.construction-subtotal-value span {
  color: rgba(75, 68, 56, 0.82);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.construction-subtotal-value strong {
  display: block;
  color: #2e2a23;
  font-size: 1rem;
}

.field-label-help {
  position: relative;
  cursor: help;
}

.field-label-help::after {
  display: none;
}

.field-label-help::before {
  display: none;
}

.floating-help-bubble {
  position: absolute;
  z-index: 120;
  max-width: min(300px, calc(100vw - 24px));
  pointer-events: none;
}

.ai-assistant-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 140;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #242321, #4c4233);
  color: #f8f3e8;
  border: 1px solid rgba(184, 163, 122, 0.34);
  box-shadow: 0 18px 38px rgba(20, 18, 16, 0.22);
  cursor: pointer;
  font: inherit;
}

.ai-assistant-launcher span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #d6bf8f;
  color: #1e1a14;
  font-size: 0.78rem;
  font-weight: 900;
}

.ai-assistant-launcher strong {
  font-size: 0.82rem;
  letter-spacing: 0;
}

.ai-assistant-launcher:hover,
.ai-assistant-launcher:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(214, 191, 143, 0.62);
  outline: none;
}

.global-ai-panel {
  position: fixed;
  right: 22px;
  bottom: 84px;
  z-index: 145;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 112px));
  overflow: auto;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(88, 88, 88, 0.14);
  box-shadow: 0 24px 70px rgba(20, 18, 16, 0.2);
  backdrop-filter: blur(18px);
}

.global-ai-panel[hidden] {
  display: none;
}

.global-ai-panel__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.global-ai-panel__header h2 {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.global-ai-panel__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(88, 88, 88, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: #2d2d2d;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.global-ai-panel__hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.global-ai-panel__prompt {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
}

.global-ai-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.floating-help-bubble[hidden] {
  display: none;
}

.floating-help-bubble__content {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(28, 26, 23, 0.96);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 16px 28px rgba(20, 18, 16, 0.18);
}

.compact-field {
  gap: 6px !important;
}

.comparison-lab .compact-field {
  position: relative;
}

.compact-field .field-label {
  font-size: 0.82rem;
}

.comparison-lab .compact-field .field-label {
  color: rgba(75, 68, 56, 0.92);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.comparison-lab input,
.comparison-lab select,
.comparison-lab textarea {
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(140, 129, 103, 0.2);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.comparison-lab input:focus,
.comparison-lab select:focus,
.comparison-lab textarea:focus {
  border-color: rgba(184, 163, 122, 0.58);
  box-shadow: 0 0 0 3px rgba(184, 163, 122, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transform: translateY(-1px);
  outline: none;
}

.comparison-lab input::placeholder,
.comparison-lab textarea::placeholder {
  color: rgba(108, 102, 90, 0.52);
}

.formatted-preview {
  min-height: 16px;
  color: var(--muted);
  font-size: 0.78rem;
}

.comparison-lab .formatted-preview {
  min-height: 18px;
  padding-left: 2px;
  color: rgba(114, 102, 79, 0.9);
  font-size: 0.74rem;
}

.comparison-lab input.is-empty,
.comparison-lab textarea.is-empty,
.comparison-lab select.is-empty {
  border-color: rgba(170, 34, 34, 0.42);
  background: rgba(255, 244, 244, 0.96);
  box-shadow: inset 0 0 0 1px rgba(170, 34, 34, 0.08);
}

.comparison-lab input[readonly][data-derived-field="true"] {
  background: rgba(184, 163, 122, 0.1);
  border-color: rgba(184, 163, 122, 0.24);
  color: #54472f;
  font-weight: 700;
}

.comparison-lab .comparable-result-field input[readonly][data-derived-field="true"] {
  background: linear-gradient(180deg, rgba(184, 163, 122, 0.18), rgba(184, 163, 122, 0.1));
  border-color: rgba(184, 163, 122, 0.32);
  color: #3f3524;
}

.comparison-lab input[readonly][data-derived-field="true"].is-empty {
  border-color: rgba(184, 163, 122, 0.24);
  background: rgba(184, 163, 122, 0.08);
  box-shadow: none;
}

.report-form .compact-field input,
.report-form .compact-field select,
.report-form .compact-field textarea {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.94rem;
}

.report-form .compact-field textarea {
  min-height: 76px;
  resize: vertical;
}

.report-form textarea[name="Colindancia_Norte"],
.report-form textarea[name="Colindancia_Sur"],
.report-form textarea[name="Colindancia_Oriente"],
.report-form textarea[name="Colindancia_Poniente"],
.report-form-bound textarea[name="Colindancia_Norte"],
.report-form-bound textarea[name="Colindancia_Sur"],
.report-form-bound textarea[name="Colindancia_Oriente"],
.report-form-bound textarea[name="Colindancia_Poniente"] {
  min-height: 120px;
  line-height: 1.45;
  resize: vertical;
}

.compact-factor-field .field-label {
  display: flex;
  width: 100%;
  min-width: 0;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  justify-content: center;
  align-items: flex-start;
  line-height: 1.1;
}

.comparison-lab .compact-factor-field input {
  text-align: center;
}

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

.cost-breakdown-card {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(184, 163, 122, 0.2);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 244, 236, 0.9));
}

.cost-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(184, 163, 122, 0.14);
}

.cost-breakdown-row strong {
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--ink);
}

.cost-breakdown-total {
  margin-top: 6px;
  border-bottom: 0;
  background: rgba(43, 40, 34, 0.96);
}

.cost-breakdown-total .field-label,
.cost-breakdown-total strong {
  color: #fffaf0;
}

input[name="Latitud_Longitud"],
input[data-source-field="Latitud_Longitud"] {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.comparable-summary-field {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(88, 88, 88, 0.1);
}

.comparable-result-field {
  background: rgba(184, 163, 122, 0.08);
  border-radius: 14px;
  padding: 8px;
  min-width: 0;
  overflow: hidden;
}

.comparable-result-field .field-label {
  display: flex;
  width: 100%;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
  font-size: 0.7rem !important;
}

.comparable-result-field input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.comparable-computed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(184, 163, 122, 0.14);
}

.computed-chip {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(88, 88, 88, 0.08);
}

.comparison-lab .computed-chip {
  min-height: 78px;
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(184, 163, 122, 0.14);
}

.computed-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.computed-chip strong {
  display: block;
  font-size: 0.96rem;
}

.computed-chip-highlight {
  background: rgba(184, 163, 122, 0.14);
  border-color: rgba(184, 163, 122, 0.22);
}

.detail-comparables-shell {
  margin-top: 16px;
}

.detail-comparables-summary {
  margin-top: 14px;
}

.comparable-summary-field strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.report-form label {
  display: grid;
  gap: 10px;
}

.report-form-bound label {
  display: grid;
  gap: 10px;
}

.report-control-grid {
  grid-template-columns: minmax(220px, 320px) minmax(280px, 1fr);
  align-items: start;
  column-gap: 18px;
}

.report-control-field {
  align-self: stretch;
  grid-template-rows: auto minmax(46px, auto) auto;
}

.report-control-field select {
  min-height: 46px;
}

.report-control-help {
  display: block;
  min-height: 18px;
  margin-top: 2px;
  line-height: 1.35;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.checkbox-custom-inline {
  margin-top: -2px;
}

.checkbox-custom-inline input {
  min-height: 46px;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.72);
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  cursor: pointer;
}

.checkbox-option input {
  width: 16px;
  height: 16px;
  accent-color: #3b3b3b;
}

.checkbox-option span {
  font-size: 0.92rem;
  font-weight: 600;
}

.map-shell {
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(88, 88, 88, 0.12);
}

.map-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.map-toolbar h3 {
  margin: 8px 0 0;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.map-status {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(88, 88, 88, 0.12);
  color: var(--muted);
}

.map-status[data-state="error"] {
  color: #8c2d2d;
  border-color: rgba(140, 45, 45, 0.2);
  background: rgba(255, 244, 244, 0.95);
}

.avaluo-map {
  margin-top: 16px;
  width: 100%;
  height: 420px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(88, 88, 88, 0.12);
  background: linear-gradient(180deg, #f0efec, #e5e2db);
}

.dashboard-map {
  margin-top: 18px;
  width: 100%;
  height: 460px;
  border-radius: 26px;
  overflow: hidden;
  border: 1px solid rgba(88, 88, 88, 0.12);
  background: linear-gradient(180deg, #f0efec, #e5e2db);
}

.map-card {
  min-width: 220px;
  padding: 4px 2px;
  color: #232323;
}

.map-card strong {
  display: block;
  margin-bottom: 8px;
}

.map-card p {
  margin: 0 0 8px;
  color: #666666;
  line-height: 1.45;
}

.map-card a {
  color: #6f6246;
  font-weight: 700;
}

.form-section {
  padding: 24px;
  margin-bottom: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 88, 88, 0.1);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  min-width: 0;
  max-width: 100%;
}

.section-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px 34px;
  align-items: center;
  gap: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.section-toggle:hover,
.section-toggle:focus {
  transform: none;
  box-shadow: none;
}

.section-toggle-copy {
  min-width: 0;
}

.section-toggle::after {
  content: "";
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(120, 120, 120, 0.18);
  background: rgba(255, 255, 255, 0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23595959' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") center / 16px no-repeat;
  flex-shrink: 0;
  transition: transform 0.22s ease, background-color 0.16s ease;
}

.form-section.is-open .section-toggle::after,
.panel.is-open .section-toggle::after {
  transform: rotate(180deg);
  background-color: rgba(255, 255, 255, 0.92);
}

.form-section-body {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(88, 88, 88, 0.08);
  min-width: 0;
  max-width: 100%;
}

.form-section.is-collapsed .form-section-body {
  display: none;
}

.panel.is-collapsed .form-section-body {
  display: none;
}

.section-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 136px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(120, 120, 120, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: #565656;
  flex-shrink: 0;
}

.section-status-pill[data-state="missing"] {
  background: rgba(170, 34, 34, 0.08);
  border-color: rgba(170, 34, 34, 0.22);
  color: #a12a2a;
  font-size: 0.92rem;
  font-weight: 800;
}

.section-status-pill[data-state="complete"] {
  background: rgba(48, 103, 72, 0.08);
  border-color: rgba(48, 103, 72, 0.18);
  color: #2f684c;
}

.section-status-pill[data-state="complete"]::before {
  content: "✓";
  margin-right: 5px;
  font-size: 0.9em;
}

.form-section.missing-required {
  border-color: rgba(170, 34, 34, 0.18);
  box-shadow: 0 18px 36px rgba(170, 34, 34, 0.06);
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading .eyebrow {
  display: inline-block;
}

.section-heading h2 {
  margin: 8px 0 0;
  font-size: 1.35rem;
}

@media (max-width: 1080px) {
  .comparison-subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .comparable-photo-field {
    grid-column: span 2;
  }

  .comparable-factors-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

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

@media (max-width: 720px) {
  .comparison-subject-grid,
  .comparable-card-grid,
  .comparable-factors-grid,
  .comparables-summary-grid,
  .comparable-computed-grid {
    grid-template-columns: 1fr;
  }

  .comparable-photo-field {
    grid-column: auto;
  }

  .comparable-photo-shell {
    grid-template-columns: 1fr;
  }

  .comparable-photo-preview {
    width: 100%;
    max-width: 220px;
  }

  .comparable-factors-grid .compact-factor-field {
    display: grid;
    align-content: start;
    justify-items: stretch;
  }

  .comparable-factors-grid .compact-factor-field .field-label {
    min-height: 32px;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .comparable-factors-grid .compact-factor-field input {
    text-align: center;
  }
}

.report-form span {
  font-size: 0.95rem;
  font-weight: 700;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.required-mark {
  color: #a12a2a;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.full-width {
  grid-column: 1 / -1;
}

.upload-field {
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(85, 85, 85, 0.05), rgba(184, 163, 122, 0.08));
  border: 1px dashed rgba(93, 93, 93, 0.24);
}

.upload-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.upload-field small {
  color: var(--muted);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.preview-card {
  overflow: hidden;
  border-radius: 18px;
  background: white;
  border: 1px solid rgba(88, 88, 88, 0.14);
}

.existing-images-topline {
  margin: 8px 0 14px;
}

.preview-card img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.preview-meta {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.preview-meta strong,
.preview-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.existing-image-card {
  display: grid;
  grid-template-rows: auto auto auto;
}

.existing-image-card.is-cover-selected {
  border-color: rgba(191, 152, 58, 0.38);
  background: linear-gradient(180deg, rgba(255, 250, 226, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow: 0 14px 30px rgba(191, 152, 58, 0.12);
}

.existing-image-card.is-cover-selected img {
  box-shadow: inset 0 0 0 2px rgba(191, 152, 58, 0.22);
}

.existing-image-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 12px 12px;
}

.existing-image-actions form {
  margin: 0;
}

.inline-upload-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: -4px;
  margin-bottom: 8px;
}

.inline-upload-actions small {
  color: var(--muted);
}

.review-checkbox-row {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(88, 88, 88, 0.12);
}

.cover-state {
  color: var(--accent);
  font-weight: 700;
}

.button.is-static {
  pointer-events: none;
  opacity: 0.85;
}

.upload-empty {
  padding: 24px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px dashed rgba(88, 88, 88, 0.16);
  color: var(--muted);
  text-align: center;
}

.form-shell {
  position: relative;
}

.global-field-search {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 80;
}

.field-search-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(88, 88, 88, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #2f2f2f;
  cursor: pointer;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 14px 32px rgba(16, 16, 16, 0.1);
}

.field-search-toggle:hover,
.global-field-search.is-open .field-search-toggle {
  border-color: rgba(184, 163, 122, 0.42);
  background: #fffaf0;
}

.field-search-panel {
  position: absolute;
  top: 50px;
  right: 0;
  width: min(420px, calc(100vw - 46px));
  padding: 12px;
  border: 1px solid rgba(184, 163, 122, 0.22);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 54px rgba(16, 16, 16, 0.16);
}

.field-search-panel label {
  display: grid;
  gap: 7px;
}

.field-search-panel label span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field-search-panel input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  font: inherit;
}

.field-search-results {
  display: grid;
  gap: 7px;
  max-height: 340px;
  margin-top: 10px;
  overflow: auto;
}

.field-search-result {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(88, 88, 88, 0.08);
  border-radius: 14px;
  background: rgba(247, 242, 233, 0.55);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.field-search-result:hover {
  border-color: rgba(184, 163, 122, 0.28);
  background: rgba(255, 250, 240, 0.94);
}

.field-search-result strong {
  font-size: 0.9rem;
}

.field-search-result span,
.field-search-empty {
  color: var(--muted);
  font-size: 0.76rem;
}

.field-search-empty {
  margin: 0;
  padding: 8px 2px 2px;
}

.field-search-hit {
  border-radius: 18px;
  outline: 3px solid rgba(184, 163, 122, 0.28);
  outline-offset: 5px;
}

.submit-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(249, 246, 239, 0.76);
  backdrop-filter: blur(3px);
  border-radius: 28px;
}

.submit-overlay[hidden] {
  display: none;
}

.submit-overlay-card {
  max-width: 420px;
  width: 100%;
  padding: 24px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(88, 88, 88, 0.12);
  box-shadow: 0 20px 40px rgba(20, 20, 20, 0.08);
  text-align: center;
}

.submit-overlay-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.submit-overlay-card p {
  margin: 0;
  color: var(--muted);
}

.submit-progress {
  width: 100%;
  height: 10px;
  margin-top: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(31, 31, 31, 0.08);
}

.submit-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b79c6a, #d6bf8f);
  transition: width 120ms ease-out;
}

.submit-progress-label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}

.detail-grid {
  grid-template-columns: 1.1fr 0.9fr;
  margin-top: 24px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: center;
}

.detail-hero-main h2 {
  margin: 14px 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.detail-chip-grid {
  display: grid;
  gap: 14px;
}

.detail-chip {
  padding: 18px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--line);
}

.detail-chip span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.detail-chip strong {
  font-size: 1.05rem;
}

.appraiser-panel {
  display: grid;
  gap: 20px;
}

.appraiser-form {
  display: grid;
  gap: 18px;
}

.appraiser-field-row,
.appraiser-upload-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.appraiser-upload-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.appraiser-form label:not(.upload-field) {
  display: grid;
  gap: 8px;
}

.appraiser-form input[type="text"],
.appraiser-form input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px 16px;
  font: inherit;
}

.appraiser-form input[type="file"] {
  padding: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.appraiser-form input:focus {
  outline: none;
  border-color: rgba(184, 163, 122, 0.52);
  box-shadow: 0 0 0 3px rgba(184, 163, 122, 0.14);
}

.appraiser-editor-list {
  display: grid;
  gap: 18px;
}

.appraiser-editor-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.appraiser-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.appraiser-card-heading h3 {
  margin: 4px 0 0;
}

.appraiser-card-actions {
  margin-top: 0;
}

.upload-topline a {
  color: #5d4b2d;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cadastral-form {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.cadastral-summary-grid,
.cadastral-check-grid {
  display: grid;
  gap: 14px;
}

.cadastral-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 18px;
}

.cadastral-check-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.cadastral-check-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(88, 88, 88, 0.1);
  background: rgba(255, 255, 255, 0.74);
}

.cadastral-check-card.match {
  border-color: rgba(48, 103, 72, 0.18);
  background: rgba(244, 249, 245, 0.92);
}

.cadastral-check-card.mismatch {
  border-color: rgba(170, 118, 39, 0.24);
  background: rgba(255, 248, 239, 0.94);
}

.cadastral-check-card.missing {
  border-color: rgba(170, 34, 34, 0.18);
  background: rgba(255, 245, 245, 0.94);
}

.cadastral-check-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cadastral-check-card p {
  margin: 0 0 8px;
  color: var(--muted);
}

.cadastral-apply-form {
  margin-top: 12px;
}

.edit-sidecar {
  margin-bottom: 20px;
}

#cadastral-check,
#registry-check {
  scroll-margin-top: 24px;
}

.verification-pending .section-toggle {
  border-color: rgba(168, 76, 76, 0.2);
  background: linear-gradient(180deg, rgba(255, 242, 242, 0.94), rgba(255, 255, 255, 0.94));
}

.verification-complete .section-toggle {
  border-color: rgba(76, 136, 92, 0.2);
  background: linear-gradient(180deg, rgba(241, 250, 243, 0.94), rgba(255, 255, 255, 0.94));
}

.verification-pending .section-status-pill[data-state="missing"] {
  background: rgba(168, 76, 76, 0.12);
  color: #8c3535;
  border-color: rgba(168, 76, 76, 0.16);
}

.verification-complete .section-status-pill[data-state="complete"] {
  background: rgba(84, 140, 95, 0.12);
  color: #2f6a3b;
  border-color: rgba(84, 140, 95, 0.18);
}

.form-section.is-complete .section-status-pill[data-state="complete"] {
  background: rgba(84, 140, 95, 0.12);
  color: #2f6a3b;
  border-color: rgba(84, 140, 95, 0.18);
}

.verification-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 18px;
}

.verification-source span {
  color: var(--muted);
  font-size: 0.95rem;
}

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

.send-card {
  padding: 22px;
}

.send-card h3 {
  margin: 8px 0 12px;
}

.send-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.compact-empty {
  padding: 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 88, 88, 0.1);
}

.intake-note {
  margin: 14px 0 0;
  color: var(--muted);
}

.detail-section + .detail-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.detail-section .section-heading {
  margin-bottom: 16px;
}

.gallery {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gallery-card {
  margin: 0;
}

.gallery-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 12px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

@media (max-width: 1100px) {
  .page-shell {
    display: block;
  }

  .sidebar {
    width: auto;
    position: static;
    height: auto;
    padding: 14px 18px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow: visible;
  }

  .sidebar:hover,
  .sidebar:focus-within {
    width: auto;
    padding: 14px 18px;
  }

  .topbar {
    display: flex;
    align-items: center;
  }

  .brand {
    margin-bottom: 0;
    justify-content: flex-start;
    gap: 12px;
  }

  .brand-lockup {
    max-width: 160px;
    opacity: 1;
    overflow: visible;
    transform: translateX(0);
  }

  .nav-links {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
  }

  .nav-links a {
    justify-content: flex-start;
    white-space: nowrap;
    width: auto;
    flex: 0 0 auto;
  }

  .nav-dropdown {
    width: auto;
    flex: 0 0 auto;
  }

  .nav-dropdown summary {
    justify-content: flex-start;
    white-space: nowrap;
    width: auto;
  }

  .nav-dropdown-menu {
    top: calc(100% + 10px);
    left: 0;
    right: auto;
    min-width: 280px;
    max-width: none;
  }

  .nav-link-full {
    max-width: 160px;
    opacity: 1;
    overflow: visible;
    transform: translateX(0);
  }

  .nav-link-mini {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .hero,
  .detail-grid,
  .detail-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .content {
    padding: 18px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
  }

  .brand {
    justify-content: flex-start;
  }

  .nav-links {
    padding-bottom: 0;
  }

  .topbar-stat {
    display: none;
  }

  .panel,
  .hero,
  .form-shell {
    padding: 20px;
  }

  .form-grid,
  .map-grid,
  .search-bar,
  .page-heading,
  .hero-actions,
  .detail-actions,
  .form-actions,
  .panel-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .map-toolbar,
  .map-actions,
  .hero-actions-main {
    display: grid;
  }

  .comparison-lab-shell,
  .comparison-lab,
  .construction-cost-lab-shell,
  .construction-cost-lab {
    gap: 14px;
  }

  .comparison-subject-grid,
  .comparables-summary-grid {
    grid-template-columns: 1fr;
  }

  .construction-table-actions,
  .installation-db-toolbar,
  .installation-db-meta {
    display: grid;
    gap: 10px;
    align-items: stretch;
  }

  .installation-db-form-grid {
    grid-template-columns: 1fr;
  }

  .appraiser-field-row,
  .appraiser-upload-row {
    grid-template-columns: 1fr;
  }

  .table-wrapper,
  .construction-table-shell {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .construction-input-table {
    min-width: 920px;
  }

  .construction-input-table thead th,
  .construction-input-table tbody td {
    padding-left: 6px;
    padding-right: 6px;
  }

  .construction-input-table input,
  .construction-input-table select,
  .construction-input-table textarea {
    font-size: 0.86rem;
  }

  .table-input-with-trigger input:focus,
  .table-input-with-trigger--wide input:focus,
  .table-input-with-trigger--type input:focus {
    min-width: 100%;
  }
}

/* ── Questionnaire visual improvements ─────────────────────────────── */

/* Step eyebrow as pill badge */
.section-toggle-copy .eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(184, 163, 122, 0.1);
  border: 1px solid rgba(184, 163, 122, 0.22);
  color: #5e4f35;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}

/* Section title in toggle */
.section-toggle-copy h2 {
  margin: 2px 0 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

/* Open section: accent border + shadow */
.form-section.is-open {
  border-color: rgba(184, 163, 122, 0.26);
  box-shadow: 0 8px 32px rgba(16, 16, 16, 0.07);
}

/* Complete section: subtle green tint */
.form-section.is-complete {
  border-color: rgba(48, 103, 72, 0.16);
  background: linear-gradient(180deg, rgba(245, 251, 247, 0.82), rgba(255, 255, 255, 0.72));
}

/* Separator between toggle and body */
.form-section.is-open .form-section-body,
.form-section.is-complete .form-section-body {
  border-top-color: rgba(88, 88, 88, 0.06);
}

/* Refined field labels */
.report-form .field-label,
.report-form-bound .field-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #3e3e3e;
}

/* Custom select arrow */
.report-form select,
.report-form-bound select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23686868' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 42px;
}

/* Checkbox checked visual state */
.checkbox-option {
  transition: border-color 0.15s ease, background 0.15s ease;
}

.checkbox-option:hover {
  border-color: rgba(184, 163, 122, 0.3);
  background: rgba(255, 255, 255, 0.98);
}

.checkbox-option:has(input:checked) {
  border-color: rgba(184, 163, 122, 0.38);
  background: linear-gradient(180deg, rgba(255, 253, 245, 0.96), rgba(255, 255, 255, 0.92));
}

.url-field {
  position: relative;
}

.url-field input[type="url"] {
  padding-right: 88px;
}

.url-open-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(88, 88, 88, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.url-open-button:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(184, 163, 122, 0.34);
  transform: translateY(-1px);
}

/* Service check ticked state */
.service-check {
  transition: border-color 0.15s ease, background 0.15s ease;
}

.service-check:has(input:checked) {
  border-color: rgba(48, 103, 72, 0.3);
  background: rgba(240, 249, 244, 0.95);
}

/* Slightly tighter gap for form labels */
.report-form label,
.report-form-bound label {
  gap: 8px;
}

@media (max-width: 760px) {
  .report-control-grid {
    grid-template-columns: 1fr;
  }
}

/* Form grid row gap */
.form-grid {
  row-gap: 16px;
}

/* ── Terreno section ────────────────────────────────── */
.terreno-layout {
  display: grid;
  gap: 20px;
}

.terreno-group {
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(247,242,233,0.74));
  border: 1px solid rgba(184,163,122,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  border-radius: 20px;
  padding: 18px 20px 20px;
}

.terreno-group-title {
  margin: 0 0 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.terreno-dims-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 8px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(184,163,122,0.14);
  border-radius: 14px;
  padding: 14px 16px;
}

.metric-input-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.metric-input-row input {
  flex: 1;
  min-width: 0;
  border-radius: 10px 0 0 10px !important;
  border-right: none !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  text-align: right;
  padding: 10px 12px !important;
}

.metric-unit {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 44px;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: var(--muted);
  background: rgba(184,163,122,0.12);
  border: 1px solid rgba(184,163,122,0.22);
  border-left: none;
  border-radius: 0 10px 10px 0;
  white-space: nowrap;
}

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

.pill-field {
  display: grid;
  gap: 10px;
}

.compact-choice-field {
  gap: 7px !important;
}

.compact-choice-field input {
  min-height: 44px;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-option {
  display: contents;
}

.pill-option input[type="radio"] {
  display: none;
}

.pill-option span {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 100px;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  background: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(184,163,122,0.25);
  color: var(--text);
  transition: background 120ms, border-color 120ms, color 120ms;
  white-space: nowrap;
}

.pill-option input[type="radio"]:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pill-option span:hover {
  border-color: var(--accent);
  background: rgba(184,163,122,0.12);
}

.pill-custom-trigger {
  align-self: start;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: 0.02em;
}

.pill-custom-trigger:hover {
  opacity: 0.75;
}

.pill-custom-input {
  font-size: 0.88rem !important;
  padding: 8px 12px !important;
  border-radius: 10px !important;
}

@media (max-width: 700px) {
  .terreno-dims-grid,
  .terreno-chars-grid,
  .form-grid-construccion {
    grid-template-columns: 1fr;
  }
}

/* Ensure comparison lab select keeps correct padding for custom arrow */
.comparison-lab select {
  padding-right: 38px;
}

/* ── IA Generation Section ─────────────────────────────────────────────────── */
.ia-generate-section {
  display: grid;
  gap: 14px;
  margin-bottom: 4px;
}

.ia-generate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(30, 30, 30, 0.96), rgba(50, 42, 30, 0.96));
  border-radius: 18px;
  border: 1px solid rgba(184, 163, 122, 0.22);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  flex-wrap: wrap;
  gap: 16px;
}

.ia-generate-copy {
  display: grid;
  gap: 4px;
}

.ia-generate-copy .eyebrow {
  color: var(--accent);
}

.ia-generate-copy p {
  margin: 0;
  color: rgba(240, 236, 226, 0.75);
  font-size: 0.84rem;
  line-height: 1.5;
}

.ia-generate-btn {
  background: linear-gradient(135deg, #b8a37a, #d6bf8f) !important;
  color: #1a1510 !important;
  font-weight: 800 !important;
  border: none !important;
  padding: 12px 22px !important;
  border-radius: 14px !important;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 160ms, transform 100ms;
}

.ia-generate-btn:disabled {
  opacity: 0.6;
}

.ia-generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ia-generate-status {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.ia-assistant-panel {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(88, 88, 88, 0.12);
}

.ia-assistant-copy {
  display: grid;
  gap: 4px;
}

.ia-assistant-bubble {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(28, 26, 23, 0.96), rgba(48, 42, 35, 0.96));
  color: #f7f3ea;
  border: 1px solid rgba(184, 163, 122, 0.22);
  box-shadow: 0 14px 28px rgba(20, 18, 16, 0.12);
}

.ia-assistant-bubble strong {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d8c49a;
}

.ia-assistant-bubble p {
  margin: 0;
  color: rgba(247, 243, 234, 0.88);
  font-size: 0.84rem;
  line-height: 1.45;
}

.ia-assistant-help {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  padding: 0;
  border: 1px solid rgba(184, 163, 122, 0.4);
  border-radius: 999px;
  background: rgba(184, 163, 122, 0.12);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.ia-assistant-help:hover,
.ia-assistant-help:focus-visible {
  background: rgba(184, 163, 122, 0.2);
  border-color: rgba(184, 163, 122, 0.58);
  outline: none;
}

.ia-assistant-copy p,
.ia-assistant-results p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ia-assistant-prompt textarea {
  min-height: 112px;
}

.ia-assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.ia-assistant-results {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.ia-assistant-result-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(250, 249, 247, 0.94);
  border: 1px solid rgba(88, 88, 88, 0.1);
}

.ia-assistant-result-card strong {
  display: block;
  margin-bottom: 4px;
}

.ia-assistant-result-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.ia-status-loading {
  background: rgba(184, 163, 122, 0.1);
  color: var(--muted);
  border: 1px solid rgba(184, 163, 122, 0.2);
}

.ia-status-ok {
  background: rgba(48, 103, 72, 0.08);
  color: #2a6840;
  border: 1px solid rgba(48, 103, 72, 0.2);
}

.ia-status-error {
  background: rgba(161, 42, 42, 0.07);
  color: #9a2222;
  border: 1px solid rgba(161, 42, 42, 0.18);
}

.ia-locked-notice {
  padding: 16px 20px;
  background: rgba(184, 163, 122, 0.07);
  border: 1px dashed rgba(184, 163, 122, 0.3);
  border-radius: 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.ia-locked-notice strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

/* ── Comparables Search Bar ─────────────────────────────────────────────────── */
.comparables-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(184, 163, 122, 0.2);
  border-radius: 18px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.comparables-search-copy .eyebrow {
  display: block;
  margin-bottom: 2px;
}

.comparables-search-copy p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.comparables-search-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.comparables-search-results {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 242, 233, 0.82));
  border: 1px solid rgba(184, 163, 122, 0.2);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 4px;
}

.comparables-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.comparables-results-header span {
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.comparables-apply-btn {
  font-size: 0.84rem !important;
  padding: 8px 16px !important;
  border-radius: 12px !important;
}

.comparables-results-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.comparable-result-card {
  display: flex;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(184, 163, 122, 0.15);
  border-radius: 14px;
  align-items: flex-start;
}

.comparable-result-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.comparable-result-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.comparable-result-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comparable-result-loc {
  font-size: 0.78rem;
  color: var(--muted);
}

.comparable-result-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.comparable-result-stats span {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  color: var(--accent);
  background: rgba(184, 163, 122, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.comparable-result-link {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: underline;
}

.comparables-results-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

.comparables-search-error {
  padding: 10px 14px;
  background: rgba(161, 42, 42, 0.07);
  color: #9a2222;
  border: 1px solid rgba(161, 42, 42, 0.18);
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.comparables-ai-warning {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(184, 120, 30, 0.09);
  color: #7a4f10;
  border: 1px solid rgba(184, 120, 30, 0.28);
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.comparables-ai-warning code {
  background: rgba(184, 120, 30, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.78rem;
}

.comparables-applied-notice {
  margin-top: 10px;
  padding: 8px 14px;
  background: rgba(48, 103, 72, 0.08);
  color: #2a6840;
  border: 1px solid rgba(48, 103, 72, 0.2);
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════
   REDISEÑO GENERAL — componentes modernos
   ═══════════════════════════════════════════════════════════════ */

/* ── Status badges con color por estado ──────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  gap: 5px;
}

.badge-validado, .badge-Validado {
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.22);
}

.badge-enviado, .badge-Enviado {
  background: rgba(37, 99, 235, 0.1);
  color: #1e40af;
  border-color: rgba(37, 99, 235, 0.2);
}

.badge-borrador, .badge-Borrador {
  background: rgba(88, 88, 88, 0.08);
  color: #52525b;
  border-color: rgba(88, 88, 88, 0.14);
}

.badge-cliente, .badge-Cliente {
  background: rgba(184, 163, 122, 0.14);
  color: #7c6132;
  border-color: rgba(184, 163, 122, 0.26);
}

/* ── KPI / stat cards modernos ──────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  padding: 20px 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(88, 88, 88, 0.09);
  box-shadow: 0 1px 6px rgba(16, 16, 16, 0.04);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.kpi-card:hover {
  box-shadow: 0 6px 20px rgba(16, 16, 16, 0.08);
  transform: translateY(-1px);
}

.kpi-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  display: block;
}

.kpi-value {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  display: block;
}

.kpi-card.kpi-dark {
  background: linear-gradient(135deg, #222120, #171614);
  border-color: transparent;
  box-shadow: 0 8px 28px rgba(16, 16, 16, 0.18);
}

.kpi-card.kpi-dark .kpi-label { color: rgba(255,255,255,0.48); }
.kpi-card.kpi-dark .kpi-value { color: rgba(255,255,255,0.96); }

/* ── Reports table (vista lista) ────────────────────────────── */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.list-toolbar .search-bar {
  flex: 1;
  min-width: 240px;
  margin: 0;
}

.list-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.reports-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
}

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

.reports-table thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: rgba(248, 246, 242, 0.9);
}

.reports-table thead th:first-child { border-radius: 16px 0 0 0; }
.reports-table thead th:last-child  { border-radius: 0 16px 0 0; }

.reports-table tbody tr {
  cursor: pointer;
  transition: background 0.11s;
}

.reports-table tbody tr:hover {
  background: rgba(184, 163, 122, 0.06);
}

.reports-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(88,88,88,0.06);
  vertical-align: middle;
}

.reports-table tbody tr:last-child td {
  border-bottom: none;
}

.folio-chip {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: #5e4f35;
  background: rgba(184, 163, 122, 0.1);
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(184, 163, 122, 0.18);
  white-space: nowrap;
}

.td-client strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.td-client small {
  display: block;
  font-size: 0.77rem;
  color: var(--muted);
  margin-top: 1px;
}

.td-value {
  font-weight: 800;
  font-size: 0.88rem;
  white-space: nowrap;
}

.row-actions-cell {
  text-align: right;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.14s;
}

.reports-table tbody tr:hover .row-actions {
  opacity: 1;
}

.row-actions .button {
  padding: 7px 13px;
  font-size: 0.78rem;
}

/* ── Page heading moderno ───────────────────────────────────── */
.page-heading {
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.page-heading h1 {
  margin: 4px 0 0;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.page-heading .eyebrow {
  display: block;
  margin-bottom: 2px;
}

/* ── Panel mejorado ─────────────────────────────────────────── */
.panel {
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  margin-top: 20px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 4px 0 0;
  font-size: 1.1rem;
  font-weight: 800;
}

/* ── Recent activity table (home) ───────────────────────────── */
.activity-table {
  width: 100%;
  border-collapse: collapse;
}

.activity-table thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.activity-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(88,88,88,0.06);
  font-size: 0.88rem;
  vertical-align: middle;
}

.activity-table tbody tr:last-child td { border-bottom: none; }
.activity-table tbody tr { cursor: pointer; transition: background 0.1s; }
.activity-table tbody tr:hover { background: rgba(63,63,63,0.04); }

.nav-section-label {
  display: block;
  padding: 16px 10px 6px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(236, 233, 225, 0.24);
  user-select: none;
  transition: opacity 0.18s ease, max-height 0.18s ease, padding 0.18s ease;
}

.sidebar:hover .nav-section-label,
.sidebar:focus-within .nav-section-label {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar:hover .nav-section-label:first-of-type,
.sidebar:focus-within .nav-section-label:first-of-type {
  border-top: none;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .row-actions { opacity: 1; }
}

@media (max-width: 760px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .reports-table thead { display: none; }
  .reports-table tbody td { display: block; padding: 6px 14px; border-bottom: none; }
  .reports-table tbody tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 0; }
  .row-actions { opacity: 1; }
  .page-heading { flex-direction: column; align-items: flex-start; }
}
