/* =========================================================
   STYLE EXCLUSIU - LIMPIO RESPONSIVE
   ========================================================= */

/* VARIABLES */
:root{
  --marino:#071b33;
  --marino2:#0f3158;
  --beige:#d8c3a5;
  --beige2:#f7efe4;
  --texto:#071b33;
  --gris:#6b7280;
  --linea:rgba(7,27,51,.16);
  --rojo:#991b1b;
  --verde:#22c55e;
}

/* BASE */
*{
  box-sizing:border-box;
}

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

body{
  font-family:Arial, Helvetica, sans-serif;
  background:linear-gradient(135deg,#f8f2e8,#d8c3a5);
  color:var(--texto);
  min-height:100vh;
}

button,
input,
select,
textarea{
  font-family:inherit;
}

a{
  text-decoration:none;
  color:inherit;
}

/* LOGIN */
.login-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.login-card{
  width:100%;
  max-width:1050px;
  min-height:610px;
  background:rgba(255,255,255,.84);
  border:1px solid rgba(255,255,255,.88);
  border-radius:34px;
  overflow:hidden;
  display:grid;
  grid-template-columns:1.05fr .95fr;
  box-shadow:0 22px 60px rgba(7,27,51,.2);
}

.brand-panel{
  background:linear-gradient(160deg,var(--marino),var(--marino2));
  color:var(--beige2);
  padding:50px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  position:relative;
  overflow:hidden;
}

.brand-panel:before{
  content:"";
  position:absolute;
  right:-120px;
  top:-120px;
  width:330px;
  height:330px;
  border-radius:50%;
  border:1px solid rgba(216,195,165,.24);
}

.logo{
  position:relative;
  z-index:1;
}

.logo h1{
  margin:0;
  color:var(--beige);
  font-size:46px;
  letter-spacing:1px;
  line-height:1;
}

.logo p{
  margin:14px 0 0;
  max-width:430px;
  line-height:1.45;
  color:#efe2cf;
  font-size:15px;
}

.login-logo{
  width:320px;
  max-width:100%;
  height:auto;
  display:block;
  margin-bottom:20px;
}

.info-box{
  position:relative;
  z-index:1;
  border:1px solid rgba(216,195,165,.25);
  background:rgba(255,255,255,.06);
  border-radius:18px;
  padding:16px;
  margin-top:12px;
}

.info-box strong{
  color:var(--beige);
  display:block;
  margin-bottom:5px;
}

.info-box span{
  font-size:13px;
  color:#f5ecdf;
}

.login-form{
  padding:50px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.login-form h2{
  margin:0;
  font-size:32px;
  color:var(--marino);
}

.login-form p{
  color:var(--gris);
  margin:8px 0 28px;
  line-height:1.4;
}

/* FORMULARIOS */
label{
  display:block;
  font-size:10px;
  font-weight:bold;
  text-transform:uppercase;
  letter-spacing:.3px;
  margin-bottom:7px;
  color:var(--marino);
  line-height:1.25;
}

input,
select,
textarea{
  width:100%;
  max-width:100%;
  min-width:0;
  padding:6px 8px;
  border:1px solid var(--linea);
  border-radius:8px;
  background:#fffaf3;
  font-size:12px;
  outline:none;
  color:var(--marino);
}

input,
select{
  height:31px;
}

textarea{
  min-height:54px;
  resize:vertical;
}

input:focus,
select:focus,
textarea:focus{
  border-color:var(--marino);
  box-shadow:0 0 0 3px rgba(7,27,51,.08);
  background:white;
}

.field{
  margin-bottom:12px;
  min-width:0;
}

/* BOTONES */
.btn,
.logout{
  display:inline-block;
  border:0;
  border-radius:10px;
  padding:8px 12px;
  background:var(--marino);
  color:var(--beige2);
  font-weight:bold;
  cursor:pointer;
  font-size:12px;
  text-align:center;
  white-space:nowrap;
}

.btn:hover,
.logout:hover{
  background:var(--marino2);
}

.btn.secondary{
  background:var(--beige2);
  color:var(--marino);
  border:1px solid var(--linea);
}

.btn.danger{
  background:var(--rojo);
  color:white;
}

.error{
  margin:0 0 14px;
  background:#fee2e2;
  color:var(--rojo);
  border:1px solid #fca5a5;
  padding:10px;
  border-radius:12px;
  font-size:13px;
  font-weight:bold;
}

.success-message{
  border-color:#86efac;
  color:#166534;
  font-weight:bold;
}

/* SIDEBAR */
.sidebar{
  position:fixed;
  inset:0 auto 0 0;
  width:250px;
  background:var(--marino);
  color:var(--beige2);
  padding:20px 16px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

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

.sidebar-logo{
  width:190px;
  max-width:100%;
  height:auto;
  display:block;
}

.mark{
  width:42px;
  height:42px;
  border-radius:13px;
  background:linear-gradient(135deg,var(--beige),#f1ddbd);
  color:var(--marino);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
}

.brand-small h2{
  margin:0;
  color:var(--beige);
  text-transform:uppercase;
  font-size:19px;
}

.brand-small span{
  font-size:11px;
  color:#d9cbb8;
}

.nav{
  margin-top:24px;
  display:grid;
  gap:8px;
}

.nav a{
  color:#efe2cf;
  padding:10px 11px;
  border-radius:12px;
  display:flex;
  gap:9px;
  background:rgba(255,255,255,.04);
  font-weight:bold;
  font-size:12px;
}

.nav a.active,
.nav a:hover{
  background:rgba(216,195,165,.13);
  color:var(--beige);
}

.nav a.disabled{
  opacity:.45;
  cursor:not-allowed;
}

.user-box{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(216,195,165,.22);
  border-radius:12px;
  padding:10px;
  margin-bottom:10px;
}

.user-box strong{
  display:block;
  color:var(--beige);
}

.user-box span{
  font-size:11px;
  color:#e7d8c2;
}

.logout{
  background:rgba(255,255,255,.06);
  border:1px solid rgba(216,195,165,.25);
  width:100%;
}

/* CONTENIDO */
.main{
  margin-left:250px;
  padding:20px;
  width:calc(100% - 250px);
  max-width:calc(100% - 250px);
  min-width:0;
}

.topline{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
  margin-bottom:16px;
}

.topline h1{
  margin:0;
  font-size:26px;
  color:var(--marino);
}

.topline p{
  margin:5px 0 0;
  color:#6b5c4b;
  font-size:12px;
}

/* TARJETAS Y MÓDULOS */
.metrics{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
}

.modules{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px;
  margin-top:16px;
  margin-bottom:16px;
}

.metric,
.module,
.panel-card{
  background:rgba(255,255,255,.88);
  border:1px solid rgba(255,255,255,.88);
  border-radius:18px;
  box-shadow:0 10px 26px rgba(7,27,51,.08);
  min-width:0;
}

.metric{
  padding:12px;
}

.metric span{
  color:#776653;
  font-size:10px;
  text-transform:uppercase;
  font-weight:bold;
}

.metric strong{
  display:block;
  margin-top:5px;
  font-size:21px;
}

.module{
  padding:18px;
  min-height:220px;
  cursor:pointer;
  transition:.25s;
  overflow:hidden;
  position:relative;
  display:flex;
  flex-direction:column;
}

.module:hover{
  transform:translateY(-3px);
}

.module.disabled{
  opacity:.55;
  cursor:default;
}

.module.disabled:hover{
  transform:none;
}

.module:after{
  content:"";
  position:absolute;
  width:90px;
  height:90px;
  right:-34px;
  top:-34px;
  border-radius:50%;
  background:rgba(216,195,165,.28);
}

.icon{
  width:58px;
  height:58px;
  border-radius:18px;
  background:linear-gradient(145deg,var(--marino),var(--marino2));
  color:var(--beige);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  z-index:1;
  font-weight:bold;
  font-size:24px;
  margin-bottom:10px;
}

.module h3{
  margin:8px 0;
  position:relative;
  z-index:1;
  font-size:22px;
  color:var(--marino);
}

.module p{
  margin:0;
  color:#6b5c4b;
  font-size:14px;
  line-height:1.5;
  position:relative;
  z-index:1;
  flex:1;
}

.tag{
  display:inline-flex;
  align-items:center;
  width:max-content;
  margin-top:18px;
  background:var(--beige2);
  color:#5f4c35;
  border-radius:999px;
  padding:6px 12px;
  font-size:11px;
  font-weight:700;
  position:relative;
  z-index:1;
}

.panel-card{
  margin-top:16px;
  padding:16px;
  width:100%;
  max-width:100%;
  overflow:hidden;
}

.panel-card.no-margin{
  margin-top:0;
}

.panel-card h2{
  margin:0 0 14px;
  font-size:18px;
  color:var(--marino);
}

/* FORMULARIO PARTES */
.form-row{
  display:grid;
  gap:18px 22px;
  width:100%;
  max-width:100%;
  margin-top:18px;
  min-width:0;
}

form .form-row:first-child{
  margin-top:0;
}

.row-main{
  grid-template-columns:1fr 2fr 2fr;
}

.row-time{
  grid-template-columns:1fr 1fr 2fr;
}

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

.form-row > div{
  min-width:0;
  width:100%;
}

.form-row label{
  margin-bottom:8px;
}

.form-row input,
.form-row select{
  margin-top:2px;
}

.form-block{
  margin-top:18px;
  width:100%;
  max-width:100%;
  min-width:0;
}

.checks{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin-top:7px;
}

.check{
  display:flex;
  align-items:center;
  gap:6px;
  padding:5px 8px;
  border:1px solid var(--linea);
  border-radius:8px;
  background:#fffaf3;
  font-size:11px;
  font-weight:bold;
  color:var(--marino);
  min-height:30px;
  min-width:0;
  white-space:normal;
  word-break:break-word;
}

.check input{
  width:13px;
  height:13px;
  padding:0;
  flex:0 0 13px;
}

.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:14px;
}

.filters{
  display:grid;
  grid-template-columns:130px minmax(0,1fr) 160px 120px;
  column-gap:30px;
  row-gap:10px;
  margin-bottom:10px;
  align-items:end;
  width:100%;
  max-width:100%;
}

.filters > div{
  min-width:0;
}

/* TABLAS */
table{
  width:100%;
  border-collapse:collapse;
  background:white;
  border-radius:10px;
  overflow:hidden;
}

th,
td{
  padding:7px 8px;
  border-bottom:1px solid #eee0cc;
  text-align:left;
  font-size:11px;
  vertical-align:top;
}

th{
  background:var(--beige2);
  text-transform:uppercase;
  font-size:9px;
  color:var(--marino);
}

.state{
  border-radius:999px;
  padding:4px 7px;
  font-weight:bold;
  font-size:10px;
  display:inline-block;
}

.ok{
  background:#e7f3e8;
  color:#166534;
}

.warn{
  background:#fef3c7;
  color:#854d0e;
}

.err{
  background:#fee2e2;
  color:#991b1b;
}

/* FOTOS */
.photo-upload{
  margin-top:18px;
}

.photo-help{
  font-size:11px;
  color:#6b5c4b;
  margin-top:4px;
}

.photo-grid{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.photo-thumb{
  width:42px;
  height:42px;
  object-fit:cover;
  border-radius:8px;
  border:1px solid var(--linea);
  background:#fffaf3;
}

.photo-empty{
  color:#6b7280;
  font-size:11px;
}

.photo-input{
  height:auto !important;
  padding:8px !important;
}

/* INTERRUPTOR CONTABILIZADO */
.switch-contable{
  position:relative;
  display:inline-block;
  width:46px;
  height:24px;
}

.switch-contable input{
  opacity:0;
  width:0;
  height:0;
  position:absolute;
}

.slider-contable{
  position:absolute;
  cursor:pointer;
  inset:0;
  background:#d1d5db;
  border-radius:30px;
  transition:.25s;
}

.slider-contable:before{
  content:"";
  position:absolute;
  width:18px;
  height:18px;
  left:3px;
  top:3px;
  background:white;
  border-radius:50%;
  transition:.25s;
  box-shadow:0 1px 4px rgba(0,0,0,.25);
}

.switch-contable input:checked + .slider-contable{
  background:var(--verde);
}

.switch-contable input:checked + .slider-contable:before{
  transform:translateX(22px);
}

/* RESPONSIVE TABLET */
@media(max-width:1200px){
  .metrics,
  .modules{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .row-main{
    grid-template-columns:1fr 2fr 2fr;
  }

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

@media(max-width:900px){
  .row-main,
  .row-time,
  .row-textarea{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

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

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

/* RESPONSIVE MÓVIL */
@media(max-width:780px){
  html,
  body{
    width:100% !important;
    max-width:100% !important;
    overflow-x:hidden !important;
  }

  .login-card{
    grid-template-columns:1fr;
  }

  .login-form,
  .brand-panel{
    padding:28px;
  }

  .sidebar{
    display:none !important;
  }

  .main{
    margin-left:0 !important;
    width:100% !important;
    max-width:100% !important;
    padding:10px !important;
    overflow-x:hidden !important;
  }

  .topline{
    width:100% !important;
    max-width:100% !important;
    flex-direction:column !important;
    align-items:flex-start !important;
    gap:10px !important;
  }

  .topline h1{
    font-size:23px;
  }

  .topline .btn{
    width:100% !important;
  }

  .panel-card{
    width:100% !important;
    max-width:100% !important;
    padding:12px !important;
    overflow:hidden !important;
  }

  .metrics,
  .modules,
  .form-row,
  .row-main,
  .row-time,
  .row-textarea,
  .checks,
  .filters{
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    width:100% !important;
    max-width:100% !important;
    gap:12px !important;
  }

  .form-row > div,
  .filters > div,
  .checks > label,
  .form-block{
    min-width:0 !important;
    width:100% !important;
    max-width:100% !important;
  }

  label{
    display:block !important;
    position:static !important;
    margin-bottom:5px !important;
    line-height:1.2 !important;
  }

  input:not([type="checkbox"]),
  select,
  textarea{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }

  textarea{
    min-height:70px !important;
  }

  .check{
    display:flex !important;
    align-items:center !important;
    gap:8px !important;
    padding:8px !important;
    min-height:40px !important;
    width:100% !important;
    max-width:100% !important;
    overflow:hidden !important;
    white-space:normal !important;
    word-break:break-word !important;
    font-size:12px !important;
    line-height:1.3 !important;
  }

  .check input{
    flex:0 0 16px !important;
    width:16px !important;
    height:16px !important;
  }

 table{
  width:100% !important;
  min-width:900px !important;
  border-collapse:collapse;
  white-space:nowrap !important;
}

.panel-card{
  overflow-x:auto !important;
}

  .photo-thumb{
    width:40px !important;
    height:40px !important;
  }

  .switch-contable{
    display:inline-block !important;
    width:46px !important;
    height:24px !important;
    min-width:46px !important;
    max-width:46px !important;
    margin:0 auto !important;
  }
}
/* FIX cuadro gris móvil en partes */
@media(max-width:780px){

  .form-row,
  .form-row > div,
  .form-block,
  .panel-card,
  form{
    background:transparent !important;
  }

  input,
  select,
  textarea{
    background:#fffaf3 !important;
  }

  .panel-card{
    background:rgba(255,255,255,.88) !important;
  }

}
/* FIX Safari móvil: inputs fecha/hora */
@media(max-width:780px){

  input[type="date"],
  input[type="time"],
  input[type="number"],
  select{
    height:38px !important;
    min-height:38px !important;
    max-height:38px !important;
    line-height:38px !important;
    padding:6px 8px !important;
    appearance:auto !important;
    -webkit-appearance:auto !important;
  }

  input[type="date"]::-webkit-date-and-time-value,
  input[type="time"]::-webkit-date-and-time-value{
    min-height:38px !important;
    height:38px !important;
    line-height:38px !important;
    text-align:left !important;
  }

}
/* FIX iPhone: campos fecha/hora/select gigantes */
@media(max-width:780px){

  input[type="date"],
  input[type="time"],
  select{
    display:block !important;
    width:100% !important;
    height:42px !important;
    min-height:42px !important;
    max-height:42px !important;
    line-height:42px !important;
    padding:6px 10px !important;
    font-size:16px !important;
    border-radius:8px !important;
    background:#fffaf3 !important;
    -webkit-appearance:none !important;
    appearance:none !important;
  }

  input[type="date"]::-webkit-date-and-time-value,
  input[type="time"]::-webkit-date-and-time-value{
    height:42px !important;
    min-height:42px !important;
    line-height:42px !important;
    padding:0 !important;
    margin:0 !important;
    text-align:left !important;
  }

}
/* FIX interruptor contable en móvil */
@media(max-width:780px){

  label.switch-contable{
    position:relative !important;
    display:inline-block !important;
    width:46px !important;
    height:24px !important;
    min-width:46px !important;
    max-width:46px !important;
    margin:0 auto !important;
    padding:0 !important;
    background:transparent !important;
  }

  label.switch-contable input{
    opacity:0 !important;
    width:0 !important;
    height:0 !important;
    position:absolute !important;
  }

  label.switch-contable .slider-contable{
    position:absolute !important;
    inset:0 !important;
  }

}