:root{
  --jc-red:#E31837;
  --jc-dark:#1A1A1A;
  --jc-bg:#FFFFFF;
  --jc-muted:#F3F4F6;
  --jc-border:#E5E7EB;
  --jc-shadow:0 10px 25px rgba(0,0,0,.10);
  --radius:14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter,Roboto,system-ui,-apple-system,Segoe UI,Arial,sans-serif;
  color:var(--jc-dark);
  background:var(--jc-bg);
}

a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}

.container{
  width:100%;
  max-width:1100px;
  margin:0 auto;
  padding:16px;
}

.input{
  width:100%;
  height:48px;
  padding:0 14px;
  border:1px solid var(--jc-border);
  border-radius:12px;
  font-size:16px;
  background:#fff;
  outline:none;
}
.input:focus{
  border-color:rgba(227,24,55,.55);
  box-shadow:0 0 0 3px rgba(227,24,55,.15);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:48px;
  padding:0 18px;
  border-radius:12px;
  border:0;
  cursor:pointer;
  font-weight:600;
  font-size:16px;
}
.btn-primary{
  background:var(--jc-red);
  color:#fff;
}
.btn-primary:active{transform:translateY(1px)}

.card{
  background:#fff;
  border:1px solid var(--jc-border);
  border-radius:var(--radius);
  box-shadow:var(--jc-shadow);
}

