:root {
  --bp-anthracite: #2a2c2e;
  --bp-anthracite-2: #3a3d40;
  --bp-anthracite-3: #55595d;
  --bp-pink: #e6007e;
  --bp-pink-dark: #c20069;
  --bp-pink-light: #ff4fa3;
  --bp-bg: #f4f5f6;
  --bp-surface: #ffffff;
  --bp-border: #e3e5e8;
  --bp-text: #1e1f21;
  --bp-muted: #6b7075;
  --bp-success: #1a9e6a;
  --bp-danger: #d6335a;
  --bp-warning: #c98a00;
  --bp-radius: 14px;
  --bp-radius-sm: 10px;
  --bp-shadow: 0 4px 20px rgba(42, 44, 46, 0.08);
  --bp-shadow-lg: 0 16px 48px rgba(42, 44, 46, 0.18);
  --bp-sidebar: 232px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bp-bg);
  color: var(--bp-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--bp-pink-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

/* ============================ LOGIN ============================ */
.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(230, 0, 126, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(42, 44, 46, 0.08), transparent 60%),
    var(--bp-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: 18px;
  box-shadow: var(--bp-shadow-lg);
  padding: 34px 30px 28px;
}

.login-logo { display: block; margin: 0 auto 8px; height: 44px; }
.login-sub { text-align: center; color: var(--bp-muted); font-size: 13.5px; margin: 0 0 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--bp-anthracite); margin-bottom: 6px; }

.input {
  width: 100%;
  padding: 13px 14px;
  min-height: 48px;
  font-size: 16px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  background: #fbfbfc;
  color: var(--bp-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--bp-pink);
  box-shadow: 0 0 0 3px rgba(230, 0, 126, 0.14);
  background: #fff;
}
select.input { appearance: none; }

/* ============================ BOTONES ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  min-height: 46px;
  border-radius: var(--bp-radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s, background 0.15s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--bp-pink); color: #fff; box-shadow: 0 6px 16px rgba(230, 0, 126, 0.25); }
.btn-primary:hover:not(:disabled) { background: var(--bp-pink-dark); text-decoration: none; }
.btn-dark { background: var(--bp-anthracite); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--bp-anthracite-2); text-decoration: none; }
.btn-ghost { background: #fff; color: var(--bp-anthracite); border-color: var(--bp-border); }
.btn-ghost:hover:not(:disabled) { background: #f0f1f2; text-decoration: none; }
.btn-danger { background: #fff; color: var(--bp-danger); border-color: #f0c4cf; }
.btn-danger:hover:not(:disabled) { background: #fdf1f4; text-decoration: none; }
.btn-sm { min-height: 38px; padding: 9px 13px; font-size: 13.5px; }
.btn-icon { padding: 9px; min-height: 40px; min-width: 40px; }

/* ============================ APP SHELL ============================ */
.app { display: flex; min-height: 100%; }

.sidebar {
  width: var(--bp-sidebar);
  background: var(--bp-anthracite);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
}
.sidebar .brand { display: flex; align-items: center; padding: 4px 8px 22px; }
.sidebar .brand img { height: 34px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--bp-radius-sm);
  color: #cfd1d4;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  min-height: 46px;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--bp-pink); color: #fff; }
.nav-item .ni-icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar .side-footer { border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 12px; }
.side-user { font-size: 12.5px; color: #9aa0a6; padding: 0 14px 8px; }

.main {
  flex: 1;
  margin-left: var(--bp-sidebar);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 245, 246, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--bp-border);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.topbar h1 { font-size: 20px; margin: 0; color: var(--bp-anthracite); }
.topbar .top-actions { display: flex; gap: 10px; align-items: center; }

.mobile-menu-btn { display: none; }

.content { padding: 26px; max-width: 1240px; width: 100%; }

/* ============================ CARDS ============================ */
.card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 4px; font-size: 17px; color: var(--bp-anthracite); }
.card .card-sub { color: var(--bp-muted); font-size: 13.5px; margin: 0 0 18px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 16px 18px;
  box-shadow: var(--bp-shadow);
}
.stat .sv { font-size: 24px; font-weight: 700; color: var(--bp-anthracite); }
.stat .sl { font-size: 12.5px; color: var(--bp-muted); margin-top: 2px; }
.stat.accent .sv { color: var(--bp-pink); }

