/* Radar SLE — Design Editorial Claro, Limpo e Responsivo */

:root {
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --surface-subtle: #F8FAFC;
  --surface-muted: #F1F5F9;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;

  --brand: #0F3D73;
  --brand-hover: #0B2E58;
  --brand-soft: #EFF6FF;
  --brand-border: #BFDBFE;

  --green: #047857;
  --green-bg: #ECFDF5;
  --green-border: #A7F3D0;

  --amber: #B45309;
  --amber-bg: #FFFBEB;
  --amber-border: #FDE68A;

  --slate-bg: #F1F5F9;
  --slate-ink: #475569;

  --red: #B91C1C;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 22px 50px rgba(15, 23, 42, 0.22);

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header & KPIs ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 0 20px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.brand-mark {
  display: flex;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 0.86rem;
  color: var(--ink-3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 600;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(15, 61, 115, 0.25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.kpi-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.kpi-accent-green { color: var(--green); }
.kpi-accent-blue { color: var(--brand); }
.kpi-accent-amber { color: var(--amber); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: var(--ink-3);
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--brand-soft);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.8rem;
}

/* ---------- Main Content & Search Hero ---------- */
.main-content {
  padding-top: 22px;
  padding-bottom: 48px;
}

.search-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 15px;
  width: 20px;
  height: 20px;
  color: var(--ink-3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 13px 78px 13px 46px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface-subtle);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.search-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 61, 115, 0.12);
}

.search-clear {
  position: absolute;
  right: 44px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--surface-muted);
  color: var(--ink-2);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.search-clear:hover {
  background: var(--border-strong);
}

.kbd-hint {
  position: absolute;
  right: 12px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  pointer-events: none;
}

.quick-chips {
  margin-top: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-chips-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
  margin-right: 4px;
}

.quick-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.quick-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.quick-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

/* ---------- Categories Strip ---------- */
.categories-section {
  margin-top: 16px;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.14s ease;
}

.cat-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.cat-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-chip.active .cat-dot {
  background: #FFFFFF !important;
}

.cat-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-3);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cat-chip.active .cat-count {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

/* ---------- Filters Bar ---------- */
.filters-bar {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.filters-grid {
  display: grid;
  grid-template-columns: 120px minmax(220px, 1.5fr) 175px 150px 210px;
  gap: 10px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field > span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.filter-field select,
.filter-field input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.85rem;
}

.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
}

.filters-toggles-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toggles-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
}

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

.toggle-ui {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background-color 0.16s ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s ease;
}

.toggle-pill input:checked + .toggle-ui {
  background: var(--brand);
}

.toggle-pill input:checked + .toggle-ui::after {
  transform: translateX(16px);
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-summary {
  font-size: 0.84rem;
  color: var(--ink-3);
  font-weight: 600;
}

/* ---------- Cards Grid ---------- */
.lotes-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.lote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.lote-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-border);
}

/* Card Media */
.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-muted);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

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

.illus-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.media-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
}

.media-badge-real {
  background: rgba(15, 23, 42, 0.78);
  color: #FFFFFF;
}

.media-badge-illus {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-2);
  border: 1px solid var(--border);
}

.card-thumbs {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
}

.card-thumb-btn {
  width: 38px;
  height: 28px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  background: #0F172A;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.card-thumb-btn.active {
  border-color: #38BDF8;
  transform: scale(1.04);
}

.card-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Card Body */
.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 11px;
}

