:root{
  --bg:#fbfaf7;
  --panel:#ffffff;
  --text:#111827;
  --muted:#6f6a63;
  --grid:#ebe5dc;
  --line:#e7ded2;

  --gold:#c79a43;
  --gold2:#d8b56d;
  --dark:#111827;

  --blue:#1f8ef1;
  --navy:#1f2aa3;
  --orange:#ef6b35;
  --purple:#6f008c;
  --green:#16a34a;
}

*{
  box-sizing:border-box;
}

html,
body{
  width:100%;
  max-width:100%;
  margin:0;
  overflow-x:hidden;
}

body{
  font-family:Inter,sans-serif;
  background:linear-gradient(180deg,#fbfaf7,#f1ece4);
  color:var(--text);
}

h1,h2,h3,p{
  margin:0;
}

.shell{
  display:grid;
  grid-template-columns:305px 1fr;
  min-height:100vh;
}

/* =========================
SIDEBAR
========================= */

.sidebar{
  padding:32px;
  background:#111827;
  color:white;
}

.brand{
  display:flex;
  gap:16px;
  align-items:center;
}

.logo-container{
  width:72px;
  height:72px;
  background:white;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  padding:8px;
  box-shadow:0 8px 20px rgba(0,0,0,.18);
  flex-shrink:0;
}

.logo-img{
  width:100%;
  height:100%;
  object-fit:contain;
}

.brand h1{
  font-size:22px;
  letter-spacing:2px;
  font-weight:900;
}

.brand p{
  color:#d1d5db;
  font-size:13px;
}

.hint{
  margin-top:18px;
  color:#d1d5db;
  font-size:13px;
  line-height:1.6;
}

.status{
  margin-top:16px;
  font-size:12px;
  color:#d1d5db;
  line-height:1.5;
}

.status.error{
  color:#fecaca;
}

.refresh{
  width:100%;
  border:0;
  margin-top:28px;
  background:#c79a43;
  color:#111827;
  padding:14px 16px;
  border-radius:12px;
  text-align:center;
  font-weight:900;
  cursor:pointer;
  font-size:15px;
  transition:.2s;
}

.refresh:hover{
  transform:translateY(-2px);
  background:#d6a852;
}

/* =========================
MAIN
========================= */

.main{
  padding:32px;
  min-width:0;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:end;
  margin-bottom:24px;
  border-bottom:1px solid var(--line);
  padding-bottom:20px;
}

.topbar h2{
  font-size:32px;
  font-weight:900;
}

.topbar p{
  color:var(--muted);
  margin-top:5px;
}

.filters{
  display:flex;
  gap:14px;
  align-items:end;
  flex-wrap:wrap;
}

.filters label{
  display:block;
  font-size:11px;
  text-transform:uppercase;
  color:var(--muted);
  font-weight:800;
  margin-bottom:6px;
}

select{
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 14px;
  background:white;
  min-width:150px;
  color:#111827;
  font-weight:600;
}

/* =========================
CARDS
========================= */

.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 10px 28px rgba(47,36,20,.07);
  overflow:hidden;
}

/* =========================
KPIS
========================= */

.kpis{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:14px;
  margin-bottom:22px;
}

.kpi{
  padding:18px;
  border-top:5px solid var(--gold2);
}

.kpi span{
  display:block;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
}

.kpi strong{
  display:block;
  margin-top:10px;
  font-size:24px;
  font-weight:900;
}

.primary{
  border-top-color:#111827;
  background:#fffdf8;
}

.meta-card{
  border-top-color:var(--green);
}

/* =========================
GRID DASHBOARD
========================= */

.dashboard-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:22px;
}

/* =========================
CHARTS
========================= */

.chart{
  padding:20px;
  height:350px;
  min-height:350px;
}

.chart h3{
  font-size:15px;
  text-transform:uppercase;
  letter-spacing:.7px;
  color:#3f3f46;
  margin-bottom:15px;
  font-weight:800;
}

.chart-line{
  height:370px;
  min-height:370px;
}

.chart-family{
  height:430px;
  min-height:430px;
}

.chart-vendor{
  height:440px;
  min-height:440px;
}

canvas{
  max-width:100%;
}

/* =========================
GAUGE
========================= */

.gauge-card{
  padding:22px;
  height:330px;
  min-height:330px;
}

.gauge-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
}

