:root {
  --primary: #15243A;
  --primary-dark: #0D1829;
  --accent: #D9A426;
  --accent-hover: #C28F1A;
  --bg: #F7F5EF;
  --card: #FFFFFF;
  --border: #E5E1D8;
  --text: #1B2430;
  --muted: #5F6B7A;
  --ok-bg: #EAF6EE;
  --ok-text: #1C6B3A;
  --warn-bg: #FEF6E4;
  --warn-text: #8C5E08;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.xsmall { font-size: 0.78rem; }
.center { text-align: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: 0.15s ease;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-gold { background: var(--accent); color: #1A160B; }
.btn-gold:hover:not(:disabled) { background: var(--accent-hover); }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); }
.btn-light { background: #F1EFE9; color: var(--text); }
.btn-light:hover { background: #E7E3D9; }
.btn-sm { padding: 6px 11px; font-size: 0.83rem; }
.btn-xs { padding: 4px 8px; font-size: 0.78rem; }
.btn-lg { padding: 12px 18px; font-size: 0.98rem; }
.btn-full { width: 100%; }
.btn-link { background: none; border: none; color: inherit; cursor: pointer; font-weight: 600; text-decoration: underline; font-size: 0.85rem; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Layout helpers */
.stack-xs { display: flex; flex-direction: column; gap: 6px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-md { display: flex; flex-direction: column; gap: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-tight { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3-tight { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--primary-dark), var(--primary));
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand h1 { margin: 0; font-size: 1.25rem; color: var(--primary); }
.login-brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.login-box { display: flex; flex-direction: column; gap: 12px; }
.info-pill {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid #F2D79B;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
}

/* Topbar */
.topbar {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 12px rgba(0,0,0,0.16);
}
.topbar-main {
  max-width: 1380px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--accent);
  color: #161209;
  font-weight: 800;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.brand-badge.lg { width: 48px; height: 48px; font-size: 1.15rem; }
.brand-logo-top { height: 34px; width: auto; object-fit: contain; display: block; }
.brand-logo-login { height: 42px; width: auto; object-fit: contain; display: block; }
.contract-logo { height: 44px; width: auto; object-fit: contain; margin: 0 auto 8px; display: block; }
.brand-title { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-title .dot { color: var(--accent); }
.brand-sub { font-size: 0.8rem; color: #BAC6D8; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.status-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.status-pill.ok { background: rgba(46, 204, 113, 0.2); color: #9BF2BE; border: 1px solid rgba(46, 204, 113, 0.45); }
.status-pill.warn { background: rgba(217, 164, 38, 0.2); color: #F9D986; border: 1px solid rgba(217, 164, 38, 0.45); }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; background: rgba(255,255,255,0.09); padding: 6px 12px; border-radius: 999px; }

/* Navigation */
.module-nav {
  background: var(--primary-dark);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  overflow-x: auto;
  padding: 0 20px;
  gap: 4px;
}
.nav-tab {
  background: transparent;
  color: #C7D2E2;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 11px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-tab:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-tab.active { color: #fff; border-bottom-color: var(--accent); background: rgba(255,255,255,0.06); }
.nav-tab.roadmap { opacity: 0.72; }
.tab-tag {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
}
.tab-tag.live { background: #1D7A46; color: #fff; }
.tab-tag.gold { background: var(--accent); color: #161209; }
.tab-tag.muted { background: rgba(255,255,255,0.12); color: #C5D0DF; }

/* Container & Cards */
.container { max-width: 1380px; margin: 22px auto 60px; padding: 0 20px; }
.tab-panel { display: none; flex-direction: column; gap: 18px; }
.tab-panel.active { display: flex; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 2px 8px rgba(21,36,58,0.04);
}
.card-head { margin-bottom: 16px; }
.card-head h2, .card-head h3 { margin: 0 0 4px; color: var(--primary); }
.card-head p { margin: 0; }
.panel-soft {
  background: #FAF8F3;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

/* Inputs */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; }
.field > span { font-weight: 600; color: var(--primary); }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], textarea, select {
  width: 100%;
  border: 1px solid #D6D1C6;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217,164,38,0.18);
}

/* Chat Workspace (Multi-chat + Advisors) */
.chat-workspace {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 18px;
  align-items: start;
}
.chat-sidebar {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.advisor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.advisor-btn {
  width: 100%;
  text-align: left;
  background: #FAF8F3;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: 0.15s ease;
}
.advisor-btn:hover { border-color: var(--accent); background: #FFFBF0; }
.advisor-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.advisor-btn .adv-ico { font-size: 1.2rem; flex-shrink: 0; }
.advisor-btn .adv-name { font-size: 0.85rem; font-weight: 700; display: block; line-height: 1.2; }
.advisor-btn .adv-role { font-size: 0.73rem; opacity: 0.78; display: block; margin-top: 2px; }

.sidebar-divider { height: 1px; background: var(--border); margin: 4px 0; }
.threads-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
}
.thread-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: #FAF9F5;
  cursor: pointer;
  font-size: 0.82rem;
}
.thread-item:hover { border-color: var(--border); background: #F3EFE5; }
.thread-item.active { background: #FEF6E0; border-color: var(--accent); font-weight: 600; color: var(--primary); }
.thread-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.thread-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.thread-thinking { font-size: 0.72rem; color: var(--warn-text); flex-shrink: 0; }
.thread-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.78rem; padding: 2px 4px; border-radius: 4px; }
.thread-del:hover { background: rgba(0,0,0,0.08); color: #A61C1C; }

.advisor-active-head { display: flex; align-items: center; gap: 12px; }
.advisor-avatar {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: #FEF6E0;
  border: 1px solid #F0D28C;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.prompt-chip {
  background: #F4F1E8;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.prompt-chip:hover { border-color: var(--accent); background: #FEF8E8; }
.chat-messages {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FCFBF8;
  padding: 16px;
  height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chat-msg {
  max-width: 85%;
  padding: 13px 16px;
  border-radius: 14px;
  font-size: 0.93rem;
  line-height: 1.55;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(21,36,58,0.04);
}
.msg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.msg-role { font-size: 0.72rem; font-weight: 700; opacity: 0.72; text-transform: uppercase; letter-spacing: 0.03em; }
.msg-copy-btn {
  background: #F4F1E8;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.msg-copy-btn:hover { border-color: var(--accent); }
.msg-body p { margin: 0 0 9px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body h3, .msg-body h4 { margin: 12px 0 6px; color: var(--primary); font-size: 0.98rem; }
.msg-body ul, .msg-body ol { margin: 6px 0 10px; padding-left: 20px; }
.msg-body li { margin-bottom: 4px; }
.msg-body hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.msg-body code { background: #F1EFE9; padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }
.chat-msg.user .msg-body { white-space: pre-wrap; }
.chat-input-bar { display: flex; gap: 10px; margin-top: 12px; align-items: stretch; }
.chat-input-bar textarea { flex: 1; resize: vertical; }

@media (max-width: 980px) {
  .chat-workspace { grid-template-columns: 1fr; }
}

/* HDR Editor */
.hdr-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  background: #F4F6FA;
  border: 1px solid #DCE3EE;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.8rem;
  color: var(--primary);
}
.dropzone {
  border: 2px dashed #C7BFA9;
  border-radius: 12px;
  background: #FCF9F1;
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: 0.15s;
}
.dropzone.dragover { border-color: var(--accent); background: #FFF7DF; }
.drop-icon { font-size: 2rem; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 8px; }
.thumb-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 4/3; }
.thumb-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 0.88rem; cursor: pointer; }
.check-row input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }

.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.result-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #FCFBF9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Interactive Before/After Slider */
.ba-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  background: #111;
  user-select: none;
}
.ba-slider img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ba-after-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0 0 0 50%);
}
.ba-divider {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0,0,0,0.45);
  pointer-events: none;
}
.ba-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}
.ba-label {
  position: absolute;
  top: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  z-index: 3;
  pointer-events: none;
}
.ba-label.left { left: 10px; background: rgba(13,24,41,0.82); color: #fff; }
.ba-label.right { right: 10px; background: rgba(217,164,38,0.92); color: #161209; }

.side-by-side { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-by-side img, .single-after img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }

/* Valuation */
.val-meta { margin-bottom: 14px; }
.val-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.val-layout { display: grid; grid-template-columns: 1fr 250px; gap: 16px; align-items: start; }
.table-scroll { overflow-x: auto; }
.val-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.val-table th { background: var(--primary); color: #fff; padding: 7px 8px; text-align: left; font-weight: 600; border: 1px solid #263A57; }
.val-table tr.sub-head th { background: #213450; font-size: 0.76rem; color: #D7E0EC; }
.val-table td { border: 1px solid var(--border); padding: 5px 6px; vertical-align: middle; }
.val-table tr.finca-main { background: #fff; cursor: pointer; }
.val-table tr.finca-sub { background: #FAF8F2; cursor: pointer; }
.val-table tr.selected-row { background: #FFF5D6 !important; }
.val-table input { padding: 4px 6px; font-size: 0.82rem; }
.val-table tfoot td { background: #EFECE3; font-weight: 700; padding: 8px; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.barems-card {
  background: #FAF8F3;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.barems-card h4 { margin: 0 0 4px; color: var(--primary); font-size: 0.9rem; }
.barems-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 8px; }
.barems-table th { background: var(--primary); color: #fff; padding: 5px; text-align: right; }
.barems-table th:first-child { text-align: left; }
.barems-table td { padding: 5px; border-bottom: 1px solid var(--border); text-align: right; }
.barems-table td:first-child { text-align: left; font-weight: 600; }
.barems-table tbody tr { cursor: pointer; }
.barems-table tbody tr:hover { background: #FFF2C6; }

/* Contracts */
.contracts-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.tpl-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--text);
}
.tpl-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.anexo-banner {
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid #BCE0C9;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.83rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.custom-field-row { display: grid; grid-template-columns: 1fr 1fr 28px; gap: 6px; align-items: center; }

.contract-paper {
  background: #fff;
  border: 1px solid #D9D5CA;
  border-radius: 10px;
  padding: 36px 42px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.94rem;
  line-height: 1.62;
  color: #161616;
}
.contract-header { border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 18px; text-align: center; }
.contract-brand { font-family: -apple-system, sans-serif; font-weight: 800; letter-spacing: 0.06em; color: var(--primary); font-size: 1.05rem; }
.contract-reg { font-family: -apple-system, sans-serif; font-size: 0.78rem; color: var(--muted); margin-bottom: 8px; }
.contract-header h3 { margin: 6px 0 0; font-size: 1.05rem; color: var(--primary); }
.contract-document h4 { margin: 18px 0 8px; text-align: center; letter-spacing: 0.08em; font-size: 0.92rem; color: var(--primary); }
.contract-document p { margin: 0 0 10px; text-align: justify; }
.contract-place { text-align: right !important; font-style: italic; }
.highlight { background: #FFF2BE; padding: 1px 4px; border-radius: 4px; font-weight: 700; }
.contract-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-family: -apple-system, sans-serif; font-size: 0.82rem; }
.contract-table th, .contract-table td { border: 1px solid #C9C9C9; padding: 6px 8px; }
.contract-table th { background: #EEF1F6; color: var(--primary); text-align: left; }
.contract-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-top: 38px; text-align: center; }
.sig-line { height: 54px; border-bottom: 1px solid #333; margin: 0 12px 6px; }
.sig-name { font-size: 0.84rem; text-align: center !important; }
.contract-note-template { margin-top: 22px !important; font-size: 0.78rem; color: #777; font-family: -apple-system, sans-serif; }
.contract-custom-block { background: #FAF9F5; border-left: 3px solid var(--accent); padding: 10px 14px; margin: 12px 0; }

/* Roadmap Cards */
.roadmap-card { max-width: 780px; }
.pill-phase { display: inline-block; background: var(--warn-bg); color: var(--warn-text); border: 1px solid #F0D28C; font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; margin-bottom: 10px; }
.roadmap-list { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text); }

/* Phase 2: Herencias / Catastro */
.pipeline-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.pipe-step {
  background: #F4F2EC;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.pipe-step.running { background: var(--warn-bg); border-color: var(--accent); color: var(--warn-text); }
.pipe-step.done { background: var(--ok-bg); border-color: #9BD6B0; color: var(--ok-text); }
.her-photo-frame {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0F1A2B;
}
.her-photo-frame img { width: 100%; height: auto; display: block; }
.kpi-big { font-size: 1.25rem; font-weight: 800; color: var(--primary); margin: 4px 0; }
.audit-box {
  background: #FEF8E7;
  border: 1px solid #F0D38A;
  border-radius: 10px;
  padding: 13px 14px;
  color: #5C3D05;
}
.alert-chip {
  background: #FFF0EE;
  border: 1px solid #F3B8B2;
  color: #9A2218;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.75rem;
  font-weight: 600;
}
@media (max-width: 900px) {
  .pipeline-strip { grid-template-columns: 1fr 1fr; }
}

/* Phase 3: Marketing Studio (Meta Ads + Organic + Reels) */
.mkt-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mkt-mode-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #FAF8F3;
  cursor: pointer;
  color: var(--text);
  transition: all 0.16s ease;
}
.mkt-mode-btn:hover {
  border-color: var(--accent);
  background: #FFFDF7;
}
.mkt-mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px rgba(29, 54, 89, 0.22);
}
.mkt-mode-btn strong { display: block; font-size: 0.94rem; }
.mkt-mode-btn small { display: block; font-size: 0.77rem; opacity: 0.78; margin-top: 2px; }
.mkt-mode-ico { font-size: 1.55rem; line-height: 1; }
.mkt-subpanel { display: none; }
.mkt-subpanel.active { display: flex; flex-direction: column; gap: 16px; }

.mkt-creatives-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}
.mkt-carousel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}
.mkt-creative-card {
  background: #FAF8F3;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mkt-creative-card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  box-shadow: 0 4px 14px rgba(13, 24, 41, 0.14);
}
.mkt-copy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.mkt-copy-card {
  background: #FAF8F3;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mkt-copy-body {
  white-space: pre-wrap;
  font-size: 0.87rem;
  line-height: 1.52;
  color: var(--text);
}

.reels-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.phone-mockup {
  width: 280px;
  aspect-ratio: 9 / 16;
  background: #0F1A2B;
  border: 6px solid #1E293B;
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 36px rgba(13,24,41,0.22);
}
.phone-mockup video { width: 100%; height: 100%; object-fit: cover; }
.phone-placeholder { text-align: center; color: #C5D2E3; padding: 24px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 900px) {
  .reels-layout, .mkt-mode-tabs, .mkt-creatives-grid { grid-template-columns: 1fr; }
}

/* Instant Witei property search results dropdown */
.witei-search-results {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(13, 24, 41, 0.12);
  margin-top: 4px;
}
.witei-search-row {
  padding: 8px 10px;
  border-bottom: 1px solid #F1EFE8;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.witei-search-row:last-child { border-bottom: none; }
.witei-search-row:hover { background: #FFF5D6; }
.witei-search-row strong { color: var(--primary); font-size: 0.83rem; }
.witei-search-meta { color: var(--muted); font-size: 0.74rem; }

/* Restyling + Reformas selectable listing gallery */
.ref-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding: 4px;
}
.ref-pick-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 2.5px solid transparent;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background: #0F1A2B;
  transition: border-color 0.14s ease, transform 0.14s ease;
}
.ref-pick-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.78;
}
.ref-pick-item.selected {
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(217, 164, 38, 0.35);
}
.ref-pick-item.selected img { opacity: 1; }
.ref-pick-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(13, 24, 41, 0.78);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
}
.ref-pick-item.selected .ref-pick-badge {
  background: var(--accent);
  color: #161209;
  border-color: #fff;
}

/* Escaparate Oficina */
.esc-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.esc-rec-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #FAF8F3;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.esc-rec-card.selected {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(217, 164, 38, 0.28);
  background: #FFFDF7;
}
.esc-rec-thumb {
  height: 126px;
  background: #0F1A2B;
  position: relative;
  overflow: hidden;
}
.esc-rec-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.esc-rec-reason {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(29, 54, 89, 0.88);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.esc-rec-body { padding: 10px; display: flex; flex-direction: column; gap: 3px; }

/* Cloud Drafts (Mis Bocetos) */
.draft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  margin-left: 4px;
}
.modal-card.modal-wide { max-width: 900px; }
.drafts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 12px;
}
.draft-card {
  background: #FAF8F3;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.draft-thumb {
  height: 126px;
  background: linear-gradient(135deg, #1D3659 0%, #2C4D7A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.draft-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.draft-thumb-icon { font-size: 2.3rem; }
.draft-mod-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(13, 24, 41, 0.84);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(217, 164, 38, 0.7);
}
.draft-body {
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.draft-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--primary);
  line-height: 1.3;
}
.draft-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(13,24,41,0.58); }
.modal-card {
  position: relative;
  z-index: 2;
  background: #fff;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.28);
}

/* Responsive */
@media (max-width: 1024px) {
  .grid-2, .grid-4, .val-layout, .contracts-layout { grid-template-columns: 1fr; }
}

/* Print Styles (clean A4 contracts & valuation) */
@media print {
  body { background: #fff; }
  .no-print, .topbar, .modal { display: none !important; }
  .container { margin: 0; padding: 0; max-width: 100%; }
  .card { border: none; box-shadow: none; padding: 0; }
  .contract-paper { border: none; box-shadow: none; padding: 0; }
  .page-break { page-break-before: always; }
}
