/* ============================================================
   ARKWUA — Panel Admin (Brand CSS)
   Mismo sistema visual del panel de referencia (sidebar, cards,
   tablas, badges, dropdown de usuario) adaptado a la paleta
   Arkwua: Rojo #C8102E · Negro #14141A · Blanco.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root{
  --red:         #C8102E;
  --red-bright:  #E2173A;
  --red-dark:    #7A0C1E;
  --red-pale:    #FBEAEC;
  --red-light:   #FCE4E7;
  --cream:       #F7F7F8;
  --white:       #FFFFFF;
  --ink:         #14141A;
  --text:        #14141A;
  --mid:         #6B6B70;
  --soft:        #96969B;
  --border:      #E5E5E8;
  --border-dk:   #CFCFD3;
  --sidebar-bg:  #14141A;
  --sidebar-w:   260px;
  --r:           10px;
  --r-lg:        16px;
  --green:       #1E8A4C;
  --amber:       #A56A13;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --shadow-red:  0 4px 16px rgba(200,16,46,.22);
  --f-display:   'Oswald', 'Arial Narrow', sans-serif;
  --f-body:      'Inter', system-ui, sans-serif;
}

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

html,body{ scrollbar-width:thin; scrollbar-color:var(--border-dk) transparent; }
::-webkit-scrollbar{ width:6px; background:transparent; }
::-webkit-scrollbar-thumb{ background:var(--border-dk); border-radius:10px; }

body{
  font-family:var(--f-body);
  background:var(--cream);
  color:var(--text);
  font-size:14px;
  display:flex;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}

a{ color:inherit; }

/* ---------- Sidebar ---------- */
.sidebar{
  width:var(--sidebar-w); background:var(--sidebar-bg); color:#fff;
  display:flex; flex-direction:column; flex-shrink:0;
  position:sticky; top:0; height:100vh; overflow-y:auto; z-index:100;
}
.sidebar-logo{
  padding:22px 20px; border-bottom:1px solid rgba(255,255,255,.08);
  display:flex; align-items:center; justify-content:center;
}
.sidebar-logo img{ height:30px; width:auto; display:block; }
.sidebar-logo .fallback-mark{
  font-family:var(--f-display); font-weight:700; letter-spacing:.14em;
  font-size:16px; text-transform:uppercase; color:#fff; text-align:center; line-height:1.3;
}
.sidebar-logo .fallback-mark span{ color:var(--red-bright); display:block; font-size:10px; letter-spacing:.2em; font-weight:500; }