.gauge-header h3{
  font-size:16px;
  text-transform:uppercase;
  letter-spacing:.7px;
  font-weight:900;
  color:#3f3f46;
}

.gauge-header p{
  color:var(--muted);
  margin-top:4px;
  font-size:13px;
}

#gaugePercent{
  font-size:36px;
  color:var(--dark);
  font-weight:900;
  white-space:nowrap;
}

.gauge-wrap{
  position:relative;
  max-width:520px;
  height:220px;
  margin:0 auto;
}

.gauge-center{
  position:absolute;
  left:50%;
  top:62%;
  transform:translate(-50%, -50%);
  text-align:center;
  width:100%;
}

#gaugeVenta{
  font-size:34px;
  font-weight:800;
  color:#6f6a63;
}

#gaugeMeta{
  display:block;
  margin-top:8px;
  color:var(--muted);
  font-size:13px;
}

/* =========================
MOBILE / DESKTOP TOGGLE
========================= */

.mobile-only{
  display:none !important;
}

.desktop-only{
  display:block !important;
}

/* =========================
MOBILE RANKING
========================= */

.mobile-card{
  padding:22px;
}

.mobile-card-header{
  margin-bottom:18px;
}

.mobile-card-header h3{
  font-size:22px;
  text-transform:uppercase;
  letter-spacing:.7px;
  font-weight:900;
  color:#3f3f46;
}

.mobile-card-header p{
  margin-top:5px;
  font-size:17px;
  color:var(--muted);
}