.auth-wrap{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px 16px;
  background:
    radial-gradient(circle at top, rgba(227,24,55,.16) 0%, rgba(227,24,55,0) 28%),
    linear-gradient(180deg, #f8f1f2 0%, #fff 62%);
}
.auth-card{
  width:100%;
  max-width:460px;
  padding:28px 24px 22px;
  border:1px solid rgba(227,24,55,.12);
  box-shadow:0 24px 60px rgba(26,26,26,.10);
  position:relative;
  overflow:hidden;
}
.auth-card::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:6px;
  background:linear-gradient(90deg, #B70E19 0%, #E31837 55%, #F24A43 100%);
}
.auth-brand{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  margin-bottom:18px;
  text-align:center;
}
.auth-brand-logo{
  width:min(100%, 280px);
  height:auto;
  filter:drop-shadow(0 14px 22px rgba(183,14,25,.12));
}
.auth-kicker{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(227,24,55,.08);
  color:var(--jc-red);
  font-size:12px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.auth-title{
  margin:0;
  font-size:28px;
  line-height:1.1;
  font-weight:800;
  text-align:center;
}
.auth-subtitle{
  margin:0;
  max-width:320px;
  font-size:14px;
  line-height:1.55;
  color:rgba(26,26,26,.68);
  text-align:center;
}
.auth-form{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-top:20px;
}
.auth-actions{margin-top:6px}
.auth-footnote{
  margin:16px 0 0;
  font-size:12px;
  line-height:1.5;
  text-align:center;
  color:rgba(26,26,26,.58);
}
.auth-credit{
  margin-top:16px;
  padding-top:4px;
}
.alert{
  border-radius:12px;
  padding:12px 14px;
  font-size:14px;
}
.alert-error{
  background:rgba(227,24,55,.10);
  border:1px solid rgba(227,24,55,.35);
  color:var(--jc-dark);
}
.alert-success{
  background:rgba(21,128,61,.10);
  border:1px solid rgba(21,128,61,.30);
  color:var(--jc-dark);
}

.app-topbar{
  position:sticky;
  top:0;
  z-index:30;
  background:#fff;
  border-bottom:1px solid var(--jc-border);
}
.topbar-inner{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.topbar-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.topbar-logo{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.topbar-logo img{width:34px}
.topbar-title{
  font-size:16px;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.icon-button{
  height:48px;
  min-width:48px;
  border:1px solid var(--jc-border);
  background:#fff;
  border-radius:12px;
  cursor:pointer;
  font-size:20px;
  line-height:1;
}
.icon-button:active{transform:translateY(1px)}

.layout{
  display:flex;
  min-height:calc(100vh - 56px);
}

.sidebar{
  position:fixed;
  top:56px;
  left:0;
  width:270px;
  height:calc(100vh - 56px);
  max-height:calc(100vh - 56px);
  background:#fff;
  border-right:1px solid var(--jc-border);
  z-index:40;
  transform:translateX(-100%);
  transition:transform .22s ease;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}
.sidebar-header{
  padding:12px 14px 10px 14px;
  border-bottom:1px solid var(--jc-border);
  flex-shrink:0;
}
.sidebar-user{
  font-weight:700;
  font-size:14px;
}
.sidebar-role{
  margin-top:2px;
  font-size:12px;
  color:rgba(26,26,26,.70);
}
.sidebar-nav{
  padding:8px 10px 18px 10px;
  display:flex;
  flex-direction:column;
  gap:4px;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  scrollbar-gutter:stable;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.sidebar-nav::-webkit-scrollbar{width:8px}
.sidebar-nav::-webkit-scrollbar-thumb{background:rgba(0,0,0,.18);border-radius:999px}
.sidebar-nav::-webkit-scrollbar-track{background:transparent}
.nav-group{display:flex;flex-direction:column}
.nav-group-toggle{
  appearance:none;background:transparent;border:0;
  width:100%;
  margin:10px 8px 4px;
  padding:4px 8px 4px 6px;
  border-radius:10px;
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  cursor:pointer;
  font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;
  color:rgba(26,26,26,.48);
  transition:background .18s ease, color .18s ease;
}
.nav-group-toggle:hover{background:rgba(0,0,0,.05);color:rgba(26,26,26,.72)}
.nav-group-toggle:focus-visible{outline:2px solid var(--jc-red);outline-offset:2px}
.nav-group-label{flex:1 1 auto;text-align:left}
.nav-group-chevron{
  width:18px;height:18px;display:inline-flex;align-items:center;justify-content:center;
  color:inherit;transform:rotate(0deg);transition:transform .2s ease;
}
.nav-group.is-collapsed .nav-group-chevron{transform:rotate(-90deg)}
.nav-group-panel{
  display:flex;flex-direction:column;gap:4px;
  overflow:hidden;
  max-height:5000px;
  transition:max-height .28s ease, opacity .22s ease, margin .22s ease;
  opacity:1;
  will-change:max-height, opacity;
}
.nav-group.is-collapsed .nav-group-panel{
  max-height:0;
  opacity:0;
  pointer-events:none;
  margin:0!important;
}
.nav-group-title{display:none}
.nav-link{
  height:42px;
  min-height:42px;
  display:flex;
  align-items:center;
  padding:0 12px;
  border-radius:12px;
  font-weight:600;
  color:rgba(26,26,26,.85);
}
.nav-link:hover{background:var(--jc-muted)}
.nav-link.active{
  background:rgba(227,24,55,.10);
  color:var(--jc-red);
}
.nav-sep{
  height:1px;
  background:var(--jc-border);
  margin:6px 10px;
}

.sidebar-overlay{
  position:fixed;
  inset:56px 0 0 0;
  background:rgba(0,0,0,.38);
  opacity:0;
  pointer-events:none;
  transition:opacity .22s ease;
  z-index:35;
}

body.sidebar-open .sidebar{transform:translateX(0)}
body.sidebar-open .sidebar-overlay{
  opacity:1;
  pointer-events:auto;
}

.content{
  flex:1;
  padding:16px;
  width:100%;
}

.app-footer{
  padding:18px 16px 22px;
  border-top:1px solid rgba(229,231,235,.9);
  background:linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(248,249,250,1) 100%);
}

.brand-credit{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  text-align:center;
  font-size:15px;
  line-height:1.4;
  color:#5F6773;
}

.brand-credit a{
  color:#B70E19;
  font-weight:500;
  transition:color .18s ease;
}

.brand-credit a:hover{
  color:#8E0F18;
  text-decoration:none;
}

.auth-page .brand-credit{
  margin-bottom:2px;
  font-size:14px;
}

@media (min-width:768px){
  .sidebar{
    position:sticky;
    transform:none;
    top:56px;
  }
  .sidebar-overlay{display:none}
  .content{padding:20px}
}

.page-title{
  margin:0 0 10px 0;
  font-size:20px;
  font-weight:800;
}
.muted{color:rgba(26,26,26,.70)}

select.input{
  appearance:none;
  padding-right:38px;
}

.module-alert{
  margin:14px 0 0;
}

.module-card{
  margin-top:16px;
  padding:16px;
}

.module-card-title{
  margin-bottom:14px;
  font-size:18px;
  font-weight:800;
}

.client-form{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
}

.client-form-span-2{
  grid-column:auto;
}

.client-form-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  justify-content:flex-start;
}

.clients-toolbar{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-bottom:18px;
}

.clients-title{
  margin-bottom:6px;
}

.clients-subtitle{
  margin:0;
  color:rgba(26,26,26,.70);
  font-size:14px;
  line-height:1.5;
}

.clients-new-button{
  width:100%;
}

.clients-filter-form{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
  margin-bottom:6px;
}

.clients-filter-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:flex-end;
}

.clients-reset-button{
  background:#fff;
  color:var(--jc-dark);
  border:1px solid var(--jc-border);
}

.clients-empty-state{
  margin:10px 0 0;
}

.levante-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
  margin-top:14px;
}

.levante-panel{
  border:1px solid var(--jc-border);
  border-radius:16px;
  padding:14px;
  background:#fff;
}

.levante-panel-title{
  margin-bottom:12px;
  font-size:15px;
  font-weight:800;
}

.levante-panel-full{
  margin-top:14px;
}

.levante-form.client-form{
  gap:12px;
}

.levante-detail-table{
  min-width:980px;
}

.levante-detail-table th,
.levante-detail-table td{
  padding:10px 8px;
}

.levante-input{
  height:42px;
  padding:0 12px;
}

.levante-cell-total{
  font-weight:800;
  white-space:nowrap;
}

.levante-detail-actions{
  margin-top:12px;
}

.levante-totals{
  margin-top:14px;
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.levante-totals-item{
  padding:12px;
  border:1px solid var(--jc-border);
  border-radius:14px;
  background:#fff;
}

.levante-totals-item-wide{
  grid-column:span 2;
}

.levante-totals-value{
  margin-top:6px;
  font-size:18px;
  font-weight:900;
}

.table-wrap{
  width:100%;
  overflow-x:auto;
}

.data-table{
  width:100%;
  min-width:760px;
  border-collapse:collapse;
}

.data-table th,
.data-table td{
  padding:12px 10px;
  border-bottom:1px solid var(--jc-border);
  text-align:left;
  font-size:14px;
  vertical-align:top;
}

.data-table th{
  font-size:13px;
  color:rgba(26,26,26,.68);
}

.data-table tbody tr:hover{
  background:rgba(227,24,55,.03);
}

.table-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.table-action-form{
  margin:0;
}

.btn-table-action{
  height:38px;
  padding:0 14px;
  border:1px solid var(--jc-border);
  border-radius:10px;
  background:#fff;
  color:var(--jc-dark);
  font-size:14px;
  font-weight:600;
}

.btn-table-danger{
  border-color:rgba(227,24,55,.28);
  color:var(--jc-red);
}

.auth-page .muted{
  display:inline-block;
  margin-bottom:6px;
  font-size:13px;
  font-weight:600;
  color:rgba(26,26,26,.72);
}

.auth-page .input{
  height:52px;
  border-radius:14px;
  border-color:#E6E0E1;
  background:#FCFCFD;
}

.auth-page .input::placeholder{
  color:rgba(26,26,26,.38);
}

.auth-page .btn-primary{
  height:52px;
  border-radius:14px;
  font-weight:800;
  letter-spacing:.01em;
  background:linear-gradient(180deg, #F03D46 0%, #D71928 100%);
  box-shadow:0 14px 24px rgba(227,24,55,.20);
}

.auth-page .btn-primary:hover{
  filter:brightness(1.02);
}

@media (max-width:480px){
  .auth-card{
    padding:24px 18px 20px;
  }
  .auth-brand-logo{
    width:min(100%, 240px);
  }
  .auth-title{
    font-size:24px;
  }
}

@media (min-width:768px){
  .client-form{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .client-form-span-2{
    grid-column:span 2;
  }

  .clients-toolbar{
    flex-direction:row;
    align-items:flex-start;
    justify-content:space-between;
  }

  .clients-new-button{
    width:auto;
    white-space:nowrap;
  }

  .clients-filter-form{
    grid-template-columns:repeat(3, minmax(0, 1fr));
    align-items:end;
  }

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

  .levante-grid-3{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }

  .levante-totals{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }

  .levante-totals-item-wide{
    grid-column:auto;
  }
}


/* Modal */
.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,15,15,.46);
  display:none;
  align-items:flex-start;
  justify-content:center;
  z-index:90;
  padding:40px 16px 80px;
  overflow-y:auto;
}
.modal-overlay.is-open{
  display:flex;
}
.modal-box{
  width:100%;
  max-width:920px;
  background:#fff;
  border-radius:var(--radius);
  box-shadow:var(--jc-shadow);
  border:1px solid var(--jc-border);
}
.modal-box-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:20px 24px;
  border-bottom:1px solid var(--jc-border);
  gap:16px;
}
.modal-box-title{
  margin:0;
  font-size:18px;
  font-weight:700;
  color:var(--jc-dark);
}
.modal-box-close{
  border:none;
  background:transparent;
  width:36px;
  height:36px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  color:rgba(26,26,26,.65);
  font-size:20px;
  font-weight:600;
}
.modal-box-close:hover{
  background:var(--jc-muted);
  color:var(--jc-dark);
}
.modal-box-body{
  padding:20px 24px 8px;
}
.modal-box-actions{
  padding:16px 24px 24px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  border-top:1px solid var(--jc-border);
  background:rgba(243,244,246,.55);
  border-radius:0 0 var(--radius) var(--radius);
}
@media (max-width:640px){
  .modal-overlay{ padding:8px 0 40px; }
  .modal-box-header{ padding:16px; }
  .modal-box-body{ padding:16px 16px 4px; }
  .modal-box-actions{ padding:14px 16px 18px; }
}

/* Modal Manifiestos (grande) */
.modal-overlay.modal-overlay-manifiestos{
  padding: 24px 16px 60px;
}
.modal-box.modal-box-manifiestos{
  width: 96vw !important;
  max-width: 1500px !important;
  min-width: 0;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
.modal-box.modal-box-manifiestos .modal-box-body{
  padding: 18px 24px 8px;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.modal-box.modal-box-manifiestos .table-scroll{
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--jc-border);
  border-radius: 10px;
  background: #fff;
  margin: 2px 0 6px;
}
.modal-box.modal-box-manifiestos table.manifiestos-detalle-table{
  min-width: 1200px;
  width: 100%;
  table-layout: auto;
}

