/* ============================================
   AXION PORTAL - Editorial Dark Theme
   ============================================ */

:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-deep: #0f0f0f;
  --border: #2a2a2a;
  --text: #f5f1e8;
  --text-dim: #c4bba8;
  --text-muted: #8a8275;
  --accent: #d4af7a;
  --accent-soft: #e8c698;
  --success: #6b9b6b;
  --danger: #c94444;
  --info: #7a9bb8;
  --warm: #b87a7a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: linear-gradient(180deg, #0a0a0a 0%, #141414 100%);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.serif { font-family: 'Playfair Display', Georgia, serif; }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 48px;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ====================== HEADER ====================== */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 50;
}

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

.client-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin: 0;
}

.campaign-label {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ====================== TABS ====================== */
.tabs {
  border-bottom: 1px solid var(--border);
  background: var(--bg-deep);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tabs-inner {
  display: flex;
  gap: 0;
  padding: 0 48px;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 16px 24px;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  white-space: nowrap;
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--accent);
}

.tab-btn:hover {
  color: var(--accent);
}

/* ====================== MAIN ====================== */
.main-content {
  padding: 48px;
  position: relative;
  z-index: 2;
}

.tab-content {
  display: none;
  animation: fadeIn 0.6s ease-out;
}

.tab-content.active {
  display: block;
}

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

.section-intro {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 700px;
  margin-bottom: 40px;
  line-height: 1.7;
}

/* ====================== ORNAMENT ====================== */
.ornament {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 32px;
}

.ornament::before, .ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.ornament.mini {
  margin-bottom: 8px;
  max-width: 200px;
}

/* ====================== STATS ====================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 64px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, var(--accent-glow, rgba(212, 175, 122, 0.15)), transparent 70%);
}

.stat-icon {
  font-size: 22px;
  margin-bottom: 16px;
}

.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ====================== TIMELINE ====================== */
.timeline-wrapper {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 48px;
  border-radius: 2px;
}

.timeline-item {
  display: flex;
  gap: 24px;
  position: relative;
  margin-bottom: 32px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot-col {
  position: relative;
  flex-shrink: 0;
}

.timeline-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  border: 2px solid var(--color);
  background: var(--dotBg);
  font-size: 16px;
}

.timeline-line {
  position: absolute;
  left: 19px;
  top: 40px;
  width: 2px;
  height: calc(100% + 32px);
  background: linear-gradient(180deg, var(--color) 0%, var(--border) 100%);
  z-index: 1;
}

.timeline-content {
  flex: 1;
  padding-top: 4px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.timeline-phase {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  margin: 0 0 4px 0;
}

.timeline-date {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.timeline-percentage {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 900;
}

.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====================== CARDS GRID ====================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: 2px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.card-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* ====================== TASK LIST ====================== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 20px 24px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-left: 3px solid var(--color, var(--text-muted));
}

.task-item-icon {
  font-size: 22px;
  color: var(--color);
  flex-shrink: 0;
}

.task-item-content {
  flex: 1;
}

.task-item-text {
  font-size: 15px;
  margin-bottom: 4px;
}

.task-item.completed .task-item-text {
  color: var(--text-muted);
  text-decoration: line-through;
}

.task-item-date {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ====================== NEEDS / CLIENT TASKS ====================== */
.category-section {
  margin-bottom: 48px;
}

.category-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.need-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: 2px;
  transition: all 0.3s;
}

.need-card.completed {
  opacity: 0.6;
}

.need-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-muted);
  font-size: 22px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.need-card.completed .toggle-btn {
  color: var(--accent);
}

.toggle-btn:hover {
  color: var(--accent);
}

.badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.badge {
  padding: 3px 10px;
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-danger {
  background: rgba(201, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.badge-success {
  background: rgba(107, 155, 107, 0.15);
  color: var(--success);
  border: 1px solid var(--success);
}

.badge-accent {
  background: rgba(212, 175, 122, 0.15);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.badge-warm {
  background: rgba(184, 122, 122, 0.15);
  color: var(--warm);
  border: 1px solid var(--warm);
}

.need-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  margin: 0 0 8px 0;
}

.need-card.completed .need-card-title {
  text-decoration: line-through;
}

.specs-box {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 2px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.specs-label {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

.examples-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.example-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
  transition: all 0.3s;
  cursor: pointer;
  background: var(--bg-deep);
}

.example-img:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

/* ====================== VIRAL ====================== */
.viral-card {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, #1a1614 100%);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.viral-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.viral-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(212, 175, 122, 0.15), transparent 70%);
}

.viral-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  position: relative;
  gap: 8px;
  flex-wrap: wrap;
}

.viral-trend {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}

.viral-format {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  position: relative;
}

/* ====================== BUTTONS ====================== */
.btn-primary, .btn-ghost, .btn-danger {
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  padding: 10px 20px;
}

.btn-primary:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 8px 16px;
}

.btn-ghost:hover {
  background: var(--accent);
  color: var(--bg);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 6px 12px;
  font-size: 11px;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* ====================== CIRCLE PROGRESS ====================== */
.circle-progress-wrapper {
  position: relative;
  height: 80px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.circle-progress-wrapper svg {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.circle-progress-value {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 900;
}

/* ====================== IMAGE MODAL ====================== */
.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 40px;
  cursor: zoom-out;
}

.image-modal.active {
  display: flex;
}

.image-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* ====================== STAT CARD ACCENT LINE ====================== */
.stat-card-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-color, var(--accent));
  border-radius: 2px 2px 0 0;
}

/* ====================== MINI STATS (resumen de proceso) ====================== */
.process-summary {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0;
  margin-bottom: 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 24px;
  border-right: 1px solid var(--border);
}

.mini-stat:last-child { border-right: none; }

.mini-stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--text);
}

.mini-stat-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ====================== TIMELINE EXPANDIBLE (NIVELES) ====================== */
.timeline-header.expandable {
  cursor: pointer;
  user-select: none;
  border-radius: 2px;
  padding: 6px;
  margin: -6px;
  transition: background 0.2s;
}

.timeline-header.expandable:hover {
  background: rgba(212, 175, 122, 0.06);
}

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

.phase-chevron {
  font-size: 22px;
  color: var(--text-muted);
  line-height: 1;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.phase-chevron.open {
  transform: rotate(90deg);
}

.phase-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.phase-detail.open {
  max-height: 900px;
}

.phase-description {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.75;
  padding-top: 18px;
  margin-top: 10px;
  margin-bottom: 20px;
  border-top: 1px solid var(--border);
}

.phase-section-label {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

.phase-deliverables {
  margin-bottom: 20px;
}

.deliverables-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.deliverables-list li {
  background: rgba(212, 175, 122, 0.08);
  border: 1px solid rgba(212, 175, 122, 0.22);
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.phase-tasks-section {
  margin-bottom: 16px;
}

.phase-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phase-task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.phase-task-icon {
  flex-shrink: 0;
  font-size: 13px;
  margin-top: 1px;
}

.phase-task-text.done {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ====================== CLIENT UPLOAD (pestaña Necesitamos) ====================== */
.client-upload-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.client-upload-label {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}

.client-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px dashed var(--border);
  border-radius: 2px;
  padding: 14px 20px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  transition: all 0.2s;
  text-align: center;
}

.client-upload-zone:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(212, 175, 122, 0.04);
}

.cup-progress {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  display: none;
}

.client-uploads-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.client-upload-file {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 2px;
  font-size: 12px;
  color: var(--text-dim);
  gap: 12px;
}

.client-upload-view {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.2s;
}

.client-upload-view:hover { color: var(--accent-soft); }

/* ====================== FOOTER ====================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 48px;
  margin-top: 64px;
  text-align: center;
  color: #555;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.footer-by {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #3a3a3a;
  text-transform: none;
}

.footer-by a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-by a:hover {
  color: var(--accent-soft);
}

/* ====================== UTILITIES ====================== */
.loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-style: italic;
}

/* ====================== BITÁCORA DE CONTENIDO ====================== */
.bitacora-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.bitacora-filter-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.bitacora-filter-btn:hover,
.bitacora-filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(212, 175, 122, 0.06);
}

.bitacora-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.bitacora-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 20px;
  transition: border-color 0.25s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bitacora-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.bitacora-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bitacora-platform {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bitacora-platform-icon {
  font-size: 22px;
  line-height: 1;
}

.bitacora-platform-name {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.bitacora-status-badge {
  font-size: 10px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.bitacora-type-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.bitacora-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  line-height: 1.3;
  margin: 0;
  color: var(--text);
}

.bitacora-date {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.bitacora-caption {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

.bitacora-hashtags {
  font-size: 11px;
  color: var(--info);
  margin: 0;
  word-break: break-word;
}

.bitacora-link {
  display: inline-block;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.5px;
  margin-top: auto;
  padding-top: 6px;
}

.bitacora-link:hover {
  text-decoration: underline;
  color: var(--accent-soft);
}

/* ====================== BITÁCORA THUMBNAIL ====================== */
.bitacora-thumbnail {
  width: 100%;
  height: auto;
  border-radius: 2px;
  cursor: zoom-in;
  transition: opacity 0.2s;
  display: block;
}

.bitacora-thumbnail:hover {
  opacity: 0.88;
}

/* ====================== PORTAL PIN OVERLAY ====================== */
.portal-pin-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.38s ease;
}

/* ====================== PIN GATE ====================== */
.pin-gate {
  max-width: 320px;
  margin: 60px auto;
  text-align: center;
}

.pin-gate-title {
  font-size: 32px;
  margin: 0 0 8px 0;
}

.pin-gate-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 36px;
  line-height: 1.6;
}

.pin-display {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-bottom: 10px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: all 0.15s;
  display: block;
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(212, 175, 122, 0.4);
}

.pin-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 20px;
  margin-bottom: 20px;
  letter-spacing: 0.3px;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 10px;
  justify-content: center;
}

.pin-btn {
  width: 72px;
  height: 72px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  font-size: 22px;
  font-family: 'Playfair Display', serif;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-btn:hover {
  background: rgba(212, 175, 122, 0.08);
  border-color: var(--accent);
  color: var(--accent);
}

.pin-btn:active {
  transform: scale(0.93);
}

.pin-btn-clear {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}

.pin-btn-clear:hover {
  background: rgba(201, 68, 68, 0.08);
  border-color: var(--danger);
  color: var(--danger);
}

.pin-btn-back {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
}

/* ====================== CLIENT LEADS ====================== */

/* Stats bar encima del grid */
.leads-stats-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.leads-stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}
.leads-stat-chip:hover { border-color: var(--accent); }
.leads-stat-chip.active { background: rgba(212,175,122,0.1); border-color: var(--accent); color: var(--text); }
.leads-stat-chip .chip-count {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Playfair Display', serif;
}

.client-leads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.client-lead-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.25s, transform 0.2s;
}
.client-lead-card:hover { border-color: var(--accent); transform: translateY(-2px); }

/* Borde de color izquierdo según status */
.client-lead-card[data-status="QUALIFIED"]     { border-left: 3px solid #2ecc71; }
.client-lead-card[data-status="CONVERTED"]     { border-left: 3px solid #9b59b6; }
.client-lead-card[data-status="VISITED"]       { border-left: 3px solid #3498db; }
.client-lead-card[data-status="NOT_QUALIFIED"] { border-left: 3px solid #e67e22; }
.client-lead-card[data-status="SPAM"]          { border-left: 3px solid #e74c3c; opacity: 0.65; }

.client-lead-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.client-lead-avatar {
  width: 44px;
  height: 44px;
  background: rgba(212, 175, 122, 0.1);
  border: 1px solid rgba(212, 175, 122, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.client-lead-info { flex: 1; min-width: 0; }

.client-lead-name {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  margin: 0 0 6px 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dropdown de status */
.lead-status-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 20px 3px 8px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23d4af7a'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: border-color 0.2s, color 0.2s;
  max-width: 160px;
}
.lead-status-select:hover { border-color: var(--accent); }
.lead-status-select:focus { outline: none; border-color: var(--accent); }
.lead-status-select option { background: #1a1a1a; color: #f5f1e8; }

/* Indicador de guardado */
.lead-save-indicator {
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
}
.lead-save-indicator.visible { opacity: 1; }
.lead-save-indicator.ok   { color: #2ecc71; }
.lead-save-indicator.err  { color: #e74c3c; }

/* Fila de status + indicador */
.lead-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.client-lead-details {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.client-lead-detail {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  align-items: baseline;
}

/* Source badge */
.lead-source-badge {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* Notas editables */
.lead-notes-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  padding: 8px 10px;
  resize: vertical;
  min-height: 54px;
  transition: border-color 0.2s;
  margin-top: 4px;
}
.lead-notes-input::placeholder { color: #444; }
.lead-notes-input:focus { outline: none; border-color: var(--accent); }

.client-lead-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lead-footer-date { font-size: 11px; color: var(--text-muted); }

/* ====================== RESPONSIVE ====================== */
@media (max-width: 768px) {
  .container { padding: 0 24px; }
  .main-content { padding: 32px 24px; }
  .tabs-inner { padding: 0 24px; }
  .tab-btn { padding: 14px 16px; font-size: 11px; }
  .client-title { font-size: 22px; }
  .timeline-wrapper { padding: 28px; }
  .stat-value { font-size: 32px; }
  .category-title { font-size: 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 20px; }
  .bitacora-grid { grid-template-columns: 1fr; }
}

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

/* ============================================================
   KNOWLEDGE BASE — Client portal view
   ============================================================ */

/* Category filter pills */
.kb-client-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.kb-pill {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
}
.kb-pill:hover  { border-color: var(--accent); color: var(--accent); }
.kb-pill.active { background: var(--accent); border-color: var(--accent); color: #0a0a0a; font-weight: 700; }

/* Articles grid */
.kb-client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Article card */
.kb-client-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 22px 18px;
  cursor: pointer;
  transition: border-color .2s, transform .15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kb-client-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.kb-client-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.kb-client-cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(212,175,122,.12);
  padding: 3px 9px;
  border-radius: 10px;
}
.kb-client-date {
  font-size: 11px;
  color: var(--text-muted);
}
.kb-client-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
}
.kb-client-summary {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-client-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.kb-client-tag {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
}
.kb-client-read {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-top: auto;
  padding-top: 6px;
}

/* Article full-content overlay */
.kb-article-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  opacity: 0;
  transition: opacity .25s;
  overflow-y: auto;
}
.kb-article-overlay.active { opacity: 1; }

.kb-article-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  transform: translateY(12px);
  transition: transform .25s;
}
.kb-article-overlay.active .kb-article-modal { transform: translateY(0); }

.kb-article-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 28px 28px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-deep);
}
.kb-article-modal-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 0;
  line-height: 1.25;
}
.kb-article-modal-summary {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 10px 0 0;
}
.kb-article-close {
  background: rgba(255,255,255,.07);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.kb-article-close:hover { background: rgba(255,255,255,.14); color: var(--text); }

.kb-article-modal-body {
  padding: 28px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.8;
  max-height: 60vh;
  overflow-y: auto;
}
.kb-article-modal-body h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 8px;
}
.kb-article-modal-body p  { margin: 0 0 12px; }
.kb-article-modal-body ul { padding-left: 18px; margin: 0 0 12px; }
.kb-article-modal-body li { margin-bottom: 4px; }
.kb-article-modal-body strong { color: var(--text); }
.kb-article-modal-body a  { color: var(--accent); }

.kb-article-modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px 28px;
  border-top: 1px solid var(--border);
}

@media (max-width: 700px) {
  .kb-client-grid    { grid-template-columns: 1fr; }
  .kb-article-overlay { padding: 16px 8px; }
  .kb-article-modal-head,
  .kb-article-modal-body,
  .kb-article-modal-footer { padding: 20px 18px; }
  .kb-article-modal-title { font-size: 19px; }
}

/* ====================== VAULT — MIS ARCHIVOS ====================== */

.vault-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  background: var(--bg-elevated);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  margin-bottom: 8px;
}
.vault-upload-zone:hover,
.vault-upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(212, 175, 122, 0.06);
}
.vault-upload-icon {
  font-size: 40px;
  margin-bottom: 12px;
  line-height: 1;
}
.vault-upload-hint {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.vault-upload-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.vault-upload-btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.vault-progress-wrap {
  margin: 8px 0 16px;
  background: var(--bg-elevated);
  border-radius: 8px;
  overflow: hidden;
}
.vault-progress-bar {
  height: 4px;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.vault-progress-text {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.vault-stats-row {
  display: flex;
  gap: 12px;
  margin: 20px 0 12px;
  flex-wrap: wrap;
}
.vault-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  text-align: center;
  flex: 1;
  min-width: 80px;
}
.vault-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  display: block;
}
.vault-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.vault-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.vault-filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.vault-filter-btn:hover,
.vault-filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(212, 175, 122, 0.08);
}

.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.vault-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}
.vault-card:hover { border-color: var(--accent); }

.vault-card-preview {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
}
.vault-card-img-wrap { overflow: hidden; cursor: pointer; }
.vault-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.vault-card-img:hover { transform: scale(1.03); }
.vault-card-icon { font-size: 36px; opacity: 0.5; }

.vault-card-body {
  padding: 12px 14px 6px;
  flex: 1;
}
.vault-card-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.vault-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.vault-card-notes {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.vault-card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.vault-card-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px 12px;
}
.vault-action-btn {
  flex: 1;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s;
}
.vault-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.vault-action-del:hover { border-color: var(--danger); color: var(--danger); }

@media (max-width: 600px) {
  .vault-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .vault-upload-zone { padding: 28px 16px; }
}
