:root{
    --primary:#1a1a1a;--accent:#c9a227;--bg:#f4f3f0;--card:#fff;--border:#e3e0d8;--muted:#6b6b6b;
  }
  *{box-sizing:border-box;}
  body{margin:0;font-family:'Segoe UI',Arial,sans-serif;background:var(--bg);color:#1a1a1a;}
  .hidden{display:none !important;}
  .creativos-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:18px;margin-top:14px;}
  .creativo-card{background:var(--card);border:1px solid var(--border);border-radius:14px;padding:14px;}
  .creativo-card canvas{width:100%;border-radius:10px;display:block;margin-bottom:10px;background:#eee;}
  .creativo-card textarea{width:100%;min-height:110px;font-family:inherit;font-size:.82rem;padding:8px;border:1px solid var(--border);border-radius:8px;resize:vertical;}
  .creativo-card .angle-label{font-size:.75rem;font-weight:700;color:var(--accent);text-transform:uppercase;letter-spacing:.03em;margin-bottom:6px;}
  .creativo-card .creativo-actions{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap;}
  .creativo-photo-thumbs{display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
  .creativo-photo-thumbs img{width:56px;height:56px;object-fit:cover;border-radius:8px;cursor:pointer;border:2px solid transparent;opacity:.75;}
  .creativo-photo-thumbs img:hover{opacity:1;}
  .creativo-photo-thumbs img.selected{border-color:var(--accent);opacity:1;}

  /* Login */
  #loginScreen{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;}
  .login-card{background:#fff;padding:36px 32px;border-radius:16px;max-width:360px;width:100%;box-shadow:0 10px 30px rgba(0,0,0,.08);}
  .login-card h1{font-size:1.3rem;margin-bottom:4px;}
  .login-card p{color:var(--muted);font-size:.85rem;margin-top:0;}
  .login-card input{width:100%;padding:11px 12px;border:1px solid var(--border);border-radius:8px;margin-bottom:12px;font-size:.9rem;}
  .login-card button{width:100%;padding:12px;border:none;border-radius:8px;background:var(--primary);color:#fff;font-weight:600;cursor:pointer;}
  .toggle-link{text-align:center;margin-top:12px;font-size:.83rem;color:var(--accent);cursor:pointer;}
  #loginError{color:#c0392b;font-size:.82rem;margin-bottom:8px;min-height:1em;}

  /* Layout */
  #appScreen{display:flex;min-height:100vh;}
  .mobile-topbar,.sidebar-backdrop{display:none;}
  nav{
    width:220px;background:var(--primary);color:#fff;flex-shrink:0;padding:20px 0;position:sticky;top:0;height:100vh;
  }
  nav .brand{padding:0 20px 18px;font-weight:700;border-bottom:1px solid rgba(255,255,255,.1);margin-bottom:10px;}
  nav .item{padding:12px 20px;cursor:pointer;font-size:.92rem;color:#ddd;}
  nav .item.active{background:rgba(255,255,255,.08);color:#fff;border-left:3px solid var(--accent);}
  nav .item:hover{color:#fff;}
  nav .logout{position:absolute;bottom:12px;padding:12px 20px;font-size:.85rem;color:#ccc;cursor:pointer;}
  main{flex:1;min-width:0;padding:26px 30px;max-width:1100px;}
  main h2{margin-top:0;}
  .toprow{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px;flex-wrap:wrap;gap:10px;}
  .btn{padding:10px 18px;border:none;border-radius:8px;background:var(--primary);color:#fff;font-weight:600;cursor:pointer;font-size:.88rem;}
  .btn.gold{background:var(--accent);color:#1a1a1a;}
  .btn.small{padding:6px 12px;font-size:.75rem; font-weight:600;}
  .btn.danger{background:#c0392b;color:#fff;}
  .btn.outline{background:#fff;border:1px solid var(--border);color:#1a1a1a;}

  table{width:100%;border-collapse:collapse;background:#fff;border-radius:10px;overflow:hidden;}
  th,td{padding:12px 14px;text-align:left;border-bottom:1px solid var(--border);font-size:.87rem;}
  th{background:#faf9f6;font-size:.78rem;text-transform:uppercase;color:var(--muted);}
  tr:last-child td{border-bottom:none;}
  .badge{padding:4px 10px;border-radius:999px;font-size:.75rem;font-weight:600;display:inline-block;}
  .badge.pendiente{background:#fff3cd;color:#856404;}
  .badge.confirmado{background:#d4edda;color:#155724;}
  .badge.despachado{background:#cce5ff;color:#004085;}
  .badge.entregado{background:#d1ecf1;color:#0c5460;}
  .badge.cancelado{background:#f8d7da;color:#721c24;}
  .badge.pagado{background:#d4edda;color:#155724;}
  .badge.no-grato{background:#f8d7da;color:#721c24;}

  .cards-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px;margin-bottom:20px;}
  .stat{background:#fff;border-radius:12px;padding:16px 18px;border:1px solid var(--border);}
  .stat .num{font-size:1.5rem;font-weight:700;}
  .stat .label{color:var(--muted);font-size:.8rem;}
  .live-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#2ecc71;box-shadow:0 0 0 rgba(46,204,113,.6);animation:live-pulse 1.8s infinite;}
  @keyframes live-pulse{
    0%{box-shadow:0 0 0 0 rgba(46,204,113,.6);}
    70%{box-shadow:0 0 0 7px rgba(46,204,113,0);}
    100%{box-shadow:0 0 0 0 rgba(46,204,113,0);}
  }
  @media (max-width:820px){ #dashTwoCol{grid-template-columns:1fr !important;} }

  @media (max-width:1024px){
    #appScreen{display:block;}
    .mobile-topbar{
      position:sticky;top:0;z-index:202;height:62px;padding:0 18px;background:var(--primary);color:#fff;
      border-bottom:2px solid var(--accent);display:flex;align-items:center;gap:14px;
    }
    .mobile-brand{font-size:1rem;font-weight:800;letter-spacing:.04em;}
    .mobile-brand span{color:var(--accent);}
    .menu-toggle{
      width:38px;height:38px;padding:0;border:1px solid rgba(255,255,255,.22);border-radius:9px;background:transparent;
      color:#fff;font-size:1.35rem;line-height:1;cursor:pointer;
    }
    .sidebar-backdrop{position:fixed;inset:0;z-index:203;background:rgba(0,0,0,.5);opacity:0;pointer-events:none;transition:opacity .2s;}
    #appScreen.sidebar-open .sidebar-backdrop{display:block;opacity:1;pointer-events:auto;}
    nav{
      position:fixed;z-index:204;top:0;left:0;width:min(290px,82vw);height:100dvh;padding-top:20px;
      box-shadow:10px 0 30px rgba(0,0,0,.22);transform:translateX(-105%);transition:transform .22s ease;
    }
    #appScreen.sidebar-open nav{transform:translateX(0);}
    nav .item{padding:14px 22px;font-size:.96rem;}
    nav .logout{margin-top:0;padding-top:20px;}
    main{width:100%;max-width:none;padding:24px;}
  }

  @media (max-width:560px){
    .mobile-topbar{height:56px;padding:0 14px;}
    main{padding:18px 14px 28px;overflow-x:auto;}
    .calc-card{padding:16px;}
    .cards-row{grid-template-columns:repeat(auto-fit,minmax(135px,1fr));gap:10px;}
    .stat{padding:14px;}
    .toprow .row-actions{width:100%;flex-wrap:wrap;}
    .toprow .row-actions .btn{flex:1;}
    .modal{padding:20px 18px;border-radius:12px;}
    .editor-frame-wrap{height:calc(100vh - 180px);min-height:360px;}
  }

  .overlay{position:fixed;inset:0;background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center;padding:16px;z-index:300;}
  .overlay.show{display:flex;}
  .modal{background:#fff;border-radius:14px;max-width:540px;width:100%;max-height:90vh;overflow-y:auto;padding:24px 26px;position:relative;}
  .modal-close{position:absolute;top:12px;right:16px;background:none;border:none;font-size:1.4rem;cursor:pointer;color:#888;}
  .modal label{display:block;font-size:.82rem;font-weight:600;margin:12px 0 4px;}
  .modal input,.modal select,.modal textarea{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:8px;font-size:.88rem;font-family:inherit;}
  .thumbs{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap;}
  .thumbs img{width:60px;height:60px;object-fit:cover;border-radius:8px;border:1px solid var(--border);}
  .row-actions{display:flex;gap:6px;}
  .order-detail{background:#faf9f6;border-radius:8px;padding:10px 12px;margin-top:8px;font-size:.85rem;}
  .toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#1a1a1a;color:#fff;padding:12px 20px;border-radius:999px;font-size:.87rem;display:none;z-index:200;}

  /* Calculadora de Rentabilidad */
  .calc-card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:20px 22px;margin-bottom:20px;}
  .calc-card h3{margin:0 0 2px;}
  .calc-sub{color:var(--muted);font-size:.85rem;margin:0 0 16px;}
  .calc-grid{display:grid;grid-template-columns:1fr 1fr;gap:26px;}
  @media(max-width:760px){.calc-grid{grid-template-columns:1fr;}}
  .calc-inputs label{display:block;font-size:.85rem;font-weight:600;margin:16px 0 4px;}
  .calc-inputs label:first-child{margin-top:0;}
  .calc-hint{display:block;font-weight:400;color:var(--muted);font-size:.78rem;margin-top:2px;}
  .calc-input-wrap{display:flex;align-items:center;gap:6px;border:1px solid var(--border);border-radius:8px;padding:0 10px;background:#fff;}
  .calc-input-wrap input{border:none;outline:none;padding:10px 0;font-size:.9rem;width:100%;font-family:inherit;}
  .calc-input-wrap input::-webkit-outer-spin-button,.calc-input-wrap input::-webkit-inner-spin-button{margin-left:6px;}
  .calc-results{background:#faf9f6;border-radius:10px;padding:18px 20px;height:fit-content;}
  .calc-headline{font-size:.95rem;font-weight:600;margin-bottom:16px;line-height:1.4;}
  .calc-metric{margin-bottom:16px;}
  .calc-metric:last-of-type{margin-bottom:0;}
  .calc-metric>span{display:block;font-size:.8rem;color:var(--muted);}
  .calc-metric b{font-size:1.2rem;}
  .calc-metric small{display:block;color:var(--muted);font-size:.76rem;margin-top:2px;}
  .calc-metric .btn{margin-top:8px;}
  #rcCompareTable th,#rcCompareTable td{white-space:nowrap;font-size:.83rem;}
  #rcCompareTable th span{color:#c0392b;font-weight:400;margin-left:4px;}

  /* Reportes */
  .rep-presets{display:flex;gap:8px;flex-wrap:wrap;}
  .field-sm{padding:9px 10px;border:1px solid var(--border);border-radius:8px;font-size:.85rem;font-family:inherit;background:#fff;}
  #repDailyTable th,#repDailyTable td,#adExpensesTable th,#adExpensesTable td{white-space:nowrap;font-size:.85rem;}

  /* Editor visual */
  .editor-frame-wrap{border:1px solid var(--border);border-radius:12px;overflow:hidden;background:#fff;height:calc(100vh - 230px);min-height:420px;}
  .editor-frame-wrap iframe{width:100%;height:100%;border:none;display:block;}
  #editModeBtn.active{background:#1c6b39;color:#fff;border-color:#1c6b39;}
  .editor-pending-bar{
    position:fixed;left:50%;bottom:22px;transform:translateX(-50%);
    background:#1a1a1a;color:#fff;padding:10px 14px;border-radius:12px;
    display:flex;align-items:center;gap:10px;box-shadow:0 8px 24px rgba(0,0,0,.25);z-index:500;font-size:.85rem;
  }
  .editor-pending-bar.hidden{display:none;}
  .editor-pending-bar .btn{padding:7px 12px;font-size:.8rem;}

  /* Alertas de cambio de estado de pedidos */
  #statusAlerts{position:fixed;top:16px;right:16px;z-index:600;display:flex;flex-direction:column;gap:8px;align-items:flex-end;}
  .status-alert-popup{
    background:#1a1a1a;color:#fff;padding:12px 16px;border-radius:10px;font-size:.85rem;
    box-shadow:0 8px 20px rgba(0,0,0,.25);opacity:0;transform:translateX(20px);transition:opacity .25s,transform .25s;max-width:280px;
  }
  .status-alert-popup.show{opacity:1;transform:translateX(0);}

  /* Carritos activos */
  .cart-card{background:#fff;border:1px solid var(--border,#e5e5e5);border-radius:12px;padding:14px;display:flex;flex-direction:column;gap:6px;}
  .cart-card .cc-top{display:flex;justify-content:space-between;align-items:baseline;gap:8px;}
  .cart-card .cc-name{font-weight:700;}
  .cart-card .cc-time{font-size:.76rem;color:var(--muted);}
  .cart-card .cc-items{font-size:.82rem;color:var(--muted);}
  .cart-card .cc-total{font-weight:800;}
  .carts-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:12px;align-items:stretch;}

  /* Notificaciones de stock */
  #stockNotifyBody td{font-size:.85rem;}

/* ================= TEMA MODERNO OSCURO / GLASS =================
   Inspirado en la referencia: fondo oscuro con glow dorado, paneles translúcidos,
   bordes suaves y navegación compacta para que el admin se sienta más actual e intuitivo. */
:root{
  --primary:#0b0b0a;
  --primary-soft:#151310;
  --accent:#ffd45a;
  --accent-2:#ff8a3d;
  --accent-dark:#b88316;
  --bg:#0b0b08;
  --card:rgba(27,25,19,.76);
  --card-solid:#17150f;
  --border:rgba(255,255,255,.12);
  --muted:#b5afa2;
  --text:#fff8ec;
  --text-strong:#ffffff;
  --danger:#ff5d5d;
  --success:#55d88a;
  --warning:#ffd45a;
  --info:#6bb9ff;
  --radius-lg:22px;
  --radius-md:16px;
  --shadow:0 24px 70px rgba(0,0,0,.34);
  --glass:linear-gradient(145deg,rgba(255,255,255,.12),rgba(255,255,255,.045));
}

html{background:#080806;}
body{
  font-family:Poppins,'Segoe UI',Arial,sans-serif;
  background:
    radial-gradient(circle at 16% 8%,rgba(34, 22, 0, 0.34),transparent 34%),
    radial-gradient(circle at 86% 12%,rgba(255,214,89,.16),transparent 30%),
    linear-gradient(135deg,#090907 0%,#16130c 46%,#090908 100%);
  color:var(--text);
  min-height:100vh;
}
body::before{
  content:"";position:fixed;inset:0;pointer-events:none;z-index:-1;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.02) 1px,transparent 1px);
  background-size:46px 46px;
  mask-image:linear-gradient(to bottom,rgba(0,0,0,.85),transparent 82%);
}

#loginScreen{
  background:
    radial-gradient(circle at 30% 10%,rgba(255,198,74,.38),transparent 38%),
    radial-gradient(circle at 80% 80%,rgba(255,138,61,.18),transparent 34%);
}
.login-card{
  background:var(--glass);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:26px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(22px);
}
.login-card h1{font-size:1.55rem;color:var(--text-strong);}
.login-card p{color:var(--muted);}
.login-card input,
.modal input,.modal select,.modal textarea,
.field-sm,
.calc-input-wrap{
  background:rgba(255,255,255,.075);
  color:var(--text);
  border-color:var(--border);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}
.login-card input::placeholder,
.modal input::placeholder,
.modal textarea::placeholder,
.field-sm::placeholder{color:rgba(255,248,236,.46);}
.login-card input:focus,
.modal input:focus,.modal select:focus,.modal textarea:focus,
.field-sm:focus{
  outline:none;border-color:rgba(255,212,90,.68);
  box-shadow:0 0 0 4px rgba(255,212,90,.12);
}
.login-card button,.btn{
  background:linear-gradient(135deg,var(--accent-2),var(--accent));
  color:#111;
  border:1px solid rgba(255,255,255,.1);
  border-radius:999px;
  font-weight:800;
  box-shadow:0 10px 24px rgba(255,165,57,.18);
  transition:transform .16s ease,box-shadow .16s ease,filter .16s ease,border-color .16s ease;
}
.login-card button:hover,.btn:hover{transform:translateY(-1px);box-shadow:0 14px 30px rgba(255,165,57,.25);}
.btn:active{transform:translateY(0) scale(.98);}
.btn.gold{background:linear-gradient(135deg,#ff8a3d,#ffe072);color:#111;}
.btn.outline{
  background:rgba(255,255,255,.07);
  color:var(--text);
  border:1px solid var(--border);
  box-shadow:none;
}
.btn.outline:hover{border-color:rgba(255,212,90,.7);background:rgba(255,212,90,.11);}
.btn.danger{background:linear-gradient(135deg,#c93939,#ff6b6b);color:#fff;}
.toggle-link{color:var(--accent);}
#loginError{color:#ff8a8a;}

#appScreen{background:transparent;}
nav{
  width:252px;
  background:linear-gradient(180deg,rgba(24,22,17,.96),rgba(10,10,9,.98));
  border-right:1px solid var(--border);
  box-shadow:18px 0 70px rgba(0,0,0,.28);
  backdrop-filter:blur(22px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.nav-links{flex:1;min-height:0;overflow-y:auto;scrollbar-width:thin;}
nav .brand{
  position:relative;
  margin:0 16px 16px;
  padding:14px 14px 18px 46px;
  border-bottom:1px solid var(--border);
  color:var(--text-strong);
  letter-spacing:.02em;
}
nav .brand::before{
  content:"B";
  position:absolute;left:0;top:8px;width:34px;height:34px;border-radius:12px;
  display:grid;place-items:center;
  background:linear-gradient(135deg,var(--accent-2),var(--accent));
  color:#111;font-weight:900;box-shadow:0 10px 28px rgba(255,183,57,.28);
}
nav .item{
  margin:4px 12px;
  padding:12px 14px;
  border:1px solid transparent;
  border-radius:16px;
  color:rgba(255,248,236,.72);
  transition:background .16s ease,color .16s ease,border-color .16s ease,transform .16s ease;
}
nav .item:hover{
  color:#fff;background:rgba(255,255,255,.07);border-color:rgba(255,255,255,.09);transform:translateX(2px);
}
nav .item.active{
  background:linear-gradient(135deg,rgba(255,138,61,.2),rgba(255,212,90,.14));
  color:#fff;border:1px solid rgba(255,212,90,.34);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 12px 28px rgba(0,0,0,.22);
}
nav .logout{
  position:static;
  flex-shrink:0;
  margin:0 12px;
  padding:12px 14px;border-radius:16px;color:rgba(255,248,236,.68);
}
nav .logout:hover{color:#fff;}

main{
  max-width:1280px;
  padding:34px;
}
main h2{
  color:var(--text-strong);
  font-size:clamp(1.55rem,2vw,2.15rem);
  letter-spacing:-.04em;
}
main h3{color:var(--text-strong);letter-spacing:-.02em;}
p, .calc-sub, .stat .label, .cart-card .cc-time, .cart-card .cc-items, .order-detail{color:var(--muted) !important;}
.toprow{align-items:flex-start;}

.stat,.calc-card,.creativo-card,.cart-card,.modal,table{
  background:var(--glass);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  backdrop-filter:blur(18px);
}
.stat,.calc-card,.creativo-card,.cart-card{border-radius:var(--radius-lg);}
.stat{
  position:relative;overflow:hidden;
  padding:20px;
}
.stat::before{
  content:"";position:absolute;inset:0 0 auto 0;height:3px;
  background:linear-gradient(90deg,var(--accent-2),var(--accent),transparent);
  opacity:.9;
}
.stat .num{
  color:var(--text-strong);
  font-size:1.8rem;
  letter-spacing:-.04em;
}
.cards-row{gap:18px;}

.calc-card{
  padding:24px;
  overflow:hidden;
}
.calc-card h3{font-size:1.05rem;}
.dashboard-lead{
  max-width:820px;
  margin:-10px 0 22px;
  padding:14px 16px;
  border:1px solid rgba(255,212,90,.2);
  border-radius:18px;
  background:linear-gradient(135deg,rgba(255,212,90,.12),rgba(255,255,255,.055));
  color:rgba(255,248,236,.82) !important;
  font-size:.92rem;
  line-height:1.55;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06);
}
#dashFixedCards{
  grid-template-columns:1fr;
  align-items:stretch;
}
.dashboard-panel h3{
  margin:0;
  line-height:1.35;
}
.dashboard-card-desc{
  margin:10px 0 18px;
  color:var(--muted) !important;
  font-size:.88rem;
  line-height:1.55;
}
#dashFunnelCards{margin-bottom:0;}
#dashFunnelCards .funnel-card{
  min-height:126px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  border-color:rgba(255,212,90,.22);
  background:linear-gradient(145deg,rgba(38,34,24,.96),rgba(19,18,14,.96));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.07),0 16px 34px rgba(0,0,0,.22);
}
#dashFunnelCards .funnel-card::before{
  height:4px;
  background:linear-gradient(90deg,#ff8a3d,#ffd45a);
}
#dashFunnelCards .funnel-card .label{
  margin-top:6px;
  line-height:1.4;
}
#dashFunnelCards .funnel-conversion.is-positive{
  border-color:rgba(85,216,138,.46);
  background:linear-gradient(145deg,rgba(25,78,47,.96),rgba(15,43,29,.98));
}
#dashFunnelCards .funnel-conversion.is-positive::before{background:linear-gradient(90deg,#55d88a,#b7f5cc);}
#dashFunnelCards .funnel-conversion.is-positive .num{color:#b7f5cc;}
#dashFunnelCards .funnel-conversion.is-warning{
  border-color:rgba(255,212,90,.46);
  background:linear-gradient(145deg,rgba(89,65,16,.96),rgba(49,36,10,.98));
}
#dashFunnelCards .funnel-conversion.is-warning::before{background:linear-gradient(90deg,#ffb648,#ffe48a);}
#dashFunnelCards .funnel-conversion.is-warning .num{color:#ffe48a;}
#dashFunnelCards .funnel-conversion.is-danger{
  border-color:rgba(255,93,93,.46);
  background:linear-gradient(145deg,rgba(90,35,35,.96),rgba(48,20,20,.98));
}
#dashFunnelCards .funnel-conversion.is-danger::before{background:linear-gradient(90deg,#ff7373,#ffb0b0);}
#dashFunnelCards .funnel-conversion.is-danger .num{color:#ffb0b0;}
.dashboard-panel-head{
  margin-bottom:16px;
  align-items:center;
}
.live-status{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border:1px solid rgba(85,216,138,.26);
  border-radius:999px;
  background:rgba(85,216,138,.1);
  color:#bff7d4;
  font-size:.84rem;
  font-weight:800;
}
.dash-date-toolbar{
  display:flex;
  flex-wrap: wrap-reverse;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  margin-bottom:18px;
  padding:12px;
  border:1px solid rgba(255,255,255,.1);
  border-radius:18px;
  background:rgba(0,0,0,.16);
}
.rep-presets{
  display:flex;
  gap:8px;
  max-height:fit-content;
}
.red-end{
  justify-content:flex-end;
  margin-left:auto;
}
.dash-date-fields{
  display:flex;
  flex-direction:row;
  gap:8px;
  align-items:center;
}
.dash-date-separator{
  color:var(--muted);
  font-size:.84rem;
  padding-bottom:10px;
}
.dash-chart{
  margin-top:14px;
  border:1px solid rgba(255,255,255,.1);
  border-radius:18px;
  background:linear-gradient(180deg,rgba(255,255,255,.06),rgba(0,0,0,.12));
  overflow:hidden;
}
.dash-chart-scroll{
  overflow-x:auto;
  padding:12px 12px 6px;
}
.dash-chart svg{
  display:block;
}
.dash-empty{
  margin:0;
  padding:24px 16px;
  color:var(--muted) !important;
  font-size:.9rem;
  line-height:1.5;
  text-align:center;
}
.calc-results,.order-detail{
  background:rgba(0,0,0,.22);
  border:1px solid var(--border);
}
.calc-input-wrap input{background:transparent;color:var(--text);}
.calc-metric b{color:#fff;}
.calc-metric small{color:var(--muted);}

table{
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  color:var(--text);
}
th{
  background:rgba(0,0,0,.22);
  color:rgba(255,248,236,.58);
  border-bottom:1px solid var(--border);
}
td{
  border-bottom:1px solid rgba(255,255,255,.08);
  color:rgba(255,248,236,.88);
}
tr:hover td{background:rgba(255,255,255,.035);}
tr:last-child td{border-bottom:none;}
a{color:#ffe072;}

.field-sm,select,input,textarea{accent-color:var(--accent);}
select option{background:#15130f;color:var(--text);}
.row-actions{flex-wrap:wrap;}

.badge{border:1px solid rgba(255,255,255,.08);box-shadow:inset 0 1px 0 rgba(255,255,255,.1);}
.badge.pendiente{background:rgba(255,212,90,.16);color:#ffe48a;}
.badge.confirmado,.badge.pagado{background:rgba(85,216,138,.16);color:#90f1b5;}
.badge.despachado{background:rgba(107,185,255,.16);color:#9fd1ff;}
.badge.entregado{background:rgba(93,220,230,.15);color:#9bf1f4;}
.badge.cancelado{background:rgba(255,93,93,.16);color:#ff9d9d;}
.badge.no-grato{background:rgba(255,93,93,.16);color:#ff9d9d;}

.overlay{background:rgba(0,0,0,.72);backdrop-filter:blur(6px);}
.modal{
  color:var(--text);
  border-radius:24px;
  background:linear-gradient(145deg,rgba(30,27,19,.94),rgba(14,13,10,.96));
}
.modal h2{color:var(--text-strong);letter-spacing:-.03em;}
.modal label{color:rgba(255,248,236,.86);}
.modal-close{color:rgba(255,248,236,.72);}
.modal-close:hover{color:#fff;}
.thumbs img,.creativo-photo-thumbs img{border-color:var(--border);background:rgba(255,255,255,.08);}
.toast,.editor-pending-bar,.status-alert-popup{
  background:linear-gradient(135deg,#18150f,#0c0b09);
  color:var(--text);
  border:1px solid var(--border);
  box-shadow:0 18px 44px rgba(0,0,0,.38);
}

.editor-frame-wrap{
  border-color:var(--border);
  background:rgba(255,255,255,.06);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow);
}
#editModeBtn.active{
  background:linear-gradient(135deg,#1c6b39,#55d88a);
  color:#071107;border-color:transparent;
}

.creativo-card canvas{background:rgba(255,255,255,.08);}
.creativo-card textarea{
  background:rgba(0,0,0,.22);
  color:var(--text);
  border-color:var(--border);
}
.creativo-card .angle-label{color:var(--accent);}
.carts-grid{gap:16px;}
.cart-card .cc-name,.cart-card .cc-total{color:var(--text-strong);}

.mobile-topbar{
  background:linear-gradient(135deg,rgba(20,18,13,.95),rgba(9,9,8,.95));
  border-bottom:1px solid var(--border);
  box-shadow:0 18px 44px rgba(0,0,0,.26);
  backdrop-filter:blur(18px);
}
.menu-toggle{
  background:rgba(255,255,255,.08);
  border-color:var(--border);
  color:var(--text);
}
.menu-toggle:hover{background:rgba(255,212,90,.14);border-color:rgba(255,212,90,.45);}
.mobile-brand{color:#fff;}
.mobile-brand span{color:var(--accent);}
.sidebar-backdrop{background:rgba(0,0,0,.68);backdrop-filter:blur(4px);}

/* Scrollbars */
html,
.nav-links,
.modal{
  scrollbar-width:thin;
  scrollbar-color:rgba(255,212,90,.7) transparent;
}
html::-webkit-scrollbar,
.nav-links::-webkit-scrollbar,
.modal::-webkit-scrollbar{
  width:10px;
  height:10px;
}
html::-webkit-scrollbar-track,
.nav-links::-webkit-scrollbar-track,
.modal::-webkit-scrollbar-track{
  background:rgba(255,255,255,.035);
}
html::-webkit-scrollbar-thumb,
.nav-links::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb{
  min-height:48px;
  border:2px solid transparent;
  border-radius:999px;
  background:linear-gradient(180deg,#ffe072,#b88316) padding-box;
}
html::-webkit-scrollbar-thumb:hover,
.nav-links::-webkit-scrollbar-thumb:hover,
.modal::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(180deg,#fff0a8,#d99c25) padding-box;
}
#dashTopProductsTable td:last-child{
    text-align:right;
    white-space:normal;
  }

@media (max-width:1024px){
  nav{width:min(310px,84vw);}
  main{padding:26px;}
  #dashFixedCards{grid-template-columns:repeat(2,1fr);}
}
@media (max-width:680px){
  main{padding:18px 14px 30px;}
  .toprow{gap:12px;}
  .toprow > h2{width:100%;margin-bottom:0;}
  .cards-row{grid-template-columns:1fr;}
  #dashFixedCards{grid-template-columns:1fr;}
  .dashboard-lead{margin-top:-4px;}
  .dash-date-separator{display:none;}
  #dashTopProductsTable,
  #dashStockAlertsTable{
    width:100%;
    min-width:0;
    table-layout:fixed;
  }
  #dashTopProductsTable th:first-child,
  #dashTopProductsTable td:first-child,
  #dashStockAlertsTable th:first-child,
  #dashStockAlertsTable td:first-child{
    width:auto;
    overflow-wrap:anywhere;
    word-break:break-word;
  }
  #dashTopProductsTable th:last-child,
  #dashTopProductsTable td:last-child{
    width:82px;
  }
  #dashStockAlertsTable th:last-child,
  #dashStockAlertsTable td:last-child{
    width:92px;
    text-align:right;
    white-space:normal;
  }
  table{min-width:680px;}
  .modal{border-radius:20px;}
  .btn{min-height:40px;}
}
@media (min-width:681px) and (max-width:1024px){
  #dashFixedCards{grid-template-columns:repeat(2,1fr);}
}
@media (min-width:1025px){
  #dashFixedCards{grid-template-columns:repeat(4,1fr);}
}

.ui-icon{
  width:1em;
  height:1em;
  flex:0 0 auto;
  stroke-width:2.2;
  vertical-align:-.14em;
  pointer-events:none;
}
nav .item,.menu-toggle,.btn,.badge{
  display:inline-flex;
  align-items:center;
  gap:.62em;
}
nav .item{display:flex;}
.menu-toggle{justify-content:center;}
.btn{justify-content:center;}
nav .item .ui-icon{
  width:1.08em;
  height:1.08em;
  color:rgba(255,212,90,.9);
}
nav .item.active .ui-icon{color:#ffe071;}
.badge,#cartsBadge{
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 8px 18px rgba(0,0,0,.16);
  letter-spacing:.01em;
}
.featured-badge{
  margin-left:6px;
  padding:3px 8px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  gap:.35em;
  color:#ffe071;
  background:linear-gradient(135deg,rgba(255,212,90,.22),rgba(255,212,90,.09));
  border:1px solid rgba(255,212,90,.22);
  font-size:.72rem;
  font-weight:800;
}
.featured-badge .ui-icon{width:.95em;height:.95em;}
#cartsBadge{
  margin-left:auto;
  min-width:22px;
  height:22px;
  padding:0 7px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg,#ff8a3d,#ffd45a);
  color:#111;
  font-size:.72rem;
  font-weight:900;
}
.badge.pendiente{background:linear-gradient(135deg,rgba(255,212,90,.24),rgba(255,212,90,.1));}
.badge.confirmado,.badge.pagado{background:linear-gradient(135deg,rgba(85,216,138,.24),rgba(85,216,138,.1));}
.badge.despachado{background:linear-gradient(135deg,rgba(107,185,255,.24),rgba(107,185,255,.1));}
.badge.entregado{background:linear-gradient(135deg,rgba(93,220,230,.22),rgba(93,220,230,.1));}
.badge.cancelado{background:linear-gradient(135deg,rgba(255,93,93,.24),rgba(255,93,93,.1));}
.badge.no-grato{background:linear-gradient(135deg,rgba(255,93,93,.24),rgba(255,93,93,.1));}

/* #tab-pedidos{
  min-height:calc(100vh - 68px);
  padding:24px;
  background:#0d0d0d;
  border:1px solid rgba(255,255,255,.08);
  background: linear-gradient(135deg, #2b220e, #0c0b08);
  border-radius:var(--radius-lg);
} */
#tab-pedidos #orderStats .stat,
#tab-pedidos .order-card,
#tab-pedidos .orders-empty{
  background:#171717;
  backdrop-filter:none;
}
#tab-pedidos #orderStats .stat::before{background:var(--accent);}
.section-heading{align-items:center;flex-wrap:nowrap;}
.section-heading h2{width:auto;min-width:0;margin-bottom:0;}
.section-heading .refresh-btn{margin-left:auto;flex:0 0 auto;}
.carts-header-actions{margin-left:auto;flex:0 0 auto;display:flex;align-items:center;gap:8px;}
.carts-header-actions .refresh-btn{margin-left:0;}
.cart-card .cc-actions{display:flex;justify-content:flex-end;margin-top:4px;}
.orders-toolbar{align-items:stretch;}
.orders-toolbar .field-sm{min-height:42px;}
.orders-grid{display:grid;grid-template-columns:1fr;gap:14px;}
.order-card{
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);
  grid-template-areas:
    "head head"
    "main items"
    "actions actions";
  gap:12px 16px;
  padding:16px 18px;
  background:var(--glass);border:1px solid var(--border);border-radius:var(--radius-lg);
  box-shadow:var(--shadow);backdrop-filter:blur(18px);
}
.order-card-head{grid-area:head;}
.order-card-main{grid-area:main;}
.order-items{grid-area:items;}
.order-card-actions{grid-area:actions;}
.order-card-head,.order-card-main{display:flex;justify-content:space-between;gap:16px;}
.order-card-head{align-items:flex-start;padding-bottom:10px;border-bottom:1px solid var(--border);}
.order-card-head h3{margin:2px 0 3px;color:var(--text-strong);font-size:1.2rem;}
.order-card-head time{color:var(--muted);font-size:.78rem;}
.order-eyebrow,.order-label{display:block;color:var(--muted);font-size:.7rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
.order-statuses{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;max-width:60%;}
.order-statuses .badge{margin:0;}
.order-customer,.order-financial{display:flex;flex-direction:column;gap:5px;min-width:0;}
.order-customer{flex:1;}
.order-customer strong{color:var(--text-strong);font-size:1rem;}
.order-customer a{width:max-content;max-width:100%;overflow-wrap:anywhere;}
.order-address{color:var(--muted);font-size:.82rem;line-height:1.45;}
.order-financial{align-items:flex-end;text-align:right;}
.order-financial strong{color:var(--text-strong);font-size:1.35rem;}
.order-financial > span:not(.badge){color:var(--muted);font-size:.82rem;}
.order-items{display:flex;flex-direction:column;gap:5px;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:rgba(0,0,0,.14);font-size:.83rem;line-height:1.35;}
.order-items > span:not(.order-label){color:var(--text);}
.order-items b{color:var(--text-strong);}
.order-note{padding-top:7px;margin-top:2px;border-top:1px dashed var(--border);color:var(--muted) !important;}
.order-muted{color:var(--muted) !important;}
.order-card-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  padding-top:12px;
  border-top:1px solid rgba(255,255,255,.06);
}
.order-card-actions .btn{margin:0 !important;flex:0 0 auto;width:auto;}
.order-card-actions select{min-width:170px;cursor:pointer;}
.orders-empty{grid-column:1/-1;padding:40px 20px;text-align:center;color:var(--muted);background:var(--glass);border:1px dashed var(--border);border-radius:var(--radius-lg);}

.customers-cards{display:none;}
#customersSearch{width:380px;max-width:100%;}

/* Productos */
.products-heading{align-items:center;}
.product-top-actions{flex-wrap:nowrap;align-items:center;gap:12px;}
.product-top-actions .btn{white-space:nowrap;}
.dropanas-actions{
  display:flex;align-items:center;gap:8px;padding:5px 6px 5px 11px;
  border:1px solid var(--border);border-radius:18px;background:rgba(0,0,0,.16);
}
.dropanas-actions-label{
  display:inline-flex;align-items:center;gap:6px;color:#9fd1ff;font-size:.72rem;
  font-weight:800;letter-spacing:.05em;text-transform:uppercase;
}
.dropanas-actions-label .ui-icon{width:1.15em;height:1.15em;}
.dropanas-actions-buttons{display:flex;align-items:center;gap:4px;}
.dropanas-actions-buttons .btn{
  min-height:34px;padding:7px 11px;border-color:transparent;background:transparent;
  color:rgba(255,248,236,.84);font-size:.78rem;box-shadow:none;
}
.dropanas-actions-buttons .btn:hover{
  background:rgba(107,185,255,.12);border-color:rgba(107,185,255,.28);color:#d8ecff;
}
.product-add-btn{min-height:44px;padding-inline:16px;}
.products-filters{margin-bottom:14px;}
.products-filters #productsSearch{flex:1;min-width:220px;}
.products-table-wrap{
  width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden;
  border-radius:var(--radius);scrollbar-width:thin;
  scrollbar-color:rgba(255,212,90,.7) transparent;
}
.products-table-wrap::-webkit-scrollbar{height:10px;}
.products-table-wrap::-webkit-scrollbar-track{background:rgba(255,255,255,.035);}
.products-table-wrap::-webkit-scrollbar-thumb{
  border:2px solid transparent;border-radius:999px;
  background:linear-gradient(90deg,#ffe072,#b88316) padding-box;
}
.products-table-wrap::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(90deg,#fff0a8,#d99c25) padding-box;
}
.products-table{min-width:900px;}
.stock-notify-table-wrap{
  width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden;
  border-radius:var(--radius);scrollbar-width:thin;
  scrollbar-color:rgba(255,212,90,.7) transparent;
}
.stock-notify-table-wrap::-webkit-scrollbar{height:10px;}
.stock-notify-table-wrap::-webkit-scrollbar-track{background:rgba(255,255,255,.035);}
.stock-notify-table-wrap::-webkit-scrollbar-thumb{
  border:2px solid transparent;border-radius:999px;
  background:linear-gradient(90deg,#ffe072,#b88316) padding-box;
}
.stock-notify-table-wrap::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(90deg,#fff0a8,#d99c25) padding-box;
}
.stock-notify-table{min-width:680px;}
.products-table th:last-child,
.products-table td:last-child{width:92px;white-space:nowrap;}
.products-table th:last-child{text-align:center;}
.product-availability{min-width:150px;white-space:nowrap;}
.product-availability-icon{
  display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;
  vertical-align:middle;
}
.product-availability-icon .ui-icon{width:22px;height:22px;}
.product-availability-icon > span{margin-left:5px;font-size:.75rem;font-weight:800;white-space:nowrap;}
.product-availability-icon.is-available{color:var(--success);}
.product-availability-icon.is-unavailable{color:var(--danger);}
.product-dropanas-badge{
  display:inline-flex;align-items:center;gap:5px;margin-left:6px;padding:4px 9px;border-radius:999px;
  background:rgba(107,185,255,.15);border:1px solid rgba(107,185,255,.32);color:#9fd1ff;
  font-size:.75rem;font-weight:800;vertical-align:middle;
}
.product-dropanas-badge .ui-icon{width:.9em;height:.9em;}
.product-actions-cell{padding:12px 8px !important;vertical-align:middle;text-align:center;}
.product-actions{flex-wrap:nowrap;align-items:center;}
.product-actions-cell .product-actions{justify-content:center;}
.product-icon-btn{width:36px;min-width:36px;height:36px;padding:0;}
.products-cards{display:none;}
.product-modal{max-width:760px;padding:26px;}
.product-modal > h2{position:sticky;top:-26px;z-index:1;margin:0 -26px 18px;padding:2px 54px 16px 26px;background:linear-gradient(145deg,rgba(30,27,19,.98),rgba(14,13,10,.98));border-bottom:1px solid var(--border);}
.product-modal .modal-close{position:sticky;float:right;top:-14px;z-index:2;margin:-14px -14px 0 0;}
.product-form-section{margin-top:14px;padding:16px;border:1px solid rgba(255,255,255,.1);border-radius:16px;background:rgba(0,0,0,.13);}
.product-form-section:first-of-type{margin-top:0;}
.product-form-section-heading{margin:-2px 0 14px;padding:0 0 10px;border-bottom:1px solid rgba(255,212,90,.18);}
.product-form-section-heading h3{margin:0 0 3px;font-size:1rem;color:var(--accent);}
.product-form-section-heading p,.product-field-hint{margin:0;color:var(--muted) !important;font-size:.79rem;line-height:1.45;}
.product-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;}
.product-form-field-full{grid-column:1/-1;}
.product-category-control,.product-ai-control,.product-cross-sell-controls{display:flex;gap:8px;align-items:center;}
.product-category-control select,.product-ai-control input,.product-cross-sell-controls select{flex:1;min-width:0;}
.product-category-control .btn,.product-ai-control .btn,.product-cross-sell-controls .btn{white-space:nowrap;}
.product-shipping-option{margin:12px 0 4px;padding:10px 12px;background:rgba(255,212,90,.07);border:1px solid rgba(255,212,90,.18);border-radius:12px;}
.product-shipping-option label,.product-options label{display:flex;align-items:center;gap:7px;margin:0;font-weight:600;}
.product-shipping-option label input,.product-options label input{width:auto;margin:0;}
.product-shipping-option span{display:block;margin-top:4px;color:var(--muted);font-size:.78rem;line-height:1.4;}
.product-inline-feedback{min-height:1.1em;margin:5px 0;color:var(--muted);font-size:.82rem;}
.product-price-calculator{margin-top:10px;padding:14px;border:1px solid var(--border);border-radius:14px;background:rgba(0,0,0,.16);}
.product-price-calculator-copy{margin-bottom:10px;color:var(--muted);font-size:.82rem;line-height:1.4;}
.product-price-calculator > label{margin-top:10px;}
.product-price-result{margin:10px 0;font-weight:600;}
.product-ai-control{margin-top:8px;}
.product-ai-preview{margin-top:8px;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:rgba(0,0,0,.16);font-size:.82rem;}
.product-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:12px;}
.product-cross-sell-controls #csDiscount{width:88px;}
.product-cross-sell-list{display:flex;flex-direction:column;gap:6px;margin-top:8px;}
.product-save-btn{width:100%;margin-top:18px;}

/* Reportes */
.report-toolbar{margin-bottom:20px;align-items:flex-end;}
.report-chart-wrap{margin-top:18px;}
.report-profit-value{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border:1px solid transparent;
  border-radius:8px;
  font-weight:800;
  line-height:1.2;
}
.report-profit-value.is-positive{
  color:#b7f5cc;
  /* border-color:rgba(85,216,138,.38); */
  background:rgba(31,117,69,.42);
  letter-spacing:.06em;
}
.report-profit-value.is-negative{
  color:#ffb0b0;
  border-color:rgba(255,93,93,.38);
  background:rgba(139,42,42,.4);
}
.report-health-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;
  height:28px;
  border:1px solid transparent;
  border-radius:9px;
}
.report-health-icon .ui-icon{width:16px;height:16px;}
.report-health-icon.is-saludable{color:#b7f5cc;border-color:rgba(85,216,138,.38);background:rgba(31,117,69,.42);}
.report-health-icon.is-ajustado{color:#ffe48a;border-color:rgba(255,212,90,.38);background:rgba(116,81,16,.42);}
.report-health-icon.is-perdida{color:#ffb0b0;border-color:rgba(255,93,93,.38);background:rgba(139,42,42,.4);}
.report-product-health-legend{
  display:flex;
  flex-wrap:wrap;
  gap:6px 12px;
  margin-top:8px;
  color:var(--muted);
  font-size:.68rem;
  line-height:1.2;
}
.report-product-health-legend span{display:inline-flex;align-items:center;gap:3px;}
.report-product-health-legend svg{width:11px;height:11px;}
.report-product-health-legend span:nth-child(1){color:#b7f5cc;}
.report-product-health-legend span:nth-child(2){color:#ffe48a;}
.report-product-health-legend span:nth-child(3){color:#ffb0b0;}
.report-result-card,.report-activity-panel,.report-cost-panel{
  border:1px solid var(--border);border-radius:18px;background:rgba(0,0,0,.16);
}
.report-result-card{
  position:relative;overflow:hidden;padding:20px;margin-bottom:14px;
  background:linear-gradient(135deg,rgba(85,216,138,.16),rgba(255,255,255,.04));
}
.report-result-card::after{
  content:"";position:absolute;inset:auto -30px -58px auto;width:150px;height:150px;border-radius:50%;
  background:rgba(85,216,138,.13);filter:blur(4px);
}
.report-result-card.is-negative{background:linear-gradient(135deg,rgba(255,93,93,.16),rgba(255,255,255,.04));}
.report-result-card.is-negative::after{background:rgba(255,93,93,.13);}
.report-result-heading{position:relative;z-index:1;display:flex;align-items:center;gap:9px;color:var(--muted);font-size:.8rem;font-weight:800;text-transform:uppercase;letter-spacing:.07em;}
.report-result-value{position:relative;z-index:1;margin:8px 0 2px;color:var(--text-strong);font-size:clamp(2rem,4vw,3rem);font-weight:900;letter-spacing:-.06em;}
.report-result-copy{position:relative;z-index:1;color:var(--muted);font-size:.82rem;}
.report-metric-icon{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:10px;background:rgba(255,212,90,.12);color:#ffe071;}
.report-result-card.is-positive .report-metric-icon{background:rgba(85,216,138,.14);color:#90f1b5;}
.report-result-card.is-negative .report-metric-icon{background:rgba(255,93,93,.14);color:#ff9d9d;}
.report-margin-pill{position:relative;z-index:1;display:inline-flex;align-items:center;gap:6px;margin-top:14px;padding:7px 10px;border:1px solid;border-radius:999px;font-size:.78rem;}
.report-margin-pill strong{color:inherit;}
.report-margin-pill.is-positive{background:rgba(85,216,138,.12);border-color:rgba(85,216,138,.3);color:#90f1b5;}
.report-margin-pill.is-warning{background:rgba(255,212,90,.12);border-color:rgba(255,212,90,.3);color:#ffe48a;}
.report-margin-pill.is-negative{background:rgba(255,93,93,.12);border-color:rgba(255,93,93,.3);color:#ff9d9d;}
.report-activity-panel,.report-cost-panel{padding:16px;margin-top:14px;}
.report-panel-heading{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:12px;color:var(--text-strong);font-size:.88rem;font-weight:800;}
.report-panel-heading small{color:var(--muted);font-size:.72rem;font-weight:600;}
.report-activity-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;}
.report-metric-card{display:flex;align-items:flex-start;gap:9px;min-width:0;padding:12px;border:1px solid rgba(255,255,255,.08);border-radius:14px;background:rgba(255,255,255,.04);}
.report-metric-card > div{min-width:0;}
.report-metric-card span:not(.report-metric-icon),.report-metric-card small{display:block;color:var(--muted);font-size:.72rem;line-height:1.3;}
.report-metric-card strong{display:block;margin-top:3px;color:var(--text-strong);font-size:1.25rem;letter-spacing:-.04em;}
.report-metric-card.is-pending .report-metric-icon{background:rgba(255,212,90,.13);color:#ffe48a;}
.report-metric-card.is-income .report-metric-icon{background:rgba(107,185,255,.13);color:#9fd1ff;}
.report-metric-card.is-completed .report-metric-icon{background:rgba(85,216,138,.13);color:#90f1b5;}
.report-cost-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;}
.report-cost-metrics > div{min-width:0;padding:10px 11px;border-left:2px solid rgba(255,212,90,.42);background:rgba(0,0,0,.12);}
.report-cost-metrics span{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:.73rem;line-height:1.3;}
.report-cost-metrics .ui-icon{color:#ffe071;}
.report-cost-metrics strong{display:block;margin-top:6px;color:var(--text-strong);font-size:1rem;letter-spacing:-.03em;}
.report-chart{margin-top:0;}
.report-chart-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 16px 0;}
.report-chart-heading h3{margin:2px 0 0;font-size:1rem;}
.report-chart-eyebrow{color:var(--muted);font-size:.7rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
.report-chart-legend{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;color:var(--muted);font-size:.75rem;}
.report-chart-legend span{display:inline-flex;align-items:center;gap:5px;}
.report-legend-dot{width:8px;height:8px;border-radius:3px;background:var(--success);}
.report-legend-dot.is-negative{background:var(--danger);}

@media (max-width:680px){
  .report-toolbar{align-items:stretch;flex-direction:column;}
  .report-activity-metrics,.report-cost-metrics{grid-template-columns:1fr;}
  .report-chart-heading{align-items:flex-start;flex-direction:column;}
  .report-chart-legend{justify-content:flex-start;}
}

/* Carritos */
.carts-toolbar{display:flex;align-items:center;gap:10px;margin:16px 0 10px;}
.carts-toolbar .field-sm{flex:1;min-width:250px;}
.carts-phone-filter{
  display:inline-flex;align-items:center;gap:7px;white-space:nowrap;padding:10px 12px;
  border:1px solid var(--border);border-radius:12px;background:rgba(0,0,0,.16);
  color:var(--text);font-size:.82rem;font-weight:600;
}
.carts-phone-filter input{width:auto;margin:0;}
.carts-summary{
  display:flex;flex-wrap:wrap;align-items:center;gap:10px 24px;margin-bottom:16px;padding:11px 14px;
  border:1px solid rgba(255,255,255,.1);border-radius:14px;background:rgba(0,0,0,.15);
}
.carts-summary > div{display:flex;align-items:baseline;gap:5px;color:var(--muted);font-size:.82rem;}
.carts-summary-label{font-weight:700;}
.carts-summary strong{color:var(--text-strong);font-size:1rem;}
.carts-empty{
  grid-column:1/-1;margin:0;padding:32px 16px;text-align:center;color:var(--muted) !important;
  border:1px dashed var(--border);border-radius:var(--radius-lg);background:rgba(0,0,0,.14);
}
.cart-whatsapp-btn{
  display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:38px;
  margin-top:auto;padding:8px 12px;border:1px solid rgba(85,216,138,.42);border-radius:12px;
  background:linear-gradient(135deg,rgba(32,156,83,.82),rgba(85,216,138,.9));color:#071107;
  font-size:.82rem;font-weight:800;text-decoration:none;box-shadow:0 10px 20px rgba(22,130,69,.18);
  transition:transform .16s ease,filter .16s ease,box-shadow .16s ease;
}
.cart-whatsapp-btn:hover{color:#071107;filter:brightness(1.08);transform:translateY(-1px);box-shadow:0 13px 24px rgba(22,130,69,.28);}
.cart-whatsapp-btn .ui-icon{width:1.12em;height:1.12em;}

/* Cliente no grato */
tr.is-no-grato{background:rgba(255,93,93,.06);}
.customer-card.is-no-grato{border-color:rgba(255,93,93,.4);}
.customer-note{margin-top:8px;padding-top:8px;border-top:1px dashed var(--border);display:flex;flex-direction:column;gap:2px;}
.customer-note span:last-child{color:var(--text);font-size:.85rem;}
.cu-no-grato-toggle{
  display:flex;align-items:center;gap:8px;margin:14px 0 4px;padding:10px 12px;
  border:1px solid var(--border);border-radius:12px;background:rgba(255,93,93,.08);
  font-weight:600;font-size:.88rem;cursor:pointer;
}
.cu-no-grato-toggle input{width:auto;margin:0;}
#cuNoGratoNoteRow{margin-bottom:10px;}

@media (max-width:980px){
  .order-card{
    grid-template-columns:1fr;
    grid-template-areas:
      "head"
      "main"
      "items"
      "actions";
  }
}

@media (max-width:800px){
  #customersSearch{width:100%;min-width:0 !important;}
  .customers-table{display:none;}
  .customers-cards{display:grid;grid-template-columns:1fr;gap:12px;}
  .customer-card{
    display:flex;flex-direction:column;gap:14px;padding:16px;
    background:#171717;border:1px solid var(--border);border-radius:var(--radius-lg);
    box-shadow:var(--shadow);
  }
  .customer-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;}
  .customer-card-head h3{margin:3px 0 4px;color:var(--text-strong);font-size:1.05rem;}
  .customer-card-head a{font-size:.88rem;overflow-wrap:anywhere;}
  .customer-label{display:block;margin-bottom:3px;color:var(--muted);font-size:.68rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
  .customer-edit-btn{flex:0 0 auto;}
  .customer-address{padding:11px 12px;background:#0d0d0d;border:1px solid var(--border);border-radius:12px;color:var(--text);font-size:.84rem;line-height:1.45;}
  .customer-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;}
  .customer-metrics > div{min-width:0;padding:10px;background:#0d0d0d;border-radius:10px;}
  .customer-metrics strong{display:block;color:var(--text-strong);font-size:.88rem;overflow-wrap:anywhere;}
  .customers-empty{padding:32px 16px;text-align:center;color:var(--muted);background:#171717;border:1px dashed var(--border);border-radius:var(--radius-lg);}
  .products-table-wrap{display:none;}
  .products-table{display:none;}
  .products-cards{display:grid;grid-template-columns:1fr;gap:12px;}
  .product-top-actions{width:100%;flex-wrap:wrap;}
  .dropanas-actions{flex:1 1 390px;}
  .product-add-btn{flex:1 1 200px;}
  .product-card{padding:16px;background:#171717;border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow);}
  .product-card-head{display:flex;align-items:flex-start;gap:12px;}
  .product-card-image{width:58px;height:58px;flex:0 0 auto;object-fit:cover;border-radius:12px;background:rgba(255,255,255,.08);border:1px solid var(--border);}
  .product-card-title{min-width:0;flex:1;}
  .product-card-title h3{margin:2px 0 7px;color:var(--text-strong);font-size:1.03rem;overflow-wrap:anywhere;}
  .product-card-label{display:block;margin-bottom:3px;color:var(--muted);font-size:.68rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
  .product-card-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;}
  .product-card-integration{min-width:0;margin-top:0;}
  .product-card-badges{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:6px;margin-left:auto;}
  .product-card-badges .product-availability-icon{width:auto;height:28px;}
  .product-card-integration .product-dropanas-badge{margin-left:0;}
  .product-card-badges .featured-badge{margin-left:0;}
  .product-card-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:14px;}
  .product-card-metrics > div{min-width:0;padding:10px;background:#0d0d0d;border-radius:10px;}
  .product-card-metrics strong{display:block;color:var(--text-strong);font-size:.88rem;overflow-wrap:anywhere;}
  .product-card-metrics strong .badge{vertical-align:middle;}
  .products-empty{padding:32px 16px;text-align:center;color:var(--muted);background:#171717;border:1px dashed var(--border);border-radius:var(--radius-lg);}
}

@media (max-width:420px){
  .customer-metrics{grid-template-columns:1fr 1fr;}
  .customer-metrics > div:last-child{grid-column:1/-1;}
}

@media (max-width:560px){
  #tab-pedidos{min-height:calc(100vh - 92px);padding:16px;}
  .section-heading > h2{width:auto;font-size:1.35rem;}
  .section-heading .refresh-btn{width:40px;height:40px;min-height:40px;padding:0;}
  .section-heading .refresh-label{display:none;}
  .carts-header-actions{gap:6px;}
  .carts-header-actions .btn.danger span:not(.ui-icon){display:none;}
  .carts-header-actions .btn.danger{width:40px;height:40px;min-height:40px;padding:0;justify-content:center;}
  .orders-toolbar{flex-direction:column;}
  .orders-toolbar .field-sm{width:100%;min-width:0 !important;}
  .order-card{display:flex;flex-direction:column;padding:16px;}
  .order-card-head,.order-card-main{flex-direction:column;}
  .order-statuses{justify-content:flex-start;max-width:none;}
  .order-financial{align-items:flex-start;text-align:left;}
  .order-card-actions{flex-direction:column;}
  .order-card-actions .btn,.order-card-actions select{width:100%;flex:none;}
  .products-heading{align-items:flex-start;}
  .product-top-actions{width:100%;}
  .dropanas-actions{width:100%;flex-basis:100%;flex-wrap:wrap;padding:9px 10px;}
  .dropanas-actions-label{width:100%;}
  .dropanas-actions-buttons{width:100%;}
  .dropanas-actions-buttons .btn{flex:1;padding-inline:8px;}
  .product-add-btn{width:100%;flex-basis:100%;}
  .products-filters{flex-direction:column;align-items:stretch;}
  .products-filters #productsSearch,.products-filters #productsFiltroCategoria{width:100%;min-width:0;}
  .product-form-grid,.product-options{grid-template-columns:1fr;}
  .overlay{align-items:flex-start;padding:12px;}
  .product-modal{max-height:calc(100dvh - 24px);padding:18px 16px;border-radius:18px;}
  .product-modal > h2{top:-18px;margin:0 -16px 16px;padding:2px 48px 14px 16px;}
  .product-modal .modal-close{top:-8px;margin:-8px -8px 0 0;}
  .product-form-section{padding:14px 12px;border-radius:14px;}
  .product-ai-control{align-items:stretch;flex-direction:column;}
  .product-cross-sell-controls{flex-wrap:wrap;}
  .product-cross-sell-controls select{flex-basis:100%;}
  .carts-toolbar{align-items:stretch;flex-direction:column;}
  .carts-toolbar .field-sm{width:100%;min-width:0;}
  .carts-phone-filter{justify-content:center;}
  .carts-summary{align-items:flex-start;flex-direction:column;gap:6px;}
  .report-activity-metrics,.report-cost-metrics{grid-template-columns:1fr;}
  .report-chart-heading{align-items:flex-start;flex-direction:column;}
  .report-chart-legend{justify-content:flex-start;}
}

/* ================= PANEL MÁSTER (plataforma de tiendas) =================
   Este archivo es el mismo assets/css/admin.css de BioCare (mismo tema oscuro/
   glass dorado), solo que aquí abajo se agregan las clases propias del panel
   máster (tiendas), igual que se hizo antes con .carts-* y .badge.no-grato. */

nav .brand::before{ content:"M"; }

/* Insignias de plan y estado de cada tienda (el resto de badges ya existen arriba). */
.badge.activa{background:linear-gradient(135deg,rgba(85,216,138,.24),rgba(85,216,138,.1));color:#90f1b5;}
.badge.suspendida{background:linear-gradient(135deg,rgba(255,138,61,.26),rgba(255,138,61,.1));color:#ffc79a;}
.badge.cancelada{background:linear-gradient(135deg,rgba(255,93,93,.24),rgba(255,93,93,.1));color:#ff9d9d;}
.badge.gratis{background:rgba(255,255,255,.1);color:rgba(255,248,236,.72);}
.badge.pago{background:linear-gradient(135deg,rgba(107,185,255,.24),rgba(107,185,255,.1));color:#9fd1ff;}

.btn.danger.outline{background:transparent;border:1px solid rgba(255,93,93,.5);color:#ff9d9d;box-shadow:none;}
.btn.danger.outline:hover{background:rgba(255,93,93,.12);border-color:rgba(255,93,93,.7);}

.modal-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.field-hint{color:var(--muted);font-size:.78rem;margin:4px 0 0;}

.tenant-slug{display:block;margin-top:2px;color:var(--muted);font-size:.8rem;}
.tenants-cards{display:none;}

@media (max-width:800px){
  #tenantsSearch{width:100%;min-width:0 !important;}
  .tenants-table{display:none;}
  .tenants-cards{display:grid;grid-template-columns:1fr;gap:12px;}
  .tenant-card{
    display:flex;flex-direction:column;gap:14px;padding:16px;
    background:#171717;border:1px solid var(--border);border-radius:var(--radius-lg);
    box-shadow:var(--shadow);
  }
  .tenant-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;}
  .tenant-card-head h3{margin:3px 0 2px;color:var(--text-strong);font-size:1.05rem;}
  .tenant-label{display:block;margin-bottom:3px;color:var(--muted);font-size:.68rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
  .tenant-edit-btn{flex:0 0 auto;}
  .tenant-badges{display:flex;gap:8px;flex-wrap:wrap;}
  .tenant-metrics{display:grid;grid-template-columns:1fr;gap:8px;}
  .tenant-metrics > div{min-width:0;padding:10px;background:#0d0d0d;border-radius:10px;display:flex;justify-content:space-between;gap:10px;}
  .tenant-metrics strong{color:var(--text-strong);font-size:.88rem;text-align:right;overflow-wrap:anywhere;}
  .tenants-empty{padding:32px 16px;text-align:center;color:var(--muted);background:#171717;border:1px dashed var(--border);border-radius:var(--radius-lg);}
}

@media (max-width:560px){
  .modal-cols{grid-template-columns:1fr;}
}

/* ---- APIs / integraciones por tienda (dentro del modal de tienda) ---- */
.modal-divider{border:none;border-top:1px solid var(--border);margin:22px 0 16px;}
.modal-subtitle{display:flex;align-items:center;gap:8px;color:var(--text-strong);font-size:1rem;margin:0 0 6px;}
.modal-section .field-hint{margin-bottom:14px;}

/* ---- Link de la tienda para el cliente ---- */
.link-box{
  display:flex;align-items:center;gap:8px;
  background:rgba(0,0,0,.14);border:1px solid var(--border);border-radius:10px;
  padding:10px 12px;
}
.link-box-text{flex:1;min-width:0;font-size:.82rem;color:var(--text);word-break:break-all;}
.link-box .btn{flex-shrink:0;}
.tenant-link-cell{display:flex;gap:6px;white-space:nowrap;}
.tenant-link-row{display:flex;align-items:center;gap:8px;margin-top:12px;padding-top:12px;border-top:1px solid var(--border);}
.tenant-link-text{flex:1;min-width:0;font-size:.76rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

/* ---- Leads (interesados desde la página de ventas) ---- */
.nav-badge{
  margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:999px;
  background:linear-gradient(135deg,var(--accent-2),var(--accent));color:#111;
  font-size:.72rem;font-weight:800;display:inline-flex;align-items:center;justify-content:center;
}
nav .item{display:flex;align-items:center;gap:10px;}

.badge.nuevo{background:linear-gradient(135deg,rgba(107,185,255,.26),rgba(107,185,255,.1));color:#9fd1ff;}
.badge.contactado{background:linear-gradient(135deg,rgba(255,212,90,.26),rgba(255,212,90,.1));color:#ffe6a8;}
.badge.convertido{background:linear-gradient(135deg,rgba(85,216,138,.24),rgba(85,216,138,.1));color:#90f1b5;}
.badge.descartado{background:rgba(255,255,255,.1);color:rgba(255,248,236,.6);}

.btn.whatsapp-link{background:linear-gradient(135deg,#1fae5c,#3fd67c);color:#08210f;box-shadow:0 10px 24px rgba(63,214,124,.18);}
.btn.whatsapp-link:hover{box-shadow:0 14px 30px rgba(63,214,124,.25);}

.lead-status-select{
  background:rgba(255,255,255,.075);color:var(--text);border:1px solid var(--border);
  border-radius:10px;padding:6px 8px;font-size:.78rem;font-family:inherit;
}
.leads-cards{display:none;}
.lead-msg{display:inline-block;color:var(--muted);font-size:.82rem;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;}
.lead-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.leads-table .btn.small,.leads-table .lead-status-select{white-space:nowrap;}

@media (max-width:800px){
  #leadsSearch{width:100%;min-width:0 !important;}
  .leads-table{display:none;}
  .leads-cards{display:grid;grid-template-columns:1fr;gap:12px;}
  .lead-card{
    display:flex;flex-direction:column;gap:12px;padding:16px;
    background:#171717;border:1px solid var(--border);border-radius:var(--radius-lg);
    box-shadow:var(--shadow);
  }
  .lead-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;}
  .lead-card-head h3{margin:3px 0 2px;color:var(--text-strong);font-size:1.05rem;}
  .lead-meta{display:grid;grid-template-columns:1fr;gap:8px;}
  .lead-meta > div{min-width:0;padding:10px;background:#0d0d0d;border-radius:10px;display:flex;justify-content:space-between;gap:10px;}
  .lead-meta strong{color:var(--text-strong);font-size:.88rem;text-align:right;overflow-wrap:anywhere;}
  .leads-empty{padding:32px 16px;text-align:center;color:var(--muted);background:#171717;border:1px dashed var(--border);border-radius:var(--radius-lg);}
}