/* ============================ DROPZONE ============================ */
.dropzone {
  border: 2px dashed #cfd2d6;
  border-radius: var(--bp-radius);
  background: #fbfbfc;
  padding: 44px 24px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.dropzone.dragover { border-color: var(--bp-pink); background: rgba(230, 0, 126, 0.05); }
.dropzone .dz-icon { font-size: 46px; margin-bottom: 8px; }
.dropzone .dz-title { font-size: 17px; font-weight: 700; color: var(--bp-anthracite); }
.dropzone .dz-sub { color: var(--bp-muted); font-size: 13.5px; margin: 6px 0 18px; }

/* ============================ PREVIEW LIST ============================ */
.preview-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

.preview-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  background: #fff;
}
.preview-thumb {
  width: 62px; height: 62px;
  border-radius: 9px;
  overflow: hidden;
  background: #eef0f2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview-info { flex: 1; min-width: 0; }
.preview-info .pn { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.preview-info .pm { font-size: 12.5px; color: var(--bp-muted); }
.preview-info .pbad { color: var(--bp-danger); font-size: 12.5px; font-weight: 600; }

.progress {
  height: 6px;
  background: #eceef0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}
.progress > span { display: block; height: 100%; background: var(--bp-pink); width: 0; transition: width 0.2s; }
.progress.done > span { background: var(--bp-success); }
.progress.error > span { background: var(--bp-danger); }

/* ============================ TOOLBAR ============================ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar .grow { flex: 1; min-width: 160px; }
.seg { display: inline-flex; border: 1px solid var(--bp-border); border-radius: var(--bp-radius-sm); overflow: hidden; background: #fff; }
.seg button {
  border: none; background: transparent; padding: 10px 14px; cursor: pointer;
  font-size: 13.5px; color: var(--bp-anthracite); min-height: 42px;
}
.seg button.active { background: var(--bp-anthracite); color: #fff; }

.search-input { width: 100%; max-width: 320px; }

/* ============================ FILE GRID ============================ */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}
.file-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  overflow: hidden;
  box-shadow: var(--bp-shadow);
  position: relative;
  transition: box-shadow 0.15s, transform 0.1s;
}
.file-card:hover { box-shadow: var(--bp-shadow-lg); }
.file-card .fc-media {
  aspect-ratio: 1 / 1;
  background: #eef0f2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
  cursor: pointer;
}
.file-card .fc-media img { width: 100%; height: 100%; object-fit: cover; }
.file-card .fc-body { padding: 10px 12px; }
.file-card .fc-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .fc-meta { font-size: 11.5px; color: var(--bp-muted); margin-top: 2px; }
.file-card .fc-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.file-card.selected { outline: 2px solid var(--bp-pink); outline-offset: -1px; }

.select-check {
  position: absolute;
  top: 8px; left: 8px;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--bp-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 2;
  font-size: 15px;
}
.select-check.on { background: var(--bp-pink); border-color: var(--bp-pink); color: #fff; }

/* Lista */
.file-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--bp-radius); overflow: hidden; box-shadow: var(--bp-shadow); }
.file-table th, .file-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--bp-border); font-size: 13.5px; }
.file-table th { background: #fafafb; color: var(--bp-muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.file-table tr:last-child td { border-bottom: none; }
.file-table td.actions { white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  background: #eef0f2;
  color: var(--bp-anthracite-3);
}
.badge.ok { background: rgba(26, 158, 106, 0.12); color: var(--bp-success); }
.badge.off { background: rgba(214, 51, 90, 0.12); color: var(--bp-danger); }
.badge.warn { background: rgba(201, 138, 0, 0.14); color: var(--bp-warning); }

/* ============================ SHARES ============================ */
.share-list { display: flex; flex-direction: column; gap: 14px; }
.share-item {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  box-shadow: var(--bp-shadow);
  padding: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.share-thumbs { display: flex; gap: 6px; }
.share-thumbs .st {
  width: 52px; height: 52px; border-radius: 8px; overflow: hidden; background: #eef0f2;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.share-thumbs .st img { width: 100%; height: 100%; object-fit: cover; }
.share-body { flex: 1; min-width: 200px; }
.share-body .sname { font-weight: 600; }
.share-body .surl { font-size: 12.5px; color: var(--bp-muted); word-break: break-all; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================ MODAL ============================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 21, 22, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 18px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--bp-shadow-lg);
  padding: 24px;
}
.modal h3 { margin: 0 0 6px; color: var(--bp-anthracite); }
.modal .modal-sub { color: var(--bp-muted); font-size: 13.5px; margin: 0 0 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* Lightbox admin */
.admin-lightbox {
  position: fixed; inset: 0; background: rgba(15, 16, 17, 0.95);
  display: none; align-items: center; justify-content: center; z-index: 110; padding: 16px;
}
.admin-lightbox.open { display: flex; }
.admin-lightbox img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: 8px; }
.admin-lightbox .close { position: absolute; top: 16px; right: 16px; }

/* Toast */
#toast-area { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--bp-anthracite);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--bp-shadow-lg);
  max-width: 340px;
  animation: toastIn 0.18s ease;
}
.toast.ok { background: var(--bp-success); }
.toast.err { background: var(--bp-danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Empty state */
.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--bp-muted);
}
.empty .e-icon { font-size: 46px; margin-bottom: 8px; }
.empty .e-title { font-size: 16px; font-weight: 700; color: var(--bp-anthracite); margin-bottom: 4px; }

/* Spinner */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.dark { border-color: rgba(42, 44, 46, 0.2); border-top-color: var(--bp-anthracite); }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #eceef0 25%, #f4f5f6 37%, #eceef0 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
  border-radius: 8px;
}
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.hidden { display: none !important; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.text-muted { color: var(--bp-muted); }
.mt-2 { margin-top: 14px; }
.mb-2 { margin-bottom: 14px; }
.small { font-size: 12.5px; }

/* Responsive */
@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--bp-shadow-lg);
  }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .mobile-menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 17px; }
}

.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  z-index: 39; display: none;
}
.overlay.open { display: block; }

/* ===================== Galerías de cliente ===================== */
.proof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 220px));
  gap: 12px;
}
.proof-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #e9eaec;
  border: 2px solid transparent;
  aspect-ratio: 1 / 1;
}
.proof-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.proof-item.decision-approved { border-color: var(--bp-success); }
.proof-item.decision-rejected { border-color: var(--bp-danger); }
.proof-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.proof-tag.approved { background: var(--bp-success); }
.proof-tag.rejected { background: var(--bp-danger); }
.proof-note-flag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(42, 44, 46, 0.85);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
}
.proof-message {
  margin-top: 12px;
  padding: 12px 14px;
  background: #fafafb;
  border-left: 3px solid var(--bp-pink);
  border-radius: 8px;
  font-size: 14px;
  color: var(--bp-anthracite);
  white-space: pre-wrap;
}