.card-top-tags {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-cat {
  background: var(--surface-muted);
  color: var(--ink-2);
}

.pill-pf {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.pill-pj {
  background: var(--slate-bg);
  color: var(--slate-ink);
  border: 1px solid var(--border);
}

.pill-novo {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.pill-seminovo {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.pill-usado {
  background: var(--slate-bg);
  color: var(--slate-ink);
  border: 1px solid var(--border-strong);
}

.pill-origem {
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}

.pill-origem-est {
  background: var(--surface-muted);
  color: var(--ink-3);
  border: 1px dashed var(--border-strong);
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.32;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.64em;
}

.card-edital-line {
  font-size: 0.78rem;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* 3-Value Comparison Box */
.values-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.val-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.val-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-3);
}

.val-num {
  font-size: 0.92rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.val-num-min {
  color: var(--brand);
}

.val-num-mkt {
  color: var(--green);
}

.market-meta-row {
  padding-top: 7px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.market-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.discount-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.discount-great {
  background: var(--green-bg);
  color: var(--green);
}

.discount-ok {
  background: var(--brand-soft);
  color: var(--brand);
}

.discount-low {
  background: var(--red-bg);
  color: var(--red);
}

.diff-rfb-row {
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.76rem;
}

.diff-rfb-label {
  color: var(--ink-3);
  font-weight: 600;
}

.diff-rfb-val {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.diff-rfb-pos {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.diff-rfb-neg {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.diff-rfb-zero {
  background: var(--slate-bg);
  color: var(--slate-ink);
  border: 1px solid var(--border);
}

.modal-diff-banner {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Fee warning */
.fee-warning {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-size: 0.77rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Card Footer */
.card-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--ink-3);
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

/* ---------- Skeletons & Empty ---------- */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 410px;
}

.skeleton-shimmer {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.25s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 2.3rem;
  margin-bottom: 10px;
}

.empty-state h3 {
  margin: 0 0 6px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--ink-3);
}

/* ---------- Pagination ---------- */
.pagination {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.page-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 6px;
  color: var(--ink-3);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 0;
  font-size: 0.79rem;
  color: var(--ink-3);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(3px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-sheet {
  background: var(--surface);
  width: min(1040px, 100%);
  max-height: 92vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
}

.modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.modal-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.28;
}

.modal-subtitle {
  margin: 4px 0 0;
  font-size: 0.84rem;
  color: var(--ink-3);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--surface-muted);
}

.modal-body {
  padding: 20px 22px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-top-grid {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 20px;
  align-items: start;
}

/* Modal Carousel */
.carousel-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.carousel-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-stage.is-illus {
  background: var(--surface-subtle);
}

.carousel-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0F172A;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.72);
  color: #FFFFFF;
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-nav:hover { background: rgba(15, 23, 42, 0.92); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }

.carousel-fullscreen-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.78);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.carousel-fullscreen-btn:hover {
  background: rgba(15, 23, 42, 0.95);
}

.carousel-bar {
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.carousel-thumbs {
  display: flex;
  gap: 8px;
}

.carousel-thumb {
  width: 62px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-muted);
}

.carousel-thumb.active {
  border-color: var(--brand);
}

.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-note {
  font-size: 0.76rem;
  color: var(--ink-3);
}

/* Modal Pricing & Simulator */
.panel {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
}

.panel-title {
  margin: 0 0 11px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.modal-val-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.modal-val-card .val-num {
  font-size: 1.05rem;
}

.quote-justif {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.45;
}

.quote-refs {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quote-ref-link {
  font-size: 0.76rem;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 3px 8px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

.quote-ref-link:hover {
  text-decoration: underline;
}

.modal-actions-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Collapsible manual editor */
.manual-editor {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.manual-editor summary {
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand);
}

.manual-form {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.manual-form .full-span {
  grid-column: 1 / -1;
}

.manual-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-3);
}

.manual-form input,
.manual-form select,
.manual-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
}

/* Bid Simulator */
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.sim-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sim-input-row input[type="number"] {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sim-range {
  width: 100%;
  margin: 10px 0 8px;
  accent-color: var(--brand);
}

.sim-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sim-breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.84rem;
}

.sim-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-2);
}

.sim-line-total {
  padding-top: 7px;
  border-top: 1px solid var(--border);
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--ink);
}

.sim-result {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.84rem;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sim-result-good { background: var(--green-bg); color: var(--green); }
.sim-result-warn { background: var(--amber-bg); color: var(--amber); }
.sim-result-bad { background: var(--red-bg); color: var(--red); }

/* Edital metadata & items table */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.meta-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}

.meta-cell span {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-3);
}

.meta-cell strong {
  display: block;
  margin-top: 2px;
  font-size: 0.83rem;
  color: var(--ink);
}

.items-search {
  width: 240px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.item-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 42px 88px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 0.83rem;
}

.item-idx {
  font-weight: 800;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.item-qty {
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.item-desc {
  color: var(--ink);
  word-break: break-word;
}

.item-recinto {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--ink-3);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(2, 6, 23, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-stage {
  max-width: 92vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-stage img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-caption {
  color: #E2E8F0;
  font-size: 0.88rem;
  font-weight: 600;
}

.lightbox-btn {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(15, 23, 42, 0.72);
  color: #FFFFFF;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-btn:hover { background: rgba(255, 255, 255, 0.16); }
.lightbox-close { top: 18px; right: 22px; }
.lightbox-prev { left: 22px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 22px; top: 50%; transform: translateY(-50%); }

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--ink);
  color: #FFFFFF;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  max-width: 360px;
  animation: toastIn 0.18s ease-out;
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

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

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .lotes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .modal-top-grid,
  .sim-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .container { padding: 0 14px; }
  .lotes-grid { grid-template-columns: 1fr; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-grid { grid-template-columns: 1fr; }
  .manual-form { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 36px 76px 1fr; }
}