.nav-section{ font-size:10px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:#6b6b74; padding:16px 20px 6px; }
.nav-item{
  display:flex; align-items:center; gap:10px; padding:10px 20px;
  color:#c7c7cc; text-decoration:none; transition:all .15s;
  border-left:3px solid transparent; font-size:13.5px;
}
.nav-item svg{ flex-shrink:0; opacity:.85; }
.nav-item:hover{ background:rgba(255,255,255,.06); color:#fff; }
.nav-item.active{ background:rgba(226,23,58,.14); color:#fff; border-left-color:var(--red-bright); font-weight:600; }
.nav-item.active svg{ opacity:1; color:var(--red-bright); }
.sidebar-footer{ padding:16px 20px; border-top:1px solid rgba(255,255,255,.08); font-size:11.5px; color:#8a8a90; margin-top:auto; }

/* ---------- Main / Topbar ---------- */
.main{ flex:1; display:flex; flex-direction:column; min-width:0; }
.topbar{
  background:var(--white); border-bottom:1px solid var(--border); padding:0 28px; height:58px;
  display:flex; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:50;
}
.topbar-title{ font-family:var(--f-display); font-weight:600; font-size:17px; letter-spacing:.01em; }
.topbar-title p{ font-family:var(--f-body); font-weight:400; font-size:11.5px; color:var(--mid); margin-top:1px; }
.mob-menu-btn{ display:none; background:none; border:none; cursor:pointer; padding:6px; }

.content{ padding:28px; flex:1; }
.content-flush{ padding:0 !important; }
.content-flush .chats-shell{ border-radius:0; border-left:none; border-right:none; border-bottom:none; height:calc(100vh - 58px); }
.page-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; gap:16px; flex-wrap:wrap; }
.page-header h1{ font-family:var(--f-display); font-weight:600; font-size:26px; color:var(--ink); }
.page-header p{ color:var(--mid); font-size:13px; margin-top:3px; }

/* ---------- User avatar dropdown ---------- */
.avatar-wrap{ position:relative; cursor:pointer; flex-shrink:0; }
.avatar{
  width:38px; height:38px; min-width:38px; border-radius:50%; background:var(--red);
  color:#fff; display:flex; align-items:center; justify-content:center;
  font-family:var(--f-display); font-weight:600; font-size:13px; letter-spacing:.02em;
  overflow:hidden; line-height:1;
}
.avatar.has-photo{ background:transparent; }
.avatar img{ width:100%; height:100%; object-fit:cover; border-radius:50%; display:block; }
.avatar-wrap:hover .avatar{ box-shadow:0 0 0 4px rgba(200,16,46,.18); }

/* ---------- Confirmación con estilo propio (reemplaza confirm() del navegador) ---------- */
.confirm-bg{ position:fixed; inset:0; background:rgba(20,20,26,.55); display:flex; align-items:center; justify-content:center; z-index:1200; padding:20px; opacity:0; transition:opacity .18s; }
.confirm-bg.open{ opacity:1; }
.confirm-box{ background:#fff; border-radius:14px; width:100%; max-width:360px; box-shadow:0 20px 60px rgba(0,0,0,.28); padding:26px 26px 20px; text-align:center; transform:translateY(8px) scale(.98); transition:transform .18s; }
.confirm-bg.open .confirm-box{ transform:translateY(0) scale(1); }
.confirm-icon{ width:44px; height:44px; border-radius:50%; background:var(--red-pale); color:var(--red); display:flex; align-items:center; justify-content:center; margin:0 auto 14px; }
.confirm-icon.danger{ background:var(--red-pale); color:var(--red); }
.confirm-msg{ font-size:14px; color:var(--text); line-height:1.5; margin-bottom:20px; }
.confirm-actions{ display:flex; gap:10px; justify-content:center; }
.confirm-actions .btn{ flex:1; }
.btn-danger{ background:var(--red); color:#fff; border:1.5px solid var(--red); }
.btn-danger:hover{ background:var(--red-dark); border-color:var(--red-dark); }
.admin-pager{ display:flex; align-items:center; justify-content:center; gap:6px; padding:18px; flex-wrap:wrap; }
.admin-pager a{ min-width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; border:1.5px solid var(--border); border-radius:8px; font-size:12.5px; font-weight:600; color:var(--text); text-decoration:none; }
.admin-pager a:hover{ border-color:var(--red); color:var(--red); }
.admin-pager a.active{ background:var(--red); border-color:var(--red); color:#fff; }
.admin-pager a.disabled{ opacity:.35; pointer-events:none; }
.admin-pager-dots{ color:var(--soft); padding:0 2px; }
.user-dropdown{
  position:absolute; top:calc(100% + 10px); right:0; width:230px; background:#fff; border-radius:14px;
  box-shadow:0 12px 40px rgba(0,0,0,.18); border:1px solid var(--border);
  opacity:0; pointer-events:none; transform:translateY(-8px) scale(.97);
  transition:all .18s cubic-bezier(.34,1.56,.64,1); z-index:500; overflow:hidden;
}
.user-dropdown.open{ opacity:1; pointer-events:all; transform:none; }
.dd-header{ display:flex; align-items:center; gap:12px; padding:16px; background:var(--red-pale); border-bottom:1px solid var(--border); }
.dd-name{ font-weight:700; font-size:14px; color:var(--ink); line-height:1.2; }
.dd-role{ font-size:11px; color:var(--mid); margin-top:2px; }
.dd-divider{ height:1px; background:var(--border); margin:4px 0; }
.dd-item{ display:flex; align-items:center; gap:10px; padding:10px 16px; font-size:13px; text-decoration:none; transition:background .15s,color .15s; }
.dd-item:hover{ background:var(--red-pale); color:var(--red-dark); }
.dd-item.danger{ color:#C0392B; }
.dd-item.danger:hover{ background:rgba(192,57,43,.08); }

/* ---------- Stats ---------- */
.stats-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:14px; margin-bottom:26px; }
.stat-card{ background:var(--white); border:1px solid var(--border); border-radius:var(--r); padding:20px 20px 16px; }
.stat-label{ font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--mid); font-weight:600; margin-bottom:8px; }
.stat-value{ font-family:var(--f-display); font-weight:700; font-size:30px; color:var(--ink); line-height:1; }
.stat-sub{ font-size:11px; color:var(--mid); margin-top:4px; }
.stat-card.highlight{ background:var(--red); border-color:var(--red-dark); }
.stat-card.highlight .stat-label,.stat-card.highlight .stat-value,.stat-card.highlight .stat-sub{ color:#fff; }

/* ---------- Cards / tables ---------- */
.card{ background:var(--white); border:1px solid var(--border); border-radius:var(--r); margin-bottom:24px; }
.card-header{ padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.card-header h3{ font-weight:600; font-size:14.5px; color:var(--ink); font-family:var(--f-display); letter-spacing:.01em; }
.card-body{ padding:20px; }

table{ width:100%; border-collapse:collapse; }
thead th{ font-size:10.5px; letter-spacing:.07em; text-transform:uppercase; color:var(--mid); font-weight:600; padding:10px 16px; border-bottom:1px solid var(--border); text-align:left; background:#FAFAFA; }
tbody td{ padding:12px 16px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:middle; }
tbody tr:last-child td{ border-bottom:none; }
tbody tr:hover{ background:#FAFAFA; }
.table-wrap{ overflow-x:auto; }

/* ---------- Buttons ---------- */
.btn{ display:inline-flex; align-items:center; gap:6px; padding:9px 16px; border-radius:7px; border:none; cursor:pointer; font-family:inherit; font-size:13px; font-weight:600; transition:all .15s; text-decoration:none; white-space:nowrap; }
.btn-primary{ background:var(--red); color:#fff; }
.btn-primary:hover{ background:var(--red-dark); }
.btn-dark{ background:var(--ink); color:#fff; }
.btn-dark:hover{ background:#000; }
.btn-sm{ padding:6px 11px; font-size:12px; }
.btn-outline{ background:transparent; border:1.5px solid var(--border-dk); color:var(--text); }
.btn-outline:hover{ border-color:var(--red); color:var(--red); }
.btn-ghost{ background:transparent; color:var(--mid); }
.btn-ghost:hover{ color:var(--ink); }
.btn-danger{ background:#FEECEC; color:#C0392B; }
.btn-danger:hover{ background:#fbd7d7; }
.btn-block{ width:100%; justify-content:center; }
.icon-btn{ width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center; border-radius:7px; border:1px solid var(--border); background:#fff; cursor:pointer; color:var(--mid); }
.icon-btn:hover{ border-color:var(--red); color:var(--red); }

/* ---------- Forms ---------- */
.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-grid.cols-3{ grid-template-columns:1fr 1fr 1fr; }
label.field{ display:block; font-size:12.5px; font-weight:600; color:var(--ink); margin-bottom:14px; }
label.field span.req{ color:var(--red); }
.field input[type=text],.field input[type=email],.field input[type=tel],.field input[type=number],
.field input[type=password],.field input[type=date],.field input[type=datetime-local],
.field textarea{
  width:100%; border:1.5px solid var(--border); border-radius:8px; padding:10px 12px; margin-top:6px;
  font-family:inherit; font-size:13.5px; background:#fff; color:var(--text); transition:border-color .15s;
}
.field select{
  width:100%; border:1.5px solid var(--border); border-radius:8px; padding:10px 12px; margin-top:6px;
  font-family:inherit; font-size:13.5px; color:var(--text); transition:border-color .15s;
}
.field input:focus,.field select:focus,.field textarea:focus{ outline:none; border-color:var(--red); }
.field textarea{ resize:vertical; }
.checkbox-field{ display:flex; align-items:center; gap:8px; font-size:13px; margin-bottom:14px; }
.checkbox-field input{ width:auto; accent-color:var(--red); }

/* ---------- Quitar flechitas de subir/bajar en inputs numéricos ---------- */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button{ -webkit-appearance:none; margin:0; }
input[type=number]{ -moz-appearance:textfield; appearance:textfield; }

/* ---------- Select: flecha propia, sin el borde azul nativo del navegador ----------
   IMPORTANTE: estas propiedades van TODAS juntas en la misma regla (con !important
   en las que importan) para que ninguna otra regla con especificidad mayor (como
   ".field select") pueda anular el background y dejar el select sin flecha. ---------- */
select, .field select{
  -webkit-appearance:none !important; -moz-appearance:none !important; appearance:none !important;
  background-color:#fff !important;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236B6B70' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") !important;
  background-repeat:no-repeat !important; background-position:right 12px center !important; background-size:11px 7px !important;
  padding-right:34px !important; cursor:pointer;
}
select::-ms-expand{ display:none; }
select:focus, .field select:focus{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23C8102E' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") !important;
  background-repeat:no-repeat !important; background-position:right 12px center !important; background-size:11px 7px !important;
}

/* ---------- Botón "Seleccionar archivo" propio ---------- */
input[type=file]{
  font-family:inherit; font-size:12.5px; color:var(--mid); max-width:100%;
}
input[type=file]::file-selector-button{
  font-family:inherit; font-size:12.5px; font-weight:600; color:var(--text);
  background:#fff; border:1.5px solid var(--border-dk); border-radius:8px; padding:9px 16px;
  margin-right:12px; cursor:pointer; transition:border-color .15s, color .15s, background .15s;
}
input[type=file]::file-selector-button:hover{ border-color:var(--red); color:var(--red); background:var(--red-pale); }

/* ---------- Badges ---------- */
.badge{ display:inline-flex; align-items:center; gap:4px; padding:3px 11px; font-size:11px; font-weight:600; border-radius:999px; background:#EFEFF1; color:var(--mid); }
.badge-green{ background:#EAF5EE; color:var(--green); }
.badge-amber{ background:#FFF8E7; color:var(--amber); }
.badge-red{ background:#FEECEC; color:#C0392B; }
.badge-blue{ background:#EAF3FF; color:#1565C0; }
.badge-dark{ background:#EDEDEF; color:var(--ink); }

/* ---------- Flash messages ---------- */
.flash{ padding:12px 16px; border-radius:8px; margin-bottom:20px; font-size:13.5px; font-weight:500; }
.flash-ok{ background:#EAF5EE; border:1px solid var(--green); color:#1e6b3c; }
.flash-err{ background:#FEECEC; border:1px solid var(--red); color:var(--red-dark); }

/* ---------- Image upload ---------- */
.image-upload{ display:flex; gap:16px; align-items:center; justify-content:center; flex-wrap:wrap; text-align:center; }
.image-upload > div{ display:flex; flex-direction:column; align-items:center; }
.image-upload .preview{
  width:120px; height:120px; border-radius:10px; border:1.5px dashed var(--border-dk); background:#FAFAFA;
  display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; color:var(--soft); font-size:11px; text-align:center; position:relative;
  cursor:pointer; transition:border-color .15s;
}
.image-upload .preview:hover{ border-color:var(--red); }
.image-upload .preview img{ width:100%; height:100%; object-fit:cover; }
.image-upload .preview.preview-circle{ border-radius:50%; border:2px solid var(--border-dk); background:linear-gradient(135deg,#F0F0F2,#FAFAFA); }
.image-upload .preview.preview-circle img{ border-radius:50%; }
.image-upload .preview-hint{
  position:absolute; inset:auto 0 0 0; background:rgba(20,20,26,.72); color:#fff;
  font-size:9.5px; font-weight:600; text-align:center; padding:5px 2px; opacity:0; transition:opacity .15s; pointer-events:none;
}
.image-upload .preview.preview-circle .preview-hint{ inset:auto 0 8px 0; border-radius:0 0 999px 999px; padding:5px 2px 3px; }
.image-upload .preview:hover .preview-hint{ opacity:1; }
.image-upload input[type=file]{ display:none; }
.image-upload-caption{ font-size:11px; color:var(--mid); margin-top:8px; }
.gallery-grid{ display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }
.gallery-item{ width:88px; height:88px; border-radius:8px; overflow:hidden; position:relative; border:1px solid var(--border); }
.gallery-item img{ width:100%; height:100%; object-fit:cover; }
.gallery-item .rm{ position:absolute; top:3px; right:3px; width:20px; height:20px; background:rgba(20,20,26,.75); color:#fff; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; cursor:pointer; border:none; }

/* ---------- Modal ---------- */
.modal-bg{ position:fixed; inset:0; background:rgba(20,20,26,.55); display:none; align-items:center; justify-content:center; z-index:1000; padding:20px; }
.modal-bg.open{ display:flex; }
.modal-box{ background:#fff; border-radius:14px; width:100%; max-width:560px; max-height:90vh; overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,.25); }
.modal-box-header{ padding:18px 22px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-box-header h3{ font-family:var(--f-display); font-size:17px; }
.modal-box-body{ padding:22px; }
.modal-box .close-x{ background:none; border:none; cursor:pointer; color:var(--mid); font-size:20px; line-height:1; }

/* ---------- Empty state ---------- */
.empty-state{ text-align:center; padding:50px 20px; color:var(--mid); }
.empty-state svg{ opacity:.35; margin-bottom:12px; }

/* ---------- Pipeline / status timeline ---------- */
.timeline{ position:relative; padding-left:24px; }
.timeline::before{ content:''; position:absolute; left:6px; top:4px; bottom:4px; width:2px; background:var(--border); }
.timeline-item{ position:relative; padding-bottom:18px; }
.timeline-item::before{ content:''; position:absolute; left:-24px; top:2px; width:11px; height:11px; border-radius:50%; background:var(--red); border:2px solid #fff; box-shadow:0 0 0 1px var(--border-dk); }
.timeline-item b{ font-size:13px; }
.timeline-item span{ display:block; font-size:11.5px; color:var(--mid); margin-top:2px; }

@media (max-width:900px){
  .sidebar{ position:fixed; left:-280px; transition:left .25s; box-shadow:0 0 40px rgba(0,0,0,.3); }
  .sidebar.open{ left:0; }
  .mob-menu-btn{ display:flex; align-items:center; }
  .content{ padding:18px; }
  .form-grid,.form-grid.cols-3{ grid-template-columns:1fr; }
  #mob-overlay.open{ display:block; position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:99; }
}
#mob-overlay{ display:none; }
