*{box-sizing:border-box; margin:0; padding:0;}
body{font-family:'Poppins', Arial, sans-serif; background:#F3F1FA; color:#222; line-height:1.5;}
a{color:inherit;}
.wrap{max-width:1000px; margin:0 auto; padding:30px 20px;}
.wrap-wide{max-width:1160px;}

.layout{display:flex; align-items:stretch; min-height:100vh;}
.sidebar{width:230px; flex-shrink:0; background:linear-gradient(180deg,#6A2FE0,#4B1FA8); color:#fff; display:flex; flex-direction:column; padding:28px 0;}
.sidebar-logo{padding:0 24px 28px; text-align:center;}
.sidebar-logo img{max-width:150px; width:100%; height:auto;}
.sidebar-nav{display:flex; flex-direction:column; flex:1;}
.sidebar-nav a{color:#fff; text-decoration:none; font-weight:600; font-size:14px; padding:14px 24px; opacity:.75; border-left:4px solid transparent; transition:opacity .15s, background .15s;}
.sidebar-nav a:hover{opacity:1; background:rgba(255,255,255,.08);}
.sidebar-nav a.active{opacity:1; background:rgba(255,255,255,.12); border-left-color:#3DFF3D;}
.sidebar-logout{margin:20px 24px 0; text-align:center; color:#fff; text-decoration:none; font-weight:700; font-size:13px; background:rgba(255,255,255,.15); padding:10px 16px; border-radius:20px;}
.sidebar-logout:hover{background:rgba(255,255,255,.25);}
.main{flex:1; min-width:0;}

h1{font-size:24px; margin-bottom:20px; color:#4B1FA8;}

.card{background:#fff; border-radius:12px; padding:24px; box-shadow:0 2px 10px rgba(0,0,0,.06); margin-bottom:24px;}

table{width:100%; border-collapse:collapse; background:#fff; border-radius:12px; overflow:hidden;}
th, td{padding:12px 14px; text-align:left; border-bottom:1px solid #eee; font-size:14px;}
th{background:#F3F1FA; color:#4B1FA8; font-weight:700;}
tr:last-child td{border-bottom:none;}

.badge{display:inline-block; padding:4px 12px; border-radius:20px; font-size:12px; font-weight:700;}
.badge-pendiente{background:#FFE9B0; color:#8A5B00;}
.badge-contactado{background:#D8F5D0; color:#1E7A0A;}
.badge-publicado{background:#D8F5D0; color:#1E7A0A;}
.badge-borrador{background:#EEE; color:#666;}

.btn{display:inline-block; padding:8px 16px; border-radius:20px; border:none; font-weight:700; font-size:13px; cursor:pointer; text-decoration:none;}
.btn-purple{background:#6A2FE0; color:#fff;}
.btn-green{background:#3DFF3D; color:#0A2E0A;}
.btn-red{background:#FF5A5A; color:#fff;}
.btn:hover{opacity:.9;}

form.inline{display:inline;}

.login-page{min-height:100vh; display:flex;}

.login-brand{flex:1; position:relative; overflow:hidden; background:linear-gradient(160deg,#6A2FE0,#4B1FA8); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px; padding:40px;}
.login-brand-glow{position:absolute; width:520px; height:520px; border-radius:50%; background:radial-gradient(circle, rgba(61,255,61,.25), transparent 70%); top:-120px; right:-160px;}
.login-brand-logo{position:relative; max-width:340px; width:70%; filter:drop-shadow(0 8px 24px rgba(0,0,0,.25));}
.login-brand-tag{position:relative; color:#fff; opacity:.85; font-size:15px; font-weight:600; letter-spacing:.3px;}

.login-form-side{flex:1; display:flex; align-items:center; justify-content:center; background:#F3F1FA; padding:20px;}
.login-box{max-width:380px; width:100%; background:#fff; padding:44px 40px; border-radius:20px; box-shadow:0 10px 40px rgba(0,0,0,.08);}
.login-box h1{font-size:24px; margin-bottom:6px;}
.login-sub{color:#777; font-size:14px; margin-bottom:24px;}
.login-label{display:block; font-size:13px; font-weight:700; color:#4B1FA8; margin-bottom:6px;}
.login-box input{width:100%; padding:12px 14px; margin-bottom:18px; border:1px solid #ddd; border-radius:10px; font-size:14px; font-family:inherit;}
.login-box input:focus{outline:none; border-color:#6A2FE0; box-shadow:0 0 0 3px rgba(106,47,224,.12);}
.login-submit{width:100%; padding:13px; font-size:14px; border-radius:10px;}

@media (max-width: 820px) {
  .login-page{flex-direction:column;}
  .login-brand{padding:36px 20px; min-height:220px;}
  .login-brand-logo{width:200px;}
}

@media (max-width: 480px) {
  .login-box{padding:32px 24px;}
}
.error{background:#FFE1E1; color:#B00020; padding:10px 14px; border-radius:8px; margin-bottom:16px; font-size:14px;}

.form-grid{display:grid; gap:14px; max-width:520px;}
.form-grid label{font-weight:600; font-size:14px; margin-bottom:4px; display:block;}
.form-grid input[type=text], .form-grid textarea, .form-grid input[type=number], .form-grid input[type=file]{
  width:100%; padding:10px 12px; border:1px solid #ddd; border-radius:8px; font-size:14px; font-family:inherit;
}
.form-grid textarea{min-height:100px;}

.thumb{width:60px; height:60px; object-fit:cover; border-radius:8px;}

.actions{display:flex; gap:8px; flex-wrap:wrap;}
.topbar-title{display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; gap:16px; flex-wrap:wrap;}

.product-grid-admin{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:20px;}
.product-card-admin{background:#fff; border-radius:16px; overflow:hidden; box-shadow:0 2px 10px rgba(0,0,0,.06); display:flex; flex-direction:column; transition:transform .15s, box-shadow .15s;}
.product-card-admin:hover{transform:translateY(-4px); box-shadow:0 8px 24px rgba(106,47,224,.18);}
.product-card-admin-img{position:relative; aspect-ratio:4/3; background:#F3F1FA;}
.product-card-admin-img img{width:100%; height:100%; object-fit:cover; display:block;}
.product-card-admin-img .badge{position:absolute; top:10px; right:10px;}
.product-card-admin-body{padding:16px; flex:1;}
.product-card-admin-body h3{font-size:15px; color:#4B1FA8; margin-bottom:6px;}
.product-card-admin-body p{font-size:13px; color:#555; margin-bottom:8px;}
.orden-tag{font-size:11px; font-weight:700; color:#8A6FE0; background:#F0EBFF; padding:3px 10px; border-radius:12px;}
.product-card-admin-actions{display:flex; gap:6px; flex-wrap:wrap; padding:0 16px 16px;}
.product-card-admin-actions .btn{padding:7px 12px; font-size:12px;}

dialog#modal-producto, dialog#modal-usuario{border:none; border-radius:16px; padding:28px; width:100%; max-width:520px; box-shadow:0 10px 40px rgba(0,0,0,.3); position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); margin:0; max-height:85vh; overflow-y:auto;}
dialog#modal-producto::backdrop, dialog#modal-usuario::backdrop{background:rgba(20,10,40,.55);}
.modal-header{display:flex; align-items:center; justify-content:space-between; margin-bottom:18px;}
.modal-header h2{font-size:18px; color:#4B1FA8;}
.modal-close{background:none; border:none; font-size:24px; line-height:1; cursor:pointer; color:#888; padding:0;}
.modal-close:hover{color:#222;}

.stat-row{display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom:24px;}
.stat-tile{background:#fff; border-radius:16px; padding:20px 22px; box-shadow:0 2px 10px rgba(0,0,0,.06); border-top:4px solid #6A2FE0; display:flex; flex-direction:column; gap:4px;}
.stat-tile-pendiente{border-top-color:#E0A400;}
.stat-tile-contactado{border-top-color:#1E9C4A;}
.stat-number{font-size:32px; font-weight:800; color:#1a1a2e;}
.stat-label{font-size:13px; color:#777; font-weight:600;}

.inbox-toolbar{display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-bottom:18px;}
.filter-tabs{display:flex; gap:6px; background:#fff; padding:4px; border-radius:24px; box-shadow:0 2px 8px rgba(0,0,0,.05);}
.filter-tab{border:none; background:none; padding:8px 18px; border-radius:20px; font-size:13px; font-weight:700; color:#666; cursor:pointer;}
.filter-tab:hover{color:#4B1FA8;}
.filter-tab.active{background:#6A2FE0; color:#fff;}
.inbox-search{padding:10px 16px; border-radius:20px; border:1px solid #ddd; font-size:14px; font-family:inherit; min-width:240px; background:#fff;}

.msg-list{display:flex; flex-direction:column; gap:12px;}
.msg-card{background:#fff; border-radius:16px; padding:18px 20px; box-shadow:0 2px 10px rgba(0,0,0,.05); display:flex; gap:16px; align-items:flex-start; transition:box-shadow .15s;}
.msg-card:hover{box-shadow:0 6px 20px rgba(106,47,224,.12);}
.msg-avatar{width:44px; height:44px; border-radius:50%; background:linear-gradient(135deg,#6A2FE0,#8A5BFF); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:14px; flex-shrink:0;}
.msg-body{flex:1; min-width:0;}
.msg-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:4px;}
.msg-name{font-weight:700; color:#1a1a2e; font-size:15px;}
.msg-time{font-size:12px; color:#999; margin-left:auto;}
.msg-contact{font-size:12px; color:#888; display:flex; gap:8px; margin-bottom:8px;}
.msg-text{font-size:14px; color:#444;}
.msg-actions{flex-shrink:0;}
.btn-outline{background:#fff; color:#6A2FE0; border:1.5px solid #6A2FE0;}

.empty-filter{text-align:center; color:#888; padding:30px; font-size:14px;}

@media (max-width: 640px) {
  .msg-card{flex-direction:column;}
  .msg-time{margin-left:0;}
}

.dash-hero{margin-bottom:24px;}
.dash-hero h1{margin-bottom:4px;}
.dash-hero p{color:#777; font-size:14px;}

.quick-links{display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; margin-top:8px;}
.quick-card{background:#fff; border-radius:16px; padding:22px; box-shadow:0 2px 10px rgba(0,0,0,.06); text-decoration:none; color:inherit; display:flex; flex-direction:column; gap:6px; transition:transform .15s, box-shadow .15s;}
.quick-card:hover{transform:translateY(-4px); box-shadow:0 8px 24px rgba(106,47,224,.18);}
.quick-icon{font-size:26px;}
.quick-title{font-weight:700; font-size:15px; color:#1a1a2e;}
.quick-desc{font-size:13px; color:#777;}

.user-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px;}
.user-card{background:#fff; border-radius:16px; padding:20px; box-shadow:0 2px 10px rgba(0,0,0,.06); display:flex; flex-direction:column; align-items:center; text-align:center; gap:10px; transition:transform .15s, box-shadow .15s;}
.user-card:hover{transform:translateY(-4px); box-shadow:0 8px 24px rgba(106,47,224,.18);}
.user-avatar{width:56px; height:56px; font-size:16px;}
.user-card-name{font-weight:700; color:#1a1a2e; font-size:15px;}
.user-card-date{font-size:12px; color:#888;}
.user-card-actions{display:flex; gap:8px;}
.user-card-actions form{display:inline;}
.user-card-actions .btn{padding:7px 14px; font-size:12px;}

@media (max-width: 768px) {
  .layout{flex-direction:column; min-height:0;}
  .sidebar{width:100%; flex-direction:row; align-items:center; padding:12px 16px; gap:14px; position:sticky; top:0; z-index:10;}
  .sidebar-logo{padding:0; flex-shrink:0;}
  .sidebar-logo img{max-width:80px;}
  .sidebar-nav{flex-direction:row; flex:1; overflow-x:auto; gap:2px; -webkit-overflow-scrolling:touch;}
  .sidebar-nav a{padding:8px 12px; white-space:nowrap; border-left:none; border-bottom:3px solid transparent; border-radius:8px 8px 0 0;}
  .sidebar-nav a.active{border-left-color:transparent; border-bottom-color:#3DFF3D;}
  .sidebar-logout{margin:0; flex-shrink:0; padding:8px 12px; font-size:12px;}

  .wrap, .wrap-wide{padding:20px 14px;}
  h1{font-size:20px;}

  .topbar-title{flex-direction:column; align-items:flex-start;}
  .topbar-title .btn{width:100%; text-align:center;}

  .stat-row{grid-template-columns:repeat(2,1fr); gap:10px;}
  .stat-tile{padding:14px 16px;}
  .stat-number{font-size:24px;}

  .inbox-toolbar{flex-direction:column; align-items:stretch;}
  .filter-tabs{justify-content:space-between;}
  .filter-tab{flex:1; text-align:center; padding:8px 6px;}
  .inbox-search{min-width:0; width:100%;}

  .msg-card{flex-direction:column;}
  .msg-time{margin-left:0;}
  .msg-actions{width:100%;}
  .msg-actions .btn{width:100%; text-align:center;}

  .product-grid-admin, .user-grid, .quick-links{grid-template-columns:1fr 1fr;}

  .product-card-admin-actions, .user-card-actions{flex-direction:column;}
  .product-card-admin-actions .btn, .user-card-actions .btn{width:100%; text-align:center;}

  dialog#modal-producto, dialog#modal-usuario{width:92vw; padding:22px; max-height:90vh;}

  table{display:block; overflow-x:auto; white-space:nowrap;}
}

@media (max-width: 460px) {
  .stat-row{grid-template-columns:1fr;}
  .product-grid-admin, .user-grid, .quick-links{grid-template-columns:1fr;}
}