.ranking-list{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.ranking-item{
  border:1px solid var(--line);
  border-radius:18px;
  padding:20px;
  background:#fffdf8;
}

.ranking-top{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:flex-start;
  margin-bottom:12px;
}

.ranking-name{
  font-size:18px;
  font-weight:900;
  color:#111827;
  line-height:1.25;
  max-width:55%;
}

.ranking-value{
  font-size:18px;
  font-weight:900;
  color:#111827;
  text-align:right;
  max-width:45%;
  line-height:1.2;
}

.ranking-bar{
  width:100%;
  height:12px;
  background:#eee6db;
  border-radius:999px;
  overflow:hidden;
}

.ranking-fill{
  height:100%;
  background:#1f2aa3;
  border-radius:999px;
}

.ranking-sub{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-top:12px;
  font-size:15px;
  color:var(--muted);
}

.ranking-pill{
  font-size:14px;
  font-weight:800;
  background:#f1ece4;
  color:#111827;
  padding:6px 10px;
  border-radius:999px;
  white-space:nowrap;
}

.ranking-positive{
  background:#dcfce7;
  color:#166534;
}

.ranking-negative{
  background:#fee2e2;
  color:#991b1b;
}

/* =========================
TABLET
========================= */

@media(max-width:1200px){

  .shell{
    grid-template-columns:1fr;
  }

  .sidebar{
    padding:24px;
  }

  .kpis{
    grid-template-columns:repeat(2,1fr);
  }

  .topbar{
    display:block;
  }

  .filters{
    margin-top:18px;
  }

}

/* =========================
MOBILE
========================= */

@media(max-width:700px){

  .desktop-only{
    display:none !important;
  }

  .mobile-only{
    display:block !important;
  }

  .chart-family,
  .chart-vendor{
    display:none !important;
  }

  body{
    background:#f6f1e8;
  }

  .shell{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    min-height:100vh;
  }

  .sidebar{
    width:100% !important;
    max-width:100% !important;
    padding:28px 24px 30px !important;
  }

  .brand{
    justify-content:center;
    text-align:center;
    flex-direction:column;
    gap:14px;
  }

  .logo-container{
    width:106px;
    height:106px;
    border-radius:26px;
  }

  .brand h1{
    font-size:31px;
    letter-spacing:4px;
  }

  .brand p{
    font-size:20px;
  }

  .refresh{
    margin-top:30px;
    padding:17px 16px;
    font-size:17px;
    border-radius:16px;
  }

  .hint{
    font-size:18px;
    margin-top:26px;
    line-height:1.55;
  }

  .status{
    font-size:16px;
    margin-top:22px;
  }

  .main{
    width:100% !important;
    max-width:100% !important;
    padding:26px 18px !important;
  }

  .topbar{
    margin-bottom:26px;
    padding-bottom:26px;
  }

  .topbar h2{
    font-size:34px;
    line-height:1.05;
  }

  .topbar p{
    font-size:21px;
    margin-top:12px;
    line-height:1.18;
  }

  .filters{
    display:grid;
    grid-template-columns:1fr;
    gap:18px;
    margin-top:28px;
  }

  .filters label{
    font-size:17px;
    margin-bottom:10px;
  }

  select{
    width:100%;
    min-width:0;
    font-size:19px;
    padding:15px 18px;
    border-radius:14px;
  }

  /* KPIS UNA COLUMNA PARA QUE NO SE PEGUEN */
  .kpis{
    grid-template-columns:1fr !important;
    gap:18px !important;
    margin-bottom:34px !important;
  }

  .kpi{
    padding:24px 24px !important;
    border-radius:22px !important;
    min-height:118px;
    border-top-width:7px;
  }

  .kpi span{
    font-size:16px !important;
    letter-spacing:.4px;
  }

  .kpi strong{
    font-size:31px !important;
    line-height:1.15;
    white-space:normal !important;
    word-break:normal !important;
  }

  .dashboard-grid{
    width:100% !important;
    max-width:100% !important;
    gap:32px !important;
  }

  .card{
    border-radius:24px !important;
  }

  .chart{
    width:100% !important;
    max-width:100% !important;
    padding:24px 18px !important;
  }

  .chart h3,
  .mobile-card-header h3{
    font-size:23px !important;
    line-height:1.18;
    margin-bottom:12px;
  }

  .chart-line{
    height:420px !important;
    min-height:420px !important;
  }

  .gauge-card{
    width:100% !important;
    max-width:100% !important;
    height:345px !important;
    min-height:345px !important;
    padding:24px 18px !important;
  }

  .gauge-header{
    display:block !important;
    text-align:left;
  }

  .gauge-header h3{
    font-size:23px !important;
    line-height:1.15;
  }

  .gauge-header p{
    font-size:17px !important;
    margin-top:6px;
  }

  #gaugePercent{
    display:block;
    margin-top:12px;
    font-size:36px !important;
    text-align:left !important;
    max-width:none !important;
  }

  .gauge-wrap{
    height:200px !important;
    max-width:100% !important;
    margin-top:4px;
  }

  #gaugeVenta{
    font-size:29px !important;
  }

  #gaugeMeta{
    font-size:15px !important;
  }

  .mobile-card{
    width:100% !important;
    max-width:100% !important;
    padding:24px 18px !important;
  }

  .mobile-card-header p{
    font-size:17px !important;
  }

  .ranking-list{
    gap:20px !important;
  }

  .ranking-item{
    padding:20px 18px !important;
    border-radius:20px !important;
  }

  .ranking-top{
    display:flex !important;
    justify-content:space-between;
    align-items:flex-start;
    gap:14px;
  }

  .ranking-name{
    font-size:18px !important;
    line-height:1.2;
    max-width:52%;
  }

  .ranking-value{
    font-size:18px !important;
    text-align:right;
    max-width:48%;
    white-space:normal !important;
    word-break:normal !important;
  }

  .ranking-bar{
    height:12px !important;
    margin-top:12px;
  }

  .ranking-sub{
    display:flex !important;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    font-size:15px !important;
    margin-top:12px;
  }

  .ranking-pill{
    font-size:14px !important;
    padding:6px 10px !important;
  }

}

/* =========================
MOBILE PEQUEÑO
========================= */

@media(max-width:430px){

  .sidebar{
    padding:26px 22px 28px !important;
  }

  .main{
    padding:24px 16px !important;
  }

  .topbar h2{
    font-size:31px !important;
  }

  .topbar p{
    font-size:19px !important;
  }

  .logo-container{
    width:98px;
    height:98px;
  }

  .brand h1{
    font-size:29px;
  }

  .brand p{
    font-size:18px;
  }

  .kpi{
    min-height:112px;
    padding:22px 20px !important;
  }

  .kpi strong{
    font-size:29px !important;
  }

  .chart-line{
    height:400px !important;
    min-height:400px !important;
  }

  .gauge-card{
    height:335px !important;
    min-height:335px !important;
  }

  #gaugePercent{
    font-size:33px !important;
  }

  #gaugeVenta{
    font-size:27px !important;
  }

  .ranking-top{
    display:grid !important;
    grid-template-columns:1fr;
    gap:8px;
  }

  .ranking-name,
  .ranking-value{
    max-width:100%;
    text-align:left;
  }

  .ranking-value{
    font-size:20px !important;
  }

}