:root {
  --bg: #f7f6f4;
  --surface: #ffffff;
  --ink: #1c1a18;
  --ink-soft: #6f6a63;
  --line: #e7e3dd;
  --accent: #17140f;
  --accent-soft: #a9977a;
  --sidebar-bg: #14120f;
  --sidebar-ink: #efece6;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Helvetica Neue', Arial, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0.01em;
}

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.app-sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.15rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 0 8px 24px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav .nav-link {
  color: var(--sidebar-ink);
  opacity: 0.75;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.92rem;
  transition: background 0.15s, opacity 0.15s;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.06); opacity: 1; }
.sidebar-nav .nav-link.active { background: var(--accent-soft); color: #14120f; opacity: 1; font-weight: 600; }
.sidebar-nav .nav-link.disabled { opacity: 0.32; pointer-events: none; }
.nav-section-title {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.5; padding: 16px 12px 4px;
}
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: #14120f;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.85rem; }
.user-name { font-size: 0.88rem; font-weight: 600; }
.user-role { font-size: 0.75rem; opacity: 0.6; text-transform: capitalize; }

/* ---------- Topbar mobile ---------- */
.app-topbar {
  background: var(--sidebar-bg);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  position: sticky; top: 0; z-index: 20;
}

/* ---------- Content ---------- */
.app-content { flex: 1; padding: 28px; max-width: 100%; }
@media (max-width: 992px) { .app-content { padding: 16px; } }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--ink-soft); font-size: 0.9rem; }

.card-metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  height: 100%;
}
.card-metric .metric-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.card-metric .metric-value { font-size: 2rem; font-weight: 700; margin-top: 4px; }
.card-metric .metric-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: #f1eee8; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: var(--accent-soft); margin-bottom: 10px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.table-clean thead th {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-soft); border-bottom: 1px solid var(--line); font-weight: 600;
}
.table-clean td { vertical-align: middle; border-color: var(--line); }

.btn-dark-brand { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-dark-brand:hover { background: #000; border-color: #000; color: #fff; }

.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #16130f 0%, #2a251c 100%);
  padding: 20px;
}
.auth-card {
  background: var(--surface); border-radius: 18px; padding: 36px 32px;
  width: 100%; max-width: 400px; box-shadow: 0 30px 60px rgba(0,0,0,0.25);
}

/* Mobile: transformar tablas grandes en cards apiladas */
@media (max-width: 768px) {
  .table-responsive-cards thead { display: none; }
  .table-responsive-cards tr {
    display: block; margin-bottom: 12px; border: 1px solid var(--line);
    border-radius: 12px; padding: 12px; background: var(--surface);
  }
  .table-responsive-cards td {
    display: flex; justify-content: space-between; border: none; padding: 6px 4px;
  }
  .table-responsive-cards td::before {
    content: attr(data-label); font-weight: 600; color: var(--ink-soft); margin-right: 12px;
  }
}

/* ---------- Fase 2: filtros y model cards ---------- */
.filter-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); display: block; margin-bottom: 2px; font-weight: 600; }

.model-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; height: 100%; transition: box-shadow 0.15s, transform 0.15s;
}
.model-card:hover { box-shadow: 0 12px 28px rgba(0,0,0,0.10); transform: translateY(-2px); }
.model-card-photo { display: block; position: relative; aspect-ratio: 3/4; background: #f1eee8; overflow: hidden; }
.model-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.model-card-nophoto { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: #cfc7ba; }
.model-card-body { padding: 12px; }
.model-card-name { display: block; font-weight: 600; color: var(--ink); text-decoration: none; font-size: 0.95rem; margin-bottom: 2px; }
.model-card-name:hover { color: var(--accent-soft); }
.model-card-meta { font-size: 0.8rem; color: var(--ink-soft); }
.model-card-measures { font-size: 0.78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; margin-top: 2px; }

.badge-minor { position: absolute; top: 8px; left: 8px; background: #dc3545; color: #fff; font-size: 0.68rem; padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.badge-fav { position: absolute; top: 8px; right: 8px; color: #f1c40f; font-size: 1rem; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }

.badge-status { display: inline-block; margin-top: 8px; font-size: 0.68rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.status-activo { background: #e6f4ea; color: #1a7f37; }
.status-aspirante { background: #e7f0fb; color: #1c5fb0; }
.status-pendiente { background: #fff4e5; color: #b76e00; }
.status-inactivo { background: #f0f0f0; color: #666; }
.status-suspendido { background: #fdecea; color: #b42318; }
.status-rechazado { background: #fdecea; color: #b42318; }

/* ---------- Ficha del modelo ---------- */
.model-header {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; overflow: hidden; margin-bottom: 20px; display: flex; gap: 0;
}
.model-header-photo { width: 200px; flex-shrink: 0; aspect-ratio: 3/4; background: #f1eee8; }
.model-header-photo img { width: 100%; height: 100%; object-fit: cover; }
.model-header-photo .nophoto { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:3rem; color:#cfc7ba; }
.model-header-info { padding: 24px; flex: 1; }
.model-header-name { font-size: 1.6rem; font-weight: 700; margin: 0; }
.model-header-tags { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display:inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; background:#f1eee8; color: var(--ink); }
@media (max-width: 640px) {
  .model-header { flex-direction: column; }
  .model-header-photo { width: 100%; aspect-ratio: 16/10; }
}

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.gallery-item { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 3/4; background: #f1eee8; border: 1px solid var(--line); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item.is-hidden { opacity: 0.4; }
.gallery-item .gallery-actions { position: absolute; inset: auto 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,0.7)); padding: 6px; display: flex; gap: 4px; justify-content: center; opacity: 0; transition: opacity 0.15s; }
.gallery-item:hover .gallery-actions { opacity: 1; }
.gallery-item .gallery-actions .btn { padding: 2px 6px; font-size: 0.7rem; }
.gallery-item .primary-star { position: absolute; top: 6px; left: 6px; color: #f1c40f; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }

/* ---------- Fase 3: castings ---------- */
.status-borrador { background: #f0f0f0; color: #666; }
.status-abierto { background: #e6f4ea; color: #1a7f37; }
.status-enrevisión, .status-enrevision { background: #fff4e5; color: #b76e00; }
.status-cerrado { background: #e7f0fb; color: #1c5fb0; }
.status-cancelado { background: #fdecea; color: #b42318; }

/* Pipeline / Kanban */
.pipeline { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-col { flex: 0 0 240px; background: #f4f2ee; border-radius: 12px; padding: 10px; min-height: 120px; }
.pipeline-col.dragover { outline: 2px dashed var(--accent-soft); outline-offset: -4px; }
.pipeline-col-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; display: flex; justify-content: space-between; }
.cand-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; cursor: grab; display: flex; gap: 8px; align-items: center; }
.cand-card:active { cursor: grabbing; }
.cand-card img, .cand-card .cand-noimg { width: 40px; height: 52px; border-radius: 6px; object-fit: cover; background: #eee; flex-shrink: 0; display:flex;align-items:center;justify-content:center;color:#bbb; }
.cand-card .cand-name { font-size: 0.82rem; font-weight: 600; line-height: 1.1; }
.cand-card .cand-meta { font-size: 0.72rem; color: var(--ink-soft); }

/* Shortlist pública */
.public-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.public-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.public-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.public-card .ph { aspect-ratio: 3/4; background: #f1eee8; }
.public-card .ph img { width: 100%; height: 100%; object-fit: cover; }
.public-card .body { padding: 12px; }
.qr-box { display: inline-block; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
